aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAaron Lu <aaron.lu@intel.com>2013-10-11 09:27:45 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-15 19:16:04 -0400
commitfbc9fe1b4f222a7c575e3bd8e9defe59c6190a04 (patch)
treec76ebdac257ec5c565bad1d7f9fc865114093aad /drivers
parent67b662e189f469c6d373f81d76b0ef0495940e99 (diff)
ACPI / video: Do not register backlight if win8 and native interface exists
According to Matthew Garrett, "Windows 8 leaves backlight control up to individual graphics drivers rather than making ACPI calls itself. There's plenty of evidence to suggest that the Intel driver for Windows [8] doesn't use the ACPI interface, including the fact that it's broken on a bunch of machines when the OS claims to support Windows 8. The simplest thing to do appears to be to disable the ACPI backlight interface on these systems". So for Win8 systems, if there is native backlight control interface registered by GPU driver, ACPI video does not need to register its own. Since there are systems that don't work well with this approach, a parameter for video module named use_native_backlight is introduced and has the value of false by default. For users who have a broken ACPI video backlight interface, video.use_native_backlight=1 is needed in kernel cmdline. Signed-off-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/internal.h4
-rw-r--r--drivers/acpi/video.c25
-rw-r--r--drivers/acpi/video_detect.c4
3 files changed, 23 insertions, 10 deletions
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 20f423337e1f..e9304dc7ebfa 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -169,9 +169,7 @@ int acpi_create_platform_device(struct acpi_device *adev,
169 Video 169 Video
170 -------------------------------------------------------------------------- */ 170 -------------------------------------------------------------------------- */
171#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) 171#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)
172bool acpi_video_backlight_quirks(void); 172bool acpi_osi_is_win8(void);
173#else
174static inline bool acpi_video_backlight_quirks(void) { return false; }
175#endif 173#endif
176 174
177#endif /* _ACPI_INTERNAL_H_ */ 175#endif /* _ACPI_INTERNAL_H_ */
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 3bd1eaa4ef90..d020df5a732a 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -88,6 +88,13 @@ module_param(allow_duplicates, bool, 0644);
88static bool use_bios_initial_backlight = 1; 88static bool use_bios_initial_backlight = 1;
89module_param(use_bios_initial_backlight, bool, 0644); 89module_param(use_bios_initial_backlight, bool, 0644);
90 90
91/*
92 * For Windows 8 systems: if set ture and the GPU driver has
93 * registered a backlight interface, skip registering ACPI video's.
94 */
95static bool use_native_backlight = false;
96module_param(use_native_backlight, bool, 0644);
97
91static int register_count; 98static int register_count;
92static struct mutex video_list_lock; 99static struct mutex video_list_lock;
93static struct list_head video_bus_head; 100static struct list_head video_bus_head;
@@ -232,6 +239,14 @@ static int acpi_video_get_next_level(struct acpi_video_device *device,
232static int acpi_video_switch_brightness(struct acpi_video_device *device, 239static int acpi_video_switch_brightness(struct acpi_video_device *device,
233 int event); 240 int event);
234 241
242static bool acpi_video_verify_backlight_support(void)
243{
244 if (acpi_osi_is_win8() && use_native_backlight &&
245 backlight_device_registered(BACKLIGHT_RAW))
246 return false;
247 return acpi_video_backlight_support();
248}
249
235/* backlight device sysfs support */ 250/* backlight device sysfs support */
236static int acpi_video_get_brightness(struct backlight_device *bd) 251static int acpi_video_get_brightness(struct backlight_device *bd)
237{ 252{
@@ -1256,8 +1271,8 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event)
1256 unsigned long long level_current, level_next; 1271 unsigned long long level_current, level_next;
1257 int result = -EINVAL; 1272 int result = -EINVAL;
1258 1273
1259 /* no warning message if acpi_backlight=vendor is used */ 1274 /* no warning message if acpi_backlight=vendor or a quirk is used */
1260 if (!acpi_video_backlight_support()) 1275 if (!acpi_video_verify_backlight_support())
1261 return 0; 1276 return 0;
1262 1277
1263 if (!device->brightness) 1278 if (!device->brightness)
@@ -1386,13 +1401,13 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
1386static int acpi_video_bus_start_devices(struct acpi_video_bus *video) 1401static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
1387{ 1402{
1388 return acpi_video_bus_DOS(video, 0, 1403 return acpi_video_bus_DOS(video, 0,
1389 acpi_video_backlight_quirks() ? 1 : 0); 1404 acpi_osi_is_win8() ? 1 : 0);
1390} 1405}
1391 1406
1392static int acpi_video_bus_stop_devices(struct acpi_video_bus *video) 1407static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
1393{ 1408{
1394 return acpi_video_bus_DOS(video, 0, 1409 return acpi_video_bus_DOS(video, 0,
1395 acpi_video_backlight_quirks() ? 0 : 1); 1410 acpi_osi_is_win8() ? 0 : 1);
1396} 1411}
1397 1412
1398static void acpi_video_bus_notify(struct acpi_device *device, u32 event) 1413static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
@@ -1558,7 +1573,7 @@ acpi_video_bus_match(acpi_handle handle, u32 level, void *context,
1558 1573
1559static void acpi_video_dev_register_backlight(struct acpi_video_device *device) 1574static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
1560{ 1575{
1561 if (acpi_video_backlight_support()) { 1576 if (acpi_video_verify_backlight_support()) {
1562 struct backlight_properties props; 1577 struct backlight_properties props;
1563 struct pci_dev *pdev; 1578 struct pci_dev *pdev;
1564 acpi_handle acpi_parent; 1579 acpi_handle acpi_parent;
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index 940edbf2fe8f..b6399343de51 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -233,11 +233,11 @@ static void acpi_video_caps_check(void)
233 acpi_video_get_capabilities(NULL); 233 acpi_video_get_capabilities(NULL);
234} 234}
235 235
236bool acpi_video_backlight_quirks(void) 236bool acpi_osi_is_win8(void)
237{ 237{
238 return acpi_gbl_osi_data >= ACPI_OSI_WIN_8; 238 return acpi_gbl_osi_data >= ACPI_OSI_WIN_8;
239} 239}
240EXPORT_SYMBOL(acpi_video_backlight_quirks); 240EXPORT_SYMBOL(acpi_osi_is_win8);
241 241
242/* Promote the vendor interface instead of the generic video module. 242/* Promote the vendor interface instead of the generic video module.
243 * This function allow DMI blacklists to be implemented by externals 243 * This function allow DMI blacklists to be implemented by externals