Age | Commit message (Collapse) | Author |
|
st1202_dt_init() calls devm_led_classdev_register_ext() before the
internal data structures are properly set up, so the LEDs become visible
to user space while being partially initialized, leading to a window
where trying to access them causes a NULL pointer access.
Move devm_led_classdev_register_ext() from DT initialization
to the end of the probe function when DT and hardware are fully
initialized and ready to interact with user space.
Fixes: 259230378c65 ("leds: Add LED1202 I2C driver")
Signed-off-by: Manuel Fombuena <fombuena@outlook.com>
Link: https://lore.kernel.org/r/CWLP123MB54732771AC0CE5491B3C84DCC5C32@CWLP123MB5473.GBRP123.PROD.OUTLOOK.COM
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core and debugfs updates from Greg KH:
"Here is the big set of driver core and debugfs updates for 6.14-rc1.
Included in here is a bunch of driver core, PCI, OF, and platform rust
bindings (all acked by the different subsystem maintainers), hence the
merge conflict with the rust tree, and some driver core api updates to
mark things as const, which will also require some fixups due to new
stuff coming in through other trees in this merge window.
There are also a bunch of debugfs updates from Al, and there is at
least one user that does have a regression with these, but Al is
working on tracking down the fix for it. In my use (and everyone
else's linux-next use), it does not seem like a big issue at the
moment.
Here's a short list of the things in here:
- driver core rust bindings for PCI, platform, OF, and some i/o
functions.
We are almost at the "write a real driver in rust" stage now,
depending on what you want to do.
- misc device rust bindings and a sample driver to show how to use
them
- debugfs cleanups in the fs as well as the users of the fs api for
places where drivers got it wrong or were unnecessarily doing
things in complex ways.
- driver core const work, making more of the api take const * for
different parameters to make the rust bindings easier overall.
- other small fixes and updates
All of these have been in linux-next with all of the aforementioned
merge conflicts, and the one debugfs issue, which looks to be resolved
"soon""
* tag 'driver-core-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (95 commits)
rust: device: Use as_char_ptr() to avoid explicit cast
rust: device: Replace CString with CStr in property_present()
devcoredump: Constify 'struct bin_attribute'
devcoredump: Define 'struct bin_attribute' through macro
rust: device: Add property_present()
saner replacement for debugfs_rename()
orangefs-debugfs: don't mess with ->d_name
octeontx2: don't mess with ->d_parent or ->d_parent->d_name
arm_scmi: don't mess with ->d_parent->d_name
slub: don't mess with ->d_name
sof-client-ipc-flood-test: don't mess with ->d_name
qat: don't mess with ->d_name
xhci: don't mess with ->d_iname
mtu3: don't mess wiht ->d_iname
greybus/camera - stop messing with ->d_iname
mediatek: stop messing with ->d_iname
netdevsim: don't embed file_operations into your structs
b43legacy: make use of debugfs_get_aux()
b43: stop embedding struct file_operations into their objects
carl9170: stop embedding file_operations into their objects
...
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
Pull LED updates from Lee Jones:
- Allow struct bin_attribute instances to be placed in read-only memory
for enhanced protection
- Fix a memory leak in the cht-wcove driver by using
devm_led_classdev_register()
- Fix an OF node reference leak in the netxbig driver
- Ensure PWM is disabled properly in pwm-multicolor suspend
- Add support for Texas Instruments LP8864, LP8864S, LP8866
LED-backlight drivers
- Add support for STMicroelectronics's LED1202 12-channel LED driver
- Convert LP8860 bindings to YAML format
- Add bindings for the TI LP8864/LP8866 LED drivers
- Add LED1202 LED controller bindings
- Fix path to color definitions in leds-class-multicolor.yaml
- Add pm660l compatible to qcom,spmi-flash-led bindings
- Extend cznic,turris-omnia-leds binding with interrupts property
- Add documentation for the STMicroelectronics LED1202 driver
- Add entry for AAEON UP board FPGA drivers in MAINTAINERS
- Fix a wrong format specifier in the ledtrig-activity driver
- Fix a bug in the lp8860 driver where only half of the EEPROM was
written
* tag 'leds-next-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (28 commits)
leds: triggers: Constify 'struct bin_attribute'
leds: cht-wcove: Use devm_led_classdev_register() to avoid memory leak
leds: lp8864: Add support for Texas Instruments LP8864, LP8864S, LP8866 LED-backlights
dt-bindings: leds: Convert LP8860 into YAML format
leds: Add LED1202 I2C driver
dt-bindings: leds: Add LED1202 LED Controller
Documentation:leds: Add leds-st1202.rst
leds: pwm-multicolor: Disable PWM when going to suspend
leds: netxbig: Fix an OF node reference leak in netxbig_leds_get_of_pdata()
turris-omnia-mcu-interface.h: Move macro definitions outside of enums
MAINTAINERS: Add entry for AAEON UP board FPGA drivers
leds: Add AAEON UP board LED driver
leds: trigger: netdev: Check offload ability on interface up
leds: turris-omnia: Use uppercase first letter in all comments
leds: turris-omnia: Use dev_err_probe() where appropriate
leds: turris-omnia: Inform about missing LED gamma correction feature in the MCU driver
platform: cznic: turris-omnia-mcu: Inform about missing LED panel brightness change interrupt feature
leds: turris-omnia: Notify sysfs on MCU global LEDs brightness change
leds: turris-omnia: Document driver private structures
dt-bindings: leds: cznic,turris-omnia-leds: Allow interrupts property
...
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull mfd updates from Lee Jones:
- Fix race in device_node_get_regmap() using more extensive locking
- Remove unused platform driver support for syscon
- Allow syscon nodes to be registered without a "syscon" compatible
string
- Make `platform_data` pointer const in struct mfd_cell
- Revert support for multiple AXP PMICs to avoid regressions
- Increase SoundWire attach timeout and use gpiod_set_raw() for GPIO
operation
- Store the result from fault_log() for use by other sub-components
- Fix an invalid regmap-config max_register value
- Add another Gemini Lake ISA bridge PCI device ID
- Use devm_register_power_off_handler() to simplify code
- Add support for QNAP microcontroller units, including LEDs, input,
and hwmon
- Use MFD_CELL macros and remove unused code
- Add support for AAEON UP board FPGA
- Remove unused includes
- Fix various typos and compatibility issues in multiple bindings
- Add new bindings for rk3562 QoS, LED1202, and qcom,tcsr-ipq5424
- Convert several bindings to YAML schema
- Update sprd,sc2731 bindings to reference sprd,sc2731-efuse bindings
directly
- Fix rohm,bd71815 bindings by correcting resistor values and typos
- Documentation improvements:
- Add documentation for LED1202 and qnap-mcu-hwmon
- Adjust the file entry for the qnap-mcu header in MAINTAINERS
* tag 'mfd-next-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (35 commits)
MAINTAINERS: Adjust the file entry for the qnap-mcu header
dt-bindings: mfd: syscon: Fix ti,j784s4-acspcie-proxy-ctrl compatible
dt-bindings: mfd: syscon: Fix al,alpine-sysfabric-service compatible
Revert "mfd: axp20x: Allow multiple regulators"
dt-bindings: mfd: syscon: Add rk3562 QoS register compatible
mfd: syscon: Allow syscon nodes without a "syscon" compatible
mfd: syscon: Remove the platform driver support
mfd: syscon: Fix race in device_node_get_regmap()
dt-bindings: mfd: atmel: Convert to YAML schema
dt-bindings: mfd: atmel,at91sam9260: Convert to YAML schema
dt-bindings: mfd: sprd,sc2731: Reference sprd,sc2731-efuse bindings
mfd: tps65219: Remove unused macros & add regmap.h
mfd: tps65219: Use MFD_CELL macros
leds: Add LED1202 I2C driver
dt-bindings: leds: Add LED1202 LED Controller
Documentation:leds: Add leds-st1202.rst
mfd: Add support for AAEON UP board FPGA
mfd: da9052: Store result from fault_log
mfd: intel_soc_pmic_chtdc_ti: Fix invalid regmap-config max_register value
mfd: cs42l43: Use devres for remove as well
...
|
|
The sysfs core now allows instances of 'struct bin_attribute' to be
moved into read-only memory. Make use of that to protect them against
accidental or malicious modifications.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241222-sysfs-const-bin_attr-led-v1-1-ecc5212a31fa@weissschuh.net
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
cht_wc_leds_probe() leaks memory when the second led_classdev_register()
call in the for-loop fails as it does not call the cleanup function
led_classdev_unregister() on the first device. Avoid this leak by
calling devm_led_classdev_register().
Fixes: 047da762b9a9 ("leds: Add Intel Cherry Trail Whiskey Cove PMIC LED driver")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Link: https://lore.kernel.org/r/20241220085346.533675-1-joe@pf.is.s.u-tokyo.ac.jp
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
LED-backlights
Add driver for TI LP8864, LP8864S, LP8866 4/6 channel LED-backlight drivers
with I2C interface.
Link: https://www.ti.com/lit/gpn/lp8864-q1
Link: https://www.ti.com/lit/gpn/lp8864s-q1
Link: https://www.ti.com/lit/gpn/lp8866-q1
Link: https://www.ti.com/lit/gpn/lp8866s-q1
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Link: https://lore.kernel.org/r/20241218210829.73191-3-alexander.sverdlin@siemens.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
The output current can be adjusted separately for each channel by 8-bit
analog (current sink input) and 12-bit digital (PWM) dimming control. The
LED1202 implements 12 low-side current generators with independent dimming
control.
Internal volatile memory allows the user to store up to 8 different patterns,
each pattern is a particular output configuration in terms of PWM
duty-cycle (on 4096 steps). Analog dimming (on 256 steps) is per channel but
common to all patterns. Each device tree LED node will have a corresponding
entry in /sys/class/leds with the label name. The brightness property
corresponds to the per channel analog dimming, while the patterns[1-8] to the
PWM dimming control.
Signed-off-by: Vicentiu Galanopulo <vicentiu.galanopulo@remote-tech.co.uk>
Link: https://lore.kernel.org/r/20241218183401.41687-4-vicentiu.galanopulo@remote-tech.co.uk
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
The output current can be adjusted separately for each channel by 8-bit
analog (current sink input) and 12-bit digital (PWM) dimming control. The
LED1202 implements 12 low-side current generators with independent dimming
control.
Internal volatile memory allows the user to store up to 8 different patterns,
each pattern is a particular output configuration in terms of PWM
duty-cycle (on 4096 steps). Analog dimming (on 256 steps) is per channel but
common to all patterns. Each device tree LED node will have a corresponding
entry in /sys/class/leds with the label name. The brightness property
corresponds to the per channel analog dimming, while the patterns[1-8] to the
PWM dimming control.
Signed-off-by: Vicentiu Galanopulo <vicentiu.galanopulo@remote-tech.co.uk>
Link: https://lore.kernel.org/r/20241218182001.41476-4-vicentiu.galanopulo@remote-tech.co.uk
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
This fixes suspend on platforms like stm32mp1xx, where the PWM consumer
has to be disabled for the PWM to enter suspend.
Another positive side effect is that active-low LEDs now properly
turn off instead of going back to full brightness when they are set to 0.
Link: https://lore.kernel.org/all/20240417153846.271751-2-u.kleine-koenig@pengutronix.de/
Signed-off-by: Jakob Riepler <jakob+lkml@paranoidlabs.org>
Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/20241216213754.18374-2-jakob+lkml@paranoidlabs.org
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
netxbig_leds_get_of_pdata() does not release the OF node obtained by
of_parse_phandle() when of_find_device_by_node() fails. Add an
of_node_put() call to fix the leak.
This bug was found by an experimental static analysis tool that I am
developing.
Fixes: 9af512e81964 ("leds: netxbig: Convert to use GPIO descriptors")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Link: https://lore.kernel.org/r/20241216074923.628509-1-joe@pf.is.s.u-tokyo.ac.jp
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Add support for LEDs on AAEON UP boards. These leds are managed by the
onboard FPGA:
- UP boards: yellow, green, red
- UP Squared boards: blue, yellow, green, red
Based on the work done by Gary Wang <garywang@aaeon.com.tw>, largely
rewritten.
Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
Link: https://lore.kernel.org/r/20241211-aaeon-up-board-pinctrl-support-v1-2-24719be27631@bootlin.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
This adds a driver that connects to the qnap-mcu mfd driver and provides
access to the LEDs on it.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20241107114712.538976-6-heiko@sntech.de
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
The trigger_data->hw_control indicates whether the LED is controlled by HW
offload, i.e. the PHY. The trigger_data->hw_control = can_hw_control() is
currently called only from netdev_led_attr_store(), i.e. when writing any
sysfs attribute of the netdev trigger instance associated with a PHY LED.
The can_hw_control() calls validate_net_dev() which internally calls
led_cdev->hw_control_get_device(), which is phy_led_hw_control_get_device()
for PHY LEDs. The phy_led_hw_control_get_device() returns NULL if the PHY
is not attached.
At least in case of DWMAC (STM32MP, iMX8M, ...), the PHY device is attached
only when the interface is brought up and is detached again when the
interface is brought down. In case e.g. udev rules configure the netdev
LED trigger sysfs attributes before the interface is brought up, then when
the interface is brought up, the LEDs are not blinking.
This is because trigger_data->hw_control = can_hw_control() was called
when udev wrote the sysfs attribute files, before the interface was up,
so can_hw_control() resp. validate_net_dev() returned false, and the
trigger_data->hw_control = can_hw_control() was never called again to
update the trigger_data->hw_control content and let the offload take
over the LED blinking.
Call data->hw_control = can_hw_control() from netdev_trig_notify() to
update the offload capability of the LED when the UP notification arrives.
This makes the LEDs blink after the interface is brought up.
On STM32MP13xx with RTL8211F, it is enough to have the following udev rule
in place, boot the machine with cable plugged in, and the LEDs won't work
without this patch once the interface is brought up, even if they should:
"
ACTION=="add", SUBSYSTEM=="leds", KERNEL=="stmmac-0:01:green:wan", ATTR{trigger}="netdev", ATTR{link_10}="1", ATTR{link_100}="1", ATTR{link_1000}="1", ATTR{device_name}="end0"
ACTION=="add", SUBSYSTEM=="leds", KERNEL=="stmmac-0:01:yellow:wan", ATTR{trigger}="netdev", ATTR{rx}="1", ATTR{tx}="1", ATTR{device_name}="end0"
"
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20241216104826.6946-1-marex@denx.de
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Change first letter of 4 more comments to uppercase to make the driver
comments uniform.
Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20241111100355.6978-12-kabel@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Use dev_err_probe() instead of dev_err() + separate return where
appropriate.
Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20241111100355.6978-11-kabel@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
MCU driver
If the LED gamma correction feature is missing in the MCU firmware,
inform about this in the MCU firmware probe function instead of LED
driver probe function, so that all the feature checks are in one place.
Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20241111100355.6978-10-kabel@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Recall that on Turris Omnia, the LED controller has a global brightness
property, which allows the user to make the front LED panel dimmer.
There is also a button on the front panel, which by default is
configured so that pressing it changes the global brightness to a lower
value (unless it is at 0%, in which case pressing the button changes the
global brightness to 100%).
Newer versions of the MCU firmware support informing the SOC that the
brightness was changed by button press event via an interrupt.
Now that we have the turris-omnia-mcu driver, which adds support for MCU
interrupts, add the ability to inform the userspace (via a sysfs
notification) that the global brightness was changed.
Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20241111100355.6978-8-kabel@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Add documentation for driver private structures, `struct omnia_leds` and
`struct omnia_led`.
Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20241111100355.6978-7-kabel@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
The global turris-omnia-mcu-interface.h header file contains the
definitions for MCU commands. Drop the driver-internal definitions and
use the global ones.
Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20241111100355.6978-5-kabel@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Use the MCU command execution functions from the MCU driver instead of
the ad-hoc implementation in the LED driver. This allows as to drop the
LED driver implementation, which is a duplicate.
Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/20241111100355.6978-3-kabel@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
The format specifier of "signed int" in sprintf() should be "%d", not
"%u".
Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20241122064626.4680-1-zhujun2@cmss.chinamobile.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
I struggle to explain dividing an ARRAY_SIZE() by the size of an element
once again. As the latter equals to 2, only the half of EEPROM was ever
written. Drop the unexplainable division and write full ARRAY_SIZE().
Cc: stable@vger.kernel.org
Fixes: 7a8685accb95 ("leds: lp8860: Introduce TI lp8860 4 channel LED driver")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Link: https://lore.kernel.org/r/20241114101402.2562878-1-alexander.sverdlin@siemens.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
PULL LED updates from Lee Jones:
- Remove unused local header files from various drivers
- Revert platform driver removal to the original method for consistency
- Introduce ordered workqueues for LED events, replacing the less
efficient system_wq
- Switch to a safer iteration macro in several drivers to prevent
potential memory leaks
- Fix a refcounting bug in the mt6360 flash LED driver
- Fix an uninitialized variable in the mt6370_mc_pattern_clear()
function
- Resolve Smatch warnings in the leds-bcm6328 driver
- Address a potential NULL pointer dereference in the brightness_show()
function
- Fix an incorrect format specifier in the ss4200 driver
- Prevent a resource leak in the max5970 driver's probe function
- Add support for specifying the number of serial shift bits in the
device tree for the BCM63138 family
- Implement multicolor brightness control in the lp5562 driver
- Add a device tree property to override the default LED pin polarity
- Add a property to specify the default brightness value when the LED
is initially on
- Set missing timing properties for the ktd2692 driver
- Document the "rc-feedback" trigger for controlling LEDs based on
remote control activity
- Convert text bindings to YAML for the pca955x driver to enable device
tree validation
- Remove redundant checks for invalid channel numbers in the lp55xx
driver
- Update the MAINTAINERS file with current contact information
* tag 'leds-next-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (46 commits)
leds: ss4200: Fix the wrong format specifier for 'blinking'
leds: pwm: Add optional DT property default-brightness
dt-bindings: leds: pwm: Add default-brightness property
leds: class: Protect brightness_show() with led_cdev->led_access mutex
leds: ktd2692: Set missing timing properties
leds: max5970: Fix unreleased fwnode_handle in probe function
leds: Introduce ordered workqueue for LEDs events instead of system_wq
MAINTAINERS: Replace Siemens IPC related bouncing maintainers
leds: bcm6328: Replace divide condition with comparison for shift value
leds: lp55xx: Remove redundant test for invalid channel number
dt-bindings: leds: pca955x: Convert text bindings to YAML
leds: rgb: leds-mt6370-rgb: Fix uninitialized variable 'ret' in mt6370_mc_pattern_clear
leds: lp5562: Add multicolor brightness control
dt-bindings: leds: Add 'active-high' property
leds: Switch back to struct platform_driver::remove()
leds: bcm63138: Add some register defines
leds: bcm63138: Handle shift register config
leds: bcm63138: Use scopes and guards
dt-bindings: leds: bcm63138: Add shift register bits
leds: leds-gpio-register: Reorganize kerneldoc parameter names
...
|
|
The format specifier of "signed int" in sprintf() should be "%d", not
"%u".
Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20241111065809.3814-1-zhujun2@cmss.chinamobile.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
When probing if default LED state is on then default brightness will be
applied instead of max brightness.
Signed-off-by: George Stark <gnstark@salutedevices.com>
Link: https://lore.kernel.org/r/20241105185006.1380166-3-gnstark@salutedevices.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Lee Jones <lee@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20241104093609.156059-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
|
|
There is NULL pointer issue observed if from Process A where hid device
being added which results in adding a led_cdev addition and later a
another call to access of led_cdev attribute from Process B can result
in NULL pointer issue.
Use mutex led_cdev->led_access to protect access to led->cdev and its
attribute inside brightness_show() and max_brightness_show() and also
update the comment for mutex that it should be used to protect the led
class device fields.
Process A Process B
kthread+0x114
worker_thread+0x244
process_scheduled_works+0x248
uhid_device_add_worker+0x24
hid_add_device+0x120
device_add+0x268
bus_probe_device+0x94
device_initial_probe+0x14
__device_attach+0xfc
bus_for_each_drv+0x10c
__device_attach_driver+0x14c
driver_probe_device+0x3c
__driver_probe_device+0xa0
really_probe+0x190
hid_device_probe+0x130
ps_probe+0x990
ps_led_register+0x94
devm_led_classdev_register_ext+0x58
led_classdev_register_ext+0x1f8
device_create_with_groups+0x48
device_create_groups_vargs+0xc8
device_add+0x244
kobject_uevent+0x14
kobject_uevent_env[jt]+0x224
mutex_unlock[jt]+0xc4
__mutex_unlock_slowpath+0xd4
wake_up_q+0x70
try_to_wake_up[jt]+0x48c
preempt_schedule_common+0x28
__schedule+0x628
__switch_to+0x174
el0t_64_sync+0x1a8/0x1ac
el0t_64_sync_handler+0x68/0xbc
el0_svc+0x38/0x68
do_el0_svc+0x1c/0x28
el0_svc_common+0x80/0xe0
invoke_syscall+0x58/0x114
__arm64_sys_read+0x1c/0x2c
ksys_read+0x78/0xe8
vfs_read+0x1e0/0x2c8
kernfs_fop_read_iter+0x68/0x1b4
seq_read_iter+0x158/0x4ec
kernfs_seq_show+0x44/0x54
sysfs_kf_seq_show+0xb4/0x130
dev_attr_show+0x38/0x74
brightness_show+0x20/0x4c
dualshock4_led_get_brightness+0xc/0x74
[ 3313.874295][ T4013] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000060
[ 3313.874301][ T4013] Mem abort info:
[ 3313.874303][ T4013] ESR = 0x0000000096000006
[ 3313.874305][ T4013] EC = 0x25: DABT (current EL), IL = 32 bits
[ 3313.874307][ T4013] SET = 0, FnV = 0
[ 3313.874309][ T4013] EA = 0, S1PTW = 0
[ 3313.874311][ T4013] FSC = 0x06: level 2 translation fault
[ 3313.874313][ T4013] Data abort info:
[ 3313.874314][ T4013] ISV = 0, ISS = 0x00000006, ISS2 = 0x00000000
[ 3313.874316][ T4013] CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[ 3313.874318][ T4013] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[ 3313.874320][ T4013] user pgtable: 4k pages, 39-bit VAs, pgdp=00000008f2b0a000
..
[ 3313.874332][ T4013] Dumping ftrace buffer:
[ 3313.874334][ T4013] (ftrace buffer empty)
..
..
[ dd3313.874639][ T4013] CPU: 6 PID: 4013 Comm: InputReader
[ 3313.874648][ T4013] pc : dualshock4_led_get_brightness+0xc/0x74
[ 3313.874653][ T4013] lr : led_update_brightness+0x38/0x60
[ 3313.874656][ T4013] sp : ffffffc0b910bbd0
..
..
[ 3313.874685][ T4013] Call trace:
[ 3313.874687][ T4013] dualshock4_led_get_brightness+0xc/0x74
[ 3313.874690][ T4013] brightness_show+0x20/0x4c
[ 3313.874692][ T4013] dev_attr_show+0x38/0x74
[ 3313.874696][ T4013] sysfs_kf_seq_show+0xb4/0x130
[ 3313.874700][ T4013] kernfs_seq_show+0x44/0x54
[ 3313.874703][ T4013] seq_read_iter+0x158/0x4ec
[ 3313.874705][ T4013] kernfs_fop_read_iter+0x68/0x1b4
[ 3313.874708][ T4013] vfs_read+0x1e0/0x2c8
[ 3313.874711][ T4013] ksys_read+0x78/0xe8
[ 3313.874714][ T4013] __arm64_sys_read+0x1c/0x2c
[ 3313.874718][ T4013] invoke_syscall+0x58/0x114
[ 3313.874721][ T4013] el0_svc_common+0x80/0xe0
[ 3313.874724][ T4013] do_el0_svc+0x1c/0x28
[ 3313.874727][ T4013] el0_svc+0x38/0x68
[ 3313.874730][ T4013] el0t_64_sync_handler+0x68/0xbc
[ 3313.874732][ T4013] el0t_64_sync+0x1a8/0x1ac
Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
Reviewed-by: Anish Kumar <yesanishhere@gmail.com>
Link: https://lore.kernel.org/r/20241103160527.82487-1-quic_mojha@quicinc.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
props.timing is not set after commit b5a8c50e5c18 ("leds: ktd2692: Convert
to use ExpressWire library"). Set it with ktd2692_timing.
Fixes: b5a8c50e5c18 ("leds: ktd2692: Convert to use ExpressWire library")
Signed-off-by: Raymond Hackley <raymondhackley@protonmail.com>
Acked-by: Duje Mihanović <duje.mihanovic@skole.hr>
Link: https://lore.kernel.org/r/20241103083505.49648-1-raymondhackley@protonmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
An object initialized via device_get_named_child_node() requires calls
to fwnode_handle_put() when it is no longer required to avoid leaking
memory.
Add the automatic cleanup facility for 'led_node' to ensure that
fwnode_handle_put() is called in all execution paths.
Fixes: 736214b4b02a ("leds: max5970: Add support for max5970")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241031-max5970-of_node_put-v2-1-0ffe1f1d3bc9@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
This allows to setup ordered workqueue for LEDs events. This may be
useful, because default 'system_wq' does not guarantee execution order
of each work_struct, thus for several brightness update requests (for
multiple LEDs), real brightness switch could be in random order.
Yes, for sysfs-based LEDs we have flush_work() call inside
brightness_store() operation, but it's blocking call, so userspace
caller can be blocked at a long time, which means LEDs animation stream
can be broken.
Ordered workqueue has the same behaviour as system_wq + flush_work(),
but all scheduled works are async and userspace caller is not blocked,
which it better for userspace animation scheduling.
Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
Link: https://lore.kernel.org/r/20240903223936.21292-1-ddrokosov@salutedevices.com
[Lee: Couple of style fix-ups]
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Fixes the following Smatch warnings:
drivers/leds/leds-bcm6328.c:116 bcm6328_led_mode() warn: replace divide condition 'shift / 16' with 'shift >= 16'
drivers/leds/leds-bcm6328.c:360 bcm6328_led() warn: replace divide condition 'shift / 16' with 'shift >= 16'
Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Link: https://lore.kernel.org/r/20241019073302.35499-1-kdipendra88@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Since commit 92a81562e695 ("leds: lp55xx: Add multicolor framework
support to lp55xx") there are two subsequent tests if the chan_nr
(reg property) is in valid range. One in the lp55xx_init_led()
function and one in the lp55xx_parse_common_child() function that
was added with the mentioned commit.
There are two issues with that.
First is in the lp55xx_parse_common_child() function where the reg
property is tested right after it is read from the device tree.
Test for the upper range is not correct though. Valid reg values are
0 to (max_channel - 1) so it should be >=.
Second issue is that in case the parsed value is out of the range
the probe just fails and no error message is shown as the code never
reaches the second test that prints and error message.
Remove the test form lp55xx_parse_common_child() function completely
and keep the one in lp55xx_init_led() function to deal with it.
Fixes: 92a81562e695 ("leds: lp55xx: Add multicolor framework support to lp55xx")
Cc: stable@vger.kernel.org
Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
Link: https://lore.kernel.org/r/20241017150812.3563629-1-michal.vokac@ysoft.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
mt6370_mc_pattern_clear
Fix the uninitialized symbol 'ret' in the function mt6370_mc_pattern_clear
to resolve the following warning:
drivers/leds/rgb/leds-mt6370-rgb.c:604 mt6370_mc_pattern_clear()
error: uninitialized symbol 'ret'.
Initialize 'ret' to 0 to prevent undefined behavior from uninitialized
access.
Signed-off-by: Suraj Sonawane <surajsonawane0215@gmail.com>
Link: https://lore.kernel.org/r/20241016042142.8088-1-surajsonawane0215@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
The framework for multicolor brightness control is already in place
in the lp55xx-common code but the function to control the multicolor
brightness for this particular chip is still missing.
Implement the multicolor_brightness_fn function to allow multicolor
brightness control of LEDs connected to the LP5562 LED driver.
Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
Link: https://lore.kernel.org/r/20241009095635.2790613-1-michal.vokac@ysoft.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
After commit 0edb555a65d1 ("platform: Make platform_driver::remove()
return void") .remove() is (again) the right callback to implement for
platform drivers.
Convert all platform drivers below drivers/leds/ to use .remove(), with
the eventual goal to drop struct platform_driver::remove_new(). As
.remove() and .remove_new() have the same prototypes, conversion is done
by just changing the structure member name in the driver initializer.
While touching these files, make indention of the struct initializer
consistent in several files.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/20241010203622.839625-5-u.kleine-koenig@baylibre.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
The Power LUT (Look-up Table) register base was missing, also
add the bit define for sending serial LED data in reverse order,
and use the BIT() macro to define the bits in the control
register.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20241010-bcm63138-leds-v4-4-cdb80780a555@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
This adds code to optionally read the width of the shift register
chain from the device tree and use it to set up the register
controlling the shifter hardware.
If the property is not present, the boot-time default is used so
existing device trees keep working as this is what they assume.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20241010-bcm63138-leds-v4-3-cdb80780a555@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Use scoped helpers and guards to handle DT node iterations
and spinlocks. This cuts some lines of code and eliminates
common mistakes (such as the missing of_node_put()).
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20241010-bcm63138-leds-v4-2-cdb80780a555@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Reorganize kerneldoc parameter names to match the parameter
order in the function header.
Problems identified using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/20240930112121.95324-8-Julia.Lawall@inria.fr
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
This driver does not require any element from the local leds.h. Drop
unused header.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240927-leds_unused_leds_h-v1-6-46fbf41ed4ae@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Commit 156a5bb89ca6 ("leds: Move led_init_default_state_get() to the
global header") moved the only element leds-gpio required from the local
leds.h to its global counterpart. Drop the inclusion of the local leds.h
as it is no longer used.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240927-leds_unused_leds_h-v1-5-46fbf41ed4ae@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
This driver does not require any element from the local leds.h. Drop
unused header.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240927-leds_unused_leds_h-v1-4-46fbf41ed4ae@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Commit 156a5bb89ca6 ("leds: Move led_init_default_state_get() to the
global header") moved the only element leds-gpio required from the local
leds.h to its global counterpart. Drop the inclusion of the local leds.h
as it is no longer used.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240927-leds_unused_leds_h-v1-3-46fbf41ed4ae@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
This driver does not require any element from the local leds.h. Drop
unused header.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240927-leds_unused_leds_h-v1-2-46fbf41ed4ae@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
This driver does not require any element from the local leds.h. Drop
unused header.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240927-leds_unused_leds_h-v1-1-46fbf41ed4ae@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Switch to device_for_each_child_node_scoped() to simplify the code by
removing the need for calls to fwnode_handle_put() in the error paths.
This also prevents possible memory leaks if new error paths are added
without the required call to fwnode_handle_put().
After switching to the scoped variant, there is no longer need for a
jump to 'fwnode_release', as an immediate return is possible. Given that
the loop is called in the probe function, and it already uses
dev_err_probe(), the common "dev_err() + return" has been updated as
well.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240927-leds_device_for_each_child_node_scoped-v1-18-95c0614b38c8@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Switch to device_for_each_child_node_scoped() to simplify the code by
removing the need for calls to fwnode_handle_put() in the error path.
This also prevents possible memory leaks if new error paths are added
without the required call to fwnode_handle_put().
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240927-leds_device_for_each_child_node_scoped-v1-17-95c0614b38c8@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
Switch to device_for_each_child_node_scoped() to simplify the code by
removing the need for calls to fwnode_handle_put() in the error path.
This also prevents possible memory leaks if new error paths are added
without the required call to fwnode_handle_put().
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240927-leds_device_for_each_child_node_scoped-v1-16-95c0614b38c8@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
|