Skip to contentSkip to conversation

Driver for TI tlc591xx 8/16 Channel i2c LED driver

PATCH Superseded Andrew Lunn 3 participants 8 messages Jan 27, 2015 – Feb 16, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v6 cover Driver for TI tlc591xx 8/16 Channel i2c LED driver

This patchset is a driver for the TI tlc59116 16 Channel i2c LED driver and tlc59108 8 Channel i2c LED driver. This driver is used on the Belkin WRT1900AC access point and the C code is derived from code Belkin contributed to OpenWRT. However it has been extensively re-written, and a device tree binding added to replace platform data.

Cc Matthew.Fatheree at belkin.com

Since v5:
Hard code number of LEDs, rather than #define Moved common fields from led into priv
Moved reg_ledout into priv, removed helper functions Cache brightness to avoid race conditions tlc591xx_led_set -> tlc591xx_set_brightness
Be paranoid with of_match_device() and client->dev.of_node

Since v4:
Fix Oops on module unload reported by Vignesh R

Since v3:
Generalized and added support for tlc59108 brightness == 0 and brightness == LED_FULL disable PWM and used
fixed OFF/ON mode

Since v2:
Remove incorrect /* Mode register ? */ comment Parenthesis around the macro arguments Converted many signed variables into unsigned Saved an initialization

Since v1:
s/uint8_t/u8/g
Remove empty line
Removed #gpio-cells
Added select REGMAP_I2C
Sorted #includes into alphabetic order
Added missing MODULE_DEVICE_TABLE(of, ...)
Check return value of regmap_write()
Simplified tlc59116_set_mode()

Andrew Lunn (2):
leds: tlc59116: Document binding for the TI 16 Channel i2c LED driver
leds: tlc59116: Driver for the TI 16 Channel i2c LED driver

 .../devicetree/bindings/leds/leds-tlc59116.txt     |  41 ++++
 drivers/leds/Kconfig                               |   7 +
 drivers/leds/Makefile                              |   1 +
 drivers/leds/leds-tlc59116.c                       | 253 +++++++++++++++++++++
 4 files changed, 302 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-tlc59116.txt
 create mode 100644 drivers/leds/leds-tlc59116.c
Signature · 1 line
2.1.3
#1 lore raw

PATCH v6 1/2 leds: tlc591xx: Document binding for the TI 8/16 Channel i2c LED driver

Document the binding for the TLC591xx LED driver.

Cc Matthew.Fatheree at belkin.com
---
 .../devicetree/bindings/leds/leds-tlc591xx.txt     | 40 ++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-tlc591xx.txt
Documentation/devicetree/bindings/leds/leds-tlc591xx.txt new file +40 -0
new file mode 100644
index 000000000000..3bbbf7024411
@@ -0,0 +1,40 @@
+LEDs connected to tlc59116 or tlc59108
+
+Required properties
+- compatible: should be "ti,tlc59116" or "ti,tlc59108"
+- #address-cells: must be 1
+- #size-cells: must be 0
+- reg: typically 0x68
+
+Each led is represented as a sub-node of the ti,tlc59116.
+See Documentation/devicetree/bindings/leds/common.txt
+
+LED sub-node properties:
+- reg: number of LED line, 0 to 15 or 0 to 7
+- label: (optional) name of LED
+- linux,default-trigger : (optional)
+
+Examples:
+
+tlc59116 at 68 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	compatible = "ti,tlc59116";
+	reg = <0x68>;
+
+	wan at 0 {
+		label = "wrt1900ac:amber:wan";
+		reg = <0x0>;
+	};
+
+	2g at 2 {
+		label = "wrt1900ac:white:2g";
+		reg = <0x2>;
+	};
+
+	alive at 9 {
+		label = "wrt1900ac:green:alive";
+		reg = <0x9>;
+		linux,default_trigger = "heartbeat";
+	};
+};
Signature · 1 line
2.1.4
#2 lore raw

PATCH v6 2/2 leds: tlc591xx: Driver for the TI 8/16 Channel i2c LED driver

In reply to Andrew Lunn

The TLC59116 is an I2C bus controlled 16-channel LED driver. The TLC59108 is an I2C bus controlled 8-channel LED driver, which is very similar to the TLC59116. Each LED output has its own 8-bit fixed-frequency PWM controller to control the brightness of the LED. The LEDs can also be fixed off and on, making them suitable for use as GPOs.

This is based on a driver from Belkin, but has been extensively rewritten and extended to support both 08 and 16 versions.

Cc Matthew.Fatheree at belkin.com
---
 drivers/leds/Kconfig         |   8 ++
 drivers/leds/Makefile        |   1 +
 drivers/leds/leds-tlc591xx.c | 300 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 309 insertions(+)
 create mode 100644 drivers/leds/leds-tlc591xx.c
drivers/leds/Kconfig +8 -0
index a6c3d2f153f3..67cba2032543 100644
@@ -457,6 +457,14 @@ config LEDS_TCA6507
 	  LED driver chips accessed via the I2C bus.
 	  Driver support brightness control and hardware-assisted blinking.
 
+config LEDS_TLC591XX
+	tristate "LED driver for TLC59108 and TLC59116 controllers"
+	depends on LEDS_CLASS && I2C
+	select REGMAP_I2C
+	help
+	  This option enables support for Texas Instruments TLC59108
+	  and TLC59116 LED controllers.
+
 config LEDS_MAX8997
 	tristate "LED support for MAX8997 PMIC"
 	depends on LEDS_CLASS && MFD_MAX8997
drivers/leds/Makefile +1 -0
index 1c65a191d907..0558117a9407 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_LEDS_LP8501)		+= leds-lp8501.o
 obj-$(CONFIG_LEDS_LP8788)		+= leds-lp8788.o
 obj-$(CONFIG_LEDS_LP8860)		+= leds-lp8860.o
 obj-$(CONFIG_LEDS_TCA6507)		+= leds-tca6507.o
+obj-$(CONFIG_LEDS_TLC591XX)		+= leds-tlc591xx.o
 obj-$(CONFIG_LEDS_CLEVO_MAIL)		+= leds-clevo-mail.o
 obj-$(CONFIG_LEDS_IPAQ_MICRO)		+= leds-ipaq-micro.o
 obj-$(CONFIG_LEDS_HP6XX)		+= leds-hp6xx.o
drivers/leds/leds-tlc591xx.c new file +300 -0

300 lines not on this page · raw message

Signature · 1 line
2.1.4
#3 lore raw

PATCH v6 2/2 leds: tlc591xx: Driver for the TI 8/16 Channel i2c LED driver

Hi Andrew,

Quoted 7 lines · Andrew Lunn

The TLC59116 is an I2C bus controlled 16-channel LED driver. The TLC59108 is an I2C bus controlled 8-channel LED driver, which is very similar to the TLC59116. Each LED output has its own 8-bit fixed-frequency PWM controller to control the brightness of the LED. The LEDs can also be fixed off and on, making them suitable for use as GPOs.

Quoted 5 lines

This is based on a driver from Belkin, but has been extensively rewritten and extended to support both 08 and 16 versions.

Cc Matthew.Fatheree at belkin.com

I've tested the driver on the Mamba (WRT1900AC) and it has been integrated to OpenWrt trunk for a while now, and no issues has been reported by the community either.

Please feel free to add Tested-by: Imre Kaloz <[email protected]>.

Thanks,

Imre

#4 lore raw

v6 cover Driver for TI tlc591xx 8/16 Channel i2c LED driver

In reply to Andrew Lunn
Quoted 5 lines · Andrew Lunn

This patchset is a driver for the TI tlc59116 16 Channel i2c LED driver and tlc59108 8 Channel i2c LED driver. This driver is used on the Belkin WRT1900AC access point and the C code is derived from code Belkin contributed to OpenWRT. However it has been extensively re-written, and a device tree binding added to replace platform data.

Hi Bryan

Do you have any further comments on this driver? Are you likely to queue it up for the next merge window?

Thanks
Andrew

Quoted 51 lines
Cc Matthew.Fatheree at belkin.com

Since v5:
Hard code number of LEDs, rather than #define Moved common fields from led into priv
Moved reg_ledout into priv, removed helper functions Cache brightness to avoid race conditions tlc591xx_led_set -> tlc591xx_set_brightness
Be paranoid with of_match_device() and client->dev.of_node

Since v4:
Fix Oops on module unload reported by Vignesh R

Since v3:
Generalized and added support for tlc59108 brightness == 0 and brightness == LED_FULL disable PWM and used
fixed OFF/ON mode

Since v2:
Remove incorrect /* Mode register ? */ comment Parenthesis around the macro arguments Converted many signed variables into unsigned Saved an initialization

Since v1:
s/uint8_t/u8/g
Remove empty line
Removed #gpio-cells
Added select REGMAP_I2C
Sorted #includes into alphabetic order
Added missing MODULE_DEVICE_TABLE(of, ...)
Check return value of regmap_write()
Simplified tlc59116_set_mode()

Andrew Lunn (2):
leds: tlc59116: Document binding for the TI 16 Channel i2c LED driver
leds: tlc59116: Driver for the TI 16 Channel i2c LED driver

 .../devicetree/bindings/leds/leds-tlc59116.txt     |  41 ++++
 drivers/leds/Kconfig                               |   7 +
 drivers/leds/Makefile                              |   1 +
 drivers/leds/leds-tlc59116.c                       | 253 +++++++++++++++++++++
 4 files changed, 302 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-tlc59116.txt
 create mode 100644 drivers/leds/leds-tlc59116.c
Signature · 1 line
2.1.3
#5 lore raw

v6 cover Driver for TI tlc591xx 8/16 Channel i2c LED driver

Quoted 11 lines · Andrew Lunn
Quoted 5 lines · Andrew Lunn

This patchset is a driver for the TI tlc59116 16 Channel i2c LED driver and tlc59108 8 Channel i2c LED driver. This driver is used on the Belkin WRT1900AC access point and the C code is derived from code Belkin contributed to OpenWRT. However it has been extensively re-written, and a device tree binding added to replace platform data.

Hi Bryan

Do you have any further comments on this driver? Are you likely to queue it up for the next merge window?

Hi Andrew,

You didn't comment anything on my and Peter's questions on v5 thread about this being a PWM driver.

Tomi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150209/d8e8263b/attachment.sig>

#6 lore raw

v6 cover Driver for TI tlc591xx 8/16 Channel i2c LED driver

Quoted 10 lines · Tomi Valkeinen
Quoted 9 lines · Andrew Lunn
Quoted 5 lines · Andrew Lunn

This patchset is a driver for the TI tlc59116 16 Channel i2c LED driver and tlc59108 8 Channel i2c LED driver. This driver is used on the Belkin WRT1900AC access point and the C code is derived from code Belkin contributed to OpenWRT. However it has been extensively re-written, and a device tree binding added to replace platform data.

Hi Bryan

Quoted 7 lines
Quoted 2 lines

Do you have any further comments on this driver? Are you likely to queue it up for the next merge window?

Hi Andrew,

You didn't comment anything on my and Peter's questions on v5 thread about this being a PWM driver.

Hi Tomi

I don't comment, because it is not our decision to make any more. We have been around this argument many times, so we are not going to resolve it. The LED and PWM maintainers need to decide, not us.

Andrew

#7 lore raw

v6 cover Driver for TI tlc591xx 8/16 Channel i2c LED driver

Quoted 16 lines · Andrew Lunn
Quoted 15 lines · Tomi Valkeinen
Quoted 11 lines · Andrew Lunn
Quoted 5 lines · Andrew Lunn

This patchset is a driver for the TI tlc59116 16 Channel i2c LED driver and tlc59108 8 Channel i2c LED driver. This driver is used on the Belkin WRT1900AC access point and the C code is derived from code Belkin contributed to OpenWRT. However it has been extensively re-written, and a device tree binding added to replace platform data.

Hi Bryan

Do you have any further comments on this driver? Are you likely to queue it up for the next merge window?

Hi Andrew,

Quoted 8 lines
Quoted 2 lines

You didn't comment anything on my and Peter's questions on v5 thread about this being a PWM driver.

Hi Tomi

I don't comment, because it is not our decision to make any more. We have been around this argument many times, so we are not going to resolve it. The LED and PWM maintainers need to decide, not us.

Well, I wasn't asking for decisions. I asked what are the technical differences between the options. If this driver would be implemented as a PWM driver, and you'd use pwm-leds, how would that affect your use case?

If I'm not mistaken, the only argument so far you've given was that the device cannot implement the pwm_config() call correctly, but Peter argued that it doesn't matter, other PWM devices cannot do that either.

I want the driver to work for all the users, and as I'm not that familiar with leds and pwms I need to ask these questions.

Tomi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150209/fad2fcb2/attachment.sig>