All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: "Lin, Meng-Bo" <linmengbo0689@protonmail.com>
Cc: linux-kernel@vger.kernel.org, Pavel Machek <pavel@ucw.cz>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Nikita Travkin <nikita@trvn.ru>,
	Stephan Gerhold <stephan@gerhold.net>,
	linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht
Subject: Re: [PATCH 2/2] leds: aw2013: Add vdd regulator
Date: Thu, 30 Mar 2023 12:48:26 +0100	[thread overview]
Message-ID: <20230330114826.GE434339@google.com> (raw)
In-Reply-To: <20230320142116.3494-1-linmengbo0689@protonmail.com>

On Mon, 20 Mar 2023, Lin, Meng-Bo wrote:

> Implement support for a "vdd" that is enabled by the aw2013 driver so that
> the regulator gets enabled when needed.

There seems to be some dispute over the H/W.

Please improve this commit message to cover the following points.

What is currently broken / not working?

How does applying this patch help with that problem?

> Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
> ---
>  drivers/leds/leds-aw2013.c | 26 +++++++++++++++++---------
>  1 file changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/leds/leds-aw2013.c b/drivers/leds/leds-aw2013.c
> index 0b52fc9097c6..91d720edb857 100644
> --- a/drivers/leds/leds-aw2013.c
> +++ b/drivers/leds/leds-aw2013.c
> @@ -62,7 +62,7 @@ struct aw2013_led {
>
>  struct aw2013 {
>  	struct mutex mutex; /* held when writing to registers */
> -	struct regulator *vcc_regulator;
> +	struct regulator_bulk_data regulators[2];
>  	struct i2c_client *client;
>  	struct aw2013_led leds[AW2013_MAX_LEDS];
>  	struct regmap *regmap;
> @@ -106,7 +106,8 @@ static void aw2013_chip_disable(struct aw2013 *chip)
>
>  	regmap_write(chip->regmap, AW2013_GCR, 0);
>
> -	ret = regulator_disable(chip->vcc_regulator);
> +	ret = regulator_bulk_disable(ARRAY_SIZE(chip->regulators),
> +				     chip->regulators);
>  	if (ret) {
>  		dev_err(&chip->client->dev,
>  			"Failed to disable regulator: %d\n", ret);
> @@ -123,7 +124,8 @@ static int aw2013_chip_enable(struct aw2013 *chip)
>  	if (chip->enabled)
>  		return 0;
>
> -	ret = regulator_enable(chip->vcc_regulator);
> +	ret = regulator_bulk_enable(ARRAY_SIZE(chip->regulators),
> +				    chip->regulators);
>  	if (ret) {
>  		dev_err(&chip->client->dev,
>  			"Failed to enable regulator: %d\n", ret);
> @@ -348,16 +350,20 @@ static int aw2013_probe(struct i2c_client *client)
>  		goto error;
>  	}
>
> -	chip->vcc_regulator = devm_regulator_get(&client->dev, "vcc");
> -	ret = PTR_ERR_OR_ZERO(chip->vcc_regulator);
> -	if (ret) {
> +	chip->regulators[0].supply = "vcc";
> +	chip->regulators[1].supply = "vdd";
> +	ret = devm_regulator_bulk_get(&client->dev,
> +				      ARRAY_SIZE(chip->regulators),
> +				      chip->regulators);
> +	if (ret < 0) {
>  		if (ret != -EPROBE_DEFER)
>  			dev_err(&client->dev,
>  				"Failed to request regulator: %d\n", ret);
>  		goto error;
>  	}
>
> -	ret = regulator_enable(chip->vcc_regulator);
> +	ret = regulator_bulk_enable(ARRAY_SIZE(chip->regulators),
> +				    chip->regulators);
>  	if (ret) {
>  		dev_err(&client->dev,
>  			"Failed to enable regulator: %d\n", ret);
> @@ -382,7 +388,8 @@ static int aw2013_probe(struct i2c_client *client)
>  	if (ret < 0)
>  		goto error_reg;
>
> -	ret = regulator_disable(chip->vcc_regulator);
> +	ret = regulator_bulk_disable(ARRAY_SIZE(chip->regulators),
> +				     chip->regulators);
>  	if (ret) {
>  		dev_err(&client->dev,
>  			"Failed to disable regulator: %d\n", ret);
> @@ -394,7 +401,8 @@ static int aw2013_probe(struct i2c_client *client)
>  	return 0;
>
>  error_reg:
> -	regulator_disable(chip->vcc_regulator);
> +	regulator_bulk_disable(ARRAY_SIZE(chip->regulators),
> +			       chip->regulators);
>
>  error:
>  	mutex_destroy(&chip->mutex);
> --
> 2.30.2
>
>

--
Lee Jones [李琼斯]

      reply	other threads:[~2023-03-30 11:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 14:20 [PATCH 0/2] leds: aw2013: Add vdd regulator Lin, Meng-Bo
2023-03-20 14:22 ` [PATCH 1/2] dt-bindings: leds: aw2013: Document vdd-supply Lin, Meng-Bo
2023-03-20 16:44   ` Krzysztof Kozlowski
2023-03-30 11:46     ` Lee Jones
2023-03-30 13:44       ` Krzysztof Kozlowski
2023-03-30 17:18         ` Lee Jones
2023-03-20 14:22 ` [PATCH 2/2] leds: aw2013: Add vdd regulator Lin, Meng-Bo
2023-03-30 11:48   ` Lee Jones [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230330114826.GE434339@google.com \
    --to=lee@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linmengbo0689@protonmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=nikita@trvn.ru \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    --cc=stephan@gerhold.net \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.