Skip to content

Commit 3a0cf7a

Browse files
committed
ACPI: video: Change how we determine if brightness key-presses are handled
Some systems have an ACPI video bus but not ACPI video devices with backlight capability. On these devices brightness key-presses are (logically) not reported through the ACPI video bus. Change how acpi_video_handles_brightness_key_presses() determines if brightness key-presses are handled by the ACPI video driver to avoid vendor specific drivers/platform/x86 drivers filtering out their brightness key-presses even though they are the only ones reporting these presses. Fixes: ed83c91 ("platform/x86: panasonic-laptop: Resolve hotkey double trigger bug") Reported-and-tested-by: Stefan Seyfried <[email protected]> Reported-and-tested-by: Kenneth Chan <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 8853e8c commit 3a0cf7a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

drivers/acpi/acpi_video.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ module_param(device_id_scheme, bool, 0444);
7373
static int only_lcd = -1;
7474
module_param(only_lcd, int, 0444);
7575

76+
static bool has_backlight;
7677
static int register_count;
7778
static DEFINE_MUTEX(register_count_mutex);
7879
static DEFINE_MUTEX(video_list_lock);
@@ -1222,6 +1223,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
12221223
acpi_video_device_bind(video, data);
12231224
acpi_video_device_find_cap(data);
12241225

1226+
if (data->cap._BCM && data->cap._BCL)
1227+
has_backlight = true;
1228+
12251229
mutex_lock(&video->device_list_lock);
12261230
list_add_tail(&data->entry, &video->video_device_list);
12271231
mutex_unlock(&video->device_list_lock);
@@ -2249,6 +2253,7 @@ void acpi_video_unregister(void)
22492253
if (register_count) {
22502254
acpi_bus_unregister_driver(&acpi_video_bus);
22512255
register_count = 0;
2256+
has_backlight = false;
22522257
}
22532258
mutex_unlock(&register_count_mutex);
22542259
}
@@ -2270,13 +2275,7 @@ void acpi_video_unregister_backlight(void)
22702275

22712276
bool acpi_video_handles_brightness_key_presses(void)
22722277
{
2273-
bool have_video_busses;
2274-
2275-
mutex_lock(&video_list_lock);
2276-
have_video_busses = !list_empty(&video_bus_head);
2277-
mutex_unlock(&video_list_lock);
2278-
2279-
return have_video_busses &&
2278+
return has_backlight &&
22802279
(report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS);
22812280
}
22822281
EXPORT_SYMBOL(acpi_video_handles_brightness_key_presses);

0 commit comments

Comments
 (0)