summaryrefslogtreecommitdiff
path: root/drivers/leds
AgeCommit message (Collapse)Author
2021-08-20leds: pca955x: Switch to i2c probe_newEddie James
The deprecated i2c probe functionality doesn't work with OF compatible strings, as it only checks for the i2c device id. Switch to the new way of probing and grab the match data to select the chip type. Signed-off-by: Eddie James <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-20leds: pca955x: Let the core process the fwnodeEddie James
Much of the fwnode processing in the PCA955x driver is now in the LEDs core driver, so pass the fwnode in the init data when registering the LED device. In order to preserve the existing naming scheme, check for an empty name and set it to the LED number. Signed-off-by: Eddie James <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-20leds: pca955x: Implement the default-state propertyEddie James
In order to retain the LED state after a system reboot, check the documented default-state device tree property during initialization. Modify the behavior of the probe according to the property. Signed-off-by: Eddie James <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-20leds: pca955x: Add brightness_get functionEddie James
Add a function to fetch the state of the hardware LED. Signed-off-by: Eddie James <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-20leds: pca955x: Clean up code formattingEddie James
Format the code. Add some variables to help shorten lines. Signed-off-by: Eddie James <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-20leds: leds-core: Implement the retain-state-shutdown propertyEddie James
Read the retain-state-shutdown device tree property to set the existing LED_RETAIN_AT_SHUTDOWN flag. Then check the flag when unregistering, and if set, don't set the brightness to OFF. This is useful for systems that want to keep the HW state of the LED across reboots. Signed-off-by: Eddie James <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-18leds: trigger: remove reference to obsolete CONFIG_IDE_GD_ATALukas Bulwahn
Commit b7fb14d3ac63 ("ide: remove the legacy ide driver") removes the definition of the config IDE_GD_ATA. So, remove the obsolete reference in ./drivers/leds/trigger/Kconfig. Signed-off-by: Lukas Bulwahn <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-18leds: lp50xx: Fix chip name in KConfigJan Kundrát
The 9-channel one is called LP5009, not LP509. Signed-off-by: Jan Kundrát <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-18leds: pwm: add support for default-state device propertyDenis Osterland-Heim
This patch adds support for "default-state" devicetree property, which allows to defer pwm init to first use of led. This allows to configure the PWM early in bootloader to let the LED blink until an application in Linux userspace sets something different. Signed-off-by: Denis Osterland-Heim <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-18leds: move default_state read from fwnode to coreDenis Osterland-Heim
This patch introduces a new function to read initial default_state from fwnode. Suggested-by: Pavel Machek <[email protected]> Signed-off-by: Denis Osterland-Heim <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-16leds: flash: Remove redundant initialization of variable retPavel Machek
Adjust initialization not to trigger Coverity warnings. Reported-by: Colin Ian King <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-07leds: lgm-sso: Propagate error codes from callee to callerAndy Shevchenko
The one of the latest change to the driver reveals the problem that the error codes from callee aren't propagated to the caller of __sso_led_dt_parse(). Fix this accordingly. Fixes: 9999908ca1ab ("leds: lgm-sso: Put fwnode in any case during ->probe()") Fixes: c3987cd2bca3 ("leds: lgm: Add LED controller driver for LGM SoC") Reported-by: kernel test robot <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-03leds: trigger: audio: Add an activate callback to ensure the initial ↵Hans de Goede
brightness is set Some 2-in-1s with a detachable (USB) keyboard(dock) have mute-LEDs in the speaker- and/or mic-mute keys on the keyboard. Examples of this are the Lenovo Thinkpad10 tablet (with its USB kbd-dock) and the HP x2 10 series. The detachable nature of these keyboards means that the keyboard and thus the mute LEDs may show up after the user (or userspace restoring old mixer settings) has muted the speaker and/or mic. Current LED-class devices with a default_trigger of "audio-mute" or "audio-micmute" initialize the brightness member of led_classdev with ledtrig_audio_get() before registering the LED. This makes the software state after attaching the keyboard match the actual audio mute state, e.g. cat /sys/class/leds/foo/brightness will show the right value. But before this commit nothing was actually calling the led_classdev's brightness_set[_blocking] callback so the value returned by ledtrig_audio_get() was never actually being sent to the hw, leading to the mute LEDs staying in their default power-on state, after attaching the keyboard, even if ledtrig_audio_get() returned a different state. This could be fixed by having the individual LED drivers call brightness_set[_blocking] themselves after registering the LED, but this really is something which should be done by a led-trigger activate callback. Add an activate callback for this, fixing the issue of the mute LEDs being out of sync after (re)attaching the keyboard. Cc: Takashi Iwai <[email protected]> Fixes: faa2541f5b1a ("leds: trigger: Introduce audio mute LED trigger") Reviewed-by: Marek Behún <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-03leds: rt8515: Put fwnode in any case during ->probe()Andy Shevchenko
fwnode_get_next_available_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller. Fixes: e1c6edcbea13 ("leds: rt8515: Add Richtek RT8515 LED driver") Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]> Reviewed-by: Linus Walleij <[email protected]>
2021-08-03leds: lt3593: Put fwnode in any case during ->probe()Andy Shevchenko
device_get_next_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller. Fixes: 8cd7d6daba93 ("leds: lt3593: Add device tree probing glue") Cc: Daniel Mack <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-03leds: lm3697: Make error handling more robustAndy Shevchenko
It's easy to miss necessary clean up, e.g. firmware node reference counting, during error path in ->probe(). Make it more robust by moving to a single point of return. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-03leds: lm3697: Update header block to reflect realityAndy Shevchenko
Currently the headers to be included look rather like a random set. Update them a bit to reflect the reality. While at it, drop unneeded dependcy to OF. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-03leds: lm3692x: Correct headers (of*.h -> mod_devicetable.h)Andy Shevchenko
There is no user of of*.h headers, but mod_devicetable.h. Update header block accordingly. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-03leds: lgm-sso: Convert to use list_for_each_entry*() APIAndy Shevchenko
Convert to use list_for_each_entry*() API insted of open coded variants. It saves few lines of code and makes iteasier to read and maintain. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-03leds: lgm-sso: Remove explicit managed GPIO resource cleanupAndy Shevchenko
The idea of managed resources is that they will be cleaned up automatically and in the proper order. Remove explicit GPIO cleanup. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-03leds: lgm-sso: Don't spam logs when probe is deferredAndy Shevchenko
When requesting GPIO line the probe can be deferred. In such case don't spam logs with an error message. This can be achieved by switching to dev_err_probe(). Fixes: c3987cd2bca3 ("leds: lgm: Add LED controller driver for LGM SoC") Cc: Amireddy Mallikarjuna reddy <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-03leds: lgm-sso: Put fwnode in any case during ->probe()Andy Shevchenko
fwnode_get_next_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller. All the same in fwnode_for_each_child_node() case. Fixes: c3987cd2bca3 ("leds: lgm: Add LED controller driver for LGM SoC") Cc: Amireddy Mallikarjuna reddy <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-08-03leds: el15203000: Correct headers (of*.h -> mod_devicetable.h)Andy Shevchenko
There is no user of of*.h headers, but mod_devicetable.h. Update header block accordingly. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Oleh Kravchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-07-12leds: is31fl32xx: Fix missing error code in is31fl32xx_parse_dt()Jiapeng Chong
The error code is missing in this code scenario, add the error code '-EINVAL' to the return value 'ret'. Eliminate the follow smatch warning: drivers/leds/leds-is31fl32xx.c:388 is31fl32xx_parse_dt() warn: missing error code 'ret'. Reported-by: Abaci Robot <[email protected]> Signed-off-by: Jiapeng Chong <[email protected]> Fixes: 9d7cffaf99f5 ("leds: Add driver for the ISSI IS31FL32xx family of LED controllers") Acked-by: David Rivshin <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-07-12leds: ktd2692: Move driver to flash subdirectoryLinus Walleij
We created a subdirectory for LED drivers that depend on CONFIG_LEDS_CLASS_FLASH, and this driver does so let's move it there. Cc: Ingi Kim <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-07-12leds: lm3601x: Move driver to flash subdirectoryLinus Walleij
We created a subdirectory for LED drivers that depend on CONFIG_LEDS_CLASS_FLASH, and this driver does so let's move it there. Cc: Dan Murphy <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-07-12leds: sgm3140: Move driver to flash subdirectoryLinus Walleij
We created a subdirectory for LED drivers that depend on CONFIG_LEDS_CLASS_FLASH, and this driver does so let's move it there. Cc: Luca Weiss <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-07-12leds: max77693: Move driver to flash subdirectoryLinus Walleij
We created a subdirectory for LED drivers that depend on CONFIG_LEDS_CLASS_FLASH, and this driver does so let's move it there. Signed-off-by: Linus Walleij <[email protected]> Acked-by: Jacek Anaszewski <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-07-12leds: as3645a: Move driver to flash subdirectoryLinus Walleij
We created a subdirectory for LED drivers that depend on CONFIG_LEDS_CLASS_FLASH, and this driver does so let's move it there. Signed-off-by: Linus Walleij <[email protected]> Acked-by: Sakari Ailus <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-07-12leds: aat1290: Move driver to flash subdirectoryLinus Walleij
We created a subdirectory for LED drivers that depend on CONFIG_LEDS_CLASS_FLASH, and this driver does so let's move it there. Signed-off-by: Linus Walleij <[email protected]> Acked-by: Jacek Anaszewski <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-07-03Merge tag 'leds-5.14-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds Pull LED updates from Pavel Machek: "This contains quite a lot of fixes, with more fixes in my inbox that did not make it (sorry)" * tag 'leds-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds: (36 commits) leds: lgm: Fix up includes leds: ktd2692: Fix an error handling path leds: as3645a: Fix error return code in as3645a_parse_node() leds: turris-omnia: add missing MODULE_DEVICE_TABLE leds: lp55xx: Initialize enable GPIO direction to output leds: lm36274: Add missed property.h leds: el15203000: Make error handling more robust leds: pwm: Make error handling more robust leds: lt3593: Make use of device properties leds: lp50xx: Put fwnode in error case during ->probe() leds: lm3697: Don't spam logs when probe is deferred leds: lm3692x: Put fwnode in any case during ->probe() leds: lm36274: Correct headers (of*.h -> mod_devicetable.h) leds: lm36274: Put fwnode in error case during ->probe() leds: lm3532: Make error handling more robust leds: lm3532: select regmap I2C API leds: lgm-sso: Drop duplicate NULL check for GPIO operations leds: lgm-sso: Remove unneeded of_match_ptr() leds: lgm-sso: Fix clock handling leds: el15203000: Introduce to_el15203000_led() helper ...
2021-07-01kernel.h: split out panic and oops helpersAndy Shevchenko
kernel.h is being used as a dump for all kinds of stuff for a long time. Here is the attempt to start cleaning it up by splitting out panic and oops helpers. There are several purposes of doing this: - dropping dependency in bug.h - dropping a loop by moving out panic_notifier.h - unload kernel.h from something which has its own domain At the same time convert users tree-wide to use new headers, although for the time being include new header back to kernel.h to avoid twisted indirected includes for existing users. [[email protected]: thread_info.h needs limits.h] [[email protected]: ia64 fix] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Co-developed-by: Andrew Morton <[email protected]> Acked-by: Mike Rapoport <[email protected]> Acked-by: Corey Minyard <[email protected]> Acked-by: Christian Brauner <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Acked-by: Kees Cook <[email protected]> Acked-by: Wei Liu <[email protected]> Acked-by: Rasmus Villemoes <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Acked-by: Sebastian Reichel <[email protected]> Acked-by: Luis Chamberlain <[email protected]> Acked-by: Stephen Boyd <[email protected]> Acked-by: Thomas Bogendoerfer <[email protected]> Acked-by: Helge Deller <[email protected]> # parisc Signed-off-by: Linus Torvalds <[email protected]>
2021-06-24leds: lgm: Fix up includesLinus Walleij
This driver is including the legacy GPIO header <linux/gpio.h> but the only thing it is using from that header is the wrong define for GPIOF_DIR_OUT. Fix it up by using GPIO_LINE_DIRECTION_OUT and including the correct consumer and driver headers. Cc: Amireddy Mallikarjuna reddy <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-06-24leds: ktd2692: Fix an error handling pathChristophe JAILLET
In 'ktd2692_parse_dt()', if an error occurs after a successful 'regulator_enable()' call, we should call 'regulator_enable()'. This is the same in 'ktd2692_probe()', if an error occurs after a successful 'ktd2692_parse_dt()' call. Instead of adding 'regulator_enable()' in several places, implement a resource managed solution and simplify the remove function accordingly. Fixes: b7da8c5c725c ("leds: Add ktd2692 flash LED driver") Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-06-23leds: as3645a: Fix error return code in as3645a_parse_node()Zhen Lei
Return error code -ENODEV rather than '0' when the indicator node can not be found. Fixes: a56ba8fbcb55 ("media: leds: as3645a: Add LED flash class driver") Reported-by: Hulk Robot <[email protected]> Acked-by: Sakari Ailus <[email protected]> Signed-off-by: Zhen Lei <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-06-23leds: turris-omnia: add missing MODULE_DEVICE_TABLEZou Wei
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module. Reported-by: Hulk Robot <[email protected]> Signed-off-by: Zou Wei <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-06-23leds: lp55xx: Initialize enable GPIO direction to outputDoug Zobel
The "Convert to use GPIO descriptors" commit changed the initialization of the enable GPIO from GPIOF_DIR_OUT to GPIOD_ASIS. This breaks systems where the GPIO does not default to output. Changing the enable initialization to GPIOD_OUT_LOW. Signed-off-by: Doug Zobel <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-05-30leds: lm36274: Add missed property.hAndy Shevchenko
It appears that property.h has been included in some configurations implicitly, but in some it's not and hence build may fail. Add missed property.h explicitly. Fixes: e2e8e4e81875 ("leds: lm36274: Correct headers (of*.h -> mod_devicetable.h)") Reported-by: kernel test robot <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-05-28leds: el15203000: Make error handling more robustAndy Shevchenko
It's easy to miss necessary clean up, e.g. firmware node reference counting, during error path in ->probe(). Make it more robust by moving to a single point of return. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-05-28leds: pwm: Make error handling more robustAndy Shevchenko
It's easy to miss necessary clean up, e.g. firmware node reference counting, during error path in ->probe(). Make it more robust by moving to a single point of return. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-05-28leds: lt3593: Make use of device propertiesAndy Shevchenko
Device property API allows to gather device resources from different sources, such as ACPI. Convert the driver to unleash the power of device property API. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-05-28leds: lp50xx: Put fwnode in error case during ->probe()Andy Shevchenko
fwnode_for_each_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller. OTOH, the successful iteration will drop reference count under the hood, no need to do it twice. Fixes: 242b81170fb8 ("leds: lp50xx: Add the LP50XX family of the RGB LED driver") Cc: Dan Murphy <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-05-28leds: lm3697: Don't spam logs when probe is deferredAndy Shevchenko
When requesting GPIO line the probe can be deferred. In such case don't spam logs with an error message. This can be achieved by switching to dev_err_probe(). Fixes: 5c1d824cda9f ("leds: lm3697: Introduce the lm3697 driver") Cc: Dan Murphy <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-05-28leds: lm3692x: Put fwnode in any case during ->probe()Andy Shevchenko
device_get_next_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller. Fixes: 9a5c1c64ac0a ("leds: lm3692x: Change DT calls to fwnode calls") Cc: Dan Murphy <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-05-28leds: lm36274: Correct headers (of*.h -> mod_devicetable.h)Andy Shevchenko
There is no user of of*.h headers, but mod_devicetable.h. Update header block accordingly. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-05-28leds: lm36274: Put fwnode in error case during ->probe()Andy Shevchenko
device_get_next_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller. In the older code the same is implied with device_for_each_child_node(). Fixes: 11e1bbc116a7 ("leds: lm36274: Introduce the TI LM36274 LED driver") Fixes: a448fcf19c9c ("leds: lm36274: don't iterate through children since there is only one") Cc: Dan Murphy <[email protected]> Cc: Marek Behún <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-05-28leds: lm3532: Make error handling more robustAndy Shevchenko
It's easy to miss necessary clean up, e.g. firmware node reference counting, during error path in ->probe(). Make it more robust by moving to a single point of return. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-05-28leds: lm3532: select regmap I2C APIAndy Shevchenko
Regmap APIs should be selected, otherwise link can fail ERROR: modpost: "__devm_regmap_init_i2c" [drivers/leds/leds-lm3532.ko] undefined! Fixes: bc1b8492c764 ("leds: lm3532: Introduce the lm3532 LED driver") Cc: Dan Murphy <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-05-28leds: lgm-sso: Drop duplicate NULL check for GPIO operationsAndy Shevchenko
Since GPIO operations are NULL-aware, we don't need to duplicate this check. Remove it and fold the rest of the code. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
2021-05-28leds: lgm-sso: Remove unneeded of_match_ptr()Andy Shevchenko
LGM SSO is an OF dependent driver, so of_match_ptr() can be safely removed. Remove the unneeded of_match_ptr(). Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Pavel Machek <[email protected]>