On 08/02/2023 10:24, Kiseok Jo wrote: > Previously, sysclk was configured using devicetree and sysclk-id. > Change the method to obtain and use clock information using clk_get. > > Signed-off-by: Kiseok Jo <kiseok.jo@xxxxxxxxxxxxxx> > --- > sound/soc/codecs/sma1303.c | 124 ++++++++++++++++++------------------- > sound/soc/codecs/sma1303.h | 5 -- > 2 files changed, 59 insertions(+), 70 deletions(-) > > diff --git a/sound/soc/codecs/sma1303.c b/sound/soc/codecs/sma1303.c > index 9ae4e3cba3ae..a21cde126906 100644 > --- a/sound/soc/codecs/sma1303.c > +++ b/sound/soc/codecs/sma1303.c > @@ -7,6 +7,7 @@ > // Auther: Gyuhwa Park <gyuhwa.park@xxxxxxxxxxxxxx> > // Kiseok Jo <kiseok.jo@xxxxxxxxxxxxxx> > > +#include <linux/clk.h> > #include <linux/module.h> > #include <linux/moduleparam.h> > #include <linux/kernel.h> > @@ -59,6 +60,7 @@ struct sma1303_pll_match { > struct sma1303_priv { > enum sma1303_type devtype; > struct attribute_group *attr_grp; > + struct clk *mclk; > struct delayed_work check_fault_work; > struct device *dev; > struct kobject *kobj; > @@ -936,27 +938,23 @@ static int sma1303_setup_pll(struct snd_soc_component *component, > dev_dbg(component->dev, "%s : BCLK = %dHz\n", > __func__, bclk); > > - if (sma1303->sys_clk_id == SMA1303_PLL_CLKIN_MCLK) { > - dev_dbg(component->dev, "%s : MCLK is not supported\n", > - __func__); > - } else if (sma1303->sys_clk_id == SMA1303_PLL_CLKIN_BCLK) { > - for (i = 0; i < sma1303->num_of_pll_matches; i++) { > - if (sma1303->pll_matches[i].input_clk == bclk) > - break; > - } > - if (i == sma1303->num_of_pll_matches) { > - dev_dbg(component->dev, "%s : No matching value between pll table and SCK\n", > + for (i = 0; i < sma1303->num_of_pll_matches; i++) { > + if (sma1303->pll_matches[i].input_clk == bclk) > + break; > + } > + if (i == sma1303->num_of_pll_matches) { > + dev_dbg(component->dev, > + "%s : No matching value between pll table and SCK\n", > __func__); > - return -EINVAL; > - } > - > - ret += sma1303_regmap_update_bits(sma1303, > - SMA1303_A2_TOP_MAN1, > - SMA1303_PLL_PD_MASK|SMA1303_PLL_REF_CLK_MASK, > - SMA1303_PLL_OPERATION|SMA1303_PLL_SCK, > - NULL); > + return -EINVAL; > } > > + ret += sma1303_regmap_update_bits(sma1303, > + SMA1303_A2_TOP_MAN1, > + SMA1303_PLL_PD_MASK|SMA1303_PLL_REF_CLK_MASK, > + SMA1303_PLL_OPERATION|SMA1303_PLL_SCK, > + NULL); > + > ret += sma1303_regmap_write(sma1303, > SMA1303_8B_PLL_POST_N, > sma1303->pll_matches[i].post_n); > @@ -999,13 +997,14 @@ static int sma1303_dai_hw_params_amp(struct snd_pcm_substream *substream, > > if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { > > - if (sma1303->sys_clk_id == SMA1303_PLL_CLKIN_MCLK > - || sma1303->sys_clk_id == SMA1303_PLL_CLKIN_BCLK) { > - > + if (IS_ERR(sma1303->mclk)) { > if (sma1303->last_bclk != bclk) { > sma1303_setup_pll(component, bclk); > sma1303->last_bclk = bclk; > } > + } else { > + dev_dbg(component->dev, > + "%s : MCLK is not supported\n", __func__); > } > > switch (params_rate(params)) { > @@ -1175,19 +1174,6 @@ static int sma1303_dai_set_sysclk_amp(struct snd_soc_dai *dai, > struct snd_soc_component *component = dai->component; > struct sma1303_priv *sma1303 = snd_soc_component_get_drvdata(component); > > - switch (clk_id) { > - case SMA1303_EXTERNAL_CLOCK_19_2: > - break; > - case SMA1303_EXTERNAL_CLOCK_24_576: > - break; > - case SMA1303_PLL_CLKIN_MCLK: > - break; > - case SMA1303_PLL_CLKIN_BCLK: > - break; > - default: > - dev_err(component->dev, "Invalid clk id: %d\n", clk_id); > - return -EINVAL; > - } > sma1303->sys_clk_id = clk_id; > return 0; > } > @@ -1570,8 +1556,12 @@ static int sma1303_probe(struct snd_soc_component *component) > { > struct snd_soc_dapm_context *dapm = > snd_soc_component_get_dapm(component); > + struct sma1303_priv *sma1303 = snd_soc_component_get_drvdata(component); > > snd_soc_dapm_sync(dapm); > + sma1303->mclk = devm_clk_get(sma1303->dev, "mclk"); One undocumented property is replaced with another undocumented property. Can't you test your DTS? Best regards, Krzysztof