Skip to content

Commit

Permalink
ASoC: don't use rtd->codec on samsung/bells
Browse files Browse the repository at this point in the history
rtd->codec will be removed soon.
rtd->codec = rtd->codec_dai->codec, thus,
we can use rtd->codec_dai->component instead of it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Kuninori Morimoto authored and Mark Brown committed Dec 5, 2017
1 parent 4fbd8d1 commit f4a2be1
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions sound/soc/samsung/bells.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ static int bells_set_bias_level(struct snd_soc_card *card,
{
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai *codec_dai;
struct snd_soc_codec *codec;
struct snd_soc_component *component;
struct bells_drvdata *bells = card->drvdata;
int ret;

rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name);
codec_dai = rtd->codec_dai;
codec = codec_dai->codec;
component = codec_dai->component;

if (dapm->dev != codec_dai->dev)
return 0;
Expand All @@ -76,15 +76,15 @@ static int bells_set_bias_level(struct snd_soc_card *card,
if (dapm->bias_level != SND_SOC_BIAS_STANDBY)
break;

ret = snd_soc_codec_set_pll(codec, WM5102_FLL1,
ret = snd_soc_component_set_pll(component, WM5102_FLL1,
ARIZONA_FLL_SRC_MCLK1,
MCLK_RATE,
bells->sysclk_rate);
if (ret < 0)
pr_err("Failed to start FLL: %d\n", ret);

if (bells->asyncclk_rate) {
ret = snd_soc_codec_set_pll(codec, WM5102_FLL2,
ret = snd_soc_component_set_pll(component, WM5102_FLL2,
ARIZONA_FLL_SRC_AIF2BCLK,
BCLK2_RATE,
bells->asyncclk_rate);
Expand All @@ -106,27 +106,27 @@ static int bells_set_bias_level_post(struct snd_soc_card *card,
{
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai *codec_dai;
struct snd_soc_codec *codec;
struct snd_soc_component *component;
struct bells_drvdata *bells = card->drvdata;
int ret;

rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name);
codec_dai = rtd->codec_dai;
codec = codec_dai->codec;
component = codec_dai->component;

if (dapm->dev != codec_dai->dev)
return 0;

switch (level) {
case SND_SOC_BIAS_STANDBY:
ret = snd_soc_codec_set_pll(codec, WM5102_FLL1, 0, 0, 0);
ret = snd_soc_component_set_pll(component, WM5102_FLL1, 0, 0, 0);
if (ret < 0) {
pr_err("Failed to stop FLL: %d\n", ret);
return ret;
}

if (bells->asyncclk_rate) {
ret = snd_soc_codec_set_pll(codec, WM5102_FLL2,
ret = snd_soc_component_set_pll(component, WM5102_FLL2,
0, 0, 0);
if (ret < 0) {
pr_err("Failed to stop FLL: %d\n", ret);
Expand All @@ -148,31 +148,31 @@ static int bells_late_probe(struct snd_soc_card *card)
{
struct bells_drvdata *bells = card->drvdata;
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_codec *wm0010;
struct snd_soc_codec *codec;
struct snd_soc_component *wm0010;
struct snd_soc_component *component;
struct snd_soc_dai *aif1_dai;
struct snd_soc_dai *aif2_dai;
struct snd_soc_dai *aif3_dai;
struct snd_soc_dai *wm9081_dai;
int ret;

rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_AP_DSP].name);
wm0010 = rtd->codec;
wm0010 = rtd->codec_dai->component;

rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name);
codec = rtd->codec;
component = rtd->codec_dai->component;
aif1_dai = rtd->codec_dai;

ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_SYSCLK,
ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_SYSCLK,
ARIZONA_CLK_SRC_FLL1,
bells->sysclk_rate,
SND_SOC_CLOCK_IN);
if (ret != 0) {
dev_err(codec->dev, "Failed to set SYSCLK: %d\n", ret);
dev_err(component->dev, "Failed to set SYSCLK: %d\n", ret);
return ret;
}

ret = snd_soc_codec_set_sysclk(wm0010, 0, 0, SYS_MCLK_RATE, 0);
ret = snd_soc_component_set_sysclk(wm0010, 0, 0, SYS_MCLK_RATE, 0);
if (ret != 0) {
dev_err(wm0010->dev, "Failed to set WM0010 clock: %d\n", ret);
return ret;
Expand All @@ -182,20 +182,20 @@ static int bells_late_probe(struct snd_soc_card *card)
if (ret != 0)
dev_err(aif1_dai->dev, "Failed to set AIF1 clock: %d\n", ret);

ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_OPCLK, 0,
ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_OPCLK, 0,
SYS_MCLK_RATE, SND_SOC_CLOCK_OUT);
if (ret != 0)
dev_err(codec->dev, "Failed to set OPCLK: %d\n", ret);
dev_err(component->dev, "Failed to set OPCLK: %d\n", ret);

if (card->num_rtd == DAI_CODEC_CP)
return 0;

ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_ASYNCCLK,
ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_ASYNCCLK,
ARIZONA_CLK_SRC_FLL2,
bells->asyncclk_rate,
SND_SOC_CLOCK_IN);
if (ret != 0) {
dev_err(codec->dev, "Failed to set ASYNCCLK: %d\n", ret);
dev_err(component->dev, "Failed to set ASYNCCLK: %d\n", ret);
return ret;
}

Expand All @@ -221,7 +221,7 @@ static int bells_late_probe(struct snd_soc_card *card)
return ret;
}

ret = snd_soc_codec_set_sysclk(wm9081_dai->codec, WM9081_SYSCLK_MCLK,
ret = snd_soc_component_set_sysclk(wm9081_dai->component, WM9081_SYSCLK_MCLK,
0, SYS_MCLK_RATE, 0);
if (ret != 0) {
dev_err(wm9081_dai->dev, "Failed to set MCLK: %d\n", ret);
Expand Down

0 comments on commit f4a2be1

Please sign in to comment.