Commit 56f1003f authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: mediatek: mt8183-da7219-max98357: use for_each_rtd_codec_dai() macro

Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87h7znjcag.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 89a2870f
...@@ -40,6 +40,7 @@ static int mt8183_da7219_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -40,6 +40,7 @@ static int mt8183_da7219_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai;
unsigned int rate = params_rate(params); unsigned int rate = params_rate(params);
unsigned int mclk_fs_ratio = 256; unsigned int mclk_fs_ratio = 256;
unsigned int mclk_fs = rate * mclk_fs_ratio; unsigned int mclk_fs = rate * mclk_fs_ratio;
...@@ -51,8 +52,7 @@ static int mt8183_da7219_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -51,8 +52,7 @@ static int mt8183_da7219_i2s_hw_params(struct snd_pcm_substream *substream,
if (ret < 0) if (ret < 0)
dev_err(rtd->dev, "failed to set cpu dai sysclk\n"); dev_err(rtd->dev, "failed to set cpu dai sysclk\n");
for (j = 0; j < rtd->num_codecs; j++) { for_each_rtd_codec_dai(rtd, j, codec_dai) {
struct snd_soc_dai *codec_dai = rtd->codec_dais[j];
if (!strcmp(codec_dai->component->name, "da7219.5-001a")) { if (!strcmp(codec_dai->component->name, "da7219.5-001a")) {
ret = snd_soc_dai_set_sysclk(codec_dai, ret = snd_soc_dai_set_sysclk(codec_dai,
...@@ -82,10 +82,10 @@ static int mt8183_da7219_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -82,10 +82,10 @@ static int mt8183_da7219_i2s_hw_params(struct snd_pcm_substream *substream,
static int mt8183_da7219_hw_free(struct snd_pcm_substream *substream) static int mt8183_da7219_hw_free(struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai;
int ret = 0, j; int ret = 0, j;
for (j = 0; j < rtd->num_codecs; j++) { for_each_rtd_codec_dai(rtd, j, codec_dai) {
struct snd_soc_dai *codec_dai = rtd->codec_dais[j];
if (!strcmp(codec_dai->component->name, "da7219.5-001a")) { if (!strcmp(codec_dai->component->name, "da7219.5-001a")) {
ret = snd_soc_dai_set_pll(codec_dai, ret = snd_soc_dai_set_pll(codec_dai,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment