[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230330114826.GE434339@google.com>
Date: Thu, 30 Mar 2023 12:48:26 +0100
From: Lee Jones <lee@...nel.org>
To: "Lin, Meng-Bo" <linmengbo0689@...tonmail.com>
Cc: linux-kernel@...r.kernel.org, Pavel Machek <pavel@....cz>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Nikita Travkin <nikita@...n.ru>,
Stephan Gerhold <stephan@...hold.net>,
linux-leds@...r.kernel.org, devicetree@...r.kernel.org,
~postmarketos/upstreaming@...ts.sr.ht
Subject: Re: [PATCH 2/2] leds: aw2013: Add vdd regulator
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@...tonmail.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 [李琼斯]
Powered by blists - more mailing lists