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

Commit c7a6ced9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull LED subsystem update from Bryan Wu.

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (24 commits)
  leds: add output driver configuration for pca9633 led driver
  leds: lm3642: Use regmap_update_bits() in lm3642_chip_init()
  leds: Add new LED driver for lm3642 chips
  leds-lp5523: Fix riskiness of the page fault
  leds-lp5523: turn off the LED engines on unloading the driver
  leds-lm3530: Fix smatch warnings
  leds-lm3530: Use devm_regulator_get function
  leds: leds-gpio: adopt pinctrl support
  leds: Add new LED driver for lm355x chips
  leds-lp5523: use the i2c device id rather than fixed name
  leds-lp5523: add new device id for LP55231
  leds-lp5523: support new LP55231 device
  leds: triggers: send uevent when changing triggers
  leds-lp5523: minor code style fixes
  leds-lp5523: change the return type of lp5523_set_mode()
  leds-lp5523: set the brightness to 0 forcely on removing the driver
  leds-lp5523: add channel name in the platform data
  leds: leds-gpio: Use of_get_child_count() helper
  leds: leds-gpio: Use platform_{get,set}_drvdata
  leds: leds-gpio: use of_match_ptr()
  ...
parents a188e7e9 2f73c392
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -10,8 +10,22 @@ Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com)
Description
-----------
LP5523 can drive up to 9 channels. Leds can be controlled directly via
the led class control interface. Channels have generic names:
lp5523:channelx where x is 0...8
the led class control interface.
The name of each channel is configurable in the platform data - name and label.
There are three options to make the channel name.

a) Define the 'name' in the platform data
To make specific channel name, then use 'name' platform data.
/sys/class/leds/R1               (name: 'R1')
/sys/class/leds/B1               (name: 'B1')

b) Use the 'label' with no 'name' field
For one device name with channel number, then use 'label'.
/sys/class/leds/RGB:channelN     (label: 'RGB', N: 0 ~ 8)

c) Default
If both fields are NULL, 'lp5523' is used by default.
/sys/class/leds/lp5523:channelN  (N: 0 ~ 8)

The chip provides 3 engines. Each engine can control channels without
interaction from the main CPU. Details of the micro engine code can be found
@@ -46,12 +60,13 @@ Note - chan_nr can have values between 0 and 8.

static struct lp5523_led_config lp5523_led_config[] = {
        {
		.name		= "D1",
                .chan_nr        = 0,
                .led_current    = 50,
		.max_current    = 130,
        },
...
        }, {
        {
                .chan_nr        = 8,
                .led_current    = 50,
		.max_current    = 130,
+19 −7
Original line number Diff line number Diff line
@@ -63,6 +63,17 @@ config LEDS_LM3533
	  hardware-accelerated blinking with maximum on and off periods of 9.8
	  and 77 seconds respectively.

config LEDS_LM3642
	tristate "LED support for LM3642 Chip"
	depends on LEDS_CLASS && I2C
	select REGMAP_I2C
	help
	  This option enables support for LEDs connected to LM3642.
	  The LM3642 is a 4MHz fixed-frequency synchronous boost
	  converter plus 1.5A constant current driver for a high-current
	  white LED.


config LEDS_LOCOMO
	tristate "LED Support for Locomo device"
	depends on LEDS_CLASS
@@ -192,11 +203,12 @@ config LEDS_LP5521
	  programming the engines.

config LEDS_LP5523
	tristate "LED Support for N.S. LP5523 LED driver chip"
	tristate "LED Support for TI/National LP5523/55231 LED driver chip"
	depends on LEDS_CLASS && I2C
	help
	  If you say yes here you get support for the National Semiconductor
	  LP5523 LED driver. It is 9 channel chip with programmable engines.
	  If you say yes here you get support for TI/National Semiconductor
	  LP5523/55231 LED driver.
	  It is 9 channel chip with programmable engines.
	  Driver provides direct control via LED class and interface for
	  programming the engines.

@@ -422,13 +434,13 @@ config LEDS_MAX8997
	  This option enables support for on-chip LED drivers on
	  MAXIM MAX8997 PMIC.

config LEDS_LM3556
	tristate "LED support for LM3556 Chip"
config LEDS_LM355x
	tristate "LED support for LM355x Chips, LM3554 and LM3556"
	depends on LEDS_CLASS && I2C
	select REGMAP_I2C
	help
	  This option enables support for LEDs connected to LM3556.
	  LM3556 includes Torch, Flash and Indicator functions.
	  This option enables support for LEDs connected to LM355x.
	  LM355x includes Torch, Flash and Indicator functions.

config LEDS_OT200
	tristate "LED support for the Bachmann OT200"
+2 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ obj-$(CONFIG_LEDS_BD2802) += leds-bd2802.o
obj-$(CONFIG_LEDS_LOCOMO)		+= leds-locomo.o
obj-$(CONFIG_LEDS_LM3530)		+= leds-lm3530.o
obj-$(CONFIG_LEDS_LM3533)		+= leds-lm3533.o
obj-$(CONFIG_LEDS_LM3642)		+= leds-lm3642.o
obj-$(CONFIG_LEDS_MIKROTIK_RB532)	+= leds-rb532.o
obj-$(CONFIG_LEDS_S3C24XX)		+= leds-s3c24xx.o
obj-$(CONFIG_LEDS_NET48XX)		+= leds-net48xx.o
@@ -48,7 +49,7 @@ obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o
obj-$(CONFIG_LEDS_ASIC3)		+= leds-asic3.o
obj-$(CONFIG_LEDS_RENESAS_TPU)		+= leds-renesas-tpu.o
obj-$(CONFIG_LEDS_MAX8997)		+= leds-max8997.o
obj-$(CONFIG_LEDS_LM3556)		+= leds-lm3556.o
obj-$(CONFIG_LEDS_LM355x)		+= leds-lm355x.o
obj-$(CONFIG_LEDS_BLINKM)		+= leds-blinkm.o

# LED SPI Drivers
+15 −0
Original line number Diff line number Diff line
@@ -124,6 +124,16 @@ static void led_timer_function(unsigned long data)
	mod_timer(&led_cdev->blink_timer, jiffies + msecs_to_jiffies(delay));
}

static void set_brightness_delayed(struct work_struct *ws)
{
	struct led_classdev *led_cdev =
		container_of(ws, struct led_classdev, set_brightness_work);

	led_stop_software_blink(led_cdev);

	__led_set_brightness(led_cdev, led_cdev->delayed_set_value);
}

/**
 * led_classdev_suspend - suspend an led_classdev.
 * @led_cdev: the led_classdev to suspend.
@@ -191,6 +201,8 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)

	led_update_brightness(led_cdev);

	INIT_WORK(&led_cdev->set_brightness_work, set_brightness_delayed);

	init_timer(&led_cdev->blink_timer);
	led_cdev->blink_timer.function = led_timer_function;
	led_cdev->blink_timer.data = (unsigned long)led_cdev;
@@ -221,7 +233,10 @@ void led_classdev_unregister(struct led_classdev *led_cdev)
	up_write(&led_cdev->trigger_lock);
#endif

	cancel_work_sync(&led_cdev->set_brightness_work);

	/* Stop blinking */
	led_stop_software_blink(led_cdev);
	led_set_brightness(led_cdev, LED_OFF);

	device_unregister(led_cdev->dev);
+13 −3
Original line number Diff line number Diff line
@@ -103,13 +103,23 @@ void led_blink_set_oneshot(struct led_classdev *led_cdev,
}
EXPORT_SYMBOL(led_blink_set_oneshot);

void led_set_brightness(struct led_classdev *led_cdev,
			enum led_brightness brightness)
void led_stop_software_blink(struct led_classdev *led_cdev)
{
	/* stop and clear soft-blink timer */
	del_timer_sync(&led_cdev->blink_timer);
	led_cdev->blink_delay_on = 0;
	led_cdev->blink_delay_off = 0;
}
EXPORT_SYMBOL_GPL(led_stop_software_blink);

void led_set_brightness(struct led_classdev *led_cdev,
			enum led_brightness brightness)
{
	/* delay brightness setting if need to stop soft-blink timer */
	if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) {
		led_cdev->delayed_set_value = brightness;
		schedule_work(&led_cdev->set_brightness_work);
		return;
	}

	__led_set_brightness(led_cdev, brightness);
}
Loading