2015-07-23 19:52:17

by Bjorn Andersson

[permalink] [raw]
Subject: [PATCH] backlight: pm8941-wled: Add default-brightness property

Add the possibility of specifying the default brightness in DT.

Signed-off-by: Bjorn Andersson <[email protected]>
---

This depends on the patch moving pm8941-wled to backlight [1]. The dt property
is used by several other backlight drivers, so I considered this to be a
"common" property and it's hence not prefixed with "qcom,".

[1] https://lkml.org/lkml/2015/7/21/906

Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt | 1 +
drivers/video/backlight/pm8941-wled.c | 4 ++++
2 files changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
index 424f8444a6cd..37503f8c3620 100644
--- a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
+++ b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
@@ -5,6 +5,7 @@ Required properties:
- reg: slave address

Optional properties:
+- default-brightness: value from: 0-4095
- label: The name of the backlight device
- qcom,cs-out: bool; enable current sink output
- qcom,cabc: bool; enable content adaptive backlight control
diff --git a/drivers/video/backlight/pm8941-wled.c b/drivers/video/backlight/pm8941-wled.c
index c704c3236034..b875e58df0fc 100644
--- a/drivers/video/backlight/pm8941-wled.c
+++ b/drivers/video/backlight/pm8941-wled.c
@@ -373,6 +373,7 @@ static int pm8941_wled_probe(struct platform_device *pdev)
struct backlight_device *bl;
struct pm8941_wled *wled;
struct regmap *regmap;
+ u32 val = 0;
int rc;

regmap = dev_get_regmap(pdev->dev.parent, NULL);
@@ -395,8 +396,11 @@ static int pm8941_wled_probe(struct platform_device *pdev)
if (rc)
return rc;

+ of_property_read_u32(pdev->dev.of_node, "default-brightness", &val);
+
memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_RAW;
+ props.brightness = val;
props.max_brightness = PM8941_WLED_REG_VAL_MAX;
bl = devm_backlight_device_register(&pdev->dev, wled->name,
&pdev->dev, wled,
--
1.8.2.2


2015-07-24 08:22:32

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH] backlight: pm8941-wled: Add default-brightness property

On Thu, 23 Jul 2015, Bjorn Andersson wrote:

> Add the possibility of specifying the default brightness in DT.
>
> Signed-off-by: Bjorn Andersson <[email protected]>
> ---
>
> This depends on the patch moving pm8941-wled to backlight [1]. The dt property
> is used by several other backlight drivers, so I considered this to be a
> "common" property and it's hence not prefixed with "qcom,".
>
> [1] https://lkml.org/lkml/2015/7/21/906
>
> Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt | 1 +

This needs to be in a seperate patch.

> drivers/video/backlight/pm8941-wled.c | 4 ++++

You can't send patches on top of non-existent drivers.

> 2 files changed, 5 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
> index 424f8444a6cd..37503f8c3620 100644
> --- a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
> +++ b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
> @@ -5,6 +5,7 @@ Required properties:
> - reg: slave address
>
> Optional properties:
> +- default-brightness: value from: 0-4095
> - label: The name of the backlight device
> - qcom,cs-out: bool; enable current sink output
> - qcom,cabc: bool; enable content adaptive backlight control
> diff --git a/drivers/video/backlight/pm8941-wled.c b/drivers/video/backlight/pm8941-wled.c
> index c704c3236034..b875e58df0fc 100644
> --- a/drivers/video/backlight/pm8941-wled.c
> +++ b/drivers/video/backlight/pm8941-wled.c
> @@ -373,6 +373,7 @@ static int pm8941_wled_probe(struct platform_device *pdev)
> struct backlight_device *bl;
> struct pm8941_wled *wled;
> struct regmap *regmap;
> + u32 val = 0;
> int rc;
>
> regmap = dev_get_regmap(pdev->dev.parent, NULL);
> @@ -395,8 +396,11 @@ static int pm8941_wled_probe(struct platform_device *pdev)
> if (rc)
> return rc;
>
> + of_property_read_u32(pdev->dev.of_node, "default-brightness", &val);
> +
> memset(&props, 0, sizeof(struct backlight_properties));
> props.type = BACKLIGHT_RAW;
> + props.brightness = val;
> props.max_brightness = PM8941_WLED_REG_VAL_MAX;
> bl = devm_backlight_device_register(&pdev->dev, wled->name,
> &pdev->dev, wled,

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

2015-07-24 13:10:25

by Rob Clark

[permalink] [raw]
Subject: Re: [PATCH] backlight: pm8941-wled: Add default-brightness property

On Thu, Jul 23, 2015 at 3:52 PM, Bjorn Andersson
<[email protected]> wrote:
> Add the possibility of specifying the default brightness in DT.
>
> Signed-off-by: Bjorn Andersson <[email protected]>
> ---
>
> This depends on the patch moving pm8941-wled to backlight [1]. The dt property
> is used by several other backlight drivers, so I considered this to be a
> "common" property and it's hence not prefixed with "qcom,".
>
> [1] https://lkml.org/lkml/2015/7/21/906
>
> Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt | 1 +
> drivers/video/backlight/pm8941-wled.c | 4 ++++
> 2 files changed, 5 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
> index 424f8444a6cd..37503f8c3620 100644
> --- a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
> +++ b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
> @@ -5,6 +5,7 @@ Required properties:
> - reg: slave address
>
> Optional properties:
> +- default-brightness: value from: 0-4095
> - label: The name of the backlight device
> - qcom,cs-out: bool; enable current sink output
> - qcom,cabc: bool; enable content adaptive backlight control
> diff --git a/drivers/video/backlight/pm8941-wled.c b/drivers/video/backlight/pm8941-wled.c
> index c704c3236034..b875e58df0fc 100644
> --- a/drivers/video/backlight/pm8941-wled.c
> +++ b/drivers/video/backlight/pm8941-wled.c
> @@ -373,6 +373,7 @@ static int pm8941_wled_probe(struct platform_device *pdev)
> struct backlight_device *bl;
> struct pm8941_wled *wled;
> struct regmap *regmap;
> + u32 val = 0;
> int rc;

as discussed on IRC, it would be better if the default read back the
current settings (so-as to inherit bootloader splash smoothly..
drm/msm supports a memory-region phandle, for example, so it can take
over the bootloader splash-screen as stolen-mem)

and it would I think be useful to have a comment in the bindings file
explaining that you *should* use the default-brightness property to
set a sane default if bootloader isn't putting up a splash, and you
should *not* use the property if it is..

BR,
-R

> regmap = dev_get_regmap(pdev->dev.parent, NULL);
> @@ -395,8 +396,11 @@ static int pm8941_wled_probe(struct platform_device *pdev)
> if (rc)
> return rc;
>
> + of_property_read_u32(pdev->dev.of_node, "default-brightness", &val);
> +
> memset(&props, 0, sizeof(struct backlight_properties));
> props.type = BACKLIGHT_RAW;
> + props.brightness = val;
> props.max_brightness = PM8941_WLED_REG_VAL_MAX;
> bl = devm_backlight_device_register(&pdev->dev, wled->name,
> &pdev->dev, wled,
> --
> 1.8.2.2
>

2015-07-24 15:29:26

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH] backlight: pm8941-wled: Add default-brightness property

On Thu, Jul 23, 2015 at 2:52 PM, Bjorn Andersson
<[email protected]> wrote:
> Add the possibility of specifying the default brightness in DT.
>
> Signed-off-by: Bjorn Andersson <[email protected]>
> ---
>
> This depends on the patch moving pm8941-wled to backlight [1]. The dt property
> is used by several other backlight drivers, so I considered this to be a
> "common" property and it's hence not prefixed with "qcom,".

Well, we have "default-brightness" and "default-brightness-level" used
by 1 driver each. But default-brightness-level is much more commonly
used (in dts files) since it is in the pwm backlight binding, so we
should go with it. I'd like to see this moved to a common backlight
doc.

Really, I think all the backlight documentation should be merged with
LEDs docs. Things like "default-on" are common. But I won't ask to do
that here.

Rob

>
> [1] https://lkml.org/lkml/2015/7/21/906
>
> Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt | 1 +
> drivers/video/backlight/pm8941-wled.c | 4 ++++
> 2 files changed, 5 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
> index 424f8444a6cd..37503f8c3620 100644
> --- a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
> +++ b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
> @@ -5,6 +5,7 @@ Required properties:
> - reg: slave address
>
> Optional properties:
> +- default-brightness: value from: 0-4095
> - label: The name of the backlight device
> - qcom,cs-out: bool; enable current sink output
> - qcom,cabc: bool; enable content adaptive backlight control
> diff --git a/drivers/video/backlight/pm8941-wled.c b/drivers/video/backlight/pm8941-wled.c
> index c704c3236034..b875e58df0fc 100644
> --- a/drivers/video/backlight/pm8941-wled.c
> +++ b/drivers/video/backlight/pm8941-wled.c
> @@ -373,6 +373,7 @@ static int pm8941_wled_probe(struct platform_device *pdev)
> struct backlight_device *bl;
> struct pm8941_wled *wled;
> struct regmap *regmap;
> + u32 val = 0;
> int rc;
>
> regmap = dev_get_regmap(pdev->dev.parent, NULL);
> @@ -395,8 +396,11 @@ static int pm8941_wled_probe(struct platform_device *pdev)
> if (rc)
> return rc;
>
> + of_property_read_u32(pdev->dev.of_node, "default-brightness", &val);
> +
> memset(&props, 0, sizeof(struct backlight_properties));
> props.type = BACKLIGHT_RAW;
> + props.brightness = val;
> props.max_brightness = PM8941_WLED_REG_VAL_MAX;
> bl = devm_backlight_device_register(&pdev->dev, wled->name,
> &pdev->dev, wled,
> --
> 1.8.2.2
>

2015-07-24 15:39:30

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH] backlight: pm8941-wled: Add default-brightness property

On Fri, Jul 24, 2015 at 8:10 AM, Rob Clark <[email protected]> wrote:
> On Thu, Jul 23, 2015 at 3:52 PM, Bjorn Andersson
> <[email protected]> wrote:
>> Add the possibility of specifying the default brightness in DT.
>>
>> Signed-off-by: Bjorn Andersson <[email protected]>
>> ---
>>
>> This depends on the patch moving pm8941-wled to backlight [1]. The dt property
>> is used by several other backlight drivers, so I considered this to be a
>> "common" property and it's hence not prefixed with "qcom,".
>>
>> [1] https://lkml.org/lkml/2015/7/21/906
>>
>> Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt | 1 +
>> drivers/video/backlight/pm8941-wled.c | 4 ++++
>> 2 files changed, 5 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
>> index 424f8444a6cd..37503f8c3620 100644
>> --- a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
>> +++ b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
>> @@ -5,6 +5,7 @@ Required properties:
>> - reg: slave address
>>
>> Optional properties:
>> +- default-brightness: value from: 0-4095
>> - label: The name of the backlight device
>> - qcom,cs-out: bool; enable current sink output
>> - qcom,cabc: bool; enable content adaptive backlight control
>> diff --git a/drivers/video/backlight/pm8941-wled.c b/drivers/video/backlight/pm8941-wled.c
>> index c704c3236034..b875e58df0fc 100644
>> --- a/drivers/video/backlight/pm8941-wled.c
>> +++ b/drivers/video/backlight/pm8941-wled.c
>> @@ -373,6 +373,7 @@ static int pm8941_wled_probe(struct platform_device *pdev)
>> struct backlight_device *bl;
>> struct pm8941_wled *wled;
>> struct regmap *regmap;
>> + u32 val = 0;
>> int rc;
>
> as discussed on IRC, it would be better if the default read back the
> current settings (so-as to inherit bootloader splash smoothly..
> drm/msm supports a memory-region phandle, for example, so it can take
> over the bootloader splash-screen as stolen-mem)
>
> and it would I think be useful to have a comment in the bindings file
> explaining that you *should* use the default-brightness property to
> set a sane default if bootloader isn't putting up a splash, and you
> should *not* use the property if it is..

+1

What if you have neither? Set to max brightness? 75%?

This could also be used for the bootloader to communicate to the
kernel what the current level is if it is not readable. I've seen one
backlight recently which you change the level by doing some number of
pulses on a gpio and a long pulse to turn off. So there is no way to
know current level without turning off the backlight (unless you
hardcode the bootloader's level in the kernel like the vendor did).

Rob

2015-07-24 17:41:16

by Rob Clark

[permalink] [raw]
Subject: Re: [PATCH] backlight: pm8941-wled: Add default-brightness property

On Fri, Jul 24, 2015 at 11:39 AM, Rob Herring <[email protected]> wrote:
> On Fri, Jul 24, 2015 at 8:10 AM, Rob Clark <[email protected]> wrote:
>> On Thu, Jul 23, 2015 at 3:52 PM, Bjorn Andersson
>> <[email protected]> wrote:
>>> Add the possibility of specifying the default brightness in DT.
>>>
>>> Signed-off-by: Bjorn Andersson <[email protected]>
>>> ---
>>>
>>> This depends on the patch moving pm8941-wled to backlight [1]. The dt property
>>> is used by several other backlight drivers, so I considered this to be a
>>> "common" property and it's hence not prefixed with "qcom,".
>>>
>>> [1] https://lkml.org/lkml/2015/7/21/906
>>>
>>> Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt | 1 +
>>> drivers/video/backlight/pm8941-wled.c | 4 ++++
>>> 2 files changed, 5 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
>>> index 424f8444a6cd..37503f8c3620 100644
>>> --- a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
>>> +++ b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
>>> @@ -5,6 +5,7 @@ Required properties:
>>> - reg: slave address
>>>
>>> Optional properties:
>>> +- default-brightness: value from: 0-4095
>>> - label: The name of the backlight device
>>> - qcom,cs-out: bool; enable current sink output
>>> - qcom,cabc: bool; enable content adaptive backlight control
>>> diff --git a/drivers/video/backlight/pm8941-wled.c b/drivers/video/backlight/pm8941-wled.c
>>> index c704c3236034..b875e58df0fc 100644
>>> --- a/drivers/video/backlight/pm8941-wled.c
>>> +++ b/drivers/video/backlight/pm8941-wled.c
>>> @@ -373,6 +373,7 @@ static int pm8941_wled_probe(struct platform_device *pdev)
>>> struct backlight_device *bl;
>>> struct pm8941_wled *wled;
>>> struct regmap *regmap;
>>> + u32 val = 0;
>>> int rc;
>>
>> as discussed on IRC, it would be better if the default read back the
>> current settings (so-as to inherit bootloader splash smoothly..
>> drm/msm supports a memory-region phandle, for example, so it can take
>> over the bootloader splash-screen as stolen-mem)
>>
>> and it would I think be useful to have a comment in the bindings file
>> explaining that you *should* use the default-brightness property to
>> set a sane default if bootloader isn't putting up a splash, and you
>> should *not* use the property if it is..
>
> +1
>
> What if you have neither? Set to max brightness? 75%?

I did chat w/ Bjorn a bit about that on irc.. his concern was some
arbitrary percentage (like 50%) might be more or less bright depending
on the device (although that implies to me that maybe we should have
min and max bindings as well, rather than just assuming hw limits?
idk)

my preference is the default is somehow at least not 0%.. possibly
motivated by the expectation that when people see a dark screen at
boot they assume the display driver is broken :-P

BR,
-R

> This could also be used for the bootloader to communicate to the
> kernel what the current level is if it is not readable. I've seen one
> backlight recently which you change the level by doing some number of
> pulses on a gpio and a long pulse to turn off. So there is no way to
> know current level without turning off the backlight (unless you
> hardcode the bootloader's level in the kernel like the vendor did).
>
> Rob

2015-07-29 22:37:23

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH] backlight: pm8941-wled: Add default-brightness property

On Fri 24 Jul 10:41 PDT 2015, Rob Clark wrote:

> On Fri, Jul 24, 2015 at 11:39 AM, Rob Herring <[email protected]> wrote:
> > On Fri, Jul 24, 2015 at 8:10 AM, Rob Clark <[email protected]> wrote:
> >> On Thu, Jul 23, 2015 at 3:52 PM, Bjorn Andersson
> >> <[email protected]> wrote:
> >>> Add the possibility of specifying the default brightness in DT.
> >>>
> >>> Signed-off-by: Bjorn Andersson <[email protected]>
> >>> ---
> >>>
> >>> This depends on the patch moving pm8941-wled to backlight [1]. The dt property
> >>> is used by several other backlight drivers, so I considered this to be a
> >>> "common" property and it's hence not prefixed with "qcom,".
> >>>
> >>> [1] https://lkml.org/lkml/2015/7/21/906
> >>>
> >>> Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt | 1 +
> >>> drivers/video/backlight/pm8941-wled.c | 4 ++++
> >>> 2 files changed, 5 insertions(+)
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
> >>> index 424f8444a6cd..37503f8c3620 100644
> >>> --- a/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
> >>> +++ b/Documentation/devicetree/bindings/video/backlight/pm8941-wled.txt
> >>> @@ -5,6 +5,7 @@ Required properties:
> >>> - reg: slave address
> >>>
> >>> Optional properties:
> >>> +- default-brightness: value from: 0-4095
> >>> - label: The name of the backlight device
> >>> - qcom,cs-out: bool; enable current sink output
> >>> - qcom,cabc: bool; enable content adaptive backlight control
> >>> diff --git a/drivers/video/backlight/pm8941-wled.c b/drivers/video/backlight/pm8941-wled.c
> >>> index c704c3236034..b875e58df0fc 100644
> >>> --- a/drivers/video/backlight/pm8941-wled.c
> >>> +++ b/drivers/video/backlight/pm8941-wled.c
> >>> @@ -373,6 +373,7 @@ static int pm8941_wled_probe(struct platform_device *pdev)
> >>> struct backlight_device *bl;
> >>> struct pm8941_wled *wled;
> >>> struct regmap *regmap;
> >>> + u32 val = 0;
> >>> int rc;
> >>
> >> as discussed on IRC, it would be better if the default read back the
> >> current settings (so-as to inherit bootloader splash smoothly..
> >> drm/msm supports a memory-region phandle, for example, so it can take
> >> over the bootloader splash-screen as stolen-mem)
> >>
> >> and it would I think be useful to have a comment in the bindings file
> >> explaining that you *should* use the default-brightness property to
> >> set a sane default if bootloader isn't putting up a splash, and you
> >> should *not* use the property if it is..
> >
> > +1
> >
> > What if you have neither? Set to max brightness? 75%?
>
> I did chat w/ Bjorn a bit about that on irc.. his concern was some
> arbitrary percentage (like 50%) might be more or less bright depending
> on the device (although that implies to me that maybe we should have
> min and max bindings as well, rather than just assuming hw limits?
> idk)
>

But this issue could easily be solved by having the boot loader pass an
appropriate value to the kernel through the dt property, overriding any
default from the implementation.

Or in the case when the boot does not touch the backlight the dt writer
still have the possibility of picking a better value.

> my preference is the default is somehow at least not 0%.. possibly
> motivated by the expectation that when people see a dark screen at
> boot they assume the display driver is broken :-P
>

Right

> > This could also be used for the bootloader to communicate to the
> > kernel what the current level is if it is not readable. I've seen one
> > backlight recently which you change the level by doing some number of
> > pulses on a gpio and a long pulse to turn off. So there is no way to
> > know current level without turning off the backlight (unless you
> > hardcode the bootloader's level in the kernel like the vendor did).
> >

Right and even in the case of this driver I feel it's just adding
accidental complexity.


50% would solve Rob's problem and we're through the dt property
providing the necessary means of changing this, either to match boot
loader set levels or developers preferences.

I'll rephrase the binding document and update the driver.

Regards,
Bjorn

2015-07-29 23:51:46

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH] backlight: pm8941-wled: Add default-brightness property

On Fri 24 Jul 08:29 PDT 2015, Rob Herring wrote:

> On Thu, Jul 23, 2015 at 2:52 PM, Bjorn Andersson
> <[email protected]> wrote:
> > Add the possibility of specifying the default brightness in DT.
> >
> > Signed-off-by: Bjorn Andersson <[email protected]>
> > ---
> >
> > This depends on the patch moving pm8941-wled to backlight [1]. The dt property
> > is used by several other backlight drivers, so I considered this to be a
> > "common" property and it's hence not prefixed with "qcom,".
>
> Well, we have "default-brightness" and "default-brightness-level" used
> by 1 driver each. But default-brightness-level is much more commonly
> used (in dts files) since it is in the pwm backlight binding, so we
> should go with it. I'd like to see this moved to a common backlight
> doc.
>

As I looked at these, the default-brightness used in tps65217 is a value
between 0 and 100, so that can be interpreted as a percentage.

The pwm binding however uses a separate array of "brightness-levels" and
then default-brightness-level is supposed to be an index into that
array.


As we're trying to specify a default brightness within the range [0,
max_brightness) the latter doesn't make much sense.

Therefor my suggestion is that we make the "default-brightness" the
common property and we define it as a percentage of [0,max_brightness).

> Really, I think all the backlight documentation should be merged with
> LEDs docs. Things like "default-on" are common. But I won't ask to do
> that here.

I think the backlight framework should be merged with the LED framework.
There's several hw blocks that are split between the two, with an mfd
tying them together...

Regards,
Bjorn

2015-07-30 15:26:41

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH] backlight: pm8941-wled: Add default-brightness property

On Wed, Jul 29, 2015 at 6:51 PM, Bjorn Andersson
<[email protected]> wrote:
> On Fri 24 Jul 08:29 PDT 2015, Rob Herring wrote:
>
>> On Thu, Jul 23, 2015 at 2:52 PM, Bjorn Andersson
>> <[email protected]> wrote:
>> > Add the possibility of specifying the default brightness in DT.
>> >
>> > Signed-off-by: Bjorn Andersson <[email protected]>
>> > ---
>> >
>> > This depends on the patch moving pm8941-wled to backlight [1]. The dt property
>> > is used by several other backlight drivers, so I considered this to be a
>> > "common" property and it's hence not prefixed with "qcom,".
>>
>> Well, we have "default-brightness" and "default-brightness-level" used
>> by 1 driver each. But default-brightness-level is much more commonly
>> used (in dts files) since it is in the pwm backlight binding, so we
>> should go with it. I'd like to see this moved to a common backlight
>> doc.
>>
>
> As I looked at these, the default-brightness used in tps65217 is a value
> between 0 and 100, so that can be interpreted as a percentage.
>
> The pwm binding however uses a separate array of "brightness-levels" and
> then default-brightness-level is supposed to be an index into that
> array.

Uggg. I missed that minor detail...


> As we're trying to specify a default brightness within the range [0,
> max_brightness) the latter doesn't make much sense.
>
> Therefor my suggestion is that we make the "default-brightness" the
> common property and we define it as a percentage of [0,max_brightness).

Okay.

I wonder if we should have units such as
"default-brightness-percentage" or "default-brightness-%" so it is
clear. Otherwise, we might have some people doing a range of [0,max].
The former is a bit long and the latter is a bit unusual.

>> Really, I think all the backlight documentation should be merged with
>> LEDs docs. Things like "default-on" are common. But I won't ask to do
>> that here.
>
> I think the backlight framework should be merged with the LED framework.
> There's several hw blocks that are split between the two, with an mfd
> tying them together...

Fully agree. BTW, doing that doesn't have to be in sync between the
bindings and drivers. Of course, if we've designed the bindings with
sub devices to fit the MFD structure, then that is another problem.

Rob

2015-07-30 16:44:42

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH] backlight: pm8941-wled: Add default-brightness property

On Thu 30 Jul 08:26 PDT 2015, Rob Herring wrote:

> On Wed, Jul 29, 2015 at 6:51 PM, Bjorn Andersson
> <[email protected]> wrote:
> > On Fri 24 Jul 08:29 PDT 2015, Rob Herring wrote:
[..]
> > As we're trying to specify a default brightness within the range [0,
> > max_brightness) the latter doesn't make much sense.
> >
> > Therefor my suggestion is that we make the "default-brightness" the
> > common property and we define it as a percentage of [0,max_brightness).
>
> Okay.
>
> I wonder if we should have units such as
> "default-brightness-percentage" or "default-brightness-%" so it is
> clear. Otherwise, we might have some people doing a range of [0,max].
> The former is a bit long and the latter is a bit unusual.
>

I discussed this further with my colleague and gave it some though over
the night;

If the boot loader sets the brightness, it would need to convert this to
a percentage just to have the kernel convert it back - with a expected
lack of precision (especially w/ non-linear brightness ranges or odd
step-sizes).

In the case where it's manually tweaked by the developer he/she would
most likely modify the brightness through sysfs until a reasonable value
is found; and we have that extra step again of converting this to a
percentage.


Therefor I think it's better to just specify this in "units of
brightness" - which would be a unit-less property.

Regards,
Bjorn