aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/samsung-laptop.c
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2012-03-22 09:08:19 -0400
committerMatthew Garrett <mjg@redhat.com>2012-03-26 15:45:25 -0400
commita979e2e2af7d5b4bb3b20f6a716c627bb23a6753 (patch)
tree02e944b7a63f86947205a9a389a9737cdb2b3099 /drivers/platform/x86/samsung-laptop.c
parent5719b81988f3c24ff694dc3a37e35b35630a3966 (diff)
samsung-laptop: unregister ACPI video module for some well known laptops
On these laptops, the ACPI video is not functional, and very unlikely to be fixed by the vendor. Note that intel_backlight works for some of these laptops, and the backlight from samsung-laptop always work. The good news is that newer laptops have functional ACPI video device and won't end up growing this list. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform/x86/samsung-laptop.c')
-rw-r--r--drivers/platform/x86/samsung-laptop.c80
1 files changed, 76 insertions, 4 deletions
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index 4787afdf11d..e2a34b42ddc 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -26,6 +26,9 @@
26#include <linux/seq_file.h> 26#include <linux/seq_file.h>
27#include <linux/debugfs.h> 27#include <linux/debugfs.h>
28#include <linux/ctype.h> 28#include <linux/ctype.h>
29#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
30#include <acpi/video.h>
31#endif
29 32
30/* 33/*
31 * This driver is needed because a number of Samsung laptops do not hook 34 * This driver is needed because a number of Samsung laptops do not hook
@@ -336,6 +339,7 @@ struct samsung_laptop {
336 struct work_struct kbd_led_work; 339 struct work_struct kbd_led_work;
337 340
338 struct samsung_laptop_debug debug; 341 struct samsung_laptop_debug debug;
342 struct samsung_quirks *quirks;
339 343
340 bool handle_backlight; 344 bool handle_backlight;
341 bool has_stepping_quirk; 345 bool has_stepping_quirk;
@@ -343,7 +347,15 @@ struct samsung_laptop {
343 char sdiag[64]; 347 char sdiag[64];
344}; 348};
345 349
350struct samsung_quirks {
351 bool broken_acpi_video;
352};
353
354static struct samsung_quirks samsung_unknown = {};
346 355
356static struct samsung_quirks samsung_broken_acpi_video = {
357 .broken_acpi_video = true,
358};
347 359
348static bool force; 360static bool force;
349module_param(force, bool, 0); 361module_param(force, bool, 0);
@@ -1416,6 +1428,14 @@ static int __init samsung_platform_init(struct samsung_laptop *samsung)
1416 return 0; 1428 return 0;
1417} 1429}
1418 1430
1431static struct samsung_quirks *quirks;
1432
1433static int __init samsung_dmi_matched(const struct dmi_system_id *d)
1434{
1435 quirks = d->driver_data;
1436 return 0;
1437}
1438
1419static struct dmi_system_id __initdata samsung_dmi_table[] = { 1439static struct dmi_system_id __initdata samsung_dmi_table[] = {
1420 { 1440 {
1421 .matches = { 1441 .matches = {
@@ -1445,6 +1465,47 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
1445 DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */ 1465 DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
1446 }, 1466 },
1447 }, 1467 },
1468 /* Specific DMI ids for laptop with quirks */
1469 {
1470 .callback = samsung_dmi_matched,
1471 .ident = "N150P",
1472 .matches = {
1473 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1474 DMI_MATCH(DMI_PRODUCT_NAME, "N150P"),
1475 DMI_MATCH(DMI_BOARD_NAME, "N150P"),
1476 },
1477 .driver_data = &samsung_broken_acpi_video,
1478 },
1479 {
1480 .callback = samsung_dmi_matched,
1481 .ident = "N145P/N250P/N260P",
1482 .matches = {
1483 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1484 DMI_MATCH(DMI_PRODUCT_NAME, "N145P/N250P/N260P"),
1485 DMI_MATCH(DMI_BOARD_NAME, "N145P/N250P/N260P"),
1486 },
1487 .driver_data = &samsung_broken_acpi_video,
1488 },
1489 {
1490 .callback = samsung_dmi_matched,
1491 .ident = "N150/N210/N220",
1492 .matches = {
1493 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1494 DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220"),
1495 DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220"),
1496 },
1497 .driver_data = &samsung_broken_acpi_video,
1498 },
1499 {
1500 .callback = samsung_dmi_matched,
1501 .ident = "NF110/NF210/NF310",
1502 .matches = {
1503 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1504 DMI_MATCH(DMI_PRODUCT_NAME, "NF110/NF210/NF310"),
1505 DMI_MATCH(DMI_BOARD_NAME, "NF110/NF210/NF310"),
1506 },
1507 .driver_data = &samsung_broken_acpi_video,
1508 },
1448 { }, 1509 { },
1449}; 1510};
1450MODULE_DEVICE_TABLE(dmi, samsung_dmi_table); 1511MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);
@@ -1456,6 +1517,7 @@ static int __init samsung_init(void)
1456 struct samsung_laptop *samsung; 1517 struct samsung_laptop *samsung;
1457 int ret; 1518 int ret;
1458 1519
1520 quirks = &samsung_unknown;
1459 if (!force && !dmi_check_system(samsung_dmi_table)) 1521 if (!force && !dmi_check_system(samsung_dmi_table))
1460 return -ENODEV; 1522 return -ENODEV;
1461 1523
@@ -1465,12 +1527,21 @@ static int __init samsung_init(void)
1465 1527
1466 mutex_init(&samsung->sabi_mutex); 1528 mutex_init(&samsung->sabi_mutex);
1467 samsung->handle_backlight = true; 1529 samsung->handle_backlight = true;
1530 samsung->quirks = quirks;
1468 1531
1469#ifdef CONFIG_ACPI 1532
1533#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
1470 /* Don't handle backlight here if the acpi video already handle it */ 1534 /* Don't handle backlight here if the acpi video already handle it */
1471 if (acpi_video_backlight_support()) 1535 if (acpi_video_backlight_support()) {
1472 samsung->handle_backlight = false; 1536 if (samsung->quirks->broken_acpi_video) {
1537 pr_info("Disabling ACPI video driver\n");
1538 acpi_video_unregister();
1539 } else {
1540 samsung->handle_backlight = false;
1541 }
1542 }
1473#endif 1543#endif
1544
1474 ret = samsung_platform_init(samsung); 1545 ret = samsung_platform_init(samsung);
1475 if (ret) 1546 if (ret)
1476 goto error_platform; 1547 goto error_platform;
@@ -1481,7 +1552,8 @@ static int __init samsung_init(void)
1481 1552
1482#ifdef CONFIG_ACPI 1553#ifdef CONFIG_ACPI
1483 /* Only log that if we are really on a sabi platform */ 1554 /* Only log that if we are really on a sabi platform */
1484 if (acpi_video_backlight_support()) 1555 if (acpi_video_backlight_support() &&
1556 !samsung->quirks->broken_acpi_video)
1485 pr_info("Backlight controlled by ACPI video driver\n"); 1557 pr_info("Backlight controlled by ACPI video driver\n");
1486#endif 1558#endif
1487 1559