Skip to contentSkip to conversation

auxdisplay: ht16k33: Use backlight helper

PATCH In review Stephen Kitt 5 participants 9 messages Jan 6, 2023 – Jan 9, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 auxdisplay: ht16k33: Use backlight helper

backlight_properties.fb_blank is deprecated. The states it represents are handled by other properties; but instead of accessing those properties directly, drivers should use the helpers provided by backlight.h.

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.

This means that BL_CORE_SUSPENDED is now taken into account, as it should be.

---

Notes:
Changes since v1: mention BL_CORE_SUSPENDED.

 drivers/auxdisplay/ht16k33.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/auxdisplay/ht16k33.c +1 -6
index 02425991c159..15ab118c80f5 100644
@@ -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.30.2
#1 lore raw
Quoted 2 lines · Stephen Kitt

Changes since v1: mention BL_CORE_SUSPENDED.

Thanks Stephen.

Robin, it would be great to get your ack/review (or if you can give it a quick test, that would be great too).

Cheers,
Miguel

reviewer Reviewed-by on v2 1/1
#2 lore raw
In reply to Stephen Kitt
Quoted 10 lines · Stephen Kitt

backlight_properties.fb_blank is deprecated. The states it represents are handled by other properties; but instead of accessing those properties directly, drivers should use the helpers provided by backlight.h.

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.

Quoted 4 lines

This means that BL_CORE_SUSPENDED is now taken into account, as it should be.

Gr{oetje,eeting}s,

Geert

--
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

#4 lore raw

Hi Miguel,

Quoted 8 lines · Miguel Ojeda
Quoted 1 line · Geert Uytterhoeven

This will likely go through drm-misc as part of a bigger series:

    https://lore.kernel.org/lkml/20230107-sam-video-backlight-drop-fb_blank-v1-0-1bd9bafb351f@ravnborg.org/

So you may want to copy-paste your tag there.

Oh, I sent it here because of
https://lore.kernel.org/all/[email protected] ?

Gr{oetje,eeting}s,

Geert

--
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

#6 lore raw

Hi all.

Quoted 8 lines · Miguel Ojeda
Quoted 3 lines · Geert Uytterhoeven

Oh, I sent it here because of
https://lore.kernel.org/all/[email protected] ?

Yeah, sorry. I mentioned it just in case, since Sam asked for Robin's Ack in that thread, but I should have probably just Cc'd him here (done!)...

Stephen notified me that the patch is already applied - so no need for anything now. Sorry for the noise!

Sam

#7 lore raw
Quoted 7 lines · Sam Ravnborg
Quoted 6 lines · Miguel Ojeda
Quoted 3 lines · Geert Uytterhoeven

Oh, I sent it here because of
https://lore.kernel.org/all/[email protected] ?

Quoted 6 lines
Quoted 3 lines

Yeah, sorry. I mentioned it just in case, since Sam asked for Robin's Ack in that thread, but I should have probably just Cc'd him here (done!)...

Stephen notified me that the patch is already applied - so no need for anything now. Sorry for the noise!

That was the via-pmu-backlight patch; AFAIK the ht16k33 patch hasn’t been applied anywhere yet.

Regards,

Stephen

maintainer Reviewed-by on v2 1/1
#8 lore raw
In reply to Stephen Kitt
Quoted 32 lines · Stephen Kitt

backlight_properties.fb_blank is deprecated. The states it represents are handled by other properties; but instead of accessing those properties directly, drivers should use the helpers provided by backlight.h.

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.

This means that BL_CORE_SUSPENDED is now taken into account, as it should be.

---

Notes:
Changes since v1: mention BL_CORE_SUSPENDED.

 drivers/auxdisplay/ht16k33.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/auxdisplay/ht16k33.c +0 -1
index 02425991c159..15ab118c80f5 100644
@@ -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;

drivers/auxdisplay/ht16k33.c static int ht16k33_initialize(struct ht16k33_priv · line 322

Quoted 10 lines
drivers/auxdisplay/ht16k33.c +1 -5
+	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);
 }

Thank you Stephen (and Sam), looks good!