Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c07b3682 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'leds-for-4.19-rc1' of...

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
  ...
parents 4d88e3d2 2224f2ff
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ Optional properties for child nodes:
     "backlight" - LED will act as a back-light, controlled by the framebuffer
		   system
     "default-on" - LED will turn on (but for leds-gpio see "default-state"
		    property in Documentation/devicetree/bindings/gpio/led.txt)
		    property in Documentation/devicetree/bindings/leds/leds-gpio.txt)
     "heartbeat" - LED "double" flashes at a load average based rate
     "disk-activity" - LED indicates disk activity
     "ide-disk" - LED indicates IDE disk activity (deprecated),
+4 −1
Original line number Diff line number Diff line
@@ -20,7 +20,10 @@ Optional properties:
	- vled-supply : LED supply

Required child properties:
	- reg : 0
	- reg : 0 - Will enable all LED sync paths
		1 - Will enable the LED1 sync
		2 - Will enable the LED2 sync
		3 - Will enable the LED3 sync (LM36923 only)

Optional child properties:
	- label : see Documentation/devicetree/bindings/leds/common.txt
+32 −0
Original line number Diff line number Diff line
Bindings for Linear Technologies LT3593 LED controller

Required properties:
- compatible:		Should be "lltc,lt3593".
- lltc,ctrl-gpios:	A handle to the GPIO that is connected to the 'CTRL'
			pin of the chip.

The hardware supports only one LED. The properties of this LED are
configured in a sub-node in the device node.

Optional sub-node properties:
- label:	A label for the LED. If none is given, the LED will be
		named "lt3595::".
- linux,default-trigger: The default trigger for the LED.
			See Documentation/devicetree/bindings/leds/common.txt
- default-state:	The initial state of the LED.
			See Documentation/devicetree/bindings/leds/common.txt

If multiple chips of this type are found in a design, each one needs to
be handled by its own device node.

Example:

led-controller {
	compatible = "lltc,lt3593";
	lltc,ctrl-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;

	led {
		label = "white:backlight";
		default-state = "on";
	};
};
+3 −2
Original line number Diff line number Diff line
@@ -57,12 +57,13 @@ config LEDS_AAT1290
	depends on PINCTRL
	help
	 This option enables support for the LEDs on the AAT1290.

config LEDS_APU
	tristate "Front panel LED support for PC Engines APU/APU2 boards"
	tristate "Front panel LED support for PC Engines APU/APU2/APU3 boards"
	depends on LEDS_CLASS
	depends on X86 && DMI
	help
	  This driver makes the PC Engines APU/APU2 front panel LEDs
	  This driver makes the PC Engines APU/APU2/APU3 front panel LEDs
	  accessible from userspace programs through the LED subsystem.

	  To compile this driver as a module, choose M here: the
+36 −3
Original line number Diff line number Diff line
@@ -103,15 +103,16 @@ ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr,
EXPORT_SYMBOL_GPL(led_trigger_show);

/* Caller must ensure led_cdev->trigger_lock held */
void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
{
	unsigned long flags;
	char *event = NULL;
	char *envp[2];
	const char *name;
	int ret;

	if (!led_cdev->trigger && !trig)
		return;
		return 0;

	name = trig ? trig->name : "none";
	event = kasprintf(GFP_KERNEL, "TRIGGER=%s", name);
@@ -126,7 +127,10 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
		led_stop_software_blink(led_cdev);
		if (led_cdev->trigger->deactivate)
			led_cdev->trigger->deactivate(led_cdev);
		device_remove_groups(led_cdev->dev, led_cdev->trigger->groups);
		led_cdev->trigger = NULL;
		led_cdev->trigger_data = NULL;
		led_cdev->activated = false;
		led_set_brightness(led_cdev, LED_OFF);
	}
	if (trig) {
@@ -134,8 +138,20 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
		list_add_tail(&led_cdev->trig_list, &trig->led_cdevs);
		write_unlock_irqrestore(&trig->leddev_list_lock, flags);
		led_cdev->trigger = trig;

		if (trig->activate)
			trig->activate(led_cdev);
			ret = trig->activate(led_cdev);
		else
			ret = 0;

		if (ret)
			goto err_activate;

		ret = device_add_groups(led_cdev->dev, trig->groups);
		if (ret) {
			dev_err(led_cdev->dev, "Failed to add trigger attributes\n");
			goto err_add_groups;
		}
	}

	if (event) {
@@ -146,6 +162,23 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
				"%s: Error sending uevent\n", __func__);
		kfree(event);
	}

	return 0;

err_add_groups:

	if (trig->deactivate)
		trig->deactivate(led_cdev);
err_activate:

	led_cdev->trigger = NULL;
	led_cdev->trigger_data = NULL;
	write_lock_irqsave(&led_cdev->trigger->leddev_list_lock, flags);
	list_del(&led_cdev->trig_list);
	write_unlock_irqrestore(&led_cdev->trigger->leddev_list_lock, flags);
	led_set_brightness(led_cdev, LED_OFF);

	return ret;
}
EXPORT_SYMBOL_GPL(led_trigger_set);

Loading