diff --git a/seeed-voicecard.c b/seeed-voicecard.c index b2a5eed..40b1df8 100644 --- a/seeed-voicecard.c +++ b/seeed-voicecard.c @@ -96,16 +96,16 @@ static int seeed_voice_card_startup(struct snd_pcm_substream *substream) if (ret) clk_disable_unprepare(dai_props->cpu_dai.clk); - if (rtd->cpu_dai->driver->playback.channels_min) { - priv->channels_playback_default = rtd->cpu_dai->driver->playback.channels_min; + if (asoc_rtd_to_cpu(rtd, 0)->driver->playback.channels_min) { + priv->channels_playback_default = asoc_rtd_to_cpu(rtd, 0)->driver->playback.channels_min; } - if (rtd->cpu_dai->driver->capture.channels_min) { - priv->channels_capture_default = rtd->cpu_dai->driver->capture.channels_min; + if (asoc_rtd_to_cpu(rtd, 0)->driver->capture.channels_min) { + priv->channels_capture_default = asoc_rtd_to_cpu(rtd, 0)->driver->capture.channels_min; } - rtd->cpu_dai->driver->playback.channels_min = priv->channels_playback_override; - rtd->cpu_dai->driver->playback.channels_max = priv->channels_playback_override; - rtd->cpu_dai->driver->capture.channels_min = priv->channels_capture_override; - rtd->cpu_dai->driver->capture.channels_max = priv->channels_capture_override; + asoc_rtd_to_cpu(rtd, 0)->driver->playback.channels_min = priv->channels_playback_override; + asoc_rtd_to_cpu(rtd, 0)->driver->playback.channels_max = priv->channels_playback_override; + asoc_rtd_to_cpu(rtd, 0)->driver->capture.channels_min = priv->channels_capture_override; + asoc_rtd_to_cpu(rtd, 0)->driver->capture.channels_max = priv->channels_capture_override; return ret; } @@ -117,10 +117,10 @@ static void seeed_voice_card_shutdown(struct snd_pcm_substream *substream) struct seeed_dai_props *dai_props = seeed_priv_to_props(priv, rtd->num); - rtd->cpu_dai->driver->playback.channels_min = priv->channels_playback_default; - rtd->cpu_dai->driver->playback.channels_max = priv->channels_playback_default; - rtd->cpu_dai->driver->capture.channels_min = priv->channels_capture_default; - rtd->cpu_dai->driver->capture.channels_max = priv->channels_capture_default; + asoc_rtd_to_cpu(rtd, 0)->driver->playback.channels_min = priv->channels_playback_default; + asoc_rtd_to_cpu(rtd, 0)->driver->playback.channels_max = priv->channels_playback_default; + asoc_rtd_to_cpu(rtd, 0)->driver->capture.channels_min = priv->channels_capture_default; + asoc_rtd_to_cpu(rtd, 0)->driver->capture.channels_max = priv->channels_capture_default; clk_disable_unprepare(dai_props->cpu_dai.clk); @@ -131,8 +131,8 @@ static int seeed_voice_card_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 *cpu_dai = rtd->cpu_dai; + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); struct seeed_card_data *priv = snd_soc_card_get_drvdata(rtd->card); struct seeed_dai_props *dai_props = seeed_priv_to_props(priv, rtd->num); @@ -196,7 +196,7 @@ static void work_cb_codec_clk(struct work_struct *work) static int seeed_voice_card_trigger(struct snd_pcm_substream *substream, int cmd) { 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); struct seeed_card_data *priv = snd_soc_card_get_drvdata(rtd->card); #if CONFIG_AC10X_TRIG_LOCK unsigned long flags; @@ -339,8 +339,8 @@ static int asoc_simple_init_dai(struct snd_soc_dai *dai, static int seeed_voice_card_dai_init(struct snd_soc_pcm_runtime *rtd) { struct seeed_card_data *priv = snd_soc_card_get_drvdata(rtd->card); - struct snd_soc_dai *codec = rtd->codec_dai; - struct snd_soc_dai *cpu = rtd->cpu_dai; + struct snd_soc_dai *codec = asoc_rtd_to_codec(rtd, 0); + struct snd_soc_dai *cpu = asoc_rtd_to_cpu(rtd, 0); struct seeed_dai_props *dai_props = seeed_priv_to_props(priv, rtd->num); int ret;