Skip to contentSkip to conversation

dt: bindings: lm3601x: Introduce the lm3601x driver

PATCH Superseded Dan Murphy 2 participants 3 messages May 7, 2018 – May 8, 2018

Subsystems (2)

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

PATCH 1/2 dt: bindings: lm3601x: Introduce the lm3601x driver

Introduce the device tree bindings for the lm3601x family of LED torch, flash and IR drivers.

---
 .../devicetree/bindings/leds/leds-lm3601x.txt | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-lm3601x.txt
Documentation/devicetree/bindings/leds/leds-lm3601x.txt new file +51 -0
new file mode 100644
index 000000000000..38cdabf6ca7e
@@ -0,0 +1,51 @@
+* Texas Instruments - lm3601x Single-LED Flash Driver
+
+The LM3601X are ultra-small LED flash drivers that
+provides a high level of adjustability.
+
+Required properties:
+	- compatible : Can be one of the following
+		"ti,lm3601x"
+		"ti,lm36010"
+		"ti,lm36011"
+	- reg : I2C slave address
+	- #address-cells : 1
+	- #size-cells : 0
+
+Required child properties:
+	- reg : 0 - Indicates to support and register a torch interface
+		1 - Indicates to support and register a strobe interface
+		2 - Indicates to support and register an ir interface
+
+Optional child properties:
+	- label : see Documentation/devicetree/bindings/leds/common.txt
+
+Example:
+led-controller@64 {
+	compatible = "ti,lm3601x";
+	#address-cells = <1>;
+	#size-cells = <0>;
+	reg = <0x64>;
+
+	led@0 {
+		reg = <0>;
+		label = "white:torch";
+		led-max-microamp=<10000>;
+	};
+
+	led@1 {
+		reg = <1>;
+		label = "white:strobe";
+		flash-max-microamp=<10000>;
+		flash-max-timeout-us=<800>;
+	};
+
+	led@2 {
+		reg = <2>;
+		label = "invisible:ir";
+	};
+}
+
+For more product information please see the links below:
+http://www.ti.com/product/LM36010
+http://www.ti.com/product/LM36011
Signature · 1 line
2.17.0.252.gfe0a9eaf3
author
#1 lore raw

PATCH 2/2 leds: lm3601x: Introduce the lm3601x LED driver

Introduce the family of LED devices that can
drive a torch, strobe or IR LED.

The LED driver can be configured with a strobe
timer to execute a strobe flash. The IR LED
brightness is controlled via the torch brightness
register.

The data sheet for each the LM36010 and LM36011
LED drivers can be found here:
http://www.ti.com/product/LM36010
http://www.ti.com/product/LM36011

---
 drivers/leds/Kconfig        |   9 +
 drivers/leds/Makefile       |   1 +
 drivers/leds/leds-lm3601x.c | 593 ++++++++++++++++++++++++++++++++++++
 3 files changed, 603 insertions(+)
 create mode 100644 drivers/leds/leds-lm3601x.c
drivers/leds/Kconfig +9 -0
index 2c896c0e69e1..50ae536f343f 100644
@@ -145,6 +145,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 && OF
+	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
drivers/leds/Makefile +1 -0
index 91eca81cae82..b79807fe1b67 100644
@@ -76,6 +76,7 @@ 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_LM3601X)		+= leds-lm3601x.o
 
 # LED SPI Drivers
 obj-$(CONFIG_LEDS_DAC124S085)		+= leds-dac124s085.o
drivers/leds/leds-lm3601x.c new file +593 -0

593 lines not on this page · raw message

Signature · 1 line
2.17.0.252.gfe0a9eaf3
#2 lore raw

Re: [PATCH 2/2] leds: lm3601x: Introduce the lm3601x LED driver

Thank you for the patch! Perhaps something to improve:

Hi Dan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.17-rc4 next-20180507]
[cannot apply to j.anaszewski-leds/for-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Dan-Murphy/dt-bindings-lm3601x-Introduce-the-lm3601x-driver/20180508-074439
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.2.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=ia64

All warnings (new ones prefixed by >>):

In file included from drivers/leds/leds-lm3601x.c:13:0:
drivers/leds/leds-lm3601x.c: In function 'lm3601x_strobe_brightness_set':

>> drivers/leds/leds-lm3601x.c:272:6: warning: large integer implicitly truncated to unsigned type [-Woverflow]
         ~LM3601X_MODE_STROBE, LED_OFF);
         ^

include/linux/regmap.h:76:36: note: in definition of macro 'regmap_update_bits'
regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
^~~~

vim +272 drivers/leds/leds-lm3601x.c

258
259 static int lm3601x_strobe_brightness_set(struct led_classdev *cdev,
260 enum led_brightness brightness)
261 {
262 struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(cdev);
263 struct lm3601x_led *led = fled_cdev_to_led(fled_cdev);
264 int ret;
265 u8 brightness_val;
266
267 mutex_lock(&led->lock);
268 ret = lm3601x_read_faults(led);
269
270 if (brightness == LED_OFF) {
271 ret = regmap_update_bits(led->regmap, LM3601X_ENABLE_REG,

 > 272						~LM3601X_MODE_STROBE, LED_OFF);

273 goto out;
274 }
275
276 if (brightness == LED_ON)
277 brightness_val = LED_ON;
278 else
279 brightness_val = (brightness/2);
280
281 ret = regmap_write(led->regmap, LM3601X_LED_FLASH_REG, brightness_val);
282
283 out:
284 mutex_unlock(&led->lock);
285 return ret;
286 }
287

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation