backlight: Drop use of deprecated fb_blank property
Subsystems (13)
cover backlight: Drop use of deprecated fb_blank property
This series refactor backlight users to avoid use of the deprecated backlight_properties.fb_blank member.
Stephen Kitt <[email protected]> and others already did a lot of work and this is the final touches.
Patches 1-13 are independent and can be applied individually. Patch 14 was already sent by Stephen and included here to make the series complete.
The last patch may have to wait to avoid breaking the build as it depends on all the other patches.
The series touches several sub-systems, so with acks I could take them all in drm-misc. Or we can let the subsystems take them and wait until next merge window with the final removal. As new users of fb_blank do not pop up that often, waiting one merge cycle is fine.
Sam
To: Nicolas Ferre <[email protected]>
To: Helge Deller <[email protected]>
To: Alexandre Belloni <[email protected]>
To: Claudiu Beznea <[email protected]>
To: Antonino Daplas <[email protected]>
To: Benjamin Herrenschmidt <[email protected]>
To: Paul Mackerras <[email protected]>
To: Greg Kroah-Hartman <[email protected]>
To: Robin van der Gracht <[email protected]>
To: Miguel Ojeda <[email protected]>
To: Lee Jones <[email protected]>
To: Daniel Thompson <[email protected]>
To: Jingoo Han <[email protected]>
---
Sam Ravnborg (14):
video: fbdev: atmel_lcdfb: Rework backlight handling
video: fbdev: atyfb: Introduce backlight_get_brightness()
video: fbdev: nvidia: Introduce backlight_get_brightness()
video: fbdev: radeon: Introduce backlight_get_brightness()
video: fbdev: riva: Introduce backlight_get_brightness()
video: fbdev: aty128fb: Introduce backlight_get_brightness()
video: fbdev: mx3fb: Introduce backlight_get_brightness()
video: fbdev: omap2: Introduce backlight_get_brightness()
staging: fbtft: fb_ssd1351.c: Introduce backlight_is_blank()
staging: fbtft: core: Introduce backlight_is_blank()
powerpc: via-pmu-backlight: Introduce backlight_get_brightness()
auxdisplay: ht16k33: Introduce backlight_get_brightness()
backlight: omap1: Use backlight helpers
backlight: backlight: Drop the deprecated fb_blank property
Stephen Kitt (1):
backlight: tosa: Use backlight helper
drivers/auxdisplay/ht16k33.c | 7 +-- drivers/macintosh/via-pmu-backlight.c | 7 +-- drivers/staging/fbtft/fb_ssd1351.c | 9 +-- drivers/staging/fbtft/fbtft-core.c | 12 ++-- drivers/video/backlight/backlight.c | 2 - drivers/video/backlight/omap1_bl.c | 67 +++------------------- drivers/video/backlight/tosa_bl.c | 7 +-- drivers/video/fbdev/atmel_lcdfb.c | 24 +------- drivers/video/fbdev/aty/aty128fb.c | 11 +--- drivers/video/fbdev/aty/atyfb_base.c | 8 +-- drivers/video/fbdev/aty/radeon_backlight.c | 10 +--- drivers/video/fbdev/mx3fb.c | 8 +-- drivers/video/fbdev/nvidia/nv_backlight.c | 8 +-- .../fbdev/omap2/omapfb/displays/panel-dsi-cm.c | 19 +----- .../omap2/omapfb/displays/panel-sony-acx565akm.c | 23 +++----- drivers/video/fbdev/riva/fbdev.c | 8 +-- include/linux/backlight.h | 22 ------- 17 files changed, 41 insertions(+), 211 deletions(-)
---
base-commit: a53be8dae86fe5d3567db245177e814e58210632
change-id: 20230107-sam-video-backlight-drop-fb_blank-d6feb73572ff
Best regards,
Signature · 1 line
Sam Ravnborg <[email protected]>
PATCH 1/15 video: fbdev: atmel_lcdfb: Rework backlight handling
The atmel_lcdfb had code to save/restore power state. This is not needed so drop it.
Introduce backlight_is_brightness() to make logic simpler.
--- drivers/video/fbdev/atmel_lcdfb.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-)
drivers/video/fbdev/atmel_lcdfb.c +3 -21
@@ -49,7 +49,6 @@ struct atmel_lcdfb_info {struct clk *lcdc_clk;struct backlight_device *backlight; -u8 bl_power;u8 saved_lcdcon;u32 pseudo_palette[16 ];
@@ -109,32 +108,18 @@ static u32 contrast_ctr = ATMEL_LCDC_PS_DIV8static int atmel_bl_update_status (struct backlight_device *bl) {struct atmel_lcdfb_info *sinfo =bl_get_data (bl); -int power = sinfo->bl_power; -int brightness = bl->props.brightness; +int brightness; -/* REVISIT there may be a meaningful difference between -* fb_blank and power ... there seem to be some cases -* this doesn't handle correctly. -*/ -if (bl->props.fb_blank != sinfo->bl_power) - power = bl->props.fb_blank; -else if (bl->props.power != sinfo->bl_power) - power = bl->props.power; - -if (brightness <0 && power ==FB_BLANK_UNBLANK ) - brightness =lcdc_readl (sinfo,ATMEL_LCDC_CONTRAST_VAL ); -else if (power !=FB_BLANK_UNBLANK ) - brightness =0 ; + brightness =backlight_get_brightness (bl);lcdc_writel (sinfo,ATMEL_LCDC_CONTRAST_VAL , brightness); +if (contrast_ctr &ATMEL_LCDC_POL_POSITIVE )lcdc_writel (sinfo,ATMEL_LCDC_CONTRAST_CTR , brightness ? contrast_ctr :0 );else lcdc_writel (sinfo,ATMEL_LCDC_CONTRAST_CTR , contrast_ctr); - bl->props.fb_blank = bl->props.power = sinfo->bl_power = power; -return 0 ; }
@@ -155,8 +140,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo)struct backlight_properties props;struct backlight_device *bl; - sinfo->bl_power =FB_BLANK_UNBLANK ; -if (sinfo->backlight)return ;
@@ -173,7 +156,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo) sinfo->backlight = bl; bl->props.power =FB_BLANK_UNBLANK ; - bl->props.fb_blank =FB_BLANK_UNBLANK ; bl->props.brightness =atmel_bl_get_brightness (bl); }
Signature · 1 line
2.34.1
Re: [PATCH 01/15] video: fbdev: atmel_lcdfb: Rework backlight handling
Quoted 76 lines · On 7 January 2023 19:26:15 CET, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
The
atmel_lcdfbhad code to save/restore power state. This is not needed so drop it.Introduce
backlight_is_brightness()to make logic simpler.Signed-off-by Sam Ravnborg <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>---
drivers/video/fbdev/atmel_lcdfb.c| 24 +++---------------------1 file changed, 3 insertions(+), 21 deletions(-)drivers/video/fbdev/atmel_lcdfb.c +3
-20@@ -49,7 +49,6 @@ struct atmel_lcdfb_info {struct clk *lcdc_clk;struct backlight_device *backlight; -u8 bl_power;u8 saved_lcdcon;u32 pseudo_palette[16 ];@@ -109,32 +108,18 @@ static u32 contrast_ctr = ATMEL_LCDC_PS_DIV8static int atmel_bl_update_status (struct backlight_device *bl) {struct atmel_lcdfb_info *sinfo =bl_get_data (bl); -int power = sinfo->bl_power; -int brightness = bl->props.brightness; +int brightness; -/* REVISIT there may be a meaningful difference between -* fb_blank and power ... there seem to be some cases -* this doesn't handle correctly. -*/ -if (bl->props.fb_blank != sinfo->bl_power) - power = bl->props.fb_blank; -else if (bl->props.power != sinfo->bl_power) - power = bl->props.power; - -if (brightness <0 && power ==FB_BLANK_UNBLANK ) - brightness =lcdc_readl (sinfo,ATMEL_LCDC_CONTRAST_VAL ); -else if (power !=FB_BLANK_UNBLANK ) - brightness =0 ; + brightness =backlight_get_brightness (bl);lcdc_writel (sinfo,ATMEL_LCDC_CONTRAST_VAL , brightness); +if (contrast_ctr &ATMEL_LCDC_POL_POSITIVE )lcdc_writel (sinfo,ATMEL_LCDC_CONTRAST_CTR , brightness ? contrast_ctr :0 );else lcdc_writel (sinfo,ATMEL_LCDC_CONTRAST_CTR , contrast_ctr); - bl->props.fb_blank = bl->props.power = sinfo->bl_power = power; -return 0 ; }@@ -155,8 +140,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo)struct backlight_properties props;struct backlight_device *bl; - sinfo->bl_power =FB_BLANK_UNBLANK ; -if (sinfo->backlight)return ;
drivers/video/fbdev/atmel_lcdfb.c static void init_backlight(struct atmel_lcdfb_info *sinfo) · line 161
Quoted 7 lines
drivers/video/fbdev/atmel_lcdfb.c +0
-1@@ -173,7 +156,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo) sinfo->backlight = bl; bl->props.power =FB_BLANK_UNBLANK ; - bl->props.fb_blank =FB_BLANK_UNBLANK ; bl->props.brightness =atmel_bl_get_brightness (bl); }
Hi Sam,
I’d submitted quite a few more of these previously (and you’d reviewed them), see e.g. the thread starting at https://lkml.org/lkml/2022/6/7/4365, and yesterday, https://lkml.org/lkml/2023/1/6/520, https://lkml.org/lkml/2023/1/6/656, https://lkml.org/lkml/2023/1/6/970, https://lkml.org/lkml/2023/1/6/643, and https://lkml.org/lkml/2023/1/6/680. There are a few more, I can find them if it’s any use.
Regards,
Stephen
Re: [PATCH 01/15] video: fbdev: atmel_lcdfb: Rework backlight handling
Hi Stephen.
Quoted 17 lines · Stephen Kitt
Quoted 16 lines · On 7 January 2023 19:26:15 CET, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
The
atmel_lcdfbhad code to save/restore power state. This is not needed so drop it.Introduce
backlight_is_brightness()to make logic simpler.Signed-off-by Sam Ravnborg <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>---
drivers/video/fbdev/atmel_lcdfb.c| 24 +++---------------------1 file changed, 3 insertions(+), 21 deletions(-)
...
Quoted 4 lines
Hi Sam,
I’d submitted quite a few more of these previously (and you’d reviewed them), see e.g. the thread starting at https://lkml.org/lkml/2022/6/7/4365, and yesterday, https://lkml.org/lkml/2023/1/6/520, https://lkml.org/lkml/2023/1/6/656, https://lkml.org/lkml/2023/1/6/970, https://lkml.org/lkml/2023/1/6/643, and https://lkml.org/lkml/2023/1/6/680. There are a few more, I can find them if it’s any use.
The patches from yesterday was what triggered me to resurrect an old branch of mine where I had done something similar. I had lost all memory of reviewing similar patches from you.
Helge - could you pick the reviewed patches from:
https://lore.kernel.org/all/[email protected]/
[This is the same mail as Stephen refer to above - looked up via lore].
Stephen - I expect Daniel/Lee to take care of the patches from yesterday. If you can look up other pending patches from you please do so, so we can have them applied.
Preferably with links to lore - as this makes it easier to apply them.
Review of what is unique in this set would be appreciated.
Sam
Re: [PATCH 01/15] video: fbdev: atmel_lcdfb: Rework backlight handling
Quoted 35 lines · Sam Ravnborg
Hi Stephen.
Quoted 17 lines · Stephen Kitt
Quoted 16 lines · On 7 January 2023 19:26:15 CET, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
The
atmel_lcdfbhad code to save/restore power state. This is not needed so drop it.Introduce
backlight_is_brightness()to make logic simpler.Signed-off-by Sam Ravnborg <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>---
drivers/video/fbdev/atmel_lcdfb.c| 24 +++---------------------1 file changed, 3 insertions(+), 21 deletions(-)...
Quoted 4 lines
Hi Sam,
I’d submitted quite a few more of these previously (and you’d reviewed them), see e.g. the thread starting at https://lkml.org/lkml/2022/6/7/4365, and yesterday, https://lkml.org/lkml/2023/1/6/520, https://lkml.org/lkml/2023/1/6/656, https://lkml.org/lkml/2023/1/6/970, https://lkml.org/lkml/2023/1/6/643, and https://lkml.org/lkml/2023/1/6/680. There are a few more, I can find them if it’s any use.
The patches from yesterday was what triggered me to resurrect an old branch of mine where I had done something similar. I had lost all memory of reviewing similar patches from you.
Helge - could you pick the reviewed patches from:
https://lore.kernel.org/all/[email protected]/
[This is the same mail as Stephen refer to above - looked up via lore].
Quoted 8 lines
Stephen - I expect Daniel/Lee to take care of the patches from yesterday. If you can look up other pending patches from you please do so, so we can have them applied.
Preferably with links to lore - as this makes it easier to apply them.Review of what is unique in this set would be appreciated.
Sam
Hi Sam,
Here are my pending patches from last June on lore:
* https://lore.kernel.org/lkml/[email protected]/
* https://lore.kernel.org/lkml/[email protected]/
* https://lore.kernel.org/lkml/[email protected]/
* https://lore.kernel.org/lkml/[email protected]/
I’ll send reviews of your other patches later today or tomorrow.
Regards,
Stephen
Re: [PATCH 01/15] video: fbdev: atmel_lcdfb: Rework backlight handling
Quoted 54 lines · Stephen Kitt
Quoted 35 lines · Sam Ravnborg
Hi Stephen.
Quoted 17 lines · Stephen Kitt
Quoted 16 lines · On 7 January 2023 19:26:15 CET, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
The
atmel_lcdfbhad code to save/restore power state. This is not needed so drop it.Introduce
backlight_is_brightness()to make logic simpler.Signed-off-by Sam Ravnborg <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>---
drivers/video/fbdev/atmel_lcdfb.c| 24 +++---------------------1 file changed, 3 insertions(+), 21 deletions(-)...
Quoted 4 lines
Hi Sam,
I’d submitted quite a few more of these previously (and you’d reviewed them), see e.g. the thread starting at https://lkml.org/lkml/2022/6/7/4365, and yesterday, https://lkml.org/lkml/2023/1/6/520, https://lkml.org/lkml/2023/1/6/656, https://lkml.org/lkml/2023/1/6/970, https://lkml.org/lkml/2023/1/6/643, and https://lkml.org/lkml/2023/1/6/680. There are a few more, I can find them if it’s any use.
The patches from yesterday was what triggered me to resurrect an old branch of mine where I had done something similar. I had lost all memory of reviewing similar patches from you.
Helge - could you pick the reviewed patches from:
https://lore.kernel.org/all/[email protected]/
[This is the same mail as Stephen refer to above - looked up via lore].Quoted 8 lines
Stephen - I expect Daniel/Lee to take care of the patches from yesterday. If you can look up other pending patches from you please do so, so we can have them applied.
Preferably with links to lore - as this makes it easier to apply them.Review of what is unique in this set would be appreciated.
Sam
Hi Sam,
Here are my pending patches from last June on lore:
* https://lore.kernel.org/lkml/[email protected]/
* https://lore.kernel.org/lkml/[email protected]/
* https://lore.kernel.org/lkml/[email protected]/
* https://lore.kernel.org/lkml/[email protected]/
Quoted 5 lines
I’ll send reviews of your other patches later today or tomorrow.
Regards,
Stephen
And the auxdisplay patch, v1:
https://lore.kernel.org/lkml/[email protected]/
and v2:
https://lore.kernel.org/lkml/[email protected]/
Regards,
Stephen
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 01/15] video: fbdev: atmel_lcdfb: Rework backlight handling
In reply to Stephen KittHi Stephen.
Quoted 2 lines
Here are my pending patches from last June on lore:
All patches are handled I think except this:
Quoted 1 line
Can I ask you to drop the assignment that is not needed, and resend with the collected acks/r-b.
With this, then all fbdev patches are handled.
Sam
Re: [PATCH 01/15] video: fbdev: atmel_lcdfb: Rework backlight handling
Hi Sam,
Quoted 10 lines · Sam Ravnborg
Quoted 2 lines
Here are my pending patches from last June on lore:
All patches are handled I think except this:
Quoted 1 line
Can I ask you to drop the assignment that is not needed, and resend with the collected acks/r-b.
With this, then all fbdev patches are handled.
Ah yes, it was revised as
https://lore.kernel.org/lkml/[email protected]/ which only got one ack (from you,
https://lore.kernel.org/lkml/[email protected]/). Should I resend that or is that usable as-is? Or would it be better if I sent all the fbdev patches again (collecting all the acks and reviews)?
Regards,
Stephen
Re: [PATCH 01/15] video: fbdev: atmel_lcdfb: Rework backlight handling
Quoted 11 lines · Stephen Kitt
Quoted 10 lines · Sam Ravnborg
Quoted 2 lines
Here are my pending patches from last June on lore:
All patches are handled I think except this:
Quoted 2 lines
Can I ask you to drop the assignment that is not needed, and resend with the collected acks/r-b.
Quoted 8 lines
Quoted 1 line
With this, then all fbdev patches are handled.
Ah yes, it was revised as
https://lore.kernel.org/lkml/[email protected]/ which only got one ack (from you,
https://lore.kernel.org/lkml/[email protected]/). Should I resend that or is that usable as-is? Or would it be better if I sent all the fbdev patches again (collecting all the acks and reviews)?
Since the others are already in fbdev/for-next, I’ve just resent v2 of this patch with your ack.
Regards,
Stephen
Helge Deller
maintainerRe: [PATCH 01/15] video: fbdev: atmel_lcdfb: Rework backlight handling
In reply to Sam RavnborgQuoted 26 lines · Sam Ravnborg
Hi Stephen.
Quoted 17 lines · Stephen Kitt
Quoted 16 lines · On 7 January 2023 19:26:15 CET, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
The
atmel_lcdfbhad code to save/restore power state. This is not needed so drop it.Introduce
backlight_is_brightness()to make logic simpler.Signed-off-by Sam Ravnborg <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>---
drivers/video/fbdev/atmel_lcdfb.c| 24 +++---------------------1 file changed, 3 insertions(+), 21 deletions(-)...
Quoted 4 lines
Hi Sam,
I’d submitted quite a few more of these previously (and you’d reviewed them), see e.g. the thread starting at https://lkml.org/lkml/2022/6/7/4365, and yesterday, https://lkml.org/lkml/2023/1/6/520, https://lkml.org/lkml/2023/1/6/656, https://lkml.org/lkml/2023/1/6/970, https://lkml.org/lkml/2023/1/6/643, and https://lkml.org/lkml/2023/1/6/680. There are a few more, I can find them if it’s any use.
Quoted 8 lines
The patches from yesterday was what triggered me to resurrect an old branch of mine where I had done something similar. I had lost all memory of reviewing similar patches from you.
Helge - could you pick the reviewed patches from:
https://lore.kernel.org/all/[email protected]/
[This is the same mail as Stephen refer to above - looked up via lore].
I just pulled those 7 patches into fbdev/for-next. If you need more, please let me know,
Thanks!
Helge
Quoted 9 lines
Stephen - I expect Daniel/Lee to take care of the patches from yesterday. If you can look up other pending patches from you please do so, so we can have them applied.
Preferably with links to lore - as this makes it easier to apply them.Review of what is unique in this set would be appreciated.
Sam
Re: [PATCH 01/15] video: fbdev: atmel_lcdfb: Rework backlight handling
Hi Helge,
Quoted 7 lines
Quoted 4 lines
Helge - could you pick the reviewed patches from:
https://lore.kernel.org/all/[email protected]/
[This is the same mail as Stephen refer to above - looked up via lore].I just pulled those 7 patches into fbdev/for-next. If you need more, please let me know,
Thanks, we have one pending patch for atmel_lcdfb, but it need a small adjustment before it is ready.
With this all fbdev drivers have the backlight_properties.fb_blank removed.
Sam
Re: [PATCH 01/15] video: fbdev: atmel_lcdfb: Rework backlight handling
In reply to Helge DellerQuoted 39 lines · Helge Deller
Quoted 38 lines · Sam Ravnborg
Hi Stephen.
Quoted 18 lines · Stephen Kitt
Quoted 16 lines · On 7 January 2023 19:26:15 CET, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
The
atmel_lcdfbhad code to save/restore power state. This is not needed so drop it.Introduce
backlight_is_brightness()to make logic simpler.Signed-off-by Sam Ravnborg <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>---
drivers/video/fbdev/atmel_lcdfb.c| 24 +++---------------------1 file changed, 3 insertions(+), 21 deletions(-)...
Quoted 10 lines
Hi Sam,
I’d submitted quite a few more of these previously (and you’d reviewed them), see e.g. the thread starting at
https://lkml.org/lkml/2022/6/7/4365, and yesterday,
https://lkml.org/lkml/2023/1/6/520, https://lkml.org/lkml/2023/1/6/656,
https://lkml.org/lkml/2023/1/6/970, https://lkml.org/lkml/2023/1/6/643,
and https://lkml.org/lkml/2023/1/6/680. There are a few more, I can find them if it’s any use.The patches from yesterday was what triggered me to resurrect an old branch of mine where I had done something similar. I had lost all memory of reviewing similar patches from you.
Quoted 6 lines
Quoted 3 lines
Helge - could you pick the reviewed patches from:
https://lore.kernel.org/all/[email protected]/
[This is the same mail as Stephen refer to above - looked up via lore].I just pulled those 7 patches into fbdev/for-next. If you need more, please let me know,
Please pull
https://lore.kernel.org/lkml/[email protected]/ too, it completes the fbdev set. (It’s a re-send of
https://lore.kernel.org/lkml/[email protected]/).
Thanks,
Stephen
Helge Deller
maintainerRe: [PATCH 01/15] video: fbdev: atmel_lcdfb: Rework backlight handling
Quoted 45 lines · Stephen Kitt
Quoted 43 lines · Helge Deller
Quoted 41 lines · Sam Ravnborg
Hi Stephen.
Quoted 18 lines · Stephen Kitt
Quoted 16 lines · On 7 January 2023 19:26:15 CET, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
The
atmel_lcdfbhad code to save/restore power state. This is not needed so drop it.Introduce
backlight_is_brightness()to make logic simpler.Signed-off-by Sam Ravnborg <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>---
drivers/video/fbdev/atmel_lcdfb.c| 24 +++---------------------1 file changed, 3 insertions(+), 21 deletions(-)...
Quoted 10 lines
Hi Sam,
I’d submitted quite a few more of these previously (and you’d reviewed them), see e.g. the thread starting at
https://lkml.org/lkml/2022/6/7/4365, and yesterday,
https://lkml.org/lkml/2023/1/6/520, https://lkml.org/lkml/2023/1/6/656,
https://lkml.org/lkml/2023/1/6/970, https://lkml.org/lkml/2023/1/6/643,
and https://lkml.org/lkml/2023/1/6/680. There are a few more, I can find them if it’s any use.The patches from yesterday was what triggered me to resurrect an old branch of mine where I had done something similar. I had lost all memory of reviewing similar patches from you.
Helge - could you pick the reviewed patches from:
https://lore.kernel.org/all/[email protected]/
[This is the same mail as Stephen refer to above - looked up via lore].
Quoted 7 lines
Quoted 2 lines
I just pulled those 7 patches into fbdev/for-next. If you need more, please let me know,
Please pull
https://lore.kernel.org/lkml/[email protected]/ too, it completes the fbdev set. (It’s a re-send of
https://lore.kernel.org/lkml/[email protected]/).
Done.
Thanks!
Helge
Re: [PATCH 01/15] video: fbdev: atmel_lcdfb: Rework backlight handling
In reply to Sam RavnborgQuoted 6 lines · On Sat, 07 Jan 2023, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
The
atmel_lcdfbhad code to save/restore power state. This is not needed so drop it.Introduce
backlight_is_brightness()to make logic simpler.
backlight_is_brightness?
BR,
Jani.
Quoted 75 lines
Signed-off-by Sam Ravnborg <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>--- drivers/video/fbdev/atmel_lcdfb.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-)drivers/video/fbdev/atmel_lcdfb.c +3
-21@@ -49,7 +49,6 @@ struct atmel_lcdfb_info {struct clk *lcdc_clk;struct backlight_device *backlight; -u8 bl_power;u8 saved_lcdcon;u32 pseudo_palette[16 ];@@ -109,32 +108,18 @@ static u32 contrast_ctr = ATMEL_LCDC_PS_DIV8static int atmel_bl_update_status (struct backlight_device *bl) {struct atmel_lcdfb_info *sinfo =bl_get_data (bl); -int power = sinfo->bl_power; -int brightness = bl->props.brightness; +int brightness; -/* REVISIT there may be a meaningful difference between -* fb_blank and power ... there seem to be some cases -* this doesn't handle correctly. -*/ -if (bl->props.fb_blank != sinfo->bl_power) - power = bl->props.fb_blank; -else if (bl->props.power != sinfo->bl_power) - power = bl->props.power; - -if (brightness <0 && power ==FB_BLANK_UNBLANK ) - brightness =lcdc_readl (sinfo,ATMEL_LCDC_CONTRAST_VAL ); -else if (power !=FB_BLANK_UNBLANK ) - brightness =0 ; + brightness =backlight_get_brightness (bl);lcdc_writel (sinfo,ATMEL_LCDC_CONTRAST_VAL , brightness); +if (contrast_ctr &ATMEL_LCDC_POL_POSITIVE )lcdc_writel (sinfo,ATMEL_LCDC_CONTRAST_CTR , brightness ? contrast_ctr :0 );else lcdc_writel (sinfo,ATMEL_LCDC_CONTRAST_CTR , contrast_ctr); - bl->props.fb_blank = bl->props.power = sinfo->bl_power = power; -return 0 ; }@@ -155,8 +140,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo)struct backlight_properties props;struct backlight_device *bl; - sinfo->bl_power =FB_BLANK_UNBLANK ; -if (sinfo->backlight)return ;@@ -173,7 +156,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo) sinfo->backlight = bl; bl->props.power =FB_BLANK_UNBLANK ; - bl->props.fb_blank =FB_BLANK_UNBLANK ; bl->props.brightness =atmel_bl_get_brightness (bl); }
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
PATCH 2/15 video: fbdev: atyfb: Introduce backlight_get_brightness()
In reply to Sam RavnborgIntroduce backlight_get_brightness() to simplify logic and avoid direct access to backlight properties.
--- drivers/video/fbdev/aty/atyfb_base.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/video/fbdev/aty/atyfb_base.c +1 -7
@@ -2219,13 +2219,7 @@ static int aty_bl_update_status(struct backlight_device *bd) {struct atyfb_par *par =bl_get_data (bd);unsigned int reg =aty_ld_lcd (LCD_MISC_CNTL , par); -int level; - -if (bd->props.power !=FB_BLANK_UNBLANK || - bd->props.fb_blank !=FB_BLANK_UNBLANK ) - level =0 ; -else - level = bd->props.brightness; +int level =backlight_get_brightness (bd); reg |= (BLMOD_EN |BIASMOD_EN );if (level >0 ) {
Signature · 1 line
2.34.1
Re: [PATCH 02/15] video: fbdev: atyfb: Introduce backlight_get_brightness()
Le 07/01/2023 à 19:26, Sam Ravnborg via B4 Submission Endpoint a écrit :
Quoted 4 lines
From: Sam Ravnborg <[email protected]>
Introduce
backlight_get_brightness()to simplify logic and avoid direct access to backlight properties.
When I read 'introduce' I understand that you are adding a new function.
In fact backlight_get_brightness() already exists, so maybe replace 'introduce' by 'use'
Quoted 36 lines
Signed-off-by Sam Ravnborg <[email protected]>Cc Bartlomiej Zolnierkiewicz <[email protected]>Cc Sam Ravnborg <[email protected]>Cc Daniel Vetter <[email protected]>Cc Souptick Joarder <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Jason Yan <[email protected]>Cc Jani Nikula <[email protected]>Cc Arnd Bergmann <[email protected]>--- drivers/video/fbdev/aty/atyfb_base.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)drivers/video/fbdev/aty/atyfb_base.c +1
-8@@ -2219,13 +2219,7 @@ static int aty_bl_update_status(struct backlight_device *bd) {struct atyfb_par *par =bl_get_data (bd);unsigned int reg =aty_ld_lcd (LCD_MISC_CNTL , par); -int level; - -if (bd->props.power !=FB_BLANK_UNBLANK || - bd->props.fb_blank !=FB_BLANK_UNBLANK ) - level =0 ; -else - level = bd->props.brightness; +int level =backlight_get_brightness (bd); reg |= (BLMOD_EN |BIASMOD_EN );if (level >0 ) { --2.34.1
Re: [PATCH 02/15] video: fbdev: atyfb: Introduce backlight_get_brightness()
Hi Christophe,
Quoted 5 lines · Christophe Leroy
Le 07/01/2023 à 19:26, Sam Ravnborg via B4 Submission Endpoint a écrit :
Quoted 2 lines
From: Sam Ravnborg <[email protected]>
Quoted 7 lines
Quoted 2 lines
Introduce
backlight_get_brightness()to simplify logic and avoid direct access to backlight properties.When I read 'introduce' I understand that you are adding a new function.
In fact
backlight_get_brightness()already exists, so maybe replace 'introduce' by 'use'
Thanks for your feedback. A similar patch is already applied to the fbdev tree, so this patch can be ignored.
Sam
PATCH 3/15 video: fbdev: nvidia: Introduce backlight_get_brightness()
In reply to Sam RavnborgIntroduce backlight_get_brightness() to simplify logic and avoid direct access to backlight properties.
--- drivers/video/fbdev/nvidia/nv_backlight.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/video/fbdev/nvidia/nv_backlight.c +1 -7
@@ -49,17 +49,11 @@ static int nvidia_bl_update_status(struct backlight_device *bd) {struct nvidia_par *par =bl_get_data (bd);u32 tmp_pcrt, tmp_pmc, fpcontrol; -int level; +int level =backlight_get_brightness (bd);if (!par->FlatPanel)return 0 ; -if (bd->props.power !=FB_BLANK_UNBLANK || - bd->props.fb_blank !=FB_BLANK_UNBLANK ) - level =0 ; -else - level = bd->props.brightness; - tmp_pmc =NV_RD32 (par->PMC,0x10F0 ) &0x0000FFFF ; tmp_pcrt =NV_RD32 (par->PCRTC0,0x081C ) &0xFFFFFFFC ; fpcontrol =NV_RD32 (par->PRAMDAC,0x0848 ) &0xCFFFFFCC ;
Signature · 1 line
2.34.1
PATCH 4/15 video: fbdev: radeon: Introduce backlight_get_brightness()
In reply to Sam RavnborgIntroduce backlight_get_brightness() to simplify logic and avoid direct access to backlight properties.
--- drivers/video/fbdev/aty/radeon_backlight.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/video/fbdev/aty/radeon_backlight.c +3 -7
@@ -54,14 +54,10 @@ static int radeon_bl_update_status(struct backlight_device *bd)return 0 ;/* We turn off the LCD completely instead of just dimming the -* backlight. This provides some greater power saving and the display -* is useless without backlight anyway. +* backlight if level < 1. This provides some greater power saving +* and the display is useless without backlight anyway. */ -if (bd->props.power !=FB_BLANK_UNBLANK || - bd->props.fb_blank !=FB_BLANK_UNBLANK ) - level =0 ; -else - level = bd->props.brightness; + level =backlight_get_brightness (bd);del_timer_sync (&rinfo->lvds_timer);radeon_engine_idle ();
Signature · 1 line
2.34.1
PATCH 5/15 video: fbdev: riva: Introduce backlight_get_brightness()
In reply to Sam RavnborgIntroduce backlight_get_brightness() to simplify logic and avoid direct access to backlight properties.
--- drivers/video/fbdev/riva/fbdev.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/video/fbdev/riva/fbdev.c +1 -7
@@ -293,13 +293,7 @@ static int riva_bl_update_status(struct backlight_device *bd) {struct riva_par *par =bl_get_data (bd);U032 tmp_pcrt, tmp_pmc; -int level; - -if (bd->props.power !=FB_BLANK_UNBLANK || - bd->props.fb_blank !=FB_BLANK_UNBLANK ) - level =0 ; -else - level = bd->props.brightness; +int level =backlight_get_brightness (bd); tmp_pmc =NV_RD32 (par->riva.PMC,0x10F0 ) &0x0000FFFF ; tmp_pcrt =NV_RD32 (par->riva.PCRTC0,0x081C ) &0xFFFFFFFC ;
Signature · 1 line
2.34.1
PATCH 6/15 video: fbdev: aty128fb: Introduce backlight_get_brightness()
In reply to Sam RavnborgIntroduce backlight_get_brightness() to simplify logic and avoid direct access to backlight properties.
--- drivers/video/fbdev/aty/aty128fb.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/video/fbdev/aty/aty128fb.c +2 -9
@@ -1764,17 +1764,10 @@ static int aty128_bl_update_status(struct backlight_device *bd) {struct aty128fb_par *par =bl_get_data (bd);unsigned int reg =aty_ld_le32 (LVDS_GEN_CNTL ); -int level; - -if (bd->props.power !=FB_BLANK_UNBLANK || - bd->props.fb_blank !=FB_BLANK_UNBLANK || - !par->lcd_on) - level =0 ; -else - level = bd->props.brightness; +int level =backlight_get_brightness (bd); reg |=LVDS_BL_MOD_EN |LVDS_BLON ; -if (level >0 ) { +if (level >0 || par->lcd_on) { reg |=LVDS_DIGION ;if (!(reg &LVDS_ON )) { reg &= ~LVDS_BLON ;
Signature · 1 line
2.34.1
PATCH 7/15 video: fbdev: mx3fb: Introduce backlight_get_brightness()
In reply to Sam RavnborgIntroduce backlight_get_brightness() to simplify logic and avoid direct access to backlight properties.
--- drivers/video/fbdev/mx3fb.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/video/fbdev/mx3fb.c +1 -7
@@ -283,12 +283,7 @@ static int mx3fb_bl_get_brightness(struct backlight_device *bl)static int mx3fb_bl_update_status (struct backlight_device *bl) {struct mx3fb_data *fbd =bl_get_data (bl); -int brightness = bl->props.brightness; - -if (bl->props.power !=FB_BLANK_UNBLANK ) - brightness =0 ; -if (bl->props.fb_blank !=FB_BLANK_UNBLANK ) - brightness =0 ; +int brightness =backlight_get_brightness (bl); fbd->backlight_level = (fbd->backlight_level & ~0xFF ) | brightness;
@@ -325,7 +320,6 @@ static void mx3fb_init_backlight(struct mx3fb_data *fbd) fbd->bl = bl; bl->props.power =FB_BLANK_UNBLANK ; - bl->props.fb_blank =FB_BLANK_UNBLANK ; bl->props.brightness =mx3fb_bl_get_brightness (bl); }
Signature · 1 line
2.34.1
PATCH 8/15 video: fbdev: omap2: Introduce backlight_get_brightness()
In reply to Sam RavnborgIntroduce backlight_get_brightness() to simplify logic and avoid direct access to backlight properties.
--- .../fbdev/omap2/omapfb/displays/panel-dsi-cm.c | 19 +----------------- .../omap2/omapfb/displays/panel-sony-acx565akm.c | 23 +++++++--------------- 2 files changed, 8 insertions(+), 34 deletions(-)
drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c +1 -18
@@ -330,14 +330,8 @@ static int dsicm_bl_update_status(struct backlight_device *dev) {struct panel_drv_data *ddata =dev_get_drvdata (&dev->dev);struct omap_dss_device *in = ddata->in; +int level =backlight_get_brightness (dev);int r; -int level; - -if (dev->props.fb_blank ==FB_BLANK_UNBLANK && - dev->props.power ==FB_BLANK_UNBLANK ) - level = dev->props.brightness; -else - level =0 ;dev_dbg (&ddata->pdev->dev,"update brightness to %d\n" , level);
@@ -360,17 +354,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)return r; } -static int dsicm_bl_get_intensity (struct backlight_device *dev) -{ -if (dev->props.fb_blank ==FB_BLANK_UNBLANK && - dev->props.power ==FB_BLANK_UNBLANK ) -return dev->props.brightness; - -return 0 ; -} -static const struct backlight_ops dsicm_bl_ops = { - .get_brightness = dsicm_bl_get_intensity, .update_status = dsicm_bl_update_status, };
@@ -1251,7 +1235,6 @@ static int dsicm_probe(struct platform_device *pdev) ddata->bldev = bldev; - bldev->props.fb_blank =FB_BLANK_UNBLANK ; bldev->props.power =FB_BLANK_UNBLANK ; bldev->props.brightness =255 ;
drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c +7 -16
@@ -337,16 +337,10 @@ static int acx565akm_get_actual_brightness(struct panel_drv_data *ddata)static int acx565akm_bl_update_status (struct backlight_device *dev) {struct panel_drv_data *ddata =dev_get_drvdata (&dev->dev); -int level; +int level =backlight_get_brightness (dev);dev_dbg (&ddata->spi->dev,"%s\n" , __func__); -if (dev->props.fb_blank ==FB_BLANK_UNBLANK && - dev->props.power ==FB_BLANK_UNBLANK ) - level = dev->props.brightness; -else - level =0 ; -if (ddata->has_bc)acx565akm_set_brightness (ddata, level);else
@@ -364,15 +358,13 @@ static int acx565akm_bl_get_intensity(struct backlight_device *dev)if (!ddata->has_bc)return -ENODEV ; -if (dev->props.fb_blank ==FB_BLANK_UNBLANK && - dev->props.power ==FB_BLANK_UNBLANK ) { -if (ddata->has_bc) -return acx565akm_get_actual_brightness (ddata); -else -return dev->props.brightness; - } +if (backlight_is_blank (dev)) +return 0 ; -return 0 ; +if (ddata->has_bc) +return acx565akm_get_actual_brightness (ddata); +else +return backlight_get_brightness (dev); }static int acx565akm_bl_update_status_locked (struct backlight_device *dev)
@@ -795,7 +787,6 @@ static int acx565akm_probe(struct spi_device *spi) }memset (&props,0 ,sizeof (props)); - props.fb_blank =FB_BLANK_UNBLANK ; props.power =FB_BLANK_UNBLANK ; props.type =BACKLIGHT_RAW ;
Signature · 1 line
2.34.1
PATCH 9/15 staging: fbtft: fb_ssd1351.c: Introduce backlight_is_blank()
In reply to Sam RavnborgAvoiding direct access to backlight_properties.props.
Access to the deprecated props.fb_blank replaced by backlight_is_blank(). Access to props.power is dropped - it was only used for debug.
--- drivers/staging/fbtft/fb_ssd1351.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/staging/fbtft/fb_ssd1351.c +3 -6
@@ -190,15 +190,12 @@ static struct fbtft_display display = {static int update_onboard_backlight (struct backlight_device *bd) {struct fbtft_par *par =bl_get_data (bd); -bool on; +bool blank =backlight_is_blank (bd); -fbtft_par_dbg (DEBUG_BACKLIGHT , par, -"%s: power=%d, fb_blank=%d\n" , - __func__, bd->props.power, bd->props.fb_blank); +fbtft_par_dbg (DEBUG_BACKLIGHT , par,"%s: blank=%d\n" , __func__, blank); - on = !backlight_is_blank (bd);/* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */ -write_reg (par,0xB5 , on ?0x03 :0x02 ); +write_reg (par,0xB5 , !blank ?0x03 :0x02 );return 0 ; }
Signature · 1 line
2.34.1
Re: [PATCH 09/15] staging: fbtft: fb_ssd1351.c: Introduce backlight_is_blank()
Quoted 43 lines · On Sat, 07 Jan 2023 19:26:23 +0100, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
Avoiding direct access to backlight_properties.props.
Access to the deprecated props.fb_blank replaced by
backlight_is_blank(). Access to props.power is dropped - it was only used for debug.Signed-off-by Sam Ravnborg <[email protected]>Cc Stephen Kitt <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Daniel Thompson <[email protected]>Cc Andy Shevchenko <[email protected]>--- drivers/staging/fbtft/fb_ssd1351.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/staging/fbtft/fb_ssd1351.cindexb8d55aa8c5c7..995fbd2f3dc6100644drivers/staging/fbtft/fb_ssd1351.c +3
-6@@ -190,15 +190,12 @@ static struct fbtft_display display = {static int update_onboard_backlight (struct backlight_device *bd) {struct fbtft_par *par =bl_get_data (bd); -bool on; +bool blank =backlight_is_blank (bd); -fbtft_par_dbg (DEBUG_BACKLIGHT , par, -"%s: power=%d, fb_blank=%d\n" , - __func__, bd->props.power, bd->props.fb_blank); +fbtft_par_dbg (DEBUG_BACKLIGHT , par,"%s: blank=%d\n" , __func__, blank); - on = !backlight_is_blank (bd);/* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */ -write_reg (par,0xB5 , on ?0x03 :0x02 ); +write_reg (par,0xB5 , !blank ?0x03 :0x02 );return 0 ; }Signature · 2 lines
-- 2.34.1
For debugging purposes here, would there be any point in logging props.state? As in
fbtft_par_dbg(DEBUG_BACKLIGHT, par,
- "%s: power=%d, fb_blank=%d\n", - __func__, bd->props.power, bd->props.fb_blank); + "%s: power=%d, state=%u\n", + __func__, bd->props.power, bd->props.state);
In any case,
Regards,
Stephen
Re: [PATCH 09/15] staging: fbtft: fb_ssd1351.c: Introduce backlight_is_blank()
Hi Stephen,
Quoted 51 lines · Stephen Kitt
Quoted 43 lines · On Sat, 07 Jan 2023 19:26:23 +0100, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
Avoiding direct access to backlight_properties.props.
Access to the deprecated props.fb_blank replaced by
backlight_is_blank(). Access to props.power is dropped - it was only used for debug.Signed-off-by Sam Ravnborg <[email protected]>Cc Stephen Kitt <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Daniel Thompson <[email protected]>Cc Andy Shevchenko <[email protected]>--- drivers/staging/fbtft/fb_ssd1351.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/staging/fbtft/fb_ssd1351.cindexb8d55aa8c5c7..995fbd2f3dc6100644drivers/staging/fbtft/fb_ssd1351.c +3
-6@@ -190,15 +190,12 @@ static struct fbtft_display display = {static int update_onboard_backlight (struct backlight_device *bd) {struct fbtft_par *par =bl_get_data (bd); -bool on; +bool blank =backlight_is_blank (bd); -fbtft_par_dbg (DEBUG_BACKLIGHT , par, -"%s: power=%d, fb_blank=%d\n" , - __func__, bd->props.power, bd->props.fb_blank); +fbtft_par_dbg (DEBUG_BACKLIGHT , par,"%s: blank=%d\n" , __func__, blank); - on = !backlight_is_blank (bd);/* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */ -write_reg (par,0xB5 , on ?0x03 :0x02 ); +write_reg (par,0xB5 , !blank ?0x03 :0x02 );return 0 ; }Signature · 2 lines
-- 2.34.1For debugging purposes here, would there be any point in logging props.state? As in
fbtft_par_dbg(DEBUG_BACKLIGHT, par,
drivers/staging/fbtft/fb_ssd1351.c static struct fbtft_display display = {
Quoted 4 lines
drivers/staging/fbtft/fb_ssd1351.c +2
-2-"%s: power=%d, fb_blank=%d\n" , - __func__, bd->props.power, bd->props.fb_blank); +"%s: power=%d, state=%u\n" , + __func__, bd->props.power, bd->props.state);
Thanks for the suggestion - and the reviews!
I was tempted to just remove the debugging.
If we require debugging, then this could be added in the backlight core, thus everyone would benefit from it.
The solution above avoid any direct use of backlight_properties which I consider a layer violation outside the backlight core. (We cannot avoid it today with the current interface - but we can minimize it).
Sam
Re: [PATCH 09/15] staging: fbtft: fb_ssd1351.c: Introduce backlight_is_blank()
Hi Sam,
Quoted 61 lines · Sam Ravnborg
Quoted 53 lines · Stephen Kitt
Quoted 45 lines · On Sat, 07 Jan 2023 19:26:23 +0100, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
Avoiding direct access to backlight_properties.props.
Access to the deprecated props.fb_blank replaced by
backlight_is_blank(). Access to props.power is dropped - it was only used for debug.Signed-off-by Sam Ravnborg <[email protected]>Cc Stephen Kitt <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Daniel Thompson <[email protected]>Cc Andy Shevchenko <[email protected]>--- drivers/staging/fbtft/fb_ssd1351.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/staging/fbtft/fb_ssd1351.cindexb8d55aa8c5c7..995fbd2f3dc6100644 ---a/drivers/staging/fbtft/fb_ssd1351.c
+++b/drivers/staging/fbtft/fb_ssd1351.cdrivers/staging/fbtft/fb_ssd1351.c +2
-5@@ -190,15 +190,12 @@ static struct fbtft_display display = {static int update_onboard_backlight (struct backlight_device *bd) {struct fbtft_par *par =bl_get_data (bd); -bool on; +bool blank =backlight_is_blank (bd); -fbtft_par_dbg (DEBUG_BACKLIGHT , par, -"%s: power=%d, fb_blank=%d\n" , - __func__, bd->props.power, bd->props.fb_blank); +fbtft_par_dbg (DEBUG_BACKLIGHT , par,"%s: blank=%d\n" , __func__, blank); - on = !backlight_is_blank (bd);/* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */
drivers/staging/fbtft/fb_ssd1351.c +1
-1-write_reg (par,0xB5 , on ?0x03 :0x02 ); +write_reg (par,0xB5 , !blank ?0x03 :0x02 );return 0 ; }Signature · 2 lines
-- 2.34.1For debugging purposes here, would there be any point in logging props.state? As in
fbtft_par_dbg(DEBUG_BACKLIGHT, par,
drivers/staging/fbtft/fb_ssd1351.c static struct fbtft_display display = {
Quoted 4 lines
drivers/staging/fbtft/fb_ssd1351.c +2
-2-"%s: power=%d, fb_blank=%d\n" , - __func__, bd->props.power, bd->props.fb_blank); +"%s: power=%d, state=%u\n" , + __func__, bd->props.power, bd->props.state);Thanks for the suggestion - and the reviews!
Quoted 8 lines
I was tempted to just remove the debugging.
If we require debugging, then this could be added in the backlight core, thus everyone would benefit from it.The solution above avoid any direct use of
backlight_propertieswhich I consider a layer violation outside the backlight core. (We cannot avoid it today with the current interface - but we can minimize it).
Ah yes, ideally backlight_properties should be viewed as an opaque structure, that makes sense.
Regards,
Stephen
Daniel Thompson
Reviewed-byRe: [PATCH 09/15] staging: fbtft: fb_ssd1351.c: Introduce backlight_is_blank()
In reply to Sam RavnborgQuoted 59 lines · Sam Ravnborg
Hi Stephen,
Quoted 51 lines · Stephen Kitt
Quoted 42 lines · On Sat, 07 Jan 2023 19:26:23 +0100, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
Avoiding direct access to backlight_properties.props.
Access to the deprecated props.fb_blank replaced by
backlight_is_blank(). Access to props.power is dropped - it was only used for debug.Signed-off-by Sam Ravnborg <[email protected]>Cc Stephen Kitt <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Daniel Thompson <[email protected]>Cc Andy Shevchenko <[email protected]>--- drivers/staging/fbtft/fb_ssd1351.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/staging/fbtft/fb_ssd1351.cindexb8d55aa8c5c7..995fbd2f3dc6100644drivers/staging/fbtft/fb_ssd1351.c +3
-7@@ -190,15 +190,12 @@ static struct fbtft_display display = {static int update_onboard_backlight (struct backlight_device *bd) {struct fbtft_par *par =bl_get_data (bd); -bool on; +bool blank =backlight_is_blank (bd); -fbtft_par_dbg (DEBUG_BACKLIGHT , par, -"%s: power=%d, fb_blank=%d\n" , - __func__, bd->props.power, bd->props.fb_blank); +fbtft_par_dbg (DEBUG_BACKLIGHT , par,"%s: blank=%d\n" , __func__, blank); - on = !backlight_is_blank (bd);/* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */ -write_reg (par,0xB5 , on ?0x03 :0x02 ); +write_reg (par,0xB5 , !blank ?0x03 :0x02 );return 0 ; } --Quoted 1 line
2.34.1
For debugging purposes here, would there be any point in logging props.state? As in
fbtft_par_dbg(DEBUG_BACKLIGHT, par,
drivers/staging/fbtft/fb_ssd1351.c static struct fbtft_display display = {
Quoted 4 lines
drivers/staging/fbtft/fb_ssd1351.c +2
-2-"%s: power=%d, fb_blank=%d\n" , - __func__, bd->props.power, bd->props.fb_blank); +"%s: power=%d, state=%u\n" , + __func__, bd->props.power, bd->props.state);
Quoted 5 lines
Thanks for the suggestion - and the reviews!
I was tempted to just remove the debugging.
If we require debugging, then this could be added in the backlight core, thus everyone would benefit from it.
I had the same instinct to remove the debug print here (esp. ones with __func__ in them) but I think that's probably a much more widely scoped clean up for fbtft ;-).
On that basis:
Daniel.
Re: [PATCH 09/15] staging: fbtft: fb_ssd1351.c: Introduce backlight_is_blank()
In reply to Sam RavnborgQuoted 7 lines · On Sat, Jan 07, 2023 at 07:26:23PM +0100, Sam Ravnborg via B4 Submission…
From: Sam Ravnborg <[email protected]>
Avoiding direct access to backlight_properties.props.
Access to the deprecated props.fb_blank replaced by
backlight_is_blank(). Access to props.power is dropped - it was only used for debug.
Quoted 7 lines
Signed-off-by Sam Ravnborg <[email protected]>Cc Stephen Kitt <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Daniel Thompson <[email protected]>Cc Andy Shevchenko <[email protected]>
Not sure why you have this (at least) explicitly mentioned as get_maintainer.pl can generate it and git send-email can utilize the script output...
...
drivers/staging/fbtft/fb_ssd1351.c static struct fbtft_display display = { · line 198
Quoted 2 lines
drivers/staging/fbtft/fb_ssd1351.c +1
-1-write_reg (par,0xB5 , on ?0x03 :0x02 ); +write_reg (par,0xB5 , !blank ?0x03 :0x02 );
Why not positive conditional?
write_reg(par, 0xB5, blank ? 0x02 : 0x03);
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 10/15 staging: fbtft: core: Introduce backlight_is_blank()
In reply to Sam RavnborgAvoiding direct access to backlight_properties.props.
Access to the deprecated props.fb_blank replaced by backlight_is_blank(). Access to props.power is dropped - it was only used for debug.
--- drivers/staging/fbtft/fbtft-core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/fbtft/fbtft-core.c +6 -6
@@ -132,15 +132,15 @@ static int fbtft_backlight_update_status(struct backlight_device *bd) {struct fbtft_par *par =bl_get_data (bd);bool polarity = par->polarity; +bool blank =backlight_is_blank (bd); -fbtft_par_dbg (DEBUG_BACKLIGHT , par, -"%s: polarity=%d, power=%d, fb_blank=%d\n" , - __func__, polarity, bd->props.power, bd->props.fb_blank); +fbtft_par_dbg (DEBUG_BACKLIGHT , par,"%s: polarity=%d, blank=%d\n" , + __func__, polarity, blank); -if (!backlight_is_blank (bd)) -gpiod_set_value (par->gpio.led[0 ], polarity); -else +if (blank)gpiod_set_value (par->gpio.led[0 ], !polarity); +else +gpiod_set_value (par->gpio.led[0 ], polarity);return 0 ; }
Signature · 1 line
2.34.1
Re: [PATCH 10/15] staging: fbtft: core: Introduce backlight_is_blank()
Quoted 46 lines · On Sat, 07 Jan 2023 19:26:24 +0100, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
Avoiding direct access to backlight_properties.props.
Access to the deprecated props.fb_blank replaced by
backlight_is_blank(). Access to props.power is dropped - it was only used for debug.Signed-off-by Sam Ravnborg <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Javier Martinez Canillas <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Sam Ravnborg <[email protected]>Cc Stephen Kitt <[email protected]>Cc Peter Suti <[email protected]>--- drivers/staging/fbtft/fbtft-core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/staging/fbtft/fbtft-core.cindexafaba94d1d1c..1746327e1939100644drivers/staging/fbtft/fbtft-core.c +6
-6@@ -132,15 +132,15 @@ static int fbtft_backlight_update_status(struct backlight_device *bd) {struct fbtft_par *par =bl_get_data (bd);bool polarity = par->polarity; +bool blank =backlight_is_blank (bd); -fbtft_par_dbg (DEBUG_BACKLIGHT , par, -"%s: polarity=%d, power=%d, fb_blank=%d\n" , - __func__, polarity, bd->props.power, bd->props.fb_blank); +fbtft_par_dbg (DEBUG_BACKLIGHT , par,"%s: polarity=%d, blank=%d\n" , + __func__, polarity, blank); -if (!backlight_is_blank (bd)) -gpiod_set_value (par->gpio.led[0 ], polarity); -else +if (blank)gpiod_set_value (par->gpio.led[0 ], !polarity); +else +gpiod_set_value (par->gpio.led[0 ], polarity);return 0 ;
Quoted 4 lines
}
Signature · 1 line
2.34.1
Re: [PATCH 10/15] staging: fbtft: core: Introduce backlight_is_blank()
In reply to Sam RavnborgQuoted 6 lines · On Sat, Jan 07, 2023 at 07:26:24PM +0100, Sam Ravnborg via B4 Submission…
From: Sam Ravnborg <[email protected]>
Avoiding direct access to backlight_properties.props.
Access to the deprecated props.fb_blank replaced by
backlight_is_blank(). Access to props.power is dropped - it was only used for debug.
...
drivers/staging/fbtft/fbtft-core.c static int fbtft_backlight_update_status(struct backlight_device *bd) · line 143
Quoted 4 lines
drivers/staging/fbtft/fbtft-core.c +3
-0+if (blank)gpiod_set_value (par->gpio.led[0 ], !polarity); +else +gpiod_set_value (par->gpio.led[0 ], polarity);
if (blank) polarity = !polarity; gpiod_set_value(par->gpio.led[0], polarity);
?
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 11/15 powerpc: via-pmu-backlight: Introduce backlight_get_brightness()
In reply to Sam RavnborgIntroduce backlight_get_brightness() to simplify logic and avoid direct access to backlight properties.
--- drivers/macintosh/via-pmu-backlight.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/macintosh/via-pmu-backlight.c +1 -6
@@ -71,12 +71,7 @@ static int pmu_backlight_get_level_brightness(int level)static int __pmu_backlight_update_status (struct backlight_device *bd) {struct adb_request req; -int level = bd->props.brightness; - - -if (bd->props.power !=FB_BLANK_UNBLANK || - bd->props.fb_blank !=FB_BLANK_UNBLANK ) - level =0 ; +int level =backlight_get_brightness (bd);if (level >0 ) {int pmulevel =pmu_backlight_get_level_brightness (level);
Signature · 1 line
2.34.1
Re: [PATCH 11/15] powerpc: via-pmu-backlight: Introduce backlight_get_brightness()
Quoted 34 lines · On Sat, 07 Jan 2023 19:26:25 +0100, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
Introduce
backlight_get_brightness()to simplify logic and avoid direct access to backlight properties.Signed-off-by Sam Ravnborg <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Cc Sam Ravnborg <[email protected]>--- drivers/macintosh/via-pmu-backlight.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/macintosh/via-pmu-backlight.cindex2194016122d2..c2d87e7fa85b100644 ---a/drivers/macintosh/via-pmu-backlight.c
+++b/drivers/macintosh/via-pmu-backlight.cdrivers/macintosh/via-pmu-backlight.c +1
-6@@ -71,12 +71,7 @@ static int pmu_backlight_get_level_brightness(int level)static int __pmu_backlight_update_status (struct backlight_device *bd) {struct adb_request req; -int level = bd->props.brightness; - - -if (bd->props.power !=FB_BLANK_UNBLANK || - bd->props.fb_blank !=FB_BLANK_UNBLANK ) - level =0 ; +int level =backlight_get_brightness (bd);if (level >0 ) {int pmulevel =pmu_backlight_get_level_brightness (level);Signature · 2 lines
-- 2.34.1
This one is already in 6.2-rc1, it went in via powerpc/next.
Regards,
Stephen
PATCH 12/15 auxdisplay: ht16k33: Introduce backlight_get_brightness()
In reply to Sam RavnborgIntroduce backlight_get_brightness() to simplify logic and avoid direct access to backlight properties.
--- drivers/auxdisplay/ht16k33.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/auxdisplay/ht16k33.c +1 -6
@@ -314,14 +314,9 @@ static int ht16k33_initialize(struct ht16k33_priv *priv)static int ht16k33_bl_update_status (struct backlight_device *bl) { -int brightness = bl->props.brightness; +int brightness =backlight_get_brightness (bl);struct ht16k33_priv *priv =bl_get_data (bl); -if (bl->props.power !=FB_BLANK_UNBLANK || - bl->props.fb_blank !=FB_BLANK_UNBLANK || - bl->props.state &BL_CORE_FBBLANK ) - brightness =0 ; -return ht16k33_brightness_set (priv, brightness); }
Signature · 1 line
2.34.1
Re: [PATCH 12/15] auxdisplay: ht16k33: Introduce backlight_get_brightness()
Quoted 3 lines · On Sat, Jan 7, 2023 at 7:26 PM Sam Ravnborg via B4 Submission Endpoint…
Introduce
backlight_get_brightness()to simplify logic and avoid direct access to backlight properties.
Note: Stephen sent this one too a while ago (with some more details in the commit message, which is always nice); and then he sent yesterday v2 [1] (to mention the functional change with BL_CORE_SUSPENDED [2]).
Anyway, if it goes via drm-misc, feel free to have my:
Though it would be nice to have Robin test the change.
Thanks!
[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/CANiq72kRhmT37H1FAGYGny83ONYXeqJuO8ZPbym0ajQOWKY4Kw@mail.gmail.com/
Cheers,
Miguel
Re: [PATCH 12/15] auxdisplay: ht16k33: Introduce backlight_get_brightness()
Hi Robin.
Quoted 10 lines · Miguel Ojeda
Quoted 3 lines · On Sat, Jan 7, 2023 at 7:26 PM Sam Ravnborg via B4 Submission Endpoint…
Introduce
backlight_get_brightness()to simplify logic and avoid direct access to backlight properties.Note: Stephen sent this one too a while ago (with some more details in the commit message, which is always nice); and then he sent yesterday v2 [1] (to mention the functional change with
BL_CORE_SUSPENDED[2]).
Thanks for the pointers. I will try to move forward with Stephen's patches.
Quoted 6 lines
Anyway, if it goes via drm-misc, feel free to have my:
Acked-by Miguel Ojeda <[email protected]>Though it would be nice to have Robin test the change.
Robin - can I get your ack to apply Stephen's original v2 patch to drm-misc?
Sam
Quoted 8 lines
Thanks!
[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/CANiq72kRhmT37H1FAGYGny83ONYXeqJuO8ZPbym0ajQOWKY4Kw@mail.gmail.com/Cheers,
Miguel
Robin van der Gracht
maintainerRe: [PATCH 12/15] auxdisplay: ht16k33: Introduce backlight_get_brightness()
Hi Sam,
Quoted 16 lines · Sam Ravnborg
Hi Robin.
Quoted 10 lines · Miguel Ojeda
Quoted 3 lines · On Sat, Jan 7, 2023 at 7:26 PM Sam Ravnborg via B4 Submission Endpoint…
Introduce
backlight_get_brightness()to simplify logic and avoid direct access to backlight properties.Note: Stephen sent this one too a while ago (with some more details in the commit message, which is always nice); and then he sent yesterday v2 [1] (to mention the functional change with
BL_CORE_SUSPENDED[2]).Thanks for the pointers. I will try to move forward with Stephen's patches.
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Anyway, if it goes via drm-misc, feel free to have my:
Acked-by Miguel Ojeda <[email protected]>Though it would be nice to have Robin test the change.
Robin - can I get your ack to apply Stephen's original v2 patch to drm-misc?
done! see: https://lore.kernel.org/lkml/[email protected]/
- Robin
Re: [PATCH 12/15] auxdisplay: ht16k33: Introduce backlight_get_brightness()
Hi,
Quoted 19 lines · Robin van der Gracht
Quoted 18 lines · Sam Ravnborg
Quoted 10 lines · Miguel Ojeda
Quoted 3 lines · On Sat, Jan 7, 2023 at 7:26 PM Sam Ravnborg via B4 Submission Endpoint…
Introduce
backlight_get_brightness()to simplify logic and avoid direct access to backlight properties.Note: Stephen sent this one too a while ago (with some more details in the commit message, which is always nice); and then he sent yesterday v2 [1] (to mention the functional change with
BL_CORE_SUSPENDED[2]).Thanks for the pointers. I will try to move forward with Stephen's patches.
Quoted 5 lines
Anyway, if it goes via drm-misc, feel free to have my:
Acked-by Miguel Ojeda <[email protected]>
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Though it would be nice to have Robin test the change.
Robin - can I get your ack to apply Stephen's original v2 patch to drm-misc?
As far as I can tell, this never got applied to drm-misc, and I don’t see it anywhere else. I guess it slipped through the cracks ;-)
Regards,
Stephen
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 12/15] auxdisplay: ht16k33: Introduce backlight_get_brightness()
Quoted 25 lines · Stephen Kitt
Hi,
Quoted 21 lines · Robin van der Gracht
Quoted 20 lines · Sam Ravnborg
Quoted 10 lines · Miguel Ojeda
Quoted 3 lines · On Sat, Jan 7, 2023 at 7:26 PM Sam Ravnborg via B4 Submission Endpoint…
Introduce
backlight_get_brightness()to simplify logic and avoid direct access to backlight properties.Note: Stephen sent this one too a while ago (with some more details in the commit message, which is always nice); and then he sent yesterday v2 [1] (to mention the functional change with
BL_CORE_SUSPENDED[2]).Thanks for the pointers. I will try to move forward with Stephen's patches.
Quoted 6 lines
Anyway, if it goes via drm-misc, feel free to have my:
Acked-by Miguel Ojeda <[email protected]>Though it would be nice to have Robin test the change.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Robin - can I get your ack to apply Stephen's original v2 patch to drm-misc?
As far as I can tell, this never got applied to drm-misc, and I don’t see it anywhere else. I guess it slipped through the cracks ;-)
Yes, I have been busy with a lot of other stuff lately, and cannot promise when I get back to do Linux work.
So if someone else could pick it up that would be nice.
Sam
PATCH 13/15 backlight: omap1: Use backlight helpers
In reply to Sam RavnborgRework backlight handling to avoid access to the deprecated backlight_properties.fb_blank member.
The rework includes removal of get_brightness() operation, because there was no read back from HW so no use for it.
--- drivers/video/backlight/omap1_bl.c | 67 +++++--------------------------------- 1 file changed, 9 insertions(+), 58 deletions(-)
drivers/video/backlight/omap1_bl.c +9 -58
@@ -20,9 +20,6 @@#define OMAPBL_MAX_INTENSITY 0xffstruct omap_backlight { -int powermode; -int current_intensity; -struct device *dev;struct omap_backlight_config *pdata; };
@@ -37,82 +34,40 @@ static inline void omapbl_send_enable(int enable)omap_writeb (enable,OMAP_PWL_CLK_ENABLE ); } -static void omapbl_blank (struct omap_backlight *bl,int mode) -{ -if (bl->pdata->set_power) - bl->pdata->set_power (bl->dev, mode); - -switch (mode) { -case FB_BLANK_NORMAL : -case FB_BLANK_VSYNC_SUSPEND : -case FB_BLANK_HSYNC_SUSPEND : -case FB_BLANK_POWERDOWN : -omapbl_send_intensity (0 ); -omapbl_send_enable (0 ); -break ; - -case FB_BLANK_UNBLANK : -omapbl_send_intensity (bl->current_intensity); -omapbl_send_enable (1 ); -break ; - } -} -#ifdef CONFIG_PM_SLEEP static int omapbl_suspend (struct device *dev) {struct backlight_device *bl_dev =dev_get_drvdata (dev); -struct omap_backlight *bl =bl_get_data (bl_dev); -omapbl_blank (bl,FB_BLANK_POWERDOWN ); +backlight_disable (bl_dev);return 0 ; }static int omapbl_resume (struct device *dev) {struct backlight_device *bl_dev =dev_get_drvdata (dev); -struct omap_backlight *bl =bl_get_data (bl_dev); -omapbl_blank (bl, bl->powermode); +backlight_enable (bl_dev);return 0 ; }#endif -static int omapbl_set_power (struct backlight_device *dev,int state) -{ -struct omap_backlight *bl =bl_get_data (dev); - -omapbl_blank (bl, state); - bl->powermode = state; - -return 0 ; -} -static int omapbl_update_status (struct backlight_device *dev) { -struct omap_backlight *bl =bl_get_data (dev); +int brightness =backlight_get_brightness (dev); -if (bl->current_intensity != dev->props.brightness) { -if (bl->powermode ==FB_BLANK_UNBLANK ) -omapbl_send_intensity (dev->props.brightness); - bl->current_intensity = dev->props.brightness; +if (brightness >0 ) { +omapbl_send_intensity (dev->props.brightness); +omapbl_send_enable (1 ); + }else { +omapbl_send_intensity (0 ); +omapbl_send_enable (0 ); } -if (dev->props.fb_blank != bl->powermode) -omapbl_set_power (dev, dev->props.fb_blank); -return 0 ; } -static int omapbl_get_intensity (struct backlight_device *dev) -{ -struct omap_backlight *bl =bl_get_data (dev); - -return bl->current_intensity; -} -static const struct backlight_ops omapbl_ops = { - .get_brightness = omapbl_get_intensity, .update_status = omapbl_update_status, };
@@ -139,9 +94,6 @@ static int omapbl_probe(struct platform_device *pdev)if (IS_ERR (dev))return PTR_ERR (dev); - bl->powermode =FB_BLANK_POWERDOWN ; - bl->current_intensity =0 ; - bl->pdata = pdata; bl->dev = &pdev->dev;
@@ -149,7 +101,6 @@ static int omapbl_probe(struct platform_device *pdev)omap_cfg_reg (PWL );/* Conflicts with UART3 */ - dev->props.fb_blank =FB_BLANK_UNBLANK ; dev->props.brightness = pdata->default_intensity;omapbl_update_status (dev);
Signature · 1 line
2.34.1
Re: [PATCH 13/15] backlight: omap1: Use backlight helpers
Quoted 144 lines · On Sat, 07 Jan 2023 19:26:27 +0100, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
Rework backlight handling to avoid access to the deprecated backlight_properties.fb_blank member.
The rework includes removal of
get_brightness()operation, because there was no read back from HW so no use for it.Signed-off-by Sam Ravnborg <[email protected]>Cc Lee Jones <[email protected]>Cc Daniel Thompson <[email protected]>Cc Jingoo Han <[email protected]>--- drivers/video/backlight/omap1_bl.c | 67+++++--------------------------------- 1 file changed, 9 insertions(+), 58 deletions(-)
(quoted diff) +0
-0
b/drivers/video/backlight/omap1_bl.cindex69a49384b3de..49f37da857e7100644drivers/video/backlight/omap1_bl.c +9
-58@@ -20,9 +20,6 @@#define OMAPBL_MAX_INTENSITY 0xffstruct omap_backlight { -int powermode; -int current_intensity; -struct device *dev;struct omap_backlight_config *pdata; };@@ -37,82 +34,40 @@ static inline void omapbl_send_enable(int enable)omap_writeb (enable,OMAP_PWL_CLK_ENABLE ); } -static void omapbl_blank (struct omap_backlight *bl,int mode) -{ -if (bl->pdata->set_power) - bl->pdata->set_power (bl->dev, mode); - -switch (mode) { -case FB_BLANK_NORMAL : -case FB_BLANK_VSYNC_SUSPEND : -case FB_BLANK_HSYNC_SUSPEND : -case FB_BLANK_POWERDOWN : -omapbl_send_intensity (0 ); -omapbl_send_enable (0 ); -break ; - -case FB_BLANK_UNBLANK : -omapbl_send_intensity (bl->current_intensity); -omapbl_send_enable (1 ); -break ; - } -} -#ifdef CONFIG_PM_SLEEP static int omapbl_suspend (struct device *dev) {struct backlight_device *bl_dev =dev_get_drvdata (dev); -struct omap_backlight *bl =bl_get_data (bl_dev); -omapbl_blank (bl,FB_BLANK_POWERDOWN ); +backlight_disable (bl_dev);return 0 ; }static int omapbl_resume (struct device *dev) {struct backlight_device *bl_dev =dev_get_drvdata (dev); -struct omap_backlight *bl =bl_get_data (bl_dev); -omapbl_blank (bl, bl->powermode); +backlight_enable (bl_dev);return 0 ; }#endif -static int omapbl_set_power (struct backlight_device *dev,int state) -{ -struct omap_backlight *bl =bl_get_data (dev); - -omapbl_blank (bl, state); - bl->powermode = state; - -return 0 ; -} -static int omapbl_update_status (struct backlight_device *dev) { -struct omap_backlight *bl =bl_get_data (dev); +int brightness =backlight_get_brightness (dev); -if (bl->current_intensity != dev->props.brightness) { -if (bl->powermode ==FB_BLANK_UNBLANK ) -omapbl_send_intensity (dev->props.brightness); - bl->current_intensity = dev->props.brightness; +if (brightness >0 ) { +omapbl_send_intensity (dev->props.brightness); +omapbl_send_enable (1 ); + }else { +omapbl_send_intensity (0 ); +omapbl_send_enable (0 ); } -if (dev->props.fb_blank != bl->powermode) -omapbl_set_power (dev, dev->props.fb_blank); -return 0 ; } -static int omapbl_get_intensity (struct backlight_device *dev) -{ -struct omap_backlight *bl =bl_get_data (dev); - -return bl->current_intensity; -} -static const struct backlight_ops omapbl_ops = { - .get_brightness = omapbl_get_intensity, .update_status = omapbl_update_status, };@@ -139,9 +94,6 @@ static int omapbl_probe(struct platform_device *pdev)if (IS_ERR (dev))return PTR_ERR (dev); - bl->powermode =FB_BLANK_POWERDOWN ; - bl->current_intensity =0 ; - bl->pdata = pdata; bl->dev = &pdev->dev;@@ -149,7 +101,6 @@ static int omapbl_probe(struct platform_device *pdev)omap_cfg_reg (PWL );/* Conflicts with UART3 */ - dev->props.fb_blank =FB_BLANK_UNBLANK ; dev->props.brightness = pdata->default_intensity;omapbl_update_status (dev);Signature · 2 lines
-- 2.34.1
Wow that gets rid of a lot of unnecessary code!
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 13/15] backlight: omap1: Use backlight helpers
In reply to Sam RavnborgQuoted 5 lines · On Sat, Jan 07, 2023 at 07:26:27PM +0100, Sam Ravnborg via B4 Submission…
From: Sam Ravnborg <[email protected]>
Rework backlight handling to avoid access to the deprecated backlight_properties.fb_blank member.
Quoted 7 lines
The rework includes removal of
get_brightness()operation, because there was no read back from HW so no use for it.Signed-off-by Sam Ravnborg <[email protected]>Cc Lee Jones <[email protected]>Cc Daniel Thompson <[email protected]>Cc Jingoo Han <[email protected]>
This rework will result in additional calls to omapbl_send_enable() during updates so, if anyone who cares about omap1, is filtering LKML then a Tested-by: would be nice.
However, I doubt the additional calls will do any harm so even with that absent:
Daniel.
Lee Jones
maintainerRe: [PATCH 13/15] backlight: omap1: Use backlight helpers
In reply to Sam RavnborgQuoted 8 lines · On Sat, 07 Jan 2023, Sam Ravnborg via B4 Submission Endpoint wrote:
From: Sam Ravnborg <[email protected]>
Rework backlight handling to avoid access to the deprecated backlight_properties.fb_blank member.
The rework includes removal of
get_brightness()operation, because there was no read back from HW so no use for it.
Quoted 7 lines
Signed-off-by Sam Ravnborg <[email protected]>Cc Lee Jones <[email protected]>Cc Daniel Thompson <[email protected]>Cc Jingoo Han <[email protected]>--- drivers/video/backlight/omap1_bl.c | 67 +++++--------------------------------- 1 file changed, 9 insertions(+), 58 deletions(-)
My tools appear to dislike the line break in the Message-Id header.
This isn't something I've encountered before. Is this a B4 thing?
Is this standard? Should I adapt my tooling to scan over line breaks?
Signature · 1 line
Lee Jones [李琼斯]
Re: [PATCH 13/15] backlight: omap1: Use backlight helpers
Quoted 2 lines · Lee Jones
My tools appear to dislike the line break in the Message-Id header. This isn't something I've encountered before. Is this a B4 thing?
It's more like it's a Python thing. The upcoming version of b4 will avoid this (by not relying on Python to do message generation).
Quoted 1 line
Is this standard? Should I adapt my tooling to scan over line breaks?
This is RFC conformant, so if your tools are not able to deal with this situation, you should consider modifying them.
-K
Lee Jones
maintainerRe: [PATCH 13/15] backlight: omap1: Use backlight helpers
Quoted 6 lines · Konstantin Ryabitsev
Quoted 2 lines · Lee Jones
My tools appear to dislike the line break in the Message-Id header. This isn't something I've encountered before. Is this a B4 thing?
It's more like it's a Python thing. The upcoming version of b4 will avoid this (by not relying on Python to do message generation).
Understood.
Quoted 4 lines
Quoted 1 line
Is this standard? Should I adapt my tooling to scan over line breaks?
This is RFC conformant, so if your tools are not able to deal with this situation, you should consider modifying them.
Thanks for the info Konstantin, I'll do just that.
Signature · 1 line
Lee Jones [李琼斯]
PATCH 14/15 backlight: tosa: Use backlight helper
In reply to Sam RavnborgFrom: Stephen Kitt <[email protected]>
Instead of retrieving the backlight brightness in struct backlight_properties manually, and then checking whether the backlight should be on at all, use backlight_get_brightness() which does all this and insulates this from future changes.
--- drivers/video/backlight/tosa_bl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/video/backlight/tosa_bl.c +1 -6
@@ -50,13 +50,8 @@ static void tosa_bl_set_backlight(struct tosa_bl_data *data, int brightness)static int tosa_bl_update_status (struct backlight_device *dev) { -struct backlight_properties *props = &dev->props;struct tosa_bl_data *data =bl_get_data (dev); -int power =max (props->power, props->fb_blank); -int brightness = props->brightness; - -if (power) - brightness =0 ; +int brightness =backlight_get_brightness (dev);tosa_bl_set_backlight (data, brightness);
Signature · 1 line
2.34.1
Re: [PATCH 14/15] backlight: tosa: Use backlight helper
Quoted 9 lines · On Sat, Jan 07, 2023 at 07:26:28PM +0100, Sam Ravnborg via B4 Submission…
From: Stephen Kitt <[email protected]>
Instead of retrieving the backlight brightness in struct
backlight_propertiesmanually, and then checking whether the backlight should be on at all, usebacklight_get_brightness()which does all this and insulates this from future changes.Signed-off-by Stephen Kitt <[email protected]>Signed-off-by Sam Ravnborg <[email protected]>
Just for completeness...
Daniel.
PATCH 15/15 backlight: backlight: Drop the deprecated fb_blank property
In reply to Sam RavnborgWith all users gone remove the deprecated fb_blank member in backlight_properties.
--- drivers/video/backlight/backlight.c | 2 -- include/linux/backlight.h | 22 ---------------------- 2 files changed, 24 deletions(-)
drivers/video/backlight/backlight.c +0 -2
@@ -118,14 +118,12 @@ static int fb_notifier_callback(struct notifier_block *self, bd->fb_bl_on[node] = true;if (!bd->use_count++) { bd->props.state &= ~BL_CORE_FBBLANK ; - bd->props.fb_blank =FB_BLANK_UNBLANK ;backlight_update_status (bd); } }else if (fb_blank !=FB_BLANK_UNBLANK && bd->fb_bl_on[node]) { bd->fb_bl_on[node] = false;if (!(--bd->use_count)) { bd->props.state |=BL_CORE_FBBLANK ; - bd->props.fb_blank = fb_blank;backlight_update_status (bd); } }
include/linux/backlight.h +0 -22
@@ -218,25 +218,6 @@ struct backlight_properties {*/ int power; -/** -* @fb_blank: The power state from the FBIOBLANK ioctl. -* -* When the FBIOBLANK ioctl is called @fb_blank is set to the -* blank parameter and the update_status() operation is called. -* -* When the backlight device is enabled @fb_blank is set -* to FB_BLANK_UNBLANK. When the backlight device is disabled -* @fb_blank is set to FB_BLANK_POWERDOWN. -* -* Backlight drivers should avoid using this property. It has been -* replaced by state & BL_CORE_FBLANK (although most drivers should -* use backlight_is_blank() as the preferred means to get the blank -* state). -* -* fb_blank is deprecated and will be removed. -*/ -int fb_blank; -/** * @type: The type of backlight supported. *
@@ -366,7 +347,6 @@ static inline int backlight_enable(struct backlight_device *bd)return 0 ; bd->props.power =FB_BLANK_UNBLANK ; - bd->props.fb_blank =FB_BLANK_UNBLANK ; bd->props.state &= ~BL_CORE_FBBLANK ;return backlight_update_status (bd);
@@ -382,7 +362,6 @@ static inline int backlight_disable(struct backlight_device *bd)return 0 ; bd->props.power =FB_BLANK_POWERDOWN ; - bd->props.fb_blank =FB_BLANK_POWERDOWN ; bd->props.state |=BL_CORE_FBBLANK ;return backlight_update_status (bd);
@@ -403,7 +382,6 @@ static inline int backlight_disable(struct backlight_device *bd)static inline bool backlight_is_blank (const struct backlight_device *bd) {return bd->props.power !=FB_BLANK_UNBLANK || - bd->props.fb_blank !=FB_BLANK_UNBLANK || bd->props.state & (BL_CORE_SUSPENDED |BL_CORE_FBBLANK ); }
Signature · 1 line
2.34.1
Re: [PATCH 15/15] backlight: backlight: Drop the deprecated fb_blank property
Quoted 90 lines · On Sat, 07 Jan 2023 19:26:29 +0100, Sam Ravnborg via B4 Submission Endpoint…
From: Sam Ravnborg <[email protected]>
With all users gone remove the deprecated
fb_blankmember inbacklight_properties.Signed-off-by Sam Ravnborg <[email protected]>Cc Lee Jones <[email protected]>Cc Daniel Thompson <[email protected]>Cc Jingoo Han <[email protected]>--- drivers/video/backlight/backlight.c | 2 -- include/linux/backlight.h | 22 ---------------------- 2 files changed, 24 deletions(-)(quoted diff) +0
-0
b/drivers/video/backlight/backlight.cindexb788ff3d0f45..9b0557d094c5100644 ---a/drivers/video/backlight/backlight.c
+++b/drivers/video/backlight/backlight.cdrivers/video/backlight/backlight.c +0
-2@@ -118,14 +118,12 @@ static int fb_notifier_callback(struct notifier_block *self, bd->fb_bl_on[node] = true;if (!bd->use_count++) { bd->props.state &= ~BL_CORE_FBBLANK ; - bd->props.fb_blank =FB_BLANK_UNBLANK ;backlight_update_status (bd); } }else if (fb_blank !=FB_BLANK_UNBLANK && bd->fb_bl_on[node]) { bd->fb_bl_on[node] = false;if (!(--bd->use_count)) { bd->props.state |=BL_CORE_FBBLANK ; - bd->props.fb_blank = fb_blank;backlight_update_status (bd); } }include/linux/backlight.h +0
-21@@ -218,25 +218,6 @@ struct backlight_properties {*/ int power; -/** -* @fb_blank: The power state from the FBIOBLANK ioctl. -* -* When the FBIOBLANK ioctl is called @fb_blank is set to the -* blank parameter and the update_status() operation is called. -* -* When the backlight device is enabled @fb_blank is set -* to FB_BLANK_UNBLANK. When the backlight device is disabled -* @fb_blank is set to FB_BLANK_POWERDOWN. -* -* Backlight drivers should avoid using this property. It has been -* replaced by state & BL_CORE_FBLANK (although most drivers should -* use backlight_is_blank() as the preferred means to get the blank -* state). -* -* fb_blank is deprecated and will be removed. -*/ -int fb_blank; -/** * @type: The type of backlight supported. * @@ -366,7 +347,6 @@ static inline int backlight_enable(struct backlight_device *bd) return 0; bd->props.power =FB_BLANK_UNBLANK ; - bd->props.fb_blank =FB_BLANK_UNBLANK ; bd->props.state &= ~BL_CORE_FBBLANK ;return backlight_update_status (bd);@@ -382,7 +362,6 @@ static inline int backlight_disable(struct backlight_device *bd) return 0; bd->props.power =FB_BLANK_POWERDOWN ; - bd->props.fb_blank =FB_BLANK_POWERDOWN ; bd->props.state |=BL_CORE_FBBLANK ;return backlight_update_status (bd);@@ -403,7 +382,6 @@ static inline int backlight_disable(struct
backlight_device*bd) static inline boolbacklight_is_blank(const struct backlight_device *bd){include/linux/backlight.h +0
-1return bd->props.power !=FB_BLANK_UNBLANK || - bd->props.fb_blank !=FB_BLANK_UNBLANK || bd->props.state & (BL_CORE_SUSPENDED |BL_CORE_FBBLANK ); }Signature · 2 lines
-- 2.34.1
Re: [PATCH 15/15] backlight: backlight: Drop the deprecated fb_blank property
In reply to Sam RavnborgQuoted 9 lines · On Sat, Jan 07, 2023 at 07:26:29PM +0100, Sam Ravnborg via B4 Submission…
From: Sam Ravnborg <[email protected]>
With all users gone remove the deprecated
fb_blankmember inbacklight_properties.Signed-off-by Sam Ravnborg <[email protected]>Cc Lee Jones <[email protected]>Cc Daniel Thompson <[email protected]>Cc Jingoo Han <[email protected]>
PS Please don't treat this like a maintainer Acked-by: and merge it
(Lee's not on holiday so work with Lee to figure out the merge strategy ;-) ).
Re: [PATCH 15/15] backlight: backlight: Drop the deprecated fb_blank property
Hi Daniel.
Quoted 6 lines · Daniel Thompson
Quoted 5 lines · On Sat, Jan 07, 2023 at 07:26:29PM +0100, Sam Ravnborg via B4 Submission…
From: Sam Ravnborg <[email protected]>
With all users gone remove the deprecated
fb_blankmember inbacklight_properties.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Sam Ravnborg <[email protected]>Cc Lee Jones <[email protected]>Cc Daniel Thompson <[email protected]>Cc Jingoo Han <[email protected]>Reviewed-by Daniel Thompson <[email protected]>
Thanks for the follow-up on all the backlight related patches.
Quoted 5 lines
PS Please don't treat this like a maintainer Acked-by: and merge it
(Lee's not on holiday so work with Lee to figure out the merge strategy ;-) ).
Nope, I am aware that the usual pattern here and wait for Lee to show up.
For this patch there is a bug as I need to update a comment. I will fix this when I resend after all the patches in flight has landed. So likely after the next merge window,
Sam
Lee Jones
maintainerRe: [PATCH 15/15] backlight: backlight: Drop the deprecated fb_blank property
Quoted 21 lines · Sam Ravnborg
Hi Daniel.
Quoted 6 lines · Daniel Thompson
Quoted 5 lines · On Sat, Jan 07, 2023 at 07:26:29PM +0100, Sam Ravnborg via B4 Submission…
From: Sam Ravnborg <[email protected]>
With all users gone remove the deprecated
fb_blankmember inbacklight_properties.Quoted 7 lines
Quoted 4 lines
Signed-off-by Sam Ravnborg <[email protected]>Cc Lee Jones <[email protected]>Cc Daniel Thompson <[email protected]>Cc Jingoo Han <[email protected]>Reviewed-by Daniel Thompson <[email protected]>Thanks for the follow-up on all the backlight related patches.
Quoted 2 lines
Quoted 5 lines
Quoted 3 lines
PS Please don't treat this like a maintainer Acked-by: and merge it
(Lee's not on holiday so work with Lee to figure out the merge strategy ;-) ).Nope, I am aware that the usual pattern here and wait for Lee to show up.
It's on the list. Only 50 more reviews in the backlog now!
Quoted 3 lines
For this patch there is a bug as I need to update a comment. I will fix this when I resend after all the patches in flight has landed. So likely after the next merge window,
Signature · 1 line
Lee Jones [李琼斯]
Re: [PATCH 15/15] backlight: backlight: Drop the deprecated fb_blank property
In reply to Sam RavnborgQuoted 5 lines · On Sat, 07 Jan 2023, Sam Ravnborg via B4 Submission Endpoint wrote:
From: Sam Ravnborg <[email protected]>
With all users gone remove the deprecated
fb_blankmember inbacklight_properties.
Quoted 8 lines
Signed-off-by Sam Ravnborg <[email protected]>Cc Lee Jones <[email protected]>Cc Daniel Thompson <[email protected]>Cc Jingoo Han <[email protected]>--- drivers/video/backlight/backlight.c | 2 -- include/linux/backlight.h | 22 ---------------------- 2 files changed, 24 deletions(-)
Applied, thanks
Signature · 1 line
Lee Jones [李琼斯]
Re: [PATCH 15/15] backlight: backlight: Drop the deprecated fb_blank property
Hi Lee,
Quoted 16 lines · Lee Jones
Quoted 5 lines · On Sat, 07 Jan 2023, Sam Ravnborg via B4 Submission Endpoint wrote:
From: Sam Ravnborg <[email protected]>
With all users gone remove the deprecated
fb_blankmember inbacklight_properties.Quoted 8 lines
Signed-off-by Sam Ravnborg <[email protected]>Cc Lee Jones <[email protected]>Cc Daniel Thompson <[email protected]>Cc Jingoo Han <[email protected]>--- drivers/video/backlight/backlight.c | 2 -- include/linux/backlight.h | 22 ---------------------- 2 files changed, 24 deletions(-)
Quoted 1 line
Applied, thanks
Some of the dependent patches in this series are not yet applied. I have them queued up for processing this weekend, but I missed the -rc6 window for drm-misc so they will likely not hit upstream in the upcoming merge window.
I can try to expedite it.
But if you have not yet pushed it, please revert this patch. Then I will resend only when the remaining patches are upstream.
Sam
Lee Jones
maintainerRe: [PATCH 15/15] backlight: backlight: Drop the deprecated fb_blank property
Quoted 20 lines · Sam Ravnborg
Hi Lee,
Quoted 16 lines · Lee Jones
Quoted 5 lines · On Sat, 07 Jan 2023, Sam Ravnborg via B4 Submission Endpoint wrote:
From: Sam Ravnborg <[email protected]>
With all users gone remove the deprecated
fb_blankmember inbacklight_properties.Quoted 8 lines
Signed-off-by Sam Ravnborg <[email protected]>Cc Lee Jones <[email protected]>Cc Daniel Thompson <[email protected]>Cc Jingoo Han <[email protected]>--- drivers/video/backlight/backlight.c | 2 -- include/linux/backlight.h | 22 ---------------------- 2 files changed, 24 deletions(-)Quoted 1 line
Applied, thanks
Quoted 8 lines
Some of the dependent patches in this series are not yet applied. I have them queued up for processing this weekend, but I missed the -rc6 window for drm-misc so they will likely not hit upstream in the upcoming merge window.
I can try to expedite it.But if you have not yet pushed it, please revert this patch. Then I will resend only when the remaining patches are upstream.
Thanks for the info. Dropped.
Signature · 1 line
Lee Jones [李琼斯]
Quoted 34 lines · On Sat, Jan 07, 2023 at 07:26:15PM +0100, Sam Ravnborg via B4 Submission…
This series refactor backlight users to avoid use of the deprecated backlight_properties.fb_blank member.
Stephen Kitt <[email protected]> and others already did a lot of work and this is the final touches.
Patches 1-13 are independent and can be applied individually. Patch 14 was already sent by Stephen and included here to make the series complete.
The last patch may have to wait to avoid breaking the build as it depends on all the other patches.
The series touches several sub-systems, so with acks I could take them all in drm-misc. Or we can let the subsystems take them and wait until next merge window with the final removal. As new users of
fb_blankdo not pop up that often, waiting one merge cycle is fine.Sam
To: Nicolas Ferre <[email protected]>
To: Helge Deller <[email protected]>
To: Alexandre Belloni <[email protected]>
To: Claudiu Beznea <[email protected]>
To: Antonino Daplas <[email protected]>
To: Benjamin Herrenschmidt <[email protected]>
To: Paul Mackerras <[email protected]>
To: Greg Kroah-Hartman <[email protected]>
To: Robin van der Gracht <[email protected]>
To: Miguel Ojeda <[email protected]>
To: Lee Jones <[email protected]>
To: Daniel Thompson <[email protected]>
To: Jingoo Han <[email protected]>
Quoted 8 lines
Cc Stephen Kitt <[email protected]>Signed-off-by Sam Ravnborg <[email protected]>
I have created a helper script [1] to send series, so it hides these long Cc lists behind the command line parameters. Feel free to use / comment / update / take any ideas from it...
[1]: https://github.com/andy-shev/home-bin-tools/blob/master/ge2maintainer.sh
Signature · 2 lines
With Best Regards, Andy Shevchenko