linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] auxdisplay: ht16k33: Use backlight helper
@ 2023-01-06 14:30 Stephen Kitt
  2023-01-07  0:56 ` Miguel Ojeda
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Stephen Kitt @ 2023-01-06 14:30 UTC (permalink / raw)
  To: Robin van der Gracht, Miguel Ojeda; +Cc: Stephen Kitt, linux-kernel

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.

Signed-off-by: Stephen Kitt <steve@sk2.org>
---

Notes:
    Changes since v1: mention BL_CORE_SUSPENDED.

 drivers/auxdisplay/ht16k33.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 02425991c159..15ab118c80f5 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -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);
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] auxdisplay: ht16k33: Use backlight helper
  2023-01-06 14:30 [PATCH v2] auxdisplay: ht16k33: Use backlight helper Stephen Kitt
@ 2023-01-07  0:56 ` Miguel Ojeda
  2023-01-08 10:03 ` Geert Uytterhoeven
  2023-01-09  9:51 ` Robin van der Gracht
  2 siblings, 0 replies; 9+ messages in thread
From: Miguel Ojeda @ 2023-01-07  0:56 UTC (permalink / raw)
  To: Stephen Kitt, Robin van der Gracht; +Cc: Miguel Ojeda, linux-kernel

On Fri, Jan 6, 2023 at 3:30 PM Stephen Kitt <steve@sk2.org> wrote:
>
>     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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] auxdisplay: ht16k33: Use backlight helper
  2023-01-06 14:30 [PATCH v2] auxdisplay: ht16k33: Use backlight helper Stephen Kitt
  2023-01-07  0:56 ` Miguel Ojeda
@ 2023-01-08 10:03 ` Geert Uytterhoeven
  2023-01-08 14:56   ` Miguel Ojeda
  2023-01-09  9:51 ` Robin van der Gracht
  2 siblings, 1 reply; 9+ messages in thread
From: Geert Uytterhoeven @ 2023-01-08 10:03 UTC (permalink / raw)
  To: Stephen Kitt; +Cc: Robin van der Gracht, Miguel Ojeda, linux-kernel

On Fri, Jan 6, 2023 at 4:10 PM Stephen Kitt <steve@sk2.org> wrote:
> 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.
>
> Signed-off-by: Stephen Kitt <steve@sk2.org>

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] auxdisplay: ht16k33: Use backlight helper
  2023-01-08 10:03 ` Geert Uytterhoeven
@ 2023-01-08 14:56   ` Miguel Ojeda
  2023-01-08 18:32     ` Geert Uytterhoeven
  0 siblings, 1 reply; 9+ messages in thread
From: Miguel Ojeda @ 2023-01-08 14:56 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Stephen Kitt, Robin van der Gracht, Miguel Ojeda, linux-kernel

On Sun, Jan 8, 2023 at 11:03 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

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.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] auxdisplay: ht16k33: Use backlight helper
  2023-01-08 14:56   ` Miguel Ojeda
@ 2023-01-08 18:32     ` Geert Uytterhoeven
  2023-01-08 19:11       ` Miguel Ojeda
  0 siblings, 1 reply; 9+ messages in thread
From: Geert Uytterhoeven @ 2023-01-08 18:32 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Stephen Kitt, Robin van der Gracht, Miguel Ojeda, linux-kernel

Hi Miguel,

On Sun, Jan 8, 2023 at 3:57 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
> On Sun, Jan 8, 2023 at 11:03 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
>
> 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/Y7qM+ZlG5gQiOW4K@ravnborg.org ?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] auxdisplay: ht16k33: Use backlight helper
  2023-01-08 18:32     ` Geert Uytterhoeven
@ 2023-01-08 19:11       ` Miguel Ojeda
  2023-01-08 20:17         ` Sam Ravnborg
  0 siblings, 1 reply; 9+ messages in thread
From: Miguel Ojeda @ 2023-01-08 19:11 UTC (permalink / raw)
  To: Geert Uytterhoeven, Sam Ravnborg
  Cc: Stephen Kitt, Robin van der Gracht, Miguel Ojeda, linux-kernel

On Sun, Jan 8, 2023 at 7:32 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Oh, I sent it here because of
> https://lore.kernel.org/all/Y7qM+ZlG5gQiOW4K@ravnborg.org ?

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!)...

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] auxdisplay: ht16k33: Use backlight helper
  2023-01-08 19:11       ` Miguel Ojeda
@ 2023-01-08 20:17         ` Sam Ravnborg
  2023-01-09  7:11           ` Stephen Kitt
  0 siblings, 1 reply; 9+ messages in thread
From: Sam Ravnborg @ 2023-01-08 20:17 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Geert Uytterhoeven, Stephen Kitt, Robin van der Gracht,
	Miguel Ojeda, linux-kernel

Hi all.

On Sun, Jan 08, 2023 at 08:11:52PM +0100, Miguel Ojeda wrote:
> On Sun, Jan 8, 2023 at 7:32 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> >
> > Oh, I sent it here because of
> > https://lore.kernel.org/all/Y7qM+ZlG5gQiOW4K@ravnborg.org ?
> 
> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] auxdisplay: ht16k33: Use backlight helper
  2023-01-08 20:17         ` Sam Ravnborg
@ 2023-01-09  7:11           ` Stephen Kitt
  0 siblings, 0 replies; 9+ messages in thread
From: Stephen Kitt @ 2023-01-09  7:11 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Miguel Ojeda, Geert Uytterhoeven, Robin van der Gracht,
	Miguel Ojeda, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 756 bytes --]

On Sun, 8 Jan 2023 21:17:43 +0100, Sam Ravnborg <sam@ravnborg.org> wrote:
> On Sun, Jan 08, 2023 at 08:11:52PM +0100, Miguel Ojeda wrote:
> > On Sun, Jan 8, 2023 at 7:32 PM Geert Uytterhoeven <geert@linux-m68k.org>
> > wrote:  
> > >
> > > Oh, I sent it here because of
> > > https://lore.kernel.org/all/Y7qM+ZlG5gQiOW4K@ravnborg.org ?  
> > 
> > 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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] auxdisplay: ht16k33: Use backlight helper
  2023-01-06 14:30 [PATCH v2] auxdisplay: ht16k33: Use backlight helper Stephen Kitt
  2023-01-07  0:56 ` Miguel Ojeda
  2023-01-08 10:03 ` Geert Uytterhoeven
@ 2023-01-09  9:51 ` Robin van der Gracht
  2 siblings, 0 replies; 9+ messages in thread
From: Robin van der Gracht @ 2023-01-09  9:51 UTC (permalink / raw)
  To: Stephen Kitt
  Cc: Miguel Ojeda, linux-kernel, Sam Ravnborg, Geert Uytterhoeven,
	Greg Kroah-Hartman

On 2023-01-06 15:30, Stephen Kitt wrote:
> 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.
> 
> Signed-off-by: Stephen Kitt <steve@sk2.org>
> ---
> 
> Notes:
>     Changes since v1: mention BL_CORE_SUSPENDED.
> 
>  drivers/auxdisplay/ht16k33.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c 
> b/drivers/auxdisplay/ht16k33.c
> index 02425991c159..15ab118c80f5 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -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);
>  }

Thank you Stephen (and Sam), looks good!

Reviewed-by: Robin van der Gracht <robin@protonic.nl>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-01-09 10:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 14:30 [PATCH v2] auxdisplay: ht16k33: Use backlight helper Stephen Kitt
2023-01-07  0:56 ` Miguel Ojeda
2023-01-08 10:03 ` Geert Uytterhoeven
2023-01-08 14:56   ` Miguel Ojeda
2023-01-08 18:32     ` Geert Uytterhoeven
2023-01-08 19:11       ` Miguel Ojeda
2023-01-08 20:17         ` Sam Ravnborg
2023-01-09  7:11           ` Stephen Kitt
2023-01-09  9:51 ` Robin van der Gracht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).