ASoC: rt5670: move set_sysclk to codec level
authorBard Liao <bardliao@realtek.com>
Wed, 28 Jun 2017 07:38:02 +0000 (15:38 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 28 Jun 2017 18:42:03 +0000 (19:42 +0100)
Move set_sysclk to codec level and people can use it at both
codec and dai level.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt5670.c

index 1146a968cb4d5cf633d122bdff0fd4fa715c3280..7fa63ad366ddb686805ec157da10cf5c907c82c5 100644 (file)
@@ -2442,10 +2442,9 @@ static int rt5670_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
        return 0;
 }
 
        return 0;
 }
 
-static int rt5670_set_dai_sysclk(struct snd_soc_dai *dai,
-               int clk_id, unsigned int freq, int dir)
+static int rt5670_set_codec_sysclk(struct snd_soc_dai *dai, int clk_id,
+                                  int source, unsigned int freq, int dir)
 {
 {
-       struct snd_soc_codec *codec = dai->codec;
        struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
        unsigned int reg_val = 0;
 
        struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
        unsigned int reg_val = 0;
 
@@ -2469,7 +2468,7 @@ static int rt5670_set_dai_sysclk(struct snd_soc_dai *dai,
        if (clk_id != RT5670_SCLK_S_RCCLK)
                rt5670->sysclk_src = clk_id;
 
        if (clk_id != RT5670_SCLK_S_RCCLK)
                rt5670->sysclk_src = clk_id;
 
-       dev_dbg(dai->dev, "Sysclk is %dHz and clock id is %d\n", freq, clk_id);
+       dev_dbg(codec->dev, "Sysclk : %dHz clock id : %d\n", freq, clk_id);
 
        return 0;
 }
 
        return 0;
 }
@@ -2721,7 +2720,6 @@ static int rt5670_resume(struct snd_soc_codec *codec)
 static const struct snd_soc_dai_ops rt5670_aif_dai_ops = {
        .hw_params = rt5670_hw_params,
        .set_fmt = rt5670_set_dai_fmt,
 static const struct snd_soc_dai_ops rt5670_aif_dai_ops = {
        .hw_params = rt5670_hw_params,
        .set_fmt = rt5670_set_dai_fmt,
-       .set_sysclk = rt5670_set_dai_sysclk,
        .set_tdm_slot = rt5670_set_tdm_slot,
        .set_pll = rt5670_set_dai_pll,
 };
        .set_tdm_slot = rt5670_set_tdm_slot,
        .set_pll = rt5670_set_dai_pll,
 };
@@ -2774,6 +2772,7 @@ static struct snd_soc_codec_driver soc_codec_dev_rt5670 = {
        .resume = rt5670_resume,
        .set_bias_level = rt5670_set_bias_level,
        .idle_bias_off = true,
        .resume = rt5670_resume,
        .set_bias_level = rt5670_set_bias_level,
        .idle_bias_off = true,
+       .set_sysclk = rt5670_set_codec_sysclk,
        .component_driver = {
                .controls               = rt5670_snd_controls,
                .num_controls           = ARRAY_SIZE(rt5670_snd_controls),
        .component_driver = {
                .controls               = rt5670_snd_controls,
                .num_controls           = ARRAY_SIZE(rt5670_snd_controls),