diff options
Diffstat (limited to 'drivers/platform/x86/thinkpad_acpi.c')
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 588 |
1 files changed, 267 insertions, 321 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 2d61186ad5a2..26c5b117df22 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -21,6 +21,8 @@ | |||
21 | * 02110-1301, USA. | 21 | * 02110-1301, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
25 | |||
24 | #define TPACPI_VERSION "0.24" | 26 | #define TPACPI_VERSION "0.24" |
25 | #define TPACPI_SYSFS_VERSION 0x020700 | 27 | #define TPACPI_SYSFS_VERSION 0x020700 |
26 | 28 | ||
@@ -128,7 +130,8 @@ enum { | |||
128 | }; | 130 | }; |
129 | 131 | ||
130 | /* ACPI HIDs */ | 132 | /* ACPI HIDs */ |
131 | #define TPACPI_ACPI_HKEY_HID "IBM0068" | 133 | #define TPACPI_ACPI_IBM_HKEY_HID "IBM0068" |
134 | #define TPACPI_ACPI_LENOVO_HKEY_HID "LEN0068" | ||
132 | #define TPACPI_ACPI_EC_HID "PNP0C09" | 135 | #define TPACPI_ACPI_EC_HID "PNP0C09" |
133 | 136 | ||
134 | /* Input IDs */ | 137 | /* Input IDs */ |
@@ -181,6 +184,10 @@ enum tpacpi_hkey_event_t { | |||
181 | 184 | ||
182 | /* Misc bay events */ | 185 | /* Misc bay events */ |
183 | TP_HKEY_EV_OPTDRV_EJ = 0x3006, /* opt. drive tray ejected */ | 186 | TP_HKEY_EV_OPTDRV_EJ = 0x3006, /* opt. drive tray ejected */ |
187 | TP_HKEY_EV_HOTPLUG_DOCK = 0x4010, /* docked into hotplug dock | ||
188 | or port replicator */ | ||
189 | TP_HKEY_EV_HOTPLUG_UNDOCK = 0x4011, /* undocked from hotplug | ||
190 | dock or port replicator */ | ||
184 | 191 | ||
185 | /* User-interface events */ | 192 | /* User-interface events */ |
186 | TP_HKEY_EV_LID_CLOSE = 0x5001, /* laptop lid closed */ | 193 | TP_HKEY_EV_LID_CLOSE = 0x5001, /* laptop lid closed */ |
@@ -191,6 +198,10 @@ enum tpacpi_hkey_event_t { | |||
191 | TP_HKEY_EV_PEN_REMOVED = 0x500c, /* tablet pen removed */ | 198 | TP_HKEY_EV_PEN_REMOVED = 0x500c, /* tablet pen removed */ |
192 | TP_HKEY_EV_BRGHT_CHANGED = 0x5010, /* backlight control event */ | 199 | TP_HKEY_EV_BRGHT_CHANGED = 0x5010, /* backlight control event */ |
193 | 200 | ||
201 | /* Key-related user-interface events */ | ||
202 | TP_HKEY_EV_KEY_NUMLOCK = 0x6000, /* NumLock key pressed */ | ||
203 | TP_HKEY_EV_KEY_FN = 0x6005, /* Fn key pressed? E420 */ | ||
204 | |||
194 | /* Thermal events */ | 205 | /* Thermal events */ |
195 | TP_HKEY_EV_ALARM_BAT_HOT = 0x6011, /* battery too hot */ | 206 | TP_HKEY_EV_ALARM_BAT_HOT = 0x6011, /* battery too hot */ |
196 | TP_HKEY_EV_ALARM_BAT_XHOT = 0x6012, /* battery critically hot */ | 207 | TP_HKEY_EV_ALARM_BAT_XHOT = 0x6012, /* battery critically hot */ |
@@ -198,6 +209,10 @@ enum tpacpi_hkey_event_t { | |||
198 | TP_HKEY_EV_ALARM_SENSOR_XHOT = 0x6022, /* sensor critically hot */ | 209 | TP_HKEY_EV_ALARM_SENSOR_XHOT = 0x6022, /* sensor critically hot */ |
199 | TP_HKEY_EV_THM_TABLE_CHANGED = 0x6030, /* thermal table changed */ | 210 | TP_HKEY_EV_THM_TABLE_CHANGED = 0x6030, /* thermal table changed */ |
200 | 211 | ||
212 | TP_HKEY_EV_UNK_6040 = 0x6040, /* Related to AC change? | ||
213 | some sort of APM hint, | ||
214 | W520 */ | ||
215 | |||
201 | /* Misc */ | 216 | /* Misc */ |
202 | TP_HKEY_EV_RFKILL_CHANGED = 0x7000, /* rfkill switch changed */ | 217 | TP_HKEY_EV_RFKILL_CHANGED = 0x7000, /* rfkill switch changed */ |
203 | }; | 218 | }; |
@@ -223,17 +238,6 @@ enum tpacpi_hkey_event_t { | |||
223 | 238 | ||
224 | #define TPACPI_MAX_ACPI_ARGS 3 | 239 | #define TPACPI_MAX_ACPI_ARGS 3 |
225 | 240 | ||
226 | /* printk headers */ | ||
227 | #define TPACPI_LOG TPACPI_FILE ": " | ||
228 | #define TPACPI_EMERG KERN_EMERG TPACPI_LOG | ||
229 | #define TPACPI_ALERT KERN_ALERT TPACPI_LOG | ||
230 | #define TPACPI_CRIT KERN_CRIT TPACPI_LOG | ||
231 | #define TPACPI_ERR KERN_ERR TPACPI_LOG | ||
232 | #define TPACPI_WARN KERN_WARNING TPACPI_LOG | ||
233 | #define TPACPI_NOTICE KERN_NOTICE TPACPI_LOG | ||
234 | #define TPACPI_INFO KERN_INFO TPACPI_LOG | ||
235 | #define TPACPI_DEBUG KERN_DEBUG TPACPI_LOG | ||
236 | |||
237 | /* Debugging printk groups */ | 241 | /* Debugging printk groups */ |
238 | #define TPACPI_DBG_ALL 0xffff | 242 | #define TPACPI_DBG_ALL 0xffff |
239 | #define TPACPI_DBG_DISCLOSETASK 0x8000 | 243 | #define TPACPI_DBG_DISCLOSETASK 0x8000 |
@@ -388,34 +392,36 @@ static int tpacpi_uwb_emulstate; | |||
388 | * Debugging helpers | 392 | * Debugging helpers |
389 | */ | 393 | */ |
390 | 394 | ||
391 | #define dbg_printk(a_dbg_level, format, arg...) \ | 395 | #define dbg_printk(a_dbg_level, format, arg...) \ |
392 | do { if (dbg_level & (a_dbg_level)) \ | 396 | do { \ |
393 | printk(TPACPI_DEBUG "%s: " format, __func__ , ## arg); \ | 397 | if (dbg_level & (a_dbg_level)) \ |
394 | } while (0) | 398 | printk(KERN_DEBUG pr_fmt("%s: " format), \ |
399 | __func__, ##arg); \ | ||
400 | } while (0) | ||
395 | 401 | ||
396 | #ifdef CONFIG_THINKPAD_ACPI_DEBUG | 402 | #ifdef CONFIG_THINKPAD_ACPI_DEBUG |
397 | #define vdbg_printk dbg_printk | 403 | #define vdbg_printk dbg_printk |
398 | static const char *str_supported(int is_supported); | 404 | static const char *str_supported(int is_supported); |
399 | #else | 405 | #else |
400 | #define vdbg_printk(a_dbg_level, format, arg...) \ | 406 | static inline const char *str_supported(int is_supported) { return ""; } |
401 | do { } while (0) | 407 | #define vdbg_printk(a_dbg_level, format, arg...) \ |
408 | no_printk(format, ##arg) | ||
402 | #endif | 409 | #endif |
403 | 410 | ||
404 | static void tpacpi_log_usertask(const char * const what) | 411 | static void tpacpi_log_usertask(const char * const what) |
405 | { | 412 | { |
406 | printk(TPACPI_DEBUG "%s: access by process with PID %d\n", | 413 | printk(KERN_DEBUG pr_fmt("%s: access by process with PID %d\n"), |
407 | what, task_tgid_vnr(current)); | 414 | what, task_tgid_vnr(current)); |
408 | } | 415 | } |
409 | 416 | ||
410 | #define tpacpi_disclose_usertask(what, format, arg...) \ | 417 | #define tpacpi_disclose_usertask(what, format, arg...) \ |
411 | do { \ | 418 | do { \ |
412 | if (unlikely( \ | 419 | if (unlikely((dbg_level & TPACPI_DBG_DISCLOSETASK) && \ |
413 | (dbg_level & TPACPI_DBG_DISCLOSETASK) && \ | 420 | (tpacpi_lifecycle == TPACPI_LIFE_RUNNING))) { \ |
414 | (tpacpi_lifecycle == TPACPI_LIFE_RUNNING))) { \ | 421 | printk(KERN_DEBUG pr_fmt("%s: PID %d: " format), \ |
415 | printk(TPACPI_DEBUG "%s: PID %d: " format, \ | 422 | what, task_tgid_vnr(current), ## arg); \ |
416 | what, task_tgid_vnr(current), ## arg); \ | 423 | } \ |
417 | } \ | 424 | } while (0) |
418 | } while (0) | ||
419 | 425 | ||
420 | /* | 426 | /* |
421 | * Quirk handling helpers | 427 | * Quirk handling helpers |
@@ -534,15 +540,6 @@ TPACPI_HANDLE(hkey, ec, "\\_SB.HKEY", /* 600e/x, 770e, 770x */ | |||
534 | "HKEY", /* all others */ | 540 | "HKEY", /* all others */ |
535 | ); /* 570 */ | 541 | ); /* 570 */ |
536 | 542 | ||
537 | TPACPI_HANDLE(vid, root, "\\_SB.PCI.AGP.VGA", /* 570 */ | ||
538 | "\\_SB.PCI0.AGP0.VID0", /* 600e/x, 770x */ | ||
539 | "\\_SB.PCI0.VID0", /* 770e */ | ||
540 | "\\_SB.PCI0.VID", /* A21e, G4x, R50e, X30, X40 */ | ||
541 | "\\_SB.PCI0.AGP.VGA", /* X100e and a few others */ | ||
542 | "\\_SB.PCI0.AGP.VID", /* all others */ | ||
543 | ); /* R30, R31 */ | ||
544 | |||
545 | |||
546 | /************************************************************************* | 543 | /************************************************************************* |
547 | * ACPI helpers | 544 | * ACPI helpers |
548 | */ | 545 | */ |
@@ -562,7 +559,7 @@ static int acpi_evalf(acpi_handle handle, | |||
562 | int quiet; | 559 | int quiet; |
563 | 560 | ||
564 | if (!*fmt) { | 561 | if (!*fmt) { |
565 | printk(TPACPI_ERR "acpi_evalf() called with empty format\n"); | 562 | pr_err("acpi_evalf() called with empty format\n"); |
566 | return 0; | 563 | return 0; |
567 | } | 564 | } |
568 | 565 | ||
@@ -587,8 +584,9 @@ static int acpi_evalf(acpi_handle handle, | |||
587 | break; | 584 | break; |
588 | /* add more types as needed */ | 585 | /* add more types as needed */ |
589 | default: | 586 | default: |
590 | printk(TPACPI_ERR "acpi_evalf() called " | 587 | pr_err("acpi_evalf() called " |
591 | "with invalid format character '%c'\n", c); | 588 | "with invalid format character '%c'\n", c); |
589 | va_end(ap); | ||
592 | return 0; | 590 | return 0; |
593 | } | 591 | } |
594 | } | 592 | } |
@@ -615,13 +613,13 @@ static int acpi_evalf(acpi_handle handle, | |||
615 | break; | 613 | break; |
616 | /* add more types as needed */ | 614 | /* add more types as needed */ |
617 | default: | 615 | default: |
618 | printk(TPACPI_ERR "acpi_evalf() called " | 616 | pr_err("acpi_evalf() called " |
619 | "with invalid format character '%c'\n", res_type); | 617 | "with invalid format character '%c'\n", res_type); |
620 | return 0; | 618 | return 0; |
621 | } | 619 | } |
622 | 620 | ||
623 | if (!success && !quiet) | 621 | if (!success && !quiet) |
624 | printk(TPACPI_ERR "acpi_evalf(%s, %s, ...) failed: %s\n", | 622 | pr_err("acpi_evalf(%s, %s, ...) failed: %s\n", |
625 | method, fmt0, acpi_format_exception(status)); | 623 | method, fmt0, acpi_format_exception(status)); |
626 | 624 | ||
627 | return success; | 625 | return success; |
@@ -765,8 +763,7 @@ static int __init setup_acpi_notify(struct ibm_struct *ibm) | |||
765 | 763 | ||
766 | rc = acpi_bus_get_device(*ibm->acpi->handle, &ibm->acpi->device); | 764 | rc = acpi_bus_get_device(*ibm->acpi->handle, &ibm->acpi->device); |
767 | if (rc < 0) { | 765 | if (rc < 0) { |
768 | printk(TPACPI_ERR "acpi_bus_get_device(%s) failed: %d\n", | 766 | pr_err("acpi_bus_get_device(%s) failed: %d\n", ibm->name, rc); |
769 | ibm->name, rc); | ||
770 | return -ENODEV; | 767 | return -ENODEV; |
771 | } | 768 | } |
772 | 769 | ||
@@ -779,12 +776,10 @@ static int __init setup_acpi_notify(struct ibm_struct *ibm) | |||
779 | ibm->acpi->type, dispatch_acpi_notify, ibm); | 776 | ibm->acpi->type, dispatch_acpi_notify, ibm); |
780 | if (ACPI_FAILURE(status)) { | 777 | if (ACPI_FAILURE(status)) { |
781 | if (status == AE_ALREADY_EXISTS) { | 778 | if (status == AE_ALREADY_EXISTS) { |
782 | printk(TPACPI_NOTICE | 779 | pr_notice("another device driver is already " |
783 | "another device driver is already " | 780 | "handling %s events\n", ibm->name); |
784 | "handling %s events\n", ibm->name); | ||
785 | } else { | 781 | } else { |
786 | printk(TPACPI_ERR | 782 | pr_err("acpi_install_notify_handler(%s) failed: %s\n", |
787 | "acpi_install_notify_handler(%s) failed: %s\n", | ||
788 | ibm->name, acpi_format_exception(status)); | 783 | ibm->name, acpi_format_exception(status)); |
789 | } | 784 | } |
790 | return -ENODEV; | 785 | return -ENODEV; |
@@ -809,8 +804,7 @@ static int __init register_tpacpi_subdriver(struct ibm_struct *ibm) | |||
809 | 804 | ||
810 | ibm->acpi->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL); | 805 | ibm->acpi->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL); |
811 | if (!ibm->acpi->driver) { | 806 | if (!ibm->acpi->driver) { |
812 | printk(TPACPI_ERR | 807 | pr_err("failed to allocate memory for ibm->acpi->driver\n"); |
813 | "failed to allocate memory for ibm->acpi->driver\n"); | ||
814 | return -ENOMEM; | 808 | return -ENOMEM; |
815 | } | 809 | } |
816 | 810 | ||
@@ -821,7 +815,7 @@ static int __init register_tpacpi_subdriver(struct ibm_struct *ibm) | |||
821 | 815 | ||
822 | rc = acpi_bus_register_driver(ibm->acpi->driver); | 816 | rc = acpi_bus_register_driver(ibm->acpi->driver); |
823 | if (rc < 0) { | 817 | if (rc < 0) { |
824 | printk(TPACPI_ERR "acpi_bus_register_driver(%s) failed: %d\n", | 818 | pr_err("acpi_bus_register_driver(%s) failed: %d\n", |
825 | ibm->name, rc); | 819 | ibm->name, rc); |
826 | kfree(ibm->acpi->driver); | 820 | kfree(ibm->acpi->driver); |
827 | ibm->acpi->driver = NULL; | 821 | ibm->acpi->driver = NULL; |
@@ -1079,15 +1073,14 @@ static int parse_strtoul(const char *buf, | |||
1079 | static void tpacpi_disable_brightness_delay(void) | 1073 | static void tpacpi_disable_brightness_delay(void) |
1080 | { | 1074 | { |
1081 | if (acpi_evalf(hkey_handle, NULL, "PWMS", "qvd", 0)) | 1075 | if (acpi_evalf(hkey_handle, NULL, "PWMS", "qvd", 0)) |
1082 | printk(TPACPI_NOTICE | 1076 | pr_notice("ACPI backlight control delay disabled\n"); |
1083 | "ACPI backlight control delay disabled\n"); | ||
1084 | } | 1077 | } |
1085 | 1078 | ||
1086 | static void printk_deprecated_attribute(const char * const what, | 1079 | static void printk_deprecated_attribute(const char * const what, |
1087 | const char * const details) | 1080 | const char * const details) |
1088 | { | 1081 | { |
1089 | tpacpi_log_usertask("deprecated sysfs attribute"); | 1082 | tpacpi_log_usertask("deprecated sysfs attribute"); |
1090 | printk(TPACPI_WARN "WARNING: sysfs attribute %s is deprecated and " | 1083 | pr_warn("WARNING: sysfs attribute %s is deprecated and " |
1091 | "will be removed. %s\n", | 1084 | "will be removed. %s\n", |
1092 | what, details); | 1085 | what, details); |
1093 | } | 1086 | } |
@@ -1262,8 +1255,7 @@ static int __init tpacpi_new_rfkill(const enum tpacpi_rfk_id id, | |||
1262 | &tpacpi_rfk_rfkill_ops, | 1255 | &tpacpi_rfk_rfkill_ops, |
1263 | atp_rfk); | 1256 | atp_rfk); |
1264 | if (!atp_rfk || !atp_rfk->rfkill) { | 1257 | if (!atp_rfk || !atp_rfk->rfkill) { |
1265 | printk(TPACPI_ERR | 1258 | pr_err("failed to allocate memory for rfkill class\n"); |
1266 | "failed to allocate memory for rfkill class\n"); | ||
1267 | kfree(atp_rfk); | 1259 | kfree(atp_rfk); |
1268 | return -ENOMEM; | 1260 | return -ENOMEM; |
1269 | } | 1261 | } |
@@ -1273,9 +1265,8 @@ static int __init tpacpi_new_rfkill(const enum tpacpi_rfk_id id, | |||
1273 | 1265 | ||
1274 | sw_status = (tp_rfkops->get_status)(); | 1266 | sw_status = (tp_rfkops->get_status)(); |
1275 | if (sw_status < 0) { | 1267 | if (sw_status < 0) { |
1276 | printk(TPACPI_ERR | 1268 | pr_err("failed to read initial state for %s, error %d\n", |
1277 | "failed to read initial state for %s, error %d\n", | 1269 | name, sw_status); |
1278 | name, sw_status); | ||
1279 | } else { | 1270 | } else { |
1280 | sw_state = (sw_status == TPACPI_RFK_RADIO_OFF); | 1271 | sw_state = (sw_status == TPACPI_RFK_RADIO_OFF); |
1281 | if (set_default) { | 1272 | if (set_default) { |
@@ -1289,9 +1280,7 @@ static int __init tpacpi_new_rfkill(const enum tpacpi_rfk_id id, | |||
1289 | 1280 | ||
1290 | res = rfkill_register(atp_rfk->rfkill); | 1281 | res = rfkill_register(atp_rfk->rfkill); |
1291 | if (res < 0) { | 1282 | if (res < 0) { |
1292 | printk(TPACPI_ERR | 1283 | pr_err("failed to register %s rfkill switch: %d\n", name, res); |
1293 | "failed to register %s rfkill switch: %d\n", | ||
1294 | name, res); | ||
1295 | rfkill_destroy(atp_rfk->rfkill); | 1284 | rfkill_destroy(atp_rfk->rfkill); |
1296 | kfree(atp_rfk); | 1285 | kfree(atp_rfk); |
1297 | return res; | 1286 | return res; |
@@ -1299,7 +1288,7 @@ static int __init tpacpi_new_rfkill(const enum tpacpi_rfk_id id, | |||
1299 | 1288 | ||
1300 | tpacpi_rfkill_switches[id] = atp_rfk; | 1289 | tpacpi_rfkill_switches[id] = atp_rfk; |
1301 | 1290 | ||
1302 | printk(TPACPI_INFO "rfkill switch %s: radio is %sblocked\n", | 1291 | pr_info("rfkill switch %s: radio is %sblocked\n", |
1303 | name, (sw_state || hw_state) ? "" : "un"); | 1292 | name, (sw_state || hw_state) ? "" : "un"); |
1304 | return 0; | 1293 | return 0; |
1305 | } | 1294 | } |
@@ -1823,10 +1812,8 @@ static void __init tpacpi_check_outdated_fw(void) | |||
1823 | * broken, or really stable to begin with, so it is | 1812 | * broken, or really stable to begin with, so it is |
1824 | * best if the user upgrades the firmware anyway. | 1813 | * best if the user upgrades the firmware anyway. |
1825 | */ | 1814 | */ |
1826 | printk(TPACPI_WARN | 1815 | pr_warn("WARNING: Outdated ThinkPad BIOS/EC firmware\n"); |
1827 | "WARNING: Outdated ThinkPad BIOS/EC firmware\n"); | 1816 | pr_warn("WARNING: This firmware may be missing critical bug " |
1828 | printk(TPACPI_WARN | ||
1829 | "WARNING: This firmware may be missing critical bug " | ||
1830 | "fixes and/or important features\n"); | 1817 | "fixes and/or important features\n"); |
1831 | } | 1818 | } |
1832 | } | 1819 | } |
@@ -2115,9 +2102,7 @@ void static hotkey_mask_warn_incomplete_mask(void) | |||
2115 | (hotkey_all_mask | TPACPI_HKEY_NVRAM_KNOWN_MASK); | 2102 | (hotkey_all_mask | TPACPI_HKEY_NVRAM_KNOWN_MASK); |
2116 | 2103 | ||
2117 | if (wantedmask) | 2104 | if (wantedmask) |
2118 | printk(TPACPI_NOTICE | 2105 | pr_notice("required events 0x%08x not enabled!\n", wantedmask); |
2119 | "required events 0x%08x not enabled!\n", | ||
2120 | wantedmask); | ||
2121 | } | 2106 | } |
2122 | 2107 | ||
2123 | /* | 2108 | /* |
@@ -2155,10 +2140,9 @@ static int hotkey_mask_set(u32 mask) | |||
2155 | * a given event. | 2140 | * a given event. |
2156 | */ | 2141 | */ |
2157 | if (!hotkey_mask_get() && !rc && (fwmask & ~hotkey_acpi_mask)) { | 2142 | if (!hotkey_mask_get() && !rc && (fwmask & ~hotkey_acpi_mask)) { |
2158 | printk(TPACPI_NOTICE | 2143 | pr_notice("asked for hotkey mask 0x%08x, but " |
2159 | "asked for hotkey mask 0x%08x, but " | 2144 | "firmware forced it to 0x%08x\n", |
2160 | "firmware forced it to 0x%08x\n", | 2145 | fwmask, hotkey_acpi_mask); |
2161 | fwmask, hotkey_acpi_mask); | ||
2162 | } | 2146 | } |
2163 | 2147 | ||
2164 | if (tpacpi_lifecycle != TPACPI_LIFE_EXITING) | 2148 | if (tpacpi_lifecycle != TPACPI_LIFE_EXITING) |
@@ -2182,13 +2166,11 @@ static int hotkey_user_mask_set(const u32 mask) | |||
2182 | (mask == 0xffff || mask == 0xffffff || | 2166 | (mask == 0xffff || mask == 0xffffff || |
2183 | mask == 0xffffffff)) { | 2167 | mask == 0xffffffff)) { |
2184 | tp_warned.hotkey_mask_ff = 1; | 2168 | tp_warned.hotkey_mask_ff = 1; |
2185 | printk(TPACPI_NOTICE | 2169 | pr_notice("setting the hotkey mask to 0x%08x is likely " |
2186 | "setting the hotkey mask to 0x%08x is likely " | 2170 | "not the best way to go about it\n", mask); |
2187 | "not the best way to go about it\n", mask); | 2171 | pr_notice("please consider using the driver defaults, " |
2188 | printk(TPACPI_NOTICE | 2172 | "and refer to up-to-date thinkpad-acpi " |
2189 | "please consider using the driver defaults, " | 2173 | "documentation\n"); |
2190 | "and refer to up-to-date thinkpad-acpi " | ||
2191 | "documentation\n"); | ||
2192 | } | 2174 | } |
2193 | 2175 | ||
2194 | /* Try to enable what the user asked for, plus whatever we need. | 2176 | /* Try to enable what the user asked for, plus whatever we need. |
@@ -2274,16 +2256,12 @@ static void tpacpi_input_send_key(const unsigned int scancode) | |||
2274 | if (keycode != KEY_RESERVED) { | 2256 | if (keycode != KEY_RESERVED) { |
2275 | mutex_lock(&tpacpi_inputdev_send_mutex); | 2257 | mutex_lock(&tpacpi_inputdev_send_mutex); |
2276 | 2258 | ||
2259 | input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, scancode); | ||
2277 | input_report_key(tpacpi_inputdev, keycode, 1); | 2260 | input_report_key(tpacpi_inputdev, keycode, 1); |
2278 | if (keycode == KEY_UNKNOWN) | ||
2279 | input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, | ||
2280 | scancode); | ||
2281 | input_sync(tpacpi_inputdev); | 2261 | input_sync(tpacpi_inputdev); |
2282 | 2262 | ||
2263 | input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, scancode); | ||
2283 | input_report_key(tpacpi_inputdev, keycode, 0); | 2264 | input_report_key(tpacpi_inputdev, keycode, 0); |
2284 | if (keycode == KEY_UNKNOWN) | ||
2285 | input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, | ||
2286 | scancode); | ||
2287 | input_sync(tpacpi_inputdev); | 2265 | input_sync(tpacpi_inputdev); |
2288 | 2266 | ||
2289 | mutex_unlock(&tpacpi_inputdev_send_mutex); | 2267 | mutex_unlock(&tpacpi_inputdev_send_mutex); |
@@ -2410,7 +2388,7 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn, | |||
2410 | * This code is supposed to duplicate the IBM firmware behaviour: | 2388 | * This code is supposed to duplicate the IBM firmware behaviour: |
2411 | * - Pressing MUTE issues mute hotkey message, even when already mute | 2389 | * - Pressing MUTE issues mute hotkey message, even when already mute |
2412 | * - Pressing Volume up/down issues volume up/down hotkey messages, | 2390 | * - Pressing Volume up/down issues volume up/down hotkey messages, |
2413 | * even when already at maximum or minumum volume | 2391 | * even when already at maximum or minimum volume |
2414 | * - The act of unmuting issues volume up/down notification, | 2392 | * - The act of unmuting issues volume up/down notification, |
2415 | * depending which key was used to unmute | 2393 | * depending which key was used to unmute |
2416 | * | 2394 | * |
@@ -2576,8 +2554,7 @@ static void hotkey_poll_setup(const bool may_warn) | |||
2576 | NULL, TPACPI_NVRAM_KTHREAD_NAME); | 2554 | NULL, TPACPI_NVRAM_KTHREAD_NAME); |
2577 | if (IS_ERR(tpacpi_hotkey_task)) { | 2555 | if (IS_ERR(tpacpi_hotkey_task)) { |
2578 | tpacpi_hotkey_task = NULL; | 2556 | tpacpi_hotkey_task = NULL; |
2579 | printk(TPACPI_ERR | 2557 | pr_err("could not create kernel thread " |
2580 | "could not create kernel thread " | ||
2581 | "for hotkey polling\n"); | 2558 | "for hotkey polling\n"); |
2582 | } | 2559 | } |
2583 | } | 2560 | } |
@@ -2585,11 +2562,10 @@ static void hotkey_poll_setup(const bool may_warn) | |||
2585 | hotkey_poll_stop_sync(); | 2562 | hotkey_poll_stop_sync(); |
2586 | if (may_warn && (poll_driver_mask || poll_user_mask) && | 2563 | if (may_warn && (poll_driver_mask || poll_user_mask) && |
2587 | hotkey_poll_freq == 0) { | 2564 | hotkey_poll_freq == 0) { |
2588 | printk(TPACPI_NOTICE | 2565 | pr_notice("hot keys 0x%08x and/or events 0x%08x " |
2589 | "hot keys 0x%08x and/or events 0x%08x " | 2566 | "require polling, which is currently " |
2590 | "require polling, which is currently " | 2567 | "disabled\n", |
2591 | "disabled\n", | 2568 | poll_user_mask, poll_driver_mask); |
2592 | poll_user_mask, poll_driver_mask); | ||
2593 | } | 2569 | } |
2594 | } | 2570 | } |
2595 | } | 2571 | } |
@@ -2813,13 +2789,13 @@ static ssize_t hotkey_source_mask_store(struct device *dev, | |||
2813 | mutex_unlock(&hotkey_mutex); | 2789 | mutex_unlock(&hotkey_mutex); |
2814 | 2790 | ||
2815 | if (rc < 0) | 2791 | if (rc < 0) |
2816 | printk(TPACPI_ERR "hotkey_source_mask: failed to update the" | 2792 | pr_err("hotkey_source_mask: " |
2817 | "firmware event mask!\n"); | 2793 | "failed to update the firmware event mask!\n"); |
2818 | 2794 | ||
2819 | if (r_ev) | 2795 | if (r_ev) |
2820 | printk(TPACPI_NOTICE "hotkey_source_mask: " | 2796 | pr_notice("hotkey_source_mask: " |
2821 | "some important events were disabled: " | 2797 | "some important events were disabled: 0x%04x\n", |
2822 | "0x%04x\n", r_ev); | 2798 | r_ev); |
2823 | 2799 | ||
2824 | tpacpi_disclose_usertask("hotkey_source_mask", "set to 0x%08lx\n", t); | 2800 | tpacpi_disclose_usertask("hotkey_source_mask", "set to 0x%08lx\n", t); |
2825 | 2801 | ||
@@ -2993,7 +2969,7 @@ static void tpacpi_send_radiosw_update(void) | |||
2993 | * rfkill input events, or we will race the rfkill core input | 2969 | * rfkill input events, or we will race the rfkill core input |
2994 | * handler. | 2970 | * handler. |
2995 | * | 2971 | * |
2996 | * tpacpi_inputdev_send_mutex works as a syncronization point | 2972 | * tpacpi_inputdev_send_mutex works as a synchronization point |
2997 | * for the above. | 2973 | * for the above. |
2998 | * | 2974 | * |
2999 | * We optimize to avoid numerous calls to hotkey_get_wlsw. | 2975 | * We optimize to avoid numerous calls to hotkey_get_wlsw. |
@@ -3050,8 +3026,7 @@ static void hotkey_exit(void) | |||
3050 | if (((tp_features.hotkey_mask && | 3026 | if (((tp_features.hotkey_mask && |
3051 | hotkey_mask_set(hotkey_orig_mask)) | | 3027 | hotkey_mask_set(hotkey_orig_mask)) | |
3052 | hotkey_status_set(false)) != 0) | 3028 | hotkey_status_set(false)) != 0) |
3053 | printk(TPACPI_ERR | 3029 | pr_err("failed to restore hot key mask " |
3054 | "failed to restore hot key mask " | ||
3055 | "to BIOS defaults\n"); | 3030 | "to BIOS defaults\n"); |
3056 | } | 3031 | } |
3057 | 3032 | ||
@@ -3290,10 +3265,9 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3290 | for HKEY interface version 0x100 */ | 3265 | for HKEY interface version 0x100 */ |
3291 | if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) { | 3266 | if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) { |
3292 | if ((hkeyv >> 8) != 1) { | 3267 | if ((hkeyv >> 8) != 1) { |
3293 | printk(TPACPI_ERR "unknown version of the " | 3268 | pr_err("unknown version of the HKEY interface: 0x%x\n", |
3294 | "HKEY interface: 0x%x\n", hkeyv); | 3269 | hkeyv); |
3295 | printk(TPACPI_ERR "please report this to %s\n", | 3270 | pr_err("please report this to %s\n", TPACPI_MAIL); |
3296 | TPACPI_MAIL); | ||
3297 | } else { | 3271 | } else { |
3298 | /* | 3272 | /* |
3299 | * MHKV 0x100 in A31, R40, R40e, | 3273 | * MHKV 0x100 in A31, R40, R40e, |
@@ -3306,8 +3280,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3306 | /* Paranoia check AND init hotkey_all_mask */ | 3280 | /* Paranoia check AND init hotkey_all_mask */ |
3307 | if (!acpi_evalf(hkey_handle, &hotkey_all_mask, | 3281 | if (!acpi_evalf(hkey_handle, &hotkey_all_mask, |
3308 | "MHKA", "qd")) { | 3282 | "MHKA", "qd")) { |
3309 | printk(TPACPI_ERR | 3283 | pr_err("missing MHKA handler, " |
3310 | "missing MHKA handler, " | ||
3311 | "please report this to %s\n", | 3284 | "please report this to %s\n", |
3312 | TPACPI_MAIL); | 3285 | TPACPI_MAIL); |
3313 | /* Fallback: pre-init for FN+F3,F4,F12 */ | 3286 | /* Fallback: pre-init for FN+F3,F4,F12 */ |
@@ -3345,16 +3318,14 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3345 | if (dbg_wlswemul) { | 3318 | if (dbg_wlswemul) { |
3346 | tp_features.hotkey_wlsw = 1; | 3319 | tp_features.hotkey_wlsw = 1; |
3347 | radiosw_state = !!tpacpi_wlsw_emulstate; | 3320 | radiosw_state = !!tpacpi_wlsw_emulstate; |
3348 | printk(TPACPI_INFO | 3321 | pr_info("radio switch emulation enabled\n"); |
3349 | "radio switch emulation enabled\n"); | ||
3350 | } else | 3322 | } else |
3351 | #endif | 3323 | #endif |
3352 | /* Not all thinkpads have a hardware radio switch */ | 3324 | /* Not all thinkpads have a hardware radio switch */ |
3353 | if (acpi_evalf(hkey_handle, &status, "WLSW", "qd")) { | 3325 | if (acpi_evalf(hkey_handle, &status, "WLSW", "qd")) { |
3354 | tp_features.hotkey_wlsw = 1; | 3326 | tp_features.hotkey_wlsw = 1; |
3355 | radiosw_state = !!status; | 3327 | radiosw_state = !!status; |
3356 | printk(TPACPI_INFO | 3328 | pr_info("radio switch found; radios are %s\n", |
3357 | "radio switch found; radios are %s\n", | ||
3358 | enabled(status, 0)); | 3329 | enabled(status, 0)); |
3359 | } | 3330 | } |
3360 | if (tp_features.hotkey_wlsw) | 3331 | if (tp_features.hotkey_wlsw) |
@@ -3365,8 +3336,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3365 | if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) { | 3336 | if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) { |
3366 | tp_features.hotkey_tablet = 1; | 3337 | tp_features.hotkey_tablet = 1; |
3367 | tabletsw_state = !!(status & TP_HOTKEY_TABLET_MASK); | 3338 | tabletsw_state = !!(status & TP_HOTKEY_TABLET_MASK); |
3368 | printk(TPACPI_INFO | 3339 | pr_info("possible tablet mode switch found; " |
3369 | "possible tablet mode switch found; " | ||
3370 | "ThinkPad in %s mode\n", | 3340 | "ThinkPad in %s mode\n", |
3371 | (tabletsw_state) ? "tablet" : "laptop"); | 3341 | (tabletsw_state) ? "tablet" : "laptop"); |
3372 | res = add_to_attr_set(hotkey_dev_attributes, | 3342 | res = add_to_attr_set(hotkey_dev_attributes, |
@@ -3384,8 +3354,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3384 | hotkey_keycode_map = kmalloc(TPACPI_HOTKEY_MAP_SIZE, | 3354 | hotkey_keycode_map = kmalloc(TPACPI_HOTKEY_MAP_SIZE, |
3385 | GFP_KERNEL); | 3355 | GFP_KERNEL); |
3386 | if (!hotkey_keycode_map) { | 3356 | if (!hotkey_keycode_map) { |
3387 | printk(TPACPI_ERR | 3357 | pr_err("failed to allocate memory for key map\n"); |
3388 | "failed to allocate memory for key map\n"); | ||
3389 | res = -ENOMEM; | 3358 | res = -ENOMEM; |
3390 | goto err_exit; | 3359 | goto err_exit; |
3391 | } | 3360 | } |
@@ -3428,13 +3397,11 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3428 | * userspace. tpacpi_detect_brightness_capabilities() must have | 3397 | * userspace. tpacpi_detect_brightness_capabilities() must have |
3429 | * been called before this point */ | 3398 | * been called before this point */ |
3430 | if (tp_features.bright_acpimode && acpi_video_backlight_support()) { | 3399 | if (tp_features.bright_acpimode && acpi_video_backlight_support()) { |
3431 | printk(TPACPI_INFO | 3400 | pr_info("This ThinkPad has standard ACPI backlight " |
3432 | "This ThinkPad has standard ACPI backlight " | 3401 | "brightness control, supported by the ACPI " |
3433 | "brightness control, supported by the ACPI " | 3402 | "video driver\n"); |
3434 | "video driver\n"); | 3403 | pr_notice("Disabling thinkpad-acpi brightness events " |
3435 | printk(TPACPI_NOTICE | 3404 | "by default...\n"); |
3436 | "Disabling thinkpad-acpi brightness events " | ||
3437 | "by default...\n"); | ||
3438 | 3405 | ||
3439 | /* Disable brightness up/down on Lenovo thinkpads when | 3406 | /* Disable brightness up/down on Lenovo thinkpads when |
3440 | * ACPI is handling them, otherwise it is plain impossible | 3407 | * ACPI is handling them, otherwise it is plain impossible |
@@ -3541,8 +3508,7 @@ static bool hotkey_notify_wakeup(const u32 hkey, | |||
3541 | 3508 | ||
3542 | case TP_HKEY_EV_WKUP_S3_BATLOW: /* Battery on critical low level/S3 */ | 3509 | case TP_HKEY_EV_WKUP_S3_BATLOW: /* Battery on critical low level/S3 */ |
3543 | case TP_HKEY_EV_WKUP_S4_BATLOW: /* Battery on critical low level/S4 */ | 3510 | case TP_HKEY_EV_WKUP_S4_BATLOW: /* Battery on critical low level/S4 */ |
3544 | printk(TPACPI_ALERT | 3511 | pr_alert("EMERGENCY WAKEUP: battery almost empty\n"); |
3545 | "EMERGENCY WAKEUP: battery almost empty\n"); | ||
3546 | /* how to auto-heal: */ | 3512 | /* how to auto-heal: */ |
3547 | /* 2313: woke up from S3, go to S4/S5 */ | 3513 | /* 2313: woke up from S3, go to S4/S5 */ |
3548 | /* 2413: woke up from S4, go to S5 */ | 3514 | /* 2413: woke up from S4, go to S5 */ |
@@ -3553,14 +3519,40 @@ static bool hotkey_notify_wakeup(const u32 hkey, | |||
3553 | } | 3519 | } |
3554 | 3520 | ||
3555 | if (hotkey_wakeup_reason != TP_ACPI_WAKEUP_NONE) { | 3521 | if (hotkey_wakeup_reason != TP_ACPI_WAKEUP_NONE) { |
3556 | printk(TPACPI_INFO | 3522 | pr_info("woke up due to a hot-unplug request...\n"); |
3557 | "woke up due to a hot-unplug " | ||
3558 | "request...\n"); | ||
3559 | hotkey_wakeup_reason_notify_change(); | 3523 | hotkey_wakeup_reason_notify_change(); |
3560 | } | 3524 | } |
3561 | return true; | 3525 | return true; |
3562 | } | 3526 | } |
3563 | 3527 | ||
3528 | static bool hotkey_notify_dockevent(const u32 hkey, | ||
3529 | bool *send_acpi_ev, | ||
3530 | bool *ignore_acpi_ev) | ||
3531 | { | ||
3532 | /* 0x4000-0x4FFF: dock-related events */ | ||
3533 | *send_acpi_ev = true; | ||
3534 | *ignore_acpi_ev = false; | ||
3535 | |||
3536 | switch (hkey) { | ||
3537 | case TP_HKEY_EV_UNDOCK_ACK: | ||
3538 | /* ACPI undock operation completed after wakeup */ | ||
3539 | hotkey_autosleep_ack = 1; | ||
3540 | pr_info("undocked\n"); | ||
3541 | hotkey_wakeup_hotunplug_complete_notify_change(); | ||
3542 | return true; | ||
3543 | |||
3544 | case TP_HKEY_EV_HOTPLUG_DOCK: /* docked to port replicator */ | ||
3545 | pr_info("docked into hotplug port replicator\n"); | ||
3546 | return true; | ||
3547 | case TP_HKEY_EV_HOTPLUG_UNDOCK: /* undocked from port replicator */ | ||
3548 | pr_info("undocked from hotplug port replicator\n"); | ||
3549 | return true; | ||
3550 | |||
3551 | default: | ||
3552 | return false; | ||
3553 | } | ||
3554 | } | ||
3555 | |||
3564 | static bool hotkey_notify_usrevent(const u32 hkey, | 3556 | static bool hotkey_notify_usrevent(const u32 hkey, |
3565 | bool *send_acpi_ev, | 3557 | bool *send_acpi_ev, |
3566 | bool *ignore_acpi_ev) | 3558 | bool *ignore_acpi_ev) |
@@ -3595,49 +3587,52 @@ static bool hotkey_notify_usrevent(const u32 hkey, | |||
3595 | 3587 | ||
3596 | static void thermal_dump_all_sensors(void); | 3588 | static void thermal_dump_all_sensors(void); |
3597 | 3589 | ||
3598 | static bool hotkey_notify_thermal(const u32 hkey, | 3590 | static bool hotkey_notify_6xxx(const u32 hkey, |
3599 | bool *send_acpi_ev, | 3591 | bool *send_acpi_ev, |
3600 | bool *ignore_acpi_ev) | 3592 | bool *ignore_acpi_ev) |
3601 | { | 3593 | { |
3602 | bool known = true; | 3594 | bool known = true; |
3603 | 3595 | ||
3604 | /* 0x6000-0x6FFF: thermal alarms */ | 3596 | /* 0x6000-0x6FFF: thermal alarms/notices and keyboard events */ |
3605 | *send_acpi_ev = true; | 3597 | *send_acpi_ev = true; |
3606 | *ignore_acpi_ev = false; | 3598 | *ignore_acpi_ev = false; |
3607 | 3599 | ||
3608 | switch (hkey) { | 3600 | switch (hkey) { |
3609 | case TP_HKEY_EV_THM_TABLE_CHANGED: | 3601 | case TP_HKEY_EV_THM_TABLE_CHANGED: |
3610 | printk(TPACPI_INFO | 3602 | pr_info("EC reports that Thermal Table has changed\n"); |
3611 | "EC reports that Thermal Table has changed\n"); | ||
3612 | /* recommended action: do nothing, we don't have | 3603 | /* recommended action: do nothing, we don't have |
3613 | * Lenovo ATM information */ | 3604 | * Lenovo ATM information */ |
3614 | return true; | 3605 | return true; |
3615 | case TP_HKEY_EV_ALARM_BAT_HOT: | 3606 | case TP_HKEY_EV_ALARM_BAT_HOT: |
3616 | printk(TPACPI_CRIT | 3607 | pr_crit("THERMAL ALARM: battery is too hot!\n"); |
3617 | "THERMAL ALARM: battery is too hot!\n"); | ||
3618 | /* recommended action: warn user through gui */ | 3608 | /* recommended action: warn user through gui */ |
3619 | break; | 3609 | break; |
3620 | case TP_HKEY_EV_ALARM_BAT_XHOT: | 3610 | case TP_HKEY_EV_ALARM_BAT_XHOT: |
3621 | printk(TPACPI_ALERT | 3611 | pr_alert("THERMAL EMERGENCY: battery is extremely hot!\n"); |
3622 | "THERMAL EMERGENCY: battery is extremely hot!\n"); | ||
3623 | /* recommended action: immediate sleep/hibernate */ | 3612 | /* recommended action: immediate sleep/hibernate */ |
3624 | break; | 3613 | break; |
3625 | case TP_HKEY_EV_ALARM_SENSOR_HOT: | 3614 | case TP_HKEY_EV_ALARM_SENSOR_HOT: |
3626 | printk(TPACPI_CRIT | 3615 | pr_crit("THERMAL ALARM: " |
3627 | "THERMAL ALARM: " | ||
3628 | "a sensor reports something is too hot!\n"); | 3616 | "a sensor reports something is too hot!\n"); |
3629 | /* recommended action: warn user through gui, that */ | 3617 | /* recommended action: warn user through gui, that */ |
3630 | /* some internal component is too hot */ | 3618 | /* some internal component is too hot */ |
3631 | break; | 3619 | break; |
3632 | case TP_HKEY_EV_ALARM_SENSOR_XHOT: | 3620 | case TP_HKEY_EV_ALARM_SENSOR_XHOT: |
3633 | printk(TPACPI_ALERT | 3621 | pr_alert("THERMAL EMERGENCY: " |
3634 | "THERMAL EMERGENCY: " | 3622 | "a sensor reports something is extremely hot!\n"); |
3635 | "a sensor reports something is extremely hot!\n"); | ||
3636 | /* recommended action: immediate sleep/hibernate */ | 3623 | /* recommended action: immediate sleep/hibernate */ |
3637 | break; | 3624 | break; |
3625 | |||
3626 | case TP_HKEY_EV_KEY_NUMLOCK: | ||
3627 | case TP_HKEY_EV_KEY_FN: | ||
3628 | /* key press events, we just ignore them as long as the EC | ||
3629 | * is still reporting them in the normal keyboard stream */ | ||
3630 | *send_acpi_ev = false; | ||
3631 | *ignore_acpi_ev = true; | ||
3632 | return true; | ||
3633 | |||
3638 | default: | 3634 | default: |
3639 | printk(TPACPI_ALERT | 3635 | pr_warn("unknown possible thermal alarm or keyboard event received\n"); |
3640 | "THERMAL ALERT: unknown thermal alarm received\n"); | ||
3641 | known = false; | 3636 | known = false; |
3642 | } | 3637 | } |
3643 | 3638 | ||
@@ -3654,8 +3649,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
3654 | bool known_ev; | 3649 | bool known_ev; |
3655 | 3650 | ||
3656 | if (event != 0x80) { | 3651 | if (event != 0x80) { |
3657 | printk(TPACPI_ERR | 3652 | pr_err("unknown HKEY notification event %d\n", event); |
3658 | "unknown HKEY notification event %d\n", event); | ||
3659 | /* forward it to userspace, maybe it knows how to handle it */ | 3653 | /* forward it to userspace, maybe it knows how to handle it */ |
3660 | acpi_bus_generate_netlink_event( | 3654 | acpi_bus_generate_netlink_event( |
3661 | ibm->acpi->device->pnp.device_class, | 3655 | ibm->acpi->device->pnp.device_class, |
@@ -3666,7 +3660,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
3666 | 3660 | ||
3667 | while (1) { | 3661 | while (1) { |
3668 | if (!acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) { | 3662 | if (!acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) { |
3669 | printk(TPACPI_ERR "failed to retrieve HKEY event\n"); | 3663 | pr_err("failed to retrieve HKEY event\n"); |
3670 | return; | 3664 | return; |
3671 | } | 3665 | } |
3672 | 3666 | ||
@@ -3694,8 +3688,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
3694 | switch (hkey) { | 3688 | switch (hkey) { |
3695 | case TP_HKEY_EV_BAYEJ_ACK: | 3689 | case TP_HKEY_EV_BAYEJ_ACK: |
3696 | hotkey_autosleep_ack = 1; | 3690 | hotkey_autosleep_ack = 1; |
3697 | printk(TPACPI_INFO | 3691 | pr_info("bay ejected\n"); |
3698 | "bay ejected\n"); | ||
3699 | hotkey_wakeup_hotunplug_complete_notify_change(); | 3692 | hotkey_wakeup_hotunplug_complete_notify_change(); |
3700 | known_ev = true; | 3693 | known_ev = true; |
3701 | break; | 3694 | break; |
@@ -3708,16 +3701,9 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
3708 | } | 3701 | } |
3709 | break; | 3702 | break; |
3710 | case 4: | 3703 | case 4: |
3711 | /* 0x4000-0x4FFF: dock-related wakeups */ | 3704 | /* 0x4000-0x4FFF: dock-related events */ |
3712 | if (hkey == TP_HKEY_EV_UNDOCK_ACK) { | 3705 | known_ev = hotkey_notify_dockevent(hkey, &send_acpi_ev, |
3713 | hotkey_autosleep_ack = 1; | 3706 | &ignore_acpi_ev); |
3714 | printk(TPACPI_INFO | ||
3715 | "undocked\n"); | ||
3716 | hotkey_wakeup_hotunplug_complete_notify_change(); | ||
3717 | known_ev = true; | ||
3718 | } else { | ||
3719 | known_ev = false; | ||
3720 | } | ||
3721 | break; | 3707 | break; |
3722 | case 5: | 3708 | case 5: |
3723 | /* 0x5000-0x5FFF: human interface helpers */ | 3709 | /* 0x5000-0x5FFF: human interface helpers */ |
@@ -3725,8 +3711,9 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
3725 | &ignore_acpi_ev); | 3711 | &ignore_acpi_ev); |
3726 | break; | 3712 | break; |
3727 | case 6: | 3713 | case 6: |
3728 | /* 0x6000-0x6FFF: thermal alarms */ | 3714 | /* 0x6000-0x6FFF: thermal alarms/notices and |
3729 | known_ev = hotkey_notify_thermal(hkey, &send_acpi_ev, | 3715 | * keyboard events */ |
3716 | known_ev = hotkey_notify_6xxx(hkey, &send_acpi_ev, | ||
3730 | &ignore_acpi_ev); | 3717 | &ignore_acpi_ev); |
3731 | break; | 3718 | break; |
3732 | case 7: | 3719 | case 7: |
@@ -3743,11 +3730,9 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
3743 | known_ev = false; | 3730 | known_ev = false; |
3744 | } | 3731 | } |
3745 | if (!known_ev) { | 3732 | if (!known_ev) { |
3746 | printk(TPACPI_NOTICE | 3733 | pr_notice("unhandled HKEY event 0x%04x\n", hkey); |
3747 | "unhandled HKEY event 0x%04x\n", hkey); | 3734 | pr_notice("please report the conditions when this " |
3748 | printk(TPACPI_NOTICE | 3735 | "event happened to %s\n", TPACPI_MAIL); |
3749 | "please report the conditions when this " | ||
3750 | "event happened to %s\n", TPACPI_MAIL); | ||
3751 | } | 3736 | } |
3752 | 3737 | ||
3753 | /* Legacy events */ | 3738 | /* Legacy events */ |
@@ -3780,8 +3765,7 @@ static void hotkey_resume(void) | |||
3780 | 3765 | ||
3781 | if (hotkey_status_set(true) < 0 || | 3766 | if (hotkey_status_set(true) < 0 || |
3782 | hotkey_mask_set(hotkey_acpi_mask) < 0) | 3767 | hotkey_mask_set(hotkey_acpi_mask) < 0) |
3783 | printk(TPACPI_ERR | 3768 | pr_err("error while attempting to reset the event " |
3784 | "error while attempting to reset the event " | ||
3785 | "firmware interface\n"); | 3769 | "firmware interface\n"); |
3786 | 3770 | ||
3787 | tpacpi_send_radiosw_update(); | 3771 | tpacpi_send_radiosw_update(); |
@@ -3826,14 +3810,12 @@ static void hotkey_enabledisable_warn(bool enable) | |||
3826 | { | 3810 | { |
3827 | tpacpi_log_usertask("procfs hotkey enable/disable"); | 3811 | tpacpi_log_usertask("procfs hotkey enable/disable"); |
3828 | if (!WARN((tpacpi_lifecycle == TPACPI_LIFE_RUNNING || !enable), | 3812 | if (!WARN((tpacpi_lifecycle == TPACPI_LIFE_RUNNING || !enable), |
3829 | TPACPI_WARN | 3813 | pr_fmt("hotkey enable/disable functionality has been " |
3830 | "hotkey enable/disable functionality has been " | 3814 | "removed from the driver. " |
3831 | "removed from the driver. Hotkeys are always " | 3815 | "Hotkeys are always enabled.\n"))) |
3832 | "enabled\n")) | 3816 | pr_err("Please remove the hotkey=enable module " |
3833 | printk(TPACPI_ERR | 3817 | "parameter, it is deprecated. " |
3834 | "Please remove the hotkey=enable module " | 3818 | "Hotkeys are always enabled.\n"); |
3835 | "parameter, it is deprecated. Hotkeys are always " | ||
3836 | "enabled\n"); | ||
3837 | } | 3819 | } |
3838 | 3820 | ||
3839 | static int hotkey_write(char *buf) | 3821 | static int hotkey_write(char *buf) |
@@ -3882,7 +3864,8 @@ errexit: | |||
3882 | } | 3864 | } |
3883 | 3865 | ||
3884 | static const struct acpi_device_id ibm_htk_device_ids[] = { | 3866 | static const struct acpi_device_id ibm_htk_device_ids[] = { |
3885 | {TPACPI_ACPI_HKEY_HID, 0}, | 3867 | {TPACPI_ACPI_IBM_HKEY_HID, 0}, |
3868 | {TPACPI_ACPI_LENOVO_HKEY_HID, 0}, | ||
3886 | {"", 0}, | 3869 | {"", 0}, |
3887 | }; | 3870 | }; |
3888 | 3871 | ||
@@ -4012,8 +3995,7 @@ static void bluetooth_shutdown(void) | |||
4012 | /* Order firmware to save current state to NVRAM */ | 3995 | /* Order firmware to save current state to NVRAM */ |
4013 | if (!acpi_evalf(NULL, NULL, "\\BLTH", "vd", | 3996 | if (!acpi_evalf(NULL, NULL, "\\BLTH", "vd", |
4014 | TP_ACPI_BLTH_SAVE_STATE)) | 3997 | TP_ACPI_BLTH_SAVE_STATE)) |
4015 | printk(TPACPI_NOTICE | 3998 | pr_notice("failed to save bluetooth state to NVRAM\n"); |
4016 | "failed to save bluetooth state to NVRAM\n"); | ||
4017 | else | 3999 | else |
4018 | vdbg_printk(TPACPI_DBG_RFKILL, | 4000 | vdbg_printk(TPACPI_DBG_RFKILL, |
4019 | "bluestooth state saved to NVRAM\n"); | 4001 | "bluestooth state saved to NVRAM\n"); |
@@ -4052,8 +4034,7 @@ static int __init bluetooth_init(struct ibm_init_struct *iibm) | |||
4052 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | 4034 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES |
4053 | if (dbg_bluetoothemul) { | 4035 | if (dbg_bluetoothemul) { |
4054 | tp_features.bluetooth = 1; | 4036 | tp_features.bluetooth = 1; |
4055 | printk(TPACPI_INFO | 4037 | pr_info("bluetooth switch emulation enabled\n"); |
4056 | "bluetooth switch emulation enabled\n"); | ||
4057 | } else | 4038 | } else |
4058 | #endif | 4039 | #endif |
4059 | if (tp_features.bluetooth && | 4040 | if (tp_features.bluetooth && |
@@ -4204,8 +4185,7 @@ static void wan_shutdown(void) | |||
4204 | /* Order firmware to save current state to NVRAM */ | 4185 | /* Order firmware to save current state to NVRAM */ |
4205 | if (!acpi_evalf(NULL, NULL, "\\WGSV", "vd", | 4186 | if (!acpi_evalf(NULL, NULL, "\\WGSV", "vd", |
4206 | TP_ACPI_WGSV_SAVE_STATE)) | 4187 | TP_ACPI_WGSV_SAVE_STATE)) |
4207 | printk(TPACPI_NOTICE | 4188 | pr_notice("failed to save WWAN state to NVRAM\n"); |
4208 | "failed to save WWAN state to NVRAM\n"); | ||
4209 | else | 4189 | else |
4210 | vdbg_printk(TPACPI_DBG_RFKILL, | 4190 | vdbg_printk(TPACPI_DBG_RFKILL, |
4211 | "WWAN state saved to NVRAM\n"); | 4191 | "WWAN state saved to NVRAM\n"); |
@@ -4242,8 +4222,7 @@ static int __init wan_init(struct ibm_init_struct *iibm) | |||
4242 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | 4222 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES |
4243 | if (dbg_wwanemul) { | 4223 | if (dbg_wwanemul) { |
4244 | tp_features.wan = 1; | 4224 | tp_features.wan = 1; |
4245 | printk(TPACPI_INFO | 4225 | pr_info("wwan switch emulation enabled\n"); |
4246 | "wwan switch emulation enabled\n"); | ||
4247 | } else | 4226 | } else |
4248 | #endif | 4227 | #endif |
4249 | if (tp_features.wan && | 4228 | if (tp_features.wan && |
@@ -4383,8 +4362,7 @@ static int __init uwb_init(struct ibm_init_struct *iibm) | |||
4383 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | 4362 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES |
4384 | if (dbg_uwbemul) { | 4363 | if (dbg_uwbemul) { |
4385 | tp_features.uwb = 1; | 4364 | tp_features.uwb = 1; |
4386 | printk(TPACPI_INFO | 4365 | pr_info("uwb switch emulation enabled\n"); |
4387 | "uwb switch emulation enabled\n"); | ||
4388 | } else | 4366 | } else |
4389 | #endif | 4367 | #endif |
4390 | if (tp_features.uwb && | 4368 | if (tp_features.uwb && |
@@ -4445,6 +4423,15 @@ static int video_orig_autosw; | |||
4445 | static int video_autosw_get(void); | 4423 | static int video_autosw_get(void); |
4446 | static int video_autosw_set(int enable); | 4424 | static int video_autosw_set(int enable); |
4447 | 4425 | ||
4426 | TPACPI_HANDLE(vid, root, | ||
4427 | "\\_SB.PCI.AGP.VGA", /* 570 */ | ||
4428 | "\\_SB.PCI0.AGP0.VID0", /* 600e/x, 770x */ | ||
4429 | "\\_SB.PCI0.VID0", /* 770e */ | ||
4430 | "\\_SB.PCI0.VID", /* A21e, G4x, R50e, X30, X40 */ | ||
4431 | "\\_SB.PCI0.AGP.VGA", /* X100e and a few others */ | ||
4432 | "\\_SB.PCI0.AGP.VID", /* all others */ | ||
4433 | ); /* R30, R31 */ | ||
4434 | |||
4448 | TPACPI_HANDLE(vid2, root, "\\_SB.PCI0.AGPB.VID"); /* G41 */ | 4435 | TPACPI_HANDLE(vid2, root, "\\_SB.PCI0.AGPB.VID"); /* G41 */ |
4449 | 4436 | ||
4450 | static int __init video_init(struct ibm_init_struct *iibm) | 4437 | static int __init video_init(struct ibm_init_struct *iibm) |
@@ -4488,7 +4475,7 @@ static void video_exit(void) | |||
4488 | dbg_printk(TPACPI_DBG_EXIT, | 4475 | dbg_printk(TPACPI_DBG_EXIT, |
4489 | "restoring original video autoswitch mode\n"); | 4476 | "restoring original video autoswitch mode\n"); |
4490 | if (video_autosw_set(video_orig_autosw)) | 4477 | if (video_autosw_set(video_orig_autosw)) |
4491 | printk(TPACPI_ERR "error while trying to restore original " | 4478 | pr_err("error while trying to restore original " |
4492 | "video autoswitch mode\n"); | 4479 | "video autoswitch mode\n"); |
4493 | } | 4480 | } |
4494 | 4481 | ||
@@ -4561,8 +4548,7 @@ static int video_outputsw_set(int status) | |||
4561 | res = acpi_evalf(vid_handle, NULL, | 4548 | res = acpi_evalf(vid_handle, NULL, |
4562 | "ASWT", "vdd", status * 0x100, 0); | 4549 | "ASWT", "vdd", status * 0x100, 0); |
4563 | if (!autosw && video_autosw_set(autosw)) { | 4550 | if (!autosw && video_autosw_set(autosw)) { |
4564 | printk(TPACPI_ERR | 4551 | pr_err("video auto-switch left enabled due to error\n"); |
4565 | "video auto-switch left enabled due to error\n"); | ||
4566 | return -EIO; | 4552 | return -EIO; |
4567 | } | 4553 | } |
4568 | break; | 4554 | break; |
@@ -4631,8 +4617,7 @@ static int video_outputsw_cycle(void) | |||
4631 | return -ENOSYS; | 4617 | return -ENOSYS; |
4632 | } | 4618 | } |
4633 | if (!autosw && video_autosw_set(autosw)) { | 4619 | if (!autosw && video_autosw_set(autosw)) { |
4634 | printk(TPACPI_ERR | 4620 | pr_err("video auto-switch left enabled due to error\n"); |
4635 | "video auto-switch left enabled due to error\n"); | ||
4636 | return -EIO; | 4621 | return -EIO; |
4637 | } | 4622 | } |
4638 | 4623 | ||
@@ -5349,7 +5334,7 @@ static int __init led_init(struct ibm_init_struct *iibm) | |||
5349 | tpacpi_leds = kzalloc(sizeof(*tpacpi_leds) * TPACPI_LED_NUMLEDS, | 5334 | tpacpi_leds = kzalloc(sizeof(*tpacpi_leds) * TPACPI_LED_NUMLEDS, |
5350 | GFP_KERNEL); | 5335 | GFP_KERNEL); |
5351 | if (!tpacpi_leds) { | 5336 | if (!tpacpi_leds) { |
5352 | printk(TPACPI_ERR "Out of memory for LED data\n"); | 5337 | pr_err("Out of memory for LED data\n"); |
5353 | return -ENOMEM; | 5338 | return -ENOMEM; |
5354 | } | 5339 | } |
5355 | 5340 | ||
@@ -5368,9 +5353,8 @@ static int __init led_init(struct ibm_init_struct *iibm) | |||
5368 | } | 5353 | } |
5369 | 5354 | ||
5370 | #ifdef CONFIG_THINKPAD_ACPI_UNSAFE_LEDS | 5355 | #ifdef CONFIG_THINKPAD_ACPI_UNSAFE_LEDS |
5371 | printk(TPACPI_NOTICE | 5356 | pr_notice("warning: userspace override of important " |
5372 | "warning: userspace override of important " | 5357 | "firmware LEDs is enabled\n"); |
5373 | "firmware LEDs is enabled\n"); | ||
5374 | #endif | 5358 | #endif |
5375 | return 0; | 5359 | return 0; |
5376 | } | 5360 | } |
@@ -5640,17 +5624,16 @@ static void thermal_dump_all_sensors(void) | |||
5640 | if (n <= 0) | 5624 | if (n <= 0) |
5641 | return; | 5625 | return; |
5642 | 5626 | ||
5643 | printk(TPACPI_NOTICE | 5627 | pr_notice("temperatures (Celsius):"); |
5644 | "temperatures (Celsius):"); | ||
5645 | 5628 | ||
5646 | for (i = 0; i < n; i++) { | 5629 | for (i = 0; i < n; i++) { |
5647 | if (t.temp[i] != TPACPI_THERMAL_SENSOR_NA) | 5630 | if (t.temp[i] != TPACPI_THERMAL_SENSOR_NA) |
5648 | printk(KERN_CONT " %d", (int)(t.temp[i] / 1000)); | 5631 | pr_cont(" %d", (int)(t.temp[i] / 1000)); |
5649 | else | 5632 | else |
5650 | printk(KERN_CONT " N/A"); | 5633 | pr_cont(" N/A"); |
5651 | } | 5634 | } |
5652 | 5635 | ||
5653 | printk(KERN_CONT "\n"); | 5636 | pr_cont("\n"); |
5654 | } | 5637 | } |
5655 | 5638 | ||
5656 | /* sysfs temp##_input -------------------------------------------------- */ | 5639 | /* sysfs temp##_input -------------------------------------------------- */ |
@@ -5770,14 +5753,12 @@ static int __init thermal_init(struct ibm_init_struct *iibm) | |||
5770 | if (ta1 == 0) { | 5753 | if (ta1 == 0) { |
5771 | /* This is sheer paranoia, but we handle it anyway */ | 5754 | /* This is sheer paranoia, but we handle it anyway */ |
5772 | if (acpi_tmp7) { | 5755 | if (acpi_tmp7) { |
5773 | printk(TPACPI_ERR | 5756 | pr_err("ThinkPad ACPI EC access misbehaving, " |
5774 | "ThinkPad ACPI EC access misbehaving, " | ||
5775 | "falling back to ACPI TMPx access " | 5757 | "falling back to ACPI TMPx access " |
5776 | "mode\n"); | 5758 | "mode\n"); |
5777 | thermal_read_mode = TPACPI_THERMAL_ACPI_TMP07; | 5759 | thermal_read_mode = TPACPI_THERMAL_ACPI_TMP07; |
5778 | } else { | 5760 | } else { |
5779 | printk(TPACPI_ERR | 5761 | pr_err("ThinkPad ACPI EC access misbehaving, " |
5780 | "ThinkPad ACPI EC access misbehaving, " | ||
5781 | "disabling thermal sensors access\n"); | 5762 | "disabling thermal sensors access\n"); |
5782 | thermal_read_mode = TPACPI_THERMAL_NONE; | 5763 | thermal_read_mode = TPACPI_THERMAL_NONE; |
5783 | } | 5764 | } |
@@ -6109,7 +6090,7 @@ static void tpacpi_brightness_notify_change(void) | |||
6109 | BACKLIGHT_UPDATE_HOTKEY); | 6090 | BACKLIGHT_UPDATE_HOTKEY); |
6110 | } | 6091 | } |
6111 | 6092 | ||
6112 | static struct backlight_ops ibm_backlight_data = { | 6093 | static const struct backlight_ops ibm_backlight_data = { |
6113 | .get_brightness = brightness_get, | 6094 | .get_brightness = brightness_get, |
6114 | .update_status = brightness_update_status, | 6095 | .update_status = brightness_update_status, |
6115 | }; | 6096 | }; |
@@ -6130,8 +6111,8 @@ static int __init tpacpi_query_bcl_levels(acpi_handle handle) | |||
6130 | if (ACPI_SUCCESS(acpi_evaluate_object(handle, "_BCL", NULL, &buffer))) { | 6111 | if (ACPI_SUCCESS(acpi_evaluate_object(handle, "_BCL", NULL, &buffer))) { |
6131 | obj = (union acpi_object *)buffer.pointer; | 6112 | obj = (union acpi_object *)buffer.pointer; |
6132 | if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { | 6113 | if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { |
6133 | printk(TPACPI_ERR "Unknown _BCL data, " | 6114 | pr_err("Unknown _BCL data, please report this to %s\n", |
6134 | "please report this to %s\n", TPACPI_MAIL); | 6115 | TPACPI_MAIL); |
6135 | rc = 0; | 6116 | rc = 0; |
6136 | } else { | 6117 | } else { |
6137 | rc = obj->package.count; | 6118 | rc = obj->package.count; |
@@ -6215,18 +6196,15 @@ static void __init tpacpi_detect_brightness_capabilities(void) | |||
6215 | switch (b) { | 6196 | switch (b) { |
6216 | case 16: | 6197 | case 16: |
6217 | bright_maxlvl = 15; | 6198 | bright_maxlvl = 15; |
6218 | printk(TPACPI_INFO | 6199 | pr_info("detected a 16-level brightness capable ThinkPad\n"); |
6219 | "detected a 16-level brightness capable ThinkPad\n"); | ||
6220 | break; | 6200 | break; |
6221 | case 8: | 6201 | case 8: |
6222 | case 0: | 6202 | case 0: |
6223 | bright_maxlvl = 7; | 6203 | bright_maxlvl = 7; |
6224 | printk(TPACPI_INFO | 6204 | pr_info("detected a 8-level brightness capable ThinkPad\n"); |
6225 | "detected a 8-level brightness capable ThinkPad\n"); | ||
6226 | break; | 6205 | break; |
6227 | default: | 6206 | default: |
6228 | printk(TPACPI_ERR | 6207 | pr_err("Unsupported brightness interface, " |
6229 | "Unsupported brightness interface, " | ||
6230 | "please contact %s\n", TPACPI_MAIL); | 6208 | "please contact %s\n", TPACPI_MAIL); |
6231 | tp_features.bright_unkfw = 1; | 6209 | tp_features.bright_unkfw = 1; |
6232 | bright_maxlvl = b - 1; | 6210 | bright_maxlvl = b - 1; |
@@ -6261,22 +6239,19 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
6261 | 6239 | ||
6262 | if (acpi_video_backlight_support()) { | 6240 | if (acpi_video_backlight_support()) { |
6263 | if (brightness_enable > 1) { | 6241 | if (brightness_enable > 1) { |
6264 | printk(TPACPI_INFO | 6242 | pr_info("Standard ACPI backlight interface " |
6265 | "Standard ACPI backlight interface " | 6243 | "available, not loading native one\n"); |
6266 | "available, not loading native one.\n"); | ||
6267 | return 1; | 6244 | return 1; |
6268 | } else if (brightness_enable == 1) { | 6245 | } else if (brightness_enable == 1) { |
6269 | printk(TPACPI_WARN | 6246 | pr_warn("Cannot enable backlight brightness support, " |
6270 | "Cannot enable backlight brightness support, " | ||
6271 | "ACPI is already handling it. Refer to the " | 6247 | "ACPI is already handling it. Refer to the " |
6272 | "acpi_backlight kernel parameter\n"); | 6248 | "acpi_backlight kernel parameter.\n"); |
6273 | return 1; | 6249 | return 1; |
6274 | } | 6250 | } |
6275 | } else if (tp_features.bright_acpimode && brightness_enable > 1) { | 6251 | } else if (tp_features.bright_acpimode && brightness_enable > 1) { |
6276 | printk(TPACPI_NOTICE | 6252 | pr_notice("Standard ACPI backlight interface not " |
6277 | "Standard ACPI backlight interface not " | 6253 | "available, thinkpad_acpi native " |
6278 | "available, thinkpad_acpi native " | 6254 | "brightness control enabled\n"); |
6279 | "brightness control enabled\n"); | ||
6280 | } | 6255 | } |
6281 | 6256 | ||
6282 | /* | 6257 | /* |
@@ -6310,6 +6285,7 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
6310 | return 1; | 6285 | return 1; |
6311 | 6286 | ||
6312 | memset(&props, 0, sizeof(struct backlight_properties)); | 6287 | memset(&props, 0, sizeof(struct backlight_properties)); |
6288 | props.type = BACKLIGHT_PLATFORM; | ||
6313 | props.max_brightness = bright_maxlvl; | 6289 | props.max_brightness = bright_maxlvl; |
6314 | props.brightness = b & TP_EC_BACKLIGHT_LVLMSK; | 6290 | props.brightness = b & TP_EC_BACKLIGHT_LVLMSK; |
6315 | ibm_backlight_device = backlight_device_register(TPACPI_BACKLIGHT_DEV_NAME, | 6291 | ibm_backlight_device = backlight_device_register(TPACPI_BACKLIGHT_DEV_NAME, |
@@ -6319,19 +6295,17 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
6319 | if (IS_ERR(ibm_backlight_device)) { | 6295 | if (IS_ERR(ibm_backlight_device)) { |
6320 | int rc = PTR_ERR(ibm_backlight_device); | 6296 | int rc = PTR_ERR(ibm_backlight_device); |
6321 | ibm_backlight_device = NULL; | 6297 | ibm_backlight_device = NULL; |
6322 | printk(TPACPI_ERR "Could not register backlight device\n"); | 6298 | pr_err("Could not register backlight device\n"); |
6323 | return rc; | 6299 | return rc; |
6324 | } | 6300 | } |
6325 | vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_BRGHT, | 6301 | vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_BRGHT, |
6326 | "brightness is supported\n"); | 6302 | "brightness is supported\n"); |
6327 | 6303 | ||
6328 | if (quirks & TPACPI_BRGHT_Q_ASK) { | 6304 | if (quirks & TPACPI_BRGHT_Q_ASK) { |
6329 | printk(TPACPI_NOTICE | 6305 | pr_notice("brightness: will use unverified default: " |
6330 | "brightness: will use unverified default: " | 6306 | "brightness_mode=%d\n", brightness_mode); |
6331 | "brightness_mode=%d\n", brightness_mode); | 6307 | pr_notice("brightness: please report to %s whether it works well " |
6332 | printk(TPACPI_NOTICE | 6308 | "or not on your ThinkPad\n", TPACPI_MAIL); |
6333 | "brightness: please report to %s whether it works well " | ||
6334 | "or not on your ThinkPad\n", TPACPI_MAIL); | ||
6335 | } | 6309 | } |
6336 | 6310 | ||
6337 | /* Added by mistake in early 2007. Probably useless, but it could | 6311 | /* Added by mistake in early 2007. Probably useless, but it could |
@@ -6345,7 +6319,7 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
6345 | "as change notification\n"); | 6319 | "as change notification\n"); |
6346 | tpacpi_hotkey_driver_mask_set(hotkey_driver_mask | 6320 | tpacpi_hotkey_driver_mask_set(hotkey_driver_mask |
6347 | | TP_ACPI_HKEY_BRGHTUP_MASK | 6321 | | TP_ACPI_HKEY_BRGHTUP_MASK |
6348 | | TP_ACPI_HKEY_BRGHTDWN_MASK);; | 6322 | | TP_ACPI_HKEY_BRGHTDWN_MASK); |
6349 | return 0; | 6323 | return 0; |
6350 | } | 6324 | } |
6351 | 6325 | ||
@@ -6804,8 +6778,7 @@ static int __init volume_create_alsa_mixer(void) | |||
6804 | rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE, | 6778 | rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE, |
6805 | sizeof(struct tpacpi_alsa_data), &card); | 6779 | sizeof(struct tpacpi_alsa_data), &card); |
6806 | if (rc < 0 || !card) { | 6780 | if (rc < 0 || !card) { |
6807 | printk(TPACPI_ERR | 6781 | pr_err("Failed to create ALSA card structures: %d\n", rc); |
6808 | "Failed to create ALSA card structures: %d\n", rc); | ||
6809 | return 1; | 6782 | return 1; |
6810 | } | 6783 | } |
6811 | 6784 | ||
@@ -6839,9 +6812,8 @@ static int __init volume_create_alsa_mixer(void) | |||
6839 | ctl_vol = snd_ctl_new1(&volume_alsa_control_vol, NULL); | 6812 | ctl_vol = snd_ctl_new1(&volume_alsa_control_vol, NULL); |
6840 | rc = snd_ctl_add(card, ctl_vol); | 6813 | rc = snd_ctl_add(card, ctl_vol); |
6841 | if (rc < 0) { | 6814 | if (rc < 0) { |
6842 | printk(TPACPI_ERR | 6815 | pr_err("Failed to create ALSA volume control: %d\n", |
6843 | "Failed to create ALSA volume control: %d\n", | 6816 | rc); |
6844 | rc); | ||
6845 | goto err_exit; | 6817 | goto err_exit; |
6846 | } | 6818 | } |
6847 | data->ctl_vol_id = &ctl_vol->id; | 6819 | data->ctl_vol_id = &ctl_vol->id; |
@@ -6850,8 +6822,7 @@ static int __init volume_create_alsa_mixer(void) | |||
6850 | ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL); | 6822 | ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL); |
6851 | rc = snd_ctl_add(card, ctl_mute); | 6823 | rc = snd_ctl_add(card, ctl_mute); |
6852 | if (rc < 0) { | 6824 | if (rc < 0) { |
6853 | printk(TPACPI_ERR "Failed to create ALSA mute control: %d\n", | 6825 | pr_err("Failed to create ALSA mute control: %d\n", rc); |
6854 | rc); | ||
6855 | goto err_exit; | 6826 | goto err_exit; |
6856 | } | 6827 | } |
6857 | data->ctl_mute_id = &ctl_mute->id; | 6828 | data->ctl_mute_id = &ctl_mute->id; |
@@ -6859,7 +6830,7 @@ static int __init volume_create_alsa_mixer(void) | |||
6859 | snd_card_set_dev(card, &tpacpi_pdev->dev); | 6830 | snd_card_set_dev(card, &tpacpi_pdev->dev); |
6860 | rc = snd_card_register(card); | 6831 | rc = snd_card_register(card); |
6861 | if (rc < 0) { | 6832 | if (rc < 0) { |
6862 | printk(TPACPI_ERR "Failed to register ALSA card: %d\n", rc); | 6833 | pr_err("Failed to register ALSA card: %d\n", rc); |
6863 | goto err_exit; | 6834 | goto err_exit; |
6864 | } | 6835 | } |
6865 | 6836 | ||
@@ -6915,9 +6886,8 @@ static int __init volume_init(struct ibm_init_struct *iibm) | |||
6915 | return -EINVAL; | 6886 | return -EINVAL; |
6916 | 6887 | ||
6917 | if (volume_mode == TPACPI_VOL_MODE_UCMS_STEP) { | 6888 | if (volume_mode == TPACPI_VOL_MODE_UCMS_STEP) { |
6918 | printk(TPACPI_ERR | 6889 | pr_err("UCMS step volume mode not implemented, " |
6919 | "UCMS step volume mode not implemented, " | 6890 | "please contact %s\n", TPACPI_MAIL); |
6920 | "please contact %s\n", TPACPI_MAIL); | ||
6921 | return 1; | 6891 | return 1; |
6922 | } | 6892 | } |
6923 | 6893 | ||
@@ -6981,13 +6951,11 @@ static int __init volume_init(struct ibm_init_struct *iibm) | |||
6981 | 6951 | ||
6982 | rc = volume_create_alsa_mixer(); | 6952 | rc = volume_create_alsa_mixer(); |
6983 | if (rc) { | 6953 | if (rc) { |
6984 | printk(TPACPI_ERR | 6954 | pr_err("Could not create the ALSA mixer interface\n"); |
6985 | "Could not create the ALSA mixer interface\n"); | ||
6986 | return rc; | 6955 | return rc; |
6987 | } | 6956 | } |
6988 | 6957 | ||
6989 | printk(TPACPI_INFO | 6958 | pr_info("Console audio control enabled, mode: %s\n", |
6990 | "Console audio control enabled, mode: %s\n", | ||
6991 | (volume_control_allowed) ? | 6959 | (volume_control_allowed) ? |
6992 | "override (read/write)" : | 6960 | "override (read/write)" : |
6993 | "monitor (read only)"); | 6961 | "monitor (read only)"); |
@@ -7049,12 +7017,10 @@ static int volume_write(char *buf) | |||
7049 | if (!volume_control_allowed && tpacpi_lifecycle != TPACPI_LIFE_INIT) { | 7017 | if (!volume_control_allowed && tpacpi_lifecycle != TPACPI_LIFE_INIT) { |
7050 | if (unlikely(!tp_warned.volume_ctrl_forbidden)) { | 7018 | if (unlikely(!tp_warned.volume_ctrl_forbidden)) { |
7051 | tp_warned.volume_ctrl_forbidden = 1; | 7019 | tp_warned.volume_ctrl_forbidden = 1; |
7052 | printk(TPACPI_NOTICE | 7020 | pr_notice("Console audio control in monitor mode, " |
7053 | "Console audio control in monitor mode, " | 7021 | "changes are not allowed\n"); |
7054 | "changes are not allowed.\n"); | 7022 | pr_notice("Use the volume_control=1 module parameter " |
7055 | printk(TPACPI_NOTICE | 7023 | "to enable volume control\n"); |
7056 | "Use the volume_control=1 module parameter " | ||
7057 | "to enable volume control\n"); | ||
7058 | } | 7024 | } |
7059 | return -EPERM; | 7025 | return -EPERM; |
7060 | } | 7026 | } |
@@ -7129,8 +7095,7 @@ static void inline volume_alsa_notify_change(void) | |||
7129 | 7095 | ||
7130 | static int __init volume_init(struct ibm_init_struct *iibm) | 7096 | static int __init volume_init(struct ibm_init_struct *iibm) |
7131 | { | 7097 | { |
7132 | printk(TPACPI_INFO | 7098 | pr_info("volume: disabled as there is no ALSA support in this kernel\n"); |
7133 | "volume: disabled as there is no ALSA support in this kernel\n"); | ||
7134 | 7099 | ||
7135 | return 1; | 7100 | return 1; |
7136 | } | 7101 | } |
@@ -7193,7 +7158,7 @@ static struct ibm_struct volume_driver_data = { | |||
7193 | * TPACPI_FAN_WR_ACPI_FANS (X31/X40/X41) | 7158 | * TPACPI_FAN_WR_ACPI_FANS (X31/X40/X41) |
7194 | * | 7159 | * |
7195 | * FIRMWARE BUG: on some models, EC 0x2f might not be initialized at | 7160 | * FIRMWARE BUG: on some models, EC 0x2f might not be initialized at |
7196 | * boot. Apparently the EC does not intialize it, so unless ACPI DSDT | 7161 | * boot. Apparently the EC does not initialize it, so unless ACPI DSDT |
7197 | * does so, its initial value is meaningless (0x07). | 7162 | * does so, its initial value is meaningless (0x07). |
7198 | * | 7163 | * |
7199 | * For firmware bugs, refer to: | 7164 | * For firmware bugs, refer to: |
@@ -7337,9 +7302,8 @@ TPACPI_HANDLE(sfan, ec, "SFAN", /* 570 */ | |||
7337 | static void fan_quirk1_setup(void) | 7302 | static void fan_quirk1_setup(void) |
7338 | { | 7303 | { |
7339 | if (fan_control_initial_status == 0x07) { | 7304 | if (fan_control_initial_status == 0x07) { |
7340 | printk(TPACPI_NOTICE | 7305 | pr_notice("fan_init: initial fan status is unknown, " |
7341 | "fan_init: initial fan status is unknown, " | 7306 | "assuming it is in auto mode\n"); |
7342 | "assuming it is in auto mode\n"); | ||
7343 | tp_features.fan_ctrl_status_undef = 1; | 7307 | tp_features.fan_ctrl_status_undef = 1; |
7344 | } | 7308 | } |
7345 | } | 7309 | } |
@@ -7726,8 +7690,7 @@ static void fan_watchdog_reset(void) | |||
7726 | if (!queue_delayed_work(tpacpi_wq, &fan_watchdog_task, | 7690 | if (!queue_delayed_work(tpacpi_wq, &fan_watchdog_task, |
7727 | msecs_to_jiffies(fan_watchdog_maxinterval | 7691 | msecs_to_jiffies(fan_watchdog_maxinterval |
7728 | * 1000))) { | 7692 | * 1000))) { |
7729 | printk(TPACPI_ERR | 7693 | pr_err("failed to queue the fan watchdog, " |
7730 | "failed to queue the fan watchdog, " | ||
7731 | "watchdog will not trigger\n"); | 7694 | "watchdog will not trigger\n"); |
7732 | } | 7695 | } |
7733 | } else | 7696 | } else |
@@ -7741,11 +7704,11 @@ static void fan_watchdog_fire(struct work_struct *ignored) | |||
7741 | if (tpacpi_lifecycle != TPACPI_LIFE_RUNNING) | 7704 | if (tpacpi_lifecycle != TPACPI_LIFE_RUNNING) |
7742 | return; | 7705 | return; |
7743 | 7706 | ||
7744 | printk(TPACPI_NOTICE "fan watchdog: enabling fan\n"); | 7707 | pr_notice("fan watchdog: enabling fan\n"); |
7745 | rc = fan_set_enable(); | 7708 | rc = fan_set_enable(); |
7746 | if (rc < 0) { | 7709 | if (rc < 0) { |
7747 | printk(TPACPI_ERR "fan watchdog: error %d while enabling fan, " | 7710 | pr_err("fan watchdog: error %d while enabling fan, " |
7748 | "will try again later...\n", -rc); | 7711 | "will try again later...\n", -rc); |
7749 | /* reschedule for later */ | 7712 | /* reschedule for later */ |
7750 | fan_watchdog_reset(); | 7713 | fan_watchdog_reset(); |
7751 | } | 7714 | } |
@@ -8049,8 +8012,7 @@ static int __init fan_init(struct ibm_init_struct *iibm) | |||
8049 | "secondary fan support enabled\n"); | 8012 | "secondary fan support enabled\n"); |
8050 | } | 8013 | } |
8051 | } else { | 8014 | } else { |
8052 | printk(TPACPI_ERR | 8015 | pr_err("ThinkPad ACPI EC access misbehaving, " |
8053 | "ThinkPad ACPI EC access misbehaving, " | ||
8054 | "fan status and control unavailable\n"); | 8016 | "fan status and control unavailable\n"); |
8055 | return 1; | 8017 | return 1; |
8056 | } | 8018 | } |
@@ -8150,9 +8112,8 @@ static void fan_suspend(pm_message_t state) | |||
8150 | fan_control_resume_level = 0; | 8112 | fan_control_resume_level = 0; |
8151 | rc = fan_get_status_safe(&fan_control_resume_level); | 8113 | rc = fan_get_status_safe(&fan_control_resume_level); |
8152 | if (rc < 0) | 8114 | if (rc < 0) |
8153 | printk(TPACPI_NOTICE | 8115 | pr_notice("failed to read fan level for later " |
8154 | "failed to read fan level for later " | 8116 | "restore during resume: %d\n", rc); |
8155 | "restore during resume: %d\n", rc); | ||
8156 | 8117 | ||
8157 | /* if it is undefined, don't attempt to restore it. | 8118 | /* if it is undefined, don't attempt to restore it. |
8158 | * KEEP THIS LAST */ | 8119 | * KEEP THIS LAST */ |
@@ -8207,13 +8168,11 @@ static void fan_resume(void) | |||
8207 | return; | 8168 | return; |
8208 | } | 8169 | } |
8209 | if (do_set) { | 8170 | if (do_set) { |
8210 | printk(TPACPI_NOTICE | 8171 | pr_notice("restoring fan level to 0x%02x\n", |
8211 | "restoring fan level to 0x%02x\n", | 8172 | fan_control_resume_level); |
8212 | fan_control_resume_level); | ||
8213 | rc = fan_set_level_safe(fan_control_resume_level); | 8173 | rc = fan_set_level_safe(fan_control_resume_level); |
8214 | if (rc < 0) | 8174 | if (rc < 0) |
8215 | printk(TPACPI_NOTICE | 8175 | pr_notice("failed to restore fan level: %d\n", rc); |
8216 | "failed to restore fan level: %d\n", rc); | ||
8217 | } | 8176 | } |
8218 | } | 8177 | } |
8219 | 8178 | ||
@@ -8305,8 +8264,8 @@ static int fan_write_cmd_level(const char *cmd, int *rc) | |||
8305 | 8264 | ||
8306 | *rc = fan_set_level_safe(level); | 8265 | *rc = fan_set_level_safe(level); |
8307 | if (*rc == -ENXIO) | 8266 | if (*rc == -ENXIO) |
8308 | printk(TPACPI_ERR "level command accepted for unsupported " | 8267 | pr_err("level command accepted for unsupported access mode %d\n", |
8309 | "access mode %d", fan_control_access_mode); | 8268 | fan_control_access_mode); |
8310 | else if (!*rc) | 8269 | else if (!*rc) |
8311 | tpacpi_disclose_usertask("procfs fan", | 8270 | tpacpi_disclose_usertask("procfs fan", |
8312 | "set level to %d\n", level); | 8271 | "set level to %d\n", level); |
@@ -8321,8 +8280,8 @@ static int fan_write_cmd_enable(const char *cmd, int *rc) | |||
8321 | 8280 | ||
8322 | *rc = fan_set_enable(); | 8281 | *rc = fan_set_enable(); |
8323 | if (*rc == -ENXIO) | 8282 | if (*rc == -ENXIO) |
8324 | printk(TPACPI_ERR "enable command accepted for unsupported " | 8283 | pr_err("enable command accepted for unsupported access mode %d\n", |
8325 | "access mode %d", fan_control_access_mode); | 8284 | fan_control_access_mode); |
8326 | else if (!*rc) | 8285 | else if (!*rc) |
8327 | tpacpi_disclose_usertask("procfs fan", "enable\n"); | 8286 | tpacpi_disclose_usertask("procfs fan", "enable\n"); |
8328 | 8287 | ||
@@ -8336,8 +8295,8 @@ static int fan_write_cmd_disable(const char *cmd, int *rc) | |||
8336 | 8295 | ||
8337 | *rc = fan_set_disable(); | 8296 | *rc = fan_set_disable(); |
8338 | if (*rc == -ENXIO) | 8297 | if (*rc == -ENXIO) |
8339 | printk(TPACPI_ERR "disable command accepted for unsupported " | 8298 | pr_err("disable command accepted for unsupported access mode %d\n", |
8340 | "access mode %d", fan_control_access_mode); | 8299 | fan_control_access_mode); |
8341 | else if (!*rc) | 8300 | else if (!*rc) |
8342 | tpacpi_disclose_usertask("procfs fan", "disable\n"); | 8301 | tpacpi_disclose_usertask("procfs fan", "disable\n"); |
8343 | 8302 | ||
@@ -8356,8 +8315,8 @@ static int fan_write_cmd_speed(const char *cmd, int *rc) | |||
8356 | 8315 | ||
8357 | *rc = fan_set_speed(speed); | 8316 | *rc = fan_set_speed(speed); |
8358 | if (*rc == -ENXIO) | 8317 | if (*rc == -ENXIO) |
8359 | printk(TPACPI_ERR "speed command accepted for unsupported " | 8318 | pr_err("speed command accepted for unsupported access mode %d\n", |
8360 | "access mode %d", fan_control_access_mode); | 8319 | fan_control_access_mode); |
8361 | else if (!*rc) | 8320 | else if (!*rc) |
8362 | tpacpi_disclose_usertask("procfs fan", | 8321 | tpacpi_disclose_usertask("procfs fan", |
8363 | "set speed to %d\n", speed); | 8322 | "set speed to %d\n", speed); |
@@ -8497,7 +8456,6 @@ static void ibm_exit(struct ibm_struct *ibm) | |||
8497 | ibm->acpi->type, | 8456 | ibm->acpi->type, |
8498 | dispatch_acpi_notify); | 8457 | dispatch_acpi_notify); |
8499 | ibm->flags.acpi_notify_installed = 0; | 8458 | ibm->flags.acpi_notify_installed = 0; |
8500 | ibm->flags.acpi_notify_installed = 0; | ||
8501 | } | 8459 | } |
8502 | 8460 | ||
8503 | if (ibm->flags.proc_created) { | 8461 | if (ibm->flags.proc_created) { |
@@ -8561,8 +8519,8 @@ static int __init ibm_init(struct ibm_init_struct *iibm) | |||
8561 | if (ibm->acpi->notify) { | 8519 | if (ibm->acpi->notify) { |
8562 | ret = setup_acpi_notify(ibm); | 8520 | ret = setup_acpi_notify(ibm); |
8563 | if (ret == -ENODEV) { | 8521 | if (ret == -ENODEV) { |
8564 | printk(TPACPI_NOTICE "disabling subdriver %s\n", | 8522 | pr_notice("disabling subdriver %s\n", |
8565 | ibm->name); | 8523 | ibm->name); |
8566 | ret = 0; | 8524 | ret = 0; |
8567 | goto err_out; | 8525 | goto err_out; |
8568 | } | 8526 | } |
@@ -8584,8 +8542,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm) | |||
8584 | entry = proc_create_data(ibm->name, mode, proc_dir, | 8542 | entry = proc_create_data(ibm->name, mode, proc_dir, |
8585 | &dispatch_proc_fops, ibm); | 8543 | &dispatch_proc_fops, ibm); |
8586 | if (!entry) { | 8544 | if (!entry) { |
8587 | printk(TPACPI_ERR "unable to create proc entry %s\n", | 8545 | pr_err("unable to create proc entry %s\n", ibm->name); |
8588 | ibm->name); | ||
8589 | ret = -ENODEV; | 8546 | ret = -ENODEV; |
8590 | goto err_out; | 8547 | goto err_out; |
8591 | } | 8548 | } |
@@ -8621,8 +8578,7 @@ static bool __pure __init tpacpi_is_valid_fw_id(const char* const s, | |||
8621 | tpacpi_is_fw_digit(s[1]) && | 8578 | tpacpi_is_fw_digit(s[1]) && |
8622 | s[2] == t && s[3] == 'T' && | 8579 | s[2] == t && s[3] == 'T' && |
8623 | tpacpi_is_fw_digit(s[4]) && | 8580 | tpacpi_is_fw_digit(s[4]) && |
8624 | tpacpi_is_fw_digit(s[5]) && | 8581 | tpacpi_is_fw_digit(s[5]); |
8625 | s[6] == 'W' && s[7] == 'W'; | ||
8626 | } | 8582 | } |
8627 | 8583 | ||
8628 | /* returns 0 - probe ok, or < 0 - probe error. | 8584 | /* returns 0 - probe ok, or < 0 - probe error. |
@@ -8685,13 +8641,11 @@ static int __must_check __init get_thinkpad_model_data( | |||
8685 | tp->ec_release = (ec_fw_string[4] << 8) | 8641 | tp->ec_release = (ec_fw_string[4] << 8) |
8686 | | ec_fw_string[5]; | 8642 | | ec_fw_string[5]; |
8687 | } else { | 8643 | } else { |
8688 | printk(TPACPI_NOTICE | 8644 | pr_notice("ThinkPad firmware release %s " |
8689 | "ThinkPad firmware release %s " | 8645 | "doesn't match the known patterns\n", |
8690 | "doesn't match the known patterns\n", | 8646 | ec_fw_string); |
8691 | ec_fw_string); | 8647 | pr_notice("please report this to %s\n", |
8692 | printk(TPACPI_NOTICE | 8648 | TPACPI_MAIL); |
8693 | "please report this to %s\n", | ||
8694 | TPACPI_MAIL); | ||
8695 | } | 8649 | } |
8696 | break; | 8650 | break; |
8697 | } | 8651 | } |
@@ -8735,8 +8689,7 @@ static int __init probe_for_thinkpad(void) | |||
8735 | tpacpi_acpi_handle_locate("ec", TPACPI_ACPI_EC_HID, &ec_handle); | 8689 | tpacpi_acpi_handle_locate("ec", TPACPI_ACPI_EC_HID, &ec_handle); |
8736 | if (!ec_handle) { | 8690 | if (!ec_handle) { |
8737 | if (is_thinkpad) | 8691 | if (is_thinkpad) |
8738 | printk(TPACPI_ERR | 8692 | pr_err("Not yet supported ThinkPad detected!\n"); |
8739 | "Not yet supported ThinkPad detected!\n"); | ||
8740 | return -ENODEV; | 8693 | return -ENODEV; |
8741 | } | 8694 | } |
8742 | 8695 | ||
@@ -8748,10 +8701,10 @@ static int __init probe_for_thinkpad(void) | |||
8748 | 8701 | ||
8749 | static void __init thinkpad_acpi_init_banner(void) | 8702 | static void __init thinkpad_acpi_init_banner(void) |
8750 | { | 8703 | { |
8751 | printk(TPACPI_INFO "%s v%s\n", TPACPI_DESC, TPACPI_VERSION); | 8704 | pr_info("%s v%s\n", TPACPI_DESC, TPACPI_VERSION); |
8752 | printk(TPACPI_INFO "%s\n", TPACPI_URL); | 8705 | pr_info("%s\n", TPACPI_URL); |
8753 | 8706 | ||
8754 | printk(TPACPI_INFO "ThinkPad BIOS %s, EC %s\n", | 8707 | pr_info("ThinkPad BIOS %s, EC %s\n", |
8755 | (thinkpad_id.bios_version_str) ? | 8708 | (thinkpad_id.bios_version_str) ? |
8756 | thinkpad_id.bios_version_str : "unknown", | 8709 | thinkpad_id.bios_version_str : "unknown", |
8757 | (thinkpad_id.ec_version_str) ? | 8710 | (thinkpad_id.ec_version_str) ? |
@@ -8760,7 +8713,7 @@ static void __init thinkpad_acpi_init_banner(void) | |||
8760 | BUG_ON(!thinkpad_id.vendor); | 8713 | BUG_ON(!thinkpad_id.vendor); |
8761 | 8714 | ||
8762 | if (thinkpad_id.model_str) | 8715 | if (thinkpad_id.model_str) |
8763 | printk(TPACPI_INFO "%s %s, model %s\n", | 8716 | pr_info("%s %s, model %s\n", |
8764 | (thinkpad_id.vendor == PCI_VENDOR_ID_IBM) ? | 8717 | (thinkpad_id.vendor == PCI_VENDOR_ID_IBM) ? |
8765 | "IBM" : ((thinkpad_id.vendor == | 8718 | "IBM" : ((thinkpad_id.vendor == |
8766 | PCI_VENDOR_ID_LENOVO) ? | 8719 | PCI_VENDOR_ID_LENOVO) ? |
@@ -9026,8 +8979,7 @@ static int __init thinkpad_acpi_module_init(void) | |||
9026 | 8979 | ||
9027 | ret = get_thinkpad_model_data(&thinkpad_id); | 8980 | ret = get_thinkpad_model_data(&thinkpad_id); |
9028 | if (ret) { | 8981 | if (ret) { |
9029 | printk(TPACPI_ERR | 8982 | pr_err("unable to get DMI data: %d\n", ret); |
9030 | "unable to get DMI data: %d\n", ret); | ||
9031 | thinkpad_acpi_module_exit(); | 8983 | thinkpad_acpi_module_exit(); |
9032 | return ret; | 8984 | return ret; |
9033 | } | 8985 | } |
@@ -9053,16 +9005,14 @@ static int __init thinkpad_acpi_module_init(void) | |||
9053 | 9005 | ||
9054 | proc_dir = proc_mkdir(TPACPI_PROC_DIR, acpi_root_dir); | 9006 | proc_dir = proc_mkdir(TPACPI_PROC_DIR, acpi_root_dir); |
9055 | if (!proc_dir) { | 9007 | if (!proc_dir) { |
9056 | printk(TPACPI_ERR | 9008 | pr_err("unable to create proc dir " TPACPI_PROC_DIR "\n"); |
9057 | "unable to create proc dir " TPACPI_PROC_DIR); | ||
9058 | thinkpad_acpi_module_exit(); | 9009 | thinkpad_acpi_module_exit(); |
9059 | return -ENODEV; | 9010 | return -ENODEV; |
9060 | } | 9011 | } |
9061 | 9012 | ||
9062 | ret = platform_driver_register(&tpacpi_pdriver); | 9013 | ret = platform_driver_register(&tpacpi_pdriver); |
9063 | if (ret) { | 9014 | if (ret) { |
9064 | printk(TPACPI_ERR | 9015 | pr_err("unable to register main platform driver\n"); |
9065 | "unable to register main platform driver\n"); | ||
9066 | thinkpad_acpi_module_exit(); | 9016 | thinkpad_acpi_module_exit(); |
9067 | return ret; | 9017 | return ret; |
9068 | } | 9018 | } |
@@ -9070,8 +9020,7 @@ static int __init thinkpad_acpi_module_init(void) | |||
9070 | 9020 | ||
9071 | ret = platform_driver_register(&tpacpi_hwmon_pdriver); | 9021 | ret = platform_driver_register(&tpacpi_hwmon_pdriver); |
9072 | if (ret) { | 9022 | if (ret) { |
9073 | printk(TPACPI_ERR | 9023 | pr_err("unable to register hwmon platform driver\n"); |
9074 | "unable to register hwmon platform driver\n"); | ||
9075 | thinkpad_acpi_module_exit(); | 9024 | thinkpad_acpi_module_exit(); |
9076 | return ret; | 9025 | return ret; |
9077 | } | 9026 | } |
@@ -9084,8 +9033,7 @@ static int __init thinkpad_acpi_module_init(void) | |||
9084 | &tpacpi_hwmon_pdriver.driver); | 9033 | &tpacpi_hwmon_pdriver.driver); |
9085 | } | 9034 | } |
9086 | if (ret) { | 9035 | if (ret) { |
9087 | printk(TPACPI_ERR | 9036 | pr_err("unable to create sysfs driver attributes\n"); |
9088 | "unable to create sysfs driver attributes\n"); | ||
9089 | thinkpad_acpi_module_exit(); | 9037 | thinkpad_acpi_module_exit(); |
9090 | return ret; | 9038 | return ret; |
9091 | } | 9039 | } |
@@ -9098,7 +9046,7 @@ static int __init thinkpad_acpi_module_init(void) | |||
9098 | if (IS_ERR(tpacpi_pdev)) { | 9046 | if (IS_ERR(tpacpi_pdev)) { |
9099 | ret = PTR_ERR(tpacpi_pdev); | 9047 | ret = PTR_ERR(tpacpi_pdev); |
9100 | tpacpi_pdev = NULL; | 9048 | tpacpi_pdev = NULL; |
9101 | printk(TPACPI_ERR "unable to register platform device\n"); | 9049 | pr_err("unable to register platform device\n"); |
9102 | thinkpad_acpi_module_exit(); | 9050 | thinkpad_acpi_module_exit(); |
9103 | return ret; | 9051 | return ret; |
9104 | } | 9052 | } |
@@ -9108,16 +9056,14 @@ static int __init thinkpad_acpi_module_init(void) | |||
9108 | if (IS_ERR(tpacpi_sensors_pdev)) { | 9056 | if (IS_ERR(tpacpi_sensors_pdev)) { |
9109 | ret = PTR_ERR(tpacpi_sensors_pdev); | 9057 | ret = PTR_ERR(tpacpi_sensors_pdev); |
9110 | tpacpi_sensors_pdev = NULL; | 9058 | tpacpi_sensors_pdev = NULL; |
9111 | printk(TPACPI_ERR | 9059 | pr_err("unable to register hwmon platform device\n"); |
9112 | "unable to register hwmon platform device\n"); | ||
9113 | thinkpad_acpi_module_exit(); | 9060 | thinkpad_acpi_module_exit(); |
9114 | return ret; | 9061 | return ret; |
9115 | } | 9062 | } |
9116 | ret = device_create_file(&tpacpi_sensors_pdev->dev, | 9063 | ret = device_create_file(&tpacpi_sensors_pdev->dev, |
9117 | &dev_attr_thinkpad_acpi_pdev_name); | 9064 | &dev_attr_thinkpad_acpi_pdev_name); |
9118 | if (ret) { | 9065 | if (ret) { |
9119 | printk(TPACPI_ERR | 9066 | pr_err("unable to create sysfs hwmon device attributes\n"); |
9120 | "unable to create sysfs hwmon device attributes\n"); | ||
9121 | thinkpad_acpi_module_exit(); | 9067 | thinkpad_acpi_module_exit(); |
9122 | return ret; | 9068 | return ret; |
9123 | } | 9069 | } |
@@ -9126,14 +9072,14 @@ static int __init thinkpad_acpi_module_init(void) | |||
9126 | if (IS_ERR(tpacpi_hwmon)) { | 9072 | if (IS_ERR(tpacpi_hwmon)) { |
9127 | ret = PTR_ERR(tpacpi_hwmon); | 9073 | ret = PTR_ERR(tpacpi_hwmon); |
9128 | tpacpi_hwmon = NULL; | 9074 | tpacpi_hwmon = NULL; |
9129 | printk(TPACPI_ERR "unable to register hwmon device\n"); | 9075 | pr_err("unable to register hwmon device\n"); |
9130 | thinkpad_acpi_module_exit(); | 9076 | thinkpad_acpi_module_exit(); |
9131 | return ret; | 9077 | return ret; |
9132 | } | 9078 | } |
9133 | mutex_init(&tpacpi_inputdev_send_mutex); | 9079 | mutex_init(&tpacpi_inputdev_send_mutex); |
9134 | tpacpi_inputdev = input_allocate_device(); | 9080 | tpacpi_inputdev = input_allocate_device(); |
9135 | if (!tpacpi_inputdev) { | 9081 | if (!tpacpi_inputdev) { |
9136 | printk(TPACPI_ERR "unable to allocate input device\n"); | 9082 | pr_err("unable to allocate input device\n"); |
9137 | thinkpad_acpi_module_exit(); | 9083 | thinkpad_acpi_module_exit(); |
9138 | return -ENOMEM; | 9084 | return -ENOMEM; |
9139 | } else { | 9085 | } else { |
@@ -9165,7 +9111,7 @@ static int __init thinkpad_acpi_module_init(void) | |||
9165 | 9111 | ||
9166 | ret = input_register_device(tpacpi_inputdev); | 9112 | ret = input_register_device(tpacpi_inputdev); |
9167 | if (ret < 0) { | 9113 | if (ret < 0) { |
9168 | printk(TPACPI_ERR "unable to register input device\n"); | 9114 | pr_err("unable to register input device\n"); |
9169 | thinkpad_acpi_module_exit(); | 9115 | thinkpad_acpi_module_exit(); |
9170 | return ret; | 9116 | return ret; |
9171 | } else { | 9117 | } else { |