]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: codecs: pcm3168a: Drop CONFIG_PM-conditional preproc directive
authorCezary Rojewski <cezary.rojewski@intel.com>
Mon, 25 May 2026 20:18:01 +0000 (22:18 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 1 Jun 2026 14:52:57 +0000 (15:52 +0100)
Revert changes done in commit 489db5d94150 ("ASoC: pcm3168a:
Don't disable pcm3168a when CONFIG_PM defined") and add
pm_runtime_status_suspended() check.

The suspended-check addresses regulator's "unbalanced disables"
warning during driver removal even when CONFIG_PM is enabled.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20260525201801.1336936-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/pcm3168a.c

index 977b8ed45f2ee546364cd7a090295d3c3a75e3da..4503f2f0724e6dd6fddb43bbb8325d97d3b77ab4 100644 (file)
@@ -821,15 +821,6 @@ err_clk:
 }
 EXPORT_SYMBOL_GPL(pcm3168a_probe);
 
-static void pcm3168a_disable(struct device *dev)
-{
-       struct pcm3168a_priv *pcm3168a = dev_get_drvdata(dev);
-
-       regulator_bulk_disable(ARRAY_SIZE(pcm3168a->supplies),
-                              pcm3168a->supplies);
-       clk_disable_unprepare(pcm3168a->scki);
-}
-
 void pcm3168a_remove(struct device *dev)
 {
        struct pcm3168a_priv *pcm3168a = dev_get_drvdata(dev);
@@ -841,10 +832,12 @@ void pcm3168a_remove(struct device *dev)
         * The asserted level of GPIO_ACTIVE_LOW is LOW.
         */
        gpiod_set_value_cansleep(pcm3168a->gpio_rst, 1);
+
        pm_runtime_disable(dev);
-#ifndef CONFIG_PM
-       pcm3168a_disable(dev);
-#endif
+       if (!pm_runtime_status_suspended(dev)) {
+               regulator_bulk_disable(ARRAY_SIZE(pcm3168a->supplies), pcm3168a->supplies);
+               clk_disable_unprepare(pcm3168a->scki);
+       }
 }
 EXPORT_SYMBOL_GPL(pcm3168a_remove);
 
@@ -899,7 +892,8 @@ static int pcm3168a_rt_suspend(struct device *dev)
 
        regcache_cache_only(pcm3168a->regmap, true);
 
-       pcm3168a_disable(dev);
+       regulator_bulk_disable(ARRAY_SIZE(pcm3168a->supplies), pcm3168a->supplies);
+       clk_disable_unprepare(pcm3168a->scki);
 
        return 0;
 }