alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next 0/4] Fix PM disable depth imbalance in probe
@ 2022-09-28 16:01 Zhang Qilong
  2022-09-28 16:01 ` [PATCH -next 1/4] ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe Zhang Qilong
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Zhang Qilong @ 2022-09-28 16:01 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, matthias.bgg; +Cc: alsa-devel, linux-mediatek

The pm_runtime_enable will increase power disable depth. Thus
a pairing decrement is needed on the error handling path to
keep it balanced according to context. We fix it by moving
pm_runtime_enable to the endding of probe.

Zhang Qilong (4):
  ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe
  ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe
  ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe
  ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe

 sound/soc/codecs/mt6660.c | 8 ++++++--
 sound/soc/codecs/wm5102.c | 6 +++---
 sound/soc/codecs/wm5110.c | 6 +++---
 sound/soc/codecs/wm8997.c | 6 +++---
 4 files changed, 15 insertions(+), 11 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH -next 1/4] ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe
  2022-09-28 16:01 [PATCH -next 0/4] Fix PM disable depth imbalance in probe Zhang Qilong
@ 2022-09-28 16:01 ` Zhang Qilong
  2022-09-28 16:01 ` [PATCH -next 2/4] ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe Zhang Qilong
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Zhang Qilong @ 2022-09-28 16:01 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, matthias.bgg; +Cc: alsa-devel, linux-mediatek

The pm_runtime_enable will increase power disable depth. Thus
a pairing decrement is needed on the error handling path to
keep it balanced according to context. We fix it by moving
pm_runtime_enable to the endding of wm8997_probe

Fixes:40843aea5a9bd ("ASoC: wm8997: Initial CODEC driver")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 sound/soc/codecs/wm8997.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c
index 210ad662fc26..77136a521605 100644
--- a/sound/soc/codecs/wm8997.c
+++ b/sound/soc/codecs/wm8997.c
@@ -1161,9 +1161,6 @@ static int wm8997_probe(struct platform_device *pdev)
 		regmap_update_bits(arizona->regmap, wm8997_digital_vu[i],
 				   WM8997_DIG_VU, WM8997_DIG_VU);
 
-	pm_runtime_enable(&pdev->dev);
-	pm_runtime_idle(&pdev->dev);
-
 	arizona_init_common(arizona);
 
 	ret = arizona_init_vol_limit(arizona);
@@ -1182,6 +1179,9 @@ static int wm8997_probe(struct platform_device *pdev)
 		goto err_spk_irqs;
 	}
 
+	pm_runtime_enable(&pdev->dev);
+	pm_runtime_idle(&pdev->dev);
+
 	return ret;
 
 err_spk_irqs:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH -next 2/4] ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe
  2022-09-28 16:01 [PATCH -next 0/4] Fix PM disable depth imbalance in probe Zhang Qilong
  2022-09-28 16:01 ` [PATCH -next 1/4] ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe Zhang Qilong
@ 2022-09-28 16:01 ` Zhang Qilong
  2022-09-28 16:06   ` Mark Brown
  2022-09-29  9:21   ` Charles Keepax
  2022-09-28 16:01 ` [PATCH -next 3/4] ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe Zhang Qilong
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 8+ messages in thread
From: Zhang Qilong @ 2022-09-28 16:01 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, matthias.bgg; +Cc: alsa-devel, linux-mediatek

The pm_runtime_enable will increase power disable depth. Thus
a pairing decrement is needed on the error handling path to
keep it balanced according to context. We fix it by moving
pm_runtime_enable to the endding of wm5110_probe.

Fixes:5c6af635fd772 ("ASoC: wm5110: Add audio CODEC driver")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 sound/soc/codecs/wm5110.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index f3f4a10bf0f7..fc634c995834 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -2457,9 +2457,6 @@ static int wm5110_probe(struct platform_device *pdev)
 		regmap_update_bits(arizona->regmap, wm5110_digital_vu[i],
 				   WM5110_DIG_VU, WM5110_DIG_VU);
 
-	pm_runtime_enable(&pdev->dev);
-	pm_runtime_idle(&pdev->dev);
-
 	ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1,
 				  "ADSP2 Compressed IRQ", wm5110_adsp2_irq,
 				  wm5110);
@@ -2492,6 +2489,9 @@ static int wm5110_probe(struct platform_device *pdev)
 		goto err_spk_irqs;
 	}
 
+	pm_runtime_enable(&pdev->dev);
+	pm_runtime_idle(&pdev->dev);
+
 	return ret;
 
 err_spk_irqs:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH -next 3/4] ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe
  2022-09-28 16:01 [PATCH -next 0/4] Fix PM disable depth imbalance in probe Zhang Qilong
  2022-09-28 16:01 ` [PATCH -next 1/4] ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe Zhang Qilong
  2022-09-28 16:01 ` [PATCH -next 2/4] ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe Zhang Qilong
@ 2022-09-28 16:01 ` Zhang Qilong
  2022-09-28 16:01 ` [PATCH -next 4/4] ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe Zhang Qilong
  2022-09-30  8:27 ` [PATCH -next 0/4] Fix PM disable depth imbalance in probe Mark Brown
  4 siblings, 0 replies; 8+ messages in thread
From: Zhang Qilong @ 2022-09-28 16:01 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, matthias.bgg; +Cc: alsa-devel, linux-mediatek

The pm_runtime_enable will increase power disable depth. Thus
a pairing decrement is needed on the error handling path to
keep it balanced according to context. We fix it by moving
pm_runtime_enable to the endding of wm5102_probe.

Fixes:93e8791dd34ca ("ASoC: wm5102: Initial driver")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 sound/soc/codecs/wm5102.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index af7d324e3352..c09c9ac51b3e 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -2099,9 +2099,6 @@ static int wm5102_probe(struct platform_device *pdev)
 		regmap_update_bits(arizona->regmap, wm5102_digital_vu[i],
 				   WM5102_DIG_VU, WM5102_DIG_VU);
 
-	pm_runtime_enable(&pdev->dev);
-	pm_runtime_idle(&pdev->dev);
-
 	ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1,
 				  "ADSP2 Compressed IRQ", wm5102_adsp2_irq,
 				  wm5102);
@@ -2134,6 +2131,9 @@ static int wm5102_probe(struct platform_device *pdev)
 		goto err_spk_irqs;
 	}
 
+	pm_runtime_enable(&pdev->dev);
+	pm_runtime_idle(&pdev->dev);
+
 	return ret;
 
 err_spk_irqs:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH -next 4/4] ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe
  2022-09-28 16:01 [PATCH -next 0/4] Fix PM disable depth imbalance in probe Zhang Qilong
                   ` (2 preceding siblings ...)
  2022-09-28 16:01 ` [PATCH -next 3/4] ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe Zhang Qilong
@ 2022-09-28 16:01 ` Zhang Qilong
  2022-09-30  8:27 ` [PATCH -next 0/4] Fix PM disable depth imbalance in probe Mark Brown
  4 siblings, 0 replies; 8+ messages in thread
From: Zhang Qilong @ 2022-09-28 16:01 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, matthias.bgg; +Cc: alsa-devel, linux-mediatek

The pm_runtime_enable will increase power disable depth. Thus
a pairing decrement is needed on the error handling path to
keep it balanced according to context. We fix it by moving
pm_runtime_enable to the endding of mt6660_i2c_probe.

Fixes:f289e55c6eeb4 ("ASoC: Add MediaTek MT6660 Speaker Amp Driver")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 sound/soc/codecs/mt6660.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/mt6660.c b/sound/soc/codecs/mt6660.c
index 4971cd0b90f8..554c33e8b62f 100644
--- a/sound/soc/codecs/mt6660.c
+++ b/sound/soc/codecs/mt6660.c
@@ -503,13 +503,17 @@ static int mt6660_i2c_probe(struct i2c_client *client)
 		dev_err(chip->dev, "read chip revision fail\n");
 		goto probe_fail;
 	}
-	pm_runtime_set_active(chip->dev);
-	pm_runtime_enable(chip->dev);
 
 	ret = devm_snd_soc_register_component(chip->dev,
 					       &mt6660_component_driver,
 					       &mt6660_codec_dai, 1);
+	if (!ret) {
+		pm_runtime_set_active(chip->dev);
+		pm_runtime_enable(chip->dev);
+	}
+
 	return ret;
+
 probe_fail:
 	_mt6660_chip_power_on(chip, 0);
 	mutex_destroy(&chip->io_lock);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH -next 2/4] ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe
  2022-09-28 16:01 ` [PATCH -next 2/4] ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe Zhang Qilong
@ 2022-09-28 16:06   ` Mark Brown
  2022-09-29  9:21   ` Charles Keepax
  1 sibling, 0 replies; 8+ messages in thread
From: Mark Brown @ 2022-09-28 16:06 UTC (permalink / raw)
  To: Zhang Qilong
  Cc: alsa-devel, patches, tiwai, lgirdwood, linux-mediatek, matthias.bgg

[-- Attachment #1: Type: text/plain, Size: 623 bytes --]

On Thu, Sep 29, 2022 at 12:01:14AM +0800, Zhang Qilong wrote:
> The pm_runtime_enable will increase power disable depth. Thus
> a pairing decrement is needed on the error handling path to
> keep it balanced according to context. We fix it by moving
> pm_runtime_enable to the endding of wm5110_probe.

As documented in submitting-patches.rst please send patches to the 
maintainers for the code you would like to change.  The normal kernel
workflow is that people apply patches from their inboxes, if they aren't
copied they are likely to not see the patch at all and it is much more
difficult to apply patches.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH -next 2/4] ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe
  2022-09-28 16:01 ` [PATCH -next 2/4] ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe Zhang Qilong
  2022-09-28 16:06   ` Mark Brown
@ 2022-09-29  9:21   ` Charles Keepax
  1 sibling, 0 replies; 8+ messages in thread
From: Charles Keepax @ 2022-09-29  9:21 UTC (permalink / raw)
  To: Zhang Qilong
  Cc: alsa-devel, tiwai, lgirdwood, broonie, linux-mediatek, matthias.bgg

On Thu, Sep 29, 2022 at 12:01:14AM +0800, Zhang Qilong wrote:
> The pm_runtime_enable will increase power disable depth. Thus
> a pairing decrement is needed on the error handling path to
> keep it balanced according to context. We fix it by moving
> pm_runtime_enable to the endding of wm5110_probe.
> 
> Fixes:5c6af635fd772 ("ASoC: wm5110: Add audio CODEC driver")
> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> ---

As Mark said please use maintainers and specifically if patching
the Wolfson/Cirrus CODECs please CC
patches@opensource.cirrus.com

>  sound/soc/codecs/wm5110.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
> index f3f4a10bf0f7..fc634c995834 100644
> --- a/sound/soc/codecs/wm5110.c
> +++ b/sound/soc/codecs/wm5110.c
> @@ -2457,9 +2457,6 @@ static int wm5110_probe(struct platform_device *pdev)
>  		regmap_update_bits(arizona->regmap, wm5110_digital_vu[i],
>  				   WM5110_DIG_VU, WM5110_DIG_VU);
>  
> -	pm_runtime_enable(&pdev->dev);
> -	pm_runtime_idle(&pdev->dev);
> -
>  	ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1,
>  				  "ADSP2 Compressed IRQ", wm5110_adsp2_irq,
>  				  wm5110);
> @@ -2492,6 +2489,9 @@ static int wm5110_probe(struct platform_device *pdev)
>  		goto err_spk_irqs;
>  	}
>  
> +	pm_runtime_enable(&pdev->dev);
> +	pm_runtime_idle(&pdev->dev);
> +

I think it would be better to keep the pm_runtime enables before
the IRQ and component stuff. Both of those could start triggering
PM runtime events. We probably need to add an extra error path
here for disabling the pm_runtime.

Thanks,
Charles

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH -next 0/4] Fix PM disable depth imbalance in probe
  2022-09-28 16:01 [PATCH -next 0/4] Fix PM disable depth imbalance in probe Zhang Qilong
                   ` (3 preceding siblings ...)
  2022-09-28 16:01 ` [PATCH -next 4/4] ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe Zhang Qilong
@ 2022-09-30  8:27 ` Mark Brown
  4 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2022-09-30  8:27 UTC (permalink / raw)
  To: perex, matthias.bgg, lgirdwood, tiwai, Zhang Qilong
  Cc: alsa-devel, linux-mediatek

On Thu, 29 Sep 2022 00:01:12 +0800, Zhang Qilong wrote:
> The pm_runtime_enable will increase power disable depth. Thus
> a pairing decrement is needed on the error handling path to
> keep it balanced according to context. We fix it by moving
> pm_runtime_enable to the endding of probe.
> 
> Zhang Qilong (4):
>   ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe
>   ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe
>   ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe
>   ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/4] ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe
      commit: 41a736ac20602f64773e80f0f5b32cde1830a44a
[2/4] ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe
      commit: 86b46bf1feb83898d89a2b4a8d08d21e9ea277a7
[3/4] ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe
      commit: fcbb60820cd3008bb44334a0395e5e57ccb77329
[4/4] ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe
      commit: b73f11e895e140537e7f8c7251211ccd3ce0782b

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-09-30  8:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 16:01 [PATCH -next 0/4] Fix PM disable depth imbalance in probe Zhang Qilong
2022-09-28 16:01 ` [PATCH -next 1/4] ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe Zhang Qilong
2022-09-28 16:01 ` [PATCH -next 2/4] ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe Zhang Qilong
2022-09-28 16:06   ` Mark Brown
2022-09-29  9:21   ` Charles Keepax
2022-09-28 16:01 ` [PATCH -next 3/4] ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe Zhang Qilong
2022-09-28 16:01 ` [PATCH -next 4/4] ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe Zhang Qilong
2022-09-30  8:27 ` [PATCH -next 0/4] Fix PM disable depth imbalance in probe Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).