* [PATCH] ACPI / video: Add new hw_changes_brightness quirk, set it on PB Easynote MZ35
@ 2019-07-12 10:00 Hans de Goede
2019-07-18 8:42 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2019-07-12 10:00 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown, Zhang Rui
Cc: Hans de Goede, linux-acpi, Kacper Piwiński
Some machines change the brightness themselves when a brightness hotkey
gets pressed, despite us telling them not to. This causes the brightness to
go two steps up / down when the hotkey is pressed. This is esp. a problem
on older machines with only a few brightness levels.
This commit adds a new hw_changes_brightness quirk which makes
acpi_video_device_notify() only call backlight_force_update(...,
BACKLIGHT_UPDATE_HOTKEY) and not do anything else, notifying userspace that
the brightness was changed and leaving it at that fixing the dual step
problem.
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204077
Cc: Kacper Piwiński <cosiekvfj@o2.pl>
Reported-and-tested-by: Kacper Piwiński <cosiekvfj@o2.pl>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/acpi/acpi_video.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 9489ffc06411..4f325e47519f 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -60,6 +60,12 @@ module_param(report_key_events, int, 0644);
MODULE_PARM_DESC(report_key_events,
"0: none, 1: output changes, 2: brightness changes, 3: all");
+static int hw_changes_brightness = -1;
+module_param(hw_changes_brightness, int, 0644);
+MODULE_PARM_DESC(hw_changes_brightness,
+ "Set this to 1 on buggy hw which changes the brightness itself when "
+ "a hotkey is pressed: -1: auto, 0: normal 1: hw-changes-brightness");
+
/*
* Whether the struct acpi_video_device_attrib::device_id_scheme bit should be
* assumed even if not actually set.
@@ -405,6 +411,14 @@ static int video_set_report_key_events(const struct dmi_system_id *id)
return 0;
}
+static int video_hw_changes_brightness(
+ const struct dmi_system_id *d)
+{
+ if (hw_changes_brightness == -1)
+ hw_changes_brightness = 1;
+ return 0;
+}
+
static const struct dmi_system_id video_dmi_table[] = {
/*
* Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
@@ -529,6 +543,21 @@ static const struct dmi_system_id video_dmi_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"),
},
},
+ /*
+ * Some machines change the brightness themselves when a brightness
+ * hotkey gets pressed, despite us telling them not to. In this case
+ * acpi_video_device_notify() should only call backlight_force_update(
+ * BACKLIGHT_UPDATE_HOTKEY) and not do anything else.
+ */
+ {
+ /* https://bugzilla.kernel.org/show_bug.cgi?id=204077 */
+ .callback = video_hw_changes_brightness,
+ .ident = "Packard Bell EasyNote MZ35",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Packard Bell"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "EasyNote MZ35"),
+ },
+ },
{}
};
@@ -1612,6 +1641,14 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
bus = video_device->video;
input = bus->input;
+ if (hw_changes_brightness > 0) {
+ if (video_device->backlight)
+ backlight_force_update(video_device->backlight,
+ BACKLIGHT_UPDATE_HOTKEY);
+ acpi_notifier_call_chain(device, event, 0);
+ return;
+ }
+
switch (event) {
case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */
brightness_switch_event(video_device, event);
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ACPI / video: Add new hw_changes_brightness quirk, set it on PB Easynote MZ35
2019-07-12 10:00 [PATCH] ACPI / video: Add new hw_changes_brightness quirk, set it on PB Easynote MZ35 Hans de Goede
@ 2019-07-18 8:42 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2019-07-18 8:42 UTC (permalink / raw)
To: Hans de Goede; +Cc: Len Brown, Zhang Rui, linux-acpi, Kacper Piwiński
On Friday, July 12, 2019 12:00:33 PM CEST Hans de Goede wrote:
> Some machines change the brightness themselves when a brightness hotkey
> gets pressed, despite us telling them not to. This causes the brightness to
> go two steps up / down when the hotkey is pressed. This is esp. a problem
> on older machines with only a few brightness levels.
>
> This commit adds a new hw_changes_brightness quirk which makes
> acpi_video_device_notify() only call backlight_force_update(...,
> BACKLIGHT_UPDATE_HOTKEY) and not do anything else, notifying userspace that
> the brightness was changed and leaving it at that fixing the dual step
> problem.
>
> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204077
> Cc: Kacper Piwiński <cosiekvfj@o2.pl>
> Reported-and-tested-by: Kacper Piwiński <cosiekvfj@o2.pl>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/acpi/acpi_video.c | 37 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
>
> diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
> index 9489ffc06411..4f325e47519f 100644
> --- a/drivers/acpi/acpi_video.c
> +++ b/drivers/acpi/acpi_video.c
> @@ -60,6 +60,12 @@ module_param(report_key_events, int, 0644);
> MODULE_PARM_DESC(report_key_events,
> "0: none, 1: output changes, 2: brightness changes, 3: all");
>
> +static int hw_changes_brightness = -1;
> +module_param(hw_changes_brightness, int, 0644);
> +MODULE_PARM_DESC(hw_changes_brightness,
> + "Set this to 1 on buggy hw which changes the brightness itself when "
> + "a hotkey is pressed: -1: auto, 0: normal 1: hw-changes-brightness");
> +
> /*
> * Whether the struct acpi_video_device_attrib::device_id_scheme bit should be
> * assumed even if not actually set.
> @@ -405,6 +411,14 @@ static int video_set_report_key_events(const struct dmi_system_id *id)
> return 0;
> }
>
> +static int video_hw_changes_brightness(
> + const struct dmi_system_id *d)
> +{
> + if (hw_changes_brightness == -1)
> + hw_changes_brightness = 1;
> + return 0;
> +}
> +
> static const struct dmi_system_id video_dmi_table[] = {
> /*
> * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
> @@ -529,6 +543,21 @@ static const struct dmi_system_id video_dmi_table[] = {
> DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"),
> },
> },
> + /*
> + * Some machines change the brightness themselves when a brightness
> + * hotkey gets pressed, despite us telling them not to. In this case
> + * acpi_video_device_notify() should only call backlight_force_update(
> + * BACKLIGHT_UPDATE_HOTKEY) and not do anything else.
> + */
> + {
> + /* https://bugzilla.kernel.org/show_bug.cgi?id=204077 */
> + .callback = video_hw_changes_brightness,
> + .ident = "Packard Bell EasyNote MZ35",
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "Packard Bell"),
> + DMI_MATCH(DMI_PRODUCT_NAME, "EasyNote MZ35"),
> + },
> + },
> {}
> };
>
> @@ -1612,6 +1641,14 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
> bus = video_device->video;
> input = bus->input;
>
> + if (hw_changes_brightness > 0) {
> + if (video_device->backlight)
> + backlight_force_update(video_device->backlight,
> + BACKLIGHT_UPDATE_HOTKEY);
> + acpi_notifier_call_chain(device, event, 0);
> + return;
> + }
> +
> switch (event) {
> case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */
> brightness_switch_event(video_device, event);
>
Applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-18 8:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12 10:00 [PATCH] ACPI / video: Add new hw_changes_brightness quirk, set it on PB Easynote MZ35 Hans de Goede
2019-07-18 8:42 ` Rafael J. Wysocki
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).