backlight: Remove struct backlight_properties.fb_blank
Subsystems (10)
cover backlight: Remove struct backlight_properties.fb_blank
The field fb_blank in struct backlight_properties has been marked for removal. Remove it in favor of the power and state fields.
Patches 1 to 5 prepare several backlight drivers. They remove fb_blank or replace driver code with existing helpers.
Patch 6 removes fb_blank from backlight core and drivers. This resolves another dependency between backlight nad fbdev.
Thomas Zimmermann (6):
auxdisplay/ht16k33: Replace use of fb_blank with backlight helper backlight/omap1-bl: Remove unused struct
omap_backlight_config.set_power
backlight/omap1-bl: Replace FB_BLANK_ states with simple on/off fbdev/omap2/omapfb: Replace use of fb_blank with backlight helpers staging/fbtft: Remove reference to fb_blank
backlight: Remove fb_blank from struct backlight_properties
drivers/auxdisplay/ht16k33.c | 7 +-- drivers/staging/fbtft/fb_ssd1351.c | 4 +- drivers/staging/fbtft/fbtft-core.c | 5 +- drivers/video/backlight/backlight.c | 2 - drivers/video/backlight/mp3309c.c | 1 - drivers/video/backlight/omap1_bl.c | 50 ++++++++----------- drivers/video/fbdev/atmel_lcdfb.c | 1 - .../omap2/omapfb/displays/panel-dsi-cm.c | 7 +-- .../omapfb/displays/panel-sony-acx565akm.c | 10 +--- include/linux/backlight.h | 25 +--------- include/linux/platform_data/omap1_bl.h | 1 - 11 files changed, 29 insertions(+), 84 deletions(-)
Signature · 1 line
2.44.0
PATCH 1/6 auxdisplay/ht16k33: Replace use of fb_blank with backlight helper
Replace the use of struct backlight_properties.fb_blank with a call to backlight_get_brightness(). The helper implement the same logic as the driver's function.
--- 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.44.0
PATCH 2/6 backlight/omap1-bl: Remove unused struct omap_backlight_config.set_power
In reply to Thomas ZimmermannThe callback set_power in struct omap_backlight_config is not implemented anywhere. Remove it from the structure and driver.
--- drivers/video/backlight/omap1_bl.c | 3 --- include/linux/platform_data/omap1_bl.h | 1 - 2 files changed, 4 deletions(-)
drivers/video/backlight/omap1_bl.c +0 -3
@@ -39,9 +39,6 @@ static inline void omapbl_send_enable(int 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 :
include/linux/platform_data/omap1_bl.h +0 -1
@@ -6,7 +6,6 @@struct omap_backlight_config {int default_intensity; -int (*set_power)(struct device *dev,int state); };#endif
Signature · 1 line
2.44.0
PATCH 3/6 backlight/omap1-bl: Replace FB_BLANK_ states with simple on/off
In reply to Thomas ZimmermannThe backlight is on for fb_blank eq FB_BLANK_UNBLANK, or off for any other value in fb_blank. But the field fb_blank in struct backlight_properties is deprecated and should not be used any longer.
Replace the test for fb_blank in omap's backlight code with a simple boolean parameter and push the test into the update_status helper. Instead of reading fb_blank directly, decode the backlight device's status with backlight_is_blank().
--- drivers/video/backlight/omap1_bl.c | 46 ++++++++++++++---------------- 1 file changed, 21 insertions(+), 25 deletions(-)
drivers/video/backlight/omap1_bl.c +21 -25
@@ -9,7 +9,6 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> -#include <linux/fb.h> #include <linux/backlight.h> #include <linux/slab.h> #include <linux/platform_data/omap1_bl.h>
@@ -20,7 +19,7 @@#define OMAPBL_MAX_INTENSITY 0xffstruct omap_backlight { -int powermode; +bool power;int current_intensity;struct device *dev;
@@ -37,21 +36,14 @@ 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) +static void omapbl_power (struct omap_backlight *bl,bool on) { -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 : +if (on) {omapbl_send_intensity (bl->current_intensity);omapbl_send_enable (1 ); -break ; + }else { +omapbl_send_intensity (0 ); +omapbl_send_enable (0 ); } }
@@ -61,7 +53,7 @@ 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 ); +omapbl_power (bl, false);return 0 ; }
@@ -70,33 +62,37 @@ 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); +omapbl_power (bl, bl->power);return 0 ; }#endif -static int omapbl_set_power (struct backlight_device *dev,int state) +static void omapbl_set_power (struct backlight_device *dev,bool on) {struct omap_backlight *bl =bl_get_data (dev); -omapbl_blank (bl, state); - bl->powermode = state; - -return 0 ; +omapbl_power (bl, on); + bl->power = on; }static int omapbl_update_status (struct backlight_device *dev) {struct omap_backlight *bl =bl_get_data (dev); +bool power;if (bl->current_intensity != dev->props.brightness) { -if (bl->powermode ==FB_BLANK_UNBLANK ) +if (bl->power)omapbl_send_intensity (dev->props.brightness); bl->current_intensity = dev->props.brightness; } -if (dev->props.fb_blank != bl->powermode) -omapbl_set_power (dev, dev->props.fb_blank); +if (backlight_is_blank (dev)) + power = false; +else + power = true; + +if (power != bl->power) +omapbl_set_power (dev, power);return 0 ; }
@@ -136,7 +132,7 @@ static int omapbl_probe(struct platform_device *pdev)if (IS_ERR (dev))return PTR_ERR (dev); - bl->powermode =FB_BLANK_POWERDOWN ; + bl->power = false; bl->current_intensity =0 ; bl->pdata = pdata;
Signature · 1 line
2.44.0
PATCH 4/6 fbdev/omap2/omapfb: Replace use of fb_blank with backlight helpers
In reply to Thomas ZimmermannReplace the use of struct backlight_properties.fb_blank with backlight helpers. This effects testing if the backlight is blanked and reading the backlight's brightness level.
--- drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c | 6 +----- .../fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c | 9 ++------- 2 files changed, 3 insertions(+), 12 deletions(-)
drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c +1 -5
@@ -356,11 +356,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)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 ; +return backlight_get_brightness (dev); }static const struct backlight_ops dsicm_bl_ops = {
drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c +2 -7
@@ -340,11 +340,7 @@ static int acx565akm_bl_update_status(struct backlight_device *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 ; + level =backlight_get_brightness (dev);if (ddata->has_bc)acx565akm_set_brightness (ddata, level);
@@ -363,8 +359,7 @@ 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 (!backlight_is_blank (dev)) {if (ddata->has_bc)return acx565akm_get_actual_brightness (ddata);else
Signature · 1 line
2.44.0
PATCH 5/6 staging/fbtft: Remove reference to fb_blank
In reply to Thomas ZimmermannThe field fb_blank in struct backlight_properties is deprecated and should not be used. Don't output its value in the driver's debug print.
--- drivers/staging/fbtft/fb_ssd1351.c | 4 +--- drivers/staging/fbtft/fbtft-core.c | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/staging/fbtft/fb_ssd1351.c +1 -3
@@ -194,9 +194,7 @@ static int update_onboard_backlight(struct backlight_device *bd)struct fbtft_par *par =bl_get_data (bd);bool on; -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: power=%d\n" , __func__, bd->props.power); on = !backlight_is_blank (bd);/* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */
drivers/staging/fbtft/fbtft-core.c +2 -3
@@ -133,9 +133,8 @@ static int fbtft_backlight_update_status(struct backlight_device *bd)struct fbtft_par *par =bl_get_data (bd);bool polarity = par->polarity; -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, power=%d\n" , __func__, + polarity, bd->props.power);if (!backlight_is_blank (bd))gpiod_set_value (par->gpio.led[0 ], polarity);
Signature · 1 line
2.44.0
PATCH 6/6 backlight: Remove fb_blank from struct backlight_properties
In reply to Thomas ZimmermannRemove the field fb_blank from struct backlight_properties and remove all code that still sets or reads it. Backlight blank status is now tracked exclusively in struct backlight_properties.state.
The core backlight code keeps the fb_blank and state fields in sync, but doesn't do anything else with fb_blank. Several drivers initialize fb_blank to FB_BLANK_UNBLANK to enable the backlight. This is already the default for the state field. So we can delete the fb_blank code from core and drivers and rely on the state field.
--- drivers/video/backlight/backlight.c | 2 -- drivers/video/backlight/mp3309c.c | 1 - drivers/video/backlight/omap1_bl.c | 1 - drivers/video/fbdev/atmel_lcdfb.c | 1 - .../omap2/omapfb/displays/panel-dsi-cm.c | 1 - .../omapfb/displays/panel-sony-acx565akm.c | 1 - include/linux/backlight.h | 25 +------------------ 7 files changed, 1 insertion(+), 31 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); } }
drivers/video/backlight/mp3309c.c +0 -1
@@ -378,7 +378,6 @@ static int mp3309c_probe(struct i2c_client *client) props.scale =BACKLIGHT_SCALE_LINEAR ; props.type =BACKLIGHT_RAW ; props.power =FB_BLANK_UNBLANK ; - props.fb_blank =FB_BLANK_UNBLANK ; chip->bl =devm_backlight_device_register (chip->dev,"mp3309c" , chip->dev, chip, &mp3309c_bl_ops, &props);
drivers/video/backlight/omap1_bl.c +0 -1
@@ -142,7 +142,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);
drivers/video/fbdev/atmel_lcdfb.c +0 -1
@@ -153,7 +153,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); }
drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c +0 -1
@@ -1215,7 +1215,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 +0 -1
@@ -753,7 +753,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 ;
include/linux/backlight.h +1 -24
@@ -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);
@@ -395,15 +374,13 @@ static inline int backlight_disable(struct backlight_device *bd)* Display is expected to be blank if any of these is true:: * * 1) if power in not UNBLANK -* 2) if fb_blank is not UNBLANK -* 3) if state indicate BLANK or SUSPENDED +* 2) if state indicate BLANK or SUSPENDED * * Returns true if display is expected to be blank, false otherwise. */ 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.44.0
Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper
In reply to Thomas ZimmermannHi Thomas,
Thanks for this!
Cc'ing Andy and Geert -- the new maintainer and reviewer.
Also, a couple quick notes below since I am here...
Quoted 4 lines · Thomas Zimmermann
Replace the use of struct backlight_properties.fb_blank with a call to
backlight_get_brightness(). The helper implement the same logic as the driver's function.
It is not exactly the same logic since backlight_is_blank accounts for BL_CORE_SUSPENDED.
drivers/auxdisplay/ht16k33.c static int ht16k33_initialize(struct ht16k33_priv *priv) · line 317
Quoted 2 lines
drivers/auxdisplay/ht16k33.c +1
-1-int brightness = bl->props.brightness; +int brightness =backlight_get_brightness (bl);
This can be const now (or even removed and have the call embedded below).
Cheers,
Miguel
Lee Jones
maintainerRe: [PATCH 2/6] backlight/omap1-bl: Remove unused struct omap_backlight_config.set_power
In reply to Thomas ZimmermannQuoted 8 lines · Thomas Zimmermann
The callback
set_powerin structomap_backlight_configis not implemented anywhere. Remove it from the structure and driver.Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/video/backlight/omap1_bl.c | 3 --- include/linux/platform_data/omap1_bl.h | 1 - 2 files changed, 4 deletions(-)
Just a quick one - I'm sure Daniel will be here soon to conduct a proper review.
Could you attempt to use the subject line format expected by a given subsystem please?
git log --oneline -- <subsystem> is your friend.
Thanks.
Signature · 1 line
Lee Jones [李琼斯]
Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper
In reply to Miguel OjedaQuoted 5 lines · Miguel Ojeda
drivers/auxdisplay/ht16k33.c static int ht16k33_initialize(struct ht16k33_priv *priv) · line 317
Quoted 2 lines
drivers/auxdisplay/ht16k33.c +1
-1-int brightness = bl->props.brightness; +int brightness =backlight_get_brightness (bl);This can be
constnow (or even removed and have the call embedded below).
Is there an advantage to making this const?
regards,
dan carpenter
Re: [PATCH 5/6] staging/fbtft: Remove reference to fb_blank
In reply to Thomas ZimmermannQuoted 7 lines · Thomas Zimmermann
The field
fb_blankin structbacklight_propertiesis deprecated and should not be used. Don't output its value in the driver's debug print.Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/staging/fbtft/fb_ssd1351.c | 4 +--- drivers/staging/fbtft/fbtft-core.c | 5 ++---
regards,
dan carpenter
Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper
In reply to Thomas ZimmermannQuoted 3 lines · Thomas Zimmermann
Replace the use of struct backlight_properties.fb_blank with a call to
backlight_get_brightness(). The helper implement the same logic as the driver's function.
If you end up resending there is a typo s/implement/implements/.
regards,
dan carpenter
I was only going to comment on the staging bits but, heck, I reviewed the whole series.
regards,
dan carpenter
Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper
In reply to Dan CarpenterQuoted 2 lines · Dan Carpenter
Is there an advantage to making this const?
Not much in this case -- it is more about trying to be const-correct where possible.
Cheers,
Miguel
Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper
In reply to Miguel OjedaHi Miguel.
Quoted 8 lines · Miguel Ojeda
Hi Thomas,
Thanks for this!
Cc'ing Andy and Geert -- the new maintainer and reviewer.
Also, a couple quick notes below since I am here...
Quoted 8 lines
Quoted 4 lines · Thomas Zimmermann
Replace the use of struct backlight_properties.fb_blank with a call to
backlight_get_brightness(). The helper implement the same logic as the driver's function.It is not exactly the same logic since
backlight_is_blankaccounts forBL_CORE_SUSPENDED.
The driver does not set BL_CORE_SUSPENDRESUME so that part is a nop.
Sam
Re: [PATCH 3/6] backlight/omap1-bl: Replace FB_BLANK_ states with simple on/off
In reply to Thomas ZimmermannHi Thomas,
Quoted 11 lines · Thomas Zimmermann
The backlight is on for
fb_blankeqFB_BLANK_UNBLANK, or off for any other value infb_blank. But the fieldfb_blankin structbacklight_propertiesis deprecated and should not be used any longer.Replace the test for
fb_blankin omap's backlight code with a simple boolean parameter and push the test into theupdate_statushelper. Instead of readingfb_blankdirectly, decode the backlight device's status withbacklight_is_blank().Signed-off-by Thomas Zimmermann <[email protected]>
My biased opinion is that the approach in this patch is a little bit better:
https://lore.kernel.org/lkml/20230107-sam-video-backlight-drop-fb_blank-v1-13-1bd9bafb351f@ravnborg.org/
I never came around resending this series it seems.
Sam
Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper
In reply to Thomas ZimmermannQuoted 7 lines · Thomas Zimmermann
Replace the use of struct backlight_properties.fb_blank with a call to
backlight_get_brightness(). The helper implement the same logic as the driver's function.Signed-off-by Thomas Zimmermann <[email protected]>Cc Robin van der Gracht <[email protected]>Cc Miguel Ojeda <[email protected]>
Quoted 26 lines
--- 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.44.0
Re: [PATCH 2/6] backlight/omap1-bl: Remove unused struct omap_backlight_config.set_power
In reply to Thomas ZimmermannQuoted 4 lines · Thomas Zimmermann
The callback
set_powerin structomap_backlight_configis not implemented anywhere. Remove it from the structure and driver.Signed-off-by Thomas Zimmermann <[email protected]>
Quoted 33 lines
--- drivers/video/backlight/omap1_bl.c | 3 --- include/linux/platform_data/omap1_bl.h | 1 - 2 files changed, 4 deletions(-)drivers/video/backlight/omap1_bl.c +0
-3@@ -39,9 +39,6 @@ static inline void omapbl_send_enable(int 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 :include/linux/platform_data/omap1_bl.h +0
-1@@ -6,7 +6,6 @@struct omap_backlight_config {int default_intensity; -int (*set_power)(struct device *dev,int state); };#endif Signature · 1 line
2.44.0
Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper
In reply to Miguel OjedaHi
Am 13.03.24 um 17:08 schrieb Miguel Ojeda:
Quoted 5 lines
Hi Thomas,
Thanks for this!
Cc'ing Andy and Geert -- the new maintainer and reviewer.
Ah, sorry. They are not yet in my MAINTAINERS file.
Quoted 9 lines
Also, a couple quick notes below since I am here...
Quoted 3 lines · Thomas Zimmermann
Replace the use of struct backlight_properties.fb_blank with a call to
backlight_get_brightness(). The helper implement the same logic as the driver's function.It is not exactly the same logic since
backlight_is_blankaccounts forBL_CORE_SUSPENDED.
As Sam already said, it doesn't seem to make different in practice. I'd mention it in the commit message and that's it. Ok?
Best regards
Thomas
Quoted 7 lines
drivers/auxdisplay/ht16k33.c static int ht16k33_initialize(struct ht16k33_priv *priv) · line 317
Quoted 3 lines
drivers/auxdisplay/ht16k33.c +1
-1-int brightness = bl->props.brightness; +int brightness =backlight_get_brightness (bl);This can be
constnow (or even removed and have the call embedded below).Cheers,
Miguel
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Re: [PATCH 3/6] backlight/omap1-bl: Replace FB_BLANK_ states with simple on/off
In reply to Sam RavnborgHi
Am 13.03.24 um 19:00 schrieb Sam Ravnborg:
Quoted 13 lines
Hi Thomas,
Quoted 10 lines · Thomas Zimmermann
The backlight is on for
fb_blankeqFB_BLANK_UNBLANK, or off for any other value infb_blank. But the fieldfb_blankin structbacklight_propertiesis deprecated and should not be used any longer.Replace the test for
fb_blankin omap's backlight code with a simple boolean parameter and push the test into theupdate_statushelper. Instead of readingfb_blankdirectly, decode the backlight device's status withbacklight_is_blank().
Quoted 6 lines
Quoted 1 line
Signed-off-by Thomas Zimmermann <[email protected]>My biased opinion is that the approach in this patch is a little bit better:
https://lore.kernel.org/lkml/20230107-sam-video-backlight-drop-fb_blank-v1-13-1bd9bafb351f@ravnborg.org/I never came around resending this series it seems.
Oh, that series has been around for over a year. I don't care about which patches go in as long as they remove the dependency on <linux/fb.h>. I saw that Dan has already r-b'ed the current patchset, but if you prefer I'll adopt yours.
Best regards
Thomas
Quoted 2 lines
Sam
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper
In reply to Thomas ZimmermannQuoted 5 lines · Thomas Zimmermann
Replace the use of struct backlight_properties.fb_blank with a call to
backlight_get_brightness(). The helper implement the same logic as the driver's function.Signed-off-by Thomas Zimmermann <[email protected]>
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH 3/6] backlight/omap1-bl: Replace FB_BLANK_ states with simple on/off
In reply to Thomas ZimmermannQuoted 21 lines · Thomas Zimmermann
Hi
Am 13.03.24 um 19:00 schrieb Sam Ravnborg:
Quoted 18 lines
Hi Thomas,
Quoted 11 lines · Thomas Zimmermann
The backlight is on for
fb_blankeqFB_BLANK_UNBLANK, or off for any other value infb_blank. But the fieldfb_blankin structbacklight_propertiesis deprecated and should not be used any longer.Replace the test for
fb_blankin omap's backlight code with a simple boolean parameter and push the test into theupdate_statushelper. Instead of readingfb_blankdirectly, decode the backlight device's status withbacklight_is_blank().Signed-off-by Thomas Zimmermann <[email protected]>My biased opinion is that the approach in this patch is a little bit better:
https://lore.kernel.org/lkml/20230107-sam-video-backlight-drop-fb_blank-v1-13-1bd9bafb351f@ravnborg.org/
Quoted 6 lines
Quoted 1 line
I never came around resending this series it seems.
Oh, that series has been around for over a year. I don't care about which patches go in as long as they remove the dependency on <
linux/fb.h>. I saw that Dan has already r-b'ed the current patchset, but if you prefer I'll adopt yours.
Whatever works for you. It is trivial stuff and as long as we get it cleaned up that is fine. You are pushing for this now - so whatever is easiest for you.
Sam
Re: [PATCH 3/6] backlight/omap1-bl: Replace FB_BLANK_ states with simple on/off
In reply to Thomas ZimmermannQuoted 21 lines · Thomas Zimmermann
Hi
Am 13.03.24 um 19:00 schrieb Sam Ravnborg:
Quoted 18 lines
Hi Thomas,
Quoted 11 lines · Thomas Zimmermann
The backlight is on for
fb_blankeqFB_BLANK_UNBLANK, or off for any other value infb_blank. But the fieldfb_blankin structbacklight_propertiesis deprecated and should not be used any longer.Replace the test for
fb_blankin omap's backlight code with a simple boolean parameter and push the test into theupdate_statushelper. Instead of readingfb_blankdirectly, decode the backlight device's status withbacklight_is_blank().Signed-off-by Thomas Zimmermann <[email protected]>My biased opinion is that the approach in this patch is a little bit better:
https://lore.kernel.org/lkml/20230107-sam-video-backlight-drop-fb_blank-v1-13-1bd9bafb351f@ravnborg.org/
Quoted 6 lines
Quoted 1 line
I never came around resending this series it seems.
Oh, that series has been around for over a year. I don't care about which patches go in as long as they remove the dependency on <
linux/fb.h>. I saw that Dan has already r-b'ed the current patchset, but if you prefer I'll adopt yours.
I hadn't seen Sam's patch. It's a little bit more daring, but it's really nice code and I trust him.
regards,
dan carpenter
RE: [PATCH 6/6] backlight: Remove fb_blank from struct backlight_properties
In reply to Thomas ZimmermannHi Thomas,
...
Quoted 1 line
drivers/video/backlight/mp3309c.c | 1 -
...
drivers/video/backlight/mp3309c.c static int mp3309c_probe(struct i2c_client *client) · line 383
Quoted 13 lines
drivers/video/backlight/mp3309c.c +0
-1@@ -378,7 +378,6 @@ static int mp3309c_probe(struct i2c_client *client) props.scale =BACKLIGHT_SCALE_LINEAR ; props.type =BACKLIGHT_RAW ; props.power =FB_BLANK_UNBLANK ; - props.fb_blank =FB_BLANK_UNBLANK ; chip->bl =devm_backlight_device_register (chip->dev,"mp3309c" , chip->dev, chip, &mp3309c_bl_ops, &props);
...
I've just tested your change with my board with the mp3309c backlight and all is ok. Thanks and best regards
Flavio
Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper
In reply to Sam RavnborgQuoted 2 lines · Sam Ravnborg
The driver does not set
BL_CORE_SUSPENDRESUMEso that part is a nop.
The driver may not set it now, but it is still not the same logic (and unless I am missing something it would not generate the same code either, so not sure I would say it is a "nop" in that sense).
But, yeah, I only meant to say that the commit message could be more accurate (e.g. mention why the difference does not matter) -- that is why I quoted the message instead of the code. Apologies if that was unclear.
Cheers,
Miguel
Miguel Ojeda
Reviewed-byRe: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper
In reply to Thomas ZimmermannQuoted 3 lines · Thomas Zimmermann
As Sam already said, it doesn't seem to make different in practice. I'd mention it in the commit message and that's it. Ok?
Yeah, that is what I meant -- thanks a lot!
Cheers,
Miguel
Re: [PATCH 1/6] auxdisplay/ht16k33: Replace use of fb_blank with backlight helper
In reply to Thomas ZimmermannHi Thomas,
Thank you for submitting your patch, it looks fine to me.
Quoted 31 lines · On Wed, 13 Mar 2024 16:45:00 +0100 Thomas Zimmermann <[email protected]>…
Replace the use of struct backlight_properties.fb_blank with a call to
backlight_get_brightness(). The helper implement the same logic as the driver's function.Signed-off-by Thomas Zimmermann <[email protected]>Cc Robin van der Gracht <[email protected]>Cc Miguel Ojeda <[email protected]>--- drivers/auxdisplay/ht16k33.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/auxdisplay/ht16k33.cindexa90430b7d07ba..83db829b97a5e100644 ---a/drivers/auxdisplay/ht16k33.c
+++b/drivers/auxdisplay/ht16k33.cdrivers/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); }
Re: [PATCH 2/6] backlight/omap1-bl: Remove unused struct omap_backlight_config.set_power
In reply to Thomas ZimmermannQuoted 4 lines · Thomas Zimmermann
The callback
set_powerin structomap_backlight_configis not implemented anywhere. Remove it from the structure and driver.Signed-off-by Thomas Zimmermann <[email protected]>
Daniel.
Re: [PATCH 3/6] backlight/omap1-bl: Replace FB_BLANK_ states with simple on/off
In reply to Thomas ZimmermannQuoted 28 lines · Thomas Zimmermann
The backlight is on for
fb_blankeqFB_BLANK_UNBLANK, or off for any other value infb_blank. But the fieldfb_blankin structbacklight_propertiesis deprecated and should not be used any longer.Replace the test for
fb_blankin omap's backlight code with a simple boolean parameter and push the test into theupdate_statushelper. Instead of readingfb_blankdirectly, decode the backlight device's status withbacklight_is_blank().Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/video/backlight/omap1_bl.c | 46 ++++++++++++++---------------- 1 file changed, 21 insertions(+), 25 deletions(-)drivers/video/backlight/omap1_bl.c +0
-1@@ -9,7 +9,6 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> -#include <linux/fb.h> #include <linux/backlight.h> #include <linux/slab.h> #include <linux/platform_data/omap1_bl.h>
drivers/video/backlight/omap1_bl.c line 22
Quoted 5 lines
drivers/video/backlight/omap1_bl.c +1
-1@@ -20,7 +19,7 @@#define OMAPBL_MAX_INTENSITY 0xffstruct omap_backlight { -int powermode; +bool power;
The new name is hard to read in several of the conditionals below (which were previously "documented" by the comparisons to constants.
This boolean effectively controls what we send to omapbl_send_enable(). On that basis I'd rather it was called something like "enabled".
drivers/video/backlight/omap1_bl.c static inline void omapbl_send_enable(int enable) · line 39
Quoted 9 lines
drivers/video/backlight/omap1_bl.c +1
-1int current_intensity;struct device *dev;@@ -37,21 +36,14 @@ 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) +static void omapbl_power (struct omap_backlight *bl,bool on)
As above omapbl_enable would be better.
Quoted 32 lines
drivers/video/backlight/omap1_bl.c +5
-12{ -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 : +if (on) {omapbl_send_intensity (bl->current_intensity);omapbl_send_enable (1 ); -break ; + }else { +omapbl_send_intensity (0 ); +omapbl_send_enable (0 ); } }@@ -61,7 +53,7 @@ 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 ); +omapbl_power (bl, false);return 0 ; }@@ -70,33 +62,37 @@ static int omapbl_resume(struct device *dev)struct backlight_device *bl_dev =dev_get_drvdata (dev);
drivers/video/backlight/omap1_bl.c static int omapbl_resume(struct device *dev) · line 70
Quoted 10 lines
drivers/video/backlight/omap1_bl.c +2
-2struct omap_backlight *bl =bl_get_data (bl_dev); -omapbl_blank (bl, bl->powermode); +omapbl_power (bl, bl->power); return 0; }#endif -static int omapbl_set_power (struct backlight_device *dev,int state) +static void omapbl_set_power (struct backlight_device *dev,bool on)
May also like a new name...
Quoted 19 lines
drivers/video/backlight/omap1_bl.c +4
-5{struct omap_backlight *bl =bl_get_data (dev); -omapbl_blank (bl, state); - bl->powermode = state; - -return 0 ; +omapbl_power (bl, on); + bl->power = on; }static int omapbl_update_status (struct backlight_device *dev) {struct omap_backlight *bl =bl_get_data (dev); +bool power;if (bl->current_intensity != dev->props.brightness) { -if (bl->powermode ==FB_BLANK_UNBLANK ) +if (bl->power)
drivers/video/backlight/omap1_bl.c static int omapbl_resume(struct device *dev) · line 92
Quoted 10 lines
drivers/video/backlight/omap1_bl.c +4
-2omapbl_send_intensity (dev->props.brightness); bl->current_intensity = dev->props.brightness; } -if (dev->props.fb_blank != bl->powermode) -omapbl_set_power (dev, dev->props.fb_blank); +if (backlight_is_blank (dev)) + power = false; +else + power = true;
I'd be happy with:
enable = !backlight_is_blank()
Daniel.
Re: [PATCH 6/6] backlight: Remove fb_blank from struct backlight_properties
In reply to Thomas ZimmermannQuoted 10 lines · Thomas Zimmermann
Remove the field
fb_blankfrom structbacklight_propertiesand remove all code that still sets or reads it. Backlight blank status is now tracked exclusively in struct backlight_properties.state.The core backlight code keeps the
fb_blankand state fields in sync, but doesn't do anything else withfb_blank. Several drivers initializefb_blanktoFB_BLANK_UNBLANKto enable the backlight. This is already the default for the state field. So we can delete thefb_blankcode from core and drivers and rely on the state field.
Quoted 5 lines
Signed-off-by Thomas Zimmermann <[email protected]>Cc Flavio Suligoi <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Claudiu Beznea <[email protected]>
Daniel.