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

Commit 3cd69271 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: introduce lp5521 led driver
  leds: just ignore invalid GPIOs in leds-gpio
  leds: Fix &&/|| confusion in leds-pca9532.c
  leds: move h1940-leds's probe function to .devinit.text
  leds: remove an unnecessary "goto" on drivers/leds/leds-s3c24.c
  leds: add BD2802GU LED driver
  leds: remove experimental flag from leds-clevo-mail
  leds: Prevent multiple LED triggers with the same name
  leds: Add gpio-led trigger
  leds: Add rb532 LED driver for the User LED
  leds: Add suspend/resume state flags to leds-gpio
  leds: simple driver for pwm driven LEDs
  leds: Fix leds-gpio driver multiple module_init/exit usage
  leds: Add dac124s085 driver
  leds: allow led-drivers to use a variable range of brightness values
  leds: Add openfirmware platform device support
parents 1aa2a7cc 67a32ec7
Loading
Loading
Loading
Loading
+37 −9
Original line number Original line Diff line number Diff line
LED connected to GPIO
LEDs connected to GPIO lines


Required properties:
Required properties:
- compatible : should be "gpio-led".
- compatible : should be "gpio-leds".
- label : (optional) the label for this LED. If omitted, the label is

Each LED is represented as a sub-node of the gpio-leds device.  Each
node's name represents the name of the corresponding LED.

LED sub-node properties:
- gpios :  Should specify the LED's GPIO, see "Specifying GPIO information
  for devices" in Documentation/powerpc/booting-without-of.txt.  Active
  low LEDs should be indicated using flags in the GPIO specifier.
- label :  (optional) The label for this LED.  If omitted, the label is
  taken from the node name (excluding the unit address).
  taken from the node name (excluding the unit address).
- gpios : should specify LED GPIO.
- linux,default-trigger :  (optional) This parameter, if present, is a
  string defining the trigger assigned to the LED.  Current triggers are:
    "backlight" - LED will act as a back-light, controlled by the framebuffer
		  system
    "default-on" - LED will turn on
    "heartbeat" - LED "double" flashes at a load average based rate
    "ide-disk" - LED indicates disk activity
    "timer" - LED flashes at a fixed, configurable rate

Examples:


Example:
leds {
	compatible = "gpio-leds";
	hdd {
		label = "IDE Activity";
		gpios = <&mcu_pio 0 1>; /* Active low */
		linux,default-trigger = "ide-disk";
	};
};


led@0 {
run-control {
	compatible = "gpio-led";
	compatible = "gpio-leds";
	label = "hdd";
	red {
	gpios = <&mcu_pio 0 1>;
		gpios = <&mpc8572 6 0>;
	};
	green {
		gpios = <&mpc8572 7 0>;
	};
	};
}
+72 −3
Original line number Original line Diff line number Diff line
@@ -31,6 +31,13 @@ config LEDS_LOCOMO
	  This option enables support for the LEDs on Sharp Locomo.
	  This option enables support for the LEDs on Sharp Locomo.
	  Zaurus models SL-5500 and SL-5600.
	  Zaurus models SL-5500 and SL-5600.


config LEDS_MIKROTIK_RB532
	tristate "LED Support for Mikrotik Routerboard 532"
	depends on LEDS_CLASS && MIKROTIK_RB532
	help
	  This option enables support for the so called "User LED" of
	  Mikrotik's Routerboard 532.

config LEDS_S3C24XX
config LEDS_S3C24XX
	tristate "LED Support for Samsung S3C24XX GPIO LEDs"
	tristate "LED Support for Samsung S3C24XX GPIO LEDs"
	depends on LEDS_CLASS && ARCH_S3C2410
	depends on LEDS_CLASS && ARCH_S3C2410
@@ -117,11 +124,40 @@ config LEDS_GPIO
	help
	help
	  This option enables support for the LEDs connected to GPIO
	  This option enables support for the LEDs connected to GPIO
	  outputs. To be useful the particular board must have LEDs
	  outputs. To be useful the particular board must have LEDs
	  and they must be connected to the GPIO lines.
	  and they must be connected to the GPIO lines.  The LEDs must be
	  defined as platform devices and/or OpenFirmware platform devices.
	  The code to use these bindings can be selected below.

config LEDS_GPIO_PLATFORM
	bool "Platform device bindings for GPIO LEDs"
	depends on LEDS_GPIO
	default y
	help
	  Let the leds-gpio driver drive LEDs which have been defined as
	  platform devices.  If you don't know what this means, say yes.

config LEDS_GPIO_OF
	bool "OpenFirmware platform device bindings for GPIO LEDs"
	depends on LEDS_GPIO && OF_DEVICE
	default y
	help
	  Let the leds-gpio driver drive LEDs which have been defined as
	  of_platform devices.  For instance, LEDs which are listed in a "dts"
	  file.

config LEDS_LP5521
	tristate "LED Support for the LP5521 LEDs"
	depends on LEDS_CLASS && I2C
	help
	  If you say 'Y' here you get support for the National Semiconductor
	  LP5521 LED driver used in n8x0 boards.

	  This driver can be built as a module by choosing 'M'. The module
	  will be called leds-lp5521.


config LEDS_CLEVO_MAIL
config LEDS_CLEVO_MAIL
	tristate "Mail LED on Clevo notebook (EXPERIMENTAL)"
	tristate "Mail LED on Clevo notebook"
	depends on LEDS_CLASS && X86 && SERIO_I8042 && DMI && EXPERIMENTAL
	depends on LEDS_CLASS && X86 && SERIO_I8042 && DMI
	help
	help
	  This driver makes the mail LED accessible from userspace
	  This driver makes the mail LED accessible from userspace
	  programs through the leds subsystem. This LED have three
	  programs through the leds subsystem. This LED have three
@@ -171,6 +207,26 @@ config LEDS_DA903X
	  This option enables support for on-chip LED drivers found
	  This option enables support for on-chip LED drivers found
	  on Dialog Semiconductor DA9030/DA9034 PMICs.
	  on Dialog Semiconductor DA9030/DA9034 PMICs.


config LEDS_DAC124S085
	tristate "LED Support for DAC124S085 SPI DAC"
	depends on LEDS_CLASS && SPI
	help
	  This option enables support for DAC124S085 SPI DAC from NatSemi,
	  which can be used to control up to four LEDs.

config LEDS_PWM
	tristate "PWM driven LED Support"
	depends on LEDS_CLASS && HAVE_PWM
	help
	  This option enables support for pwm driven LEDs

config LEDS_BD2802
	tristate "LED driver for BD2802 RGB LED"
	depends on LEDS_CLASS && I2C
	help
	  This option enables support for BD2802GU RGB LED driver chips
	  accessed via the I2C bus.

comment "LED Triggers"
comment "LED Triggers"


config LEDS_TRIGGERS
config LEDS_TRIGGERS
@@ -216,6 +272,19 @@ config LEDS_TRIGGER_BACKLIGHT


	  If unsure, say N.
	  If unsure, say N.


config LEDS_TRIGGER_GPIO
	tristate "LED GPIO Trigger"
	depends on LEDS_TRIGGERS
	depends on GPIOLIB
	help
	  This allows LEDs to be controlled by gpio events. It's good
	  when using gpios as switches and triggering the needed LEDs
	  from there. One use case is n810's keypad LEDs that could
	  be triggered by this trigger when user slides up to show
	  keypad.

	  If unsure, say N.

config LEDS_TRIGGER_DEFAULT_ON
config LEDS_TRIGGER_DEFAULT_ON
	tristate "LED Default ON Trigger"
	tristate "LED Default ON Trigger"
	depends on LEDS_TRIGGERS
	depends on LEDS_TRIGGERS
+7 −0
Original line number Original line Diff line number Diff line
@@ -6,7 +6,9 @@ obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o


# LED Platform Drivers
# LED Platform Drivers
obj-$(CONFIG_LEDS_ATMEL_PWM)		+= leds-atmel-pwm.o
obj-$(CONFIG_LEDS_ATMEL_PWM)		+= leds-atmel-pwm.o
obj-$(CONFIG_LEDS_BD2802)		+= leds-bd2802.o
obj-$(CONFIG_LEDS_LOCOMO)		+= leds-locomo.o
obj-$(CONFIG_LEDS_LOCOMO)		+= leds-locomo.o
obj-$(CONFIG_LEDS_MIKROTIK_RB532)	+= leds-rb532.o
obj-$(CONFIG_LEDS_S3C24XX)		+= leds-s3c24xx.o
obj-$(CONFIG_LEDS_S3C24XX)		+= leds-s3c24xx.o
obj-$(CONFIG_LEDS_AMS_DELTA)		+= leds-ams-delta.o
obj-$(CONFIG_LEDS_AMS_DELTA)		+= leds-ams-delta.o
obj-$(CONFIG_LEDS_NET48XX)		+= leds-net48xx.o
obj-$(CONFIG_LEDS_NET48XX)		+= leds-net48xx.o
@@ -24,10 +26,15 @@ obj-$(CONFIG_LEDS_FSG) += leds-fsg.o
obj-$(CONFIG_LEDS_PCA955X)		+= leds-pca955x.o
obj-$(CONFIG_LEDS_PCA955X)		+= leds-pca955x.o
obj-$(CONFIG_LEDS_DA903X)		+= leds-da903x.o
obj-$(CONFIG_LEDS_DA903X)		+= leds-da903x.o
obj-$(CONFIG_LEDS_WM8350)		+= leds-wm8350.o
obj-$(CONFIG_LEDS_WM8350)		+= leds-wm8350.o
obj-$(CONFIG_LEDS_PWM)			+= leds-pwm.o

# LED SPI Drivers
obj-$(CONFIG_LEDS_DAC124S085)		+= leds-dac124s085.o


# LED Triggers
# LED Triggers
obj-$(CONFIG_LEDS_TRIGGER_TIMER)	+= ledtrig-timer.o
obj-$(CONFIG_LEDS_TRIGGER_TIMER)	+= ledtrig-timer.o
obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK)	+= ledtrig-ide-disk.o
obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK)	+= ledtrig-ide-disk.o
obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT)	+= ledtrig-heartbeat.o
obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT)	+= ledtrig-heartbeat.o
obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT)	+= ledtrig-backlight.o
obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT)	+= ledtrig-backlight.o
obj-$(CONFIG_LEDS_TRIGGER_GPIO)		+= ledtrig-gpio.o
obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON)	+= ledtrig-default-on.o
obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON)	+= ledtrig-default-on.o
+20 −1
Original line number Original line Diff line number Diff line
@@ -64,7 +64,16 @@ static ssize_t led_brightness_store(struct device *dev,
	return ret;
	return ret;
}
}


static ssize_t led_max_brightness_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct led_classdev *led_cdev = dev_get_drvdata(dev);

	return sprintf(buf, "%u\n", led_cdev->max_brightness);
}

static DEVICE_ATTR(brightness, 0644, led_brightness_show, led_brightness_store);
static DEVICE_ATTR(brightness, 0644, led_brightness_show, led_brightness_store);
static DEVICE_ATTR(max_brightness, 0444, led_max_brightness_show, NULL);
#ifdef CONFIG_LEDS_TRIGGERS
#ifdef CONFIG_LEDS_TRIGGERS
static DEVICE_ATTR(trigger, 0644, led_trigger_show, led_trigger_store);
static DEVICE_ATTR(trigger, 0644, led_trigger_show, led_trigger_store);
#endif
#endif
@@ -138,6 +147,13 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
	list_add_tail(&led_cdev->node, &leds_list);
	list_add_tail(&led_cdev->node, &leds_list);
	up_write(&leds_list_lock);
	up_write(&leds_list_lock);


	if (!led_cdev->max_brightness)
		led_cdev->max_brightness = LED_FULL;

	rc = device_create_file(led_cdev->dev, &dev_attr_max_brightness);
	if (rc)
		goto err_out_attr_max;

	led_update_brightness(led_cdev);
	led_update_brightness(led_cdev);


#ifdef CONFIG_LEDS_TRIGGERS
#ifdef CONFIG_LEDS_TRIGGERS
@@ -155,9 +171,11 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)


#ifdef CONFIG_LEDS_TRIGGERS
#ifdef CONFIG_LEDS_TRIGGERS
err_out_led_list:
err_out_led_list:
	device_remove_file(led_cdev->dev, &dev_attr_max_brightness);
#endif
err_out_attr_max:
	device_remove_file(led_cdev->dev, &dev_attr_brightness);
	device_remove_file(led_cdev->dev, &dev_attr_brightness);
	list_del(&led_cdev->node);
	list_del(&led_cdev->node);
#endif
err_out:
err_out:
	device_unregister(led_cdev->dev);
	device_unregister(led_cdev->dev);
	return rc;
	return rc;
@@ -172,6 +190,7 @@ EXPORT_SYMBOL_GPL(led_classdev_register);
 */
 */
void led_classdev_unregister(struct led_classdev *led_cdev)
void led_classdev_unregister(struct led_classdev *led_cdev)
{
{
	device_remove_file(led_cdev->dev, &dev_attr_max_brightness);
	device_remove_file(led_cdev->dev, &dev_attr_brightness);
	device_remove_file(led_cdev->dev, &dev_attr_brightness);
#ifdef CONFIG_LEDS_TRIGGERS
#ifdef CONFIG_LEDS_TRIGGERS
	device_remove_file(led_cdev->dev, &dev_attr_trigger);
	device_remove_file(led_cdev->dev, &dev_attr_trigger);
+9 −1
Original line number Original line Diff line number Diff line
@@ -156,12 +156,20 @@ EXPORT_SYMBOL_GPL(led_trigger_set_default);
int led_trigger_register(struct led_trigger *trigger)
int led_trigger_register(struct led_trigger *trigger)
{
{
	struct led_classdev *led_cdev;
	struct led_classdev *led_cdev;
	struct led_trigger *trig;


	rwlock_init(&trigger->leddev_list_lock);
	rwlock_init(&trigger->leddev_list_lock);
	INIT_LIST_HEAD(&trigger->led_cdevs);
	INIT_LIST_HEAD(&trigger->led_cdevs);


	/* Add to the list of led triggers */
	down_write(&triggers_list_lock);
	down_write(&triggers_list_lock);
	/* Make sure the trigger's name isn't already in use */
	list_for_each_entry(trig, &trigger_list, next_trig) {
		if (!strcmp(trig->name, trigger->name)) {
			up_write(&triggers_list_lock);
			return -EEXIST;
		}
	}
	/* Add to the list of led triggers */
	list_add_tail(&trigger->next_trig, &trigger_list);
	list_add_tail(&trigger->next_trig, &trigger_list);
	up_write(&triggers_list_lock);
	up_write(&triggers_list_lock);


Loading