diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-12-02 01:09:28 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-12-02 01:09:28 +0100 |
commit | 304220b56e8c6a99b71832427802221be472247a (patch) | |
tree | ed9fbce952e3b3796ec0fa18706a3c6b69f73dc9 /drivers/leds/leds-lm3692x.c | |
parent | Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cl... (diff) | |
parent | leds: trigger: netdev: fix handling on interface rename (diff) | |
download | linux-304220b56e8c6a99b71832427802221be472247a.tar.xz linux-304220b56e8c6a99b71832427802221be472247a.zip |
Merge tag 'leds-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds
Pull LED updates from Pavel Machek:
"This contains usual small updates to drivers, and removal of PAGE_SIZE
limits on /sys/class/leds/<led>/trigger.
We should not be really having that many triggers; but with cpu
activity triggers we do, and we'll eventually need to fix it, but...
remove the limit for now"
* tag 'leds-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds: (26 commits)
leds: trigger: netdev: fix handling on interface rename
leds: an30259a: add a check for devm_regmap_init_i2c
leds: mlxreg: Fix possible buffer overflow
leds: pca953x: Use of_device_get_match_data()
leds: core: Fix leds.h structure documentation
leds: core: Fix devm_classdev_match to reference correct structure
leds: core: Remove extern from header
leds: lm3601x: Convert class registration to device managed
leds: flash: Add devm_* functions to the flash class
leds: flash: Remove extern from the header file
leds: flash: Convert non extended registration to inline
leds: Kconfig: Be consistent with the usage of "LED"
leds: remove PAGE_SIZE limit of /sys/class/leds/<led>/trigger
leds: tlc591xx: update the maximum brightness
leds: lm3692x: Use flags from LM3692X_BRT_CTRL
leds: lm3692x: Use flags from LM3692X_BOOST_CTRL
leds: lm3692x: Handle failure to probe the regulator
leds: lm3692x: Don't overwrite return value in error path
leds: lm3692x: Print error value on dev_err
leds: tlc591xx: use devm_led_classdev_register_ext()
...
Diffstat (limited to 'drivers/leds/leds-lm3692x.c')
-rw-r--r-- | drivers/leds/leds-lm3692x.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c index 3d381f2f73d0..8b408102e138 100644 --- a/drivers/leds/leds-lm3692x.c +++ b/drivers/leds/leds-lm3692x.c @@ -174,19 +174,20 @@ static int lm3692x_brightness_set(struct led_classdev *led_cdev, ret = lm3692x_fault_check(led); if (ret) { - dev_err(&led->client->dev, "Cannot read/clear faults\n"); + dev_err(&led->client->dev, "Cannot read/clear faults: %d\n", + ret); goto out; } ret = regmap_write(led->regmap, LM3692X_BRT_MSB, brt_val); if (ret) { - dev_err(&led->client->dev, "Cannot write MSB\n"); + dev_err(&led->client->dev, "Cannot write MSB: %d\n", ret); goto out; } ret = regmap_write(led->regmap, LM3692X_BRT_LSB, led_brightness_lsb); if (ret) { - dev_err(&led->client->dev, "Cannot write LSB\n"); + dev_err(&led->client->dev, "Cannot write LSB: %d\n", ret); goto out; } out: @@ -197,13 +198,13 @@ out: static int lm3692x_init(struct lm3692x_led *led) { int enable_state; - int ret; + int ret, reg_ret; if (led->regulator) { ret = regulator_enable(led->regulator); if (ret) { dev_err(&led->client->dev, - "Failed to enable regulator\n"); + "Failed to enable regulator: %d\n", ret); return ret; } } @@ -213,7 +214,8 @@ static int lm3692x_init(struct lm3692x_led *led) ret = lm3692x_fault_check(led); if (ret) { - dev_err(&led->client->dev, "Cannot read/clear faults\n"); + dev_err(&led->client->dev, "Cannot read/clear faults: %d\n", + ret); goto out; } @@ -248,9 +250,9 @@ static int lm3692x_init(struct lm3692x_led *led) goto out; ret = regmap_write(led->regmap, LM3692X_BOOST_CTRL, - LM3692X_BRHT_MODE_RAMP_MULTI | - LM3692X_BL_ADJ_POL | - LM3692X_RAMP_RATE_250us); + LM3692X_BOOST_SW_1MHZ | + LM3692X_BOOST_SW_NO_SHIFT | + LM3692X_OCP_PROT_1_5A); if (ret) goto out; @@ -267,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; @@ -311,14 +313,15 @@ out: gpiod_direction_output(led->enable_gpio, 0); if (led->regulator) { - ret = regulator_disable(led->regulator); - if (ret) + reg_ret = regulator_disable(led->regulator); + if (reg_ret) dev_err(&led->client->dev, - "Failed to disable regulator\n"); + "Failed to disable regulator: %d\n", reg_ret); } return ret; } + static int lm3692x_probe_dt(struct lm3692x_led *led) { struct fwnode_handle *child = NULL; @@ -334,9 +337,18 @@ static int lm3692x_probe_dt(struct lm3692x_led *led) return ret; } - led->regulator = devm_regulator_get(&led->client->dev, "vled"); - if (IS_ERR(led->regulator)) + led->regulator = devm_regulator_get_optional(&led->client->dev, "vled"); + if (IS_ERR(led->regulator)) { + ret = PTR_ERR(led->regulator); + if (ret != -ENODEV) { + if (ret != -EPROBE_DEFER) + dev_err(&led->client->dev, + "Failed to get vled regulator: %d\n", + ret); + return ret; + } led->regulator = NULL; + } child = device_get_next_child_node(&led->client->dev, child); if (!child) { @@ -409,7 +421,8 @@ static int lm3692x_remove(struct i2c_client *client) ret = regmap_update_bits(led->regmap, LM3692X_EN, LM3692X_DEVICE_EN, 0); if (ret) { - dev_err(&led->client->dev, "Failed to disable regulator\n"); + dev_err(&led->client->dev, "Failed to disable regulator: %d\n", + ret); return ret; } @@ -420,7 +433,7 @@ static int lm3692x_remove(struct i2c_client *client) ret = regulator_disable(led->regulator); if (ret) dev_err(&led->client->dev, - "Failed to disable regulator\n"); + "Failed to disable regulator: %d\n", ret); } mutex_destroy(&led->lock); |