diff mbox series

[v4,1/2] dt: bindings: lm3601x: Introduce the lm3601x driver

Message ID 20180510122718.8413-1-dmurphy@ti.com
State New
Headers show
Series [v4,1/2] dt: bindings: lm3601x: Introduce the lm3601x driver | expand

Commit Message

Dan Murphy May 10, 2018, 12:27 p.m. UTC
Introduce the device tree bindings for the lm3601x
family of LED torch, flash and IR drivers.

Signed-off-by: Dan Murphy <dmurphy@ti.com>

---

v4 - Added " " around "=", changed strobe to flash on label, removed "support and
register" comment and change ir lable to ir:torch - See v2 patchworks for comments

v3 - Removed wildcard compatible - https://patchwork.kernel.org/patch/10386241/
v2 - No changes - https://patchwork.kernel.org/patch/10384587/

 .../devicetree/bindings/leds/leds-lm3601x.txt | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-lm3601x.txt

-- 
2.17.0.582.gccdcbd54c

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Dan Murphy May 10, 2018, 3:16 p.m. UTC | #1
On 05/10/2018 09:31 AM, Andrew F. Davis wrote:
> On 05/10/2018 09:04 AM, Dan Murphy wrote:

> 

>>>> +static int lm3601x_remove(struct i2c_client *client)

>>>> +{

>>>> +	struct lm3601x_led *led = i2c_get_clientdata(client);

>>>> +

>>>> +	regmap_write(led->regmap, LM3601X_ENABLE_REG, 0);

>>>> +

>>>

>>>

>>> If probe doesn't enable this, remove shouldn't disable it. It can lead

>>> to odd cases if the driver is removed and added again.

>>

>> I want to make sure the LED is off and in standby mode.  Maybe I will just set it to

>> the default value instead.

>>

> 

> 

> Why? If you want to do this then implement PM controls and put it in

> standby mode there.

> 

> 


Implementing PM controls does not cause this line to be removed on a removal.

>>>

>>> Plus, removing the driver is not a command to disable the LED anyway.

>>

>> True but you don't want to leave any LEDs in the on state without a driver to support it.

>> This could burn out the LED or the board if left on on max brightness

>>

> 

> 

> I disagree, we should not try to decide what the user wants here. We

> should only do what we are instructed to do, which for remove() is to

> cleanup what probe has done so the driver can be removed w/o leaking

> memory or device state.


So your OK with a causing a burn out of the device or LED or draining the battery because the driver was
unloaded and there is not way to turn it off besides hard power cycling the device.  Because even a reboot
of the device will still leave the LED on throughout the boot until the driver is reloaded.

I will let the maintainer weigh in on this issue.

> 

> 

>>

>> Dan

>>



-- 
------------------
Dan Murphy
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pavel Machek May 10, 2018, 6:39 p.m. UTC | #2
Hi!

> >> Plus, removing the driver is not a command to disable the LED anyway.

> > 

> > True but you don't want to leave any LEDs in the on state without a driver to support it.

> > This could burn out the LED or the board if left on on max brightness

> 

> I disagree, we should not try to decide what the user wants here. We

> should only do what we are instructed to do, which for remove() is to

> cleanup what probe has done so the driver can be removed w/o leaking

> memory or device state.


We normally powerdown on rmmod. We should do that here, too.
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/leds/leds-lm3601x.txt b/Documentation/devicetree/bindings/leds/leds-lm3601x.txt
new file mode 100644
index 000000000000..697e5e3a1d4c
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-lm3601x.txt
@@ -0,0 +1,50 @@ 
+* Texas Instruments - lm3601x Single-LED Flash Driver
+
+The LM3601X are ultra-small LED flash drivers that
+provide a high level of adjustability.
+
+Required properties:
+	- compatible : Can be one of the following
+		"ti,lm36010"
+		"ti,lm36011"
+	- reg : I2C slave address
+	- #address-cells : 1
+	- #size-cells : 0
+
+Required child properties:
+	- reg : 0 - Indicates a torch interface
+		1 - Indicates a flash interface
+		2 - Indicates an infrared interface
+
+Optional child properties:
+	- label : see Documentation/devicetree/bindings/leds/common.txt
+
+Example:
+led-controller@64 {
+	compatible = "ti,lm36010";
+	#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:flash";
+		flash-max-microamp = <10000>;
+		flash-max-timeout-us = <800>;
+	};
+
+	led@2 {
+		reg = <2>;
+		label = "ir:torch";
+	};
+}
+
+For more product information please see the links below:
+http://www.ti.com/product/LM36010
+http://www.ti.com/product/LM36011