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

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

Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds

* 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds:
  leds: Add default-on trigger
  leds: Document the context brightness_set needs
  leds: Add new driver for the LEDs on the Freecom FSG-3
  leds: Add support to leds with readable status
  leds: enable support for blink_set() platform hook in leds-gpio
  leds: Cleanup various whitespace and code style issues
  leds: disable triggers on brightness set
  leds: Add mail LED support for "Clevo D400P"
parents bf16ae25 060856c7
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -19,6 +19,12 @@ optimises away.

Complex triggers whilst available to all LEDs have LED specific
parameters and work on a per LED basis. The timer trigger is an example.
The timer trigger will periodically change the LED brightness between
LED_OFF and the current brightness setting. The "on" and "off" time can
be specified via /sys/class/leds/<device>/delay_{on,off} in milliseconds.
You can change the brightness value of a LED independently of the timer
trigger. However, if you set the brightness value to LED_OFF it will
also disable the timer trigger.

You can change triggers in a similar manner to the way an IO scheduler
is chosen (via /sys/class/leds/<device>/trigger). Trigger specific
@@ -63,9 +69,9 @@ value if it is called with *delay_on==0 && *delay_off==0 parameters. In
this case the driver should give back the chosen value through delay_on
and delay_off parameters to the leds subsystem.

Any call to the brightness_set() callback function should cancel the
previously programmed hardware blinking function so setting the brightness
to 0 can also cancel the blinking of the LED.
Setting the brightness to zero with brightness_set() callback function
should completely turn off the LED and cancel the previously programmed
hardware blinking function, if any.


Known Issues
+17 −0
Original line number Diff line number Diff line
@@ -65,6 +65,12 @@ config LEDS_NET48XX
	  This option enables support for the Soekris net4801 and net4826 error
	  LED.

config LEDS_FSG
	tristate "LED Support for the Freecom FSG-3"
	depends on LEDS_CLASS && MACH_FSG
	help
	  This option enables support for the LEDs on the Freecom FSG-3.

config LEDS_WRAP
	tristate "LED Support for the WRAP series LEDs"
	depends on LEDS_CLASS && SCx200_GPIO
@@ -127,6 +133,7 @@ config LEDS_CLEVO_MAIL

	  This module can drive the mail LED for the following notebooks:

	  	Clevo D400P
	  	Clevo D410J
	  	Clevo D410V
	  	Clevo D400V/D470V (not tested, but might work)
@@ -134,6 +141,9 @@ config LEDS_CLEVO_MAIL
	  	Clevo M5x0N (not tested, but might work)
	  	Positivo Mobile (Clevo M5x0V)

	  If your model is not listed here you can try the "nodetect"
	  module paramter.

	  To compile this driver as a module, choose M here: the
	  module will be called leds-clevo-mail.

@@ -173,4 +183,11 @@ config LEDS_TRIGGER_HEARTBEAT
	  load average.
	  If unsure, say Y.

config LEDS_TRIGGER_DEFAULT_ON
	tristate "LED Default ON Trigger"
	depends on LEDS_TRIGGERS
	help
	  This allows LEDs to be initialised in the ON state.
	  If unsure, say Y.

endif # NEW_LEDS
+2 −0
Original line number Diff line number Diff line
@@ -20,8 +20,10 @@ obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o
obj-$(CONFIG_LEDS_CM_X270)              += leds-cm-x270.o
obj-$(CONFIG_LEDS_CLEVO_MAIL)		+= leds-clevo-mail.o
obj-$(CONFIG_LEDS_HP6XX)		+= leds-hp6xx.o
obj-$(CONFIG_LEDS_FSG)			+= leds-fsg.o

# LED Triggers
obj-$(CONFIG_LEDS_TRIGGER_TIMER)	+= ledtrig-timer.o
obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK)	+= ledtrig-ide-disk.o
obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT)	+= ledtrig-heartbeat.o
obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON)	+= ledtrig-default-on.o
+12 −0
Original line number Diff line number Diff line
@@ -24,6 +24,12 @@

static struct class *leds_class;

static void led_update_brightness(struct led_classdev *led_cdev)
{
	if (led_cdev->brightness_get)
		led_cdev->brightness = led_cdev->brightness_get(led_cdev);
}

static ssize_t led_brightness_show(struct device *dev, 
		struct device_attribute *attr, char *buf)
{
@@ -31,6 +37,7 @@ static ssize_t led_brightness_show(struct device *dev,
	ssize_t ret = 0;

	/* no lock needed for this */
	led_update_brightness(led_cdev);
	sprintf(buf, "%u\n", led_cdev->brightness);
	ret = strlen(buf) + 1;

@@ -51,6 +58,9 @@ static ssize_t led_brightness_store(struct device *dev,

	if (count == size) {
		ret = count;

		if (state == LED_OFF)
			led_trigger_remove(led_cdev);
		led_set_brightness(led_cdev, state);
	}

@@ -110,6 +120,8 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
	list_add_tail(&led_cdev->node, &leds_list);
	up_write(&leds_list_lock);

	led_update_brightness(led_cdev);

#ifdef CONFIG_LEDS_TRIGGERS
	init_rwsem(&led_cdev->trigger_lock);

+2 −2
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
#include "leds.h"

DECLARE_RWSEM(leds_list_lock);
LIST_HEAD(leds_list);
EXPORT_SYMBOL_GPL(leds_list_lock);

LIST_HEAD(leds_list);
EXPORT_SYMBOL_GPL(leds_list);
EXPORT_SYMBOL_GPL(leds_list_lock);
Loading