diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 57 |
1 files changed, 39 insertions, 18 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 63290b33c879..21759dacff6c 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -480,6 +480,15 @@ static unsigned long __init tpacpi_check_quirks( | |||
480 | return 0; | 480 | return 0; |
481 | } | 481 | } |
482 | 482 | ||
483 | static inline bool __pure __init tpacpi_is_lenovo(void) | ||
484 | { | ||
485 | return thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO; | ||
486 | } | ||
487 | |||
488 | static inline bool __pure __init tpacpi_is_ibm(void) | ||
489 | { | ||
490 | return thinkpad_id.vendor == PCI_VENDOR_ID_IBM; | ||
491 | } | ||
483 | 492 | ||
484 | /**************************************************************************** | 493 | /**************************************************************************** |
485 | **************************************************************************** | 494 | **************************************************************************** |
@@ -1886,7 +1895,9 @@ static int __init thinkpad_acpi_driver_init(struct ibm_init_struct *iibm) | |||
1886 | (thinkpad_id.ec_version_str) ? | 1895 | (thinkpad_id.ec_version_str) ? |
1887 | thinkpad_id.ec_version_str : "unknown"); | 1896 | thinkpad_id.ec_version_str : "unknown"); |
1888 | 1897 | ||
1889 | if (thinkpad_id.vendor && thinkpad_id.model_str) | 1898 | BUG_ON(!thinkpad_id.vendor); |
1899 | |||
1900 | if (thinkpad_id.model_str) | ||
1890 | printk(TPACPI_INFO "%s %s, model %s\n", | 1901 | printk(TPACPI_INFO "%s %s, model %s\n", |
1891 | (thinkpad_id.vendor == PCI_VENDOR_ID_IBM) ? | 1902 | (thinkpad_id.vendor == PCI_VENDOR_ID_IBM) ? |
1892 | "IBM" : ((thinkpad_id.vendor == | 1903 | "IBM" : ((thinkpad_id.vendor == |
@@ -3353,7 +3364,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3353 | goto err_exit; | 3364 | goto err_exit; |
3354 | } | 3365 | } |
3355 | 3366 | ||
3356 | if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) { | 3367 | if (tpacpi_is_lenovo()) { |
3357 | dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, | 3368 | dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, |
3358 | "using Lenovo default hot key map\n"); | 3369 | "using Lenovo default hot key map\n"); |
3359 | memcpy(hotkey_keycode_map, &lenovo_keycode_map, | 3370 | memcpy(hotkey_keycode_map, &lenovo_keycode_map, |
@@ -4422,7 +4433,8 @@ static int __init video_init(struct ibm_init_struct *iibm) | |||
4422 | vdbg_printk(TPACPI_DBG_INIT, "initializing video subdriver\n"); | 4433 | vdbg_printk(TPACPI_DBG_INIT, "initializing video subdriver\n"); |
4423 | 4434 | ||
4424 | TPACPI_ACPIHANDLE_INIT(vid); | 4435 | TPACPI_ACPIHANDLE_INIT(vid); |
4425 | TPACPI_ACPIHANDLE_INIT(vid2); | 4436 | if (tpacpi_is_ibm()) |
4437 | TPACPI_ACPIHANDLE_INIT(vid2); | ||
4426 | 4438 | ||
4427 | if (vid2_handle && acpi_evalf(NULL, &ivga, "\\IVGA", "d") && ivga) | 4439 | if (vid2_handle && acpi_evalf(NULL, &ivga, "\\IVGA", "d") && ivga) |
4428 | /* G41, assume IVGA doesn't change */ | 4440 | /* G41, assume IVGA doesn't change */ |
@@ -4431,10 +4443,12 @@ static int __init video_init(struct ibm_init_struct *iibm) | |||
4431 | if (!vid_handle) | 4443 | if (!vid_handle) |
4432 | /* video switching not supported on R30, R31 */ | 4444 | /* video switching not supported on R30, R31 */ |
4433 | video_supported = TPACPI_VIDEO_NONE; | 4445 | video_supported = TPACPI_VIDEO_NONE; |
4434 | else if (acpi_evalf(vid_handle, &video_orig_autosw, "SWIT", "qd")) | 4446 | else if (tpacpi_is_ibm() && |
4447 | acpi_evalf(vid_handle, &video_orig_autosw, "SWIT", "qd")) | ||
4435 | /* 570 */ | 4448 | /* 570 */ |
4436 | video_supported = TPACPI_VIDEO_570; | 4449 | video_supported = TPACPI_VIDEO_570; |
4437 | else if (acpi_evalf(vid_handle, &video_orig_autosw, "^VADL", "qd")) | 4450 | else if (tpacpi_is_ibm() && |
4451 | acpi_evalf(vid_handle, &video_orig_autosw, "^VADL", "qd")) | ||
4438 | /* 600e/x, 770e, 770x */ | 4452 | /* 600e/x, 770e, 770x */ |
4439 | video_supported = TPACPI_VIDEO_770; | 4453 | video_supported = TPACPI_VIDEO_770; |
4440 | else | 4454 | else |
@@ -4811,8 +4825,10 @@ static int __init light_init(struct ibm_init_struct *iibm) | |||
4811 | 4825 | ||
4812 | vdbg_printk(TPACPI_DBG_INIT, "initializing light subdriver\n"); | 4826 | vdbg_printk(TPACPI_DBG_INIT, "initializing light subdriver\n"); |
4813 | 4827 | ||
4814 | TPACPI_ACPIHANDLE_INIT(ledb); | 4828 | if (tpacpi_is_ibm()) { |
4815 | TPACPI_ACPIHANDLE_INIT(lght); | 4829 | TPACPI_ACPIHANDLE_INIT(ledb); |
4830 | TPACPI_ACPIHANDLE_INIT(lght); | ||
4831 | } | ||
4816 | TPACPI_ACPIHANDLE_INIT(cmos); | 4832 | TPACPI_ACPIHANDLE_INIT(cmos); |
4817 | INIT_WORK(&tpacpi_led_thinklight.work, light_set_status_worker); | 4833 | INIT_WORK(&tpacpi_led_thinklight.work, light_set_status_worker); |
4818 | 4834 | ||
@@ -5284,10 +5300,10 @@ static int __init led_init(struct ibm_init_struct *iibm) | |||
5284 | if (!led_handle) | 5300 | if (!led_handle) |
5285 | /* led not supported on R30, R31 */ | 5301 | /* led not supported on R30, R31 */ |
5286 | led_supported = TPACPI_LED_NONE; | 5302 | led_supported = TPACPI_LED_NONE; |
5287 | else if (strlencmp(led_path, "SLED") == 0) | 5303 | else if (tpacpi_is_ibm() && strlencmp(led_path, "SLED") == 0) |
5288 | /* 570 */ | 5304 | /* 570 */ |
5289 | led_supported = TPACPI_LED_570; | 5305 | led_supported = TPACPI_LED_570; |
5290 | else if (strlencmp(led_path, "SYSL") == 0) | 5306 | else if (tpacpi_is_ibm() && strlencmp(led_path, "SYSL") == 0) |
5291 | /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */ | 5307 | /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */ |
5292 | led_supported = TPACPI_LED_OLD; | 5308 | led_supported = TPACPI_LED_OLD; |
5293 | else | 5309 | else |
@@ -5741,11 +5757,12 @@ static int __init thermal_init(struct ibm_init_struct *iibm) | |||
5741 | TPACPI_THERMAL_TPEC_16 : TPACPI_THERMAL_TPEC_8; | 5757 | TPACPI_THERMAL_TPEC_16 : TPACPI_THERMAL_TPEC_8; |
5742 | } | 5758 | } |
5743 | } else if (acpi_tmp7) { | 5759 | } else if (acpi_tmp7) { |
5744 | if (acpi_evalf(ec_handle, NULL, "UPDT", "qv")) { | 5760 | if (tpacpi_is_ibm() && |
5761 | acpi_evalf(ec_handle, NULL, "UPDT", "qv")) { | ||
5745 | /* 600e/x, 770e, 770x */ | 5762 | /* 600e/x, 770e, 770x */ |
5746 | thermal_read_mode = TPACPI_THERMAL_ACPI_UPDT; | 5763 | thermal_read_mode = TPACPI_THERMAL_ACPI_UPDT; |
5747 | } else { | 5764 | } else { |
5748 | /* Standard ACPI TMPx access, max 8 sensors */ | 5765 | /* IBM/LENOVO DSDT EC.TMPx access, max 8 sensors */ |
5749 | thermal_read_mode = TPACPI_THERMAL_ACPI_TMP07; | 5766 | thermal_read_mode = TPACPI_THERMAL_ACPI_TMP07; |
5750 | } | 5767 | } |
5751 | } else { | 5768 | } else { |
@@ -6249,7 +6266,7 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
6249 | } | 6266 | } |
6250 | 6267 | ||
6251 | /* Safety */ | 6268 | /* Safety */ |
6252 | if (thinkpad_id.vendor != PCI_VENDOR_ID_IBM && | 6269 | if (!tpacpi_is_ibm() && |
6253 | (brightness_mode == TPACPI_BRGHT_MODE_ECNVRAM || | 6270 | (brightness_mode == TPACPI_BRGHT_MODE_ECNVRAM || |
6254 | brightness_mode == TPACPI_BRGHT_MODE_EC)) | 6271 | brightness_mode == TPACPI_BRGHT_MODE_EC)) |
6255 | return -EINVAL; | 6272 | return -EINVAL; |
@@ -7968,9 +7985,11 @@ static int __init fan_init(struct ibm_init_struct *iibm) | |||
7968 | tp_features.second_fan = 0; | 7985 | tp_features.second_fan = 0; |
7969 | fan_control_desired_level = 7; | 7986 | fan_control_desired_level = 7; |
7970 | 7987 | ||
7971 | TPACPI_ACPIHANDLE_INIT(fans); | 7988 | if (tpacpi_is_ibm()) { |
7972 | TPACPI_ACPIHANDLE_INIT(gfan); | 7989 | TPACPI_ACPIHANDLE_INIT(fans); |
7973 | TPACPI_ACPIHANDLE_INIT(sfan); | 7990 | TPACPI_ACPIHANDLE_INIT(gfan); |
7991 | TPACPI_ACPIHANDLE_INIT(sfan); | ||
7992 | } | ||
7974 | 7993 | ||
7975 | quirks = tpacpi_check_quirks(fan_quirk_table, | 7994 | quirks = tpacpi_check_quirks(fan_quirk_table, |
7976 | ARRAY_SIZE(fan_quirk_table)); | 7995 | ARRAY_SIZE(fan_quirk_table)); |
@@ -8662,6 +8681,10 @@ static int __init probe_for_thinkpad(void) | |||
8662 | if (acpi_disabled) | 8681 | if (acpi_disabled) |
8663 | return -ENODEV; | 8682 | return -ENODEV; |
8664 | 8683 | ||
8684 | /* It would be dangerous to run the driver in this case */ | ||
8685 | if (!tpacpi_is_ibm() && !tpacpi_is_lenovo()) | ||
8686 | return -ENODEV; | ||
8687 | |||
8665 | /* | 8688 | /* |
8666 | * Non-ancient models have better DMI tagging, but very old models | 8689 | * Non-ancient models have better DMI tagging, but very old models |
8667 | * don't. tpacpi_is_fw_known() is a cheat to help in that case. | 8690 | * don't. tpacpi_is_fw_known() is a cheat to help in that case. |
@@ -9059,9 +9082,7 @@ static int __init thinkpad_acpi_module_init(void) | |||
9059 | tpacpi_inputdev->name = "ThinkPad Extra Buttons"; | 9082 | tpacpi_inputdev->name = "ThinkPad Extra Buttons"; |
9060 | tpacpi_inputdev->phys = TPACPI_DRVR_NAME "/input0"; | 9083 | tpacpi_inputdev->phys = TPACPI_DRVR_NAME "/input0"; |
9061 | tpacpi_inputdev->id.bustype = BUS_HOST; | 9084 | tpacpi_inputdev->id.bustype = BUS_HOST; |
9062 | tpacpi_inputdev->id.vendor = (thinkpad_id.vendor) ? | 9085 | tpacpi_inputdev->id.vendor = thinkpad_id.vendor; |
9063 | thinkpad_id.vendor : | ||
9064 | PCI_VENDOR_ID_IBM; | ||
9065 | tpacpi_inputdev->id.product = TPACPI_HKEY_INPUT_PRODUCT; | 9086 | tpacpi_inputdev->id.product = TPACPI_HKEY_INPUT_PRODUCT; |
9066 | tpacpi_inputdev->id.version = TPACPI_HKEY_INPUT_VERSION; | 9087 | tpacpi_inputdev->id.version = TPACPI_HKEY_INPUT_VERSION; |
9067 | tpacpi_inputdev->dev.parent = &tpacpi_pdev->dev; | 9088 | tpacpi_inputdev->dev.parent = &tpacpi_pdev->dev; |