aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/thinkpad_acpi.c
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2007-04-21 10:08:32 -0400
committerLen Brown <len.brown@intel.com>2007-04-21 23:30:33 -0400
commitfe08bc4b4fd1371fad111675a564e4d2ebbf39ea (patch)
treeab2a116569ab856f1a1041925170c6b9011c981a /drivers/misc/thinkpad_acpi.c
parent5fba344cfdbaa79e6320da26c3db34dfb219a845 (diff)
ACPI: thinkpad-acpi: add subdriver debug statements
Add debug messages to the subdriver initialization and exit code. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc/thinkpad_acpi.c')
-rw-r--r--drivers/misc/thinkpad_acpi.c111
1 files changed, 111 insertions, 0 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index eeab39418c71..e8fc8da35669 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -313,6 +313,9 @@ static int __init setup_notify(struct ibm_struct *ibm)
313 if (!*ibm->handle) 313 if (!*ibm->handle)
314 return 0; 314 return 0;
315 315
316 dbg_printk(TPACPI_DBG_INIT,
317 "setting up ACPI notify for %s\n", ibm->name);
318
316 ret = acpi_bus_get_device(*ibm->handle, &ibm->device); 319 ret = acpi_bus_get_device(*ibm->handle, &ibm->device);
317 if (ret < 0) { 320 if (ret < 0) {
318 printk(IBM_ERR "%s device not present\n", ibm->name); 321 printk(IBM_ERR "%s device not present\n", ibm->name);
@@ -349,6 +352,9 @@ static int __init register_tpacpi_subdriver(struct ibm_struct *ibm)
349{ 352{
350 int ret; 353 int ret;
351 354
355 dbg_printk(TPACPI_DBG_INIT,
356 "registering %s as an ACPI driver\n", ibm->name);
357
352 ibm->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL); 358 ibm->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL);
353 if (!ibm->driver) { 359 if (!ibm->driver) {
354 printk(IBM_ERR "kzalloc(ibm->driver) failed\n"); 360 printk(IBM_ERR "kzalloc(ibm->driver) failed\n");
@@ -497,17 +503,25 @@ static int hotkey_orig_mask;
497 503
498static int hotkey_init(void) 504static int hotkey_init(void)
499{ 505{
506 vdbg_printk(TPACPI_DBG_INIT, "initializing hotkey subdriver\n");
507
500 IBM_HANDLE_INIT(hkey); 508 IBM_HANDLE_INIT(hkey);
501 509
502 /* hotkey not supported on 570 */ 510 /* hotkey not supported on 570 */
503 hotkey_supported = hkey_handle != NULL; 511 hotkey_supported = hkey_handle != NULL;
504 512
513 vdbg_printk(TPACPI_DBG_INIT, "hotkeys are %s\n",
514 str_supported(hotkey_supported));
515
505 if (hotkey_supported) { 516 if (hotkey_supported) {
506 /* mask not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p, 517 /* mask not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,
507 A30, R30, R31, T20-22, X20-21, X22-24 */ 518 A30, R30, R31, T20-22, X20-21, X22-24 */
508 hotkey_mask_supported = 519 hotkey_mask_supported =
509 acpi_evalf(hkey_handle, NULL, "DHKN", "qv"); 520 acpi_evalf(hkey_handle, NULL, "DHKN", "qv");
510 521
522 vdbg_printk(TPACPI_DBG_INIT, "hotkey masks are %s\n",
523 str_supported(hotkey_mask_supported));
524
511 if (!hotkey_get(&hotkey_orig_status, &hotkey_orig_mask)) 525 if (!hotkey_get(&hotkey_orig_status, &hotkey_orig_mask))
512 return -ENODEV; 526 return -ENODEV;
513 } 527 }
@@ -518,6 +532,7 @@ static int hotkey_init(void)
518static void hotkey_exit(void) 532static void hotkey_exit(void)
519{ 533{
520 if (hotkey_supported) { 534 if (hotkey_supported) {
535 dbg_printk(TPACPI_DBG_EXIT, "restoring original hotkey mask\n");
521 hotkey_set(hotkey_orig_status, hotkey_orig_mask); 536 hotkey_set(hotkey_orig_status, hotkey_orig_mask);
522 } 537 }
523} 538}
@@ -633,6 +648,8 @@ static int bluetooth_supported;
633 648
634static int bluetooth_init(void) 649static int bluetooth_init(void)
635{ 650{
651 vdbg_printk(TPACPI_DBG_INIT, "initializing bluetooth subdriver\n");
652
636 IBM_HANDLE_INIT(hkey); 653 IBM_HANDLE_INIT(hkey);
637 654
638 /* bluetooth not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p, 655 /* bluetooth not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,
@@ -640,6 +657,9 @@ static int bluetooth_init(void)
640 bluetooth_supported = hkey_handle && 657 bluetooth_supported = hkey_handle &&
641 acpi_evalf(hkey_handle, NULL, "GBDC", "qv"); 658 acpi_evalf(hkey_handle, NULL, "GBDC", "qv");
642 659
660 vdbg_printk(TPACPI_DBG_INIT, "bluetooth is %s\n",
661 str_supported(bluetooth_supported));
662
643 return (bluetooth_supported)? 0 : 1; 663 return (bluetooth_supported)? 0 : 1;
644} 664}
645 665
@@ -704,11 +724,16 @@ static int wan_supported;
704 724
705static int wan_init(void) 725static int wan_init(void)
706{ 726{
727 vdbg_printk(TPACPI_DBG_INIT, "initializing wan subdriver\n");
728
707 IBM_HANDLE_INIT(hkey); 729 IBM_HANDLE_INIT(hkey);
708 730
709 wan_supported = hkey_handle && 731 wan_supported = hkey_handle &&
710 acpi_evalf(hkey_handle, NULL, "GWAN", "qv"); 732 acpi_evalf(hkey_handle, NULL, "GWAN", "qv");
711 733
734 vdbg_printk(TPACPI_DBG_INIT, "wan is %s\n",
735 str_supported(wan_supported));
736
712 return (wan_supported)? 0 : 1; 737 return (wan_supported)? 0 : 1;
713} 738}
714 739
@@ -784,6 +809,8 @@ static int video_init(void)
784{ 809{
785 int ivga; 810 int ivga;
786 811
812 vdbg_printk(TPACPI_DBG_INIT, "initializing video subdriver\n");
813
787 IBM_HANDLE_INIT(vid); 814 IBM_HANDLE_INIT(vid);
788 IBM_HANDLE_INIT(vid2); 815 IBM_HANDLE_INIT(vid2);
789 816
@@ -804,11 +831,16 @@ static int video_init(void)
804 /* all others */ 831 /* all others */
805 video_supported = TPACPI_VIDEO_NEW; 832 video_supported = TPACPI_VIDEO_NEW;
806 833
834 vdbg_printk(TPACPI_DBG_INIT, "video is %s, mode %d\n",
835 str_supported(video_supported != TPACPI_VIDEO_NONE),
836 video_supported);
837
807 return (video_supported != TPACPI_VIDEO_NONE)? 0 : 1; 838 return (video_supported != TPACPI_VIDEO_NONE)? 0 : 1;
808} 839}
809 840
810static void video_exit(void) 841static void video_exit(void)
811{ 842{
843 dbg_printk(TPACPI_DBG_EXIT, "restoring original video autoswitch mode\n");
812 acpi_evalf(vid_handle, NULL, "_DOS", "vd", video_orig_autosw); 844 acpi_evalf(vid_handle, NULL, "_DOS", "vd", video_orig_autosw);
813} 845}
814 846
@@ -991,6 +1023,8 @@ IBM_HANDLE(ledb, ec, "LEDB"); /* G4x */
991 1023
992static int light_init(void) 1024static int light_init(void)
993{ 1025{
1026 vdbg_printk(TPACPI_DBG_INIT, "initializing light subdriver\n");
1027
994 IBM_HANDLE_INIT(ledb); 1028 IBM_HANDLE_INIT(ledb);
995 IBM_HANDLE_INIT(lght); 1029 IBM_HANDLE_INIT(lght);
996 IBM_HANDLE_INIT(cmos); 1030 IBM_HANDLE_INIT(cmos);
@@ -1004,6 +1038,9 @@ static int light_init(void)
1004 light_status_supported = acpi_evalf(ec_handle, NULL, 1038 light_status_supported = acpi_evalf(ec_handle, NULL,
1005 "KBLT", "qv"); 1039 "KBLT", "qv");
1006 1040
1041 vdbg_printk(TPACPI_DBG_INIT, "light is %s\n",
1042 str_supported(light_supported));
1043
1007 return (light_supported)? 0 : 1; 1044 return (light_supported)? 0 : 1;
1008} 1045}
1009 1046
@@ -1075,9 +1112,14 @@ IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */
1075 1112
1076static int dock_init(void) 1113static int dock_init(void)
1077{ 1114{
1115 vdbg_printk(TPACPI_DBG_INIT, "initializing dock subdriver\n");
1116
1078 IBM_HANDLE_INIT(dock); 1117 IBM_HANDLE_INIT(dock);
1079 IBM_HANDLE_INIT(pci); 1118 IBM_HANDLE_INIT(pci);
1080 1119
1120 vdbg_printk(TPACPI_DBG_INIT, "dock is %s\n",
1121 str_supported(dock_handle != NULL));
1122
1081 return (dock_handle)? 0 : 1; 1123 return (dock_handle)? 0 : 1;
1082} 1124}
1083 1125
@@ -1171,6 +1213,8 @@ IBM_HANDLE(bay2_ej, bay2, "_EJ3", /* 600e/x, 770e, A3x */
1171 1213
1172static int bay_init(void) 1214static int bay_init(void)
1173{ 1215{
1216 vdbg_printk(TPACPI_DBG_INIT, "initializing bay subdriver\n");
1217
1174 IBM_HANDLE_INIT(bay); 1218 IBM_HANDLE_INIT(bay);
1175 if (bay_handle) 1219 if (bay_handle)
1176 IBM_HANDLE_INIT(bay_ej); 1220 IBM_HANDLE_INIT(bay_ej);
@@ -1188,6 +1232,13 @@ static int bay_init(void)
1188 bay_eject2_supported = bay2_handle && bay2_ej_handle && 1232 bay_eject2_supported = bay2_handle && bay2_ej_handle &&
1189 (strlencmp(bay2_ej_path, "_EJ0") == 0 || experimental); 1233 (strlencmp(bay2_ej_path, "_EJ0") == 0 || experimental);
1190 1234
1235 vdbg_printk(TPACPI_DBG_INIT,
1236 "bay 1: status %s, eject %s; bay 2: status %s, eject %s\n",
1237 str_supported(bay_status_supported),
1238 str_supported(bay_eject_supported),
1239 str_supported(bay_status2_supported),
1240 str_supported(bay_eject2_supported));
1241
1191 return (bay_status_supported || bay_eject_supported || 1242 return (bay_status_supported || bay_eject_supported ||
1192 bay_status2_supported || bay_eject2_supported)? 0 : 1; 1243 bay_status2_supported || bay_eject2_supported)? 0 : 1;
1193} 1244}
@@ -1255,8 +1306,13 @@ static int bay_write(char *buf)
1255 1306
1256static int cmos_init(void) 1307static int cmos_init(void)
1257{ 1308{
1309 vdbg_printk(TPACPI_DBG_INIT,
1310 "initializing cmos commands subdriver\n");
1311
1258 IBM_HANDLE_INIT(cmos); 1312 IBM_HANDLE_INIT(cmos);
1259 1313
1314 vdbg_printk(TPACPI_DBG_INIT, "cmos commands are %s\n",
1315 str_supported(cmos_handle != NULL));
1260 return (cmos_handle)? 0 : 1; 1316 return (cmos_handle)? 0 : 1;
1261} 1317}
1262 1318
@@ -1320,6 +1376,8 @@ IBM_HANDLE(led, ec, "SLED", /* 570 */
1320 1376
1321static int led_init(void) 1377static int led_init(void)
1322{ 1378{
1379 vdbg_printk(TPACPI_DBG_INIT, "initializing LED subdriver\n");
1380
1323 IBM_HANDLE_INIT(led); 1381 IBM_HANDLE_INIT(led);
1324 1382
1325 if (!led_handle) 1383 if (!led_handle)
@@ -1335,6 +1393,9 @@ static int led_init(void)
1335 /* all others */ 1393 /* all others */
1336 led_supported = TPACPI_LED_NEW; 1394 led_supported = TPACPI_LED_NEW;
1337 1395
1396 vdbg_printk(TPACPI_DBG_INIT, "LED commands are %s, mode %d\n",
1397 str_supported(led_supported), led_supported);
1398
1338 return (led_supported != TPACPI_LED_NONE)? 0 : 1; 1399 return (led_supported != TPACPI_LED_NONE)? 0 : 1;
1339} 1400}
1340 1401
@@ -1434,8 +1495,13 @@ IBM_HANDLE(beep, ec, "BEEP"); /* all except R30, R31 */
1434 1495
1435static int beep_init(void) 1496static int beep_init(void)
1436{ 1497{
1498 vdbg_printk(TPACPI_DBG_INIT, "initializing beep subdriver\n");
1499
1437 IBM_HANDLE_INIT(beep); 1500 IBM_HANDLE_INIT(beep);
1438 1501
1502 vdbg_printk(TPACPI_DBG_INIT, "beep is %s\n",
1503 str_supported(beep_handle != NULL));
1504
1439 return (beep_handle)? 0 : 1; 1505 return (beep_handle)? 0 : 1;
1440} 1506}
1441 1507
@@ -1486,6 +1552,8 @@ static int thermal_init(void)
1486 int i; 1552 int i;
1487 int acpi_tmp7; 1553 int acpi_tmp7;
1488 1554
1555 vdbg_printk(TPACPI_DBG_INIT, "initializing thermal subdriver\n");
1556
1489 acpi_tmp7 = acpi_evalf(ec_handle, NULL, "TMP7", "qv"); 1557 acpi_tmp7 = acpi_evalf(ec_handle, NULL, "TMP7", "qv");
1490 1558
1491 if (ibm_thinkpad_ec_found && experimental) { 1559 if (ibm_thinkpad_ec_found && experimental) {
@@ -1542,6 +1610,10 @@ static int thermal_init(void)
1542 thermal_read_mode = TPACPI_THERMAL_NONE; 1610 thermal_read_mode = TPACPI_THERMAL_NONE;
1543 } 1611 }
1544 1612
1613 vdbg_printk(TPACPI_DBG_INIT, "thermal is %s, mode %d\n",
1614 str_supported(thermal_read_mode != TPACPI_THERMAL_NONE),
1615 thermal_read_mode);
1616
1545 return (thermal_read_mode != TPACPI_THERMAL_NONE)? 0 : 1; 1617 return (thermal_read_mode != TPACPI_THERMAL_NONE)? 0 : 1;
1546} 1618}
1547 1619
@@ -1698,6 +1770,8 @@ static int brightness_init(void)
1698{ 1770{
1699 int b; 1771 int b;
1700 1772
1773 vdbg_printk(TPACPI_DBG_INIT, "initializing brightness subdriver\n");
1774
1701 b = brightness_get(NULL); 1775 b = brightness_get(NULL);
1702 if (b < 0) 1776 if (b < 0)
1703 return b; 1777 return b;
@@ -1708,6 +1782,7 @@ static int brightness_init(void)
1708 printk(IBM_ERR "Could not register backlight device\n"); 1782 printk(IBM_ERR "Could not register backlight device\n");
1709 return PTR_ERR(ibm_backlight_device); 1783 return PTR_ERR(ibm_backlight_device);
1710 } 1784 }
1785 vdbg_printk(TPACPI_DBG_INIT, "brightness is supported\n");
1711 1786
1712 ibm_backlight_device->props.max_brightness = 7; 1787 ibm_backlight_device->props.max_brightness = 7;
1713 ibm_backlight_device->props.brightness = b; 1788 ibm_backlight_device->props.brightness = b;
@@ -1719,6 +1794,8 @@ static int brightness_init(void)
1719static void brightness_exit(void) 1794static void brightness_exit(void)
1720{ 1795{
1721 if (ibm_backlight_device) { 1796 if (ibm_backlight_device) {
1797 vdbg_printk(TPACPI_DBG_EXIT,
1798 "calling backlight_device_unregister()\n");
1722 backlight_device_unregister(ibm_backlight_device); 1799 backlight_device_unregister(ibm_backlight_device);
1723 ibm_backlight_device = NULL; 1800 ibm_backlight_device = NULL;
1724 } 1801 }
@@ -2017,6 +2094,8 @@ IBM_HANDLE(sfan, ec, "SFAN", /* 570 */
2017 2094
2018static int fan_init(void) 2095static int fan_init(void)
2019{ 2096{
2097 vdbg_printk(TPACPI_DBG_INIT, "initializing fan subdriver\n");
2098
2020 fan_status_access_mode = TPACPI_FAN_NONE; 2099 fan_status_access_mode = TPACPI_FAN_NONE;
2021 fan_control_access_mode = TPACPI_FAN_WR_NONE; 2100 fan_control_access_mode = TPACPI_FAN_WR_NONE;
2022 fan_control_commands = 0; 2101 fan_control_commands = 0;
@@ -2095,6 +2174,11 @@ static int fan_init(void)
2095 } 2174 }
2096 } 2175 }
2097 2176
2177 vdbg_printk(TPACPI_DBG_INIT, "fan is %s, modes %d, %d\n",
2178 str_supported(fan_status_access_mode != TPACPI_FAN_NONE ||
2179 fan_control_access_mode != TPACPI_FAN_WR_NONE),
2180 fan_status_access_mode, fan_control_access_mode);
2181
2098 return (fan_status_access_mode != TPACPI_FAN_NONE || 2182 return (fan_status_access_mode != TPACPI_FAN_NONE ||
2099 fan_control_access_mode != TPACPI_FAN_WR_NONE)? 2183 fan_control_access_mode != TPACPI_FAN_WR_NONE)?
2100 0 : 1; 2184 0 : 1;
@@ -2138,6 +2222,7 @@ static int fan_get_status(u8 *status)
2138 2222
2139static void fan_exit(void) 2223static void fan_exit(void)
2140{ 2224{
2225 vdbg_printk(TPACPI_DBG_EXIT, "cancelling any pending watchdogs\n");
2141 cancel_delayed_work(&fan_watchdog_task); 2226 cancel_delayed_work(&fan_watchdog_task);
2142 flush_scheduled_work(); 2227 flush_scheduled_work();
2143} 2228}
@@ -2622,6 +2707,15 @@ static struct ibm_struct ibms[] = {
2622 * Module and infrastructure proble, init and exit handling 2707 * Module and infrastructure proble, init and exit handling
2623 */ 2708 */
2624 2709
2710#ifdef CONFIG_THINKPAD_ACPI_DEBUG
2711static const char * str_supported(int is_supported)
2712{
2713 static const char * const text_unsupported = "not supported";
2714
2715 return (is_supported)? text_unsupported + 4 : text_unsupported;
2716}
2717#endif /* CONFIG_THINKPAD_ACPI_DEBUG */
2718
2625static int __init ibm_init(struct ibm_struct *ibm) 2719static int __init ibm_init(struct ibm_struct *ibm)
2626{ 2720{
2627 int ret; 2721 int ret;
@@ -2630,6 +2724,9 @@ static int __init ibm_init(struct ibm_struct *ibm)
2630 if (ibm->experimental && !experimental) 2724 if (ibm->experimental && !experimental)
2631 return 0; 2725 return 0;
2632 2726
2727 dbg_printk(TPACPI_DBG_INIT,
2728 "probing for %s\n", ibm->name);
2729
2633 if (ibm->init) { 2730 if (ibm->init) {
2634 ret = ibm->init(); 2731 ret = ibm->init();
2635 if (ret > 0) 2732 if (ret > 0)
@@ -2657,6 +2754,9 @@ static int __init ibm_init(struct ibm_struct *ibm)
2657 goto err_out; 2754 goto err_out;
2658 } 2755 }
2659 2756
2757 dbg_printk(TPACPI_DBG_INIT,
2758 "%s installed\n", ibm->name);
2759
2660 if (ibm->read) { 2760 if (ibm->read) {
2661 entry = create_proc_entry(ibm->name, 2761 entry = create_proc_entry(ibm->name,
2662 S_IFREG | S_IRUGO | S_IWUSR, 2762 S_IFREG | S_IRUGO | S_IWUSR,
@@ -2678,24 +2778,35 @@ static int __init ibm_init(struct ibm_struct *ibm)
2678 return 0; 2778 return 0;
2679 2779
2680err_out: 2780err_out:
2781 dbg_printk(TPACPI_DBG_INIT,
2782 "%s: at error exit path with result %d\n",
2783 ibm->name, ret);
2784
2681 ibm_exit(ibm); 2785 ibm_exit(ibm);
2682 return (ret < 0)? ret : 0; 2786 return (ret < 0)? ret : 0;
2683} 2787}
2684 2788
2685static void ibm_exit(struct ibm_struct *ibm) 2789static void ibm_exit(struct ibm_struct *ibm)
2686{ 2790{
2791 dbg_printk(TPACPI_DBG_EXIT, "removing %s\n", ibm->name);
2687 if (ibm->notify_installed) { 2792 if (ibm->notify_installed) {
2793 dbg_printk(TPACPI_DBG_EXIT,
2794 "%s: acpi_remove_notify_handler\n", ibm->name);
2688 acpi_remove_notify_handler(*ibm->handle, ibm->type, 2795 acpi_remove_notify_handler(*ibm->handle, ibm->type,
2689 dispatch_notify); 2796 dispatch_notify);
2690 ibm->notify_installed = 0; 2797 ibm->notify_installed = 0;
2691 } 2798 }
2692 2799
2693 if (ibm->proc_created) { 2800 if (ibm->proc_created) {
2801 dbg_printk(TPACPI_DBG_EXIT,
2802 "%s: remove_proc_entry\n", ibm->name);
2694 remove_proc_entry(ibm->name, proc_dir); 2803 remove_proc_entry(ibm->name, proc_dir);
2695 ibm->proc_created = 0; 2804 ibm->proc_created = 0;
2696 } 2805 }
2697 2806
2698 if (ibm->driver_registered) { 2807 if (ibm->driver_registered) {
2808 dbg_printk(TPACPI_DBG_EXIT,
2809 "%s: acpi_bus_unregister_driver\n", ibm->name);
2699 acpi_bus_unregister_driver(ibm->driver); 2810 acpi_bus_unregister_driver(ibm->driver);
2700 kfree(ibm->driver); 2811 kfree(ibm->driver);
2701 ibm->driver = NULL; 2812 ibm->driver = NULL;