acpi_video.c (db6da59cf27b5661ced03754ae0550f8914eda9e) | acpi_video.c (6f7016819766a55bf90e21fdb8a8532418009adb) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * video.c - ACPI Video Driver 4 * 5 * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> 6 * Copyright (C) 2004 Bruno Ducrot <ducrot@poupinou.org> 7 * Copyright (C) 2006 Thomas Tuttle <linux-kernel@ttuttle.net> 8 */ --- 63 unchanged lines hidden (view full) --- 72 73static bool may_report_brightness_keys; 74static int register_count; 75static DEFINE_MUTEX(register_count_mutex); 76static DEFINE_MUTEX(video_list_lock); 77static LIST_HEAD(video_bus_head); 78static int acpi_video_bus_add(struct acpi_device *device); 79static void acpi_video_bus_remove(struct acpi_device *device); | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * video.c - ACPI Video Driver 4 * 5 * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> 6 * Copyright (C) 2004 Bruno Ducrot <ducrot@poupinou.org> 7 * Copyright (C) 2006 Thomas Tuttle <linux-kernel@ttuttle.net> 8 */ --- 63 unchanged lines hidden (view full) --- 72 73static bool may_report_brightness_keys; 74static int register_count; 75static DEFINE_MUTEX(register_count_mutex); 76static DEFINE_MUTEX(video_list_lock); 77static LIST_HEAD(video_bus_head); 78static int acpi_video_bus_add(struct acpi_device *device); 79static void acpi_video_bus_remove(struct acpi_device *device); |
80static void acpi_video_bus_notify(struct acpi_device *device, u32 event); | 80static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data); |
81 82/* 83 * Indices in the _BCL method response: the first two items are special, 84 * the rest are all supported levels. 85 * 86 * See page 575 of the ACPI spec 3.0 87 */ 88enum acpi_video_level_idx { --- 10 unchanged lines hidden (view full) --- 99 100static struct acpi_driver acpi_video_bus = { 101 .name = "video", 102 .class = ACPI_VIDEO_CLASS, 103 .ids = video_device_ids, 104 .ops = { 105 .add = acpi_video_bus_add, 106 .remove = acpi_video_bus_remove, | 81 82/* 83 * Indices in the _BCL method response: the first two items are special, 84 * the rest are all supported levels. 85 * 86 * See page 575 of the ACPI spec 3.0 87 */ 88enum acpi_video_level_idx { --- 10 unchanged lines hidden (view full) --- 99 100static struct acpi_driver acpi_video_bus = { 101 .name = "video", 102 .class = ACPI_VIDEO_CLASS, 103 .ids = video_device_ids, 104 .ops = { 105 .add = acpi_video_bus_add, 106 .remove = acpi_video_bus_remove, |
107 .notify = acpi_video_bus_notify, | |
108 }, 109}; 110 111struct acpi_video_bus_flags { 112 u8 multihead:1; /* can switch video heads */ 113 u8 rom:1; /* can retrieve a video rom */ 114 u8 post:1; /* can configure the head to */ 115 u8 reserved:5; --- 1406 unchanged lines hidden (view full) --- 1522} 1523 1524static int acpi_video_bus_stop_devices(struct acpi_video_bus *video) 1525{ 1526 return acpi_video_bus_DOS(video, 0, 1527 acpi_osi_is_win8() ? 0 : 1); 1528} 1529 | 107 }, 108}; 109 110struct acpi_video_bus_flags { 111 u8 multihead:1; /* can switch video heads */ 112 u8 rom:1; /* can retrieve a video rom */ 113 u8 post:1; /* can configure the head to */ 114 u8 reserved:5; --- 1406 unchanged lines hidden (view full) --- 1521} 1522 1523static int acpi_video_bus_stop_devices(struct acpi_video_bus *video) 1524{ 1525 return acpi_video_bus_DOS(video, 0, 1526 acpi_osi_is_win8() ? 0 : 1); 1527} 1528 |
1530static void acpi_video_bus_notify(struct acpi_device *device, u32 event) | 1529static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) |
1531{ | 1530{ |
1531 struct acpi_device *device = data; |
|
1532 struct acpi_video_bus *video = acpi_driver_data(device); 1533 struct input_dev *input; 1534 int keycode = 0; 1535 1536 if (!video || !video->input) 1537 return; 1538 1539 input = video->input; --- 508 unchanged lines hidden (view full) --- 2048 */ 2049 acpi_video_run_bcl_for_osi(video); 2050 if (__acpi_video_get_backlight_type(false, &auto_detect) == acpi_backlight_video && 2051 !auto_detect) 2052 acpi_video_bus_register_backlight(video); 2053 2054 acpi_video_bus_add_notify_handler(video); 2055 | 1532 struct acpi_video_bus *video = acpi_driver_data(device); 1533 struct input_dev *input; 1534 int keycode = 0; 1535 1536 if (!video || !video->input) 1537 return; 1538 1539 input = video->input; --- 508 unchanged lines hidden (view full) --- 2048 */ 2049 acpi_video_run_bcl_for_osi(video); 2050 if (__acpi_video_get_backlight_type(false, &auto_detect) == acpi_backlight_video && 2051 !auto_detect) 2052 acpi_video_bus_register_backlight(video); 2053 2054 acpi_video_bus_add_notify_handler(video); 2055 |
2056 error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY, 2057 acpi_video_bus_notify); 2058 if (error) 2059 goto err_remove; 2060 |
|
2056 return 0; 2057 | 2061 return 0; 2062 |
2063err_remove: 2064 mutex_lock(&video_list_lock); 2065 list_del(&video->entry); 2066 mutex_unlock(&video_list_lock); 2067 acpi_video_bus_remove_notify_handler(video); 2068 acpi_video_bus_unregister_backlight(video); |
|
2058err_put_video: 2059 acpi_video_bus_put_devices(video); 2060 kfree(video->attached_array); 2061err_free_video: 2062 kfree(video); 2063 device->driver_data = NULL; 2064 2065 return error; --- 4 unchanged lines hidden (view full) --- 2070 struct acpi_video_bus *video = NULL; 2071 2072 2073 if (!device || !acpi_driver_data(device)) 2074 return; 2075 2076 video = acpi_driver_data(device); 2077 | 2069err_put_video: 2070 acpi_video_bus_put_devices(video); 2071 kfree(video->attached_array); 2072err_free_video: 2073 kfree(video); 2074 device->driver_data = NULL; 2075 2076 return error; --- 4 unchanged lines hidden (view full) --- 2081 struct acpi_video_bus *video = NULL; 2082 2083 2084 if (!device || !acpi_driver_data(device)) 2085 return; 2086 2087 video = acpi_driver_data(device); 2088 |
2089 acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY, 2090 acpi_video_bus_notify); 2091 |
|
2078 mutex_lock(&video_list_lock); 2079 list_del(&video->entry); 2080 mutex_unlock(&video_list_lock); 2081 2082 acpi_video_bus_remove_notify_handler(video); 2083 acpi_video_bus_unregister_backlight(video); 2084 acpi_video_bus_put_devices(video); 2085 --- 183 unchanged lines hidden --- | 2092 mutex_lock(&video_list_lock); 2093 list_del(&video->entry); 2094 mutex_unlock(&video_list_lock); 2095 2096 acpi_video_bus_remove_notify_handler(video); 2097 acpi_video_bus_unregister_backlight(video); 2098 acpi_video_bus_put_devices(video); 2099 --- 183 unchanged lines hidden --- |