Skip to contentSkip to conversation

leds: add TI LMU backlight driver

PATCH In review Dan Murphy 4 participants 30 messages Oct 23, 2018 – Mar 4, 2019

Subsystems (3)
lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

PATCH v4 1/7 leds: add TI LMU backlight driver

From: Pavel Machek <[email protected]>

This adds backlight support for the following TI LMU
chips: LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.

It controls LEDs on Droid 4
smartphone, including keyboard and screen backlights.

[add LED subsystem support for keyboard backlight and rework DT binding according to Rob Herrings feedback]

[remove backlight subsystem support for now]
---
 drivers/leds/Kconfig              |   8 ++
 drivers/leds/Makefile             |   1 +
 drivers/leds/ti-lmu-led-common.c  | 138 ++++++++++++++++++++++++++++++
 include/linux/ti-lmu-led-common.h |  59 +++++++++++++
 4 files changed, 206 insertions(+)
 create mode 100644 drivers/leds/ti-lmu-led-common.c
 create mode 100644 include/linux/ti-lmu-led-common.h
drivers/leds/Kconfig +8 -0
index 44097a3e0fcc..dc717b30d9d3 100644
@@ -756,6 +756,14 @@ config LEDS_NIC78BX
 	  To compile this driver as a module, choose M here: the module
 	  will be called leds-nic78bx.
 
+config LEDS_TI_LMU_COMMON
+	tristate "LED driver for TI LMU"
+	depends on REGMAP
+	help
+          Say Y to enable the LED driver for TI LMU devices.
+          This supports common features between the TI LM3532, LM3631, LM3632,
+	  LM3633, LM3695 and LM3697.
+
 comment "LED Triggers"
 source "drivers/leds/trigger/Kconfig"
 
drivers/leds/Makefile +1 -0
index 420b5d2cfa62..e09bb27bc7ea 100644
@@ -78,6 +78,7 @@ 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
+obj-$(CONFIG_LEDS_TI_LMU_COMMON)	+= ti-lmu-led-common.o
 
 # LED SPI Drivers
 obj-$(CONFIG_LEDS_CR0014114)		+= leds-cr0014114.o
drivers/leds/ti-lmu-led-common.c new file +138 -0

138 lines not on this page · raw message

include/linux/ti-lmu-led-common.h new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
2.19.0
author
#1 lore raw

PATCH v4 2/7 dt-bindings: ti-lmu: Modify dt bindings for the LM3697

The LM3697 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp features and those can be accomodated by a TI LMU framework.

The LM3697 dt binding needs to be moved from the ti-lmu.txt and a dedicated LED dt binding needs to be added. The new LM3697 LED dt binding will then reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

---

v4 - Squashed removal and addition of the dt bindings into a single patch - https://lore.kernel.org/patchwork/patch/998703/

 .../devicetree/bindings/leds/leds-lm3697.txt  | 98 +++++++++++++++++++
 .../devicetree/bindings/mfd/ti-lmu.txt        | 26 +----
 2 files changed, 99 insertions(+), 25 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-lm3697.txt
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +98 -0
new file mode 100644
index 000000000000..4bb2ed51025b
@@ -0,0 +1,98 @@
+* Texas Instruments - LM3697 Highly Efficient White LED Driver
+
+The LM3697 11-bit LED driver provides high-
+performance backlight dimming for 1, 2, or 3 series
+LED strings while delivering up to 90% efficiency.
+
+This device is suitable for display and keypad Lighting
+
+Required properties:
+	- compatible:
+		"ti,lm3697"
+	- reg :  I2C slave address
+	- #address-cells : 1
+	- #size-cells : 0
+
+Optional properties:
+	- enable-gpios : GPIO pin to enable/disable the device
+	- vled-supply : LED supply
+
+Required child properties:
+	- reg : 0 - LED is Controlled by bank A
+		1 - LED is Controlled by bank B
+	- led-sources : Indicates which HVLED string is associated to which
+			control bank.  Each element in the array is associated
+			with a specific HVLED string.  Element 0 is HVLED1,
+			element 1 is HVLED2 and element 2 HVLED3.
+			Additional information is contained
+			in Documentation/devicetree/bindings/leds/common.txt
+			0 - HVLED is not active in this control bank
+			1 - HVLED string is controlled by this control bank
+
+Optional child properties:
+	- runtime-ramp-up-msec: Current ramping from one brightness level to
+				the a higher brightness level.
+				Range from 2048 us - 117.44 s
+	- runtime-ramp-down-msec: Current ramping from one brightness level to
+				  the a lower brightness level.
+				  Range from 2048 us - 117.44 s
+	- label : see Documentation/devicetree/bindings/leds/common.txt
+	- linux,default-trigger :
+	   see Documentation/devicetree/bindings/leds/common.txt
+
+Example:
+
+HVLED string 1 and 3 are controlled by control bank A and HVLED 2 string is
+controlled by control bank B.
+
+led-controller@36 {
+	compatible = "ti,lm3697";
+	reg = <0x36>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
+	vled-supply = <&vbatt>;
+
+	led@0 {
+		reg = <0>;
+		led-sources = <1 0 1>;
+		runtime-ramp-up-msec = <5000>;
+		runtime-ramp-down-msec = <1000>;
+		label = "white:first_backlight_cluster";
+		linux,default-trigger = "backlight";
+	};
+
+	led@1 {
+		reg = <1>;
+		led-sources = <0 1 0>;
+		runtime-ramp-up-msec = <500>;
+		runtime-ramp-down-msec = <1000>;
+		label = "white:second_backlight_cluster";
+		linux,default-trigger = "backlight";
+	};
+}
+
+All HVLED strings controlled by control bank A
+
+led-controller@36 {
+	compatible = "ti,lm3697";
+	reg = <0x36>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
+	vled-supply = <&vbatt>;
+
+	led@0 {
+		reg = <0>;
+		led-sources = <1 1 1>;
+		runtime-ramp-up-msec = <500>;
+		runtime-ramp-down-msec = <1000>;
+		label = "white:backlight_cluster";
+		linux,default-trigger = "backlight";
+	};
+}
+
+For more product information please see the link below:
+http://www.ti.com/lit/ds/symlink/lm3697.pdf
Documentation/devicetree/bindings/mfd/ti-lmu.txt +1 -25
index c885cf89b8ce..920f910be4e9 100644
@@ -9,7 +9,6 @@ TI LMU driver supports lighting devices below.
   LM3632       Backlight and regulator
   LM3633       Backlight, LED and fault monitor
   LM3695       Backlight
-  LM3697       Backlight and fault monitor
 
 Required properties:
   - compatible: Should be one of:
@@ -18,11 +17,10 @@ Required properties:
                 "ti,lm3632"
                 "ti,lm3633"
                 "ti,lm3695"
-                "ti,lm3697"
   - reg: I2C slave address.
          0x11 for LM3632
          0x29 for LM3631
-         0x36 for LM3633, LM3697
+         0x36 for LM3633
          0x38 for LM3532
          0x63 for LM3695
 
@@ -38,7 +36,6 @@ Optional nodes:
     Required properties:
       - compatible: Should be one of:
                     "ti,lm3633-fault-monitor"
-                    "ti,lm3697-fault-monitor"
   - leds: LED properties for LM3633. Please refer to [2].
   - regulators: Regulator properties for LM3631 and LM3632.
                 Please refer to [3].
@@ -220,24 +217,3 @@ lm3695@63 {
 		};
 	};
 };
-
-lm3697@36 {
-	compatible = "ti,lm3697";
-	reg = <0x36>;
-
-	enable-gpios = <&pioC 2 GPIO_ACTIVE_HIGH>;
-
-	backlight {
-		compatible = "ti,lm3697-backlight";
-
-		lcd {
-			led-sources = <0 1 2>;
-			ramp-up-msec = <200>;
-			ramp-down-msec = <200>;
-		};
-	};
-
-	fault-monitor {
-		compatible = "ti,lm3697-fault-monitor";
-	};
-};
Signature · 1 line
2.19.0
#2 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

Hi!

Quoted 3 lines

The LM3697 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp

So it is single function LED driver. That does not mean it can not share bindings with the rest. Where the bindings live is not imporant.

Quoted 2 lines

reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

What you forgot to tell us in the changelog:

Documentation/devicetree/bindings/leds/leds-lm3697.txt line 35

Quoted 4 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +4 -0
+Optional child properties:
+	- runtime-ramp-up-msec: Current ramping from one brightness level to
+				the a higher brightness level.
+				Range from 2048 us - 117.44 s

The other binding uses "ramp-up-msec". Tell us why you are changing this, or better don't change things needlessly.

We don't want to be using "runtime-ramp-up-msec" for one device and "ramp-up-msec" for the other.

I'm not sure what other changes you did, and changelog does not tell me.

Documentation/devicetree/bindings/mfd/ti-lmu.txt TI LMU driver supports lighting devices below. · line 14

Quoted 10 lines
Documentation/devicetree/bindings/mfd/ti-lmu.txt +0 -1
@@ -9,7 +9,6 @@ TI LMU driver supports lighting devices below.
   LM3632       Backlight and regulator
   LM3633       Backlight, LED and fault monitor
   LM3695       Backlight
-  LM3697       Backlight and fault monitor
 
 Required properties:
   - compatible: Should be one of:

NAK. You can use existing binding.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
author
#3 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

Pavel

Quoted 9 lines · Pavel Machek

Hi!

Quoted 3 lines

The LM3697 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp

So it is single function LED driver. That does not mean it can not share bindings with the rest. Where the bindings live is not imporant.

It can share bindings that are correctly done, not ones that are incomplete and incorrect.

Where bindings live is important to new Linux kernel developers and product developers looking for the proper documentation on the H/W bindings.

Quoted 4 lines
Quoted 2 lines

reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

What you forgot to tell us in the changelog:

I can add this to the changelog.

Quoted 11 lines

Documentation/devicetree/bindings/leds/leds-lm3697.txt line 35

Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +4 -0
+Optional child properties:
+	- runtime-ramp-up-msec: Current ramping from one brightness level to
+				the a higher brightness level.
+				Range from 2048 us - 117.44 s

The other binding uses "ramp-up-msec". Tell us why you are changing this, or better don't change things needlessly.

We don't want to be using "runtime-ramp-up-msec" for one device and "ramp-up-msec" for the other.

This is another example of how the original bindings were incorrect and misleading.

The LM3697 have 2 ramp implementations that can be used.

Startup/Shutdown ramp and Runtime Ramp. Same Ramp rates different registers and different end user experience.

So having a single node call ramp-up-msec is misleading and it does not indicate what the H/W will do.

Quoted 12 lines

I'm not sure what other changes you did, and changelog does not tell me.

Quoted 8 lines
Documentation/devicetree/bindings/mfd/ti-lmu.txt +0 -1
@@ -9,7 +9,6 @@ TI LMU driver supports lighting devices below.
   LM3632       Backlight and regulator
   LM3633       Backlight, LED and fault monitor
   LM3695       Backlight
-  LM3697       Backlight and fault monitor
 
Quoted 4 lines

Documentation/devicetree/bindings/mfd/ti-lmu.txt TI LMU driver supports lighting devices below. · line 14

Quoted 2 lines
Documentation/devicetree/bindings/mfd/ti-lmu.txt +0 -0
 Required properties:
   - compatible: Should be one of:

NAK. You can use existing binding.

Thank you for the consistency

Dan

Quoted 3 lines

Pavel

Signature · 2 lines
------------------
Dan Murphy
#4 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

Hi!

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

The LM3697 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp

So it is single function LED driver. That does not mean it can not share bindings with the rest. Where the bindings live is not imporant.

It can share bindings that are correctly done, not ones that are incomplete and incorrect.

If you see wrong binding you are welcome to fix it. If it is in wrong place, you can move it around.

You are not welcome to create 2 "fixed" versions, while leaving original "buggy" version in tree!

...but that's what your series does. Better changelogs will _not_ help.

Quoted 2 lines

Where bindings live is important to new Linux kernel developers and product developers looking for the proper documentation on the H/W bindings.

We have talked about this before.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/mfd/ti-lmu.txt +0 -1
@@ -9,7 +9,6 @@ TI LMU driver supports lighting devices below.
   LM3632       Backlight and regulator
   LM3633       Backlight, LED and fault monitor
   LM3695       Backlight
-  LM3697       Backlight and fault monitor
 
Quoted 6 lines
Quoted 4 lines

Review TI LMU driver supports lighting devices below. · line 14

Quoted 2 lines
(quoted diff) +0 -0
 Required properties:
   - compatible: Should be one of:

NAK. You can use existing binding.

Thank you for the consistency

You are wasting your time. What is worse, you are wasting my time, too, and time of people on the list.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
maintainer
#5 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

In reply to Dan Murphy
Quoted 39 lines · Dan Murphy

Pavel

Quoted 9 lines · Pavel Machek

Hi!

Quoted 3 lines

The LM3697 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp

So it is single function LED driver. That does not mean it can not share bindings with the rest. Where the bindings live is not imporant.

It can share bindings that are correctly done, not ones that are incomplete and incorrect.

Where bindings live is important to new Linux kernel developers and product developers looking for the proper documentation on the H/W bindings.

Quoted 4 lines
Quoted 2 lines

reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

What you forgot to tell us in the changelog:

I can add this to the changelog.

Quoted 11 lines

Documentation/devicetree/bindings/leds/leds-lm3697.txt line 35

Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +4 -0
+Optional child properties:
+	- runtime-ramp-up-msec: Current ramping from one brightness level to
+				the a higher brightness level.
+				Range from 2048 us - 117.44 s

The other binding uses "ramp-up-msec". Tell us why you are changing this, or better don't change things needlessly.

We don't want to be using "runtime-ramp-up-msec" for one device and "ramp-up-msec" for the other.

This is another example of how the original bindings were incorrect and misleading.

Quoted 7 lines

The LM3697 have 2 ramp implementations that can be used.

Startup/Shutdown ramp and Runtime Ramp. Same Ramp rates different registers and different end user experience.

So having a single node call ramp-up-msec is misleading and it does not indicate what the H/W will do.

The existing ones aren't documented (present in the example is not documented). This seems like something that should be common rather than TI specific. Though it also seems more like something the user would want to control (i.e. sysfs) rather than fixed in DT.

Rob

author
#6 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

Rob

Quoted 45 lines · Rob Herring
Quoted 44 lines · Dan Murphy

Pavel

Quoted 9 lines · Pavel Machek

Hi!

Quoted 3 lines

The LM3697 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp

So it is single function LED driver. That does not mean it can not share bindings with the rest. Where the bindings live is not imporant.

It can share bindings that are correctly done, not ones that are incomplete and incorrect.

Where bindings live is important to new Linux kernel developers and product developers looking for the proper documentation on the H/W bindings.

Quoted 4 lines
Quoted 2 lines

reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

What you forgot to tell us in the changelog:

I can add this to the changelog.

Quoted 11 lines

Documentation/devicetree/bindings/leds/leds-lm3697.txt line 35

Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +4 -0
+Optional child properties:
+	- runtime-ramp-up-msec: Current ramping from one brightness level to
+				the a higher brightness level.
+				Range from 2048 us - 117.44 s

The other binding uses "ramp-up-msec". Tell us why you are changing this, or better don't change things needlessly.

We don't want to be using "runtime-ramp-up-msec" for one device and "ramp-up-msec" for the other.

This is another example of how the original bindings were incorrect and misleading.

The LM3697 have 2 ramp implementations that can be used.

Startup/Shutdown ramp and Runtime Ramp. Same Ramp rates different registers and different end user experience.

Quoted 8 lines
Quoted 2 lines

So having a single node call ramp-up-msec is misleading and it does not indicate what the H/W will do.

The existing ones aren't documented (present in the example is not documented). This seems like something that should be common rather than TI specific. Though it also seems more like something the user would want to control (i.e. sysfs) rather than fixed in DT.

Changing the runtime ramping or startup/shutdown ramping could also be done via sysfs. I am not dedicated to having it in the DT file I was following prior art.

Jacek

Do you have an opinion on this?

Dan

Quoted 2 lines

Rob

Signature · 2 lines
------------------
Dan Murphy
#7 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

Quoted 57 lines · Dan Murphy

Rob

Quoted 45 lines · Rob Herring
Quoted 44 lines · Dan Murphy

Pavel

Quoted 9 lines · Pavel Machek

Hi!

Quoted 3 lines

The LM3697 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp

So it is single function LED driver. That does not mean it can not share bindings with the rest. Where the bindings live is not imporant.

It can share bindings that are correctly done, not ones that are incomplete and incorrect.

Where bindings live is important to new Linux kernel developers and product developers looking for the proper documentation on the H/W bindings.

Quoted 4 lines
Quoted 2 lines

reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

What you forgot to tell us in the changelog:

I can add this to the changelog.

Quoted 11 lines

Documentation/devicetree/bindings/leds/leds-lm3697.txt line 35

Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +4 -0
+Optional child properties:
+	- runtime-ramp-up-msec: Current ramping from one brightness level to
+				the a higher brightness level.
+				Range from 2048 us - 117.44 s

The other binding uses "ramp-up-msec". Tell us why you are changing this, or better don't change things needlessly.

We don't want to be using "runtime-ramp-up-msec" for one device and "ramp-up-msec" for the other.

This is another example of how the original bindings were incorrect and misleading.

The LM3697 have 2 ramp implementations that can be used.

Startup/Shutdown ramp and Runtime Ramp. Same Ramp rates different registers and different end user experience.

Quoted 8 lines
Quoted 2 lines

So having a single node call ramp-up-msec is misleading and it does not indicate what the H/W will do.

The existing ones aren't documented (present in the example is not documented). This seems like something that should be common rather than TI specific. Though it also seems more like something the user would want to control (i.e. sysfs) rather than fixed in DT.

Quoted 6 lines

Changing the runtime ramping or startup/shutdown ramping could also be done via sysfs. I am not dedicated to having it in the DT file I was following prior art.

Jacek

Do you have an opinion on this?

This is this problem with the Device Tree's scope of responsibility. It is defined as a means for "describing the hardware", but often this rule is abused by the properties that fall into "configuration" category. E.g. default-state, retain-state-suspended from leds-gpio.txt or linux-default-trigger from common LED bindings.

In some cases this is justified. The question is whether it is something that necessarily needs to be configured on driver probing? If not, then I'd go for sysfs interface.

Signature · 2 lines
Best regards,
Jacek Anaszewski
author
#8 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

Jacek

Quoted 71 lines · Jacek Anaszewski
Quoted 57 lines · Dan Murphy

Rob

Quoted 45 lines · Rob Herring
Quoted 44 lines · Dan Murphy

Pavel

Quoted 9 lines · Pavel Machek

Hi!

Quoted 3 lines

The LM3697 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp

So it is single function LED driver. That does not mean it can not share bindings with the rest. Where the bindings live is not imporant.

It can share bindings that are correctly done, not ones that are incomplete and incorrect.

Where bindings live is important to new Linux kernel developers and product developers looking for the proper documentation on the H/W bindings.

Quoted 4 lines
Quoted 2 lines

reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

What you forgot to tell us in the changelog:

I can add this to the changelog.

Quoted 11 lines

Documentation/devicetree/bindings/leds/leds-lm3697.txt line 35

Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +4 -0
+Optional child properties:
+	- runtime-ramp-up-msec: Current ramping from one brightness level to
+				the a higher brightness level.
+				Range from 2048 us - 117.44 s

The other binding uses "ramp-up-msec". Tell us why you are changing this, or better don't change things needlessly.

We don't want to be using "runtime-ramp-up-msec" for one device and "ramp-up-msec" for the other.

This is another example of how the original bindings were incorrect and misleading.

The LM3697 have 2 ramp implementations that can be used.

Startup/Shutdown ramp and Runtime Ramp. Same Ramp rates different registers and different end user experience.

Quoted 8 lines
Quoted 2 lines

So having a single node call ramp-up-msec is misleading and it does not indicate what the H/W will do.

The existing ones aren't documented (present in the example is not documented). This seems like something that should be common rather than TI specific. Though it also seems more like something the user would want to control (i.e. sysfs) rather than fixed in DT.

Quoted 6 lines

Changing the runtime ramping or startup/shutdown ramping could also be done via sysfs. I am not dedicated to having it in the DT file I was following prior art.

Jacek

Do you have an opinion on this?

This is this problem with the Device Tree's scope of responsibility. It is defined as a means for "describing the hardware", but often this rule is abused by the properties that fall into "configuration" category. E.g. default-state, retain-state-suspended from leds-gpio.txt or linux-default-trigger from common LED bindings.

Quoted 4 lines

In some cases this is justified. The question is whether it is something that necessarily needs to be configured on driver probing? If not, then I'd go for sysfs interface.

Appreciate the feedback. I think you and Rob are right. This should be a sysfs entry. I can think of instances where the ramp times might want to be modified or even turned off.

I will change that implementation.

Dan

Signature · 2 lines
------------------
Dan Murphy
maintainer
#9 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

In reply to Jacek Anaszewski
Quoted 71 lines · Jacek Anaszewski
Quoted 57 lines · Dan Murphy

Rob

Quoted 45 lines · Rob Herring
Quoted 44 lines · Dan Murphy

Pavel

Quoted 9 lines · Pavel Machek

Hi!

Quoted 3 lines

The LM3697 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp

So it is single function LED driver. That does not mean it can not share bindings with the rest. Where the bindings live is not imporant.

It can share bindings that are correctly done, not ones that are incomplete and incorrect.

Where bindings live is important to new Linux kernel developers and product developers looking for the proper documentation on the H/W bindings.

Quoted 4 lines
Quoted 2 lines

reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

What you forgot to tell us in the changelog:

I can add this to the changelog.

Quoted 11 lines

Documentation/devicetree/bindings/leds/leds-lm3697.txt line 35

Quoted 5 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +4 -0
+Optional child properties:
+	- runtime-ramp-up-msec: Current ramping from one brightness level to
+				the a higher brightness level.
+				Range from 2048 us - 117.44 s

The other binding uses "ramp-up-msec". Tell us why you are changing this, or better don't change things needlessly.

We don't want to be using "runtime-ramp-up-msec" for one device and "ramp-up-msec" for the other.

This is another example of how the original bindings were incorrect and misleading.

The LM3697 have 2 ramp implementations that can be used.

Startup/Shutdown ramp and Runtime Ramp. Same Ramp rates different registers and different end user experience.

Quoted 8 lines
Quoted 2 lines

So having a single node call ramp-up-msec is misleading and it does not indicate what the H/W will do.

The existing ones aren't documented (present in the example is not documented). This seems like something that should be common rather than TI specific. Though it also seems more like something the user would want to control (i.e. sysfs) rather than fixed in DT.

Quoted 6 lines

Changing the runtime ramping or startup/shutdown ramping could also be done via sysfs. I am not dedicated to having it in the DT file I was following prior art.

Jacek

Do you have an opinion on this?

This is this problem with the Device Tree's scope of responsibility. It is defined as a means for "describing the hardware", but often this rule is abused by the properties that fall into "configuration" category. E.g. default-state, retain-state-suspended from leds-gpio.txt or linux-default-trigger from common LED bindings.

Quoted 3 lines

In some cases this is justified. The question is whether it is something that necessarily needs to be configured on driver probing? If not, then I'd go for sysfs interface.

Yes. I'd also add it should be along the lines of for a given board it's always configured in that way or is it something you'd want in the BIOS of your PC.

Rob

#10 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

In reply to Jacek Anaszewski

Hi!

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Documentation/devicetree/bindings/leds/leds-lm3697.txt line 35

Quoted 4 lines
Documentation/devicetree/bindings/leds/leds-lm3697.txt new file +4 -0
+Optional child properties:
+	- runtime-ramp-up-msec: Current ramping from one brightness level to
+				the a higher brightness level.
+				Range from 2048 us - 117.44 s

This is this problem with the Device Tree's scope of responsibility. It is defined as a means for "describing the hardware", but often this rule is abused by the properties that fall into "configuration" category. E.g. default-state, retain-state-suspended from leds-gpio.txt or linux-default-trigger from common LED bindings.

I always assumed that ramp-up time is there because hardware (power supply?) can not handle "too fast" switching. Missing capacitors or something. If so, this needs to be in device tree.

If not, it indeed does not belong to device tree.

Quoted 3 lines

In some cases this is justified. The question is whether it is something that necessarily needs to be configured on driver probing? If not, then I'd go for sysfs interface.

While this would be useful for hardware accelerated patterns, I doubt we want to make it configurable without that support.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#11 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

In reply to Jacek Anaszewski

Hi!

Quoted 7 lines
Quoted 1 line

Do you have an opinion on this?

This is this problem with the Device Tree's scope of responsibility. It is defined as a means for "describing the hardware", but often this rule is abused by the properties that fall into "configuration" category. E.g. default-state, retain-state-suspended from leds-gpio.txt or linux-default-trigger from common LED bindings.

"retain-state-suspended" is actually hardware property. On PCs, (most?) LEDs will go off in suspend. On android phones, LEDs stay on while suspended.

"linux-default-trigger" is actually kind-of hardware property, too. If LED has an icon near it (or on it), you want to use that LED in that meaning.

(Thinkpad X60 has "wifi", "bluetooth", "numlock", "capslock", "hdd", "power", "battery", "ac" and "sleep" leds. Surely we should use them in that meaning?)

Now, if someone has leds labeled "user 1..user 4" and uses "linux-default-trigger" there, that is kind of "more interesting".

"default-state" is similar (subset of "linux-default-trigger"); you don't want power LED to go off during kernel boot...

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
author
#12 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

All

Quoted 22 lines · Pavel Machek

Hi!

Quoted 7 lines
Quoted 1 line

Do you have an opinion on this?

This is this problem with the Device Tree's scope of responsibility. It is defined as a means for "describing the hardware", but often this rule is abused by the properties that fall into "configuration" category. E.g. default-state, retain-state-suspended from leds-gpio.txt or linux-default-trigger from common LED bindings.

"retain-state-suspended" is actually hardware property. On PCs, (most?) LEDs will go off in suspend. On android phones, LEDs stay on while suspended.

"linux-default-trigger" is actually kind-of hardware property, too. If LED has an icon near it (or on it), you want to use that LED in that meaning.

(Thinkpad X60 has "wifi", "bluetooth", "numlock", "capslock", "hdd", "power", "battery", "ac" and "sleep" leds. Surely we should use them in that meaning?)

Quoted 5 lines

Now, if someone has leds labeled "user 1..user 4" and uses "linux-default-trigger" there, that is kind of "more interesting".

"default-state" is similar (subset of "linux-default-trigger"); you don't want power LED to go off during kernel boot...

I just want to follow up here and let you know that I have not abandoned this. I am trying to rework and fix up the ti lmu binding as asked by Pavel. Its proving to be a bit of a challenge based on looking forward to what will be the implementation.

I also did go offline and speak with Tony. I have a Droid 4 so I can test all of this on production hardware as well.

Updated patchset will take some time to get out.

Dan

Quoted 3 lines

Pavel

Signature · 2 lines
------------------
Dan Murphy
#13 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

Hi!

Quoted 8 lines

I just want to follow up here and let you know that I have not abandoned this. I am trying to rework and fix up the ti lmu binding as asked by Pavel. Its proving to be a bit of a challenge based on looking forward to what will be the implementation.

I also did go offline and speak with Tony. I have a Droid 4 so I can test all of this on production hardware as well.

Updated patchset will take some time to get out.

Is there any progress here?

This is needed for display on Droid 4, so it is somehow important... and Milo Kim's patches are pretty reasonable.

I still believe best way forward is to merge them, and let you submit any improvements on top of them...

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
author
#14 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

Pavel

Quoted 11 lines · Pavel Machek

Hi!

Quoted 8 lines

I just want to follow up here and let you know that I have not abandoned this. I am trying to rework and fix up the ti lmu binding as asked by Pavel. Its proving to be a bit of a challenge based on looking forward to what will be the implementation.

I also did go offline and speak with Tony. I have a Droid 4 so I can test all of this on production hardware as well.

Updated patchset will take some time to get out.

Quoted 8 lines

Is there any progress here?

This is needed for display on Droid 4, so it is somehow important... and Milo Kim's patches are pretty reasonable.

I still believe best way forward is to merge them, and let you submit any improvements on top of them...

I had looked at this a while back. And I will pick this up again as it seems that the multi color framework will take longer than expected.

For the Droid 4 it uses the lm3552 backlight driver, at least that is what is in the DT.

There is a lm3530 backlight driver that is already available and could be upgraded to DT support and have the lm3552 added to it but the issues are the 3532 has 3 outputs and the 3530 has 1 and the register map is a bit different.

There are register differences between the two devices but the driver already has ramp support, PWM support (exponential/linear), ALS support and manual support already available along with user space configuration.

I was working on creating a new lm3532 driver based off the lm3530 driver or adapting the 3530 to include the 3532 and making the driver generic to this family.

Dan

Quoted 3 lines

Best regards,
Pavel

Signature · 2 lines
------------------
Dan Murphy
maintainer
#15 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

In reply to Dan Murphy
Quoted 10 lines · Dan Murphy

The LM3697 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp features and those can be accomodated by a TI LMU framework.

The LM3697 dt binding needs to be moved from the ti-lmu.txt and a dedicated LED dt binding needs to be added. The new LM3697 LED dt binding will then reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

Quoted 4 lines

---

v4 - Squashed removal and addition of the dt bindings into a single patch - https://lore.kernel.org/patchwork/patch/998703/

Still not really the sequence I'd like to see and what I think would help the discussion move along.

Patch 1: move all the devices out of ti-lmu.txt into the grouping which makes sense. IOW, no functional changes. Probably only strict sub/supersets of each other should be shared.

Patch 2-N: Make binding changes. Then we discuss things like ramp time properties separately from binding structure.

Quoted 5 lines
 .../devicetree/bindings/leds/leds-lm3697.txt  | 98 +++++++++++++++++++
 .../devicetree/bindings/mfd/ti-lmu.txt        | 26 +----
 2 files changed, 99 insertions(+), 25 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-lm3697.txt
author
#16 lore raw

Re: [PATCH v4 2/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3697

Rob

Thanks

Quoted 19 lines · Rob Herring
Quoted 10 lines · Dan Murphy

The LM3697 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp features and those can be accomodated by a TI LMU framework.

The LM3697 dt binding needs to be moved from the ti-lmu.txt and a dedicated LED dt binding needs to be added. The new LM3697 LED dt binding will then reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

Quoted 4 lines

---

v4 - Squashed removal and addition of the dt bindings into a single patch - https://lore.kernel.org/patchwork/patch/998703/

Still not really the sequence I'd like to see and what I think would help the discussion move along.

Quoted 7 lines

Patch 1: move all the devices out of ti-lmu.txt into the grouping which makes sense. IOW, no functional changes. Probably only strict sub/supersets of each other should be shared.

Patch 2-N: Make binding changes. Then we discuss things like ramp time properties separately from binding structure.

OK I will re-work the patchset.

Dan

Quoted 5 lines
Quoted 5 lines
 .../devicetree/bindings/leds/leds-lm3697.txt  | 98 +++++++++++++++++++
 .../devicetree/bindings/mfd/ti-lmu.txt        | 26 +----
 2 files changed, 99 insertions(+), 25 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-lm3697.txt
Signature · 2 lines
------------------
Dan Murphy
author
#17 lore raw

PATCH v4 3/7 mfd: ti-lmu: Remove support for LM3697

In reply to Dan Murphy

Remove support for the LM3697 from the ti-lmu
driver in favor of a dedicated LED driver.

---
 drivers/leds/Kconfig                |  2 +-
 drivers/mfd/Kconfig                 |  2 +-
 drivers/mfd/ti-lmu.c                | 17 -----------
 include/linux/mfd/ti-lmu-register.h | 44 -----------------------------
 include/linux/mfd/ti-lmu.h          |  1 -
 5 files changed, 2 insertions(+), 64 deletions(-)
drivers/leds/Kconfig +1 -1
index dc717b30d9d3..853014dbb1c2 100644
@@ -762,7 +762,7 @@ config LEDS_TI_LMU_COMMON
 	help
           Say Y to enable the LED driver for TI LMU devices.
           This supports common features between the TI LM3532, LM3631, LM3632,
-	  LM3633, LM3695 and LM3697.
+	  LM3633, and LM3695.
 
 comment "LED Triggers"
 source "drivers/leds/trigger/Kconfig"
drivers/mfd/Kconfig +1 -1
index 11841f4b7b2b..9b04dd527c68 100644
@@ -1293,7 +1293,7 @@ config MFD_TI_LMU
 	help
 	  Say yes here to enable support for TI LMU chips.
 
-	  TI LMU MFD supports LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.
+	  TI LMU MFD supports LM3532, LM3631, LM3632, LM3633, and LM3695.
 	  It consists of backlight, LED and regulator driver.
 	  It provides consistent device controls for lighting functions.
 
drivers/mfd/ti-lmu.c +0 -17
index cfb411cde51c..b6bfa99a29dd 100644
@@ -128,20 +128,6 @@ static struct mfd_cell lm3695_devices[] = {
 	},
 };
 
-static struct mfd_cell lm3697_devices[] = {
-	{
-		.name          = "ti-lmu-backlight",
-		.id            = LM3697,
-		.of_compatible = "ti,lm3697-backlight",
-	},
-	/* Monitoring driver for open/short circuit detection */
-	{
-		.name          = "ti-lmu-fault-monitor",
-		.id            = LM3697,
-		.of_compatible = "ti,lm3697-fault-monitor",
-	},
-};
-
 #define TI_LMU_DATA(chip, max_reg)		\
 static const struct ti_lmu_data chip##_data =	\
 {						\
@@ -155,7 +141,6 @@ TI_LMU_DATA(lm3631, LM3631_MAX_REG);
 TI_LMU_DATA(lm3632, LM3632_MAX_REG);
 TI_LMU_DATA(lm3633, LM3633_MAX_REG);
 TI_LMU_DATA(lm3695, LM3695_MAX_REG);
-TI_LMU_DATA(lm3697, LM3697_MAX_REG);
 
 static const struct of_device_id ti_lmu_of_match[] = {
 	{ .compatible = "ti,lm3532", .data = &lm3532_data },
@@ -163,7 +148,6 @@ static const struct of_device_id ti_lmu_of_match[] = {
 	{ .compatible = "ti,lm3632", .data = &lm3632_data },
 	{ .compatible = "ti,lm3633", .data = &lm3633_data },
 	{ .compatible = "ti,lm3695", .data = &lm3695_data },
-	{ .compatible = "ti,lm3697", .data = &lm3697_data },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, ti_lmu_of_match);
@@ -237,7 +221,6 @@ static const struct i2c_device_id ti_lmu_ids[] = {
 	{ "lm3632", LM3632 },
 	{ "lm3633", LM3633 },
 	{ "lm3695", LM3695 },
-	{ "lm3697", LM3697 },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, ti_lmu_ids);
include/linux/mfd/ti-lmu-register.h +0 -44

48 lines not on this page · raw message

include/linux/mfd/ti-lmu.h +0 -1
index 09d5f30384e5..bc9272f08f47 100644
@@ -26,7 +26,6 @@ enum ti_lmu_id {
 	LM3632,
 	LM3633,
 	LM3695,
-	LM3697,
 	LMU_MAX_ID,
 };
 
Signature · 1 line
2.19.0
author
#18 lore raw

PATCH v4 4/7 leds: lm3697: Introduce the lm3697 driver

In reply to Dan Murphy

Introduce the lm3697 LED driver for
backlighting and display.

Datasheet location:
http://www.ti.com/lit/ds/symlink/lm3697.pdf

---
 drivers/leds/Kconfig       |   8 +-
 drivers/leds/Makefile      |   1 +
 drivers/leds/leds-lm3697.c | 381 +++++++++++++++++++++++++++++++++++++
 3 files changed, 389 insertions(+), 1 deletion(-)
 create mode 100644 drivers/leds/leds-lm3697.c
drivers/leds/Kconfig +7 -1
index 853014dbb1c2..7d9a98044be4 100644
@@ -756,9 +756,15 @@ config LEDS_NIC78BX
 	  To compile this driver as a module, choose M here: the module
 	  will be called leds-nic78bx.
 
+config LEDS_LM3697
+	tristate "LED driver for LM3697"
+ 	depends on LEDS_TI_LMU_COMMON
+	help
+          Say Y to enable the LED driver for TI LMU devices.
+          This supports the LED device LM3697.
+
 config LEDS_TI_LMU_COMMON
 	tristate "LED driver for TI LMU"
-	depends on REGMAP
 	help
           Say Y to enable the LED driver for TI LMU devices.
           This supports common features between the TI LM3532, LM3631, LM3632,
drivers/leds/Makefile +1 -0
index e09bb27bc7ea..6fbce7cfc41c 100644
@@ -78,6 +78,7 @@ 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
+obj-$(CONFIG_LEDS_LM3697)		+= leds-lm3697.o
 obj-$(CONFIG_LEDS_TI_LMU_COMMON)	+= ti-lmu-led-common.o
 
 # LED SPI Drivers
drivers/leds/leds-lm3697.c new file +381 -0

381 lines not on this page · raw message

Signature · 1 line
2.19.0
author
#19 lore raw

PATCH v4 5/7 dt-bindings: ti-lmu: Modify dt bindings for the LM3633

In reply to Dan Murphy

The LM3633 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp features and those can be accomodated by a TI LMU framework.

The LM3633 dt binding needs to be moved from the ti-lmu.txt and a dedicated LED dt binding needs to be added. The new LM3633 LED dt binding will then reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

---

v4 - Squashed removal and addition of the dt bindings into a single patch - https://lore.kernel.org/patchwork/patch/998703/

 .../devicetree/bindings/leds/leds-lm3633.txt  | 102 ++++++++++++++++++
 .../devicetree/bindings/mfd/ti-lmu.txt        |  48 ---------
 2 files changed, 102 insertions(+), 48 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-lm3633.txt
Documentation/devicetree/bindings/leds/leds-lm3633.txt new file +102 -0
new file mode 100644
index 000000000000..d791b891ea6e
@@ -0,0 +1,102 @@
+* Texas Instruments - LM3633 Lighting Power Solution for Smartphone Handsets
+
+The LM3633 is a complete power source for
+backlight, keypad, and indicator LEDs in smartphone
+handsets.
+
+This device is suitable for display and keypad Lighting
+
+Required properties:
+	- compatible:
+		"ti,lm3633"
+	- reg :  I2C slave address
+	- #address-cells : 1
+	- #size-cells : 0
+
+Optional properties:
+	- enable-gpios : GPIO pin to enable/disable the device
+	- vled-supply : LED supply
+
+Required child properties:
+	- reg : 0 - HVLED is Controlled by bank A
+		1 - HVLED is Controlled by bank B
+		2,3,4 - LVLED1, 2 and 3 are Controlled by bank C, D and E
+		5,6,7 - LVLED4, 5 and 6 are Controlled by bank F, G and H
+	- led-sources : Indicates which LED string is associated to which
+			control bank.
+			0 - LED is not active in this control bank
+			1 - LED string is controlled by this control bank
+
+Optional child properties:
+	- runtime-ramp-up-msec: Current ramping from one brightness level to
+				the a higher brightness level.
+				Range from 2048 us - 117.44 s
+	- runtime-ramp-down-msec: Current ramping from one brightness level to
+				  the a lower brightness level.
+				  Range from 2048 us - 117.44 s
+	- label : see Documentation/devicetree/bindings/leds/common.txt
+	- linux,default-trigger :
+	   see Documentation/devicetree/bindings/leds/common.txt
+
+Example:
+Control bank C output to 3 LVLEDs and Control F, G and H have independent
+controls of the LVLEDs.
+
+led-controller@36 {
+	compatible = "ti,lm3633";
+	reg = <0x36>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
+	led@0 {
+		reg = <0>;
+		led-sources = < 1 0 1 >;
+		label = "white:backlight";
+		ramp-up-ms = <100000>;
+		ramp-down-ms = <1000>;
+		linux,default-trigger = "backlight";
+	};
+
+	led@1 {
+		reg = <1>;
+		led-sources = < 0 1 0 >;
+		label = "white:light";
+		ramp-up-ms = <100000>;
+		ramp-down-ms = <1000>;
+	};
+
+	led@2 {
+		reg = <2>;
+		led-sources = <1>;
+		ramp-up-ms = <100000>;
+		ramp-down-ms = <1000>;
+		label = "white:indicator1";
+	};
+
+	led@5 {
+		reg = <5>;
+		led-sources = <1>;
+		ramp-up-ms = <100000>;
+		ramp-down-ms = <1000>;
+		label = "red:light";
+	};
+
+	led@6 {
+		reg = <6>;
+		led-sources = <1>;
+		ramp-up-ms = <41940>;
+		ramp-down-ms = <1000>;
+		label = "green:light";
+	};
+
+	led@7 {
+		reg = <7>;
+		led-sources = <1>;
+		ramp-up-ms = <100000>;
+		ramp-down-ms = <1000>;
+		label = "blue:light";
+	};
+};
+For more product information please see the link below:
+http://www.ti.com/lit/ds/symlink/lm3633.pdf
Documentation/devicetree/bindings/mfd/ti-lmu.txt +0 -48

70 lines not on this page · raw message

Signature · 1 line
2.19.0
#20 lore raw

Re: [PATCH v4 5/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3633

Quoted 9 lines · Dan Murphy

The LM3633 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp features and those can be accomodated by a TI LMU framework.

The LM3633 dt binding needs to be moved from the ti-lmu.txt and a dedicated LED dt binding needs to be added. The new LM3633 LED dt binding will then reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

What?

Quoted 10 lines
 .../devicetree/bindings/leds/leds-lm3633.txt  | 102 ++++++++++++++++++
 .../devicetree/bindings/mfd/ti-lmu.txt        |  48 ---------
 2 files changed, 102 insertions(+), 48 deletions(-)
 create mode 100644

Documentation/devicetree/bindings/leds/leds-lm3633.txt

index 920f910be4e9..573e88578d3d 100644

Documentation/devicetree/bindings/mfd/ti-lmu.txt TI LMU driver supports lighting devices below. · line 10

Quoted 5 lines
Documentation/devicetree/bindings/mfd/ti-lmu.txt +0 -1
@@ -7,7 +7,6 @@ TI LMU driver supports lighting devices below.
   LM3532       Backlight
   LM3631       Backlight and regulator
   LM3632       Backlight and regulator
-  LM3633       Backlight, LED and fault monitor
   LM3695       Backlight

Are you seriously proposing to take one binding and split it into 6 copy&pasted ones?

That's not the way we do development. NAK.

We don't want to have copy & pasted code. We also don't want to have copy & pasted bindings. Nor changelogs, for that matter.

Thank you,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
maintainer
#21 lore raw

Re: [PATCH v4 5/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3633

Quoted 32 lines · Pavel Machek
Quoted 9 lines · Dan Murphy

The LM3633 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp features and those can be accomodated by a TI LMU framework.

The LM3633 dt binding needs to be moved from the ti-lmu.txt and a dedicated LED dt binding needs to be added. The new LM3633 LED dt binding will then reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

What?

Quoted 10 lines
 .../devicetree/bindings/leds/leds-lm3633.txt  | 102 ++++++++++++++++++
 .../devicetree/bindings/mfd/ti-lmu.txt        |  48 ---------
 2 files changed, 102 insertions(+), 48 deletions(-)
 create mode 100644

Documentation/devicetree/bindings/leds/leds-lm3633.txt

index 920f910be4e9..573e88578d3d 100644

Documentation/devicetree/bindings/mfd/ti-lmu.txt TI LMU driver supports lighting devices below. · line 10

Quoted 5 lines
Documentation/devicetree/bindings/mfd/ti-lmu.txt +0 -1
@@ -7,7 +7,6 @@ TI LMU driver supports lighting devices below.
   LM3532       Backlight
   LM3631       Backlight and regulator
   LM3632       Backlight and regulator
-  LM3633       Backlight, LED and fault monitor
   LM3695       Backlight

Are you seriously proposing to take one binding and split it into 6 copy&pasted ones?

Quoted 4 lines

That's not the way we do development. NAK.

We don't want to have copy & pasted code. We also don't want to have copy & pasted bindings. Nor changelogs, for that matter.

I looked at the LM3633 and LM3632 datasheets. They look quite different to me and should be separate IMO. Just looking at different LED functions and GPIO control lines is enough to make that determination. The LM3697 looks like a subset of LM3633 at least at a schematic diagram level, so maybe those can be shared.

While we could litter the binding with conditions on properties depending on specific compatible strings (such as which GPIO properties apply to which compatible), that is going to be problematic down the line when we convert to json-schema[1].

Rob

[1] https://lkml.org/lkml/2018/10/5/883

#22 lore raw

Re: [PATCH v4 5/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3633

Quoted 35 lines · Rob Herring
Quoted 34 lines · Pavel Machek
Quoted 9 lines · Dan Murphy

The LM3633 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp features and those can be accomodated by a TI LMU framework.

The LM3633 dt binding needs to be moved from the ti-lmu.txt and a dedicated LED dt binding needs to be added. The new LM3633 LED dt binding will then reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

What?

Quoted 10 lines
 .../devicetree/bindings/leds/leds-lm3633.txt  | 102 ++++++++++++++++++
 .../devicetree/bindings/mfd/ti-lmu.txt        |  48 ---------
 2 files changed, 102 insertions(+), 48 deletions(-)
 create mode 100644

Documentation/devicetree/bindings/leds/leds-lm3633.txt

index 920f910be4e9..573e88578d3d 100644

Documentation/devicetree/bindings/mfd/ti-lmu.txt TI LMU driver supports lighting devices below. · line 10

Quoted 5 lines
Documentation/devicetree/bindings/mfd/ti-lmu.txt +0 -1
@@ -7,7 +7,6 @@ TI LMU driver supports lighting devices below.
   LM3532       Backlight
   LM3631       Backlight and regulator
   LM3632       Backlight and regulator
-  LM3633       Backlight, LED and fault monitor
   LM3695       Backlight

Are you seriously proposing to take one binding and split it into 6 copy&pasted ones?

That's not the way we do development. NAK.

Quoted 8 lines
Quoted 2 lines

We don't want to have copy & pasted code. We also don't want to have copy & pasted bindings. Nor changelogs, for that matter.

I looked at the LM3633 and LM3632 datasheets. They look quite different to me and should be separate IMO. Just looking at different LED functions and GPIO control lines is enough to make that determination. The LM3697 looks like a subset of LM3633 at least at a schematic diagram level, so maybe those can be shared.

Well, they have blocks in common, and are currently handled by one driver. Two .c files proposed here shared 80% code when I reviewed previous version. Original merge documentation is:

https://groups.google.com/forum/#!msg/fa.linux.kernel/hWvxahP7INw/Y2EDZmjoAQAJ

TI LMU(Lighting Management Unit) driver supports lighting devices below.

Enable pin Backlights HWMON LEDs Regulators
---------- ---------- ----- ---- ------------
LM3532 o o x x x
LM3631 o o x x 5 regulators
LM3632 o o x x 3 regulators
LM3633 o o o o x
LM3695 o o x x x
LM3697 o o o x x

I thought I understood that table, but maybe I'm confused. Anyway, there seemed to be "enough" to share.

Quoted 4 lines

While we could litter the binding with conditions on properties depending on specific compatible strings (such as which GPIO properties apply to which compatible), that is going to be problematic down the line when we convert to json-schema[1].

Well, situation where different devices share common features / function blocks is going to be somehow common. Not sure how to solve it in json, maybe the properties can simply be marked optional?, but I guess it will need solving somehow.

Quoted 1 line

[1] https://lkml.org/lkml/2018/10/5/883

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
maintainer
#23 lore raw

Re: [PATCH v4 5/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3633

Quoted 64 lines · Pavel Machek
Quoted 35 lines · Rob Herring
Quoted 34 lines · Pavel Machek
Quoted 9 lines · Dan Murphy

The LM3633 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp features and those can be accomodated by a TI LMU framework.

The LM3633 dt binding needs to be moved from the ti-lmu.txt and a dedicated LED dt binding needs to be added. The new LM3633 LED dt binding will then reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

What?

Quoted 10 lines
 .../devicetree/bindings/leds/leds-lm3633.txt  | 102 ++++++++++++++++++
 .../devicetree/bindings/mfd/ti-lmu.txt        |  48 ---------
 2 files changed, 102 insertions(+), 48 deletions(-)
 create mode 100644

Documentation/devicetree/bindings/leds/leds-lm3633.txt

index 920f910be4e9..573e88578d3d 100644

Documentation/devicetree/bindings/mfd/ti-lmu.txt TI LMU driver supports lighting devices below. · line 10

Quoted 5 lines
Documentation/devicetree/bindings/mfd/ti-lmu.txt +0 -1
@@ -7,7 +7,6 @@ TI LMU driver supports lighting devices below.
   LM3532       Backlight
   LM3631       Backlight and regulator
   LM3632       Backlight and regulator
-  LM3633       Backlight, LED and fault monitor
   LM3695       Backlight

Are you seriously proposing to take one binding and split it into 6 copy&pasted ones?

That's not the way we do development. NAK.

Quoted 8 lines
Quoted 2 lines

We don't want to have copy & pasted code. We also don't want to have copy & pasted bindings. Nor changelogs, for that matter.

I looked at the LM3633 and LM3632 datasheets. They look quite different to me and should be separate IMO. Just looking at different LED functions and GPIO control lines is enough to make that determination. The LM3697 looks like a subset of LM3633 at least at a schematic diagram level, so maybe those can be shared.

Well, they have blocks in common, and are currently handled by one driver. Two .c files proposed here shared 80% code when I reviewed previous version. Original merge documentation is:

https://groups.google.com/forum/#!msg/fa.linux.kernel/hWvxahP7INw/Y2EDZmjoAQAJ

TI LMU(Lighting Management Unit) driver supports lighting devices below.

Enable pin Backlights HWMON LEDs Regulators
---------- ---------- ----- ---- ------------
LM3532 o o x x x
LM3631 o o x x 5 regulators
LM3632 o o x x 3 regulators
LM3633 o o o o x
LM3695 o o x x x
LM3697 o o o x x

Quoted 2 lines

I thought I understood that table, but maybe I'm confused. Anyway, there seemed to be "enough" to share.

I don't think all the backlight blocks are the same. Some don't have 2 ramp settings is what I looked at. I only skimmed thru the datasheets though.

Quoted 9 lines
Quoted 4 lines

While we could litter the binding with conditions on properties depending on specific compatible strings (such as which GPIO properties apply to which compatible), that is going to be problematic down the line when we convert to json-schema[1].

Well, situation where different devices share common features / function blocks is going to be somehow common. Not sure how to solve it in json, maybe the properties can simply be marked optional?, but I guess it will need solving somehow.

There are ways to deal with some of that, but at some point when every property has different constraints based on compatibles at some point it is easier to just split them. We don't try to have all LED bindings in one doc even if they only use standard properties.

Rob

author
#24 lore raw

Re: [PATCH v4 5/7] dt-bindings: ti-lmu: Modify dt bindings for the LM3633

In reply to Pavel Machek

Pavel

Quoted 19 lines · Pavel Machek
Quoted 9 lines · Dan Murphy

The LM3633 is a single function LED driver. The single function LED driver needs to reside in the LED directory as a dedicated LED driver and not as a MFD device. The device does have common brightness and ramp features and those can be accomodated by a TI LMU framework.

The LM3633 dt binding needs to be moved from the ti-lmu.txt and a dedicated LED dt binding needs to be added. The new LM3633 LED dt binding will then reside in the Documentation/devicetree/bindings/leds directory and follow the current LED and general bindings guidelines.

What?

Quoted 5 lines
 .../devicetree/bindings/leds/leds-lm3633.txt  | 102 ++++++++++++++++++
 .../devicetree/bindings/mfd/ti-lmu.txt        |  48 ---------
 2 files changed, 102 insertions(+), 48 deletions(-)
 create mode 100644

Documentation/devicetree/bindings/leds/leds-lm3633.txt

Quoted 12 lines

Documentation/devicetree/bindings/mfd/ti-lmu.txt TI LMU driver supports lighting devices below. · line 10

Quoted 9 lines

index 920f910be4e9..573e88578d3d 100644

Documentation/devicetree/bindings/mfd/ti-lmu.txt +0 -1
@@ -7,7 +7,6 @@ TI LMU driver supports lighting devices below.
   LM3532       Backlight
   LM3631       Backlight and regulator
   LM3632       Backlight and regulator
-  LM3633       Backlight, LED and fault monitor
   LM3695       Backlight

Are you seriously proposing to take one binding and split it into 6 copy&pasted ones?

No that is not what I am proposing. And never have. I support keeping the MFD devices in the MFD directory and only pulling out the single function devices as we have debated over and over again.

Quoted 6 lines

That's not the way we do development. NAK.

We don't want to have copy & pasted code. We also don't want to have copy & pasted bindings. Nor changelogs, for that matter.

Change was copy and pasted don't know why I need to rephrase the same exact change only for a different part but I can modify it.

I do see what I can update here. As you said I will fix up the ti-lmu binding in such a way that the dedicated LED driver bindings point to the common binding for the TI-LMU framework.

Dan

Quoted 3 lines

Thank you,
Pavel

Signature · 2 lines
------------------
Dan Murphy
author
#25 lore raw

PATCH v4 6/7 mfd: ti-lmu: Remove support for LM3633

In reply to Dan Murphy

Remove support for the LM3633 from the ti-lmu
driver in favor of a dedicated LED driver.

---
 drivers/mfd/Kconfig  |  2 +-
 drivers/mfd/ti-lmu.c | 21 ---------------------
 2 files changed, 1 insertion(+), 22 deletions(-)
drivers/mfd/Kconfig +1 -1
index 9b04dd527c68..225cb3be350c 100644
@@ -1293,7 +1293,7 @@ config MFD_TI_LMU
 	help
 	  Say yes here to enable support for TI LMU chips.
 
-	  TI LMU MFD supports LM3532, LM3631, LM3632, LM3633, and LM3695.
+	  TI LMU MFD supports LM3532, LM3631, LM3632, and LM3695.
 	  It consists of backlight, LED and regulator driver.
 	  It provides consistent device controls for lighting functions.
 
drivers/mfd/ti-lmu.c +0 -21
index b6bfa99a29dd..2cf8a23cba52 100644
@@ -102,24 +102,6 @@ static struct mfd_cell lm3632_devices[] = {
 	},
 };
 
-static struct mfd_cell lm3633_devices[] = {
-	{
-		.name          = "ti-lmu-backlight",
-		.id            = LM3633,
-		.of_compatible = "ti,lm3633-backlight",
-	},
-	{
-		.name          = "lm3633-leds",
-		.of_compatible = "ti,lm3633-leds",
-	},
-	/* Monitoring driver for open/short circuit detection */
-	{
-		.name          = "ti-lmu-fault-monitor",
-		.id            = LM3633,
-		.of_compatible = "ti,lm3633-fault-monitor",
-	},
-};
-
 static struct mfd_cell lm3695_devices[] = {
 	{
 		.name          = "ti-lmu-backlight",
@@ -139,14 +121,12 @@ static const struct ti_lmu_data chip##_data =	\
 TI_LMU_DATA(lm3532, LM3532_MAX_REG);
 TI_LMU_DATA(lm3631, LM3631_MAX_REG);
 TI_LMU_DATA(lm3632, LM3632_MAX_REG);
-TI_LMU_DATA(lm3633, LM3633_MAX_REG);
 TI_LMU_DATA(lm3695, LM3695_MAX_REG);
 
 static const struct of_device_id ti_lmu_of_match[] = {
 	{ .compatible = "ti,lm3532", .data = &lm3532_data },
 	{ .compatible = "ti,lm3631", .data = &lm3631_data },
 	{ .compatible = "ti,lm3632", .data = &lm3632_data },
-	{ .compatible = "ti,lm3633", .data = &lm3633_data },
 	{ .compatible = "ti,lm3695", .data = &lm3695_data },
 	{ }
 };
@@ -219,7 +199,6 @@ static const struct i2c_device_id ti_lmu_ids[] = {
 	{ "lm3532", LM3532 },
 	{ "lm3631", LM3631 },
 	{ "lm3632", LM3632 },
-	{ "lm3633", LM3633 },
 	{ "lm3695", LM3695 },
 	{ }
 };
Signature · 1 line
2.19.0
author
#26 lore raw

PATCH v4 7/7 leds: lm3633: Introduce the lm3633 driver

In reply to Dan Murphy

Introduce the LED LM3633 driver. This LED
driver has 9 total LED outputs with runtime
internal ramp configurations.

Data sheet:
http://www.ti.com/lit/ds/symlink/lm3633.pdf

---
 drivers/leds/Kconfig       |   8 +
 drivers/leds/Makefile      |   1 +
 drivers/leds/leds-lm3633.c | 556 +++++++++++++++++++++++++++++++++++++
 3 files changed, 565 insertions(+)
 create mode 100644 drivers/leds/leds-lm3633.c
drivers/leds/Kconfig +8 -0
index 7d9a98044be4..1f9093e5d902 100644
@@ -763,8 +763,16 @@ config LEDS_LM3697
           Say Y to enable the LED driver for TI LMU devices.
           This supports the LED device LM3697.
 
+config LEDS_LM3633
+	tristate "LED driver for LM3633"
+ 	depends on LEDS_TI_LMU_COMMON
+	help
+          Say Y to enable the LED driver for TI LMU devices.
+          This supports the LED device LM3633.
+
 config LEDS_TI_LMU_COMMON
 	tristate "LED driver for TI LMU"
+	depends on REGMAP
 	help
           Say Y to enable the LED driver for TI LMU devices.
           This supports common features between the TI LM3532, LM3631, LM3632,
drivers/leds/Makefile +1 -0
index 6fbce7cfc41c..6ec006892fc0 100644
@@ -79,6 +79,7 @@ obj-$(CONFIG_LEDS_LM3692X)		+= leds-lm3692x.o
 obj-$(CONFIG_LEDS_SC27XX_BLTC)		+= leds-sc27xx-bltc.o
 obj-$(CONFIG_LEDS_LM3601X)		+= leds-lm3601x.o
 obj-$(CONFIG_LEDS_LM3697)		+= leds-lm3697.o
+obj-$(CONFIG_LEDS_LM3633)		+= leds-lm3633.o
 obj-$(CONFIG_LEDS_TI_LMU_COMMON)	+= ti-lmu-led-common.o
 
 # LED SPI Drivers
drivers/leds/leds-lm3633.c new file +556 -0

556 lines not on this page · raw message

Signature · 1 line
2.19.0
#27 lore raw
In reply to Dan Murphy
Quoted 8 lines · Dan Murphy

From: Pavel Machek <[email protected]>

This adds backlight support for the following TI LMU
chips: LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.

It controls LEDs on Droid 4
smartphone, including keyboard and screen backlights.

Quoted 6 lines

[add LED subsystem support for keyboard backlight and rework DT binding according to Rob Herrings feedback]

[remove backlight subsystem support for now]

This is not correct way to sign off a patch.

What is worse, this is very different from patch I submitted; this misses imporant parts while my patch was complete.

I already submitted better patch for both the driver and device tree bindings. Can we go back and apply that?

Then you can add your changes on top of that, if they actually make the situation better.

Thanks,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
author
#28 lore raw

Pavel

Quoted 18 lines · Pavel Machek
Quoted 8 lines · Dan Murphy

From: Pavel Machek <[email protected]>

This adds backlight support for the following TI LMU
chips: LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.

It controls LEDs on Droid 4
smartphone, including keyboard and screen backlights.

Quoted 6 lines

[add LED subsystem support for keyboard backlight and rework DT binding according to Rob Herrings feedback]

[remove backlight subsystem support for now]

This is not correct way to sign off a patch.

Quoted 8 lines

What is worse, this is very different from patch I submitted; this misses imporant parts while my patch was complete.

I already submitted better patch for both the driver and device tree bindings. Can we go back and apply that?

Then you can add your changes on top of that, if they actually make the situation better.

Thanks for this. I wanted to make sure not to loose any authorship or credit in the commit. Actually removing Milo might help stop getting the bounce back from the mail daemon.

I was using the RFC patch as my base https://lore.kernel.org/patchwork/patch/978995/

Which contains this sign off.

Dan

Quoted 4 lines

Thanks,
Pavel

Signature · 2 lines
------------------
Dan Murphy
#29 lore raw
Quoted 30 lines · Dan Murphy

Pavel

Quoted 18 lines · Pavel Machek
Quoted 8 lines · Dan Murphy

From: Pavel Machek <[email protected]>

This adds backlight support for the following TI LMU
chips: LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.

It controls LEDs on Droid 4
smartphone, including keyboard and screen backlights.

Quoted 6 lines

[add LED subsystem support for keyboard backlight and rework DT binding according to Rob Herrings feedback]

[remove backlight subsystem support for now]

This is not correct way to sign off a patch.

Quoted 8 lines

What is worse, this is very different from patch I submitted; this misses imporant parts while my patch was complete.

I already submitted better patch for both the driver and device tree bindings. Can we go back and apply that?

Then you can add your changes on top of that, if they actually make the situation better.

Quoted 7 lines

Thanks for this. I wanted to make sure not to loose any authorship or credit in the commit. Actually removing Milo might help stop getting the bounce back from the mail daemon.

I was using the RFC patch as my base https://lore.kernel.org/patchwork/patch/978995/

Which contains this sign off.

Yeah, but you need to append your sign-off to the end, preferably prepending note saying what you modified. [I'm ok with the original patch, but I'm not ok with your version].

From: Pavel Machek <[email protected]>

Is not correct. Original patch is from Milo, if you want to add explicit From:, I guess it should be his.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html