aboutsummaryrefslogtreecommitdiff
path: root/drivers/leds
AgeCommit message (Collapse)AuthorFilesLines
2020-07-12leds: pca955x: Include the right GPIO headerLinus Walleij1-1/+1
This driver provides a GPIO chip, so include <linux/gpio/driver.h> and not the legacy <linux/gpio.h> header. Cc: Andrew Jeffery <[email protected]> Cc: Joel Stanley <[email protected]> Cc: Matt Spinler <[email protected]> Cc: Cédric Le Goater <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-07-12leds: lp55xx: Convert to use GPIO descriptorsLinus Walleij1-16/+11
The LP55xx driver is already using the of_gpio() functions to pick a global GPIO number for "enable" from the device tree and request the line. Simplify it by just using a GPIO descriptor. Make sure to keep the enable GPIO line optional, change the naming from "lp5523_enable" to "LP55xx enable" to reflect that this is used on all LP55xx LED drivers. Cc: Milo Kim <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-07-09ARM: s3c24xx: leds: Convert to use GPIO descriptorsLinus Walleij1-29/+7
This converts the s3c24xx LED driver to use GPIO descriptors and also modify all board files to account for these changes by registering the appropriate GPIO tables for each board. The driver was using a custom flag to indicate open drain (tristate) but this can be handled by standard descriptor machine tables. The driver was setting non-pull-up for the pin using the custom S3C24xx GPIO API, but this is a custom pin control system used by the S3C24xx and no generic GPIO function, so this has simply been pushed back into the respective board files. Signed-off-by: Linus Walleij <[email protected]> Acked-by: Jacek Anaszewski <[email protected]> Signed-off-by: Krzysztof Kozlowski <[email protected]>
2020-06-22leds-bcm6328: support second hw blinking intervalÁlvaro Fernández Rojas1-22/+75
Right now the driver uses only 3 LED modes: 0: On 1: HW Blinking (Interval 1) 3: Off However, the controller supports a second HW blinking interval, which results in 4 possible LED modes: 0: On 1: HW Blinking (Interval 1) 2: HW Blinking (Interval 2) 3: Off Signed-off-by: Álvaro Fernández Rojas <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-06-22leds: drop redundant struct-device pointer castsJohan Hovold2-12/+6
Drop the pointless and needlessly confusing casts of struct-device pointers. Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-06-22leds: wm831x-status: fix use-after-free on unbindJohan Hovold1-1/+13
Several MFD child drivers register their class devices directly under the parent device. This means you cannot blindly do devres conversions so that deregistration ends up being tied to the parent device, something which leads to use-after-free on driver unbind when the class device is released while still being registered. Fixes: 8d3b6a4001ce ("leds: wm831x-status: Use devm_led_classdev_register") Cc: stable <[email protected]> # 4.6 Cc: Amitoj Kaur Chawla <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-06-22leds: lm36274: fix use-after-free on unbindJohan Hovold1-3/+12
Several MFD child drivers register their class devices directly under the parent device. This means you cannot use devres so that deregistration ends up being tied to the parent device, something which leads to use-after-free on driver unbind when the class device is released while still being registered. Fixes: 11e1bbc116a7 ("leds: lm36274: Introduce the TI LM36274 LED driver") Cc: stable <[email protected]> # 5.3 Cc: Dan Murphy <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-06-22leds: lm3533: fix use-after-free on unbindJohan Hovold1-3/+9
Several MFD child drivers register their class devices directly under the parent device. This means you cannot blindly do devres conversions so that deregistration ends up being tied to the parent device, something which leads to use-after-free on driver unbind when the class device is released while still being registered. Fixes: 50154e29e5cc ("leds: lm3533: Use devm_led_classdev_register") Cc: stable <[email protected]> # 4.6 Cc: Amitoj Kaur Chawla <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-06-22leds: da903x: fix use-after-free on unbindJohan Hovold1-1/+13
Several MFD child drivers register their class devices directly under the parent device. This means you cannot blindly do devres conversions so that deregistration ends up being tied to the parent device, something which leads to use-after-free on driver unbind when the class device is released while still being registered. Fixes: eed16255d66b ("leds: da903x: Use devm_led_classdev_register") Cc: stable <[email protected]> # 4.6 Cc: Amitoj Kaur Chawla <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-06-22leds: 88pm860x: fix use-after-free on unbindJohan Hovold1-1/+13
Several MFD child drivers register their class devices directly under the parent device. This means you cannot blindly do devres conversions so that deregistration ends up being tied to the parent device, something which leads to use-after-free on driver unbind when the class device is released while still being registered. Fixes: 375446df95ee ("leds: 88pm860x: Use devm_led_classdev_register") Cc: stable <[email protected]> # 4.6 Cc: Amitoj Kaur Chawla <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-06-22leds: lm355x: avoid enum conversion warningArnd Bergmann1-3/+4
clang points out that doing arithmetic between diffent enums is usually a mistake: drivers/leds/leds-lm355x.c:167:28: warning: bitwise operation between different enumeration types ('enum lm355x_tx2' and 'enum lm355x_ntc') [-Wenum-enum-conversion] reg_val = pdata->pin_tx2 | pdata->ntc_pin; ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ drivers/leds/leds-lm355x.c:178:28: warning: bitwise operation between different enumeration types ('enum lm355x_tx2' and 'enum lm355x_ntc') [-Wenum-enum-conversion] reg_val = pdata->pin_tx2 | pdata->ntc_pin | pdata->pass_mode; ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ In this driver, it is intentional, so add a cast to hide the false-positive warning. It appears to be the only instance of this warning at the moment. Fixes: b98d13c72592 ("leds: Add new LED driver for lm355x chips") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-06-04Merge tag 'leds-5.8-rc1' of ↵Linus Torvalds13-80/+1020
git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds Pull LED updates from Pavel Machek: "New drivers: aw2013, sgm3140, some fixes Nothing much to see here, next release should be more interesting" * tag 'leds-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds: leds: add aw2013 driver dt-bindings: leds: Add binding for aw2013 leds: trigger: remove redundant assignment to variable ret leds: netxbig: Convert to use GPIO descriptors leds: add sgm3140 driver dt-bindings: leds: Add binding for sgm3140 leds: ariel: Add driver for status LEDs on Dell Wyse 3020 leds: pwm: check result of led_pwm_set() in led_pwm_add() leds: tlc591xxt: hide error on EPROBE_DEFER leds: tca6507: Include the right header leds: lt3593: Drop surplus include leds: lp3952: Include the right header leds: lm355x: Drop surplus include
2020-05-25mailmap: change email for Ricardo RibaldaRicardo Ribalda Delgado1-1/+1
Modify emails to [email protected] and unify my surname in all the files. Signed-off-by: Ricardo Ribalda <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Corbet <[email protected]>
2020-05-25leds: add aw2013 driverNikita Travkin3-0/+447
This commit adds support for AWINIC AW2013 3-channel LED driver. The chip supports 3 PWM channels and is controlled with I2C. Signed-off-by: Nikita Travkin <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-04-27leds: trigger: remove redundant assignment to variable retColin Ian King1-2/+2
The variable ret is being assigned with a value that is never read and it is being updated later with a new value. The initialization is redundant and can be removed. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-04-27leds: netxbig: Convert to use GPIO descriptorsLinus Walleij1-67/+81
This converts the NetXbig LED driver to use GPIO descriptors instead of using the legacy interfaces in <linux/of_gpio.h> and <linux/gpio.h> to iteratively parse the device tree for global GPIO numbers. Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Pavel Machek <[email protected]> Tested-by: Simon Guinot <[email protected]>
2020-04-27leds: add sgm3140 driverLuca Weiss3-0/+329
Add a driver for the SGMICRO SGM3140 Buck/Boost Charge Pump LED driver. This device is controlled by two GPIO pins, one for enabling and the second one for switching between torch and flash mode. Signed-off-by: Luca Weiss <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-04-27leds: ariel: Add driver for status LEDs on Dell Wyse 3020Lubomir Rintel3-0/+145
This adds support for controlling the LEDs attached to the Embedded Controller on a Dell Wyse 3020 "Ariel" board. Signed-off-by: Lubomir Rintel <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-04-27leds: pwm: check result of led_pwm_set() in led_pwm_add()Denis Osterland-Heim1-5/+11
led_pwm_set() now returns an error when setting the PWM fails. Signed-off-by: Denis Osterland-Heim <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-04-17leds: tlc591xxt: hide error on EPROBE_DEFERTomi Valkeinen1-2/+3
If devm_led_classdev_register_ext() fails with EPROBE_DEFER, we get: tlc591xx 0-0040: couldn't register LED (null) Only print the error if the error is something else than EPROBE_DEFER. Signed-off-by: Tomi Valkeinen <[email protected]> Reviewed-by: Dan Murphy <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-04-17leds: tca6507: Include the right headerLinus Walleij1-1/+1
The TCA6507 optionally presents a GPIO controller, so include <linux/gpio/driver.h> instead of the legacy <linux/gpio.h>. Cc: NeilBrown <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-04-17leds: lt3593: Drop surplus includeLinus Walleij1-1/+0
This driver is already including and using the proper <linux/gpio/consumer.h> header, there is no need to include the legacy <linux/gpio.h> header. Cc: Daniel Mack <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-04-17leds: lp3952: Include the right headerLinus Walleij1-1/+1
This driver is using the GPIO descriptor API properly as it should be but is including the legacy GPIO header <linux/gpio.h>. Fix it by including <linux/gpio/consumer.h> instead. Cc: Tony Makkiel <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-04-17leds: lm355x: Drop surplus includeLinus Walleij1-1/+0
This driver includes <linux/gpio.h> but does not use any symbols from that file, so drop the include. Cc: G.Shark Jeong <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-04-06leds: core: Fix warning message when init_dataRicardo Ribalda Delgado1-1/+1
The warning message when a led is renamed due to name collition can fail to show proper original name if init_data is used. Eg: [ 9.073996] leds-gpio a0040000.leds_0: Led (null) renamed to red_led_1 due to name collision Fixes: bb4e9af0348d ("leds: core: Add support for composing LED class device names") Signed-off-by: Ricardo Ribalda Delgado <[email protected]> Acked-by: Jacek Anaszewski <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-04-06leds: sort Makefile entriesPavel Machek1-50/+50
Sort Makefile entries to reduce risk of rejects. Signed-off-by: Pavel Machek <[email protected]>
2020-04-06leds: ip30: label power LED as suchPavel Machek1-1/+1
Make label "white:power" to be consistent with dt-bindings/leds/common.h . Signed-off-by: Pavel Machek <[email protected]>
2020-04-06leds: lm3532: make bitfield 'enabled' unsignedColin Ian King1-1/+1
The bitfield 'enabled' should bit unsigned, so make it unsigned. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-03-21leds: leds-pwm: Replace zero-length array with flexible-array memberGustavo A. R. Silva1-1/+1
The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-03-21leds: leds-is31fl32xx: Replace zero-length array with flexible-array memberGustavo A. R. Silva1-1/+1
The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-03-21leds: pwm: remove useless pwm_period_nsDenis Osterland-Heim1-4/+0
This member seems to was a way to pass PWM period to the LED. Since there is no header anymore, this is useless. Signed-off-by: Denis Osterland-Heim <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-03-21leds: pwm: remove headerDenis Osterland-Heim1-1/+13
The header is only used by leds_pwm.c, so move contents to leds_pwm.c and remove it. Apply minor changes suggested by checkpatch. Remove deprecated and unused pwm_id member. Suggested-by: Pavel Machek <[email protected]> Signed-off-by: Denis Osterland-Heim <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-02-26leds: pwm: convert to atomic PWM APIUwe Kleine-König1-32/+9
pwm_config(), pwm_enable() and pwm_disable() should get removed in the long run. So update the driver to use the atomic API that is here to stay. A few side effects: - led_pwm_set() now returns an error when setting the PWM fails. - During .probe() the PWM isn't disabled implicitly by pwm_apply_args() any more. Signed-off-by: Uwe Kleine-König <[email protected]> Tested-by: Jeff LaBundy <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-02-26leds: pwm: simplify if conditionUwe Kleine-König1-1/+1
.pwm_period_ns is an unsigned integer. So when led->pwm_period_ns > 0 is false, we now assign 0 to a value that is already 0, so it doesn't hurt and we can skip checking the actual value. Signed-off-by: Uwe Kleine-König <[email protected]> Tested-by: Jeff LaBundy <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-02-26leds: add SGI IP30 led supportThomas Bogendoerfer3-0/+98
This patch implemenets a driver to support the front panel LEDs of SGI Octane (IP30) workstations. Reviewed-by: Dan Murphy <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]> Acked-by: Jacek Anaszewski <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-02-26leds: lm3697: fix spelling mistake "To" -> "Too"Colin Ian King1-1/+1
There is a spelling mistake in a dev_err message. Fix it. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-02-26leds: leds-bd2802: remove set but not used variable 'pdata'YueHaibing1-2/+0
Fixes gcc '-Wunused-but-set-variable' warning: drivers/leds/leds-bd2802.c: In function 'bd2802_probe': drivers/leds/leds-bd2802.c:663:35: warning: variable 'pdata' set but not used [-Wunused-but-set-variable] commit 4c3718f9d6a6 ("leds: bd2802: Convert to use GPIO descriptors") left behind this unused variable. Signed-off-by: YueHaibing <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-02-26leds: ns2: Convert to GPIO descriptorsLinus Walleij1-42/+31
This converts the NS2 LED driver to use GPIO descriptors. We take care to request the GPIOs "as is" which is what the current driver goes to lengths to achieve, then we use GPIOs throughout. As the nodes for each LED does not have any corresponding device, we need to use the DT-specific accessors to get these GPIO descriptors from the device tree. Cc: Vincent Donnefort <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Tested-by: Simon Guinot <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-02-26leds: ns2: Absorb platform dataLinus Walleij1-3/+27
Nothing in the kernel includes the external header <linux/platform_data/leds-kirkwood-ns2.h> so just push the contents into the ns2 leds driver. If someone wants to use platform data or board files to describe this device they should be able to do so using GPIO machine descriptors but in any case device tree should be the way forward for these systems in all cases I can think of, and the driver already supports that. Cc: Simon Guinot <[email protected]> Cc: Vincent Donnefort <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Tested-by: Simon Guinot <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-01-07leds: lm3692x: Disable chip on brightness 0Guido Günther1-1/+17
Otherwise there's a noticeable glow even with brightness 0. Also turning off the regulator can save additional power. Signed-off-by: Guido Günther <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-01-07leds: lm3692x: Split out lm3692x_leds_disableGuido Günther1-16/+26
Move the relevant parts out of lm3692x_remove() and call it from there. No functional change. Signed-off-by: Guido Günther <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-01-07leds: lm3692x: Move lm3692x_init and rename to lm3692x_leds_enableGuido Günther1-35/+35
This moves lm3692x_init so it can be used from lm3692x_brightness_set. Rename to lm3692_leds_enable to pair up with lm3692x_leds_disable. No functional change. Signed-off-by: Guido Günther <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-01-07leds: lm3692x: Make sure we don't exceed the maximum LED currentGuido Günther1-1/+19
The current is given by the formular from page 12 of https://www.ti.com/lit/ds/symlink/lm36922.pdf. We use this to limit the led's max_brightness using the led-max-microamp DT property. The formula for the lm36923 is identical according to the data sheet. Signed-off-by: Guido Günther <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-01-06leds: lm3692x: Allow to configure over voltage protectionGuido Günther1-4/+30
Overvoltage protection is currently using the default of 29V. Make it configurable via DT. Signed-off-by: Guido Günther <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-01-06leds: populate the device's of_nodeJean-Jacques Hiblot1-1/+3
If initialization data is available and its fwnode is actually a of_node, store this information in the led device's structure. This will allow the device to use or provide OF-based API such (devm_xxx). Signed-off-by: Jean-Jacques Hiblot <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-01-06leds: Add managed API to get a LED from a device driverJean-Jacques Hiblot1-0/+49
If the LED is acquired by a consumer device with devm_led_get(), it is automatically released when the device is detached. Signed-off-by: Jean-Jacques Hiblot <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-01-06leds: Add of_led_get() and led_put()Tomi Valkeinen1-0/+44
This patch adds basic support for a kernel driver to get a LED device. This will be used by the led-backlight driver. Only OF version is implemented for now, and the behavior is similar to PWM's of_pwm_get() and pwm_put(). Signed-off-by: Tomi Valkeinen <[email protected]> Signed-off-by: Jean-Jacques Hiblot <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2020-01-06leds: lm3532: add pointer to documentation and fix typoPavel1-1/+2
Add pointer to datasheet and fix typo in printk message. Signed-off-by: Pavel Machek <[email protected]>
2020-01-04leds: lm3532: use extended registration so that LED can be used for backlightPavel1-1/+7
Signed-off-by: Pavel Machek <[email protected]>
2020-01-02leds: lm3642: remove warnings for bad strtol, cleanup gotosPavel Machek1-23/+14
Bad string from userspace is not worth printing warning on; gotos that just directly return are not good, plus a comment fix. Cc: [email protected], [email protected], [email protected], [email protected] Signed-off-by: Pavel Machek <[email protected]>