Age | Commit message (Collapse) | Author | Files | Lines |
|
Trivial cleanup removing empty line at wrong place.
Signed-off-by: Pavel Machek <[email protected]>
|
|
Apparently it is quite easy to forget ">" in quoting of email
address. This fixes it.
Signed-off-by: Pavel Machek <[email protected]>
|
|
This driver adds support for the LED operational mode of the
tps6105x MFD device.
Acked-by: Jacek Anaszewski <[email protected]>
Signed-off-by: Sven Van Asbroeck <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
We need the of_match table if we want to use the compatible string in
the pmic's child node and get the led driver loaded automatically.
Signed-off-by: Bartosz Golaszewski <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
The Rohm BD2802 have no in-kernel users so we can drop the
GPIO number from the platform data and require users to
provide the GPIO line using machine descriptors.
As the descriptors come with inherent polarity inversion
semantics, we invert the calls to set the GPIO line such
that 0 means "unasserted" and 1 means "asserted".
Put a note in the driver that machine descriptor tables
will need to specify that the line is active low.
Cc: Kim Kyuwon <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
Before commit bb29b9cccd95 ("leds: pca963x: Add bindings to invert
polarity") Mode register 2 was initialized directly with either 0x01
or 0x05 for open-drain or totem pole (push-pull) configuration.
Afterwards, MODE2 initialization started using bitwise operations on
top of the default MODE2 register value (0x05). Using bitwise OR for
setting OUTDRV with 0x01 and 0x05 does not produce correct results.
When open-drain is used, instead of setting OUTDRV to 0, the driver
keeps it as 1:
Open-drain: 0x05 | 0x01 -> 0x05 (0b101 - incorrect)
Totem pole: 0x05 | 0x05 -> 0x05 (0b101 - correct but still wrong)
Now OUTDRV setting uses correct bitwise operations for initialization:
Open-drain: 0x05 & ~0x04 -> 0x01 (0b001 - correct)
Totem pole: 0x05 | 0x04 -> 0x05 (0b101 - correct)
Additional MODE2 register definitions are introduced now as well.
Fixes: bb29b9cccd95 ("leds: pca963x: Add bindings to invert polarity")
Signed-off-by: Zahari Petkov <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
If a node is ignored, do not get a reference to it. Fix the bug by moving
fwnode_handle_get() where a reference to an fwnode is saved for clarity.
Reported-by: Andy Shevchenko <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Sakari Ailus <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
When switching to using generic LED name composition mechanism via
devm_led_classdev_register_ext() API the part of code initializing
struct gpio_led's template name property was removed alongside.
It was however overlooked that the property was also passed to
devm_fwnode_get_gpiod_from_child() in place of "label" parameter,
which when set to NULL, results in gpio label being initialized to '?'.
It could be observed in debugfs and failed to properly identify
gpio association with LED consumer.
Fix this shortcoming by updating the GPIO label after the LED is
registered and its final name is known.
Fixes: d7235f5feaa0 ("leds: gpio: Use generic support for composing LED names")
Cc: Russell King <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
[fixed comment]
Signed-off-by: Pavel Machek <[email protected]>
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds
Pull LED updates from Pavel Machek:
"This contains usual small updates to drivers, and removal of PAGE_SIZE
limits on /sys/class/leds/<led>/trigger.
We should not be really having that many triggers; but with cpu
activity triggers we do, and we'll eventually need to fix it, but...
remove the limit for now"
* tag 'leds-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds: (26 commits)
leds: trigger: netdev: fix handling on interface rename
leds: an30259a: add a check for devm_regmap_init_i2c
leds: mlxreg: Fix possible buffer overflow
leds: pca953x: Use of_device_get_match_data()
leds: core: Fix leds.h structure documentation
leds: core: Fix devm_classdev_match to reference correct structure
leds: core: Remove extern from header
leds: lm3601x: Convert class registration to device managed
leds: flash: Add devm_* functions to the flash class
leds: flash: Remove extern from the header file
leds: flash: Convert non extended registration to inline
leds: Kconfig: Be consistent with the usage of "LED"
leds: remove PAGE_SIZE limit of /sys/class/leds/<led>/trigger
leds: tlc591xx: update the maximum brightness
leds: lm3692x: Use flags from LM3692X_BRT_CTRL
leds: lm3692x: Use flags from LM3692X_BOOST_CTRL
leds: lm3692x: Handle failure to probe the regulator
leds: lm3692x: Don't overwrite return value in error path
leds: lm3692x: Print error value on dev_err
leds: tlc591xx: use devm_led_classdev_register_ext()
...
|
|
We can now safely read user kcpustat fields on nohz_full CPUs.
Use the appropriate accessor.
[ mingo: Fixed build failure. ]
Reported-by: Yauheni Kaliuta <[email protected]>
Signed-off-by: Frederic Weisbecker <[email protected]>
Cc: Jacek Anaszewski <[email protected]> (maintainer:LED SUBSYSTEM)
Cc: Pavel Machek <[email protected]> (maintainer:LED SUBSYSTEM)
Cc: Dan Murphy <[email protected]> (reviewer:LED SUBSYSTEM)
Cc: Peter Zijlstra <[email protected]>
Cc: Wanpeng Li <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
|
|
The NETDEV_CHANGENAME code is not "unneeded" like it is stated in commit
4cb6560514fa ("leds: trigger: netdev: fix refcnt leak on interface
rename").
The event was accidentally misinterpreted equivalent to
NETDEV_UNREGISTER, but should be equivalent to NETDEV_REGISTER.
This was the case in the original code from the openwrt project.
Otherwise, you are unable to set netdev led triggers for (non-existent)
netdevices, which has to be renamed. This is the case, for example, for
ppp interfaces in openwrt.
Fixes: 06f502f57d0d ("leds: trigger: Introduce a NETDEV trigger")
Fixes: 4cb6560514fa ("leds: trigger: netdev: fix refcnt leak on interface rename")
Signed-off-by: Martin Schiller <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
an30259a_probe misses a check for devm_regmap_init_i2c and may cause
problems.
Add a check and print errors like other leds drivers.
Signed-off-by: Chuhong Yuan <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
Error was detected by PVS-Studio:
V512 A call of the 'sprintf' function will lead to overflow of
the buffer 'led_data->led_cdev_name'.
Acked-by: Jacek Anaszewski <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Oleh Kravchenko <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
This driver can use the of_device_get_match_data() API to simplify the
code. Replace calls to of_match_device() with this newer API under the
assumption that where it is called will be when we know the device is
backed by a DT node. This nicely avoids referencing the match table when
it is undefined with configurations where CONFIG_OF=n.
Cc: Arnd Bergmann <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Riku Voipio <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Frank Rowand <[email protected]>
Cc: Jacek Anaszewski <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Dan Murphy <[email protected]>
Cc: <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
Fix the devm_classdev_match pointer initialization to the correct
structure type.
Signed-off-by: Dan Murphy <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
Convert LED flash class registration to device managed class
registration API.
Signed-off-by: Dan Murphy <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
Add the missing device managed API for registration and
unregistration for the LED flash class.
Signed-off-by: Dan Murphy <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
Update the Kconfig to be consistent in the case of using
"LED" in the Kconfig. LED is an acronym and should be
capitalized.
Signed-off-by: Dan Murphy <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
Reading /sys/class/leds/<led>/trigger returns all available LED triggers.
However, the size of this file is limited to PAGE_SIZE because of the
limitation for sysfs attribute.
Enabling LED CPU trigger on systems with thousands of CPUs easily hits
PAGE_SIZE limit, and makes it impossible to see all available LED triggers
and which trigger is currently activated.
We work around it here by converting /sys/class/leds/<led>/trigger to
binary attribute, which is not limited by length. This is _not_ good
design, do not copy it.
Signed-off-by: Akinobu Mita <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Dan Murphy <[email protected]>A
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
The TLC chips actually offer 257 levels:
- 0: led OFF
- 1-255: Led dimmed is using a PWM. The duty cycle range from 0.4% to 99.6%
- 256: led fully ON
Fixes: e370d010a5fe ("leds: tlc591xx: Driver for the TI 8/16 Channel i2c LED driver")
Signed-off-by: Jean-Jacques Hiblot <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
Use LM3692X_RAMP_EN instead of LM3692X_PWM_HYSTER_4LSB
since the later is a flag for the PWM register. The
actual register value remains unchanged.
Signed-off-by: Guido Günther <[email protected]>
Reviewed-by: Dan Murphy <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
The current setup of LM3692X_BOOST_CTRL uses flags from LM3692X_BRT_CTRL.
Use flags from LM3692X_BOOST_CTRL but leave the resulting register value
unchanged.
Signed-off-by: Guido Günther <[email protected]>
Reviewed-by: Dan Murphy <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
Instead use devm_regulator_get_optional since the regulator
is optional and check for errors.
Signed-off-by: Guido Günther <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Reviewed-by: Dan Murphy <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
The driver currently reports successful initialization on every failure
as long as it's able to power off the regulator. Don't check the return
value of regulator_disable to avoid that.
Signed-off-by: Guido Günther <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Reviewed-by: Dan Murphy <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
This gives a way better idea what is going on.
Signed-off-by: Guido Günther <[email protected]>
Reviewed-by: Dan Murphy <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
Use devm_led_classdev_register_ext() to pass the fwnode to the LED core.
The fwnode can then be used by the firmware core to create meaningful
names.
Signed-off-by: Jean-Jacques Hiblot <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
Use the managed API of the LED class (devm_led_classdev_register()
instead of led_classdev_register()).
This allows us to remove the code used to track-and-destroy the LED devices.
Signed-off-by: Jean-Jacques Hiblot <[email protected]>
Reviewed-by: Tomi Valkeinen <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
Simplify this function implementation by using a known wrapper function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
Simplify this function implementation by using a known wrapper function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
The driver currently ignores errors from register writes at probe time.
It will hence register an LED class device no matter whether the
pyhsical device is present or not.
To fix this, make the device probe fail in case regmap operations
return an error.
Signed-off-by: Daniel Mack <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
This patch adds a LED class driver for the LEDs found on
the Crane Merchandising System EL15203000 LEDs board
(aka RED LEDs board).
Signed-off-by: Oleh Kravchenko <[email protected]>
Reviewed-by: Dan Murphy <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
|
|
Now that we have a vtime safe kcpustat accessor for CPUTIME_SYSTEM, use
it to start fixing frozen kcpustat values on nohz_full CPUs.
Reported-by: Yauheni Kaliuta <[email protected]>
Signed-off-by: Frederic Weisbecker <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Jacek Anaszewski <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Rafael J . Wysocki <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Viresh Kumar <[email protected]>
Cc: Wanpeng Li <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
|
|
Fix the error handling for the led-max-microamp property.
Need to check if the property is present and then if it is
retrieve the setting and its max boundary
Reported-by: Pavel Machek <[email protected]>
Signed-off-by: Dan Murphy <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
Error was detected by PVS-Studio:
V522 Dereferencing of the null pointer 'led_cdev->trigger' might take place.
Fixes: 2282e125a406 ("leds: triggers: let struct led_trigger::activate() return an error code")
Signed-off-by: Oleh Kravchenko <[email protected]>
Reviewed-by: Uwe Kleine-König <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
Move the static keyword to the front of declaration of ramp_table,
and resolve the following compiler warning that can be seen when
building with warnings enabled (W=1):
drivers/leds/leds-ti-lmu-common.c:14:1: warning:
‘static’ is not at beginning of declaration [-Wold-style-declaration]
Signed-off-by: Krzysztof Wilczynski <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
Move the static keyword to the front of declarations ramp_table,
als_avrg_table and als_imp_table, and resolve the following
compiler warnings that can be seen when building with warnings
enabled (W=1):
drivers/leds/leds-lm3532.c:209:1: warning:
‘static’ is not at beginning of declaration [-Wold-style-declaration]
drivers/leds/leds-lm3532.c:266:1: warning:
‘static’ is not at beginning of declaration [-Wold-style-declaration]
drivers/leds/leds-lm3532.c:281:1: warning:
‘static’ is not at beginning of declaration [-Wold-style-declaration]
Signed-off-by: Krzysztof Wilczynski <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
Allow all valid GPIOs to be used in the driver.
Fixes: 17354bfe8527 ("leds: Add gpio-led trigger")
Signed-off-by: Andy Shevchenko <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:
struct led_pwm_priv {
...
struct led_pwm_data leds[0];
};
Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.
So, replace the following function:
static inline size_t sizeof_pwm_leds_priv(int num_leds)
{
return sizeof(struct led_pwm_priv) +
(sizeof(struct led_pwm_data) * num_leds);
}
with:
struct_size(priv, leds, count)
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:
struct is31fl32xx_priv {
...
struct is31fl32xx_led_data leds[0];
};
Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.
So, replace the following function:
static inline size_t sizeof_is31fl32xx_priv(int num_leds)
{
return sizeof(struct is31fl32xx_priv) +
(sizeof(struct is31fl32xx_led_data) * num_leds);
}
with:
struct_size(priv, leds, count)
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
Fix the coccinelle issues found in the TI LMU common code
drivers/leds/leds-ti-lmu-common.c:97:20-29: WARNING: Unsigned expression compared with zero: ramp_down < 0
drivers/leds/leds-ti-lmu-common.c:97:5-12: WARNING: Unsigned expression compared with zero: ramp_up < 0
Fixes: 3fce8e1eb994 ("leds: TI LMU: Add common code for TI LMU devices")
Signed-off-by: Dan Murphy <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
We may currently get unpaired regulator calls when configuring the LED
brightness via sysfs in case of regulator calls producing errors. Let's
fix this by maintaining local state for enabled.
Signed-off-by: Tony Lindgren <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
We have a MFD driver compiled as module instantiating this driver. When
unloading that module, those LED devices are not removed, which produces
conflicts, when that module is inserted again.
Signed-off-by: Alexander Dahl <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
If in the certain driver the LED is optional, and it's a majority of them,
the call of led_classdev_unregister() still requires some additional
checks.
The usual pattern on unregistering is to check for NULL, but we also check
for IS_ERR() in case device_create_with_groups() fails.
The change will reduce a burden in a lot of drivers to repeatedly check
for above conditions.
Signed-off-by: Andy Shevchenko <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
Allow the full scale current to be configured at init.
Valid rangles are 5mA->29.8mA.
Signed-off-by: Dan Murphy <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
Fixed misspelled words, added error check during probe
on the init of the registers, and fixed ALS/I2C control
mode.
Fixes: bc1b8492c764 ("leds: lm3532: Introduce the lm3532 LED driver")
Reported-by: Pavel Machek <[email protected]>
Signed-off-by: Dan Murphy <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
Change the define name of the full scale current registers.
Signed-off-by: Dan Murphy <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
Fix the brightness control for I2C mode. Instead of
changing the full scale current register update the ALS target
register for the appropriate banks.
In addition clean up some code errors and random misspellings found
during coding.
Tested on Droid4 as well as LM3532 EVM connected to a BeagleBoneBlack
Fixes: bc1b8492c764 ("leds: lm3532: Introduce the lm3532 LED driver")
Reported-by: Pavel Machek <[email protected]>
Signed-off-by: Dan Murphy <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
There is no need to be stuck with OF node when we may use agnostic
firmware node instead.
It allows users to get property if needed independently of provider.
Note, some OF parts are left because %pfw [1] is in progress.
[1]: https://lore.kernel.org/patchwork/cover/1054863/
Signed-off-by: Andy Shevchenko <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
Switch the max77650 from OF to the fwnode property API.
Signed-off-by: Andy Shevchenko <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|
|
In led_trigger_set(), 'event' is allocated in kasprintf(). However, it is
not deallocated in the following execution if the label 'err_activate' or
'err_add_groups' is entered, leading to memory leaks. To fix this issue,
free 'event' before returning the error.
Fixes: 52c47742f79d ("leds: triggers: send uevent when changing triggers")
Signed-off-by: Wenwen Wang <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
|