Commit Graph

1248752 Commits

Author SHA1 Message Date
Abdel Alkuor
45066c4bbe leds: ncp5623: Add MS suffix to time defines
To make the time macro defines clearer, add MS as a suffix.

Signed-off-by: Abdel Alkuor <alkuor@gmail.com>
Link: https://lore.kernel.org/r/20240305133824.1551809-1-alkuor@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:20 +00:00
Abdel Alkuor
7b7e50f8f5 leds: Add NCP5623 multi-led driver
NCP5623 is DC-DC multi-LEDs driver which has three PWMs that can be
programmed up to 32 steps giving 32768 colors hue.

NCP5623 driver supports gradual dimming upward/downward with programmable
delays. Also, the driver supports driving a single LED or multi-LED
like RGB.

Signed-off-by: Abdel Alkuor <alkuor@gmail.com>
Link: https://lore.kernel.org/r/20240305042049.1533279-2-alkuor@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:18 +00:00
Abdel Alkuor
2c7c70f54f dt-bindings: leds: Add NCP5623 multi-LED Controller
NCP5623 is DC-DC multi-LED controller which can be used for RGB
illumination or backlight LCD display.

Signed-off-by: Abdel Alkuor <alkuor@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240305042049.1533279-1-alkuor@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:17 +00:00
Randy Dunlap
a22f11305d leds: mlxreg: Drop an excess struct mlxreg_led_data member
Drop one struct member description to fix a kernel-doc warning:

drivers/leds/leds-mlxreg.c:42: warning: Excess struct member 'led_data' description in 'mlxreg_led_data'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20240229071931.7870-4-rdunlap@infradead.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:16 +00:00
Randy Dunlap
e7dd80b5fd leds: leds-mlxcpld: Fix struct mlxcpld_led_priv member name
Change "cled" to "cdev" to quieten kernel-doc warnings:

leds-mlxcpld.c:86: warning: Function parameter or struct member 'cdev' not described in 'mlxcpld_led_priv'
leds-mlxcpld.c:86: warning: Excess struct member 'cled' description in 'mlxcpld_led_priv'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20240229071931.7870-3-rdunlap@infradead.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:16 +00:00
Randy Dunlap
d0c2df0c7b leds: lm3601x: Fix struct lm3601_led kernel-doc warnings
Add a short struct description and remove one extraneous struct field
description to quieten these warnings:

leds-lm3601x.c:73: warning: missing initial short description on line:
 * struct lm3601x_led -
leds-lm3601x.c💯 warning: Excess struct member 'led_name' description in 'lm3601x_led'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20240229071931.7870-2-rdunlap@infradead.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:15 +00:00
Arnd Bergmann
08b7dab9f0 leds: Fix ifdef check for gpio_led_register_device()
gpio_led_register_device() is built whenever CONFIG_LEDS_GPIO_REGISTER is
enabled, and this may be used even when CONFIG_NEW_LEDS is turned off.

However, the stub declaration in the header is provided for all configs
without CONFIG_NEW_LEDS, resulting in a build failure:

drivers/leds/leds-gpio-register.c:24:1: error: redefinition of 'gpio_led_register_device'
   24 | gpio_led_register_device(int id, const struct gpio_led_platform_data *pdata)
      | ^
include/linux/leds.h:646:39: note: previous definition is here

Change the #ifdef check to match the definition.
Note: this apparently took years of randconfig builds to hit, since
a number of other drivers just 'select NEW_LEDS' anyway.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240228093834.2230004-1-arnd@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:14 +00:00
Krzysztof Kozlowski
6c27bf4c6d dt-bindings: leds: qcom-lpg: Narrow nvmem for other variants
Only few variants support PPG and store LPG per-channel data and pattern
in SDAM modules.  Disallow the nvmem for other variants to make the
binding precise.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20240226073713.19045-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:14 +00:00
Krzysztof Kozlowski
615d49f552 dt-bindings: leds: qcom-lpg: Drop redundant qcom,pm8550-pwm in if:then:
"qcom,pm8550-pwm" is compatible with "qcom,pm8350c-pwm" (latter used as
fallback), thus it is enough for the "if:then:" clause to check for the
presence of the fallback "qcom,pm8350c-pwm".

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20240226073713.19045-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:13 +00:00
Rafał Miłecki
64e558500d dt-bindings: leds: Add LED_FUNCTION_WAN_ONLINE for Internet access
It's common for routers to have LED indicating link on the WAN port.

Some devices however have an extra LED that's meant to be used if WAN
connection is actually "online" (there is Internet access available).

It was suggested to add #define for such use case.

Link: https://lore.kernel.org/linux-devicetree/80e92209-5578-44e7-bd4b-603a29053ddf@collabora.com/T/#u
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240223112223.1368-1-zajec5@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:12 +00:00
Ondrej Jirman
205c29887a leds: sgm3140: Add missing timer cleanup and flash gpio control
Enabling strobe and then setting brightness to 0 causes the driver to enter
invalid state after strobe end timer fires. We should cancel strobe mode
resources when changing brightness (aka torch mode).

Fixes: cef8ec8cbd ("leds: add sgm3140 driver")
Signed-off-by: Ondrej Jirman <megi@xff.cz>
Link: https://lore.kernel.org/r/20240217191133.1757553-1-megi@xff.cz
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:12 +00:00
Duje Mihanović
2cd0d1db31 leds: expresswire: Don't depend on NEW_LEDS
The ExpressWire library does not depend on NEW_LEDS and selecting it
from a subsystem other than LEDs may cause Kconfig warnings:

WARNING: unmet direct dependencies detected for LEDS_EXPRESSWIRE
  Depends on [n]: NEW_LEDS [=n] && GPIOLIB [=y]
  Selected by [y]:
  - BACKLIGHT_KTD2801 [=y] && HAS_IOMEM [=y] && BACKLIGHT_CLASS_DEVICE [=y]

Move it out of the "if NEW_LEDS" block to allow selection from other
subsystems (in particular backlight) without raising this warning.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Closes: https://lore.kernel.org/20240212111819.936815-1-arnd@kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202402161410.IG9I4odj-lkp@intel.com/
Suggested-by: Daniel Thompson <daniel.thompson@linaro.org>
Fixes: 25ae5f5f4168 ("leds: Introduce ExpressWire library")
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
Link: https://lore.kernel.org/r/20240216-expresswire-deps-v2-2-8be59c4a75f5@skole.hr
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:11 +00:00
Duje Mihanović
041d2a0ea7 Revert "leds: Only descend into leds directory when CONFIG_NEW_LEDS is set"
This reverts commit b1ae40a5db.

The ExpressWire library introduced in commit 25ae5f5f4168 ("leds:
Introduce ExpressWire library") does not depend on NEW_LEDS, but without
this revert it would never get compiled if NEW_LEDS is not enabled.
Revert this commit to allow the library to be compiled.

Link: https://lore.kernel.org/2cacd8dc-6150-4aa2-af9e-830a202fb0a8@app.fastmail.com
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
Link: https://lore.kernel.org/r/20240216-expresswire-deps-v2-1-8be59c4a75f5@skole.hr
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:10 +00:00
George Stark
6969d0a2ba leds: aw2013: Unlock mutex before destroying it
In the probe() callback in case of error mutex is destroyed being locked
which is not allowed so unlock the mutex before destroying.

Fixes: 59ea3c9faf ("leds: add aw2013 driver")
Signed-off-by: George Stark <gnstark@salutedevices.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231214173614.2820929-2-gnstark@salutedevices.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:10 +00:00
Arnd Bergmann
bfa0f02d75 leds: qcom-lpg: Add QCOM_PBS dependency
The lpg driver fails to link now when the pbs driver is in a loadable module:

x86_64-linux-ld: drivers/leds/rgb/leds-qcom-lpg.o: in function `lpg_brightness_set':
leds-qcom-lpg.c:(.text+0xe7f): undefined reference to `qcom_pbs_trigger_event'
x86_64-linux-ld: drivers/leds/rgb/leds-qcom-lpg.o: in function `lpg_probe':
leds-qcom-lpg.c:(.text+0x16a5): undefined reference to `get_pbs_client_device'

Add a dependency to avoid the broken configuration. Apparently there is still
a use for lpg with pbs disabled entirely for certain chips, so allow both
but not LEDS_QCOM_LPG=y with QCOM_PBS=m.

Fixes: 214110175679 ("leds: rgb: leds-qcom-lpg: Add support for PPG through single SDAM")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Link: https://lore.kernel.org/r/20240212111526.829122-1-arnd@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:09 +00:00
Aren Moynihan
ec9aa8971f leds: rgb: leds-group-multicolor: Allow LEDs to stay on in suspend
If none of the managed LEDs enable LED_CORE_SUSPENDRESUME, then we
shouldn't need to set it here. This makes it possible to use multicolor
groups with GPIO LEDs that enable retain-state-suspended in the device
tree.

Signed-off-by: Aren Moynihan <aren@peacevolution.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Link: https://lore.kernel.org/r/20240206185400.596979-1-aren@peacevolution.org
[Lee: Changed the comment to respect proper grammar]
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:08 +00:00
Christian Marangi
415798bc07 leds: trigger: netdev: Fix kernel panic on interface rename trig notify
Commit d5e01266e7 ("leds: trigger: netdev: add additional specific link
speed mode") in the various changes, reworked the way to set the LINKUP
mode in commit cee4bd16c3 ("leds: trigger: netdev: Recheck
NETDEV_LED_MODE_LINKUP on dev rename") and moved it to a generic function.

This changed the logic where, in the previous implementation the dev
from the trigger event was used to check if the carrier was ok, but in
the new implementation with the generic function, the dev in
trigger_data is used instead.

This is problematic and cause a possible kernel panic due to the fact
that the dev in the trigger_data still reference the old one as the
new one (passed from the trigger event) still has to be hold and saved
in the trigger_data struct (done in the NETDEV_REGISTER case).

On calling of get_device_state(), an invalid net_dev is used and this
cause a kernel panic.

To handle this correctly, move the call to get_device_state() after the
new net_dev is correctly set in trigger_data (in the NETDEV_REGISTER
case) and correctly parse the new dev.

Fixes: d5e01266e7 ("leds: trigger: netdev: add additional specific link speed mode")
Cc: stable@vger.kernel.org
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20240203235413.1146-1-ansuelsmth@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:08 +00:00
Marijn Suijten
1c5b72e60c leds: qcom-lpg: Add PM660L configuration and compatible
Inherit PM660L PMIC LPG/triled block configuration from downstream
drivers and DT sources, consisting of a triled block with automatic
trickle charge control and source selection, three colored led channels
belonging to the synchronized triled block and one loose PWM channel.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20240204-pm660l-lpg-v5-1-2f54d1a0894b@somainline.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:07 +00:00
Stefan Kalscheuer
ccc35ff2fd leds: spi-byte: Use devm_led_classdev_register_ext()
Use extended classdev registration to generate generic device names from
color and function enums instead of reading only the label from the
device tree.

Signed-off-by: Stefan Kalscheuer <stefan@stklcode.de>
Link: https://lore.kernel.org/r/20240204150726.29783-1-stefan@stklcode.de
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:06 +00:00
Amitesh Singh
46f02b681b leds: pca963x: Add support for suspend and resume
This implements power management for pca9633 which enables
device sleep and resume on system-wide sleep/hibernation

Signed-off-by: Amitesh Singh <singh.amitesh@gmail.com>
Link: https://lore.kernel.org/r/20240203162524.343936-1-singh.amitesh@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:06 +00:00
Heiner Kallweit
9225333e48 leds: triggers: Add helper led_match_default_trigger
Avoid code duplication and factor out common functionality to new
helper led_match_default_trigger().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/d78eef6f-c18c-4546-b83e-6d1890849154@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:05 +00:00
Heiner Kallweit
e838a5a110 leds: trigger: Stop exporting trigger_list
Commit 682e98564ffb ("leds: trigger: panic: Simplify
led_trigger_set_panic") removed the last external user of variable
trigger_list. So stop exporting it. If in future a need should arise
again to access this variable, I think we better add some accessor
instead of exporting the variable directly.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/ca185fb1-3a66-46b9-920e-bfecbe39c6bf@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:04 +00:00
Arnd Bergmann
09e3f3244e leds: Make flash and multicolor dependencies unconditional
Along the same lines as making devm_led_classdev_register() declared
extern unconditional, do the same thing for the two sub-classes
that have similar stubs.

The users of these interfaces go to great lengths to allow building
with both the generic leds API and the extended version, but realistically
there is not much use in this, so just simplify it to always rely
on it and remove the confusing fallback logic.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240109090715.982332-2-arnd@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:03 +00:00
Arnd Bergmann
211f8ec940 leds: Remove led_init_default_state_get() and devm_led_classdev_register_ext() stubs
These two functions have stub implementations that are called when
NEW_LEDS and/or LEDS_CLASS are disabled, theorerically allowing drivers
to optionally use the LED subsystem.

However, this has never really worked because a built-in driver is
unable to link against these functions if the LED class is in a loadable
module. Heiner ran into this problem with a driver that newly gained
a LEDS_CLASS dependency and suggested using an IS_REACHABLE() check.

This is the reverse approach, removing the stub entirely to acknowledge
that it is pointless in its current form, and that not having it avoids
misleading developers into thinking that they can rely on it.

This survived around 1000 randconfig builds to validate that any callers
of the interface already have the correct Kconfig dependency already,
with the exception of the one that Heiner just added.

Cc: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/linux-leds/0f6f432b-c650-4bb8-a1b5-fe3372804d52@gmail.com/T/#u
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240109090715.982332-1-arnd@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:02 +00:00
Colin Ian King
d0532248df leds: aw200xx: Make read-only array coeff_table static const
Don't populate the read-only array coeff_table on the stack at
run time, instead make it static const.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20240119232630.2752239-1-colin.i.king@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:02 +00:00
Heiner Kallweit
7eef64da0b leds: trigger: panic: Simplify led_trigger_set_panic
I don't see why we iterate over all triggers to find the panic trigger.
We *are* the panic trigger. Therefore we also know that the panic
trigger doesn't have an activate() hook. So we can simplify the code
significantly.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Link: https://lore.kernel.org/r/84c0fa67-2f03-4474-aa75-914d65d88dd0@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:01 +00:00
Rafał Miłecki
ec18a2a83b dt-bindings: leds: Add FUNCTION defines for per-band WLANs
Most wireless routers and access points can operate in multiple bands
simultaneously. Vendors often equip their devices with per-band LEDs.

Add defines for those very common functions to allow cleaner & clearer
bindings.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20240117151736.27440-1-zajec5@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:00 +00:00
Heiner Kallweit
7e1121138c leds: triggers: default-on: Add module alias for module auto-loading
A bigger number of board device tree files, plus few drivers, set
default-on as default trigger for LED's. Therefore add an alias for
module auto-loading.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/7e94d26b-d772-4a07-b0f6-bb3111b9ff75@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:48:00 +00:00
Heiner Kallweit
cdac0fd2b7 leds: trigger: audio: Set module alias for module auto-loading
This a follow-up to 5edf7f11313d ("leds: trigger: Load trigger modules
on-demand if used as default trigger") and sets an alias for the audio
triggers.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/4663d2d8-660d-4af2-9f65-d95e95263923@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:47:59 +00:00
Florian Eckert
96d947d4ab Documentation: leds: Update led-trigger-tty ABI description
The 'led-trigger-tty' uses the same naming in the ABI documentation as
the 'led-trigger-netdev'. Which leads to the following warning when
building the documentation.

Warning: /sys/class/leds/<led>/rx is defined 2 times:
Documentation/ABI/testing/sysfs-class-led-trigger-tty:7
Documentation/ABI/testing/sysfs-class-led-trigger-netdev:49
Warning: /sys/class/leds/<led>/tx is defined 2 times:
Documentation/ABI/testing/sysfs-class-led-trigger-tty:15
Documentation/ABI/testing/sysfs-class-led-trigger-netdev:34

Renaming the 'What' path by prefixing it with 'tty_' solves this problem.

Fixes: 6dec659896 ("leds: ledtrig-tty: Add additional line state evaluation")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Link: https://lore.kernel.org/r/20240110133410.81645-1-fe@dev.tdt.de
Signed-off-by: Lee Jones <lee@kernel.org>
(cherry picked from commit ea411a8422c1d7f8193d726fb76ba09534b6a5fe)
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:47:59 +00:00
Christian Marangi
5fe5e2a3d7 docs: ABI: sysfs-class-led-trigger-netdev: Document now hidable link_*
Document now hidable link speed modes for the LED netdev trigger.

Link speed modes are now showed only if the named network device
supports them and are hidden if not.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20240111160501.1774-2-ansuelsmth@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:47:58 +00:00
Christian Marangi
06cdca014e leds: trigger: netdev: Display only supported link speed attribute
With the addition of more link speed mode to the netdev trigger, it was
pointed out that there may be a problem with bloating the attribute list
with modes that won't ever be supported by the trigger as the attached
device name doesn't support them.

To clear and address this problem, change the logic where these
additional trigger modes are listed.

Since the netdev trigger REQUIRE a device name to be set, attach to the
device name change function additional logic to parse the supported link
speed modes using ethtool APIs and show only the supported link speed
modes attribute.

Link speed attribute are refreshed on device_name set and on
NETDEV_CHANGE events.

This only apply to the link speed modes and every other mode is still
provided by default.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20240111160501.1774-1-ansuelsmth@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:47:57 +00:00
Heiner Kallweit
66601a29bb leds: class: If no default trigger is given, make hw_control trigger the default trigger
If a hw_control_trigger is defined, it's usually desirable to make it
the default trigger. Therefore make it the default trigger, except
the driver explicitly set a default trigger.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/f33543de-3800-488f-a779-1fa282614462@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:47:56 +00:00
Heiner Kallweit
fd14a87230 leds: trigger: netdev: Add module alias ledtrig:netdev
Add module alias ledtrig:netdev to enable auto-loading of the module.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/84a1bbd3-1ac7-4f37-849a-7f4d31698f76@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:47:56 +00:00
Heiner Kallweit
e09c706bfb leds: trigger: Load trigger modules on-demand if used as default trigger
Even if a trigger is set as default trigger for a LED device,
the respective trigger module (if built as module) isn't automatically
loaded by the kernel if the LED device is registered. I think we can
do better. Try to load the module asynchronously by alias
ledtrig:<trigger name>. This requires that such an alias is added to
relevant triggers.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/79adb260-06ad-443a-a68e-abe4498c3298@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:47:55 +00:00
Anjelique Melendez
c47d14545b leds: rgb: Update PM8350C lpg_data to support two-nvmem PPG Scheme
Update the pm8350c lpg_data struct so that pm8350c devices are treated as
PWM devices that support two-nvmem PPG scheme.

Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com>
Link: https://lore.kernel.org/r/20231221185838.28440-8-quic_amelende@quicinc.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:47:54 +00:00
Anjelique Melendez
5e9ff62686 leds: rgb: leds-qcom-lpg: Include support for PPG with dedicated LUT SDAM
On PMICs such as PM8350C, the pattern lookup table (LUT) is stored in a
separate SDAM from the one where the lpg per-channel data is stored.

Add support for PPG with a dedicated LUT SDAM while maintaining backward
compatibility for those targets that use only a single SDAM.

Co-developed-by: Guru Das Srinagesh <quic_gurus@quicinc.com>
Signed-off-by: Guru Das Srinagesh <quic_gurus@quicinc.com>
Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com>
Link: https://lore.kernel.org/r/20231221185838.28440-7-quic_amelende@quicinc.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:47:53 +00:00
Anjelique Melendez
05338ba56c leds: rgb: leds-qcom-lpg: Update PMI632 lpg_data to support PPG
Update the pmi632 lpg_data struct so that pmi632 devices use PPG
for LUT pattern.

Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com>
Tested-by: Luca Weiss <luca.weiss@fairphone.com>
Link: https://lore.kernel.org/r/20231221185838.28440-6-quic_amelende@quicinc.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:47:53 +00:00
Anjelique Melendez
6ab1f766a8 leds: rgb: leds-qcom-lpg: Add support for PPG through single SDAM
In some PMICs like pmi632, the pattern look up table (LUT) and LPG
configuration is stored in a single SDAM module instead of LUT
peripheral. This feature is called PPG. PPG uses Qualcomm Programmable
Boot Sequencer (PBS) inorder to trigger pattern sequences for PMICs.

Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com>
Tested-by: Luca Weiss <luca.weiss@fairphone.com>
Link: https://lore.kernel.org/r/20231221185838.28440-5-quic_amelende@quicinc.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:47:51 +00:00
Anjelique Melendez
d7d0efaf52 dt-bindings: leds: leds-qcom-lpg: Add support for LPG PPG
Update leds-qcom-lpg binding to support LPG PPG.

Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20231221185838.28440-3-quic_amelende@quicinc.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:47:50 +00:00
Heiner Kallweit
f574751cdf leds: trigger: netdev: Skip setting baseline state in activate if hw-controlled
The current codes uses the sw_control path in set_baseline_state() when
called from netdev_trig_activate() even if we're hw-controlled. This
may result in errors when led_set_brightness() is called because we may
not have set_brightness led ops (if hw doesn't support setting a "LED"
to ON). In addition this path may schedule trigger_data->work which
doesn't make sense when being hw-controlled.

Therefore set trigger_data->hw_control = true before calling
set_device_name() from netdev_trig_activate(). In this call chain we
have to prevent set_baseline_state() from being called, because this
would call hw_control_set(). Use led_cdev->trigger_data == NULL as
indicator for being called from netdev_trig_activate().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/d3f2859c-2673-401c-a4f7-fcaef2167991@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:47:50 +00:00
Lee Jones
888cd6e721 Merge branches 'ib-qcom-leds-6.9' and 'ib-leds-backlight-6.9' into ibs-for-leds-merged 2024-03-07 08:47:13 +00:00
Andy Shevchenko
7774f3d1dd leds: expresswire: Don't use "proxy" headers
Update header inclusions to follow IWYU (Include What You Use)
principle.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Duje Mihanović <duje.mihanovic@skole.hr>
Link: https://lore.kernel.org/r/20240223203010.881065-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:45:31 +00:00
Arnd Bergmann
d48ece99f2 leds: ktd2692: Add GPIOLIB dependency
The expresswire module requires gpiolib, so anything selecting it
also needs this dependency:

WARNING: unmet direct dependencies detected for LEDS_EXPRESSWIRE
  Depends on [n]: NEW_LEDS [=y] && GPIOLIB [=n]
  Selected by [y]:
  - LEDS_KTD2692 [=y] && NEW_LEDS [=y] && LEDS_CLASS_FLASH [=y] && OF [=y]

Fixes: e59a15af7aa6 ("leds: ktd2692: Convert to use ExpressWire library")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Link: https://lore.kernel.org/r/20240213165602.2230970-1-arnd@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:45:24 +00:00
Duje Mihanović
7534904d42 backlight: ktd2801: Make timing struct static
The struct containing the KTD2801 timing can be made static as it's not
referenced outside the KTD2801 driver. Do this to prevent sparse
complaints.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202402100625.M0RkJhMh-lkp@intel.com/
Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Link: https://lore.kernel.org/r/20240210-ktd2801-static-v1-1-90ad2e2e8483@skole.hr
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:45:20 +00:00
Duje Mihanović
a5554f1b5b backlight: Add Kinetic KTD2801 Backlight support
KTD2801 is a LED backlight driver IC found in samsung,coreprimevelte.
The brightness can be set using PWM or the ExpressWire protocol. Add
support for the KTD2801.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
Link: https://lore.kernel.org/r/20240125-ktd2801-v5-4-e22da232a825@skole.hr
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:45:16 +00:00
Duje Mihanović
922235a9b8 dt-bindings: backlight: Add Kinetic KTD2801 binding
KTD2801 is a LED backlight driver IC found in samsung,coreprimevelte.
The brightness can be set using PWM or the ExpressWire protocol. Add
a DT binding for the KTD2801.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
Link: https://lore.kernel.org/r/20240125-ktd2801-v5-3-e22da232a825@skole.hr
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:45:11 +00:00
Duje Mihanović
b5a8c50e5c leds: ktd2692: Convert to use ExpressWire library
The KTD2692 uses the ExpressWire protocol implemented in the newly
introduced ExpressWire library. Convert the driver to use the library.

Suggested-by: Daniel Thompson <daniel.thompson@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
Link: https://lore.kernel.org/r/20240125-ktd2801-v5-2-e22da232a825@skole.hr
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:45:08 +00:00
Duje Mihanović
1368d06dd2 leds: Introduce ExpressWire library
The ExpressWire protocol is shared between at least KTD2692 and KTD2801
with slight differences such as timings and the former not having a
defined set of pulses for enabling the protocol (possibly because it
does not support PWM unlike KTD2801). Despite these differences the
ExpressWire handling code can be shared between the two, so in
preparation for adding KTD2801 support introduce a library implementing
this protocol.

Suggested-by: Daniel Thompson <daniel.thompson@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
Link: https://lore.kernel.org/r/20240125-ktd2801-v5-1-e22da232a825@skole.hr
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07 08:45:03 +00:00
Anjelique Melendez
5b2dd77be1 soc: qcom: add QCOM PBS driver
Add the Qualcomm PBS (Programmable Boot Sequencer) driver. The QCOM PBS
driver supports configuring software PBS trigger events through PBS RAM
on Qualcomm Technologies, Inc (QTI) PMICs.

Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com>
Link: https://lore.kernel.org/r/20240201204421.16992-6-quic_amelende@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2024-02-01 16:26:55 -06:00