aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r--drivers/acpi/video.c147
1 files changed, 141 insertions, 6 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index b727d105046d..b6ba88ed31ae 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -81,11 +81,12 @@ static bool allow_duplicates;
81module_param(allow_duplicates, bool, 0644); 81module_param(allow_duplicates, bool, 0644);
82 82
83/* 83/*
84 * For Windows 8 systems: if set ture and the GPU driver has 84 * For Windows 8 systems: used to decide if video module
85 * registered a backlight interface, skip registering ACPI video's. 85 * should skip registering backlight interface of its own.
86 */ 86 */
87static bool use_native_backlight = false; 87static int use_native_backlight_param = -1;
88module_param(use_native_backlight, bool, 0644); 88module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
89static bool use_native_backlight_dmi = false;
89 90
90static int register_count; 91static int register_count;
91static struct mutex video_list_lock; 92static struct mutex video_list_lock;
@@ -231,9 +232,17 @@ static int acpi_video_get_next_level(struct acpi_video_device *device,
231static int acpi_video_switch_brightness(struct acpi_video_device *device, 232static int acpi_video_switch_brightness(struct acpi_video_device *device,
232 int event); 233 int event);
233 234
235static bool acpi_video_use_native_backlight(void)
236{
237 if (use_native_backlight_param != -1)
238 return use_native_backlight_param;
239 else
240 return use_native_backlight_dmi;
241}
242
234static bool acpi_video_verify_backlight_support(void) 243static bool acpi_video_verify_backlight_support(void)
235{ 244{
236 if (acpi_osi_is_win8() && use_native_backlight && 245 if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
237 backlight_device_registered(BACKLIGHT_RAW)) 246 backlight_device_registered(BACKLIGHT_RAW))
238 return false; 247 return false;
239 return acpi_video_backlight_support(); 248 return acpi_video_backlight_support();
@@ -398,6 +407,12 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
398 return 0; 407 return 0;
399} 408}
400 409
410static int __init video_set_use_native_backlight(const struct dmi_system_id *d)
411{
412 use_native_backlight_dmi = true;
413 return 0;
414}
415
401static struct dmi_system_id video_dmi_table[] __initdata = { 416static struct dmi_system_id video_dmi_table[] __initdata = {
402 /* 417 /*
403 * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 418 * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
@@ -442,6 +457,120 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
442 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"), 457 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"),
443 }, 458 },
444 }, 459 },
460 {
461 .callback = video_set_use_native_backlight,
462 .ident = "ThinkPad T430s",
463 .matches = {
464 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
465 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430s"),
466 },
467 },
468 {
469 .callback = video_set_use_native_backlight,
470 .ident = "ThinkPad X230",
471 .matches = {
472 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
473 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X230"),
474 },
475 },
476 {
477 .callback = video_set_use_native_backlight,
478 .ident = "ThinkPad X1 Carbon",
479 .matches = {
480 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
481 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X1 Carbon"),
482 },
483 },
484 {
485 .callback = video_set_use_native_backlight,
486 .ident = "Lenovo Yoga 13",
487 .matches = {
488 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
489 DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Yoga 13"),
490 },
491 },
492 {
493 .callback = video_set_use_native_backlight,
494 .ident = "Dell Inspiron 7520",
495 .matches = {
496 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
497 DMI_MATCH(DMI_PRODUCT_VERSION, "Inspiron 7520"),
498 },
499 },
500 {
501 .callback = video_set_use_native_backlight,
502 .ident = "Acer Aspire 5733Z",
503 .matches = {
504 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
505 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5733Z"),
506 },
507 },
508 {
509 .callback = video_set_use_native_backlight,
510 .ident = "Acer Aspire V5-431",
511 .matches = {
512 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
513 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-431"),
514 },
515 },
516 {
517 .callback = video_set_use_native_backlight,
518 .ident = "HP ProBook 4340s",
519 .matches = {
520 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
521 DMI_MATCH(DMI_PRODUCT_VERSION, "HP ProBook 4340s"),
522 },
523 },
524 {
525 .callback = video_set_use_native_backlight,
526 .ident = "HP ProBook 2013 models",
527 .matches = {
528 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
529 DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook "),
530 DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
531 },
532 },
533 {
534 .callback = video_set_use_native_backlight,
535 .ident = "HP EliteBook 2013 models",
536 .matches = {
537 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
538 DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "),
539 DMI_MATCH(DMI_PRODUCT_NAME, " G1"),
540 },
541 },
542 {
543 .callback = video_set_use_native_backlight,
544 .ident = "HP ZBook 14",
545 .matches = {
546 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
547 DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 14"),
548 },
549 },
550 {
551 .callback = video_set_use_native_backlight,
552 .ident = "HP ZBook 15",
553 .matches = {
554 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
555 DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 15"),
556 },
557 },
558 {
559 .callback = video_set_use_native_backlight,
560 .ident = "HP ZBook 17",
561 .matches = {
562 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
563 DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 17"),
564 },
565 },
566 {
567 .callback = video_set_use_native_backlight,
568 .ident = "HP EliteBook 8780w",
569 .matches = {
570 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
571 DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"),
572 },
573 },
445 {} 574 {}
446}; 575};
447 576
@@ -685,6 +814,7 @@ acpi_video_init_brightness(struct acpi_video_device *device)
685 union acpi_object *o; 814 union acpi_object *o;
686 struct acpi_video_device_brightness *br = NULL; 815 struct acpi_video_device_brightness *br = NULL;
687 int result = -EINVAL; 816 int result = -EINVAL;
817 u32 value;
688 818
689 if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) { 819 if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) {
690 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available " 820 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available "
@@ -715,7 +845,12 @@ acpi_video_init_brightness(struct acpi_video_device *device)
715 printk(KERN_ERR PREFIX "Invalid data\n"); 845 printk(KERN_ERR PREFIX "Invalid data\n");
716 continue; 846 continue;
717 } 847 }
718 br->levels[count] = (u32) o->integer.value; 848 value = (u32) o->integer.value;
849 /* Skip duplicate entries */
850 if (count > 2 && br->levels[count - 1] == value)
851 continue;
852
853 br->levels[count] = value;
719 854
720 if (br->levels[count] > max_level) 855 if (br->levels[count] > max_level)
721 max_level = br->levels[count]; 856 max_level = br->levels[count];