]> www.infradead.org Git - users/hch/misc.git/commitdiff
ASoC: soc-dapm: tidyup idle_bias handling - step1
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 4 Sep 2025 05:21:33 +0000 (05:21 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 18 Sep 2025 21:24:15 +0000 (22:24 +0100)
Current soc-dapm is using  "idle_bias_off", and its default settings
came from snd_soc_component "idle_bias_on". It is complicated/confusable.

Let's handling it as "idle_bias".

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/874itix06a.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 files changed:
include/sound/soc-dapm.h
sound/soc/codecs/wm8993.c
sound/soc/codecs/wm8994.c
sound/soc/intel/avs/boards/es8336.c
sound/soc/intel/avs/boards/rt274.c
sound/soc/intel/avs/boards/rt5640.c
sound/soc/intel/boards/bytcht_cx2072x.c
sound/soc/intel/boards/bytcht_es8316.c
sound/soc/intel/boards/bytcr_rt5640.c
sound/soc/intel/boards/bytcr_rt5651.c
sound/soc/intel/boards/bytcr_wm5102.c
sound/soc/intel/boards/sof_es8336.c
sound/soc/soc-core.c
sound/soc/soc-dapm.c
sound/soc/sof/sof-client-probes.c

index 498f8af79cfa10fa96e94c4547e53dd1641af996..9618a54a53485a7288bda1b18f79ad5fda103e81 100644 (file)
@@ -583,8 +583,7 @@ struct snd_soc_dapm_update {
 struct snd_soc_dapm_context {
        enum snd_soc_bias_level bias_level;
 
-       /* bit field */
-       unsigned int idle_bias_off:1;           /* Use BIAS_OFF instead of STANDBY */
+       bool idle_bias;                         /* Use BIAS_OFF instead of STANDBY when false */
 
        struct device *dev;                     /* from parent - for debug */ /* REMOVE ME */
        struct snd_soc_component *component;    /* parent component */
index 9be4f6cadba39e0af208034296f94afec86ec687..75d923c2c9cac8e43af90b27bf5f05d43428140e 100644 (file)
@@ -1536,7 +1536,7 @@ static int wm8993_probe(struct snd_soc_component *component)
         * VMID as an output and can disable it.
         */
        if (wm8993->pdata.lineout1_diff && wm8993->pdata.lineout2_diff)
-               dapm->idle_bias_off = 1;
+               dapm->idle_bias = false;
 
        return 0;
 
index 240ec1bed23470884d2cb55249272f9e7f7f2d48..128c3a59beac3d9bcef026581b4d6f0d94fc5a60 100644 (file)
@@ -4182,8 +4182,8 @@ static int wm8994_component_probe(struct snd_soc_component *component)
 
        wm8994->micdet_irq = control->pdata.micdet_irq;
 
-       /* By default use idle_bias_off, will override for WM8994 */
-       dapm->idle_bias_off = 1;
+       /* By default use idle_bias false, will override for WM8994 */
+       dapm->idle_bias = false;
 
        /* Set revision-specific configuration */
        switch (control->type) {
@@ -4191,7 +4191,7 @@ static int wm8994_component_probe(struct snd_soc_component *component)
                /* Single ended line outputs should have VMID on. */
                if (!control->pdata.lineout1_diff ||
                    !control->pdata.lineout2_diff)
-                       dapm->idle_bias_off = 0;
+                       dapm->idle_bias = true;
 
                switch (control->revision) {
                case 2:
index 12e4e0aba5fa24edf42fdf489b731fd388aef91c..eb2b40894e3f205e9bd054bcacf933be5370fbe7 100644 (file)
@@ -132,7 +132,7 @@ static int avs_es8336_codec_init(struct snd_soc_pcm_runtime *runtime)
        snd_jack_set_key(data->jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
        snd_soc_component_set_jack(component, &data->jack, NULL);
 
-       card->dapm.idle_bias_off = true;
+       card->dapm.idle_bias = false;
 
        return 0;
 }
index 67d2c4585cddc44f0e1f9299800abb721e6596b6..4055ecc60838f399b061c1406be9041c0ceb1345 100644 (file)
@@ -117,7 +117,7 @@ static int avs_rt274_codec_init(struct snd_soc_pcm_runtime *runtime)
                return ret;
        }
 
-       card->dapm.idle_bias_off = true;
+       card->dapm.idle_bias = false;
 
        return 0;
 }
index 706b84ffe1ef02de67b854d53c01452054c5f5c5..97d1fa944188fa3c9f49b0991a429f182bff0c8e 100644 (file)
@@ -67,7 +67,7 @@ static int avs_rt5640_codec_init(struct snd_soc_pcm_runtime *runtime)
                return ret;
 
        snd_soc_component_set_jack(codec_dai->component, jack, NULL);
-       card->dapm.idle_bias_off = true;
+       card->dapm.idle_bias = false;
 
        return 0;
 }
index 68a3d345dc25df4e6e1349642fffefd59a77c23f..27b63a853a48e48e10659255fc520132c74d43c6 100644 (file)
@@ -77,7 +77,7 @@ static int byt_cht_cx2072x_init(struct snd_soc_pcm_runtime *rtd)
                                           byt_cht_cx2072x_acpi_gpios))
                dev_warn(rtd->dev, "Unable to add GPIO mapping table\n");
 
-       card->dapm.idle_bias_off = true;
+       card->dapm.idle_bias = false;
 
        /* set the default PLL rate, the clock is handled by the codec driver */
        ret = snd_soc_dai_set_sysclk(snd_soc_rtd_to_codec(rtd, 0), CX2072X_MCLK_EXTERNAL_PLL,
index b384d38654e65847d7cc5396d8ea538eb91a3582..3b5f63112237eaa34ecc85e122fb49b8866ca889 100644 (file)
@@ -179,7 +179,7 @@ static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime)
        int num_routes;
        int ret;
 
-       card->dapm.idle_bias_off = true;
+       card->dapm.idle_bias = false;
 
        switch (BYT_CHT_ES8316_MAP(quirk)) {
        case BYT_CHT_ES8316_INTMIC_IN1_MAP:
index bc846558480e41292d2f02317da8803447d2558a..1e9b1903fae81081b5af24f10f6419a75987827e 100644 (file)
@@ -1324,7 +1324,7 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
        int num_routes = 0;
        int ret;
 
-       card->dapm.idle_bias_off = true;
+       card->dapm.idle_bias = false;
        jack_data->use_platform_clock = true;
 
        /* Start with RC clk for jack-detect (we disable MCLK below) */
index 604a35d380e9ab63190620faba7477a1d8d45461..ca540a66f22ce05768ff0996ba345a6a57f20751 100644 (file)
@@ -586,7 +586,7 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
        int report;
        int ret;
 
-       card->dapm.idle_bias_off = true;
+       card->dapm.idle_bias = false;
 
        /* Start with RC clk for jack-detect (we disable MCLK below) */
        if (byt_rt5651_quirk & BYT_RT5651_MCLK_EN)
index a6dfbcfdf74e3174c3dc65fc2a9a0b9cf4e8fc8a..72c0e5941ae840ffdf5a7272b185c8654d50cec6 100644 (file)
@@ -288,7 +288,7 @@ static int byt_wm5102_init(struct snd_soc_pcm_runtime *runtime)
        const struct snd_soc_dapm_route *custom_map = NULL;
        int ret, jack_type, num_routes = 0;
 
-       card->dapm.idle_bias_off = true;
+       card->dapm.idle_bias = false;
 
        ret = snd_soc_add_card_controls(card, byt_wm5102_controls,
                                        ARRAY_SIZE(byt_wm5102_controls));
index 1211a2b8a2a2c75d9c6a4b537bdd9f650750c5f2..10b189ea88dba8bf181b4f2a6562d42acf997724 100644 (file)
@@ -276,7 +276,7 @@ static int sof_es8316_init(struct snd_soc_pcm_runtime *runtime)
        int num_routes;
        int ret;
 
-       card->dapm.idle_bias_off = true;
+       card->dapm.idle_bias = false;
 
        if (quirk & SOC_ES8336_HEADSET_MIC1) {
                custom_map = sof_es8316_headset_mic1_map;
index cc9125ffe92ac0326a21469bdee2d10eb3234088..9dd84d73046be7747d50c794fde0369c9bbd9353 100644 (file)
@@ -717,7 +717,7 @@ int snd_soc_suspend(struct device *dev)
                                 * means it's doing something,
                                 * otherwise fall through.
                                 */
-                               if (dapm->idle_bias_off) {
+                               if (!dapm->idle_bias) {
                                        dev_dbg(component->dev,
                                                "ASoC: idle_bias_off CODEC on over suspend\n");
                                        break;
@@ -1652,7 +1652,7 @@ static int soc_probe_component(struct snd_soc_card *card,
        if (ret < 0)
                goto err_probe;
 
-       WARN(dapm->idle_bias_off &&
+       WARN(!dapm->idle_bias &&
             dapm->bias_level != SND_SOC_BIAS_OFF,
             "codec %s can not start from non-off bias with idle_bias_off==1\n",
             component->name);
index b90d0adb77132f7778e2b382c9922da3b1668dd5..cbe945f1dc9cf10d7b30f765f83194ec89031034 100644 (file)
@@ -2180,23 +2180,23 @@ end:
                dapm_seq_insert(w, down_list, false);
 }
 
-static bool dapm_idle_bias_off(struct snd_soc_dapm_context *dapm)
+static bool dapm_get_idle_bias(struct snd_soc_dapm_context *dapm)
 {
        struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
-       if (dapm->idle_bias_off)
-               return true;
+       if (!dapm->idle_bias)
+               return false;
 
        switch (snd_power_get_state(dapm->card->snd_card)) {
        case SNDRV_CTL_POWER_D3hot:
        case SNDRV_CTL_POWER_D3cold:
                if (component)
-                       return component->driver->suspend_bias_off;
+                       return !component->driver->suspend_bias_off;
                fallthrough;
        default:
                break;
        }
 
-       return false;
+       return true;
 }
 
 /*
@@ -2224,10 +2224,10 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event,
        trace_snd_soc_dapm_start(card, event);
 
        for_each_card_dapms(card, d) {
-               if (dapm_idle_bias_off(d))
-                       d->target_bias_level = SND_SOC_BIAS_OFF;
-               else
+               if (dapm_get_idle_bias(d))
                        d->target_bias_level = SND_SOC_BIAS_STANDBY;
+               else
+                       d->target_bias_level = SND_SOC_BIAS_OFF;
        }
 
        dapm_reset(card);
@@ -2291,7 +2291,7 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event,
                if (d->target_bias_level > bias)
                        bias = d->target_bias_level;
        for_each_card_dapms(card, d)
-               if (!dapm_idle_bias_off(d))
+               if (dapm_get_idle_bias(d))
                        d->target_bias_level = bias;
 
        trace_snd_soc_dapm_walk_done(card);
@@ -4825,7 +4825,7 @@ void snd_soc_dapm_init(struct snd_soc_dapm_context *dapm,
 
        if (component) {
                dapm->dev               = component->dev;
-               dapm->idle_bias_off     = !component->driver->idle_bias_on;
+               dapm->idle_bias         = component->driver->idle_bias_on;
        } else {
                dapm->dev               = card->dev;
        }
index 3ca8460774bb4dec32226c16fc325b3135de07aa..aaf0ae4bf01f8faf4932cc632787143d7e63d363 100644 (file)
@@ -525,7 +525,7 @@ static int sof_probes_client_probe(struct auxiliary_device *auxdev,
        card->dai_link = links;
 
        /* set idle_bias_off to prevent the core from resuming the card->dev */
-       card->dapm.idle_bias_off = true;
+       card->dapm.idle_bias = false;
 
        snd_soc_card_set_drvdata(card, cdev);