LED updates for 4.19-rc1
-----BEGIN PGP SIGNATURE-----
iJEEABYIADkWIQQUwxxKyE5l/npt8ARiEGxRG/Sl2wUCW3HajRscamFjZWsuYW5h
c3pld3NraUBnbWFpbC5jb20ACgkQYhBsURv0pdvxAwEA+qS5O9ByxlhT+BUC4ck6
nIy0ITOCXP8ySoo8VVhzjikBAPrb9lFYGvHqzKN4dYtnSILPmlTSf1t1flng2Zev
NfoE
=lNwq
-----END PGP SIGNATURE-----
Merge tag 'leds-for-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds
Pull LED updates from Jacek Anaszewski:
"LED triggers improvements make the biggest part of this pull request.
The most striking ones, that allowed for nice cleanups in the triggers
are:
- centralized handling of creation and removal of trigger sysfs
attributes via attribute group
- addition of module_led_trigger() helper
The other things that need to be mentioned:
New features and improvements to existing LED class drivers:
- lt3593: add DT support, switch to gpiod interface
- lm3692x: support LED sync configuration, change OF calls to fwnode
calls
- apu: modify PC Engines apu/apu2 driver to support apu3
Change in the drivers/net/can/led.c:
- mark led trigger as broken since it's in the way for the further
cleanups. It implements a subset of the netdev trigger and an Ack
is needed from someone who can actually test and confirm that the
netdev trigger works for can devices"
* tag 'leds-for-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds: (32 commits)
leds: ns2: Change unsigned to unsigned int
usb: simplify usbport trigger
leds: gpio trigger: simplifications from core changes
leds: backlight trigger: simplifications from core changes
leds: activity trigger: simplifications from core changes
leds: default-on trigger: make use of module_led_trigger()
leds: heartbeat trigger: simplifications from core changes
leds: oneshot trigger: simplifications from core changes
leds: transient trigger: simplifications from core changes
leds: timer trigger: simplifications from core changes
leds: netdev trigger: simplifications from core changes
leds: triggers: new function led_set_trigger_data()
leds: triggers: define module_led_trigger helper
leds: triggers: handle .trigger_data and .activated() in the core
leds: triggers: add device attribute support
leds: triggers: let struct led_trigger::activate() return an error code
leds: triggers: make the MODULE_LICENSE string match the actual license
leds: lm3692x: Support LED sync configuration
dt: bindings: lm3692x: Update binding for LED sync control
leds: lm3692x: Change DT calls to fwnode calls
...
This commit is contained in:
commit
c07b3682cd
28 changed files with 641 additions and 619 deletions
|
|
@ -253,7 +253,7 @@ static inline bool led_sysfs_is_disabled(struct led_classdev *led_cdev)
|
|||
struct led_trigger {
|
||||
/* Trigger Properties */
|
||||
const char *name;
|
||||
void (*activate)(struct led_classdev *led_cdev);
|
||||
int (*activate)(struct led_classdev *led_cdev);
|
||||
void (*deactivate)(struct led_classdev *led_cdev);
|
||||
|
||||
/* LEDs under control by this trigger (for simple triggers) */
|
||||
|
|
@ -262,8 +262,19 @@ struct led_trigger {
|
|||
|
||||
/* Link to next registered trigger */
|
||||
struct list_head next_trig;
|
||||
|
||||
const struct attribute_group **groups;
|
||||
};
|
||||
|
||||
/*
|
||||
* Currently the attributes in struct led_trigger::groups are added directly to
|
||||
* the LED device. As this might change in the future, the following
|
||||
* macros abstract getting the LED device and its trigger_data from the dev
|
||||
* parameter passed to the attribute accessor functions.
|
||||
*/
|
||||
#define led_trigger_get_led(dev) ((struct led_classdev *)dev_get_drvdata((dev)))
|
||||
#define led_trigger_get_drvdata(dev) (led_get_trigger_data(led_trigger_get_led(dev)))
|
||||
|
||||
ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count);
|
||||
ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr,
|
||||
|
|
@ -288,10 +299,16 @@ extern void led_trigger_blink_oneshot(struct led_trigger *trigger,
|
|||
unsigned long *delay_off,
|
||||
int invert);
|
||||
extern void led_trigger_set_default(struct led_classdev *led_cdev);
|
||||
extern void led_trigger_set(struct led_classdev *led_cdev,
|
||||
struct led_trigger *trigger);
|
||||
extern int led_trigger_set(struct led_classdev *led_cdev,
|
||||
struct led_trigger *trigger);
|
||||
extern void led_trigger_remove(struct led_classdev *led_cdev);
|
||||
|
||||
static inline void led_set_trigger_data(struct led_classdev *led_cdev,
|
||||
void *trigger_data)
|
||||
{
|
||||
led_cdev->trigger_data = trigger_data;
|
||||
}
|
||||
|
||||
static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
|
||||
{
|
||||
return led_cdev->trigger_data;
|
||||
|
|
@ -315,6 +332,10 @@ static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
|
|||
extern void led_trigger_rename_static(const char *name,
|
||||
struct led_trigger *trig);
|
||||
|
||||
#define module_led_trigger(__led_trigger) \
|
||||
module_driver(__led_trigger, led_trigger_register, \
|
||||
led_trigger_unregister)
|
||||
|
||||
#else
|
||||
|
||||
/* Trigger has no members */
|
||||
|
|
@ -334,9 +355,14 @@ static inline void led_trigger_blink_oneshot(struct led_trigger *trigger,
|
|||
unsigned long *delay_off,
|
||||
int invert) {}
|
||||
static inline void led_trigger_set_default(struct led_classdev *led_cdev) {}
|
||||
static inline void led_trigger_set(struct led_classdev *led_cdev,
|
||||
struct led_trigger *trigger) {}
|
||||
static inline int led_trigger_set(struct led_classdev *led_cdev,
|
||||
struct led_trigger *trigger)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void led_trigger_remove(struct led_classdev *led_cdev) {}
|
||||
static inline void led_set_trigger_data(struct led_classdev *led_cdev) {}
|
||||
static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
|
||||
{
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue