ASoC: ac108: Fix changed interface
authorHoegeun Kwon <hoegeun.kwon@samsung.com>
Wed, 20 Jan 2021 07:33:20 +0000 (16:33 +0900)
committerHoegeun Kwon <hoegeun.kwon@samsung.com>
Wed, 23 Nov 2022 02:31:04 +0000 (11:31 +0900)
Fix changed interface and incorrectly used structure member names.

Change-Id: Ic22bf7d6651537d63f85ad8ba54e429a44874311
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
sound/soc/codecs/ac101.c
sound/soc/codecs/ac108.c
sound/soc/seeed/seeed-voicecard.c

index a4bcd62..5982678 100644 (file)
@@ -955,10 +955,10 @@ void ac101_aif_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai
 
        AC101_DBG("stream = %s, play: %d, capt: %d, active: %d\n", 
                snd_pcm_stream_str(substream),
-               codec_dai->playback_active, codec_dai->capture_active,
-               codec_dai->active);
+               codec_dai->playback_active, codec_dai->stream_active[SNDRV_PCM_STREAM_CAPTURE],
+               snd_soc_dai_active(codec_dai));
 
-       if (!codec_dai->active) {
+       if (!snd_soc_dai_active(codec_dai)) {
                ac10x->aif1_clken = 1;
                ac101_aif1clk(codec, SND_SOC_DAPM_POST_PMD, 0);
        } else {
@@ -1080,7 +1080,8 @@ int ac101_hw_params(struct snd_pcm_substream *substream,
        freq_out = _FREQ_24_576K;
        for (i = 0; i < ARRAY_SIZE(codec_aif1_fs); i++) {
                if (codec_aif1_fs[i].samp_rate == params_rate(params)) {
-                       if (codec_dai->capture_active && dmic_used && codec_aif1_fs[i].samp_rate == 44100) {
+                       if (codec_dai->stream_active[SNDRV_PCM_STREAM_CAPTURE] &&
+                           dmic_used && codec_aif1_fs[i].samp_rate == 44100) {
                                ac101_update_bits(codec, AIF_SR_CTRL, (0xf<<AIF1_FS), (0x4<<AIF1_FS));
                        } else {
                                ac101_update_bits(codec, AIF_SR_CTRL, (0xf<<AIF1_FS), ((codec_aif1_fs[i].srbit)<<AIF1_FS));
index 0609bef..4462812 100644 (file)
@@ -653,7 +653,8 @@ static int ac108_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_h
 
        dev_dbg(dai->dev, "%s() stream=%s play:%d capt:%d +++\n", __func__,
                        snd_pcm_stream_str(substream),
-                       dai->playback_active, dai->capture_active);
+                       dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK],
+                       dai->stream_active[SNDRV_PCM_STREAM_CAPTURE]);
 
        if (ac10x->i2c101) {
                ret = ac101_hw_params(substream, params, dai);
@@ -664,8 +665,10 @@ static int ac108_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_h
                }
        }
 
-       if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE && dai->playback_active)
-        || (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && dai->capture_active)) {
+       if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
+           dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK])
+           || (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+           dai->stream_active[SNDRV_PCM_STREAM_CAPTURE])) {
                /* not configure hw_param twice */
                /* return 0; */
        }
@@ -1083,7 +1086,7 @@ void ac108_aif_shutdown(struct snd_pcm_substream *substream,
        }
 }
 
-int ac108_aif_mute(struct snd_soc_dai *dai, int mute) {
+int ac108_aif_mute(struct snd_soc_dai *dai, int mute, int direction) {
        struct snd_soc_codec *codec = dai->codec;
        struct ac10x_priv *ac10x = snd_soc_codec_get_drvdata(codec);
 
@@ -1103,7 +1106,7 @@ static const struct snd_soc_dai_ops ac108_dai_ops = {
        /*ALSA PCM audio operations*/
        .hw_params      = ac108_hw_params,
        .prepare        = ac108_prepare,
-       .digital_mute   = ac108_aif_mute,
+       .mute_stream    = ac108_aif_mute,
 
        /*DAI format configuration*/
        .set_fmt        = ac108_set_fmt,
index 5de1b40..c24230b 100644 (file)
@@ -86,6 +86,7 @@ static int seeed_voice_card_startup(struct snd_pcm_substream *substream)
        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);
+       struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
        int ret;
 
        ret = clk_prepare_enable(dai_props->cpu_dai.clk);
@@ -96,16 +97,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 (cpu_dai->driver->playback.channels_min) {
+               priv->channels_playback_default = cpu_dai->driver->playback.channels_min;
        }
-       if (rtd->cpu_dai->driver->capture.channels_min) {
-               priv->channels_capture_default = rtd->cpu_dai->driver->capture.channels_min;
+       if (cpu_dai->driver->capture.channels_min) {
+               priv->channels_capture_default = cpu_dai->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;
+       cpu_dai->driver->playback.channels_min = priv->channels_playback_override;
+       cpu_dai->driver->playback.channels_max = priv->channels_playback_override;
+       cpu_dai->driver->capture.channels_min = priv->channels_capture_override;
+       cpu_dai->driver->capture.channels_max = priv->channels_capture_override;
 
        return ret;
 }
@@ -113,21 +114,23 @@ static int seeed_voice_card_startup(struct snd_pcm_substream *substream)
 static void seeed_voice_card_shutdown(struct snd_pcm_substream *substream)
 {
        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);
        struct seeed_dai_props *dai_props =
                seeed_priv_to_props(priv, rtd->num);
+       struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
 
-       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;
+       cpu_dai->driver->playback.channels_min = priv->channels_playback_default;
+       cpu_dai->driver->playback.channels_max = priv->channels_playback_default;
+       cpu_dai->driver->capture.channels_min = priv->channels_capture_default;
+       cpu_dai->driver->capture.channels_max = priv->channels_capture_default;
 
        clk_disable_unprepare(dai_props->cpu_dai.clk);
 
        clk_disable_unprepare(dai_props->codec_dai.clk);
 
-       if (dai->capture_active && substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+       if (dai->stream_active[SNDRV_PCM_STREAM_CAPTURE] &&
+           substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
                return;
 
        /* interrupt environment */
@@ -145,8 +148,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);
@@ -293,8 +296,8 @@ static int asoc_card_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;