Commit 0d1571c1 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: intel: 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/87r1xjir7a.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4d3801d5
...@@ -649,7 +649,7 @@ static snd_pcm_uframes_t sst_soc_pointer(struct snd_soc_component *component, ...@@ -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, static int sst_soc_pcm_new(struct snd_soc_component *component,
struct snd_soc_pcm_runtime *rtd) 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; struct snd_pcm *pcm = rtd->pcm;
if (dai->driver->playback.channels_min || if (dai->driver->playback.channels_min ||
...@@ -741,7 +741,7 @@ static int sst_soc_prepare(struct device *dev) ...@@ -741,7 +741,7 @@ static int sst_soc_prepare(struct device *dev)
/* set the SSPs to idle */ /* set the SSPs to idle */
for_each_card_rtds(drv->soc_card, rtd) { 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) { if (dai->active) {
send_ssp_cmd(dai, dai->name, 0); send_ssp_cmd(dai, dai->name, 0);
...@@ -762,7 +762,7 @@ static void sst_soc_complete(struct device *dev) ...@@ -762,7 +762,7 @@ static void sst_soc_complete(struct device *dev)
/* restart SSPs */ /* restart SSPs */
for_each_card_rtds(drv->soc_card, rtd) { 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) { if (dai->active) {
sst_handle_vb_timer(dai, true); sst_handle_vb_timer(dai, true);
......
...@@ -107,7 +107,7 @@ static int bdw_rt5650_hw_params(struct snd_pcm_substream *substream, ...@@ -107,7 +107,7 @@ static int bdw_rt5650_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;
/* Workaround: set codec PLL to 19.2MHz that PLL source is /* 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) ...@@ -166,8 +166,8 @@ static int bdw_rt5650_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct bdw_rt5650_priv *bdw_rt5650 = struct bdw_rt5650_priv *bdw_rt5650 =
snd_soc_card_get_drvdata(rtd->card); snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_component *component = rtd->codec_dai->component; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_component *component = codec_dai->component;
int ret; int ret;
/* Enable codec ASRC function for Stereo DAC/Stereo1 ADC/DMIC/I2S1. /* Enable codec ASRC function for Stereo DAC/Stereo1 ADC/DMIC/I2S1.
......
...@@ -157,7 +157,7 @@ static int bdw_rt5677_hw_params(struct snd_pcm_substream *substream, ...@@ -157,7 +157,7 @@ static int bdw_rt5677_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;
ret = snd_soc_dai_set_sysclk(codec_dai, RT5677_SCLK_S_MCLK, 24576000, 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, ...@@ -174,7 +174,7 @@ static int bdw_rt5677_dsp_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;
ret = snd_soc_dai_set_sysclk(codec_dai, RT5677_SCLK_S_PLL1, 24576000, 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) ...@@ -226,7 +226,7 @@ static int bdw_rt5677_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct bdw_rt5677_priv *bdw_rt5677 = struct bdw_rt5677_priv *bdw_rt5677 =
snd_soc_card_get_drvdata(rtd->card); 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); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
int ret; int ret;
......
...@@ -70,7 +70,7 @@ static const struct snd_soc_dapm_route broadwell_rt286_map[] = { ...@@ -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) 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; int ret = 0;
ret = snd_soc_card_jack_new(rtd->card, "Headset", ret = snd_soc_card_jack_new(rtd->card, "Headset",
SND_JACK_HEADSET | SND_JACK_BTN_0, &broadwell_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, ...@@ -104,7 +104,7 @@ static int broadwell_rt286_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;
ret = snd_soc_dai_set_sysclk(codec_dai, RT286_SCLK_S_PLL, 24000000, ret = snd_soc_dai_set_sysclk(codec_dai, RT286_SCLK_S_PLL, 24000000,
......
...@@ -179,8 +179,8 @@ static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -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) static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
{ {
int ret; int ret;
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 = rtd->codec_dai->component; struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
int clk_freq; int clk_freq;
/* Configure sysclk for codec */ /* Configure sysclk for codec */
...@@ -226,7 +226,7 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -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) static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct bxt_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct bxt_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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) ...@@ -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) static int broxton_da7219_fe_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dapm_context *dapm; 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); dapm = snd_soc_component_get_dapm(component);
snd_soc_dapm_ignore_suspend(dapm, "Reference Capture"); snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
......
...@@ -155,7 +155,7 @@ static const struct snd_soc_dapm_route geminilake_rt298_map[] = { ...@@ -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) static int broxton_rt298_fe_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dapm_context *dapm; 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); dapm = snd_soc_component_get_dapm(component);
snd_soc_dapm_ignore_suspend(dapm, "Reference Capture"); snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
...@@ -165,7 +165,7 @@ static int broxton_rt298_fe_init(struct snd_soc_pcm_runtime *rtd) ...@@ -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) 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; int ret = 0;
ret = snd_soc_card_jack_new(rtd->card, "Headset", 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) ...@@ -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) static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct bxt_rt286_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct bxt_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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, ...@@ -225,7 +225,7 @@ static int broxton_rt298_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;
ret = snd_soc_dai_set_sysclk(codec_dai, RT298_SCLK_S_PLL, ret = snd_soc_dai_set_sysclk(codec_dai, RT298_SCLK_S_PLL,
......
...@@ -89,7 +89,7 @@ static int byt_max98090_init(struct snd_soc_pcm_runtime *runtime) ...@@ -89,7 +89,7 @@ static int byt_max98090_init(struct snd_soc_pcm_runtime *runtime)
card->dapm.idle_bias_off = true; 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, M98090_REG_SYSTEM_CLOCK,
25000000, SND_SOC_CLOCK_IN); 25000000, SND_SOC_CLOCK_IN);
if (ret < 0) { if (ret < 0) {
......
...@@ -73,7 +73,7 @@ static int byt_rt5640_hw_params(struct snd_pcm_substream *substream, ...@@ -73,7 +73,7 @@ static int byt_rt5640_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;
ret = snd_soc_dai_set_sysclk(codec_dai, RT5640_SCLK_S_PLL1, 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[] = { ...@@ -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) static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
{ {
int ret; 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; struct snd_soc_card *card = runtime->card;
const struct snd_soc_dapm_route *custom_map; const struct snd_soc_dapm_route *custom_map;
int num_routes; int num_routes;
......
...@@ -70,7 +70,7 @@ static const struct acpi_gpio_mapping byt_cht_cx2072x_acpi_gpios[] = { ...@@ -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) static int byt_cht_cx2072x_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; 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; int ret;
if (devm_acpi_dev_add_driver_gpios(codec->dev, 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) ...@@ -80,7 +80,7 @@ static int byt_cht_cx2072x_init(struct snd_soc_pcm_runtime *rtd)
card->dapm.idle_bias_off = true; card->dapm.idle_bias_off = true;
/* set the default PLL rate, the clock is handled by the codec driver */ /* 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); 19200000, SND_SOC_CLOCK_IN);
if (ret) { if (ret) {
dev_err(rtd->dev, "Could not set sysclk\n"); 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) ...@@ -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_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; return ret;
} }
...@@ -123,7 +123,7 @@ static int byt_cht_cx2072x_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -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 * 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 * 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_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS); SND_SOC_DAIFMT_CBS_CFS);
...@@ -132,7 +132,7 @@ static int byt_cht_cx2072x_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -132,7 +132,7 @@ static int byt_cht_cx2072x_fixup(struct snd_soc_pcm_runtime *rtd,
return ret; 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) { if (ret < 0) {
dev_err(rtd->dev, "can't set I2S config, err %d\n", ret); dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
return ret; return ret;
......
...@@ -78,7 +78,7 @@ static int codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -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 * 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 * 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_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS); SND_SOC_DAIFMT_CBS_CFS);
...@@ -87,7 +87,7 @@ static int codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -87,7 +87,7 @@ static int codec_fixup(struct snd_soc_pcm_runtime *rtd,
return ret; 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) { if (ret < 0) {
dev_err(rtd->dev, "can't set I2S config, err %d\n", ret); dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
return ret; return ret;
...@@ -106,7 +106,7 @@ static int aif1_hw_params(struct snd_pcm_substream *substream, ...@@ -106,7 +106,7 @@ static int 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_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
int ret; int ret;
ret = snd_soc_dai_set_sysclk(codec_dai, DA7213_CLKSRC_MCLK, 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, ...@@ -127,7 +127,7 @@ static int aif1_hw_params(struct snd_pcm_substream *substream,
static int aif1_hw_free(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_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;
ret = snd_soc_dai_set_pll(codec_dai, 0, ret = snd_soc_dai_set_pll(codec_dai, 0,
......
...@@ -157,7 +157,7 @@ static struct snd_soc_jack_pin byt_cht_es8316_jack_pins[] = { ...@@ -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) 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 snd_soc_card *card = runtime->card;
struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card); struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
const struct snd_soc_dapm_route *custom_map; const struct snd_soc_dapm_route *custom_map;
...@@ -212,7 +212,7 @@ static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime) ...@@ -212,7 +212,7 @@ static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime)
if (ret) if (ret)
dev_err(card->dev, "unable to enable MCLK\n"); 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); SND_SOC_CLOCK_IN);
if (ret < 0) { if (ret < 0) {
dev_err(card->dev, "can't set codec clock %d\n", ret); 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, ...@@ -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 * 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 * 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_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS SND_SOC_DAIFMT_CBS_CFS
...@@ -272,7 +272,7 @@ static int byt_cht_es8316_codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -272,7 +272,7 @@ static int byt_cht_es8316_codec_fixup(struct snd_soc_pcm_runtime *rtd,
return ret; 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) { if (ret < 0) {
dev_err(rtd->dev, "can't set I2S config, err %d\n", ret); dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
return ret; return ret;
......
...@@ -58,7 +58,7 @@ static int codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -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 * 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 * 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_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS); SND_SOC_DAIFMT_CBS_CFS);
...@@ -68,7 +68,7 @@ static int codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -68,7 +68,7 @@ static int codec_fixup(struct snd_soc_pcm_runtime *rtd,
return ret; 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) { if (ret < 0) {
dev_err(rtd->dev, "can't set I2S config, err %d\n", ret); dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
return ret; return ret;
......
...@@ -381,7 +381,7 @@ static int byt_rt5640_aif1_hw_params(struct snd_pcm_substream *substream, ...@@ -381,7 +381,7 @@ static int byt_rt5640_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_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)); 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) ...@@ -805,7 +805,7 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
{ {
struct snd_soc_card *card = runtime->card; struct snd_soc_card *card = runtime->card;
struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(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; const struct snd_soc_dapm_route *custom_map;
int num_routes; int num_routes;
int ret; int ret;
...@@ -962,7 +962,7 @@ static int byt_rt5640_codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -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 * with explicit setting to I2S 2ch. The word length is set with
* dai_set_tdm_slot() since there is no other API exposed * 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_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS); SND_SOC_DAIFMT_CBS_CFS);
...@@ -971,7 +971,7 @@ static int byt_rt5640_codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -971,7 +971,7 @@ static int byt_rt5640_codec_fixup(struct snd_soc_pcm_runtime *rtd,
return ret; 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) { if (ret < 0) {
dev_err(rtd->dev, "can't set I2S config, err %d\n", ret); dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
return ret; return ret;
......
...@@ -348,7 +348,7 @@ static int byt_rt5651_aif1_hw_params(struct snd_pcm_substream *substream, ...@@ -348,7 +348,7 @@ static int byt_rt5651_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_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); snd_pcm_format_t format = params_format(params);
int rate = params_rate(params); int rate = params_rate(params);
int bclk_ratio; int bclk_ratio;
...@@ -540,7 +540,7 @@ static int byt_rt5651_add_codec_device_props(struct device *i2c_dev) ...@@ -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) static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
{ {
struct snd_soc_card *card = runtime->card; 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); struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
const struct snd_soc_dapm_route *custom_map; const struct snd_soc_dapm_route *custom_map;
int num_routes; int num_routes;
...@@ -685,7 +685,7 @@ static int byt_rt5651_codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -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 * with explicit setting to I2S 2ch. The word length is set with
* dai_set_tdm_slot() since there is no other API exposed * 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_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS SND_SOC_DAIFMT_CBS_CFS
...@@ -696,7 +696,7 @@ static int byt_rt5651_codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -696,7 +696,7 @@ static int byt_rt5651_codec_fixup(struct snd_soc_pcm_runtime *rtd,
return ret; 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) { if (ret < 0) {
dev_err(rtd->dev, "can't set I2S config, err %d\n", ret); dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
return ret; return ret;
......
...@@ -113,7 +113,7 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream, ...@@ -113,7 +113,7 @@ static int cht_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_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
int ret; int ret;
ret = snd_soc_dai_set_sysclk(codec_dai, M98090_REG_SYSTEM_CLOCK, 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, ...@@ -257,7 +257,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
int ret = 0; int ret = 0;
unsigned int fmt = 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) { if (ret < 0) {
dev_err(rtd->dev, "can't set cpu_dai slot fmt: %d\n", ret); dev_err(rtd->dev, "can't set cpu_dai slot fmt: %d\n", ret);
return ret; return ret;
...@@ -266,7 +266,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -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 fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBS_CFS; | 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) { if (ret < 0) {
dev_err(rtd->dev, "can't set cpu_dai set fmt: %d\n", ret); dev_err(rtd->dev, "can't set cpu_dai set fmt: %d\n", ret);
return ret; return ret;
......
...@@ -73,7 +73,7 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream, ...@@ -73,7 +73,7 @@ static int cht_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_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
int ret; int ret;
ret = snd_soc_dai_set_sysclk(codec_dai, NAU8824_CLK_FLL_FS, 0, 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) ...@@ -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 cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
struct snd_soc_jack *jack = &ctx->jack; 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; struct snd_soc_component *component = codec_dai->component;
int ret, jack_type; int ret, jack_type;
......
...@@ -208,7 +208,7 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream, ...@@ -208,7 +208,7 @@ static int cht_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_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
int ret; int ret;
/* set codec PLL source to the 19.2MHz platform clock (MCLK) */ /* 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) ...@@ -252,7 +252,7 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
{ {
struct snd_soc_card *card = runtime->card; struct snd_soc_card *card = runtime->card;
struct cht_mc_private *ctx = snd_soc_card_get_drvdata(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 jack_type;
int ret; int ret;
...@@ -359,7 +359,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -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 * 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 * 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_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS SND_SOC_DAIFMT_CBS_CFS
...@@ -369,7 +369,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -369,7 +369,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
return ret; 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_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS SND_SOC_DAIFMT_CBS_CFS
...@@ -379,7 +379,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -379,7 +379,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
return ret; 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) { if (ret < 0) {
dev_err(rtd->dev, "can't set I2S config, err %d\n", ret); dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
return ret; return ret;
...@@ -393,7 +393,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -393,7 +393,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
/* /*
* Default mode for SSP configuration is TDM 4 slot * 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_DSP_B |
SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_IB_NF |
SND_SOC_DAIFMT_CBS_CFS); SND_SOC_DAIFMT_CBS_CFS);
...@@ -403,7 +403,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -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 */ /* 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) { if (ret < 0) {
dev_err(rtd->dev, "can't set codec TDM slot %d\n", ret); dev_err(rtd->dev, "can't set codec TDM slot %d\n", ret);
return ret; return ret;
......
...@@ -144,7 +144,7 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream, ...@@ -144,7 +144,7 @@ static int cht_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_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
int ret; int ret;
/* set codec PLL source to the 19.2MHz platform clock (MCLK) */ /* set codec PLL source to the 19.2MHz platform clock (MCLK) */
...@@ -176,7 +176,7 @@ static const struct acpi_gpio_mapping cht_rt5672_gpios[] = { ...@@ -176,7 +176,7 @@ static const struct acpi_gpio_mapping cht_rt5672_gpios[] = {
static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
{ {
int ret; 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 snd_soc_component *component = codec_dai->component;
struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card); 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, ...@@ -255,7 +255,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
/* /*
* Default mode for SSP configuration is TDM 4 slot * 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_DSP_B |
SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_IB_NF |
SND_SOC_DAIFMT_CBS_CFS); SND_SOC_DAIFMT_CBS_CFS);
...@@ -265,7 +265,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -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 */ /* 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) { if (ret < 0) {
dev_err(rtd->dev, "can't set codec TDM slot %d\n", ret); dev_err(rtd->dev, "can't set codec TDM slot %d\n", ret);
return ret; return ret;
......
...@@ -85,7 +85,7 @@ static const struct snd_soc_dapm_route cml_rt1011_rt5682_map[] = { ...@@ -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) static int cml_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct snd_soc_jack *jack;
int ret; int ret;
...@@ -125,7 +125,7 @@ static int cml_rt5682_hw_params(struct snd_pcm_substream *substream, ...@@ -125,7 +125,7 @@ static int cml_rt5682_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 clk_id, clk_freq, pll_out, ret; int clk_id, clk_freq, pll_out, ret;
clk_id = RT5682_PLL1_S_MCLK; clk_id = RT5682_PLL1_S_MCLK;
...@@ -274,7 +274,7 @@ static int sof_card_late_probe(struct snd_soc_card *card) ...@@ -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) static int hdmi_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
......
...@@ -136,8 +136,8 @@ static int geminilake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -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) 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 glk_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_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_jack *jack; struct snd_soc_jack *jack;
int ret; int ret;
...@@ -188,7 +188,7 @@ static int geminilake_rt5682_hw_params(struct snd_pcm_substream *substream, ...@@ -188,7 +188,7 @@ static int geminilake_rt5682_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;
/* Set valid bitmask & configuration for I2S in 24 bit */ /* Set valid bitmask & configuration for I2S in 24 bit */
...@@ -208,7 +208,7 @@ static struct snd_soc_ops geminilake_rt5682_ops = { ...@@ -208,7 +208,7 @@ static struct snd_soc_ops geminilake_rt5682_ops = {
static int geminilake_hdmi_init(struct snd_soc_pcm_runtime *rtd) static int geminilake_hdmi_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct glk_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct glk_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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) ...@@ -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) 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; struct snd_soc_dapm_context *dapm;
int ret; int ret;
......
...@@ -56,7 +56,7 @@ static int haswell_rt5640_hw_params(struct snd_pcm_substream *substream, ...@@ -56,7 +56,7 @@ static int haswell_rt5640_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;
ret = snd_soc_dai_set_sysclk(codec_dai, RT5640_SCLK_S_MCLK, 12288000, ret = snd_soc_dai_set_sysclk(codec_dai, RT5640_SCLK_S_MCLK, 12288000,
......
...@@ -159,8 +159,8 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -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) 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 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_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_jack *jack; struct snd_soc_jack *jack;
int ret; int ret;
...@@ -203,7 +203,7 @@ static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -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) 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 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; struct kbl_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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) ...@@ -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) static int kabylake_da7219_fe_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dapm_context *dapm; 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); dapm = snd_soc_component_get_dapm(component);
snd_soc_dapm_ignore_suspend(dapm, "Reference Capture"); snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
......
...@@ -331,7 +331,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -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) 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 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_jack *jack;
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
...@@ -381,7 +381,7 @@ static int kabylake_dmic_init(struct snd_soc_pcm_runtime *rtd) ...@@ -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) 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 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; struct kbl_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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) ...@@ -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) static int kabylake_da7219_fe_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dapm_context *dapm; 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); dapm = snd_soc_component_get_dapm(component);
snd_soc_dapm_ignore_suspend(dapm, "Reference Capture"); snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
......
...@@ -157,7 +157,7 @@ static int kabylake_rt5660_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -157,7 +157,7 @@ static int kabylake_rt5660_codec_init(struct snd_soc_pcm_runtime *rtd)
{ {
int ret; int ret;
struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
ret = devm_acpi_dev_add_driver_gpios(component->dev, acpi_rt5660_gpios); 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) ...@@ -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) 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 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; struct kbl_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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, ...@@ -244,7 +244,7 @@ static int kabylake_rt5660_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;
ret = snd_soc_dai_set_sysclk(codec_dai, ret = snd_soc_dai_set_sysclk(codec_dai,
......
...@@ -242,7 +242,7 @@ static int kabylake_rt5663_fe_init(struct snd_soc_pcm_runtime *rtd) ...@@ -242,7 +242,7 @@ static int kabylake_rt5663_fe_init(struct snd_soc_pcm_runtime *rtd)
{ {
int ret; int ret;
struct snd_soc_dapm_context *dapm; 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); dapm = snd_soc_component_get_dapm(component);
ret = snd_soc_dapm_ignore_suspend(dapm, "Reference Capture"); 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) ...@@ -258,7 +258,7 @@ static int kabylake_rt5663_codec_init(struct snd_soc_pcm_runtime *rtd)
{ {
int ret; int ret;
struct kbl_rt5663_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct snd_soc_jack *jack;
/* /*
...@@ -305,7 +305,7 @@ static int kabylake_rt5663_max98927_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -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) 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 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; struct kbl_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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, ...@@ -431,7 +431,7 @@ static int kabylake_rt5663_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;
/* use ASRC for internal clocks, as PLL rate isn't multiple of BCLK */ /* use ASRC for internal clocks, as PLL rate isn't multiple of BCLK */
......
...@@ -206,7 +206,7 @@ static struct snd_soc_codec_conf max98927_codec_conf[] = { ...@@ -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) static int kabylake_rt5663_fe_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dapm_context *dapm; 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; int ret;
dapm = snd_soc_component_get_dapm(component); dapm = snd_soc_component_get_dapm(component);
...@@ -221,7 +221,7 @@ static int kabylake_rt5663_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -221,7 +221,7 @@ static int kabylake_rt5663_codec_init(struct snd_soc_pcm_runtime *rtd)
{ {
int ret; int ret;
struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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_jack *jack;
/* /*
...@@ -255,7 +255,7 @@ static int kabylake_rt5663_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -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) 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 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; struct kbl_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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, ...@@ -372,7 +372,7 @@ static int kabylake_rt5663_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;
/* use ASRC for internal clocks, as PLL rate isn't multiple of BCLK */ /* use ASRC for internal clocks, as PLL rate isn't multiple of BCLK */
......
...@@ -157,7 +157,7 @@ static int skylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -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) static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)
{ {
int ret; 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. * Headset buttons map to the google Reference headset.
...@@ -182,7 +182,7 @@ static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -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) static int skylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct skl_nau8825_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct skl_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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) ...@@ -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) static int skylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct skl_nau8825_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct skl_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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) ...@@ -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) static int skylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct skl_nau8825_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct skl_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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) ...@@ -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) static int skylake_nau8825_fe_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dapm_context *dapm; 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); dapm = snd_soc_component_get_dapm(component);
snd_soc_dapm_ignore_suspend(dapm, "Reference Capture"); snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
...@@ -296,7 +296,7 @@ static int skylake_nau8825_hw_params(struct snd_pcm_substream *substream, ...@@ -296,7 +296,7 @@ static int skylake_nau8825_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;
ret = snd_soc_dai_set_sysclk(codec_dai, ret = snd_soc_dai_set_sysclk(codec_dai,
......
...@@ -161,12 +161,12 @@ static int skylake_ssm4567_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -161,12 +161,12 @@ static int skylake_ssm4567_codec_init(struct snd_soc_pcm_runtime *rtd)
int ret; int ret;
/* Slot 1 for left */ /* 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) if (ret < 0)
return ret; return ret;
/* Slot 2 for right */ /* 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) if (ret < 0)
return ret; return ret;
...@@ -176,7 +176,7 @@ static int skylake_ssm4567_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -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) static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)
{ {
int ret; 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 * 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) ...@@ -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) static int skylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct skl_nau88125_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct skl_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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) ...@@ -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) static int skylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct skl_nau88125_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct skl_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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) ...@@ -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) static int skylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct skl_nau88125_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct skl_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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) ...@@ -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) static int skylake_nau8825_fe_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dapm_context *dapm; 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); dapm = snd_soc_component_get_dapm(component);
snd_soc_dapm_ignore_suspend(dapm, "Reference Capture"); snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
...@@ -348,7 +348,7 @@ static int skylake_nau8825_hw_params(struct snd_pcm_substream *substream, ...@@ -348,7 +348,7 @@ static int skylake_nau8825_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;
ret = snd_soc_dai_set_sysclk(codec_dai, ret = snd_soc_dai_set_sysclk(codec_dai,
......
...@@ -112,7 +112,7 @@ static const struct snd_soc_dapm_route skylake_rt286_map[] = { ...@@ -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) static int skylake_rt286_fe_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dapm_context *dapm; 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); dapm = snd_soc_component_get_dapm(component);
snd_soc_dapm_ignore_suspend(dapm, "Reference Capture"); snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
...@@ -122,7 +122,7 @@ static int skylake_rt286_fe_init(struct snd_soc_pcm_runtime *rtd) ...@@ -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) 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; int ret;
ret = snd_soc_card_jack_new(rtd->card, "Headset", 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) ...@@ -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) static int skylake_hdmi_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct skl_rt286_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct skl_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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, ...@@ -229,7 +229,7 @@ static int skylake_rt286_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;
ret = snd_soc_dai_set_sysclk(codec_dai, RT286_SCLK_S_PLL, 24000000, ret = snd_soc_dai_set_sysclk(codec_dai, RT286_SCLK_S_PLL, 24000000,
......
...@@ -129,8 +129,8 @@ static struct snd_soc_jack headset; ...@@ -129,8 +129,8 @@ static struct snd_soc_jack headset;
static int da7219_codec_init(struct snd_soc_pcm_runtime *rtd) 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 = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_component *component = codec_dai->component;
struct snd_soc_jack *jack; struct snd_soc_jack *jack;
int ret; int ret;
...@@ -173,7 +173,7 @@ static int ssp1_hw_params(struct snd_pcm_substream *substream, ...@@ -173,7 +173,7 @@ static int ssp1_hw_params(struct snd_pcm_substream *substream,
int ret, j; int ret, j;
for (j = 0; j < runtime->num_codecs; 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)) { if (!strcmp(codec_dai->component->name, MAXIM_DEV0_NAME)) {
/* vmon_slot_no = 0 imon_slot_no = 1 for TX slots */ /* vmon_slot_no = 0 imon_slot_no = 1 for TX slots */
...@@ -214,7 +214,7 @@ static struct snd_soc_codec_conf max98373_codec_conf[] = { ...@@ -214,7 +214,7 @@ static struct snd_soc_codec_conf max98373_codec_conf[] = {
static int hdmi_init(struct snd_soc_pcm_runtime *rtd) static int hdmi_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
......
...@@ -66,7 +66,7 @@ static const struct dmi_system_id sof_pcm512x_quirk_table[] = { ...@@ -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) static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct sof_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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) ...@@ -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) 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_EN, 0x08, 0x08);
snd_soc_component_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02); 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) ...@@ -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) static int aif1_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 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, snd_soc_component_update_bits(codec, PCM512x_GPIO_CONTROL_1,
0x08, 0x08); 0x08, 0x08);
...@@ -108,7 +108,7 @@ static int aif1_startup(struct snd_pcm_substream *substream) ...@@ -108,7 +108,7 @@ static int aif1_startup(struct snd_pcm_substream *substream)
static void aif1_shutdown(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_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, snd_soc_component_update_bits(codec, PCM512x_GPIO_CONTROL_1,
0x08, 0x00); 0x08, 0x00);
......
...@@ -124,7 +124,7 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = { ...@@ -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) static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; struct sof_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); 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) ...@@ -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) 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 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; struct snd_soc_jack *jack;
int ret; int ret;
...@@ -211,7 +211,7 @@ static int sof_rt5682_hw_params(struct snd_pcm_substream *substream, ...@@ -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 snd_soc_pcm_runtime *rtd = substream->private_data;
struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); 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; int clk_id, clk_freq, pll_out, ret;
if (sof_rt5682_quirk & SOF_RT5682_MCLK_EN) { if (sof_rt5682_quirk & SOF_RT5682_MCLK_EN) {
......
...@@ -476,7 +476,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component, ...@@ -476,7 +476,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component,
u8 channels; u8 channels;
int ret, dai; 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]; pcm_data = &pdata->pcm[dai][substream->stream];
/* check if we are being called a subsequent time */ /* check if we are being called a subsequent time */
...@@ -494,7 +494,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component, ...@@ -494,7 +494,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component,
} }
pcm_data->allocated = false; 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); hsw_notify_pointer, pcm_data);
if (pcm_data->stream == NULL) { if (pcm_data->stream == NULL) {
dev_err(rtd->dev, "error: failed to create stream\n"); 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, ...@@ -509,7 +509,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component,
path_id = SST_HSW_STREAM_PATH_SSP0_IN; path_id = SST_HSW_STREAM_PATH_SSP0_IN;
/* DSP stream type depends on DAI ID */ /* DSP stream type depends on DAI ID */
switch (rtd->cpu_dai->id) { switch (asoc_rtd_to_cpu(rtd, 0)->id) {
case 0: case 0:
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
stream_type = SST_HSW_STREAM_TYPE_SYSTEM; stream_type = SST_HSW_STREAM_TYPE_SYSTEM;
...@@ -533,7 +533,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component, ...@@ -533,7 +533,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component,
break; break;
default: default:
dev_err(rtd->dev, "error: invalid DAI ID %d\n", dev_err(rtd->dev, "error: invalid DAI ID %d\n",
rtd->cpu_dai->id); asoc_rtd_to_cpu(rtd, 0)->id);
return -EINVAL; return -EINVAL;
} }
...@@ -595,7 +595,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component, ...@@ -595,7 +595,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component,
dmab = snd_pcm_get_dma_buf(substream); dmab = snd_pcm_get_dma_buf(substream);
ret = create_adsp_page_table(substream, pdata, rtd, runtime->dma_area, 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) if (ret < 0)
return ret; return ret;
...@@ -608,7 +608,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component, ...@@ -608,7 +608,7 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component,
pages = runtime->dma_bytes / PAGE_SIZE; pages = runtime->dma_bytes / PAGE_SIZE;
ret = sst_hsw_stream_buffer(hsw, pcm_data->stream, 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, pages, runtime->dma_bytes, 0,
snd_sgbuf_get_addr(dmab, 0) >> PAGE_SHIFT); snd_sgbuf_get_addr(dmab, 0) >> PAGE_SHIFT);
if (ret < 0) { if (ret < 0) {
...@@ -661,7 +661,7 @@ static int hsw_pcm_trigger(struct snd_soc_component *component, ...@@ -661,7 +661,7 @@ static int hsw_pcm_trigger(struct snd_soc_component *component,
snd_pcm_uframes_t pos; snd_pcm_uframes_t pos;
int dai; 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]; pcm_data = &pdata->pcm[dai][substream->stream];
sst_stream = pcm_data->stream; sst_stream = pcm_data->stream;
...@@ -770,7 +770,7 @@ static snd_pcm_uframes_t hsw_pcm_pointer(struct snd_soc_component *component, ...@@ -770,7 +770,7 @@ static snd_pcm_uframes_t hsw_pcm_pointer(struct snd_soc_component *component,
u32 position; u32 position;
int dai; 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]; pcm_data = &pdata->pcm[dai][substream->stream];
position = sst_hsw_get_dsp_position(hsw, pcm_data->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, ...@@ -791,7 +791,7 @@ static int hsw_pcm_open(struct snd_soc_component *component,
struct sst_hsw *hsw = pdata->hsw; struct sst_hsw *hsw = pdata->hsw;
int dai; 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]; pcm_data = &pdata->pcm[dai][substream->stream];
mutex_lock(&pcm_data->mutex); mutex_lock(&pcm_data->mutex);
...@@ -801,7 +801,7 @@ static int hsw_pcm_open(struct snd_soc_component *component, ...@@ -801,7 +801,7 @@ static int hsw_pcm_open(struct snd_soc_component *component,
snd_soc_set_runtime_hwparams(substream, &hsw_pcm_hardware); 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); hsw_notify_pointer, pcm_data);
if (pcm_data->stream == NULL) { if (pcm_data->stream == NULL) {
dev_err(rtd->dev, "error: failed to create stream\n"); dev_err(rtd->dev, "error: failed to create stream\n");
...@@ -824,7 +824,7 @@ static int hsw_pcm_close(struct snd_soc_component *component, ...@@ -824,7 +824,7 @@ static int hsw_pcm_close(struct snd_soc_component *component,
struct sst_hsw *hsw = pdata->hsw; struct sst_hsw *hsw = pdata->hsw;
int ret, dai; 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]; pcm_data = &pdata->pcm[dai][substream->stream];
mutex_lock(&pcm_data->mutex); mutex_lock(&pcm_data->mutex);
...@@ -923,9 +923,9 @@ static int hsw_pcm_new(struct snd_soc_component *component, ...@@ -923,9 +923,9 @@ static int hsw_pcm_new(struct snd_soc_component *component,
hsw_pcm_hardware.buffer_bytes_max); hsw_pcm_hardware.buffer_bytes_max);
} }
if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) 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) 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; return 0;
} }
......
...@@ -545,7 +545,7 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream, ...@@ -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_bus *bus = dev_get_drvdata(dai->dev);
struct hdac_ext_stream *link_dev; struct hdac_ext_stream *link_dev;
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); 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 skl_pipe_params p_params = {0};
struct hdac_ext_link *link; struct hdac_ext_link *link;
int stream_tag; int stream_tag;
...@@ -644,7 +644,7 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream, ...@@ -644,7 +644,7 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream,
link_dev->link_prepared = 0; 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) if (!link)
return -EINVAL; return -EINVAL;
...@@ -1074,7 +1074,7 @@ static int skl_platform_soc_open(struct snd_soc_component *component, ...@@ -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_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai_link *dai_link = rtd->dai_link; 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); dai_link->cpus->dai_name);
snd_soc_set_runtime_hwparams(substream, &azx_pcm_hw); snd_soc_set_runtime_hwparams(substream, &azx_pcm_hw);
...@@ -1226,7 +1226,7 @@ static u64 skl_adjust_codec_delay(struct snd_pcm_substream *substream, ...@@ -1226,7 +1226,7 @@ static u64 skl_adjust_codec_delay(struct snd_pcm_substream *substream,
u64 nsec) u64 nsec)
{ {
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); 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; u64 codec_frames, codec_nsecs;
if (!codec_dai->driver->ops->delay) if (!codec_dai->driver->ops->delay)
...@@ -1281,7 +1281,7 @@ static int skl_platform_soc_get_time_info( ...@@ -1281,7 +1281,7 @@ static int skl_platform_soc_get_time_info(
static int skl_platform_soc_new(struct snd_soc_component *component, static int skl_platform_soc_new(struct snd_soc_component *component,
struct snd_soc_pcm_runtime *rtd) 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 hdac_bus *bus = dev_get_drvdata(dai->dev);
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
unsigned int size; unsigned int size;
......
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