Skip to content

Commit

Permalink
Merge tag 'leds_for_4.18-rc1' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/j.anaszewski/linux-leds

Pull LED updates from Jacek Anaszewski:
 "This was quite a fruitful cycle, taking into account usual traffic on
  linux-leds list, as we managed to merge three new LED class drivers.

  New LED class drivers with related DT bindings:
   - add LED driver for CR0014114 board
   - add Spreadtrum SC27xx breathing light controller driver
   - introduce the lm3601x LED driver

  LED class fix:
   - ensure workqueue is initialized before setting brightness

  Improvements and fixes to existing LED class drivers:
   - fix return value check in sc27xx_led_probe()
   - use sysfs_match_string() helper in wm831x_status_src_store()"

* tag 'leds_for_4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds:
  leds: class: ensure workqueue is initialized before setting brightness
  leds: lm3601x: Introduce the lm3601x LED driver
  dt: bindings: lm3601x: Introduce the lm3601x driver
  leds: sc27xx: Fix return value check in sc27xx_led_probe()
  leds: Add Spreadtrum SC27xx breathing light controller driver
  dt-bindings: leds: Add SC27xx breathing light controller documentation
  leds: wm831x-status: Use sysfs_match_string() helper
  leds: add LED driver for CR0014114 board
  dt-bindings: Add vendor prefix and docs for CR0014114
  • Loading branch information
torvalds committed Jun 5, 2018
2 parents 2158091 + 6d71021 commit 5231804
Show file tree
Hide file tree
Showing 11 changed files with 1,237 additions and 18 deletions.
54 changes: 54 additions & 0 deletions Documentation/devicetree/bindings/leds/leds-cr0014114.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Crane Merchandising System - cr0014114 LED driver
-------------------------------------------------

This LED Board is widely used in vending machines produced
by Crane Merchandising Systems.

Required properties:
- compatible: "crane,cr0014114"

Property rules described in Documentation/devicetree/bindings/spi/spi-bus.txt
apply. In particular, "reg" and "spi-max-frequency" properties must be given.

LED sub-node properties:
- label :
see Documentation/devicetree/bindings/leds/common.txt
- linux,default-trigger : (optional)
see Documentation/devicetree/bindings/leds/common.txt

Example
-------

led-controller@0 {
compatible = "crane,cr0014114";
reg = <0>;
spi-max-frequency = <50000>;
#address-cells = <1>;
#size-cells = <0>;

led@0 {
reg = <0>;
label = "red:coin";
};
led@1 {
reg = <1>;
label = "green:coin";
};
led@2 {
reg = <2>;
label = "blue:coin";
};
led@3 {
reg = <3>;
label = "red:bill";
};
led@4 {
reg = <4>;
label = "green:bill";
};
led@5 {
reg = <5>;
label = "blue:bill";
};
...
};
45 changes: 45 additions & 0 deletions Documentation/devicetree/bindings/leds/leds-lm3601x.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
* Texas Instruments - lm3601x Single-LED Flash Driver

The LM3601X are ultra-small LED flash drivers that
provide a high level of adjustability.

Required properties:
- compatible : Can be one of the following
"ti,lm36010"
"ti,lm36011"
- reg : I2C slave address
- #address-cells : 1
- #size-cells : 0

Required child properties:
- reg : 0 - Indicates a IR mode
1 - Indicates a Torch (white LED) mode

Required properties for flash LED child nodes:
See Documentation/devicetree/bindings/leds/common.txt
- flash-max-microamp : Range from 11mA - 1.5A
- flash-max-timeout-us : Range from 40ms - 1600ms
- led-max-microamp : Range from 2.4mA - 376mA

Optional child properties:
- label : see Documentation/devicetree/bindings/leds/common.txt

Example:
led-controller@64 {
compatible = "ti,lm36010";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x64>;

led@0 {
reg = <1>;
label = "white:torch";
led-max-microamp = <376000>;
flash-max-microamp = <1500000>;
flash-max-timeout-us = <1600000>;
};
}

For more product information please see the links below:
http://www.ti.com/product/LM36010
http://www.ti.com/product/LM36011
41 changes: 41 additions & 0 deletions Documentation/devicetree/bindings/leds/leds-sc27xx-bltc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
LEDs connected to Spreadtrum SC27XX PMIC breathing light controller

The SC27xx breathing light controller supports to 3 outputs:
red LED, green LED and blue LED. Each LED can work at normal
PWM mode or breath light mode.

Required properties:
- compatible: Should be "sprd,sc2731-bltc".
- #address-cells: Must be 1.
- #size-cells: Must be 0.
- reg: Specify the controller address.

Required child properties:
- reg: Port this LED is connected to.

Optional child properties:
- label: See Documentation/devicetree/bindings/leds/common.txt.

Examples:

led-controller@200 {
compatible = "sprd,sc2731-bltc";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x200>;

led@0 {
label = "red";
reg = <0x0>;
};

led@1 {
label = "green";
reg = <0x1>;
};

led@2 {
label = "blue";
reg = <0x2>;
};
};
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/vendor-prefixes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ cnxt Conexant Systems, Inc.
compulab CompuLab Ltd.
cortina Cortina Systems, Inc.
cosmic Cosmic Circuits
crane Crane Connectivity Solutions
creative Creative Technology Ltd
crystalfontz Crystalfontz America, Inc.
cubietech Cubietech, Ltd.
Expand Down
33 changes: 33 additions & 0 deletions drivers/leds/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ config LEDS_CPCAP
This option enables support for LEDs offered by Motorola's
CPCAP PMIC.

config LEDS_CR0014114
tristate "LED Support for Crane CR0014114"
depends on LEDS_CLASS
depends on SPI
depends on OF
help
This option enables support for CR0014114 LED Board which
is widely used in vending machines produced by
Crane Merchandising Systems.

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

config LEDS_LM3530
tristate "LCD Backlight driver for LM3530"
depends on LEDS_CLASS
Expand Down Expand Up @@ -145,6 +158,15 @@ config LEDS_LM3692X
This option enables support for the TI LM3692x family
of white LED string drivers used for backlighting.

config LEDS_LM3601X
tristate "LED support for LM3601x Chips"
depends on LEDS_CLASS && I2C
depends on LEDS_CLASS_FLASH
select REGMAP_I2C
help
This option enables support for the TI LM3601x family
of flash, torch and indicator classes.

config LEDS_LOCOMO
tristate "LED Support for Locomo device"
depends on LEDS_CLASS
Expand Down Expand Up @@ -647,6 +669,17 @@ config LEDS_IS31FL32XX
LED controllers. They are I2C devices with multiple constant-current
channels, each with independent 256-level PWM control.

config LEDS_SC27XX_BLTC
tristate "LED support for the SC27xx breathing light controller"
depends on LEDS_CLASS && MFD_SC27XX_PMIC
depends on OF
help
Say Y here to include support for the SC27xx breathing light controller
LEDs.

This driver can also be built as a module. If so the module will be
called leds-sc27xx-bltc.

comment "LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM)"

config LEDS_BLINKM
Expand Down
3 changes: 3 additions & 0 deletions drivers/leds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ obj-$(CONFIG_LEDS_MLXREG) += leds-mlxreg.o
obj-$(CONFIG_LEDS_NIC78BX) += leds-nic78bx.o
obj-$(CONFIG_LEDS_MT6323) += leds-mt6323.o
obj-$(CONFIG_LEDS_LM3692X) += leds-lm3692x.o
obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o
obj-$(CONFIG_LEDS_LM3601X) += leds-lm3601x.o

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

# LED Userspace Drivers
Expand Down
10 changes: 8 additions & 2 deletions drivers/leds/led-class.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,14 @@ int of_led_classdev_register(struct device *parent, struct device_node *np,
if (ret < 0)
return ret;

mutex_init(&led_cdev->led_access);
mutex_lock(&led_cdev->led_access);
led_cdev->dev = device_create_with_groups(leds_class, parent, 0,
led_cdev, led_cdev->groups, "%s", name);
if (IS_ERR(led_cdev->dev))
if (IS_ERR(led_cdev->dev)) {
mutex_unlock(&led_cdev->led_access);
return PTR_ERR(led_cdev->dev);
}
led_cdev->dev->of_node = np;

if (ret)
Expand All @@ -274,6 +278,7 @@ int of_led_classdev_register(struct device *parent, struct device_node *np,
ret = led_add_brightness_hw_changed(led_cdev);
if (ret) {
device_unregister(led_cdev->dev);
mutex_unlock(&led_cdev->led_access);
return ret;
}
}
Expand All @@ -285,7 +290,6 @@ int of_led_classdev_register(struct device *parent, struct device_node *np,
#ifdef CONFIG_LEDS_BRIGHTNESS_HW_CHANGED
led_cdev->brightness_hw_changed = -1;
#endif
mutex_init(&led_cdev->led_access);
/* add to the list of leds */
down_write(&leds_list_lock);
list_add_tail(&led_cdev->node, &leds_list);
Expand All @@ -302,6 +306,8 @@ int of_led_classdev_register(struct device *parent, struct device_node *np,
led_trigger_set_default(led_cdev);
#endif

mutex_unlock(&led_cdev->led_access);

dev_dbg(parent, "Registered led device: %s\n",
led_cdev->name);

Expand Down
Loading

0 comments on commit 5231804

Please sign in to comment.