ASoC: rt: use helper function
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 31 Jan 2023 02:00:16 +0000 (02:00 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 31 Jan 2023 11:04:57 +0000 (11:04 +0000)
Current ASoC has many helper function.
This patch use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zg9zea4w.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 files changed:
sound/soc/codecs/rt1308-sdw.c
sound/soc/codecs/rt1316-sdw.c
sound/soc/codecs/rt1318-sdw.c
sound/soc/codecs/rt5645.c
sound/soc/codecs/rt5665.c
sound/soc/codecs/rt5668.c
sound/soc/codecs/rt5682-sdw.c
sound/soc/codecs/rt5682.c
sound/soc/codecs/rt5682s.c
sound/soc/codecs/rt700.c
sound/soc/codecs/rt711-sdca.c
sound/soc/codecs/rt711.c
sound/soc/codecs/rt715-sdca.c
sound/soc/codecs/rt715.c

index ca2790d..45544b5 100644 (file)
@@ -508,10 +508,7 @@ static int rt1308_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
-       if (direction == SNDRV_PCM_STREAM_PLAYBACK)
-               dai->playback_dma_data = stream;
-       else
-               dai->capture_dma_data = stream;
+       snd_soc_dai_dma_data_set(dai, direction, stream);
 
        return 0;
 }
 
        return 0;
 }
index 45a3eff..91edfd5 100644 (file)
@@ -507,10 +507,7 @@ static int rt1316_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
-       if (direction == SNDRV_PCM_STREAM_PLAYBACK)
-               dai->playback_dma_data = stream;
-       else
-               dai->capture_dma_data = stream;
+       snd_soc_dai_dma_data_set(dai, direction, stream);
 
        return 0;
 }
 
        return 0;
 }
index c6ec86e..c34975f 100644 (file)
@@ -575,10 +575,7 @@ static int rt1318_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
-       if (direction == SNDRV_PCM_STREAM_PLAYBACK)
-               dai->playback_dma_data = stream;
-       else
-               dai->capture_dma_data = stream;
+       snd_soc_dai_dma_data_set(dai, direction, stream);
 
        return 0;
 }
 
        return 0;
 }
index 620ecbf..7c7cbb6 100644 (file)
@@ -3157,7 +3157,7 @@ static int rt5645_jack_detect(struct snd_soc_component *component, int jack_inse
                snd_soc_dapm_force_enable_pin(dapm, "LDO2");
                snd_soc_dapm_force_enable_pin(dapm, "Mic Det Power");
                snd_soc_dapm_sync(dapm);
                snd_soc_dapm_force_enable_pin(dapm, "LDO2");
                snd_soc_dapm_force_enable_pin(dapm, "Mic Det Power");
                snd_soc_dapm_sync(dapm);
-               if (!dapm->card->instantiated) {
+               if (!snd_soc_card_is_instantiated(dapm->card)) {
                        /* Power up necessary bits for JD if dapm is
                           not ready yet */
                        regmap_update_bits(rt5645->regmap, RT5645_PWR_ANLG1,
                        /* Power up necessary bits for JD if dapm is
                           not ready yet */
                        regmap_update_bits(rt5645->regmap, RT5645_PWR_ANLG1,
index 6e66cc2..17afaef 100644 (file)
@@ -1298,7 +1298,7 @@ static void rt5665_jack_detect_handler(struct work_struct *work)
                usleep_range(10000, 15000);
        }
 
                usleep_range(10000, 15000);
        }
 
-       while (!rt5665->component->card->instantiated) {
+       while (!snd_soc_card_is_instantiated(rt5665->component->card)) {
                pr_debug("%s\n", __func__);
                usleep_range(10000, 15000);
        }
                pr_debug("%s\n", __func__);
                usleep_range(10000, 15000);
        }
@@ -4748,7 +4748,7 @@ static void rt5665_calibrate_handler(struct work_struct *work)
        struct rt5665_priv *rt5665 = container_of(work, struct rt5665_priv,
                calibrate_work.work);
 
        struct rt5665_priv *rt5665 = container_of(work, struct rt5665_priv,
                calibrate_work.work);
 
-       while (!rt5665->component->card->instantiated) {
+       while (!snd_soc_card_is_instantiated(rt5665->component->card)) {
                pr_debug("%s\n", __func__);
                usleep_range(10000, 15000);
        }
                pr_debug("%s\n", __func__);
                usleep_range(10000, 15000);
        }
index beb0951..ecf3b05 100644 (file)
@@ -1022,8 +1022,8 @@ static void rt5668_jack_detect_handler(struct work_struct *work)
                container_of(work, struct rt5668_priv, jack_detect_work.work);
        int val, btn_type;
 
                container_of(work, struct rt5668_priv, jack_detect_work.work);
        int val, btn_type;
 
-       if (!rt5668->component || !rt5668->component->card ||
-           !rt5668->component->card->instantiated) {
+       if (!rt5668->component ||
+           !snd_soc_card_is_instantiated(rt5668->component->card)) {
                /* card not yet ready, try later */
                mod_delayed_work(system_power_efficient_wq,
                                 &rt5668->jack_detect_work, msecs_to_jiffies(15));
                /* card not yet ready, try later */
                mod_delayed_work(system_power_efficient_wq,
                                 &rt5668->jack_detect_work, msecs_to_jiffies(15));
index d8a573d..5f80a5d 100644 (file)
@@ -107,10 +107,7 @@ static int rt5682_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
-       if (direction == SNDRV_PCM_STREAM_PLAYBACK)
-               dai->playback_dma_data = stream;
-       else
-               dai->capture_dma_data = stream;
+       snd_soc_dai_dma_data_set(dai, direction, stream);
 
        return 0;
 }
 
        return 0;
 }
index 7e3eb65..f6c798b 100644 (file)
@@ -1094,8 +1094,8 @@ void rt5682_jack_detect_handler(struct work_struct *work)
        struct snd_soc_dapm_context *dapm;
        int val, btn_type;
 
        struct snd_soc_dapm_context *dapm;
        int val, btn_type;
 
-       if (!rt5682->component || !rt5682->component->card ||
-           !rt5682->component->card->instantiated) {
+       if (!rt5682->component ||
+           !snd_soc_card_is_instantiated(rt5682->component->card)) {
                /* card not yet ready, try later */
                mod_delayed_work(system_power_efficient_wq,
                                 &rt5682->jack_detect_work, msecs_to_jiffies(15));
                /* card not yet ready, try later */
                mod_delayed_work(system_power_efficient_wq,
                                 &rt5682->jack_detect_work, msecs_to_jiffies(15));
index f5e5dbc..77dc622 100644 (file)
@@ -834,8 +834,8 @@ static void rt5682s_jack_detect_handler(struct work_struct *work)
        struct snd_soc_dapm_context *dapm;
        int val, btn_type;
 
        struct snd_soc_dapm_context *dapm;
        int val, btn_type;
 
-       if (!rt5682s->component || !rt5682s->component->card ||
-           !rt5682s->component->card->instantiated) {
+       if (!rt5682s->component ||
+           !snd_soc_card_is_instantiated(rt5682s->component->card)) {
                /* card not yet ready, try later */
                mod_delayed_work(system_power_efficient_wq,
                                 &rt5682s->jack_detect_work, msecs_to_jiffies(15));
                /* card not yet ready, try later */
                mod_delayed_work(system_power_efficient_wq,
                                 &rt5682s->jack_detect_work, msecs_to_jiffies(15));
index 6534c9b..659ce26 100644 (file)
@@ -163,7 +163,7 @@ static void rt700_jack_detect_handler(struct work_struct *work)
        if (!rt700->hs_jack)
                return;
 
        if (!rt700->hs_jack)
                return;
 
-       if (!rt700->component->card || !rt700->component->card->instantiated)
+       if (!snd_soc_card_is_instantiated(rt700->component->card))
                return;
 
        reg = RT700_VERB_GET_PIN_SENSE | RT700_HP_OUT;
                return;
 
        reg = RT700_VERB_GET_PIN_SENSE | RT700_HP_OUT;
@@ -887,10 +887,7 @@ static int rt700_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
-       if (direction == SNDRV_PCM_STREAM_PLAYBACK)
-               dai->playback_dma_data = stream;
-       else
-               dai->capture_dma_data = stream;
+       snd_soc_dai_dma_data_set(dai, direction, stream);
 
        return 0;
 }
 
        return 0;
 }
index 7cdf184..c65abe8 100644 (file)
@@ -295,7 +295,7 @@ static void rt711_sdca_jack_detect_handler(struct work_struct *work)
        if (!rt711->hs_jack)
                return;
 
        if (!rt711->hs_jack)
                return;
 
-       if (!rt711->component->card || !rt711->component->card->instantiated)
+       if (!snd_soc_card_is_instantiated(rt711->component->card))
                return;
 
        /* SDW_SCP_SDCA_INT_SDCA_0 is used for jack detection */
                return;
 
        /* SDW_SCP_SDCA_INT_SDCA_0 is used for jack detection */
@@ -1249,10 +1249,7 @@ static int rt711_sdca_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
-       if (direction == SNDRV_PCM_STREAM_PLAYBACK)
-               dai->playback_dma_data = stream;
-       else
-               dai->capture_dma_data = stream;
+       snd_soc_dai_dma_data_set(dai, direction, stream);
 
        return 0;
 }
 
        return 0;
 }
index 78e1da9..862f509 100644 (file)
@@ -243,7 +243,7 @@ static void rt711_jack_detect_handler(struct work_struct *work)
        if (!rt711->hs_jack)
                return;
 
        if (!rt711->hs_jack)
                return;
 
-       if (!rt711->component->card || !rt711->component->card->instantiated)
+       if (!snd_soc_card_is_instantiated(rt711->component->card))
                return;
 
        if (pm_runtime_status_suspended(rt711->slave->dev.parent)) {
                return;
 
        if (pm_runtime_status_suspended(rt711->slave->dev.parent)) {
@@ -976,10 +976,7 @@ static int rt711_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
-       if (direction == SNDRV_PCM_STREAM_PLAYBACK)
-               dai->playback_dma_data = stream;
-       else
-               dai->capture_dma_data = stream;
+       snd_soc_dai_dma_data_set(dai, direction, stream);
 
        return 0;
 }
 
        return 0;
 }
index 1fca7a3..9205103 100644 (file)
@@ -793,10 +793,7 @@ static int rt715_sdca_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
-       if (direction == SNDRV_PCM_STREAM_PLAYBACK)
-               dai->playback_dma_data = stream;
-       else
-               dai->capture_dma_data = stream;
+       snd_soc_dai_dma_data_set(dai, direction, stream);
 
        return 0;
 }
 
        return 0;
 }
index 1a2036c..c6dd9df 100644 (file)
@@ -777,10 +777,7 @@ static int rt715_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
        stream->sdw_stream = sdw_stream;
 
        /* Use tx_mask or rx_mask to configure stream tag and set dma_data */
-       if (direction == SNDRV_PCM_STREAM_PLAYBACK)
-               dai->playback_dma_data = stream;
-       else
-               dai->capture_dma_data = stream;
+       snd_soc_dai_dma_data_set(dai, direction, stream);
 
        return 0;
 }
 
        return 0;
 }