Commit graph

1398 commits

Author SHA1 Message Date
Linus Torvalds
e4a7b2dc35 LEDs changes for 5.9-rc1.
Okay, so... this one is interesting. RGB LEDs are very common, and we
 need to have some kind of support for them. Multicolor is for
 arbitrary set of LEDs in one package, RGB is for LEDs that can produce
 full range of colors. We do not have real multicolor LED that is not
 RGB in the pipeline, so that one is disabled for now.
 
 You can expect this saga to continue with next pull requests.
 -----BEGIN PGP SIGNATURE-----
 
 iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCXyskqQAKCRAw5/Bqldv6
 8ge0AJ9JRTa/0Xkl7JuKUpC93jAnvjpK+ACgsDijb77H5zmtwC8xa0kXiDsbh3E=
 =aSJX
 -----END PGP SIGNATURE-----

Merge tag 'leds-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds

Pull LED updates from Pavel Machek:
 "Okay, so... this one is interesting. RGB LEDs are very common, and we
  need to have some kind of support for them. Multicolor is for
  arbitrary set of LEDs in one package, RGB is for LEDs that can produce
  full range of colors. We do not have real multicolor LED that is not
  RGB in the pipeline, so that one is disabled for now.

  You can expect this saga to continue with next pull requests"

* tag 'leds-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds: (37 commits)
  MAINTAINERS: Remove myself as LED subsystem maintainer
  leds: disallow /sys/class/leds/*:multi:* for now
  leds: add RGB color option, as that is different from multicolor.
  Make LEDS_LP55XX_COMMON depend on I2C to fix build errors:
  Documentation: ABI: leds-turris-omnia: document sysfs attribute
  leds: initial support for Turris Omnia LEDs
  dt-bindings: leds: add cznic,turris-omnia-leds binding
  leds: pattern trigger -- check pattern for validity
  leds: Replace HTTP links with HTTPS ones
  leds: trigger: add support for LED-private device triggers
  leds: lp5521: Add multicolor framework multicolor brightness support
  leds: lp5523: Update the lp5523 code to add multicolor brightness function
  leds: lp55xx: Add multicolor framework support to lp55xx
  leds: lp55xx: Convert LED class registration to devm_*
  dt-bindings: leds: Convert leds-lp55xx to yaml
  leds: multicolor: Introduce a multicolor class definition
  leds: Add multicolor ID to the color ID list
  dt: bindings: Add multicolor class dt bindings documention
  leds: lp5523: Fix various formatting issues in the code
  leds: lp55xx: Fix file permissions to use DEVICE_ATTR macros
  ...
2020-08-05 19:24:27 -07:00
Pavel Machek
77dce3a22e leds: disallow /sys/class/leds/*:multi:* for now
All the LEDs in the queue are RGB, so they should not use multi for
their color.

Make sure we don't add such LED by mistake (and make it part of ABI).

Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-08-03 14:00:06 +02:00
Pavel Machek
54212f5a1b leds: add RGB color option, as that is different from multicolor.
Multicolor is a bit too abstract. Yes, we can have
Green-Magenta-Ultraviolet LED, but so far all the LEDs we support are
RGB, and not even RGB-White or RGB-Yellow variants emerged.

Multicolor is not a good fit for RGB LED. It does not really know
about LED color.  In particular, there's no way to make LED "white".

Userspace is interested in knowing "this LED can produce arbitrary
color", which not all multicolor LEDs can.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-08-03 13:26:15 +02:00
Randy Dunlap
2742b4192a Make LEDS_LP55XX_COMMON depend on I2C to fix build errors:
leds-lp55xx-common.c:(.text+0x9d): undefined reference to `i2c_smbus_read_byte_data'
leds-lp55xx-common.c:(.text+0x8fc): undefined reference to `i2c_smbus_write_byte_data'

These errors happened when I2C=m and LEDS_LP55XX_COMMON=y, so
prevent that from being possible.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Dan Murphy <dmurphy@ti.com>
Cc: linux-leds@vger.kernel.org
Cc: Milo Kim <milo.kim@ti.com>
Cc: Mathias Nyman <mathias.nyman@nokia.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-28 12:26:13 +02:00
Marek Behún
089381b27a leds: initial support for Turris Omnia LEDs
This adds basic support for LEDs on the front side of CZ.NIC's Turris
Omnia router.

There are 12 RGB LEDs. The controller supports HW triggering mode for
the LEDs, but this driver does not support it yet, and sets all the LEDs
defined in device-tree into SW mode upon probe.

This driver uses the multicolor LED framework.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-24 12:58:55 +02:00
Pavel Machek
feff72735b leds: pattern trigger -- check pattern for validity
Don't allow invalid brightness in the pattern.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-24 12:43:57 +02:00
Alexander A. Klimov
c543733815 leds: Replace HTTP links with HTTPS ones
Rationale:
Reduces attack surface on kernel devs opening the links for MITM
as HTTPS traffic is much harder to manipulate.

Deterministic algorithm:
For each file:
  If not .svg:
    For each line:
      If doesn't contain `\bxmlns\b`:
        For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
	  If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
            If both the HTTP and HTTPS versions
            return 200 OK and serve the same content:
              Replace HTTP with HTTPS.

Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-22 14:48:40 +02:00
Marek Behún
93690cdf30 leds: trigger: add support for LED-private device triggers
Some LED controllers may come with an internal HW triggering mechanism
for the LED and the ability to switch between SW control and the
internal HW control. This includes most PHYs, various ethernet switches,
the Turris Omnia LED controller or AXP20X PMIC.

This adds support for registering such triggers.

This code is based on work by Pavel Machek <pavel@ucw.cz> and
Ondřej Jirman <megous@megous.com>.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-22 14:42:07 +02:00
Dan Murphy
00253ec2c9 leds: lp5521: Add multicolor framework multicolor brightness support
Add the multicolor brightness call back to support the multicolor
framework. This function allows setting the brightness across
grouped LED channels in a single call.

Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-22 14:42:07 +02:00
Dan Murphy
4047313260 leds: lp5523: Update the lp5523 code to add multicolor brightness function
Add the multicolor brightness call back to support the multicolor
framework. This call back allows setting brightness on grouped channels
in a single function.

Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-22 14:42:06 +02:00
Dan Murphy
92a81562e6 leds: lp55xx: Add multicolor framework support to lp55xx
Add multicolor framework support for the lp55xx family.

Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-22 14:42:06 +02:00
Dan Murphy
c732eaf01f leds: lp55xx: Convert LED class registration to devm_*
Convert the LED class registration calls to the LED devm_*
registration calls.

Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-22 14:42:06 +02:00
Dan Murphy
55d5d3b46b leds: multicolor: Introduce a multicolor class definition
Introduce a multicolor class that groups colored LEDs
within a LED node.

The multicolor class groups monochrome LEDs and allows controlling two
aspects of the final combined color: hue and lightness. The former is
controlled via the intensity file and the latter is controlled
via brightness file.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
[squashed leds: multicolor: Fix camel case in documentation in]
2020-07-22 14:41:29 +02:00
Dan Murphy
10d3e0d815 leds: Add multicolor ID to the color ID list
Add a new color ID that is declared as MULTICOLOR as with the
multicolor framework declaring a definitive color is not accurate
as the node can contain multiple colors.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-15 19:33:16 +02:00
Dan Murphy
7105e4647b leds: lp5523: Fix various formatting issues in the code
Fix checkpatch errors and warnings for the LP5523.c device
driver.

Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-15 19:32:54 +02:00
Dan Murphy
7e6f7f3ac3 leds: lp55xx: Fix file permissions to use DEVICE_ATTR macros
Fix the checkpatch warnings for the use of the file permission macros.
In converting the file permissions to the DEVICE_ATTR_XX macros the
call back function names needed to be updated within the code.

This means that the lp55xx_ needed to be dropped in the name to keep in
harmony with the ABI documentation.

Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-15 19:32:38 +02:00
Gustavo A. R. Silva
cf1a1a6a7d leds: gpio: Use struct_size() in devm_kzalloc()
Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes. Also, remove unnecessary
function sizeof_gpio_leds_priv().

This code was detected with the help of Coccinelle and, audited and
fixed manually.

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-12 10:28:01 +02:00
Gustavo A. R. Silva
a7ad53cb66 leds: ns2: Use struct_size() in devm_kzalloc()
Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes. Also, remove unnecessary
function sizeof_ns2_led_priv().

This code was detected with the help of Coccinelle and, audited and
fixed manually.

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-12 10:26:10 +02:00
Linus Walleij
c4e9441392 leds: gpio: Fix semantic error
The leds-gpio driver mixes up the legacy GPIO flags with the
GPIO descriptor flags and passes a legacy flag to
devm_gpiod_get_index().

Fix this by replacing the flags variable with the strict
descriptor flag.

Fixes: 45d4c6de4e ("leds: gpio: Try to lookup gpiod from device")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-12 10:14:05 +02:00
Kai-Heng Feng
302a085c20 leds: core: Flush scheduled work for system suspend
Sometimes LED won't be turned off by LED_CORE_SUSPENDRESUME flag upon
system suspend.

led_set_brightness_nopm() uses schedule_work() to set LED brightness.
However, there's no guarantee that the scheduled work gets executed
because no one flushes the work.

So flush the scheduled work to make sure LED gets turned off.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Fixes: 81fe8e5b73 ("leds: core: Add led_set_brightness_nosleep{nopm} functions")
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-12 10:10:37 +02:00
Jan Kiszka
5ad79c20b6 leds: trigger: gpio: Avoid warning on update of inverted
If the GPIO has not been configured yet, writing to inverted will raise
a kernel warning.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-12 10:06:38 +02:00
Flavio Suligoi
14d3e74f59 leds: fix spelling mistake
Fix typo: "Tigger" --> "Trigger"

Signed-off-by: Flavio Suligoi <f.suligoi@asem.it>
Reviewed-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-12 10:04:59 +02:00
Linus Walleij
0987c7df8a leds: pca955x: Include the right GPIO header
This driver provides a GPIO chip, so include <linux/gpio/driver.h>
and not the legacy <linux/gpio.h> header.

Cc: Andrew Jeffery <andrew@aj.id.au>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Matt Spinler <mspinler@linux.vnet.ibm.com>
Cc: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-12 09:53:24 +02:00
Linus Walleij
ac219bf3c9 leds: lp55xx: Convert to use GPIO descriptors
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 <milo.kim@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-12 09:52:22 +02:00
Linus Walleij
f7f611f2b1 ARM: s3c24xx: leds: Convert to use GPIO descriptors
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 <linus.walleij@linaro.org>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
2020-07-09 09:56:14 +02:00
Álvaro Fernández Rojas
e190f57df3 leds-bcm6328: support second hw blinking interval
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 <noltari@gmail.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-06-22 10:38:00 +02:00
Johan Hovold
b5684a73d2 leds: drop redundant struct-device pointer casts
Drop the pointless and needlessly confusing casts of struct-device
pointers.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-06-22 10:38:00 +02:00
Johan Hovold
47a459ecc8 leds: wm831x-status: fix use-after-free on unbind
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: 8d3b6a4001 ("leds: wm831x-status: Use devm_led_classdev_register")
Cc: stable <stable@vger.kernel.org>     # 4.6
Cc: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-06-22 10:38:00 +02:00
Johan Hovold
a0972fff09 leds: lm36274: fix use-after-free on unbind
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: 11e1bbc116 ("leds: lm36274: Introduce the TI LM36274 LED driver")
Cc: stable <stable@vger.kernel.org>     # 5.3
Cc: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-06-22 10:37:59 +02:00
Johan Hovold
d584221e68 leds: lm3533: fix use-after-free on unbind
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: 50154e29e5 ("leds: lm3533: Use devm_led_classdev_register")
Cc: stable <stable@vger.kernel.org>     # 4.6
Cc: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-06-22 10:37:59 +02:00
Johan Hovold
6f4aa35744 leds: da903x: fix use-after-free on unbind
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: eed16255d6 ("leds: da903x: Use devm_led_classdev_register")
Cc: stable <stable@vger.kernel.org>     # 4.6
Cc: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-06-22 10:37:58 +02:00
Johan Hovold
eca21c2d86 leds: 88pm860x: fix use-after-free on unbind
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: 375446df95 ("leds: 88pm860x: Use devm_led_classdev_register")
Cc: stable <stable@vger.kernel.org>     # 4.6
Cc: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-06-22 10:37:58 +02:00
Arnd Bergmann
985b1f596f leds: lm355x: avoid enum conversion warning
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: b98d13c725 ("leds: Add new LED driver for lm355x chips")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-06-22 10:37:57 +02:00
Linus Torvalds
86c67ce20d LEDs pull request for 5.8-rc1.
New drivers: aw2013, sgm3140, some fixes. Nothing much to see here,
 next release should be more interesting.
 -----BEGIN PGP SIGNATURE-----
 
 iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCXtjlggAKCRAw5/Bqldv6
 8mi4AJ9sFTwt9zcnIB3dZcD+C9J/GtCU7ACgwlN9UsQ1qvpEG1xE0mSgLlPvebQ=
 =HymN
 -----END PGP SIGNATURE-----

Merge tag 'leds-5.8-rc1' of 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-06-04 11:03:45 -07:00
Ricardo Ribalda Delgado
cea0fad0f8 mailmap: change email for Ricardo Ribalda
Modify  emails to ribalda@kernel.org and unify my surname in all the
files.

Signed-off-by: Ricardo Ribalda <ribalda@kernel.org>
Link: https://lore.kernel.org/r/20200430135224.362700-1-ricardo@ribalda.com
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2020-05-25 18:59:59 -06:00
Nikita Travkin
59ea3c9faf leds: add aw2013 driver
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 <nikitos.tr@gmail.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-05-25 12:56:39 +02:00
Colin Ian King
c85c7cdef3 leds: trigger: remove redundant assignment to variable ret
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 <colin.king@canonical.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-04-27 14:13:12 +02:00
Linus Walleij
9af512e819 leds: netxbig: Convert to use GPIO descriptors
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 <linus.walleij@linaro.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Tested-by: Simon Guinot <simon.guinot@sequanux.org>
2020-04-27 14:11:20 +02:00
Luca Weiss
cef8ec8cbd leds: add sgm3140 driver
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 <luca@z3ntu.xyz>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-04-27 11:44:51 +02:00
Lubomir Rintel
03f613f057 leds: ariel: Add driver for status LEDs on Dell Wyse 3020
This adds support for controlling the LEDs attached to the Embedded
Controller on a Dell Wyse 3020 "Ariel" board.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-04-27 11:35:11 +02:00
Denis Osterland-Heim
44c606b005 leds: pwm: check result of led_pwm_set() in led_pwm_add()
led_pwm_set() now returns an error when setting the PWM fails.

Signed-off-by: Denis Osterland-Heim <Denis.Osterland@diehl.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-04-27 11:35:11 +02:00
Tomi Valkeinen
ba50e011b1 leds: tlc591xxt: hide error on EPROBE_DEFER
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 <tomi.valkeinen@ti.com>
Reviewed-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-04-17 15:39:07 +02:00
Linus Walleij
ca99522667 leds: tca6507: Include the right header
The TCA6507 optionally presents a GPIO controller, so include
<linux/gpio/driver.h> instead of the legacy <linux/gpio.h>.

Cc: NeilBrown <neilb@suse.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-04-17 14:49:22 +02:00
Linus Walleij
cb60e2f9af leds: lt3593: Drop surplus include
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 <daniel@zonque.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-04-17 14:49:22 +02:00
Linus Walleij
da542caf1f leds: lp3952: Include the right header
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 <tony.makkiel@daqri.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-04-17 14:49:22 +02:00
Linus Walleij
ea1a6a15f4 leds: lm355x: Drop surplus include
This driver includes <linux/gpio.h> but does not use
any symbols from that file, so drop the include.

Cc: G.Shark Jeong <gshark.jeong@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-04-17 14:49:22 +02:00
Ricardo Ribalda Delgado
64ed6588c2 leds: core: Fix warning message when init_data
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: bb4e9af034 ("leds: core: Add support for composing LED class device names")
Signed-off-by: Ricardo Ribalda Delgado <ribalda@kernel.org>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-04-06 23:12:08 +02:00
Pavel Machek
457386350e leds: sort Makefile entries
Sort Makefile entries to reduce risk of rejects.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-04-06 22:57:10 +02:00
Pavel Machek
19aa984090 leds: ip30: label power LED as such
Make label "white:power" to be consistent with dt-bindings/leds/common.h .

Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-04-06 22:44:19 +02:00
Colin Ian King
28799272ac leds: lm3532: make bitfield 'enabled' unsigned
The bitfield 'enabled' should bit unsigned, so make it unsigned.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-04-06 22:44:18 +02:00