2019-09-20 22:58:50

by Guido Günther

[permalink] [raw]
Subject: [PATCH v2 0/5] leds: lm3692x: Probing and flag fixes

The driver currently returns success on init although probing fails and
register setup uses flag values from other registers which is confusing when
reading the driver. This series cleans this up.

Changes from v1:
- Add reviewed by's from Dan Murphy, thanks!
https://lore.kernel.org/linux-leds/[email protected]/T/#mc183f3f65931371fa9f9ca2e0e83e0b85010f24b
https://lore.kernel.org/linux-leds/[email protected]/T/#mb845fac36327a5d5dd03fe7e988eef0eb5626f82
https://lore.kernel.org/linux-leds/[email protected]/T/#m995bce73dda3e3bd4f0c2e8f98cbd04a39c13832
- As per review comment from Dan Murphy
- Don't drop error message when disabling the regulator fails
https://lore.kernel.org/linux-leds/[email protected]/T/#m2ab6dc33b7277b71a197c3747847f1c4d9d9c1d8
- Handle -ENODEV (when the regulator is not set)
https://lore.kernel.org/linux-leds/[email protected]/T/#mf6212c29bbfa37b43200ea2c9744074de4f068ee
- Add Acked-by from Pavel Machek, thanks!
https://lore.kernel.org/linux-leds/20190919095415.GA29939@amd/

To: Jacek Anaszewski <[email protected]>,Pavel Machek <[email protected]>,Dan Murphy <[email protected]>,[email protected],[email protected]


Guido Günther (5):
leds: lm3692x: Print error value on dev_err
leds: lm3692x: Don't overwrite return value in error path
leds: lm3692x: Handle failure to probe the regulator
leds: lm3692x: Use flags from LM3692X_BOOST_CTRL
leds: lm3692x: Use flags from LM3692X_BRT_CTRL

drivers/leds/leds-lm3692x.c | 45 ++++++++++++++++++++++++-------------
1 file changed, 29 insertions(+), 16 deletions(-)

--
2.23.0.rc1


2019-09-20 22:58:50

by Guido Günther

[permalink] [raw]
Subject: [PATCH v2 2/5] leds: lm3692x: Don't overwrite return value in error path

The driver currently reports successful initialization on every failure
as long as it's able to power off the regulator. Don't check the return
value of regulator_disable to avoid that.

Signed-off-by: Guido Günther <[email protected]>
---
drivers/leds/leds-lm3692x.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c
index 487228c2bed2..31115655f97b 100644
--- a/drivers/leds/leds-lm3692x.c
+++ b/drivers/leds/leds-lm3692x.c
@@ -198,7 +198,7 @@ static int lm3692x_brightness_set(struct led_classdev *led_cdev,
static int lm3692x_init(struct lm3692x_led *led)
{
int enable_state;
- int ret;
+ int ret, ret2;

if (led->regulator) {
ret = regulator_enable(led->regulator);
@@ -313,14 +313,15 @@ static int lm3692x_init(struct lm3692x_led *led)
gpiod_direction_output(led->enable_gpio, 0);

if (led->regulator) {
- ret = regulator_disable(led->regulator);
- if (ret)
+ ret2 = regulator_disable(led->regulator);
+ if (ret2)
dev_err(&led->client->dev,
"Failed to disable regulator\n");
}

return ret;
}
+
static int lm3692x_probe_dt(struct lm3692x_led *led)
{
struct fwnode_handle *child = NULL;
--
2.23.0.rc1

2019-09-20 22:59:03

by Guido Günther

[permalink] [raw]
Subject: [PATCH v2 5/5] leds: lm3692x: Use flags from LM3692X_BRT_CTRL

Use LM3692X_RAMP_EN instead of LM3692X_PWM_HYSTER_4LSB
since the later is a flag for the PWM register. The
actual register value remains unchanged.

Signed-off-by: Guido Günther <[email protected]>
Reviewed-by: Dan Murphy <[email protected]>
Acked-by: Pavel Machek <[email protected]>
---
drivers/leds/leds-lm3692x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c
index d8a60c7c8077..a404b66b31e5 100644
--- a/drivers/leds/leds-lm3692x.c
+++ b/drivers/leds/leds-lm3692x.c
@@ -269,7 +269,7 @@ static int lm3692x_init(struct lm3692x_led *led)
goto out;

ret = regmap_write(led->regmap, LM3692X_BRT_CTRL,
- LM3692X_BL_ADJ_POL | LM3692X_PWM_HYSTER_4LSB);
+ LM3692X_BL_ADJ_POL | LM3692X_RAMP_EN);
if (ret)
goto out;

--
2.23.0.rc1