alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: rt5665: add missed regulator_bulk_disable
@ 2023-07-23  7:07 Zhang Shurong
  2023-07-23 15:12 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Shurong @ 2023-07-23  7:07 UTC (permalink / raw)
  To: oder_chiou
  Cc: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel,
	Zhang Shurong

The driver forgets to call regulator_bulk_disable()

Add the missed call to fix it.

Fixes: 33ada14a26c8 ("ASoC: add rt5665 codec driver")
Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
---
 sound/soc/codecs/rt5665.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sound/soc/codecs/rt5665.c b/sound/soc/codecs/rt5665.c
index 83c367af91da..de36cad8a559 100644
--- a/sound/soc/codecs/rt5665.c
+++ b/sound/soc/codecs/rt5665.c
@@ -4756,6 +4756,13 @@ static void rt5665_calibrate_handler(struct work_struct *work)
 	rt5665_calibrate(rt5665);
 }
 
+static void rt5665_i2c_disable_regulators(void *data)
+{
+	struct rt5665_priv *rt5665 = data;
+
+	regulator_bulk_disable(ARRAY_SIZE(rt5665->supplies), rt5665->supplies);
+}
+
 static int rt5665_i2c_probe(struct i2c_client *i2c)
 {
 	struct rt5665_platform_data *pdata = dev_get_platdata(&i2c->dev);
@@ -4786,6 +4793,11 @@ static int rt5665_i2c_probe(struct i2c_client *i2c)
 		return ret;
 	}
 
+	ret = devm_add_action_or_reset(&i2c->dev, rt5665_i2c_disable_regulators,
+			rt5665);
+	if (ret)
+		return ret;
+
 	ret = regulator_bulk_enable(ARRAY_SIZE(rt5665->supplies),
 				    rt5665->supplies);
 	if (ret != 0) {
-- 
2.41.0



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

* Re: [PATCH] ASoC: rt5665: add missed regulator_bulk_disable
  2023-07-23  7:07 [PATCH] ASoC: rt5665: add missed regulator_bulk_disable Zhang Shurong
@ 2023-07-23 15:12 ` Mark Brown
  2023-08-01 15:46   ` Zhang Shurong
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2023-07-23 15:12 UTC (permalink / raw)
  To: Zhang Shurong
  Cc: oder_chiou, lgirdwood, perex, tiwai, alsa-devel, linux-kernel

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

On Sun, Jul 23, 2023 at 03:07:31PM +0800, Zhang Shurong wrote:

> +	ret = devm_add_action_or_reset(&i2c->dev, rt5665_i2c_disable_regulators,
> +			rt5665);
> +	if (ret)
> +		return ret;
> +
>  	ret = regulator_bulk_enable(ARRAY_SIZE(rt5665->supplies),
>  				    rt5665->supplies);
>  	if (ret != 0) {

This will attempt to disable the regulators if the initial enable fails
which is a bug.

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

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

* Re: [PATCH] ASoC: rt5665: add missed regulator_bulk_disable
  2023-07-23 15:12 ` Mark Brown
@ 2023-08-01 15:46   ` Zhang Shurong
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang Shurong @ 2023-08-01 15:46 UTC (permalink / raw)
  To: Mark Brown; +Cc: oder_chiou, lgirdwood, perex, tiwai, alsa-devel, linux-kernel

在 2023年7月23日星期日 CST 下午11:12:17,Mark Brown 写道:
> On Sun, Jul 23, 2023 at 03:07:31PM +0800, Zhang Shurong wrote:
> > +	ret = devm_add_action_or_reset(&i2c->dev, 
rt5665_i2c_disable_regulators,
> > +			rt5665);
> > +	if (ret)
> > +		return ret;
> > +
> > 
> >  	ret = regulator_bulk_enable(ARRAY_SIZE(rt5665->supplies),
> >  	
> >  				    rt5665->supplies);
> >  	
> >  	if (ret != 0) {
> 
> This will attempt to disable the regulators if the initial enable fails
> which is a bug.
You are right. I will move this to rt5663_i2c_remove() in next version.




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

end of thread, other threads:[~2023-08-01 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-23  7:07 [PATCH] ASoC: rt5665: add missed regulator_bulk_disable Zhang Shurong
2023-07-23 15:12 ` Mark Brown
2023-08-01 15:46   ` Zhang Shurong

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).