Commit 7de6b6bc authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: samsung: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer

Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87ftdzir57.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a7ff5268
...@@ -21,8 +21,8 @@ static int arndale_rt5631_hw_params(struct snd_pcm_substream *substream, ...@@ -21,8 +21,8 @@ static int arndale_rt5631_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 *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
int rfs, ret; int rfs, ret;
unsigned long rclk; unsigned long rclk;
...@@ -56,7 +56,7 @@ static int arndale_wm1811_hw_params(struct snd_pcm_substream *substream, ...@@ -56,7 +56,7 @@ static int arndale_wm1811_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 = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
unsigned int rfs, rclk; unsigned int rfs, rclk;
/* Ensure AIF1CLK is >= 3 MHz for optimal performance */ /* Ensure AIF1CLK is >= 3 MHz for optimal performance */
......
...@@ -60,7 +60,7 @@ static int bells_set_bias_level(struct snd_soc_card *card, ...@@ -60,7 +60,7 @@ static int bells_set_bias_level(struct snd_soc_card *card,
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[DAI_DSP_CODEC]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[DAI_DSP_CODEC]);
codec_dai = rtd->codec_dai; codec_dai = asoc_rtd_to_codec(rtd, 0);
component = codec_dai->component; component = codec_dai->component;
if (dapm->dev != codec_dai->dev) if (dapm->dev != codec_dai->dev)
...@@ -106,7 +106,7 @@ static int bells_set_bias_level_post(struct snd_soc_card *card, ...@@ -106,7 +106,7 @@ static int bells_set_bias_level_post(struct snd_soc_card *card,
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[DAI_DSP_CODEC]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[DAI_DSP_CODEC]);
codec_dai = rtd->codec_dai; codec_dai = asoc_rtd_to_codec(rtd, 0);
component = codec_dai->component; component = codec_dai->component;
if (dapm->dev != codec_dai->dev) if (dapm->dev != codec_dai->dev)
...@@ -152,11 +152,11 @@ static int bells_late_probe(struct snd_soc_card *card) ...@@ -152,11 +152,11 @@ static int bells_late_probe(struct snd_soc_card *card)
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[DAI_AP_DSP]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[DAI_AP_DSP]);
wm0010 = rtd->codec_dai->component; wm0010 = asoc_rtd_to_codec(rtd, 0)->component;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[DAI_DSP_CODEC]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[DAI_DSP_CODEC]);
component = rtd->codec_dai->component; component = asoc_rtd_to_codec(rtd, 0)->component;
aif1_dai = rtd->codec_dai; aif1_dai = asoc_rtd_to_codec(rtd, 0);
ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_SYSCLK, ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_SYSCLK,
ARIZONA_CLK_SRC_FLL1, ARIZONA_CLK_SRC_FLL1,
...@@ -195,7 +195,7 @@ static int bells_late_probe(struct snd_soc_card *card) ...@@ -195,7 +195,7 @@ static int bells_late_probe(struct snd_soc_card *card)
} }
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[DAI_CODEC_CP]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[DAI_CODEC_CP]);
aif2_dai = rtd->cpu_dai; aif2_dai = asoc_rtd_to_cpu(rtd, 0);
ret = snd_soc_dai_set_sysclk(aif2_dai, ARIZONA_CLK_ASYNCCLK, 0, 0); ret = snd_soc_dai_set_sysclk(aif2_dai, ARIZONA_CLK_ASYNCCLK, 0, 0);
if (ret != 0) { if (ret != 0) {
...@@ -207,8 +207,8 @@ static int bells_late_probe(struct snd_soc_card *card) ...@@ -207,8 +207,8 @@ static int bells_late_probe(struct snd_soc_card *card)
return 0; return 0;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[DAI_CODEC_SUB]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[DAI_CODEC_SUB]);
aif3_dai = rtd->cpu_dai; aif3_dai = asoc_rtd_to_cpu(rtd, 0);
wm9081_dai = rtd->codec_dai; wm9081_dai = asoc_rtd_to_codec(rtd, 0);
ret = snd_soc_dai_set_sysclk(aif3_dai, ARIZONA_CLK_SYSCLK, 0, 0); ret = snd_soc_dai_set_sysclk(aif3_dai, ARIZONA_CLK_SYSCLK, 0, 0);
if (ret != 0) { if (ret != 0) {
......
...@@ -68,7 +68,7 @@ static int h1940_hw_params(struct snd_pcm_substream *substream, ...@@ -68,7 +68,7 @@ static int h1940_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 *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int div; int div;
int ret; int ret;
unsigned int rate = params_rate(params); unsigned int rate = params_rate(params);
......
...@@ -932,7 +932,7 @@ static int i2s_trigger(struct snd_pcm_substream *substream, ...@@ -932,7 +932,7 @@ static int i2s_trigger(struct snd_pcm_substream *substream,
struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai); struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct i2s_dai *i2s = to_info(rtd->cpu_dai); struct i2s_dai *i2s = to_info(asoc_rtd_to_cpu(rtd, 0));
unsigned long flags; unsigned long flags;
switch (cmd) { switch (cmd) {
......
...@@ -33,8 +33,8 @@ static int jive_hw_params(struct snd_pcm_substream *substream, ...@@ -33,8 +33,8 @@ static int jive_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 = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct s3c_i2sv2_rate_calc div; struct s3c_i2sv2_rate_calc div;
unsigned int clk = 0; unsigned int clk = 0;
int ret = 0; int ret = 0;
......
...@@ -23,7 +23,7 @@ static int littlemill_set_bias_level(struct snd_soc_card *card, ...@@ -23,7 +23,7 @@ static int littlemill_set_bias_level(struct snd_soc_card *card,
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]);
aif1_dai = rtd->codec_dai; aif1_dai = asoc_rtd_to_codec(rtd, 0);
if (dapm->dev != aif1_dai->dev) if (dapm->dev != aif1_dai->dev)
return 0; return 0;
...@@ -70,7 +70,7 @@ static int littlemill_set_bias_level_post(struct snd_soc_card *card, ...@@ -70,7 +70,7 @@ static int littlemill_set_bias_level_post(struct snd_soc_card *card,
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]);
aif1_dai = rtd->codec_dai; aif1_dai = asoc_rtd_to_codec(rtd, 0);
if (dapm->dev != aif1_dai->dev) if (dapm->dev != aif1_dai->dev)
return 0; return 0;
...@@ -105,7 +105,7 @@ static int littlemill_hw_params(struct snd_pcm_substream *substream, ...@@ -105,7 +105,7 @@ static int littlemill_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 = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
int ret; int ret;
sample_rate = params_rate(params); sample_rate = params_rate(params);
...@@ -181,7 +181,7 @@ static int bbclk_ev(struct snd_soc_dapm_widget *w, ...@@ -181,7 +181,7 @@ static int bbclk_ev(struct snd_soc_dapm_widget *w,
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[1]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[1]);
aif2_dai = rtd->cpu_dai; aif2_dai = asoc_rtd_to_cpu(rtd, 0);
switch (event) { switch (event) {
case SND_SOC_DAPM_PRE_PMU: case SND_SOC_DAPM_PRE_PMU:
...@@ -264,11 +264,11 @@ static int littlemill_late_probe(struct snd_soc_card *card) ...@@ -264,11 +264,11 @@ static int littlemill_late_probe(struct snd_soc_card *card)
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]);
component = rtd->codec_dai->component; component = asoc_rtd_to_codec(rtd, 0)->component;
aif1_dai = rtd->codec_dai; aif1_dai = asoc_rtd_to_codec(rtd, 0);
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[1]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[1]);
aif2_dai = rtd->cpu_dai; aif2_dai = asoc_rtd_to_cpu(rtd, 0);
ret = snd_soc_dai_set_sysclk(aif1_dai, WM8994_SYSCLK_MCLK2, ret = snd_soc_dai_set_sysclk(aif1_dai, WM8994_SYSCLK_MCLK2,
32768, SND_SOC_CLOCK_IN); 32768, SND_SOC_CLOCK_IN);
......
...@@ -32,7 +32,7 @@ static struct snd_soc_jack_pin lowland_headset_pins[] = { ...@@ -32,7 +32,7 @@ static struct snd_soc_jack_pin lowland_headset_pins[] = {
static int lowland_wm5100_init(struct snd_soc_pcm_runtime *rtd) static int lowland_wm5100_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_component *component = rtd->codec_dai->component; struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
int ret; int ret;
ret = snd_soc_component_set_sysclk(component, WM5100_CLK_SYSCLK, ret = snd_soc_component_set_sysclk(component, WM5100_CLK_SYSCLK,
...@@ -65,7 +65,7 @@ static int lowland_wm5100_init(struct snd_soc_pcm_runtime *rtd) ...@@ -65,7 +65,7 @@ static int lowland_wm5100_init(struct snd_soc_pcm_runtime *rtd)
static int lowland_wm9081_init(struct snd_soc_pcm_runtime *rtd) static int lowland_wm9081_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_component *component = rtd->codec_dai->component; struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
snd_soc_dapm_nc_pin(&rtd->card->dapm, "LINEOUT"); snd_soc_dapm_nc_pin(&rtd->card->dapm, "LINEOUT");
......
...@@ -26,8 +26,8 @@ static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream, ...@@ -26,8 +26,8 @@ static int neo1973_hifi_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 = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
unsigned int pll_out = 0, bclk = 0; unsigned int pll_out = 0, bclk = 0;
int ret = 0; int ret = 0;
unsigned long iis_clkrate; unsigned long iis_clkrate;
...@@ -100,7 +100,7 @@ static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream, ...@@ -100,7 +100,7 @@ static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream,
static int neo1973_hifi_hw_free(struct snd_pcm_substream *substream) static int neo1973_hifi_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 = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
/* disable the PLL */ /* disable the PLL */
return snd_soc_dai_set_pll(codec_dai, WM8753_PLL1, 0, 0, 0); return snd_soc_dai_set_pll(codec_dai, WM8753_PLL1, 0, 0, 0);
...@@ -118,7 +118,7 @@ static int neo1973_voice_hw_params(struct snd_pcm_substream *substream, ...@@ -118,7 +118,7 @@ static int neo1973_voice_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 = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
unsigned int pcmdiv = 0; unsigned int pcmdiv = 0;
int ret = 0; int ret = 0;
unsigned long iis_clkrate; unsigned long iis_clkrate;
...@@ -155,7 +155,7 @@ static int neo1973_voice_hw_params(struct snd_pcm_substream *substream, ...@@ -155,7 +155,7 @@ static int neo1973_voice_hw_params(struct snd_pcm_substream *substream,
static int neo1973_voice_hw_free(struct snd_pcm_substream *substream) static int neo1973_voice_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 = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
/* disable the PLL */ /* disable the PLL */
return snd_soc_dai_set_pll(codec_dai, WM8753_PLL2, 0, 0, 0); return snd_soc_dai_set_pll(codec_dai, WM8753_PLL2, 0, 0, 0);
......
...@@ -98,7 +98,7 @@ static int odroid_card_be_hw_params(struct snd_pcm_substream *substream, ...@@ -98,7 +98,7 @@ static int odroid_card_be_hw_params(struct snd_pcm_substream *substream,
return ret; return ret;
if (rtd->num_codecs > 1) { if (rtd->num_codecs > 1) {
struct snd_soc_dai *codec_dai = rtd->codec_dais[1]; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 1);
ret = snd_soc_dai_set_sysclk(codec_dai, 0, rclk_freq, ret = snd_soc_dai_set_sysclk(codec_dai, 0, rclk_freq,
SND_SOC_CLOCK_IN); SND_SOC_CLOCK_IN);
......
...@@ -212,7 +212,7 @@ static int s3c_pcm_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -212,7 +212,7 @@ static int s3c_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(rtd->cpu_dai); struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0));
unsigned long flags; unsigned long flags;
dev_dbg(pcm->dev, "Entered %s\n", __func__); dev_dbg(pcm->dev, "Entered %s\n", __func__);
...@@ -256,7 +256,7 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -256,7 +256,7 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *socdai) struct snd_soc_dai *socdai)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(rtd->cpu_dai); struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0));
void __iomem *regs = pcm->regs; void __iomem *regs = pcm->regs;
struct clk *clk; struct clk *clk;
int sclk_div, sync_div; int sclk_div, sync_div;
......
...@@ -149,7 +149,7 @@ static int rx1950_hw_params(struct snd_pcm_substream *substream, ...@@ -149,7 +149,7 @@ static int rx1950_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 *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int div; int div;
int ret; int ret;
unsigned int rate = params_rate(params); unsigned int rate = params_rate(params);
......
...@@ -380,7 +380,7 @@ static int s3c2412_i2s_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -380,7 +380,7 @@ static int s3c2412_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct s3c_i2sv2_info *i2s = to_info(rtd->cpu_dai); struct s3c_i2sv2_info *i2s = to_info(asoc_rtd_to_cpu(rtd, 0));
int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
unsigned long irqs; unsigned long irqs;
int ret = 0; int ret = 0;
......
...@@ -160,8 +160,8 @@ static int simtec_hw_params(struct snd_pcm_substream *substream, ...@@ -160,8 +160,8 @@ static int simtec_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 = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int ret; int ret;
ret = snd_soc_dai_set_sysclk(codec_dai, 0, ret = snd_soc_dai_set_sysclk(codec_dai, 0,
......
...@@ -51,7 +51,7 @@ static int s3c24xx_uda134x_startup(struct snd_pcm_substream *substream) ...@@ -51,7 +51,7 @@ static int s3c24xx_uda134x_startup(struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct s3c24xx_uda134x *priv = snd_soc_card_get_drvdata(rtd->card); struct s3c24xx_uda134x *priv = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int ret = 0; int ret = 0;
mutex_lock(&priv->clk_lock); mutex_lock(&priv->clk_lock);
...@@ -119,8 +119,8 @@ static int s3c24xx_uda134x_hw_params(struct snd_pcm_substream *substream, ...@@ -119,8 +119,8 @@ static int s3c24xx_uda134x_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 = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
unsigned int clk = 0; unsigned int clk = 0;
int ret = 0; int ret = 0;
int clk_source, fs_mode; int clk_source, fs_mode;
......
...@@ -25,8 +25,8 @@ static int smartq_hifi_hw_params(struct snd_pcm_substream *substream, ...@@ -25,8 +25,8 @@ static int smartq_hifi_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 = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
unsigned int clk = 0; unsigned int clk = 0;
int ret; int ret;
......
...@@ -101,7 +101,7 @@ static int smdk_hw_params(struct snd_pcm_substream *substream, ...@@ -101,7 +101,7 @@ static int smdk_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 *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
unsigned long pll_out, rclk_rate; unsigned long pll_out, rclk_rate;
int ret, ratio; int ret, ratio;
......
...@@ -23,7 +23,7 @@ static int smdk_hw_params(struct snd_pcm_substream *substream, ...@@ -23,7 +23,7 @@ static int smdk_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 = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
unsigned int pll_out; unsigned int pll_out;
int rfs, ret; int rfs, ret;
......
...@@ -45,7 +45,7 @@ static int smdk_hw_params(struct snd_pcm_substream *substream, ...@@ -45,7 +45,7 @@ static int smdk_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 = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
unsigned int pll_out; unsigned int pll_out;
int ret; int ret;
......
...@@ -44,8 +44,8 @@ static int smdk_wm8994_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -44,8 +44,8 @@ static int smdk_wm8994_pcm_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 = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
unsigned long mclk_freq; unsigned long mclk_freq;
int rfs, ret; int rfs, ret;
......
...@@ -110,9 +110,9 @@ static int snow_late_probe(struct snd_soc_card *card) ...@@ -110,9 +110,9 @@ static int snow_late_probe(struct snd_soc_card *card)
/* In the multi-codec case codec_dais 0 is MAX98095 and 1 is HDMI. */ /* In the multi-codec case codec_dais 0 is MAX98095 and 1 is HDMI. */
if (rtd->num_codecs > 1) if (rtd->num_codecs > 1)
codec_dai = rtd->codec_dais[0]; codec_dai = asoc_rtd_to_codec(rtd, 0);
else else
codec_dai = rtd->codec_dai; codec_dai = asoc_rtd_to_codec(rtd, 0);
/* Set the MCLK rate for the codec */ /* Set the MCLK rate for the codec */
return snd_soc_dai_set_sysclk(codec_dai, 0, return snd_soc_dai_set_sysclk(codec_dai, 0,
......
...@@ -142,7 +142,7 @@ static int spdif_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -142,7 +142,7 @@ static int spdif_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct samsung_spdif_info *spdif = to_info(rtd->cpu_dai); struct samsung_spdif_info *spdif = to_info(asoc_rtd_to_cpu(rtd, 0));
unsigned long flags; unsigned long flags;
dev_dbg(spdif->dev, "Entered %s\n", __func__); dev_dbg(spdif->dev, "Entered %s\n", __func__);
...@@ -178,7 +178,7 @@ static int spdif_hw_params(struct snd_pcm_substream *substream, ...@@ -178,7 +178,7 @@ static int spdif_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *socdai) struct snd_soc_dai *socdai)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct samsung_spdif_info *spdif = to_info(rtd->cpu_dai); struct samsung_spdif_info *spdif = to_info(asoc_rtd_to_cpu(rtd, 0));
void __iomem *regs = spdif->regs; void __iomem *regs = spdif->regs;
struct snd_dmaengine_dai_dma_data *dma_data; struct snd_dmaengine_dai_dma_data *dma_data;
u32 con, clkcon, cstas; u32 con, clkcon, cstas;
...@@ -194,7 +194,7 @@ static int spdif_hw_params(struct snd_pcm_substream *substream, ...@@ -194,7 +194,7 @@ static int spdif_hw_params(struct snd_pcm_substream *substream,
return -EINVAL; return -EINVAL;
} }
snd_soc_dai_set_dma_data(rtd->cpu_dai, substream, dma_data); snd_soc_dai_set_dma_data(asoc_rtd_to_cpu(rtd, 0), substream, dma_data);
spin_lock_irqsave(&spdif->lock, flags); spin_lock_irqsave(&spdif->lock, flags);
...@@ -280,7 +280,7 @@ static void spdif_shutdown(struct snd_pcm_substream *substream, ...@@ -280,7 +280,7 @@ static void spdif_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct samsung_spdif_info *spdif = to_info(rtd->cpu_dai); struct samsung_spdif_info *spdif = to_info(asoc_rtd_to_cpu(rtd, 0));
void __iomem *regs = spdif->regs; void __iomem *regs = spdif->regs;
u32 con, clkcon; u32 con, clkcon;
......
...@@ -25,7 +25,7 @@ static int speyside_set_bias_level(struct snd_soc_card *card, ...@@ -25,7 +25,7 @@ static int speyside_set_bias_level(struct snd_soc_card *card,
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[1]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[1]);
codec_dai = rtd->codec_dai; codec_dai = asoc_rtd_to_codec(rtd, 0);
if (dapm->dev != codec_dai->dev) if (dapm->dev != codec_dai->dev)
return 0; return 0;
...@@ -61,7 +61,7 @@ static int speyside_set_bias_level_post(struct snd_soc_card *card, ...@@ -61,7 +61,7 @@ static int speyside_set_bias_level_post(struct snd_soc_card *card,
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[1]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[1]);
codec_dai = rtd->codec_dai; codec_dai = asoc_rtd_to_codec(rtd, 0);
if (dapm->dev != codec_dai->dev) if (dapm->dev != codec_dai->dev)
return 0; return 0;
...@@ -131,7 +131,7 @@ static void speyside_set_polarity(struct snd_soc_component *component, ...@@ -131,7 +131,7 @@ static void speyside_set_polarity(struct snd_soc_component *component,
static int speyside_wm0010_init(struct snd_soc_pcm_runtime *rtd) static int speyside_wm0010_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dai *dai = rtd->codec_dai; struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
int ret; int ret;
ret = snd_soc_dai_set_sysclk(dai, 0, MCLK_AUDIO_RATE, 0); ret = snd_soc_dai_set_sysclk(dai, 0, MCLK_AUDIO_RATE, 0);
...@@ -143,7 +143,7 @@ static int speyside_wm0010_init(struct snd_soc_pcm_runtime *rtd) ...@@ -143,7 +143,7 @@ static int speyside_wm0010_init(struct snd_soc_pcm_runtime *rtd)
static int speyside_wm8996_init(struct snd_soc_pcm_runtime *rtd) static int speyside_wm8996_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dai *dai = rtd->codec_dai; struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_component *component = dai->component; struct snd_soc_component *component = dai->component;
int ret; int ret;
......
...@@ -93,7 +93,7 @@ static int tm2_aif1_hw_params(struct snd_pcm_substream *substream, ...@@ -93,7 +93,7 @@ static int tm2_aif1_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_component *component = rtd->codec_dai->component; struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
struct tm2_machine_priv *priv = snd_soc_card_get_drvdata(rtd->card); struct tm2_machine_priv *priv = snd_soc_card_get_drvdata(rtd->card);
switch (params_rate(params)) { switch (params_rate(params)) {
...@@ -134,7 +134,7 @@ static int tm2_aif2_hw_params(struct snd_pcm_substream *substream, ...@@ -134,7 +134,7 @@ static int tm2_aif2_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_component *component = rtd->codec_dai->component; struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
unsigned int asyncclk_rate; unsigned int asyncclk_rate;
int ret; int ret;
...@@ -188,7 +188,7 @@ static int tm2_aif2_hw_params(struct snd_pcm_substream *substream, ...@@ -188,7 +188,7 @@ static int tm2_aif2_hw_params(struct snd_pcm_substream *substream,
static int tm2_aif2_hw_free(struct snd_pcm_substream *substream) static int tm2_aif2_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_component *component = rtd->codec_dai->component; struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
int ret; int ret;
/* disable FLL2 */ /* disable FLL2 */
...@@ -209,7 +209,7 @@ static int tm2_hdmi_hw_params(struct snd_pcm_substream *substream, ...@@ -209,7 +209,7 @@ static int tm2_hdmi_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 *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
unsigned int bfs; unsigned int bfs;
int bitwidth, ret; int bitwidth, ret;
...@@ -284,7 +284,7 @@ static int tm2_set_bias_level(struct snd_soc_card *card, ...@@ -284,7 +284,7 @@ static int tm2_set_bias_level(struct snd_soc_card *card,
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]);
if (dapm->dev != rtd->codec_dai->dev) if (dapm->dev != asoc_rtd_to_codec(rtd, 0)->dev)
return 0; return 0;
switch (level) { switch (level) {
...@@ -315,8 +315,8 @@ static int tm2_late_probe(struct snd_soc_card *card) ...@@ -315,8 +315,8 @@ static int tm2_late_probe(struct snd_soc_card *card)
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[TM2_DAI_AIF1]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[TM2_DAI_AIF1]);
aif1_dai = rtd->codec_dai; aif1_dai = asoc_rtd_to_codec(rtd, 0);
priv->component = rtd->codec_dai->component; priv->component = asoc_rtd_to_codec(rtd, 0)->component;
ret = snd_soc_dai_set_sysclk(aif1_dai, ARIZONA_CLK_SYSCLK, 0, 0); ret = snd_soc_dai_set_sysclk(aif1_dai, ARIZONA_CLK_SYSCLK, 0, 0);
if (ret < 0) { if (ret < 0) {
...@@ -325,7 +325,7 @@ static int tm2_late_probe(struct snd_soc_card *card) ...@@ -325,7 +325,7 @@ static int tm2_late_probe(struct snd_soc_card *card)
} }
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[TM2_DAI_AIF2]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[TM2_DAI_AIF2]);
aif2_dai = rtd->codec_dai; aif2_dai = asoc_rtd_to_codec(rtd, 0);
ret = snd_soc_dai_set_sysclk(aif2_dai, ARIZONA_CLK_ASYNCCLK, 0, 0); ret = snd_soc_dai_set_sysclk(aif2_dai, ARIZONA_CLK_ASYNCCLK, 0, 0);
if (ret < 0) { if (ret < 0) {
......
...@@ -23,7 +23,7 @@ static int tobermory_set_bias_level(struct snd_soc_card *card, ...@@ -23,7 +23,7 @@ static int tobermory_set_bias_level(struct snd_soc_card *card,
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]);
codec_dai = rtd->codec_dai; codec_dai = asoc_rtd_to_codec(rtd, 0);
if (dapm->dev != codec_dai->dev) if (dapm->dev != codec_dai->dev)
return 0; return 0;
...@@ -66,7 +66,7 @@ static int tobermory_set_bias_level_post(struct snd_soc_card *card, ...@@ -66,7 +66,7 @@ static int tobermory_set_bias_level_post(struct snd_soc_card *card,
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]);
codec_dai = rtd->codec_dai; codec_dai = asoc_rtd_to_codec(rtd, 0);
if (dapm->dev != codec_dai->dev) if (dapm->dev != codec_dai->dev)
return 0; return 0;
...@@ -181,8 +181,8 @@ static int tobermory_late_probe(struct snd_soc_card *card) ...@@ -181,8 +181,8 @@ static int tobermory_late_probe(struct snd_soc_card *card)
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]);
component = rtd->codec_dai->component; component = asoc_rtd_to_codec(rtd, 0)->component;
codec_dai = rtd->codec_dai; codec_dai = asoc_rtd_to_codec(rtd, 0);
ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK, ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK,
32768, SND_SOC_CLOCK_IN); 32768, SND_SOC_CLOCK_IN);
......
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