aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-09-26leds: pm8058: cosmetic change: use helper variableMarek Behún1-9/+11
Use helper variable dev instead of always writing &pdev->dev. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: pm8058: use struct led_init_data when registeringMarek Behún1-5/+6
By using struct led_init_data when registering we do not need to parse `label` DT property. Moreover `label` is deprecated and if it is not present but `color` and `function` are, LED core will compose a name from these properties instead. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: mt6323: cosmetic change: use helper variableMarek Behún1-4/+3
Use helper variable dev instead of always writing &pdev->dev. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Sean Wang <sean.wang@mediatek.com> Cc: John Crispin <john@phrozen.org> Cc: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: mt6323: use struct led_init_data when registeringMarek Behún1-3/+6
By using struct led_init_data when registering we do not need to parse `label` DT property. Moreover `label` is deprecated and if it is not present but `color` and `function` are, LED core will compose a name from these properties instead. Since init_data is passed with fwnode handle, we do not need to set the of_node member of the newly created LED classdev. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Sean Wang <sean.wang@mediatek.com> Cc: John Crispin <john@phrozen.org> Cc: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: max77650: use struct led_init_data when registeringMarek Behún1-14/+9
By using struct led_init_data when registering we do not need to parse `label` DT property. Moreover `label` is deprecated and if it is not present but `color` and `function` are, LED core will compose a name from these properties instead. Previously if the `label` DT property was not present, the code composed name for the LED in the form "max77650::" For backwards compatibility we therefore set init_data->default_label = ":"; so that the LED will not get a different name if `label` property is not present. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: lm3697: cosmetic change: use helper variable, reverse christmas treeMarek Behún1-39/+36
Use helper variable dev instead of always writing &client->dev, or &priv->client->dev, or even &led->priv->client->dev. With one more line moved reverse christmas tree is also achieved. 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-09-26leds: lm3697: use struct led_init_data when registeringMarek Behún1-10/+8
By using struct led_init_data when registering we do not need to parse `label` DT property. Moreover `label` is deprecated and if it is not present but `color` and `function` are, LED core will compose a name from these properties instead. Previously if the `label` DT property was not present, the code composed name for the LED in the form "parent_name::" For backwards compatibility we therefore set init_data->default_label = ":"; so that the LED will not get a different name if `label` property is not present. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Dan Murphy <dmurphy@ti.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: bcm6328, bcm6358: use struct led_init_data when registeringMarek Behún2-4/+6
By using struct led_init_data when registering we do not need to parse `label` DT property. Moreover `label` is deprecated and if it is not present but `color` and `function` are, LED core will compose a name from these properties instead. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Álvaro Fernández Rojas <noltari@gmail.com> Cc: Kevin Cernekee <cernekee@gmail.com> Cc: Jaedon Shin <jaedon.shin@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: bcm6328, bcm6358: use devres LED registering functionMarek Behún2-2/+2
These two drivers do not provide remove method and use devres for allocation of other resources, yet they use led_classdev_register instead of the devres variant, devm_led_classdev_register. Fix this. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Álvaro Fernández Rojas <noltari@gmail.com> Cc: Kevin Cernekee <cernekee@gmail.com> Cc: Jaedon Shin <jaedon.shin@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz> Cc: stable@kernel.org
2020-09-26leds: various: fix OF node leaksMarek Behún3-4/+12
Fix OF node leaks by calling of_node_put in for_each_available_child_of_node when the cycle breaks or returns. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Nikita Travkin <nikitos.tr@gmail.com> Cc: Milo Kim <milo.kim@ti.com> Cc: Dan Murphy <dmurphy@ti.com> Signed-off-by: Pavel Machek <pavel@ucw.cz> Not-for-stable: untested, theoretical, insignificant leaks
2020-09-26leds: various: use only available OF childrenMarek Behún15-26/+26
Various drivers count and iterate over OF children nodes via of_get_child_count and for_each_child_of_node. Instead they should use of_get_available_child_count and for_each_available_child_of_node, so that if a given node has the `status` property set to `disabled`, the child will be ignored. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Andrew Lunn <andrew@lunn.ch> Cc: Andrey Utkin <andrey_utkin@fastmail.com> Cc: Baolin Wang <baolin.wang7@gmail.com> Cc: Baolin Wang <baolin.wang@linaro.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Christian Mauderer <oss@c-mauderer.de> Cc: Chunyan Zhang <zhang.lyra@gmail.com> Cc: Dan Murphy <dmurphy@ti.com> Cc: David Rivshin <drivshin@allworx.com> Cc: Haojian Zhuang <haojian.zhuang@marvell.com> Cc: H. Nikolaus Schaller <hns@goldelico.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Milo Kim <milo.kim@ti.com> Cc: NeilBrown <neilb@suse.de> Cc: Nikita Travkin <nikitos.tr@gmail.com> Cc: Orson Zhai <orsonzhai@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Philippe Retornaz <philippe.retornaz@epfl.ch> Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Simon Guinot <sguinot@lacie.com> Cc: Simon Shields <simon@lineageos.org> Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Cc: Xiaotong Lu <xiaotong.lu@spreadtrum.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: lt3593: do not rewrite .of_node of new LED device to wrong valueMarek Behún1-1/+0
The devm_led_classdev_register_ext is given init_data with fwnode set, so the LED core sets .of_node of the new LED classdev correctly. Do not rewrite this value to parent of_node. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Daniel Mack <daniel@caiaq.de> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: various: use dev_of_node(dev) instead of dev->of_nodeMarek Behún28-35/+35
The dev_of_node function should be preferred. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Orson Zhai <orsonzhai@gmail.com> Cc: Baolin Wang <baolin.wang7@gmail.com> Cc: Chunyan Zhang <zhang.lyra@gmail.com> Cc: Sean Wang <sean.wang@mediatek.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: various: use device_get_match_dataMarek Behún5-34/+6
Simply use device_get_match_data instead of matching against the match table again. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: H. Nikolaus Schaller <hns@goldelico.com> Cc: David Rivshin <drivshin@allworx.com> Cc: Sebastian Reichel <sre@kernel.org> Cc: Christian Mauderer <oss@c-mauderer.de> Cc: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: ip30: compile if COMPILE_TEST=yMarek Behún2-1/+2
This driver can be compiled on other platforms with small change if COMPILE_TEST=y. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Pavel Machek <pavel@ucw.cz> Cc: Dan Murphy <dmurphy@ti.com> Cc: Thomas Bogendoerfer <tbogendoerfer@suse.de> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: various: compile if COMPILE_TEST=yMarek Behún1-5/+5
These drivers can be compiled without modification when COMPILE_TEST=y: cobalt-qube, cobalt-raq, netxbig, ns2 and s3c24xx Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Pavel Machek <pavel@ucw.cz> Cc: Dan Murphy <dmurphy@ti.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: pwm: Allow automatic labels for DT based devicesAlexander Dahl1-1/+2
If LEDs are configured through device tree and the property 'label' is omitted, the label is supposed to be generated from the properties 'function' and 'color' if present. While this works fine for e.g. the 'leds-gpio' driver, it did not for 'leds-pwm'. The reason is, you get this label naming magic only if you add a LED device through 'devm_led_classdev_register_ext()' and pass a pointer to the current device tree node. For the following node from dts the LED appeared as 'led-5' in sysfs before and as 'red:debug' after this change. pwm_leds { compatible = "pwm-leds"; led-5 { function = LED_FUNCTION_DEBUG; color = <LED_COLOR_ID_RED>; pwms = <&pwm0 2 10000000 0>; max-brightness = <127>; linux,default-trigger = "heartbeat"; panic-indicator; }; }; Signed-off-by: Alexander Dahl <post@lespocky.de> Cc: Marek Behún <marek.behun@nic.cz> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-09leds: tlc591xx: Simplify with dev_err_probe()Krzysztof Kozlowski1-6/+4
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-09leds: sgm3140: Simplify with dev_err_probe()Krzysztof Kozlowski1-18/+9
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-09leds: pwm: Simplify with dev_err_probe()Krzysztof Kozlowski1-7/+4
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-09leds: lm3692x: Simplify with dev_err_probe()Krzysztof Kozlowski1-7/+4
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-09leds: is31fl319x: Add shutdown pin and generate a 5ms low pulse when startupGrant Feng1-0/+18
generate a 5ms low pulse on shutdown pin when startup, then the chip becomes more stable in the complex EM environment. Signed-off-by: Grant Feng <von81@163.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-08-17leds: lp50xx: Add the LP50XX family of the RGB LED driverDan Murphy3-0/+646
Introduce the LP5036/30/24/18/12/9 RGB LED driver. The difference in these parts are the number of LED outputs where the: LP5036 can control 36 LEDs LP5030 can control 30 LEDs LP5024 can control 24 LEDs LP5018 can control 18 LEDs LP5012 can control 12 LEDs LP5009 can control 9 LEDs The device has the ability to group LED outputs into control banks so that multiple LED banks can be controlled with the same mixing and brightness. Or the LED outputs can also be controlled independently. 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-08-17leds: LP55XX_COMMON needs to depend on LEDS_CLASSRandy Dunlap1-0/+1
With these kernel configs: CONFIG_LEDS_CLASS=m # CONFIG_LEDS_CLASS_MULTICOLOR is not set CONFIG_LEDS_LP55XX_COMMON=y CONFIG_LEDS_LP5521=m CONFIG_LEDS_LP5562=m leds-lp55xx-common.c has a build error because it is builtin and calls an interface that is built as a loadable module (due to LEDS_CLASS=m). By making LEDS_LP55XX_COMMON depend on LEDS_CLASS, this config combination cannot happen, thus preventing the build error. ld: drivers/leds/leds-lp55xx-common.o: in function `lp55xx_register_leds': leds-lp55xx-common.c:(.text+0xc5f): undefined reference to `devm_led_classdev_register_ext' Fixes: 33b3a561f417 ("leds: support new LP8501 device - another LP55xx common") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Pavel Machek <pavel@ucw.cz> Cc: Dan Murphy <dmurphy@ti.com> Cc: Milo Kim <milo.kim@ti.com> Cc: linux-leds@vger.kernel.org Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-08-17leds: pca955x: Add an IBM software implementation of the PCA9552 chipEddie James1-0/+8
IBM created an implementation of the PCA9552 on a PIC16F microcontroller. The I2C device addresses are different from the hardware PCA9552, so add a new compatible string and associated platform data to be able to probe this device. Signed-off-by: Eddie James <eajames@linux.ibm.com> Reviewed-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-08-17leds: sgm3140: fix led->LED for consistencyPavel Machek1-1/+1
Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-08-17leds: mt6323: move period calculationTom Rix1-9/+9
clang static analysis reports this problem leds-mt6323.c:275:12: warning: Division by zero duty_hw = MT6323_CAL_HW_DUTY(*delay_on, period); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is because period can be 0. period = *delay_on + *delay_off; There is a later check that *delay_on/off are valid. if (!*delay_on && !*delay_off) { *delay_on = 500; *delay_off = 500; } Setting the delay_on/off means period needs to be recalculated anyway. So move the period statements after this check. Fixes: 216ec6cc4c19 ("leds: Add LED support for MT6323 PMIC") Signed-off-by: Tom Rix <trix@redhat.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-08-17leds: s3c24xx: Remove unused machine header includeKrzysztof Kozlowski1-2/+0
The driver includes machine header for GPIO registers but actually does not use them. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-08-05Merge tag 'leds-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-ledsLinus Torvalds30-210/+1001
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-03leds: disallow /sys/class/leds/*:multi:* for nowPavel Machek1-0/+4
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-03leds: add RGB color option, as that is different from multicolor.Pavel Machek2-1/+2
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-07-28Make LEDS_LP55XX_COMMON depend on I2C to fix build errors:Randy Dunlap1-0/+1
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-24leds: initial support for Turris Omnia LEDsMarek Behún3-0/+307
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-24leds: pattern trigger -- check pattern for validityPavel Machek1-2/+4
Don't allow invalid brightness in the pattern. Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-22leds: Replace HTTP links with HTTPS onesAlexander A. Klimov5-6/+6
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-22leds: trigger: add support for LED-private device triggersMarek Behún1-6/+20
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-22leds: lp5521: Add multicolor framework multicolor brightness supportDan Murphy1-0/+20
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-22leds: lp5523: Update the lp5523 code to add multicolor brightness functionDan Murphy1-0/+20
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-22leds: lp55xx: Add multicolor framework support to lp55xxDan Murphy7-52/+205
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-22leds: lp55xx: Convert LED class registration to devm_*Dan Murphy6-40/+13
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-22leds: multicolor: Introduce a multicolor class definitionDan Murphy3-0/+214
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-15leds: Add multicolor ID to the color ID listDan Murphy1-0/+1
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-15leds: lp5523: Fix various formatting issues in the codeDan Murphy1-9/+10
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-15leds: lp55xx: Fix file permissions to use DEVICE_ATTR macrosDan Murphy1-12/+10
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-12leds: gpio: Use struct_size() in devm_kzalloc()Gustavo A. R. Silva1-10/+3
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-12leds: ns2: Use struct_size() in devm_kzalloc()Gustavo A. R. Silva1-8/+1
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-12leds: gpio: Fix semantic errorLinus Walleij1-1/+1
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: 45d4c6de4e49 ("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-12leds: core: Flush scheduled work for system suspendKai-Heng Feng1-0/+1
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: 81fe8e5b73e3 ("leds: core: Add led_set_brightness_nosleep{nopm} functions") Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-07-12leds: trigger: gpio: Avoid warning on update of invertedJan Kiszka1-1/+2
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-12leds: fix spelling mistakeFlavio Suligoi1-1/+1
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>