backlight: gpio_backlight: add new property default-brightness-level
Subsystems (4)
PATCH 1/2 backlight: gpio_backlight: add new property default-brightness-level
From: Yannick Fertre <[email protected]>
Add new property to set a brightness by default at probe.
---
Link to original patch:
https://github.com/STMicroelectronics/linux/commit/c4067d7bd883c6fa14ffd49892c4ce663cdafe98
drivers/video/backlight/gpio_backlight.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/video/backlight/gpio_backlight.c +6 -1
@@ -53,6 +53,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)struct backlight_device *bl;struct gpio_backlight *gbl;int ret, init_brightness, def_value; +u32 value; gbl =devm_kzalloc (dev,sizeof (*gbl),GFP_KERNEL );if (gbl ==NULL )
@@ -93,7 +94,11 @@ static int gpio_backlight_probe(struct platform_device *pdev)else bl->props.power =FB_BLANK_UNBLANK ; - bl->props.brightness =1 ; + ret =device_property_read_u32 (dev,"default-brightness-level" , &value); +if (!ret && value <= props.max_brightness) + bl->props.brightness = value; +else + bl->props.brightness =1 ; init_brightness =backlight_get_brightness (bl); ret =gpiod_direction_output (gbl->gpiod, init_brightness);
Signature · 1 line
2.40.1
PATCH 2/2 dt-bindings: backlight: document new property default-brightness-level
From: Yannick Fertre <[email protected]>
Add documentation for new default-brightness-level property.
---
Link to original patch:
https://github.com/STMicroelectronics/linux/commit/c4067d7bd883c6fa14ffd49892c4ce663cdafe98
.../bindings/leds/backlight/gpio-backlight.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml +9 -0
@@ -23,6 +23,15 @@ properties: description: enable the backlight at boot. type: boolean + default-brightness-level: + description: + The default brightness level (index into the array defined by the + "brightness-levels" property). + $ref: /schemas/types.yaml#/definitions/uint32 + +dependencies: + default-brightness-level: [ "brightness-levels" ] + required: - compatible - gpios
Signature · 1 line
2.40.1
Re: [PATCH 2/2] dt-bindings: backlight: document new property default-brightness-level
Quoted 20 lines · Alexandru Ardelean
From: Yannick Fertre <[email protected]>
Add documentation for new default-brightness-level property.
Reviewed-by Philippe CORNU <[email protected]>Signed-off-by Yannick Fertre <[email protected]>Signed-off-by Alexandru Ardelean <[email protected]>---
Link to original patch:
https://github.com/STMicroelectronics/linux/commit/c4067d7bd883c6fa14ffd49892c4ce663cdafe98.../bindings/leds/backlight/gpio-backlight.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml +0
-0
Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml properties: · line 29
Quoted 7 lines
Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml +4
-0@@ -23,6 +23,15 @@ properties: description: enable the backlight at boot. type: boolean + default-brightness-level: + description: + The default brightness level (index into the array defined by the + "brightness-levels" property).
gpio-backlight does not have a brightness-levels array property!
I think it is also necessary to improve the docs of both properties to distinguish between the meaning of default-on and default-brightness-level. The result of setting default-on and default-brightness level to zero is that the GPIO will be off (this is correct behaviour but hard to figure out from the current text).
default-on is a control that can "enable" the backlight at boot when it is not linked to a display in the DT (e.g. it is mostly for legacy cases). When the backlight is linked to a display then the backlight enable state will be automatically linked to the display enable state instead.
default-brightness-level is useful for handling displays that are still readable with the backlight off (e-ink, reflective/ transflexive LCD, etc), otherwise is should be absent or set to 1.
Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml properties: · line 33
Quoted 4 lines
Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml +4
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + +dependencies: + default-brightness-level: [ "brightness-levels" ]
As above, depending on brightness-levels doesn't make any sense here.
Daniel.
Re: [PATCH 2/2] dt-bindings: backlight: document new property default-brightness-level
Quoted 44 lines · Daniel Thompson
Quoted 20 lines · Alexandru Ardelean
From: Yannick Fertre <[email protected]>
Add documentation for new default-brightness-level property.
Reviewed-by Philippe CORNU <[email protected]>Signed-off-by Yannick Fertre <[email protected]>Signed-off-by Alexandru Ardelean <[email protected]>---
Link to original patch:
https://github.com/STMicroelectronics/linux/commit/c4067d7bd883c6fa14ffd49892c4ce663cdafe98.../bindings/leds/backlight/gpio-backlight.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml +0
-0Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml properties: · line 29
Quoted 7 lines
Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml +4
-0@@ -23,6 +23,15 @@ properties: description: enable the backlight at boot. type: boolean + default-brightness-level: + description: + The default brightness level (index into the array defined by the + "brightness-levels" property).gpio-backlight does not have a brightness-levels array property!
I think it is also necessary to improve the docs of both properties to distinguish between the meaning of default-on and default-brightness-level. The result of setting default-on and default-brightness level to zero is that the GPIO will be off (this is correct behaviour but hard to figure out from the current text).
default-on is a control that can "enable" the backlight at boot when it is not linked to a display in the DT (e.g. it is mostly for legacy cases). When the backlight is linked to a display then the backlight enable state will be automatically linked to the display enable state instead.
Quoted 3 lines
default-brightness-level is useful for handling displays that are still readable with the backlight off (e-ink, reflective/ transflexive LCD, etc), otherwise is should be absent or set to 1.
ack
will do in V2
thanks
Quoted 11 lines
Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml properties: · line 33
Quoted 6 lines
Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml +4
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + +dependencies: + default-brightness-level: [ "brightness-levels" ]As above, depending on brightness-levels doesn't make any sense here.
Daniel.
Re: [PATCH 2/2] dt-bindings: backlight: document new property default-brightness-level
In reply to Alexandru ArdeleanQuoted 5 lines · Alexandru Ardelean
From: Yannick Fertre <[email protected]>
Add documentation for new default-brightness-level property.
Reviewed-by Philippe CORNU <[email protected]>
Hi Alexandru,
same comments as for the 1/2 patch.
Many thanks
Philippe :-)
Quoted 30 lines
Signed-off-by Yannick Fertre <[email protected]>Signed-off-by Alexandru Ardelean <[email protected]>---
Link to original patch:
https://github.com/STMicroelectronics/linux/commit/c4067d7bd883c6fa14ffd49892c4ce663cdafe98.../bindings/leds/backlight/gpio-backlight.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml +9
-0@@ -23,6 +23,15 @@ properties: description: enable the backlight at boot. type: boolean + default-brightness-level: + description: + The default brightness level (index into the array defined by the + "brightness-levels" property). + $ref: /schemas/types.yaml#/definitions/uint32 + +dependencies: + default-brightness-level: [ "brightness-levels" ] + required: - compatible - gpios
Re: [PATCH 2/2] dt-bindings: backlight: document new property default-brightness-level
Quoted 4 lines · Philippe CORNU
On 5/19/23 22:05, Alexandru Ardelean wrote:
Quoted 8 lines
Quoted 5 lines
From: Yannick Fertre <[email protected]>
Add documentation for new default-brightness-level property.
Reviewed-by Philippe CORNU <[email protected]>Hi Alexandru,
same comments as for the 1/2 patch.
Ack
Will do
Thanks
Alexandru
Quoted 33 lines
Many thanks
Philippe :-)Quoted 30 lines
Signed-off-by Yannick Fertre <[email protected]>Signed-off-by Alexandru Ardelean <[email protected]>---
Link to original patch:
https://github.com/STMicroelectronics/linux/commit/c4067d7bd883c6fa14ffd49892c4ce663cdafe98.../bindings/leds/backlight/gpio-backlight.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml +9
-0@@ -23,6 +23,15 @@ properties: description: enable the backlight at boot. type: boolean + default-brightness-level: + description: + The default brightness level (index into the array defined by the + "brightness-levels" property). + $ref: /schemas/types.yaml#/definitions/uint32 + +dependencies: + default-brightness-level: [ "brightness-levels" ] + required: - compatible - gpios
Quoted 7 lines · Alexandru Ardelean
From: Yannick Fertre <[email protected]>
Add new property to set a brightness by default at probe.
Reviewed-by Philippe CORNU <[email protected]>Signed-off-by Yannick Fertre <[email protected]>Signed-off-by Alexandru Ardelean <[email protected]>
Patch order should be reversed for v2. Nevertheless:
Daniel.
Quoted 23 lines
drivers/video/backlight/gpio_backlight.c +6
-2struct backlight_device *bl;struct gpio_backlight *gbl;int ret, init_brightness, def_value; +u32 value; gbl =devm_kzalloc (dev,sizeof (*gbl),GFP_KERNEL );if (gbl ==NULL )@@ -93,7 +94,11 @@ static int gpio_backlight_probe(struct platform_device *pdev)else bl->props.power =FB_BLANK_UNBLANK ; - bl->props.brightness =1 ; + ret =device_property_read_u32 (dev,"default-brightness-level" , &value); +if (!ret && value <= props.max_brightness) + bl->props.brightness = value; +else + bl->props.brightness =1 ; init_brightness =backlight_get_brightness (bl); ret =gpiod_direction_output (gbl->gpiod, init_brightness); --2.40.1
Quoted 5 lines · Alexandru Ardelean
From: Yannick Fertre <[email protected]>
Add new property to set a brightness by default at probe.
Reviewed-by Philippe CORNU <[email protected]>
Hi Alexandru,
Many thanks for your patch.
You have sent a patch originally pushed on the STMicroelectronics github as mentioned in your commit message (no problem with that :-). But, the "Reviewed-by" inside this github patch is linked to our gerrit STM internal server so you can not use it directly for mainlining this patch.
So please, re-send your this patch without my "Reviewed-by".
Many thanks
Philippe :-)
Quoted 35 lines
Signed-off-by Yannick Fertre <[email protected]>Signed-off-by Alexandru Ardelean <[email protected]>---
Link to original patch:
https://github.com/STMicroelectronics/linux/commit/c4067d7bd883c6fa14ffd49892c4ce663cdafe98drivers/video/backlight/gpio_backlight.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/video/backlight/gpio_backlight.c +6
-1@@ -53,6 +53,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)struct backlight_device *bl;struct gpio_backlight *gbl;int ret, init_brightness, def_value; +u32 value; gbl =devm_kzalloc (dev,sizeof (*gbl),GFP_KERNEL );if (gbl ==NULL )@@ -93,7 +94,11 @@ static int gpio_backlight_probe(struct platform_device *pdev)else bl->props.power =FB_BLANK_UNBLANK ; - bl->props.brightness =1 ; + ret =device_property_read_u32 (dev,"default-brightness-level" , &value); +if (!ret && value <= props.max_brightness) + bl->props.brightness = value; +else + bl->props.brightness =1 ; init_brightness =backlight_get_brightness (bl); ret =gpiod_direction_output (gbl->gpiod, init_brightness);
Quoted 11 lines · Philippe CORNU
Quoted 5 lines · Alexandru Ardelean
From: Yannick Fertre <[email protected]>
Add new property to set a brightness by default at probe.
Reviewed-by Philippe CORNU <[email protected]>Hi Alexandru,
Quoted 8 lines
Many thanks for your patch.
You have sent a patch originally pushed on the STMicroelectronics github as mentioned in your commit message (no problem with that :-). But, the "Reviewed-by" inside this github patch is linked to our gerrit STM internal server so you can not use it directly for mainlining this patch.
So please, re-send your this patch without my "Reviewed-by".
ack
will do
Quoted 40 lines
Many thanks
Philippe :-)Quoted 35 lines
Signed-off-by Yannick Fertre <[email protected]>Signed-off-by Alexandru Ardelean <[email protected]>---
Link to original patch:
https://github.com/STMicroelectronics/linux/commit/c4067d7bd883c6fa14ffd49892c4ce663cdafe98drivers/video/backlight/gpio_backlight.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/video/backlight/gpio_backlight.c +6
-1@@ -53,6 +53,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)struct backlight_device *bl;struct gpio_backlight *gbl;int ret, init_brightness, def_value; +u32 value; gbl =devm_kzalloc (dev,sizeof (*gbl),GFP_KERNEL );if (gbl ==NULL )@@ -93,7 +94,11 @@ static int gpio_backlight_probe(struct platform_device *pdev)else bl->props.power =FB_BLANK_UNBLANK ; - bl->props.brightness =1 ; + ret =device_property_read_u32 (dev,"default-brightness-level" , &value); +if (!ret && value <= props.max_brightness) + bl->props.brightness = value; +else + bl->props.brightness =1 ; init_brightness =backlight_get_brightness (bl); ret =gpiod_direction_output (gbl->gpiod, init_brightness);