Skip to content

Commit fbc9fe1

Browse files
Aaron Lurafaeljw
authored andcommitted
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>
1 parent 67b662e commit fbc9fe1

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

drivers/acpi/internal.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@ int acpi_create_platform_device(struct acpi_device *adev,
169169
Video
170170
-------------------------------------------------------------------------- */
171171
#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)
172-
bool acpi_video_backlight_quirks(void);
173-
#else
174-
static inline bool acpi_video_backlight_quirks(void) { return false; }
172+
bool acpi_osi_is_win8(void);
175173
#endif
176174

177175
#endif /* _ACPI_INTERNAL_H_ */

drivers/acpi/video.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ module_param(allow_duplicates, bool, 0644);
8888
static bool use_bios_initial_backlight = 1;
8989
module_param(use_bios_initial_backlight, bool, 0644);
9090

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+
*/
95+
static bool use_native_backlight = false;
96+
module_param(use_native_backlight, bool, 0644);
97+
9198
static int register_count;
9299
static struct mutex video_list_lock;
93100
static struct list_head video_bus_head;
@@ -232,6 +239,14 @@ static int acpi_video_get_next_level(struct acpi_video_device *device,
232239
static int acpi_video_switch_brightness(struct acpi_video_device *device,
233240
int event);
234241

242+
static 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+
235250
/* backlight device sysfs support */
236251
static int acpi_video_get_brightness(struct backlight_device *bd)
237252
{
@@ -1256,8 +1271,8 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event)
12561271
unsigned long long level_current, level_next;
12571272
int result = -EINVAL;
12581273

1259-
/* no warning message if acpi_backlight=vendor is used */
1260-
if (!acpi_video_backlight_support())
1274+
/* no warning message if acpi_backlight=vendor or a quirk is used */
1275+
if (!acpi_video_verify_backlight_support())
12611276
return 0;
12621277

12631278
if (!device->brightness)
@@ -1386,13 +1401,13 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
13861401
static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
13871402
{
13881403
return acpi_video_bus_DOS(video, 0,
1389-
acpi_video_backlight_quirks() ? 1 : 0);
1404+
acpi_osi_is_win8() ? 1 : 0);
13901405
}
13911406

13921407
static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
13931408
{
13941409
return acpi_video_bus_DOS(video, 0,
1395-
acpi_video_backlight_quirks() ? 0 : 1);
1410+
acpi_osi_is_win8() ? 0 : 1);
13961411
}
13971412

13981413
static 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,
15581573

15591574
static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
15601575
{
1561-
if (acpi_video_backlight_support()) {
1576+
if (acpi_video_verify_backlight_support()) {
15621577
struct backlight_properties props;
15631578
struct pci_dev *pdev;
15641579
acpi_handle acpi_parent;

drivers/acpi/video_detect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ static void acpi_video_caps_check(void)
233233
acpi_video_get_capabilities(NULL);
234234
}
235235

236-
bool acpi_video_backlight_quirks(void)
236+
bool acpi_osi_is_win8(void)
237237
{
238238
return acpi_gbl_osi_data >= ACPI_OSI_WIN_8;
239239
}
240-
EXPORT_SYMBOL(acpi_video_backlight_quirks);
240+
EXPORT_SYMBOL(acpi_osi_is_win8);
241241

242242
/* Promote the vendor interface instead of the generic video module.
243243
* This function allow DMI blacklists to be implemented by externals

0 commit comments

Comments
 (0)