Skip to content

Commit

Permalink
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/cooloney/linux-leds

Pull led updates from Bryan Wu:
 "Sorry for the late pull request, since I'm just back from vacation.

  LED subsystem updates for 3.12:
   - pca9633 driver DT supporting and pca9634 chip supporting
   - restore legacy device attributes for lp5521
   - other fixing and updates"

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (28 commits)
  leds: wm831x-status: Request a REG resource
  leds: trigger: ledtrig-backlight: Fix invalid memory access in fb_event notification callback
  leds-pca963x: Fix device tree parsing
  leds-pca9633: Rename to leds-pca963x
  leds-pca9633: Add mutex to the ledout register
  leds-pca9633: Unique naming of the LEDs
  leds-pca9633: Add support for PCA9634
  leds: lp5562: use LP55xx common macros for device attributes
  Documentation: leds-lp5521,lp5523: update device attribute information
  leds: lp5523: remove unnecessary writing commands
  leds: lp5523: restore legacy device attributes
  leds: lp5523: LED MUX configuration on initializing
  leds: lp5523: make separate API for loading engine
  leds: lp5521: remove unnecessary writing commands
  leds: lp5521: restore legacy device attributes
  leds: lp55xx: add common macros for device attributes
  leds: lp55xx: add common data structure for program
  Documentation: leds: Fix a typo
  leds: ss4200: Fix incorrect placement of __initdata
  leds: clevo-mail: Fix incorrect placement of __initdata
  ...
  • Loading branch information
Linus Torvalds committed Sep 12, 2013
2 parents e5d0c87 + 61abeba commit 5223161
Show file tree
Hide file tree
Showing 44 changed files with 1,645 additions and 315 deletions.
72 changes: 71 additions & 1 deletion Documentation/devicetree/bindings/leds/leds-lp55xx.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Binding for TI/National Semiconductor LP55xx Led Drivers

Required properties:
- compatible: "national,lp5521" or "national,lp5523" or "ti,lp5562"
- compatible: "national,lp5521" or "national,lp5523" or "ti,lp5562" or "ti,lp8501"
- reg: I2C slave address
- clock-mode: Input clock mode, (0: automode, 1: internal, 2: external)

Expand All @@ -11,6 +11,11 @@ Each child has own specific current settings

Optional properties:
- label: Used for naming LEDs
- pwr-sel: LP8501 specific property. Power selection for output channels.
0: D1~9 are connected to VDD
1: D1~6 with VDD, D7~9 with VOUT
2: D1~6 with VOUT, D7~9 with VDD
3: D1~9 are connected to VOUT

Alternatively, each child can have specific channel name
- chan-name: Name of each channel name
Expand Down Expand Up @@ -145,3 +150,68 @@ lp5562@30 {
max-cur = /bits/ 8 <0x60>;
};
};

example 4) LP8501
9 channels are defined. The 'pwr-sel' is LP8501 specific property.
Others are same as LP5523.

lp8501@32 {
compatible = "ti,lp8501";
reg = <0x32>;
clock-mode = /bits/ 8 <2>;
pwr-sel = /bits/ 8 <3>; /* D1~9 connected to VOUT */

chan0 {
chan-name = "d1";
led-cur = /bits/ 8 <0x14>;
max-cur = /bits/ 8 <0x20>;
};

chan1 {
chan-name = "d2";
led-cur = /bits/ 8 <0x14>;
max-cur = /bits/ 8 <0x20>;
};

chan2 {
chan-name = "d3";
led-cur = /bits/ 8 <0x14>;
max-cur = /bits/ 8 <0x20>;
};

chan3 {
chan-name = "d4";
led-cur = /bits/ 8 <0x14>;
max-cur = /bits/ 8 <0x20>;
};

chan4 {
chan-name = "d5";
led-cur = /bits/ 8 <0x14>;
max-cur = /bits/ 8 <0x20>;
};

chan5 {
chan-name = "d6";
led-cur = /bits/ 8 <0x14>;
max-cur = /bits/ 8 <0x20>;
};

chan6 {
chan-name = "d7";
led-cur = /bits/ 8 <0x14>;
max-cur = /bits/ 8 <0x20>;
};

chan7 {
chan-name = "d8";
led-cur = /bits/ 8 <0x14>;
max-cur = /bits/ 8 <0x20>;
};

chan8 {
chan-name = "d9";
led-cur = /bits/ 8 <0x14>;
max-cur = /bits/ 8 <0x20>;
};
};
47 changes: 47 additions & 0 deletions Documentation/devicetree/bindings/leds/pca963x.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
LEDs connected to pca9632, pca9633 or pca9634

Required properties:
- compatible : should be : "nxp,pca9632", "nxp,pca9633" or "nxp,pca9634"

Optional properties:
- nxp,totem-pole : use totem pole (push-pull) instead of default open-drain
- nxp,hw-blink : use hardware blinking instead of software blinking

Each led is represented as a sub-node of the nxp,pca963x device.

LED sub-node properties:
- label : (optional) see Documentation/devicetree/bindings/leds/common.txt
- reg : number of LED line (could be from 0 to 3 in pca9632 or pca9633
or 0 to 7 in pca9634)
- linux,default-trigger : (optional)
see Documentation/devicetree/bindings/leds/common.txt

Examples:

pca9632: pca9632 {
compatible = "nxp,pca9632";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x62>;

red@0 {
label = "red";
reg = <0>;
linux,default-trigger = "none";
};
green@1 {
label = "green";
reg = <1>;
linux,default-trigger = "none";
};
blue@2 {
label = "blue";
reg = <2>;
linux,default-trigger = "none";
};
unused@3 {
label = "unused";
reg = <3>;
linux,default-trigger = "none";
};
};
20 changes: 19 additions & 1 deletion Documentation/leds/leds-lp5521.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,25 @@ All three channels can be also controlled using the engine micro programs.
More details of the instructions can be found from the public data sheet.

LP5521 has the internal program memory for running various LED patterns.
For the details, please refer to 'firmware' section in leds-lp55xx.txt
There are two ways to run LED patterns.

1) Legacy interface - enginex_mode and enginex_load
Control interface for the engines:
x is 1 .. 3
enginex_mode : disabled, load, run
enginex_load : store program (visible only in engine load mode)

Example (start to blink the channel 2 led):
cd /sys/class/leds/lp5521:channel2/device
echo "load" > engine3_mode
echo "037f4d0003ff6000" > engine3_load
echo "run" > engine3_mode

To stop the engine:
echo "disabled" > engine3_mode

2) Firmware interface - LP55xx common interface
For the details, please refer to 'firmware' section in leds-lp55xx.txt

sysfs contains a selftest entry.
The test communicates with the chip and checks that
Expand Down
21 changes: 20 additions & 1 deletion Documentation/leds/leds-lp5523.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,26 @@ If both fields are NULL, 'lp5523' is used by default.
/sys/class/leds/lp5523:channelN (N: 0 ~ 8)

LP5523 has the internal program memory for running various LED patterns.
For the details, please refer to 'firmware' section in leds-lp55xx.txt
There are two ways to run LED patterns.

1) Legacy interface - enginex_mode, enginex_load and enginex_leds
Control interface for the engines:
x is 1 .. 3
enginex_mode : disabled, load, run
enginex_load : microcode load (visible only in load mode)
enginex_leds : led mux control (visible only in load mode)

cd /sys/class/leds/lp5523:channel2/device
echo "load" > engine3_mode
echo "9d80400004ff05ff437f0000" > engine3_load
echo "111111111" > engine3_leds
echo "run" > engine3_mode

To stop the engine:
echo "disabled" > engine3_mode

2) Firmware interface - LP55xx common interface
For the details, please refer to 'firmware' section in leds-lp55xx.txt

Selftest uses always the current from the platform data.

Expand Down
30 changes: 27 additions & 3 deletions Documentation/leds/leds-lp55xx.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
LP5521/LP5523/LP55231 Common Driver
===================================
LP5521/LP5523/LP55231/LP5562/LP8501 Common Driver
=================================================

Authors: Milo(Woogyom) Kim <milo.kim@ti.com>

Description
-----------
LP5521, LP5523/55231 and LP5562 have common features as below.
LP5521, LP5523/55231, LP5562 and LP8501 have common features as below.

Register access via the I2C
Device initialization/deinitialization
Expand Down Expand Up @@ -109,6 +109,30 @@ As soon as 'loading' is set to 0, registered callback is called.
Inside the callback, the selected engine is loaded and memory is updated.
To run programmed pattern, 'run_engine' attribute should be enabled.

The pattern sqeuence of LP8501 is same as LP5523.
However pattern data is specific.
Ex 1) Engine 1 is used
echo 1 > /sys/bus/i2c/devices/xxxx/select_engine
echo 1 > /sys/class/firmware/lp8501/loading
echo "9d0140ff7e0040007e00a001c000" > /sys/class/firmware/lp8501/data
echo 0 > /sys/class/firmware/lp8501/loading
echo 1 > /sys/bus/i2c/devices/xxxx/run_engine

Ex 2) Engine 2 and 3 are used at the same time
echo 2 > /sys/bus/i2c/devices/xxxx/select_engine
sleep 1
echo 1 > /sys/class/firmware/lp8501/loading
echo "9d0140ff7e0040007e00a001c000" > /sys/class/firmware/lp8501/data
echo 0 > /sys/class/firmware/lp8501/loading
sleep 1
echo 3 > /sys/bus/i2c/devices/xxxx/select_engine
sleep 1
echo 1 > /sys/class/firmware/lp8501/loading
echo "9d0340ff7e0040007e00a001c000" > /sys/class/firmware/lp8501/data
echo 0 > /sys/class/firmware/lp8501/loading
sleep 1
echo 1 > /sys/class/leds/d1/device/run_engine

( 'run_engine' and 'firmware_cb' )
The sequence of running the program data is common.
But each device has own specific register addresses for commands.
Expand Down
34 changes: 22 additions & 12 deletions drivers/leds/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ config LEDS_LP3944
module will be called leds-lp3944.

config LEDS_LP55XX_COMMON
tristate "Common Driver for TI/National LP5521, LP5523/55231 and LP5562"
depends on LEDS_LP5521 || LEDS_LP5523 || LEDS_LP5562
tristate "Common Driver for TI/National LP5521/5523/55231/5562/8501"
depends on LEDS_LP5521 || LEDS_LP5523 || LEDS_LP5562 || LEDS_LP8501
select FW_LOADER
help
This option supports common operations for LP5521 and LP5523/55231
This option supports common operations for LP5521/5523/55231/5562/8501
devices.

config LEDS_LP5521
Expand Down Expand Up @@ -232,6 +232,18 @@ config LEDS_LP5562
Driver provides direct control via LED class and interface for
programming the engines.

config LEDS_LP8501
tristate "LED Support for TI LP8501 LED driver chip"
depends on LEDS_CLASS && I2C
select LEDS_LP55XX_COMMON
help
If you say yes here you get support for TI LP8501 LED driver.
It is 9 channel chip with programmable engines.
Driver provides direct control via LED class and interface for
programming the engines.
It is similar as LP5523, but output power selection is available.
And register layout and engine program schemes are different.

config LEDS_LP8788
tristate "LED support for the TI LP8788 PMIC"
depends on LEDS_CLASS
Expand Down Expand Up @@ -279,13 +291,14 @@ config LEDS_PCA955X
LED driver chips accessed via the I2C bus. Supported
devices include PCA9550, PCA9551, PCA9552, and PCA9553.

config LEDS_PCA9633
tristate "LED support for PCA9633 I2C chip"
config LEDS_PCA963X
tristate "LED support for PCA963x I2C chip"
depends on LEDS_CLASS
depends on I2C
help
This option enables support for LEDs connected to the PCA9633
LED driver chip accessed via the I2C bus.
This option enables support for LEDs connected to the PCA963x
LED driver chip accessed via the I2C bus. Supported
devices include PCA9633 and PCA9634

config LEDS_WM831X_STATUS
tristate "LED support for status LEDs on WM831x PMICs"
Expand Down Expand Up @@ -398,10 +411,7 @@ config LEDS_MC13783
config LEDS_NS2
tristate "LED support for Network Space v2 GPIO LEDs"
depends on LEDS_CLASS
depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || \
MACH_NETSPACE_MAX_V2 || MACH_D2NET_V2 || \
MACH_NETSPACE_V2_DT || MACH_INETSPACE_V2_DT || \
MACH_NETSPACE_MAX_V2_DT || MACH_NETSPACE_MINI_V2_DT
depends on ARCH_KIRKWOOD
default y
help
This option enable support for the dual-GPIO LED found on the
Expand All @@ -410,8 +420,8 @@ config LEDS_NS2

config LEDS_NETXBIG
tristate "LED support for Big Network series LEDs"
depends on MACH_NET2BIG_V2 || MACH_NET5BIG_V2
depends on LEDS_CLASS
depends on ARCH_KIRKWOOD
default y
help
This option enable support for LEDs found on the LaCie 2Big
Expand Down
3 changes: 2 additions & 1 deletion drivers/leds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ obj-$(CONFIG_LEDS_LP55XX_COMMON) += leds-lp55xx-common.o
obj-$(CONFIG_LEDS_LP5521) += leds-lp5521.o
obj-$(CONFIG_LEDS_LP5523) += leds-lp5523.o
obj-$(CONFIG_LEDS_LP5562) += leds-lp5562.o
obj-$(CONFIG_LEDS_LP8501) += leds-lp8501.o
obj-$(CONFIG_LEDS_LP8788) += leds-lp8788.o
obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o
obj-$(CONFIG_LEDS_CLEVO_MAIL) += leds-clevo-mail.o
obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o
obj-$(CONFIG_LEDS_OT200) += leds-ot200.o
obj-$(CONFIG_LEDS_FSG) += leds-fsg.o
obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o
obj-$(CONFIG_LEDS_PCA9633) += leds-pca9633.o
obj-$(CONFIG_LEDS_PCA963X) += leds-pca963x.o
obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o
obj-$(CONFIG_LEDS_DA9052) += leds-da9052.o
obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o
Expand Down
2 changes: 1 addition & 1 deletion drivers/leds/leds-88pm860x.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static int pm860x_led_dt_init(struct platform_device *pdev,
static int pm860x_led_probe(struct platform_device *pdev)
{
struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
struct pm860x_led_pdata *pdata = pdev->dev.platform_data;
struct pm860x_led_pdata *pdata = dev_get_platdata(&pdev->dev);
struct pm860x_led *data;
struct resource *res;
int ret = 0;
Expand Down
6 changes: 3 additions & 3 deletions drivers/leds/leds-adp5520.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static int adp5520_led_setup(struct adp5520_led *led)

static int adp5520_led_prepare(struct platform_device *pdev)
{
struct adp5520_leds_platform_data *pdata = pdev->dev.platform_data;
struct adp5520_leds_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct device *dev = pdev->dev.parent;
int ret = 0;

Expand All @@ -103,7 +103,7 @@ static int adp5520_led_prepare(struct platform_device *pdev)

static int adp5520_led_probe(struct platform_device *pdev)
{
struct adp5520_leds_platform_data *pdata = pdev->dev.platform_data;
struct adp5520_leds_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct adp5520_led *led, *led_dat;
struct led_info *cur_led;
int ret, i;
Expand Down Expand Up @@ -185,7 +185,7 @@ static int adp5520_led_probe(struct platform_device *pdev)

static int adp5520_led_remove(struct platform_device *pdev)
{
struct adp5520_leds_platform_data *pdata = pdev->dev.platform_data;
struct adp5520_leds_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct adp5520_led *led;
int i;

Expand Down
4 changes: 2 additions & 2 deletions drivers/leds/leds-asic3.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static int blink_set(struct led_classdev *cdev,

static int asic3_led_probe(struct platform_device *pdev)
{
struct asic3_led *led = pdev->dev.platform_data;
struct asic3_led *led = dev_get_platdata(&pdev->dev);
int ret;

ret = mfd_cell_enable(pdev);
Expand Down Expand Up @@ -127,7 +127,7 @@ static int asic3_led_probe(struct platform_device *pdev)

static int asic3_led_remove(struct platform_device *pdev)
{
struct asic3_led *led = pdev->dev.platform_data;
struct asic3_led *led = dev_get_platdata(&pdev->dev);

led_classdev_unregister(led->cdev);

Expand Down
Loading

0 comments on commit 5223161

Please sign in to comment.