summaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-bcm6328.c
Commit message (Collapse)AuthorAgeFilesLines
* leds: bcm6328: Get rid of custom led_init_default_state_get()Andy Shevchenko2023-01-301-25/+24
| | | | | | | | | | LED core provides a helper to parse default state from firmware node. Use it instead of custom implementation. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20230103131256.33894-5-andriy.shevchenko@linux.intel.com
* leds: leds-bcm6328: Demote kernel-doc abuseLee Jones2021-05-281-1/+1
| | | | | | | | | | | | | Fixes the following W=1 kernel build warning(s): drivers/leds/leds-bcm6328.c:97: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst Cc: Pavel Machek <pavel@ucw.cz> Cc: "Fernández Rojas" <noltari@gmail.com> Cc: Jonas Gorski <jogo@openwrt.org> Cc: linux-leds@vger.kernel.org Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
* leds: parse linux,default-trigger DT property in LED coreMarek Behún2020-09-261-4/+0
| | | | | | | | | | | | | | | | | | | | Do the parsing of `linux,default-trigger` DT property to LED core. Currently it is done in many different drivers and the code is repeated. This patch removes the parsing from 23 drivers: an30259a, aw2013, bcm6328, bcm6358, cr0014114, el15203000, gpio, is31fl32xx, lm3532, lm36274, lm3692x, lm3697, lp50xx, lp8860, lt3593, max77650, mt6323, ns2, pm8058, pwm, syscon, tlc591xx and turris-omnia. There is one driver in drivers/input which parses this property on it's own. I shall send a separate patch there after this is applied. There are still 8 drivers that parse this property on their own because they do not pass the led_init_data structure to the registering function. I will try to refactor those in the future. Signed-off-by: Marek Behún <marek.behun@nic.cz> Signed-off-by: Pavel Machek <pavel@ucw.cz>
* leds: bcm6328, bcm6358: use struct led_init_data when registeringMarek Behún2020-09-261-2/+3
| | | | | | | | | | | | | 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>
* leds: bcm6328, bcm6358: use devres LED registering functionMarek Behún2020-09-261-1/+1
| | | | | | | | | | | | | | | 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
* leds: various: use dev_of_node(dev) instead of dev->of_nodeMarek Behún2020-09-261-1/+1
| | | | | | | | | | | | | 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>
* leds-bcm6328: support second hw blinking intervalÁlvaro Fernández Rojas2020-06-221-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 <noltari@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
* leds: bcm6328: Use devm_platform_ioremap_resource() in bcm6328_leds_probe()Markus Elfring2019-11-031-6/+1
| | | | | | | | | Simplify this function implementation by using a known wrapper function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Pavel Machek <pavel@ucw.cz>
* treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner2019-05-301-5/+1
| | | | | | | | | | | | | | | | | | | | | Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* leds: bcm6328: fix signal source assignment for leds 4 to 7Jonas Gorski2017-06-131-2/+2
| | | | | | | | | | Each nibble represents 4 LEDs, and in case of the higher register, bit 0 represents LED 4, so we need to use modulus for the LED number as well. Fixes: fd7b025a238d0a5440bfa26c585eb78097bf48dc ("leds: add BCM6328 LED driver") Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Acked-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
* leds: bcm6328: improve blink supportÁlvaro Fernández Rojas2016-01-041-5/+15
| | | | | | | | | | | | | | BCM6328 controller has a margin of 20ms per blink step, which means that we can only set it to 20, 40, 60 ... 1260 ms (0x3f * 20ms). However, when checking if delay_on == delay_off, we were not considering the case when the user had set delay_on=20 and delay_off=21, since this will cause the driver to fallback to software blinking. This update fixes this issue and improves blink steps by rounding them in a more sensible way. Now 30-49ms is rounded to 40 ms, and previous behaviour implied 40-59ms being rounded to 40 ms. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
* leds: bcm6328: simplify duplicated unlock in bcm6328_blink_setÁlvaro Fernández Rojas2016-01-041-5/+5
| | | | | | | | Instead of duplicating the unlock we can store the return value and use a single unlock before returning that value, which simplifies the code. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
* leds: bcm6328: add little endian supportÁlvaro Fernández Rojas2016-01-041-0/+8
| | | | | | | This adds little endian support while keeping big endian support. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
* leds: bcm6328: remove unneded lock when checking initial LEDÁlvaro Fernández Rojas2016-01-041-3/+0
| | | | | | | | This lock isn't really needed, since we're only reading the register and changes made to other LEDs aren't relevant. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
* leds: bcm6328: code cleaningÁlvaro Fernández Rojas2016-01-041-4/+4
| | | | | | | | | - Remove double whitespace - Add missing brackets - Add spinlock info Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
* leds: bcm6328: Swap LED ON and OFF definitionsSimon Arlott2016-01-041-6/+6
| | | | | | | | | The values of BCM6328_LED_MODE_ON and BCM6328_LED_MODE_OFF were named for active low LEDs. These should be swapped so that they are named for the default case of active high LEDs. Signed-off-by: Simon Arlott <simon@fire.lp0.eu> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
* leds: bcm6328: Reuse bcm6328_led_set() instead of copying its functionalitySimon Arlott2016-01-041-6/+2
| | | | | | | | | | | | | When ensuring a consistent initial LED state in bcm6328_led (as they may be blinking instead of on/off), the LED register is set using an inverted copy of bcm6328_led_set(). To avoid further errors relating to active low handling, call this function directly instead. As bcm6328_led_set() acquires the same spinlock again when updating the register, it is called after unlocking. Signed-off-by: Simon Arlott <simon@fire.lp0.eu> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
* leds: bcm6328: add missing of_node_putJulia Lawall2015-11-031-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for_each_available_child_of_node performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // <smpl> @@ expression root,e; local idexpression child; @@ for_each_available_child_of_node(root, child) { ... when != of_node_put(child) when != e = child ( return child; | + of_node_put(child); ? return ...; ) ... } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
* leds-bcm6328: add more init configuration optionsÁlvaro Fernández Rojas2015-11-031-1/+14
| | | | | | | | | | | This patch adds more init register configuration options: - Serial LEDs multiplexing. - Serial LEDs clock signal low/high polarity. - Serial LEDs data signal low/high polarity. - Serial LEDs shift direction inverted/normal. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
* leds-bcm6328: simplify and improve default-state handlingÁlvaro Fernández Rojas2015-11-031-9/+15
| | | | | | | | | This patch simplifies and improves the code related to default-state handling. It also changes the code to power off the LEDs by default. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
* leds-bcm6328: print invalid LEDÁlvaro Fernández Rojas2015-11-031-1/+1
| | | | | | | Print invalid LED instead of warning only about maximum LED value. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
* leds: bcm6328: Fix module autoload for OF platform driverLuis de Bethencourt2015-09-171-0/+1
| | | | | | | | This platform driver has a OF device ID table but the OF module alias information is not created so module autoloading won't work. Signed-off-by: Luis de Bethencourt <luis@debethencourt.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
* leds: add BCM6328 LED driverÁlvaro Fernández Rojas2015-05-041-0/+413
This adds support for the LED controller on Broadcom's BCM6328. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jonas Gorski <jogo@openwrt.org> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Bryan Wu <cooloney@gmail.com>