Message ID | 20180521180927.18472-1-dmurphy@ti.com |
---|---|
State | Accepted |
Commit | 2f8270de62db520313fc4aa27eccd9300478f3a3 |
Headers | show |
Series | [v7,1/2] dt: bindings: lm3601x: Introduce the lm3601x driver | expand |
Andy On 05/21/2018 06:05 PM, Andy Shevchenko wrote: > On Tue, May 22, 2018 at 12:44 AM, Dan Murphy <dmurphy@ti.com> wrote: > > >>>> + child = device_get_next_child_node(&led->client->dev, child); >>>> + if (!child) { >>>> + dev_err(&led->client->dev, "No LED Child node\n"); >>>> + return ret; >>>> + } >>>> + >>>> + ret = fwnode_property_read_u32(child, "reg", &led->led_mode); >>>> + if (ret) { >>>> + dev_err(&led->client->dev, "reg DT property missing\n"); >>>> + goto out_err; >>>> + } >>>> + >>>> + if (led->led_mode > LM3601X_LED_TORCH || >>>> + led->led_mode < LM3601X_LED_IR) { >>>> + dev_warn(&led->client->dev, "Invalid led mode requested\n"); >>>> + ret = -EINVAL; >>>> + goto out_err; >>>> + } >>>> + >>>> + ret = fwnode_property_read_string(child, "label", &name); >>>> + if (ret) { >>>> + if (led->led_mode == LM3601X_LED_TORCH) >>>> + name = "torch"; >>>> + else >>>> + name = "infrared"; >>>> + } >>>> + >>>> + snprintf(led->led_name, sizeof(led->led_name), >>>> + "%s:%s", node->name, name); >>> >>> Reading once again my recent explanation regarding this I realized >>> that I didn't provide clear conclusion, which is: we no longer >>> use child node name for LED class device name if label is absent. >>> (apart from that - you're using parent DT node now, i.e. >>> led-controller). >>> >>> Please follow what was done for drivers/leds/leds-cr0014114.c. >> >> Hmmm. If this is calling dev->of_node->name to store the name will this >> work in non-DT configurations? > > I didn't found this kind of use in linux-next, perhaps I missed something? > Linux next has a different version then what I found doing a search for the driver. I will change the code to match what is in linux-next. Dan > In the driver Jacek referred to I found, though, use of of_node, which > at some point should be changed to fwnode. > > For now you can fill that if you want to using something like this > (IIRC it should work): > > if (is_of_node(fwnode)) > ...->of_node = to_of_node(...); > >> I have not dug to deeply into the fwnode code to find out how the nodes >> get populated. So my question may not even be valid. > -- ------------------ 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
diff --git a/Documentation/devicetree/bindings/leds/leds-lm3601x.txt b/Documentation/devicetree/bindings/leds/leds-lm3601x.txt new file mode 100644 index 000000000000..a88b2c41e75b --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-lm3601x.txt @@ -0,0 +1,45 @@ +* 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 IR mode + 1 - Indicates a Torch (white LED) mode + +Required properties for flash LED child nodes: + See Documentation/devicetree/bindings/leds/common.txt + - flash-max-microamp : Range from 11mA - 1.5A + - flash-max-timeout-us : Range from 40ms - 1600ms + - led-max-microamp : Range from 2.4mA - 376mA + +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 = <1>; + label = "white:torch"; + led-max-microamp = <376000>; + flash-max-microamp = <1500000>; + flash-max-timeout-us = <1600000>; + }; +} + +For more product information please see the links below: +http://www.ti.com/product/LM36010 +http://www.ti.com/product/LM36011