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

Commit 5223161d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
  ...
parents e5d0c874 61abeba5
Loading
Loading
Loading
Loading
+71 −1
Original line number Diff line number Diff line
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)

@@ -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
@@ -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 −0
Original line number Diff line number Diff line
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";
	};
};
+19 −1
Original line number Diff line number Diff line
@@ -18,6 +18,24 @@ 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.
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.
+20 −1
Original line number Diff line number Diff line
@@ -28,6 +28,25 @@ 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.
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.
+27 −3
Original line number Diff line number Diff line
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
@@ -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.
Loading