ASoC: intel: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 23 Mar 2020 05:19:05 +0000 (14:19 +0900)
committerMark Brown <broonie@kernel.org>
Fri, 27 Mar 2020 14:44:38 +0000 (14:44 +0000)
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87r1xjir7a.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
34 files changed:
sound/soc/intel/atom/sst-mfld-platform-pcm.c
sound/soc/intel/boards/bdw-rt5650.c
sound/soc/intel/boards/bdw-rt5677.c
sound/soc/intel/boards/broadwell.c
sound/soc/intel/boards/bxt_da7219_max98357a.c
sound/soc/intel/boards/bxt_rt298.c
sound/soc/intel/boards/byt-max98090.c
sound/soc/intel/boards/byt-rt5640.c
sound/soc/intel/boards/bytcht_cx2072x.c
sound/soc/intel/boards/bytcht_da7213.c
sound/soc/intel/boards/bytcht_es8316.c
sound/soc/intel/boards/bytcht_nocodec.c
sound/soc/intel/boards/bytcr_rt5640.c
sound/soc/intel/boards/bytcr_rt5651.c
sound/soc/intel/boards/cht_bsw_max98090_ti.c
sound/soc/intel/boards/cht_bsw_nau8824.c
sound/soc/intel/boards/cht_bsw_rt5645.c
sound/soc/intel/boards/cht_bsw_rt5672.c
sound/soc/intel/boards/cml_rt1011_rt5682.c
sound/soc/intel/boards/glk_rt5682_max98357a.c
sound/soc/intel/boards/haswell.c
sound/soc/intel/boards/kbl_da7219_max98357a.c
sound/soc/intel/boards/kbl_da7219_max98927.c
sound/soc/intel/boards/kbl_rt5660.c
sound/soc/intel/boards/kbl_rt5663_max98927.c
sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
sound/soc/intel/boards/skl_nau88l25_max98357a.c
sound/soc/intel/boards/skl_nau88l25_ssm4567.c
sound/soc/intel/boards/skl_rt286.c
sound/soc/intel/boards/sof_da7219_max98373.c
sound/soc/intel/boards/sof_pcm512x.c
sound/soc/intel/boards/sof_rt5682.c
sound/soc/intel/haswell/sst-haswell-pcm.c
sound/soc/intel/skylake/skl-pcm.c

index 340bd2b..82f2b63 100644 (file)
@@ -649,7 +649,7 @@ static snd_pcm_uframes_t sst_soc_pointer(struct snd_soc_component *component,
 static int sst_soc_pcm_new(struct snd_soc_component *component,
                           struct snd_soc_pcm_runtime *rtd)
 {
-       struct snd_soc_dai *dai = rtd->cpu_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_cpu(rtd, 0);
        struct snd_pcm *pcm = rtd->pcm;
 
        if (dai->driver->playback.channels_min ||
@@ -741,7 +741,7 @@ static int sst_soc_prepare(struct device *dev)
 
        /* set the SSPs to idle */
        for_each_card_rtds(drv->soc_card, rtd) {
-               struct snd_soc_dai *dai = rtd->cpu_dai;
+               struct snd_soc_dai *dai = asoc_rtd_to_cpu(rtd, 0);
 
                if (dai->active) {
                        send_ssp_cmd(dai, dai->name, 0);
@@ -762,7 +762,7 @@ static void sst_soc_complete(struct device *dev)
 
        /* restart SSPs */
        for_each_card_rtds(drv->soc_card, rtd) {
-               struct snd_soc_dai *dai = rtd->cpu_dai;
+               struct snd_soc_dai *dai = asoc_rtd_to_cpu(rtd, 0);
 
                if (dai->active) {
                        sst_handle_vb_timer(dai, true);
index 058abf3..53ca3d8 100644 (file)
@@ -107,7 +107,7 @@ static int bdw_rt5650_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        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;
 
        /* Workaround: set codec PLL to 19.2MHz that PLL source is
@@ -166,8 +166,8 @@ static int bdw_rt5650_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct bdw_rt5650_priv *bdw_rt5650 =
                snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_component *component = rtd->codec_dai->component;
-       struct snd_soc_dai *codec_dai = rtd->codec_dai;
+       struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
+       struct snd_soc_component *component = codec_dai->component;
        int ret;
 
        /* Enable codec ASRC function for Stereo DAC/Stereo1 ADC/DMIC/I2S1.
index a94f498..06a5396 100644 (file)
@@ -157,7 +157,7 @@ static int bdw_rt5677_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        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;
 
        ret = snd_soc_dai_set_sysclk(codec_dai, RT5677_SCLK_S_MCLK, 24576000,
@@ -174,7 +174,7 @@ static int bdw_rt5677_dsp_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        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;
 
        ret = snd_soc_dai_set_sysclk(codec_dai, RT5677_SCLK_S_PLL1, 24576000,
@@ -226,7 +226,7 @@ static int bdw_rt5677_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct bdw_rt5677_priv *bdw_rt5677 =
                        snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_component *component = rtd->codec_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
        struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
        int ret;
 
index 2517800..8318914 100644 (file)
@@ -70,7 +70,7 @@ static const struct snd_soc_dapm_route broadwell_rt286_map[] = {
 
 static int broadwell_rt286_codec_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 = 0;
        ret = snd_soc_card_jack_new(rtd->card, "Headset",
                SND_JACK_HEADSET | SND_JACK_BTN_0, &broadwell_headset,
@@ -104,7 +104,7 @@ static int broadwell_rt286_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        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;
 
        ret = snd_soc_dai_set_sysclk(codec_dai, RT286_SCLK_S_PLL, 24000000,
index 0614622..44016c1 100644 (file)
@@ -179,8 +179,8 @@ static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
 static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
        int ret;
-       struct snd_soc_dai *codec_dai = rtd->codec_dai;
-       struct snd_soc_component *component = rtd->codec_dai->component;
+       struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
+       struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
        int clk_freq;
 
        /* Configure sysclk for codec */
@@ -226,7 +226,7 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
 static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct bxt_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct bxt_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -244,7 +244,7 @@ static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 static int broxton_da7219_fe_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct snd_soc_dapm_context *dapm;
-       struct snd_soc_component *component = rtd->cpu_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_cpu(rtd, 0)->component;
 
        dapm = snd_soc_component_get_dapm(component);
        snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
index 4b5e7f6..7a4decf 100644 (file)
@@ -155,7 +155,7 @@ static const struct snd_soc_dapm_route geminilake_rt298_map[] = {
 static int broxton_rt298_fe_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct snd_soc_dapm_context *dapm;
-       struct snd_soc_component *component = rtd->cpu_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_cpu(rtd, 0)->component;
 
        dapm = snd_soc_component_get_dapm(component);
        snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
@@ -165,7 +165,7 @@ static int broxton_rt298_fe_init(struct snd_soc_pcm_runtime *rtd)
 
 static int broxton_rt298_codec_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 = 0;
 
        ret = snd_soc_card_jack_new(rtd->card, "Headset",
@@ -186,7 +186,7 @@ static int broxton_rt298_codec_init(struct snd_soc_pcm_runtime *rtd)
 static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct bxt_rt286_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct bxt_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -225,7 +225,7 @@ static int broxton_rt298_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        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;
 
        ret = snd_soc_dai_set_sysclk(codec_dai, RT298_SCLK_S_PLL,
index 01739ad..f5097da 100644 (file)
@@ -89,7 +89,7 @@ static int byt_max98090_init(struct snd_soc_pcm_runtime *runtime)
 
        card->dapm.idle_bias_off = true;
 
-       ret = snd_soc_dai_set_sysclk(runtime->codec_dai,
+       ret = snd_soc_dai_set_sysclk(asoc_rtd_to_codec(runtime, 0),
                                     M98090_REG_SYSTEM_CLOCK,
                                     25000000, SND_SOC_CLOCK_IN);
        if (ret < 0) {
index 0c76daf..ace232f 100644 (file)
@@ -73,7 +73,7 @@ static int byt_rt5640_hw_params(struct snd_pcm_substream *substream,
                                struct snd_pcm_hw_params *params)
 {
        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;
 
        ret = snd_soc_dai_set_sysclk(codec_dai, RT5640_SCLK_S_PLL1,
@@ -123,7 +123,7 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
 static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
 {
        int ret;
-       struct snd_soc_component *component = runtime->codec_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_codec(runtime, 0)->component;
        struct snd_soc_card *card = runtime->card;
        const struct snd_soc_dapm_route *custom_map;
        int num_routes;
index 67f06c9..3b3df7c 100644 (file)
@@ -70,7 +70,7 @@ static const struct acpi_gpio_mapping byt_cht_cx2072x_acpi_gpios[] = {
 static int byt_cht_cx2072x_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct snd_soc_card *card = rtd->card;
-       struct snd_soc_component *codec = rtd->codec_dai->component;
+       struct snd_soc_component *codec = asoc_rtd_to_codec(rtd, 0)->component;
        int ret;
 
        if (devm_acpi_dev_add_driver_gpios(codec->dev,
@@ -80,7 +80,7 @@ static int byt_cht_cx2072x_init(struct snd_soc_pcm_runtime *rtd)
        card->dapm.idle_bias_off = true;
 
        /* set the default PLL rate, the clock is handled by the codec driver */
-       ret = snd_soc_dai_set_sysclk(rtd->codec_dai, CX2072X_MCLK_EXTERNAL_PLL,
+       ret = snd_soc_dai_set_sysclk(asoc_rtd_to_codec(rtd, 0), CX2072X_MCLK_EXTERNAL_PLL,
                                     19200000, SND_SOC_CLOCK_IN);
        if (ret) {
                dev_err(rtd->dev, "Could not set sysclk\n");
@@ -97,7 +97,7 @@ static int byt_cht_cx2072x_init(struct snd_soc_pcm_runtime *rtd)
 
        snd_soc_component_set_jack(codec, &byt_cht_cx2072x_headset, NULL);
 
-       snd_soc_dai_set_bclk_ratio(rtd->codec_dai, 50);
+       snd_soc_dai_set_bclk_ratio(asoc_rtd_to_codec(rtd, 0), 50);
 
        return ret;
 }
@@ -123,7 +123,7 @@ static int byt_cht_cx2072x_fixup(struct snd_soc_pcm_runtime *rtd,
         * with explicit setting to I2S 2ch 24-bit. The word length is set with
         * dai_set_tdm_slot() since there is no other API exposed
         */
-       ret = snd_soc_dai_set_fmt(rtd->cpu_dai,
+       ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0),
                                SND_SOC_DAIFMT_I2S     |
                                SND_SOC_DAIFMT_NB_NF   |
                                SND_SOC_DAIFMT_CBS_CFS);
@@ -132,7 +132,7 @@ static int byt_cht_cx2072x_fixup(struct snd_soc_pcm_runtime *rtd,
                return ret;
        }
 
-       ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, 24);
+       ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2, 24);
        if (ret < 0) {
                dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
                return ret;
index d6b912c..5e96e7d 100644 (file)
@@ -78,7 +78,7 @@ static int codec_fixup(struct snd_soc_pcm_runtime *rtd,
         * with explicit setting to I2S 2ch 24-bit. The word length is set with
         * dai_set_tdm_slot() since there is no other API exposed
         */
-       ret = snd_soc_dai_set_fmt(rtd->cpu_dai,
+       ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0),
                                  SND_SOC_DAIFMT_I2S     |
                                  SND_SOC_DAIFMT_NB_NF   |
                                  SND_SOC_DAIFMT_CBS_CFS);
@@ -87,7 +87,7 @@ static int codec_fixup(struct snd_soc_pcm_runtime *rtd,
                return ret;
        }
 
-       ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, 24);
+       ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2, 24);
        if (ret < 0) {
                dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
                return ret;
@@ -106,7 +106,7 @@ static int aif1_hw_params(struct snd_pcm_substream *substream,
                          struct snd_pcm_hw_params *params)
 {
        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;
 
        ret = snd_soc_dai_set_sysclk(codec_dai, DA7213_CLKSRC_MCLK,
@@ -127,7 +127,7 @@ static int aif1_hw_params(struct snd_pcm_substream *substream,
 static int aif1_hw_free(struct snd_pcm_substream *substream)
 {
        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;
 
        ret = snd_soc_dai_set_pll(codec_dai, 0,
index 0adc5a5..ddcd070 100644 (file)
@@ -157,7 +157,7 @@ static struct snd_soc_jack_pin byt_cht_es8316_jack_pins[] = {
 
 static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime)
 {
-       struct snd_soc_component *codec = runtime->codec_dai->component;
+       struct snd_soc_component *codec = asoc_rtd_to_codec(runtime, 0)->component;
        struct snd_soc_card *card = runtime->card;
        struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
        const struct snd_soc_dapm_route *custom_map;
@@ -212,7 +212,7 @@ static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime)
        if (ret)
                dev_err(card->dev, "unable to enable MCLK\n");
 
-       ret = snd_soc_dai_set_sysclk(runtime->codec_dai, 0, 19200000,
+       ret = snd_soc_dai_set_sysclk(asoc_rtd_to_codec(runtime, 0), 0, 19200000,
                                     SND_SOC_CLOCK_IN);
        if (ret < 0) {
                dev_err(card->dev, "can't set codec clock %d\n", ret);
@@ -262,7 +262,7 @@ static int byt_cht_es8316_codec_fixup(struct snd_soc_pcm_runtime *rtd,
         * with explicit setting to I2S 2ch 24-bit. The word length is set with
         * dai_set_tdm_slot() since there is no other API exposed
         */
-       ret = snd_soc_dai_set_fmt(rtd->cpu_dai,
+       ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0),
                                SND_SOC_DAIFMT_I2S     |
                                SND_SOC_DAIFMT_NB_NF   |
                                SND_SOC_DAIFMT_CBS_CFS
@@ -272,7 +272,7 @@ static int byt_cht_es8316_codec_fixup(struct snd_soc_pcm_runtime *rtd,
                return ret;
        }
 
-       ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, bits);
+       ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2, bits);
        if (ret < 0) {
                dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
                return ret;
index 479af80..8c0dab1 100644 (file)
@@ -58,7 +58,7 @@ static int codec_fixup(struct snd_soc_pcm_runtime *rtd,
         * with explicit setting to I2S 2ch 24-bit. The word length is set with
         * dai_set_tdm_slot() since there is no other API exposed
         */
-       ret = snd_soc_dai_set_fmt(rtd->cpu_dai,
+       ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0),
                                  SND_SOC_DAIFMT_I2S     |
                                  SND_SOC_DAIFMT_NB_NF   |
                                  SND_SOC_DAIFMT_CBS_CFS);
@@ -68,7 +68,7 @@ static int codec_fixup(struct snd_soc_pcm_runtime *rtd,
                return ret;
        }
 
-       ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, 24);
+       ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2, 24);
        if (ret < 0) {
                dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
                return ret;
index 6bd9ae8..33fb8ea 100644 (file)
@@ -381,7 +381,7 @@ static int byt_rt5640_aif1_hw_params(struct snd_pcm_substream *substream,
                                        struct snd_pcm_hw_params *params)
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
 
        return byt_rt5640_prepare_and_enable_pll1(dai, params_rate(params));
 }
@@ -805,7 +805,7 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
 {
        struct snd_soc_card *card = runtime->card;
        struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
-       struct snd_soc_component *component = runtime->codec_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_codec(runtime, 0)->component;
        const struct snd_soc_dapm_route *custom_map;
        int num_routes;
        int ret;
@@ -962,7 +962,7 @@ static int byt_rt5640_codec_fixup(struct snd_soc_pcm_runtime *rtd,
         * with explicit setting to I2S 2ch. The word length is set with
         * dai_set_tdm_slot() since there is no other API exposed
         */
-       ret = snd_soc_dai_set_fmt(rtd->cpu_dai,
+       ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0),
                                  SND_SOC_DAIFMT_I2S     |
                                  SND_SOC_DAIFMT_NB_NF   |
                                  SND_SOC_DAIFMT_CBS_CFS);
@@ -971,7 +971,7 @@ static int byt_rt5640_codec_fixup(struct snd_soc_pcm_runtime *rtd,
                return ret;
        }
 
-       ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, bits);
+       ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2, bits);
        if (ret < 0) {
                dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
                return ret;
index 5074bb5..214ef41 100644 (file)
@@ -348,7 +348,7 @@ static int byt_rt5651_aif1_hw_params(struct snd_pcm_substream *substream,
                                        struct snd_pcm_hw_params *params)
 {
        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);
        snd_pcm_format_t format = params_format(params);
        int rate = params_rate(params);
        int bclk_ratio;
@@ -540,7 +540,7 @@ static int byt_rt5651_add_codec_device_props(struct device *i2c_dev)
 static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
 {
        struct snd_soc_card *card = runtime->card;
-       struct snd_soc_component *codec = runtime->codec_dai->component;
+       struct snd_soc_component *codec = asoc_rtd_to_codec(runtime, 0)->component;
        struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
        const struct snd_soc_dapm_route *custom_map;
        int num_routes;
@@ -685,7 +685,7 @@ static int byt_rt5651_codec_fixup(struct snd_soc_pcm_runtime *rtd,
         * with explicit setting to I2S 2ch. The word length is set with
         * dai_set_tdm_slot() since there is no other API exposed
         */
-       ret = snd_soc_dai_set_fmt(rtd->cpu_dai,
+       ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0),
                                  SND_SOC_DAIFMT_I2S     |
                                  SND_SOC_DAIFMT_NB_NF   |
                                  SND_SOC_DAIFMT_CBS_CFS
@@ -696,7 +696,7 @@ static int byt_rt5651_codec_fixup(struct snd_soc_pcm_runtime *rtd,
                return ret;
        }
 
-       ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, bits);
+       ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2, bits);
        if (ret < 0) {
                dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
                return ret;
index ea119d5..1357017 100644 (file)
@@ -113,7 +113,7 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream,
                             struct snd_pcm_hw_params *params)
 {
        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;
 
        ret = snd_soc_dai_set_sysclk(codec_dai, M98090_REG_SYSTEM_CLOCK,
@@ -257,7 +257,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
        int ret = 0;
        unsigned int fmt = 0;
 
-       ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, 16);
+       ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2, 16);
        if (ret < 0) {
                dev_err(rtd->dev, "can't set cpu_dai slot fmt: %d\n", ret);
                return ret;
@@ -266,7 +266,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
        fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
                                | SND_SOC_DAIFMT_CBS_CFS;
 
-       ret = snd_soc_dai_set_fmt(rtd->cpu_dai, fmt);
+       ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0), fmt);
        if (ret < 0) {
                dev_err(rtd->dev, "can't set cpu_dai set fmt: %d\n", ret);
                return ret;
index 34d4e17..f456150 100644 (file)
@@ -73,7 +73,7 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        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;
 
        ret = snd_soc_dai_set_sysclk(codec_dai, NAU8824_CLK_FLL_FS, 0,
@@ -96,7 +96,7 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
 {
        struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
        struct snd_soc_jack *jack = &ctx->jack;
-       struct snd_soc_dai *codec_dai = runtime->codec_dai;
+       struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(runtime, 0);
        struct snd_soc_component *component = codec_dai->component;
        int ret, jack_type;
 
index 452691d..e64eca5 100644 (file)
@@ -208,7 +208,7 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream,
                             struct snd_pcm_hw_params *params)
 {
        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;
 
        /* set codec PLL source to the 19.2MHz platform clock (MCLK) */
@@ -252,7 +252,7 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
 {
        struct snd_soc_card *card = runtime->card;
        struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
-       struct snd_soc_component *component = runtime->codec_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_codec(runtime, 0)->component;
        int jack_type;
        int ret;
 
@@ -359,7 +359,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
                 * with explicit setting to I2S 2ch 16-bit. The word length is set with
                 * dai_set_tdm_slot() since there is no other API exposed
                 */
-               ret = snd_soc_dai_set_fmt(rtd->cpu_dai,
+               ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0),
                                        SND_SOC_DAIFMT_I2S     |
                                        SND_SOC_DAIFMT_NB_NF   |
                                        SND_SOC_DAIFMT_CBS_CFS
@@ -369,7 +369,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
                        return ret;
                }
 
-               ret = snd_soc_dai_set_fmt(rtd->codec_dai,
+               ret = snd_soc_dai_set_fmt(asoc_rtd_to_codec(rtd, 0),
                                        SND_SOC_DAIFMT_I2S     |
                                        SND_SOC_DAIFMT_NB_NF   |
                                        SND_SOC_DAIFMT_CBS_CFS
@@ -379,7 +379,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
                        return ret;
                }
 
-               ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, 16);
+               ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2, 16);
                if (ret < 0) {
                        dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
                        return ret;
@@ -393,7 +393,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
                /*
                 * Default mode for SSP configuration is TDM 4 slot
                 */
-               ret = snd_soc_dai_set_fmt(rtd->codec_dai,
+               ret = snd_soc_dai_set_fmt(asoc_rtd_to_codec(rtd, 0),
                                        SND_SOC_DAIFMT_DSP_B |
                                        SND_SOC_DAIFMT_IB_NF |
                                        SND_SOC_DAIFMT_CBS_CFS);
@@ -403,7 +403,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
                }
 
                /* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */
-               ret = snd_soc_dai_set_tdm_slot(rtd->codec_dai, 0xF, 0xF, 4, 24);
+               ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_codec(rtd, 0), 0xF, 0xF, 4, 24);
                if (ret < 0) {
                        dev_err(rtd->dev, "can't set codec TDM slot %d\n", ret);
                        return ret;
index 9d65742..097023a 100644 (file)
@@ -144,7 +144,7 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream,
                                        struct snd_pcm_hw_params *params)
 {
        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;
 
        /* set codec PLL source to the 19.2MHz platform clock (MCLK) */
@@ -176,7 +176,7 @@ static const struct acpi_gpio_mapping cht_rt5672_gpios[] = {
 static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
 {
        int ret;
-       struct snd_soc_dai *codec_dai = runtime->codec_dai;
+       struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(runtime, 0);
        struct snd_soc_component *component = codec_dai->component;
        struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
 
@@ -255,7 +255,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
        /*
         * Default mode for SSP configuration is TDM 4 slot
         */
-       ret = snd_soc_dai_set_fmt(rtd->codec_dai,
+       ret = snd_soc_dai_set_fmt(asoc_rtd_to_codec(rtd, 0),
                                  SND_SOC_DAIFMT_DSP_B |
                                  SND_SOC_DAIFMT_IB_NF |
                                  SND_SOC_DAIFMT_CBS_CFS);
@@ -265,7 +265,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
        }
 
        /* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */
-       ret = snd_soc_dai_set_tdm_slot(rtd->codec_dai, 0xF, 0xF, 4, 24);
+       ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_codec(rtd, 0), 0xF, 0xF, 4, 24);
        if (ret < 0) {
                dev_err(rtd->dev, "can't set codec TDM slot %d\n", ret);
                return ret;
index ed6c26a..8167b29 100644 (file)
@@ -85,7 +85,7 @@ static const struct snd_soc_dapm_route cml_rt1011_rt5682_map[] = {
 static int cml_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_component *component = rtd->codec_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
        struct snd_soc_jack *jack;
        int ret;
 
@@ -125,7 +125,7 @@ static int cml_rt5682_hw_params(struct snd_pcm_substream *substream,
                                struct snd_pcm_hw_params *params)
 {
        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 clk_id, clk_freq, pll_out, ret;
 
        clk_id = RT5682_PLL1_S_MCLK;
@@ -274,7 +274,7 @@ static int sof_card_late_probe(struct snd_soc_card *card)
 static int hdmi_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
index 3c576b3..f13158e 100644 (file)
@@ -136,8 +136,8 @@ static int geminilake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
 static int geminilake_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct glk_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_component *component = rtd->codec_dai->component;
-       struct snd_soc_dai *codec_dai = rtd->codec_dai;
+       struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
+       struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
        struct snd_soc_jack *jack;
        int ret;
 
@@ -188,7 +188,7 @@ static int geminilake_rt5682_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        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;
 
        /* Set valid bitmask & configuration for I2S in 24 bit */
@@ -208,7 +208,7 @@ static struct snd_soc_ops geminilake_rt5682_ops = {
 static int geminilake_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct glk_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct glk_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -225,7 +225,7 @@ static int geminilake_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 
 static int geminilake_rt5682_fe_init(struct snd_soc_pcm_runtime *rtd)
 {
-       struct snd_soc_component *component = rtd->cpu_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_cpu(rtd, 0)->component;
        struct snd_soc_dapm_context *dapm;
        int ret;
 
index 6589fa5..3ed53d7 100644 (file)
@@ -56,7 +56,7 @@ static int haswell_rt5640_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        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;
 
        ret = snd_soc_dai_set_sysclk(codec_dai, RT5640_SCLK_S_MCLK, 12288000,
index bc7f9a9..32cd90b 100644 (file)
@@ -159,8 +159,8 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
 static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_component *component = rtd->codec_dai->component;
-       struct snd_soc_dai *codec_dai = rtd->codec_dai;
+       struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
+       struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
        struct snd_soc_jack *jack;
        int ret;
 
@@ -203,7 +203,7 @@ static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
 static int kabylake_hdmi_init(struct snd_soc_pcm_runtime *rtd, int device)
 {
        struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct kbl_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -236,7 +236,7 @@ static int kabylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
 static int kabylake_da7219_fe_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct snd_soc_dapm_context *dapm;
-       struct snd_soc_component *component = rtd->cpu_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_cpu(rtd, 0)->component;
 
        dapm = snd_soc_component_get_dapm(component);
        snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
index 0ceb174..abd4e38 100644 (file)
@@ -331,7 +331,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
 static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_component *component = rtd->codec_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
        struct snd_soc_jack *jack;
        struct snd_soc_card *card = rtd->card;
        int ret;
@@ -381,7 +381,7 @@ static int kabylake_dmic_init(struct snd_soc_pcm_runtime *rtd)
 static int kabylake_hdmi_init(struct snd_soc_pcm_runtime *rtd, int device)
 {
        struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct kbl_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -414,7 +414,7 @@ static int kabylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
 static int kabylake_da7219_fe_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct snd_soc_dapm_context *dapm;
-       struct snd_soc_component *component = rtd->cpu_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_cpu(rtd, 0)->component;
 
        dapm = snd_soc_component_get_dapm(component);
        snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
index e23dea9..6460e3f 100644 (file)
@@ -157,7 +157,7 @@ static int kabylake_rt5660_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
        int ret;
        struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_component *component = rtd->codec_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
        struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
 
        ret = devm_acpi_dev_add_driver_gpios(component->dev, acpi_rt5660_gpios);
@@ -210,7 +210,7 @@ static int kabylake_rt5660_codec_init(struct snd_soc_pcm_runtime *rtd)
 static int kabylake_hdmi_init(struct snd_soc_pcm_runtime *rtd, int device)
 {
        struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct kbl_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -244,7 +244,7 @@ static int kabylake_rt5660_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        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;
 
        ret = snd_soc_dai_set_sysclk(codec_dai,
index 20d566e..658a9da 100644 (file)
@@ -242,7 +242,7 @@ static int kabylake_rt5663_fe_init(struct snd_soc_pcm_runtime *rtd)
 {
        int ret;
        struct snd_soc_dapm_context *dapm;
-       struct snd_soc_component *component = rtd->cpu_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_cpu(rtd, 0)->component;
 
        dapm = snd_soc_component_get_dapm(component);
        ret = snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
@@ -258,7 +258,7 @@ static int kabylake_rt5663_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
        int ret;
        struct kbl_rt5663_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_component *component = rtd->codec_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
        struct snd_soc_jack *jack;
 
        /*
@@ -305,7 +305,7 @@ static int kabylake_rt5663_max98927_codec_init(struct snd_soc_pcm_runtime *rtd)
 static int kabylake_hdmi_init(struct snd_soc_pcm_runtime *rtd, int device)
 {
        struct kbl_rt5663_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct kbl_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -431,7 +431,7 @@ static int kabylake_rt5663_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        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;
 
        /* use ASRC for internal clocks, as PLL rate isn't multiple of BCLK */
index 6493ede..1b1f8d7 100644 (file)
@@ -206,7 +206,7 @@ static struct snd_soc_codec_conf max98927_codec_conf[] = {
 static int kabylake_rt5663_fe_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct snd_soc_dapm_context *dapm;
-       struct snd_soc_component *component = rtd->cpu_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_cpu(rtd, 0)->component;
        int ret;
 
        dapm = snd_soc_component_get_dapm(component);
@@ -221,7 +221,7 @@ static int kabylake_rt5663_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
        int ret;
        struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_component *component = rtd->codec_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
        struct snd_soc_jack *jack;
 
        /*
@@ -255,7 +255,7 @@ static int kabylake_rt5663_codec_init(struct snd_soc_pcm_runtime *rtd)
 static int kabylake_hdmi_init(struct snd_soc_pcm_runtime *rtd, int device)
 {
        struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct kbl_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -372,7 +372,7 @@ static int kabylake_rt5663_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        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;
 
        /* use ASRC for internal clocks, as PLL rate isn't multiple of BCLK */
index 8216c15..d7b8154 100644 (file)
@@ -157,7 +157,7 @@ static int skylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
 static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
        int ret;
-       struct snd_soc_component *component = rtd->codec_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
 
        /*
         * Headset buttons map to the google Reference headset.
@@ -182,7 +182,7 @@ static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)
 static int skylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct skl_nau8825_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct skl_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -200,7 +200,7 @@ static int skylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
 static int skylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct skl_nau8825_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct skl_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -218,7 +218,7 @@ static int skylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
 static int skylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct skl_nau8825_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct skl_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -236,7 +236,7 @@ static int skylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
 static int skylake_nau8825_fe_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct snd_soc_dapm_context *dapm;
-       struct snd_soc_component *component = rtd->cpu_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_cpu(rtd, 0)->component;
 
        dapm = snd_soc_component_get_dapm(component);
        snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
@@ -296,7 +296,7 @@ static int skylake_nau8825_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        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;
 
        ret = snd_soc_dai_set_sysclk(codec_dai,
index 40f8eb5..4b317bc 100644 (file)
@@ -161,12 +161,12 @@ static int skylake_ssm4567_codec_init(struct snd_soc_pcm_runtime *rtd)
        int ret;
 
        /* Slot 1 for left */
-       ret = snd_soc_dai_set_tdm_slot(rtd->codec_dais[0], 0x01, 0x01, 2, 48);
+       ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_codec(rtd, 0), 0x01, 0x01, 2, 48);
        if (ret < 0)
                return ret;
 
        /* Slot 2 for right */
-       ret = snd_soc_dai_set_tdm_slot(rtd->codec_dais[1], 0x02, 0x02, 2, 48);
+       ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_codec(rtd, 1), 0x02, 0x02, 2, 48);
        if (ret < 0)
                return ret;
 
@@ -176,7 +176,7 @@ static int skylake_ssm4567_codec_init(struct snd_soc_pcm_runtime *rtd)
 static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
        int ret;
-       struct snd_soc_component *component = rtd->codec_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
 
        /*
         * 4 buttons here map to the google Reference headset
@@ -201,7 +201,7 @@ static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)
 static int skylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct skl_nau88125_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct skl_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -219,7 +219,7 @@ static int skylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
 static int skylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct skl_nau88125_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct skl_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -238,7 +238,7 @@ static int skylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
 static int skylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct skl_nau88125_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct skl_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -256,7 +256,7 @@ static int skylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
 static int skylake_nau8825_fe_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct snd_soc_dapm_context *dapm;
-       struct snd_soc_component *component = rtd->cpu_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_cpu(rtd, 0)->component;
 
        dapm = snd_soc_component_get_dapm(component);
        snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
@@ -348,7 +348,7 @@ static int skylake_nau8825_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        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;
 
        ret = snd_soc_dai_set_sysclk(codec_dai,
index a9aec66..903ae1b 100644 (file)
@@ -112,7 +112,7 @@ static const struct snd_soc_dapm_route skylake_rt286_map[] = {
 static int skylake_rt286_fe_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct snd_soc_dapm_context *dapm;
-       struct snd_soc_component *component = rtd->cpu_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_cpu(rtd, 0)->component;
 
        dapm = snd_soc_component_get_dapm(component);
        snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
@@ -122,7 +122,7 @@ static int skylake_rt286_fe_init(struct snd_soc_pcm_runtime *rtd)
 
 static int skylake_rt286_codec_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;
 
        ret = snd_soc_card_jack_new(rtd->card, "Headset",
@@ -143,7 +143,7 @@ static int skylake_rt286_codec_init(struct snd_soc_pcm_runtime *rtd)
 static int skylake_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct skl_rt286_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct skl_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -229,7 +229,7 @@ static int skylake_rt286_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
        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;
 
        ret = snd_soc_dai_set_sysclk(codec_dai, RT286_SCLK_S_PLL, 24000000,
index 239d8ff..b707dd3 100644 (file)
@@ -129,8 +129,8 @@ static struct snd_soc_jack headset;
 
 static int da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
-       struct snd_soc_component *component = rtd->codec_dai->component;
-       struct snd_soc_dai *codec_dai = rtd->codec_dai;
+       struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
+       struct snd_soc_component *component = codec_dai->component;
        struct snd_soc_jack *jack;
        int ret;
 
@@ -173,7 +173,7 @@ static int ssp1_hw_params(struct snd_pcm_substream *substream,
        int ret, j;
 
        for (j = 0; j < runtime->num_codecs; j++) {
-               struct snd_soc_dai *codec_dai = runtime->codec_dais[j];
+               struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(runtime, j);
 
                if (!strcmp(codec_dai->component->name, MAXIM_DEV0_NAME)) {
                        /* vmon_slot_no = 0 imon_slot_no = 1 for TX slots */
@@ -214,7 +214,7 @@ static struct snd_soc_codec_conf max98373_codec_conf[] = {
 static int hdmi_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
index 4ce707b..fb78118 100644 (file)
@@ -66,7 +66,7 @@ static const struct dmi_system_id sof_pcm512x_quirk_table[] = {
 static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct sof_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -84,7 +84,7 @@ static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 
 static int sof_pcm512x_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
-       struct snd_soc_component *codec = rtd->codec_dai->component;
+       struct snd_soc_component *codec = asoc_rtd_to_codec(rtd, 0)->component;
 
        snd_soc_component_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08);
        snd_soc_component_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02);
@@ -97,7 +97,7 @@ static int sof_pcm512x_codec_init(struct snd_soc_pcm_runtime *rtd)
 static int aif1_startup(struct snd_pcm_substream *substream)
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
-       struct snd_soc_component *codec = rtd->codec_dai->component;
+       struct snd_soc_component *codec = asoc_rtd_to_codec(rtd, 0)->component;
 
        snd_soc_component_update_bits(codec, PCM512x_GPIO_CONTROL_1,
                                      0x08, 0x08);
@@ -108,7 +108,7 @@ static int aif1_startup(struct snd_pcm_substream *substream)
 static void aif1_shutdown(struct snd_pcm_substream *substream)
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
-       struct snd_soc_component *codec = rtd->codec_dai->component;
+       struct snd_soc_component *codec = asoc_rtd_to_codec(rtd, 0)->component;
 
        snd_soc_component_update_bits(codec, PCM512x_GPIO_CONTROL_1,
                                      0x08, 0x00);
index 2eeaa14..8c29431 100644 (file)
@@ -124,7 +124,7 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = {
 static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *dai = rtd->codec_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
        struct sof_hdmi_pcm *pcm;
 
        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
@@ -143,7 +143,7 @@ static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 static int sof_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_component *component = rtd->codec_dai->component;
+       struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
        struct snd_soc_jack *jack;
        int ret;
 
@@ -211,7 +211,7 @@ static int sof_rt5682_hw_params(struct snd_pcm_substream *substream,
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
-       struct snd_soc_dai *codec_dai = rtd->codec_dai;
+       struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
        int clk_id, clk_freq, pll_out, ret;
 
        if (sof_rt5682_quirk & SOF_RT5682_MCLK_EN) {
index 033d7c0..c183f8e 100644 (file)
@@ -476,7 +476,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component,
        u8 channels;
        int ret, dai;
 
-       dai = mod_map[rtd->cpu_dai->id].dai_id;
+       dai = mod_map[asoc_rtd_to_cpu(rtd, 0)->id].dai_id;
        pcm_data = &pdata->pcm[dai][substream->stream];
 
        /* check if we are being called a subsequent time */
@@ -494,7 +494,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component,
                }
                pcm_data->allocated = false;
 
-               pcm_data->stream = sst_hsw_stream_new(hsw, rtd->cpu_dai->id,
+               pcm_data->stream = sst_hsw_stream_new(hsw, asoc_rtd_to_cpu(rtd, 0)->id,
                        hsw_notify_pointer, pcm_data);
                if (pcm_data->stream == NULL) {
                        dev_err(rtd->dev, "error: failed to create stream\n");
@@ -509,7 +509,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component,
                path_id = SST_HSW_STREAM_PATH_SSP0_IN;
 
        /* DSP stream type depends on DAI ID */
-       switch (rtd->cpu_dai->id) {
+       switch (asoc_rtd_to_cpu(rtd, 0)->id) {
        case 0:
                if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
                        stream_type = SST_HSW_STREAM_TYPE_SYSTEM;
@@ -533,7 +533,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component,
                break;
        default:
                dev_err(rtd->dev, "error: invalid DAI ID %d\n",
-                       rtd->cpu_dai->id);
+                       asoc_rtd_to_cpu(rtd, 0)->id);
                return -EINVAL;
        }
 
@@ -595,7 +595,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component,
        dmab = snd_pcm_get_dma_buf(substream);
 
        ret = create_adsp_page_table(substream, pdata, rtd, runtime->dma_area,
-               runtime->dma_bytes, rtd->cpu_dai->id);
+               runtime->dma_bytes, asoc_rtd_to_cpu(rtd, 0)->id);
        if (ret < 0)
                return ret;
 
@@ -608,7 +608,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component,
                pages = runtime->dma_bytes / PAGE_SIZE;
 
        ret = sst_hsw_stream_buffer(hsw, pcm_data->stream,
-               pdata->dmab[rtd->cpu_dai->id][substream->stream].addr,
+               pdata->dmab[asoc_rtd_to_cpu(rtd, 0)->id][substream->stream].addr,
                pages, runtime->dma_bytes, 0,
                snd_sgbuf_get_addr(dmab, 0) >> PAGE_SHIFT);
        if (ret < 0) {
@@ -661,7 +661,7 @@ static int hsw_pcm_trigger(struct snd_soc_component *component,
        snd_pcm_uframes_t pos;
        int dai;
 
-       dai = mod_map[rtd->cpu_dai->id].dai_id;
+       dai = mod_map[asoc_rtd_to_cpu(rtd, 0)->id].dai_id;
        pcm_data = &pdata->pcm[dai][substream->stream];
        sst_stream = pcm_data->stream;
 
@@ -770,7 +770,7 @@ static snd_pcm_uframes_t hsw_pcm_pointer(struct snd_soc_component *component,
        u32 position;
        int dai;
 
-       dai = mod_map[rtd->cpu_dai->id].dai_id;
+       dai = mod_map[asoc_rtd_to_cpu(rtd, 0)->id].dai_id;
        pcm_data = &pdata->pcm[dai][substream->stream];
        position = sst_hsw_get_dsp_position(hsw, pcm_data->stream);
 
@@ -791,7 +791,7 @@ static int hsw_pcm_open(struct snd_soc_component *component,
        struct sst_hsw *hsw = pdata->hsw;
        int dai;
 
-       dai = mod_map[rtd->cpu_dai->id].dai_id;
+       dai = mod_map[asoc_rtd_to_cpu(rtd, 0)->id].dai_id;
        pcm_data = &pdata->pcm[dai][substream->stream];
 
        mutex_lock(&pcm_data->mutex);
@@ -801,7 +801,7 @@ static int hsw_pcm_open(struct snd_soc_component *component,
 
        snd_soc_set_runtime_hwparams(substream, &hsw_pcm_hardware);
 
-       pcm_data->stream = sst_hsw_stream_new(hsw, rtd->cpu_dai->id,
+       pcm_data->stream = sst_hsw_stream_new(hsw, asoc_rtd_to_cpu(rtd, 0)->id,
                hsw_notify_pointer, pcm_data);
        if (pcm_data->stream == NULL) {
                dev_err(rtd->dev, "error: failed to create stream\n");
@@ -824,7 +824,7 @@ static int hsw_pcm_close(struct snd_soc_component *component,
        struct sst_hsw *hsw = pdata->hsw;
        int ret, dai;
 
-       dai = mod_map[rtd->cpu_dai->id].dai_id;
+       dai = mod_map[asoc_rtd_to_cpu(rtd, 0)->id].dai_id;
        pcm_data = &pdata->pcm[dai][substream->stream];
 
        mutex_lock(&pcm_data->mutex);
@@ -923,9 +923,9 @@ static int hsw_pcm_new(struct snd_soc_component *component,
                        hsw_pcm_hardware.buffer_bytes_max);
        }
        if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream)
-               priv_data->pcm[rtd->cpu_dai->id][SNDRV_PCM_STREAM_PLAYBACK].hsw_pcm = pcm;
+               priv_data->pcm[asoc_rtd_to_cpu(rtd, 0)->id][SNDRV_PCM_STREAM_PLAYBACK].hsw_pcm = pcm;
        if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream)
-               priv_data->pcm[rtd->cpu_dai->id][SNDRV_PCM_STREAM_CAPTURE].hsw_pcm = pcm;
+               priv_data->pcm[asoc_rtd_to_cpu(rtd, 0)->id][SNDRV_PCM_STREAM_CAPTURE].hsw_pcm = pcm;
 
        return 0;
 }
index 05a9677..89dcccd 100644 (file)
@@ -545,7 +545,7 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,
        struct hdac_bus *bus = dev_get_drvdata(dai->dev);
        struct hdac_ext_stream *link_dev;
        struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
-       struct snd_soc_dai *codec_dai = rtd->codec_dai;
+       struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
        struct skl_pipe_params p_params = {0};
        struct hdac_ext_link *link;
        int stream_tag;
@@ -644,7 +644,7 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream,
 
        link_dev->link_prepared = 0;
 
-       link = snd_hdac_ext_bus_get_link(bus, rtd->codec_dai->component->name);
+       link = snd_hdac_ext_bus_get_link(bus, asoc_rtd_to_codec(rtd, 0)->component->name);
        if (!link)
                return -EINVAL;
 
@@ -1074,7 +1074,7 @@ static int skl_platform_soc_open(struct snd_soc_component *component,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai_link *dai_link = rtd->dai_link;
 
-       dev_dbg(rtd->cpu_dai->dev, "In %s:%s\n", __func__,
+       dev_dbg(asoc_rtd_to_cpu(rtd, 0)->dev, "In %s:%s\n", __func__,
                                        dai_link->cpus->dai_name);
 
        snd_soc_set_runtime_hwparams(substream, &azx_pcm_hw);
@@ -1226,7 +1226,7 @@ static u64 skl_adjust_codec_delay(struct snd_pcm_substream *substream,
                                u64 nsec)
 {
        struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
-       struct snd_soc_dai *codec_dai = rtd->codec_dai;
+       struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
        u64 codec_frames, codec_nsecs;
 
        if (!codec_dai->driver->ops->delay)
@@ -1281,7 +1281,7 @@ static int skl_platform_soc_get_time_info(
 static int skl_platform_soc_new(struct snd_soc_component *component,
                                struct snd_soc_pcm_runtime *rtd)
 {
-       struct snd_soc_dai *dai = rtd->cpu_dai;
+       struct snd_soc_dai *dai = asoc_rtd_to_cpu(rtd, 0);
        struct hdac_bus *bus = dev_get_drvdata(dai->dev);
        struct snd_pcm *pcm = rtd->pcm;
        unsigned int size;