* [PATCH 1/4] platform/x86: acer-wmi: Use backlight helper
2022-06-07 18:46 [PATCH 0/4] platform/x86: Use backlight helpers Stephen Kitt
@ 2022-06-07 18:46 ` Stephen Kitt
2022-06-08 15:06 ` Daniel Thompson
2022-06-07 18:46 ` [PATCH 2/4] platform/x86: apple-gmux: " Stephen Kitt
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Stephen Kitt @ 2022-06-07 18:46 UTC (permalink / raw)
To: Lee, Chun-Yi, Hans de Goede, Mark Gross, Cezary Jackiewicz,
Henrique de Moraes Holschuh
Cc: platform-driver-x86, linux-kernel, Stephen Kitt
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 <steve@sk2.org>
Cc: "Lee, Chun-Yi" <jlee@suse.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <markgross@kernel.org>
Cc: platform-driver-x86@vger.kernel.org
---
drivers/platform/x86/acer-wmi.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 9c6943e401a6..e0230ea0cb7e 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1615,12 +1615,7 @@ static int read_brightness(struct backlight_device *bd)
static int update_bl_status(struct backlight_device *bd)
{
- int intensity = bd->props.brightness;
-
- if (bd->props.power != FB_BLANK_UNBLANK)
- intensity = 0;
- if (bd->props.fb_blank != FB_BLANK_UNBLANK)
- intensity = 0;
+ int intensity = backlight_get_brightness(bd);
set_u32(intensity, ACER_CAP_BRIGHTNESS);
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] platform/x86: acer-wmi: Use backlight helper
2022-06-07 18:46 ` [PATCH 1/4] platform/x86: acer-wmi: Use backlight helper Stephen Kitt
@ 2022-06-08 15:06 ` Daniel Thompson
0 siblings, 0 replies; 10+ messages in thread
From: Daniel Thompson @ 2022-06-08 15:06 UTC (permalink / raw)
To: Stephen Kitt
Cc: Lee, Chun-Yi, Hans de Goede, Mark Gross, Cezary Jackiewicz,
Henrique de Moraes Holschuh, platform-driver-x86, linux-kernel
On Tue, Jun 07, 2022 at 08:46:32PM +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 <steve@sk2.org>
> Cc: "Lee, Chun-Yi" <jlee@suse.com>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Mark Gross <markgross@kernel.org>
> Cc: platform-driver-x86@vger.kernel.org
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Daniel.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/4] platform/x86: apple-gmux: Use backlight helper
2022-06-07 18:46 [PATCH 0/4] platform/x86: Use backlight helpers Stephen Kitt
2022-06-07 18:46 ` [PATCH 1/4] platform/x86: acer-wmi: Use backlight helper Stephen Kitt
@ 2022-06-07 18:46 ` Stephen Kitt
2022-06-08 15:06 ` Daniel Thompson
2022-06-07 18:46 ` [PATCH 3/4] platform/x86: compal-laptop: " Stephen Kitt
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Stephen Kitt @ 2022-06-07 18:46 UTC (permalink / raw)
To: Lee, Chun-Yi, Hans de Goede, Mark Gross, Cezary Jackiewicz,
Henrique de Moraes Holschuh
Cc: platform-driver-x86, linux-kernel, Stephen Kitt
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 <steve@sk2.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <markgross@kernel.org>
Cc: platform-driver-x86@vger.kernel.org
---
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/4] platform/x86: apple-gmux: Use backlight helper
2022-06-07 18:46 ` [PATCH 2/4] platform/x86: apple-gmux: " Stephen Kitt
@ 2022-06-08 15:06 ` Daniel Thompson
0 siblings, 0 replies; 10+ messages in thread
From: Daniel Thompson @ 2022-06-08 15:06 UTC (permalink / raw)
To: Stephen Kitt
Cc: Lee, Chun-Yi, Hans de Goede, Mark Gross, Cezary Jackiewicz,
Henrique de Moraes Holschuh, platform-driver-x86, linux-kernel
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 <steve@sk2.org>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Mark Gross <markgross@kernel.org>
> Cc: platform-driver-x86@vger.kernel.org
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Daniel.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/4] platform/x86: compal-laptop: Use backlight helper
2022-06-07 18:46 [PATCH 0/4] platform/x86: Use backlight helpers Stephen Kitt
2022-06-07 18:46 ` [PATCH 1/4] platform/x86: acer-wmi: Use backlight helper Stephen Kitt
2022-06-07 18:46 ` [PATCH 2/4] platform/x86: apple-gmux: " Stephen Kitt
@ 2022-06-07 18:46 ` Stephen Kitt
2022-06-08 15:06 ` Daniel Thompson
2022-06-07 18:46 ` [PATCH 4/4] platform/x86: thinkpad_acpi: " Stephen Kitt
2022-06-22 9:54 ` [PATCH 0/4] platform/x86: Use backlight helpers Hans de Goede
4 siblings, 1 reply; 10+ messages in thread
From: Stephen Kitt @ 2022-06-07 18:46 UTC (permalink / raw)
To: Lee, Chun-Yi, Hans de Goede, Mark Gross, Cezary Jackiewicz,
Henrique de Moraes Holschuh
Cc: platform-driver-x86, linux-kernel, Stephen Kitt
Instead of manually checking the power state in struct
backlight_properties, use backlight_is_blank().
Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <markgross@kernel.org>
Cc: platform-driver-x86@vger.kernel.org
---
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] platform/x86: compal-laptop: Use backlight helper
2022-06-07 18:46 ` [PATCH 3/4] platform/x86: compal-laptop: " Stephen Kitt
@ 2022-06-08 15:06 ` Daniel Thompson
0 siblings, 0 replies; 10+ messages in thread
From: Daniel Thompson @ 2022-06-08 15:06 UTC (permalink / raw)
To: Stephen Kitt
Cc: Lee, Chun-Yi, Hans de Goede, Mark Gross, Cezary Jackiewicz,
Henrique de Moraes Holschuh, platform-driver-x86, linux-kernel
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 <steve@sk2.org>
> Cc: Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Mark Gross <markgross@kernel.org>
> Cc: platform-driver-x86@vger.kernel.org
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Daniel.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/4] platform/x86: thinkpad_acpi: Use backlight helper
2022-06-07 18:46 [PATCH 0/4] platform/x86: Use backlight helpers Stephen Kitt
` (2 preceding siblings ...)
2022-06-07 18:46 ` [PATCH 3/4] platform/x86: compal-laptop: " Stephen Kitt
@ 2022-06-07 18:46 ` Stephen Kitt
2022-06-08 15:07 ` Daniel Thompson
2022-06-22 9:54 ` [PATCH 0/4] platform/x86: Use backlight helpers Hans de Goede
4 siblings, 1 reply; 10+ messages in thread
From: Stephen Kitt @ 2022-06-07 18:46 UTC (permalink / raw)
To: Lee, Chun-Yi, Hans de Goede, Mark Gross, Cezary Jackiewicz,
Henrique de Moraes Holschuh
Cc: platform-driver-x86, linux-kernel, Stephen Kitt, ibm-acpi-devel
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 <steve@sk2.org>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <markgross@kernel.org>
Cc: ibm-acpi-devel@lists.sourceforge.net
Cc: platform-driver-x86@vger.kernel.org
---
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 4/4] platform/x86: thinkpad_acpi: Use backlight helper
2022-06-07 18:46 ` [PATCH 4/4] platform/x86: thinkpad_acpi: " Stephen Kitt
@ 2022-06-08 15:07 ` Daniel Thompson
0 siblings, 0 replies; 10+ messages in thread
From: Daniel Thompson @ 2022-06-08 15:07 UTC (permalink / raw)
To: Stephen Kitt
Cc: Lee, Chun-Yi, Hans de Goede, Mark Gross, Cezary Jackiewicz,
Henrique de Moraes Holschuh, platform-driver-x86, linux-kernel,
ibm-acpi-devel
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 <steve@sk2.org>
> Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Mark Gross <markgross@kernel.org>
> Cc: ibm-acpi-devel@lists.sourceforge.net
> Cc: platform-driver-x86@vger.kernel.org
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Daniel.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/4] platform/x86: Use backlight helpers
2022-06-07 18:46 [PATCH 0/4] platform/x86: Use backlight helpers Stephen Kitt
` (3 preceding siblings ...)
2022-06-07 18:46 ` [PATCH 4/4] platform/x86: thinkpad_acpi: " Stephen Kitt
@ 2022-06-22 9:54 ` Hans de Goede
4 siblings, 0 replies; 10+ messages in thread
From: Hans de Goede @ 2022-06-22 9:54 UTC (permalink / raw)
To: Stephen Kitt, Lee, Chun-Yi, Mark Gross, Cezary Jackiewicz,
Henrique de Moraes Holschuh
Cc: platform-driver-x86, linux-kernel
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
^ permalink raw reply [flat|nested] 10+ messages in thread