AW: [PATCH v2 2/4] leds: lp50xx: add setting of default intensity from DT
Hello Andy, > Von: Andy Shevchenko > Gesendet: Freitag, 19. Februar 2021 14:56 > An: Sven Schuchmann > Cc: Pavel Machek ; Dan Murphy ; > linux-l...@vger.kernel.org; > linux-kernel@vger.kernel.org > Betreff: Re: [PATCH v2 2/4] leds: lp50xx: add setting of default intensity > from DT > > > > > > Can you or Dan submit patch getting the regulator support to work? If > > > > > not, I guess we should remove the regulator support after all. > > > > > > > > To be true I am fairly new to the kernel and have no idea > > > > how to test this. So no, I don't want provide a patch (except > > > > for removing), sorry. > > > > > > No problem. It seems Andy submitted series for this. > > > > > > > To me it seems that patches from Andy don't make > > the regulator work. Maybe I am wrong? > > I;m not sure I understand this correctly. Do you mean that my patches broke > something? Which one explicitly and what is broken? No, your patches do not break something (as far as I can see). Pavel asked for a patch to fix the regulator. The regulator at this time is only initialized but never used in the lp50xx. I told him (see above) that I cannot provide a patch which fixes this. He answered that you fixed this in your series, but to me it doesn't seem so. or did you fix the regulator usage in your patch series? Best Regards, Sven
AW: [PATCH v2 2/4] leds: lp50xx: add setting of default intensity from DT
Hello Pavel, hello Andy, > -Ursprüngliche Nachricht- > Von: Pavel Machek > Gesendet: Freitag, 19. Februar 2021 12:17 > An: Sven Schuchmann > Cc: Dan Murphy ; linux-l...@vger.kernel.org; > linux-kernel@vger.kernel.org > Betreff: Re: [PATCH v2 2/4] leds: lp50xx: add setting of default intensity > from DT > > > > Can you or Dan submit patch getting the regulator support to work? If > > > not, I guess we should remove the regulator support after all. > > > > To be true I am fairly new to the kernel and have no idea > > how to test this. So no, I don't want provide a patch (except > > for removing), sorry. > > No problem. It seems Andy submitted series for this. > To me it seems that patches from Andy don't make the regulator work. Maybe I am wrong? I am very busy right now but hopefully I will find some more time next week to submit some new patches. On my list so far for the lp50xx: * Remove unused variable https://www.spinics.net/lists/linux-leds/msg17654.html * Enable-GPIO not working (used before init, reset/enable order wrong) * Add default setting from DT https://www.spinics.net/lists/linux-leds/msg17596.html * Fix regulator https://www.spinics.net/lists/linux-leds/msg17631.html Best Regards, Sven
AW: [PATCH v2 1/4] leds: lp50xx: add setting of default intensity from DT
Hello Dan, > Von: Jacek Anaszewski > Gesendet: Freitag, 5. Februar 2021 19:37 > Hi Pavel, > > On 2/5/21 11:23 AM, Pavel Machek wrote: > > Hi! > > > patternProperties: > "(^led-[0-9a-f]$|led)": > @@ -99,6 +104,7 @@ examples: > reg = <0x1>; > color = ; > function = LED_FUNCTION_CHARGING; > + default-intensity = <100 0 0>; > > How will you know which array position is for which child LED? > I presume DT child nodes are not guaranteed to be parsed in the order > of declaration? I tried to fiddle this out, but it seems Jacek is right over here. The multi-led definition looks like this (from the documentation leds-lp50xx.yaml) multi-led@1 { #address-cells = <1>; #size-cells = <0>; reg = <0x1>; color = ; function = LED_FUNCTION_CHARGING; led-0 { color = ; }; led-1 { color = ; }; led-2 { color = ; }; }; But it seems that the color definition of each led is ignored. By ignored I mean the driver does not take care which color is at which position. So if I change led-0 to be LED_COLOR_ID_BLUE and led-2 to be LED_COLOR_ID_RED nothing will change if I write from userspace. Could you help to clarify? Then it is even hard to know which led to set with default-intensity. Also it seems that the enumeration of the multi-leds should start with multi-led@0 (and not 1 as in the documentation). Best Regards, Sven
AW: [PATCH v2 1/4] leds: lp50xx: add setting of default intensity from DT
Hello Pavel, hello Dan, > > diff --git a/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml > > b/Documentation/devicetree/bindings/leds/leds- > lp50xx.yaml > > index c192b5feadc7..2bc25b2fc94d 100644 > > --- a/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml > > +++ b/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml > > @@ -65,6 +65,11 @@ patternProperties: > >This property denotes the LED module number(s) that is used on > > the > >for the child node. The LED modules can either be used stand > > alone > >or grouped into a module bank. > > + default-intensity: > > +minItems: 1 > > +maxItems: 3 > > +description: > > Do we need more than three for RGBW and similar? AFAIK the lp50xx supports only RGB. So I would go for that. > > patternProperties: > >"(^led-[0-9a-f]$|led)": > > @@ -99,6 +104,7 @@ examples: > > reg = <0x1>; > > color = ; > > function = LED_FUNCTION_CHARGING; > > + default-intensity = <100 0 0>; > > > > led-0 { > > color = ; > > Should this go to leds-class-multicolor.yaml ? I think then all drivers should support it, but I cannot change all drivers. So I would only leave it in there. > Can you make example > <255 120 0> or something like that, so make it clear it is not > percent? Sure Best Regards, Sven
AW: [PATCH v2 2/4] leds: lp50xx: add setting of default intensity from DT
Hello Pavel, > > > > diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c > > > > index f13117eed976..4b40bf66483c 100644 > > > > --- a/drivers/leds/leds-lp50xx.c > > > > +++ b/drivers/leds/leds-lp50xx.c > > > > @@ -267,7 +267,6 @@ struct lp50xx_led { > > > > struct led_classdev_mc mc_cdev; > > > > struct lp50xx *priv; > > > > unsigned long bank_modules; > > > > - int led_intensity[LP50XX_LEDS_PER_MODULE]; > > > > u8 ctrl_bank_enabled; > > > > int led_number; > > > > }; > > > > > > ? Does not make sense and changelog does not help. > > > > This is an unused variable which is in the driver > > (same as the regulator). Should I provide a patch on its own for that > > or just describe in the changelog? > > Lets do separate patch here. DT changes will need Ack from Rob, this > can go in directly. Okay, I will submit a separate patch > Can you or Dan submit patch getting the regulator support to work? If > not, I guess we should remove the regulator support after all. To be true I am fairly new to the kernel and have no idea how to test this. So no, I don't want provide a patch (except for removing), sorry. Best Regards, Sven
AW: [PATCH v2 4/4] leds: lp50xx: add setting of default intensity from DT
Hello Pavel, > > > Signed-off-by: Sven Schuchmann > > Check your email headers, empty To: is strange. > > > diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c > > index 79bc071c31fb..e8aa36c7e963 100644 > > --- a/drivers/leds/leds-lp50xx.c > > +++ b/drivers/leds/leds-lp50xx.c > > @@ -504,6 +504,24 @@ static int lp50xx_probe_dt(struct lp50xx *priv) > > num_colors++; > > } > > > > + if (fwnode_property_count_u32(child, "default-intensity") > > + == num_colors) { > > + > > + int j, def_int[LP50XX_LEDS_PER_MODULE]; > > No need for empty line? Using "git send-email", maybe I am doing something wrong here, will check. > > + ret = fwnode_property_read_u32_array(child, > > + "default-intensity", def_int, num_colors); > > + if (ret) { > > + dev_err(>client->dev, > > + "Cannot read default-intensity: %d\n", > > + ret); > > + goto child_out; > > + } > > Just ignore such error? Yes, I will ignore in the next version Best Regards, Sven
AW: [PATCH v2 2/4] leds: lp50xx: add setting of default intensity from DT
Hello Pavel, > > diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c > > index f13117eed976..4b40bf66483c 100644 > > --- a/drivers/leds/leds-lp50xx.c > > +++ b/drivers/leds/leds-lp50xx.c > > @@ -267,7 +267,6 @@ struct lp50xx_led { > > struct led_classdev_mc mc_cdev; > > struct lp50xx *priv; > > unsigned long bank_modules; > > - int led_intensity[LP50XX_LEDS_PER_MODULE]; > > u8 ctrl_bank_enabled; > > int led_number; > > }; > > ? Does not make sense and changelog does not help. This is an unused variable which is in the driver (same as the regulator). Should I provide a patch on its own for that or just describe in the changelog? Best Regards, Sven
[PATCH v2 4/4] leds: lp50xx: add setting of default intensity from DT
In order to use a multicolor-led together with a trigger the led needs to have an intensity set to see something. The trigger changes the brightness of the led but if there is no intensity we actually see nothing. This patch adds the ability to set the default intensity of each multi-led node so that it is turned on from DT. If no intensity is given the led will be initialized with full intensity. Part 1 updates the documentation. Part 2 removes an unused variable. Part 3 sets the initial intensity to full. Part 4 reads the default intensity from DT changes in v1 - fix dt_binding_check errors changes in v2 - sets default intensity to full - adds the property to the multi-led node Signed-off-by: Sven Schuchmann --- drivers/leds/leds-lp50xx.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c index 79bc071c31fb..e8aa36c7e963 100644 --- a/drivers/leds/leds-lp50xx.c +++ b/drivers/leds/leds-lp50xx.c @@ -504,6 +504,24 @@ static int lp50xx_probe_dt(struct lp50xx *priv) num_colors++; } + if (fwnode_property_count_u32(child, "default-intensity") + == num_colors) { + + int j, def_int[LP50XX_LEDS_PER_MODULE]; + + ret = fwnode_property_read_u32_array(child, + "default-intensity", def_int, num_colors); + if (ret) { + dev_err(>client->dev, + "Cannot read default-intensity: %d\n", + ret); + goto child_out; + } + + for (j = 0; j < num_colors; j++) + mc_led_info[j].intensity = def_int[j]; + } + led->priv = priv; led->mc_cdev.num_colors = num_colors; led->mc_cdev.subled_info = mc_led_info; -- 2.17.1
[PATCH v2 3/4] leds: lp50xx: add setting of default intensity from DT
In order to use a multicolor-led together with a trigger the led needs to have an intensity set to see something. The trigger changes the brightness of the led but if there is no intensity we actually see nothing. This patch adds the ability to set the default intensity of each multi-led node so that it is turned on from DT. If no intensity is given the led will be initialized with full intensity. Part 1 updates the documentation. Part 2 removes an unused variable. Part 3 sets the initial intensity to full. Part 4 reads the default intensity from DT changes in v1 - fix dt_binding_check errors changes in v2 - sets default intensity to full - adds the property to the multi-led node Signed-off-by: Sven Schuchmann --- drivers/leds/leds-lp50xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c index 4b40bf66483c..79bc071c31fb 100644 --- a/drivers/leds/leds-lp50xx.c +++ b/drivers/leds/leds-lp50xx.c @@ -500,6 +500,7 @@ static int lp50xx_probe_dt(struct lp50xx *priv) } mc_led_info[num_colors].color_index = color_id; + mc_led_info[num_colors].intensity = LED_FULL; num_colors++; } -- 2.17.1
[PATCH v2 1/4] leds: lp50xx: add setting of default intensity from DT
In order to use a multicolor-led together with a trigger the led needs to have an intensity set to see something. The trigger changes the brightness of the led but if there is no intensity we actually see nothing. This patch adds the ability to set the default intensity of each multi-led node so that it is turned on from DT. If no intensity is given the led will be initialized with full intensity. Part 1 updates the documentation. Part 2 removes an unused variable. Part 3 sets the initial intensity to full. Part 4 reads the default intensity from DT changes in v1 - fix dt_binding_check errors changes in v2 - sets default intensity to full - adds the property to the multi-led node Signed-off-by: Sven Schuchmann --- Documentation/devicetree/bindings/leds/leds-lp50xx.yaml | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml b/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml index c192b5feadc7..2bc25b2fc94d 100644 --- a/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml +++ b/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml @@ -65,6 +65,11 @@ patternProperties: This property denotes the LED module number(s) that is used on the for the child node. The LED modules can either be used stand alone or grouped into a module bank. + default-intensity: +minItems: 1 +maxItems: 3 +description: + The default intensity the multi-led gets initialised with. patternProperties: "(^led-[0-9a-f]$|led)": @@ -99,6 +104,7 @@ examples: reg = <0x1>; color = ; function = LED_FUNCTION_CHARGING; + default-intensity = <100 0 0>; led-0 { color = ; -- 2.17.1
[PATCH v2 2/4] leds: lp50xx: add setting of default intensity from DT
In order to use a multicolor-led together with a trigger the led needs to have an intensity set to see something. The trigger changes the brightness of the led but if there is no intensity we actually see nothing. This patch adds the ability to set the default intensity of each multi-led node so that it is turned on from DT. If no intensity is given the led will be initialized with full intensity. Part 1 updates the documentation. Part 2 removes an unused variable. Part 3 sets the initial intensity to full. Part 4 reads the default intensity from DT changes in v1 - fix dt_binding_check errors changes in v2 - sets default intensity to full - adds the property to the multi-led node Signed-off-by: Sven Schuchmann --- drivers/leds/leds-lp50xx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c index f13117eed976..4b40bf66483c 100644 --- a/drivers/leds/leds-lp50xx.c +++ b/drivers/leds/leds-lp50xx.c @@ -267,7 +267,6 @@ struct lp50xx_led { struct led_classdev_mc mc_cdev; struct lp50xx *priv; unsigned long bank_modules; - int led_intensity[LP50XX_LEDS_PER_MODULE]; u8 ctrl_bank_enabled; int led_number; }; -- 2.17.1
AW: [PATCH v1] leds: lp50xx: add setting of default intensity from DT
Helo Pavel, > > > Yes, sounds reasonable. Could we get default intensity of 100% on all > > > channels if nothing else is specified? > > > > > > Or maybe simply "if intensity is not specified, start with 100%, and > > > use explicit =0 if other color is expected". > > > > > Mh, if someone is already using the led driver and updates to a newer kernel > > we would then turn on all leds per default to the maximum intensity during > > boot > > until they are set the way they should be from userspace. I don't know if > > this > > is what we want? If yes, sure, we could set them to maximum per > > default. > > Not really. If they don't have trigger configured, nothing will happen. Oops, you are right, my fault. > > > Also if we want to use Percentage Values (%) for setting the intensity > > I think this should also be done for the userspace interfaces and > > not only from DT. > > We don't want to use percentages in the API (but let me still use > percentages in discussion). No Problem. Best Regards, Sven
AW: [PATCH v1] leds: lp50xx: add setting of default intensity from DT
Hello Pavel, hello Marek > > Is the property default-intensity documented in DT bindings? I updated the documentation in leds-lp50xx.yaml. Is it this what you mean? > > Wouldn't it be better if the property was used in the multi-led node > > instead of the channel node? I.e. > > multi-led@3 { > > color = ; > > default-intensity = <100 0 0>; > > }; > > Yes, this would be better. Sound good, I will see what I can do here. Regards, Sven
AW: [PATCH v1] leds: lp50xx: add setting of default intensity from DT
Hello Pavel, > > Yes, sounds reasonable. Could we get default intensity of 100% on all > channels if nothing else is specified? > > Or maybe simply "if intensity is not specified, start with 100%, and > use explicit =0 if other color is expected". > Mh, if someone is already using the led driver and updates to a newer kernel we would then turn on all leds per default to the maximum intensity during boot until they are set the way they should be from userspace. I don't know if this is what we want? If yes, sure, we could set them to maximum per default. Also if we want to use Percentage Values (%) for setting the intensity I think this should also be done for the userspace interfaces and not only from DT. So at this time setting the RGB-LED to white is done like this: echo "255 255 255" > /sys/class/leds/rgb\:led/multi_intensity would then get echo "100 100 100" > /sys/class/leds/rgb\:led/multi_intensity Again over here: If we would change it would break earlier Applications from userspace. Just my thoughts. What do you think? Best Regards, Sven
AW: [PATCH 2/2] leds: lp50xx: remove unused regulator
Hello Dan, hello Pavel, > > Do you have set up where this is needed and you can test this? Will > > you submit the fixes? > > No I use an always on regulator in my setup. I have no managed supplies > exposed. I am also sorry I do not have a setup ready for testing this. I think we should ignore this patch then?` For now I am working on the enable pin in the driver. The enablement seems it does not work. The order of I2C-Reset and Enable is wrong and the pin is used before initialized. But I do not have any patches ready. Is the enable pin working on your side? Best Regards, Sven
AW: [PATCH v1] leds: lp50xx: add setting of default intensity from DT
Hello Pavel, > > In order to use a multicolor-led together with a trigger > > from DT the led needs to have an intensity set to see something. > > The trigger changes the brightness of the led but if there > > is no intensity we actually see nothing. > > > > This patch adds the ability to set the default intensity > > of each led so that it is turned on from DT. > > Do we need this to be configurable from device tree? Can we just set > it to max or something? > > Aha, this basically sets the initial color for LEDs the monochromatic > triggers, right? Let me try to explain in other words: I have one RGB-LED which consists of 3 Colors. Each of the three colors (Red, Green, Blue) you have to define in the DT. For example this is my setup for one RGB-LED which I wanted to show the heartbeat in Red (half intensity): multi-led@3 { #address-cells = <1>; #size-cells = <0>; reg = <0x3>; color = ; linux,default-trigger = "heartbeat"; function = LED_FUNCTION_HEARTBEAT; led-9 { color = ; default-intensity = <100>; }; led-10 { color = ; }; led-11 { color = ; }; }; If I would not have the default-intensity I would actually see nothing, since the intensity (which goes from 0-255) of each led is initialized with 0. I hope I could clarify this a little more? Best Regards, Sven
[PATCH 2/2] leds: lp50xx: remove unused regulator
The regulator for vled-supply is unused in the driver. It is just assigned from DT and disabled in lp50xx_remove. So the code can be removed from the driver. Part 1 updates the documentation Part 2 removes the code Signed-off-by: Sven Schuchmann --- drivers/leds/leds-lp50xx.c | 14 -- 1 file changed, 14 deletions(-) diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c index f13117eed976..b0871495bae3 100644 --- a/drivers/leds/leds-lp50xx.c +++ b/drivers/leds/leds-lp50xx.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -275,7 +274,6 @@ struct lp50xx_led { /** * struct lp50xx - * @enable_gpio: hardware enable gpio - * @regulator: LED supply regulator pointer * @client: pointer to the I2C client * @regmap: device register map * @dev: pointer to the devices device struct @@ -286,7 +284,6 @@ struct lp50xx_led { */ struct lp50xx { struct gpio_desc *enable_gpio; - struct regulator *regulator; struct i2c_client *client; struct regmap *regmap; struct device *dev; @@ -462,10 +459,6 @@ static int lp50xx_probe_dt(struct lp50xx *priv) return ret; } - priv->regulator = devm_regulator_get(priv->dev, "vled"); - if (IS_ERR(priv->regulator)) - priv->regulator = NULL; - device_for_each_child_node(priv->dev, child) { led = >leds[i]; ret = fwnode_property_count_u32(child, "reg"); @@ -583,13 +576,6 @@ static int lp50xx_remove(struct i2c_client *client) return ret; } - if (led->regulator) { - ret = regulator_disable(led->regulator); - if (ret) - dev_err(>client->dev, - "Failed to disable regulator\n"); - } - mutex_destroy(>lock); return 0; -- 2.17.1
[PATCH 1/2] leds: lp50xx: remove unused regulator
The regulator for vled-supply is unused in the driver. It is just assigned from DT and disabled in lp50xx_remove. So the code can be removed from the driver. Part 1 updates the documentation Part 2 removes the code Signed-off-by: Sven Schuchmann --- Documentation/devicetree/bindings/leds/leds-lp50xx.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml b/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml index c192b5feadc7..c20a81d13bfd 100644 --- a/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml +++ b/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml @@ -43,9 +43,6 @@ properties: maxItems: 1 description: GPIO pin to enable/disable the device. - vled-supply: -description: LED supply. - '#address-cells': const: 1 -- 2.17.1
AW: [PATCH v1] leds: lp50xx: add setting of default intensity from DT
Hi, sorry to ask but was someone able to look at this? Any thoughts? Best Regards, Sven > -Ursprüngliche Nachricht- > Von: Sven Schuchmann > Gesendet: Dienstag, 19. Januar 2021 11:53 > An: Sven Schuchmann > Cc: Pavel Machek ; Dan Murphy ; Rob Herring > ; linux- > l...@vger.kernel.org; devicet...@vger.kernel.org; linux-kernel@vger.kernel.org > Betreff: [PATCH v1] leds: lp50xx: add setting of default intensity from DT > > In order to use a multicolor-led together with a trigger > from DT the led needs to have an intensity set to see something. > The trigger changes the brightness of the led but if there > is no intensity we actually see nothing. > > This patch adds the ability to set the default intensity > of each led so that it is turned on from DT. > > Signed-off-by: Sven Schuchmann > --- > Documentation/devicetree/bindings/leds/leds-lp50xx.yaml | 8 +++- > drivers/leds/leds-lp50xx.c | 4 > 2 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml > b/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml > index c192b5feadc7..5ad2a0c3c052 100644 > --- a/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml > +++ b/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml > @@ -69,7 +69,12 @@ patternProperties: > patternProperties: >"(^led-[0-9a-f]$|led)": > type: object > -$ref: common.yaml# > +allOf: > + - $ref: common.yaml# > +properties: > + default-intensity: > +maxItems: 1 > +description: The intensity the LED gets initialised with. > > required: >- compatible > @@ -102,6 +107,7 @@ examples: > > led-0 { > color = ; > + default-intensity = <100>; > }; > > led-1 { > diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c > index f13117eed976..ba760fa33bdc 100644 > --- a/drivers/leds/leds-lp50xx.c > +++ b/drivers/leds/leds-lp50xx.c > @@ -501,6 +501,10 @@ static int lp50xx_probe_dt(struct lp50xx *priv) > } > > mc_led_info[num_colors].color_index = color_id; > + > + fwnode_property_read_u32(led_node, "default-intensity", > + > _led_info[num_colors].intensity); > + > num_colors++; > } > > -- > 2.17.1
[PATCH v1] leds: lp50xx: add setting of default intensity from DT
In order to use a multicolor-led together with a trigger from DT the led needs to have an intensity set to see something. The trigger changes the brightness of the led but if there is no intensity we actually see nothing. This patch adds the ability to set the default intensity of each led so that it is turned on from DT. Signed-off-by: Sven Schuchmann --- Documentation/devicetree/bindings/leds/leds-lp50xx.yaml | 8 +++- drivers/leds/leds-lp50xx.c | 4 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml b/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml index c192b5feadc7..5ad2a0c3c052 100644 --- a/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml +++ b/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml @@ -69,7 +69,12 @@ patternProperties: patternProperties: "(^led-[0-9a-f]$|led)": type: object -$ref: common.yaml# +allOf: + - $ref: common.yaml# +properties: + default-intensity: +maxItems: 1 +description: The intensity the LED gets initialised with. required: - compatible @@ -102,6 +107,7 @@ examples: led-0 { color = ; + default-intensity = <100>; }; led-1 { diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c index f13117eed976..ba760fa33bdc 100644 --- a/drivers/leds/leds-lp50xx.c +++ b/drivers/leds/leds-lp50xx.c @@ -501,6 +501,10 @@ static int lp50xx_probe_dt(struct lp50xx *priv) } mc_led_info[num_colors].color_index = color_id; + + fwnode_property_read_u32(led_node, "default-intensity", + _led_info[num_colors].intensity); + num_colors++; } -- 2.17.1
[PATCH] leds: lp50xx: add setting of default intensity from DT
In order to use a multicolor-led together with a trigger the led needs to have an intensity set to see something. The trigger changes the brightness of the led but if there is no intensity we actually see nothing. This patch adds the ability to set the default intensity of each led so that it is turned on from DT. Signed-off-by: Sven Schuchmann --- Documentation/devicetree/bindings/leds/leds-lp50xx.yaml | 6 +- drivers/leds/leds-lp50xx.c | 4 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml b/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml index c192b5feadc7..f810c4e84c44 100644 --- a/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml +++ b/Documentation/devicetree/bindings/leds/leds-lp50xx.yaml @@ -69,7 +69,11 @@ patternProperties: patternProperties: "(^led-[0-9a-f]$|led)": type: object -$ref: common.yaml# +allOf: + - $ref: common.yaml# +properties: + default-intensity: +The intensity the LED get initialised with. required: - compatible diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c index f13117eed976..55b9e0c9e737 100644 --- a/drivers/leds/leds-lp50xx.c +++ b/drivers/leds/leds-lp50xx.c @@ -501,6 +501,10 @@ static int lp50xx_probe_dt(struct lp50xx *priv) } mc_led_info[num_colors].color_index = color_id; + + fwnode_property_read_u32(led_node, "default-intensity", + _led_info[num_colors].intensity); + num_colors++; } -- 2.17.1