2022-06-07 22:21:06

by Stephen Kitt

[permalink] [raw]
Subject: [PATCH 0/4] platform/x86: Use backlight helpers

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.

This will ultimately allow fb_blank to be removed.

Stephen Kitt (4):
platform/x86: acer-wmi: Use backlight helper
platform/x86: apple-gmux: Use backlight helper
platform/x86: compal-laptop: Use backlight helper
platform/x86: thinkpad_acpi: Use backlight helper

drivers/platform/x86/acer-wmi.c | 7 +------
drivers/platform/x86/apple-gmux.c | 5 +----
drivers/platform/x86/compal-laptop.c | 4 +---
drivers/platform/x86/thinkpad_acpi.c | 5 +----
4 files changed, 4 insertions(+), 17 deletions(-)


base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
--
2.30.2


2022-06-08 04:23:04

by Stephen Kitt

[permalink] [raw]
Subject: [PATCH 3/4] platform/x86: compal-laptop: Use backlight helper

Instead of manually checking the power state in struct
backlight_properties, use backlight_is_blank().

Signed-off-by: Stephen Kitt <[email protected]>
Cc: Cezary Jackiewicz <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Mark Gross <[email protected]>
Cc: [email protected]
---
drivers/platform/x86/compal-laptop.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index ab610376fdad..0942f50bd793 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -324,9 +324,7 @@ static int bl_update_status(struct backlight_device *b)
if (ret)
return ret;

- set_backlight_state((b->props.power == FB_BLANK_UNBLANK)
- && !(b->props.state & BL_CORE_SUSPENDED)
- && !(b->props.state & BL_CORE_FBBLANK));
+ set_backlight_state(!backlight_is_blank(b));
return 0;
}

--
2.30.2

2022-06-08 04:37:35

by Stephen Kitt

[permalink] [raw]
Subject: [PATCH 4/4] platform/x86: thinkpad_acpi: Use backlight helper

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.

Signed-off-by: Stephen Kitt <[email protected]>
Cc: Henrique de Moraes Holschuh <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Mark Gross <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/platform/x86/thinkpad_acpi.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index e6cb4a14cdd4..a9337bd1d125 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -6796,10 +6796,7 @@ static int brightness_set(unsigned int value)

static int brightness_update_status(struct backlight_device *bd)
{
- unsigned int level =
- (bd->props.fb_blank == FB_BLANK_UNBLANK &&
- bd->props.power == FB_BLANK_UNBLANK) ?
- bd->props.brightness : 0;
+ int level = backlight_get_brightness(bd);

dbg_printk(TPACPI_DBG_BRGHT,
"backlight: attempt to set level to %d\n",
--
2.30.2

2022-06-08 05:08:17

by Stephen Kitt

[permalink] [raw]
Subject: [PATCH 2/4] platform/x86: apple-gmux: Use backlight helper

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.

Signed-off-by: Stephen Kitt <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Mark Gross <[email protected]>
Cc: [email protected]
---
drivers/platform/x86/apple-gmux.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
index 57553f9b4d1d..ffe98a18440b 100644
--- a/drivers/platform/x86/apple-gmux.c
+++ b/drivers/platform/x86/apple-gmux.c
@@ -291,10 +291,7 @@ static int gmux_get_brightness(struct backlight_device *bd)
static int gmux_update_status(struct backlight_device *bd)
{
struct apple_gmux_data *gmux_data = bl_get_data(bd);
- u32 brightness = bd->props.brightness;
-
- if (bd->props.state & BL_CORE_SUSPENDED)
- return 0;
+ u32 brightness = backlight_get_brightness(bd);

gmux_write32(gmux_data, GMUX_PORT_BRIGHTNESS, brightness);

--
2.30.2

2022-06-08 15:44:29

by Daniel Thompson

[permalink] [raw]
Subject: Re: [PATCH 4/4] platform/x86: thinkpad_acpi: Use backlight helper

On Tue, Jun 07, 2022 at 08:46:35PM +0200, Stephen Kitt wrote:
> 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.
>
> Signed-off-by: Stephen Kitt <[email protected]>
> Cc: Henrique de Moraes Holschuh <[email protected]>
> Cc: Hans de Goede <[email protected]>
> Cc: Mark Gross <[email protected]>
> Cc: [email protected]
> Cc: [email protected]

Reviewed-by: Daniel Thompson <[email protected]>


Daniel.

2022-06-08 15:45:46

by Daniel Thompson

[permalink] [raw]
Subject: Re: [PATCH 2/4] platform/x86: apple-gmux: Use backlight helper

On Tue, Jun 07, 2022 at 08:46:33PM +0200, Stephen Kitt wrote:
> 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.
>
> Signed-off-by: Stephen Kitt <[email protected]>
> Cc: Hans de Goede <[email protected]>
> Cc: Mark Gross <[email protected]>
> Cc: [email protected]

Reviewed-by: Daniel Thompson <[email protected]>


Daniel.

2022-06-08 15:59:45

by Daniel Thompson

[permalink] [raw]
Subject: Re: [PATCH 3/4] platform/x86: compal-laptop: Use backlight helper

On Tue, Jun 07, 2022 at 08:46:34PM +0200, Stephen Kitt wrote:
> Instead of manually checking the power state in struct
> backlight_properties, use backlight_is_blank().
>
> Signed-off-by: Stephen Kitt <[email protected]>
> Cc: Cezary Jackiewicz <[email protected]>
> Cc: Hans de Goede <[email protected]>
> Cc: Mark Gross <[email protected]>
> Cc: [email protected]

Reviewed-by: Daniel Thompson <[email protected]>


Daniel.

2022-06-22 10:11:58

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH 0/4] platform/x86: Use backlight helpers

Hi,

On 6/7/22 20:46, 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.
>
> This will ultimately allow fb_blank to be removed.
>
> Stephen Kitt (4):
> platform/x86: acer-wmi: Use backlight helper
> platform/x86: apple-gmux: Use backlight helper
> platform/x86: compal-laptop: Use backlight helper
> platform/x86: thinkpad_acpi: Use backlight helper
>
> drivers/platform/x86/acer-wmi.c | 7 +------
> drivers/platform/x86/apple-gmux.c | 5 +----
> drivers/platform/x86/compal-laptop.c | 4 +---
> drivers/platform/x86/thinkpad_acpi.c | 5 +----
> 4 files changed, 4 insertions(+), 17 deletions(-)

Thank you for your patch-series, I've applied the series to my
review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans