diff options
| author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2006-11-25 13:36:00 -0500 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2006-12-07 01:38:47 -0500 |
| commit | 9a8e1738c1136a857c1fd3ae0c5019f9767427ad (patch) | |
| tree | 16bb32ab7cb33bc3ae15216bca4f0f8b6fc612f9 /drivers/acpi | |
| parent | fb87a811a4c232e2af8d746dc75330cbe5b0780c (diff) | |
ACPI: ibm-acpi: style fixes and cruft removal
This patch just fixes style, move some #defines to enums, and removes some
old cruft.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Diffstat (limited to 'drivers/acpi')
| -rw-r--r-- | drivers/acpi/ibm_acpi.c | 100 |
1 files changed, 43 insertions, 57 deletions
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index 36e2667d8652..8bb41bd85cd3 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c | |||
| @@ -78,9 +78,11 @@ | |||
| 78 | #include <linux/init.h> | 78 | #include <linux/init.h> |
| 79 | #include <linux/types.h> | 79 | #include <linux/types.h> |
| 80 | #include <linux/string.h> | 80 | #include <linux/string.h> |
| 81 | |||
| 81 | #include <linux/proc_fs.h> | 82 | #include <linux/proc_fs.h> |
| 82 | #include <linux/backlight.h> | 83 | #include <linux/backlight.h> |
| 83 | #include <asm/uaccess.h> | 84 | #include <asm/uaccess.h> |
| 85 | |||
| 84 | #include <linux/dmi.h> | 86 | #include <linux/dmi.h> |
| 85 | #include <linux/jiffies.h> | 87 | #include <linux/jiffies.h> |
| 86 | #include <linux/workqueue.h> | 88 | #include <linux/workqueue.h> |
| @@ -121,28 +123,6 @@ static acpi_handle root_handle = NULL; | |||
| 121 | static char *object##_path; \ | 123 | static char *object##_path; \ |
| 122 | static char *object##_paths[] = { paths } | 124 | static char *object##_paths[] = { paths } |
| 123 | 125 | ||
| 124 | /* | ||
| 125 | * The following models are supported to various degrees: | ||
| 126 | * | ||
| 127 | * 570, 600e, 600x, 770e, 770x | ||
| 128 | * A20m, A21e, A21m, A21p, A22p, A30, A30p, A31, A31p | ||
| 129 | * G40, G41 | ||
| 130 | * R30, R31, R32, R40, R40e, R50, R50e, R50p, R51 | ||
| 131 | * T20, T21, T22, T23, T30, T40, T40p, T41, T41p, T42, T42p, T43 | ||
| 132 | * X20, X21, X22, X23, X24, X30, X31, X40 | ||
| 133 | * | ||
| 134 | * The following models have no supported features: | ||
| 135 | * | ||
| 136 | * 240, 240x, i1400 | ||
| 137 | * | ||
| 138 | * Still missing DSDTs for the following models: | ||
| 139 | * | ||
| 140 | * A20p, A22e, A22m | ||
| 141 | * R52 | ||
| 142 | * S31 | ||
| 143 | * T43p | ||
| 144 | */ | ||
| 145 | |||
| 146 | IBM_HANDLE(ec, root, "\\_SB.PCI0.ISA.EC0", /* 240, 240x */ | 126 | IBM_HANDLE(ec, root, "\\_SB.PCI0.ISA.EC0", /* 240, 240x */ |
| 147 | "\\_SB.PCI.ISA.EC", /* 570 */ | 127 | "\\_SB.PCI.ISA.EC", /* 570 */ |
| 148 | "\\_SB.PCI0.ISA0.EC0", /* 600e/x, 770e, 770x */ | 128 | "\\_SB.PCI0.ISA0.EC0", /* 600e/x, 770e, 770x */ |
| @@ -785,12 +765,15 @@ static int wan_write(char *buf) | |||
| 785 | return 0; | 765 | return 0; |
| 786 | } | 766 | } |
| 787 | 767 | ||
| 788 | static int video_supported; | 768 | enum video_access_mode { |
| 789 | static int video_orig_autosw; | 769 | IBMACPI_VIDEO_NONE = 0, |
| 770 | IBMACPI_VIDEO_570, /* 570 */ | ||
| 771 | IBMACPI_VIDEO_770, /* 600e/x, 770e, 770x */ | ||
| 772 | IBMACPI_VIDEO_NEW, /* all others */ | ||
| 773 | }; | ||
| 790 | 774 | ||
| 791 | #define VIDEO_570 1 | 775 | static enum video_access_mode video_supported; |
| 792 | #define VIDEO_770 2 | 776 | static int video_orig_autosw; |
| 793 | #define VIDEO_NEW 3 | ||
| 794 | 777 | ||
| 795 | static int video_init(void) | 778 | static int video_init(void) |
| 796 | { | 779 | { |
| @@ -802,16 +785,16 @@ static int video_init(void) | |||
| 802 | 785 | ||
| 803 | if (!vid_handle) | 786 | if (!vid_handle) |
| 804 | /* video switching not supported on R30, R31 */ | 787 | /* video switching not supported on R30, R31 */ |
| 805 | video_supported = 0; | 788 | video_supported = IBMACPI_VIDEO_NONE; |
| 806 | else if (acpi_evalf(vid_handle, &video_orig_autosw, "SWIT", "qd")) | 789 | else if (acpi_evalf(vid_handle, &video_orig_autosw, "SWIT", "qd")) |
| 807 | /* 570 */ | 790 | /* 570 */ |
| 808 | video_supported = VIDEO_570; | 791 | video_supported = IBMACPI_VIDEO_570; |
| 809 | else if (acpi_evalf(vid_handle, &video_orig_autosw, "^VADL", "qd")) | 792 | else if (acpi_evalf(vid_handle, &video_orig_autosw, "^VADL", "qd")) |
| 810 | /* 600e/x, 770e, 770x */ | 793 | /* 600e/x, 770e, 770x */ |
| 811 | video_supported = VIDEO_770; | 794 | video_supported = IBMACPI_VIDEO_770; |
| 812 | else | 795 | else |
| 813 | /* all others */ | 796 | /* all others */ |
| 814 | video_supported = VIDEO_NEW; | 797 | video_supported = IBMACPI_VIDEO_NEW; |
| 815 | 798 | ||
| 816 | return 0; | 799 | return 0; |
| 817 | } | 800 | } |
| @@ -821,15 +804,15 @@ static int video_status(void) | |||
| 821 | int status = 0; | 804 | int status = 0; |
| 822 | int i; | 805 | int i; |
| 823 | 806 | ||
| 824 | if (video_supported == VIDEO_570) { | 807 | if (video_supported == IBMACPI_VIDEO_570) { |
| 825 | if (acpi_evalf(NULL, &i, "\\_SB.PHS", "dd", 0x87)) | 808 | if (acpi_evalf(NULL, &i, "\\_SB.PHS", "dd", 0x87)) |
| 826 | status = i & 3; | 809 | status = i & 3; |
| 827 | } else if (video_supported == VIDEO_770) { | 810 | } else if (video_supported == IBMACPI_VIDEO_770) { |
| 828 | if (acpi_evalf(NULL, &i, "\\VCDL", "d")) | 811 | if (acpi_evalf(NULL, &i, "\\VCDL", "d")) |
| 829 | status |= 0x01 * i; | 812 | status |= 0x01 * i; |
| 830 | if (acpi_evalf(NULL, &i, "\\VCDC", "d")) | 813 | if (acpi_evalf(NULL, &i, "\\VCDC", "d")) |
| 831 | status |= 0x02 * i; | 814 | status |= 0x02 * i; |
| 832 | } else if (video_supported == VIDEO_NEW) { | 815 | } else if (video_supported == IBMACPI_VIDEO_NEW) { |
| 833 | acpi_evalf(NULL, NULL, "\\VUPS", "vd", 1); | 816 | acpi_evalf(NULL, NULL, "\\VUPS", "vd", 1); |
| 834 | if (acpi_evalf(NULL, &i, "\\VCDC", "d")) | 817 | if (acpi_evalf(NULL, &i, "\\VCDC", "d")) |
| 835 | status |= 0x02 * i; | 818 | status |= 0x02 * i; |
| @@ -848,9 +831,10 @@ static int video_autosw(void) | |||
| 848 | { | 831 | { |
| 849 | int autosw = 0; | 832 | int autosw = 0; |
| 850 | 833 | ||
| 851 | if (video_supported == VIDEO_570) | 834 | if (video_supported == IBMACPI_VIDEO_570) |
| 852 | acpi_evalf(vid_handle, &autosw, "SWIT", "d"); | 835 | acpi_evalf(vid_handle, &autosw, "SWIT", "d"); |
| 853 | else if (video_supported == VIDEO_770 || video_supported == VIDEO_NEW) | 836 | else if (video_supported == IBMACPI_VIDEO_770 || |
| 837 | video_supported == IBMACPI_VIDEO_NEW) | ||
| 854 | acpi_evalf(vid_handle, &autosw, "^VDEE", "d"); | 838 | acpi_evalf(vid_handle, &autosw, "^VDEE", "d"); |
| 855 | 839 | ||
| 856 | return autosw & 1; | 840 | return autosw & 1; |
| @@ -870,12 +854,12 @@ static int video_read(char *p) | |||
| 870 | len += sprintf(p + len, "status:\t\tsupported\n"); | 854 | len += sprintf(p + len, "status:\t\tsupported\n"); |
| 871 | len += sprintf(p + len, "lcd:\t\t%s\n", enabled(status, 0)); | 855 | len += sprintf(p + len, "lcd:\t\t%s\n", enabled(status, 0)); |
| 872 | len += sprintf(p + len, "crt:\t\t%s\n", enabled(status, 1)); | 856 | len += sprintf(p + len, "crt:\t\t%s\n", enabled(status, 1)); |
| 873 | if (video_supported == VIDEO_NEW) | 857 | if (video_supported == IBMACPI_VIDEO_NEW) |
| 874 | len += sprintf(p + len, "dvi:\t\t%s\n", enabled(status, 3)); | 858 | len += sprintf(p + len, "dvi:\t\t%s\n", enabled(status, 3)); |
| 875 | len += sprintf(p + len, "auto:\t\t%s\n", enabled(autosw, 0)); | 859 | len += sprintf(p + len, "auto:\t\t%s\n", enabled(autosw, 0)); |
| 876 | len += sprintf(p + len, "commands:\tlcd_enable, lcd_disable\n"); | 860 | len += sprintf(p + len, "commands:\tlcd_enable, lcd_disable\n"); |
| 877 | len += sprintf(p + len, "commands:\tcrt_enable, crt_disable\n"); | 861 | len += sprintf(p + len, "commands:\tcrt_enable, crt_disable\n"); |
| 878 | if (video_supported == VIDEO_NEW) | 862 | if (video_supported == IBMACPI_VIDEO_NEW) |
| 879 | len += sprintf(p + len, "commands:\tdvi_enable, dvi_disable\n"); | 863 | len += sprintf(p + len, "commands:\tdvi_enable, dvi_disable\n"); |
| 880 | len += sprintf(p + len, "commands:\tauto_enable, auto_disable\n"); | 864 | len += sprintf(p + len, "commands:\tauto_enable, auto_disable\n"); |
| 881 | len += sprintf(p + len, "commands:\tvideo_switch, expand_toggle\n"); | 865 | len += sprintf(p + len, "commands:\tvideo_switch, expand_toggle\n"); |
| @@ -890,7 +874,7 @@ static int video_switch(void) | |||
| 890 | 874 | ||
| 891 | if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 1)) | 875 | if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 1)) |
| 892 | return -EIO; | 876 | return -EIO; |
| 893 | ret = video_supported == VIDEO_570 ? | 877 | ret = video_supported == IBMACPI_VIDEO_570 ? |
| 894 | acpi_evalf(ec_handle, NULL, "_Q16", "v") : | 878 | acpi_evalf(ec_handle, NULL, "_Q16", "v") : |
| 895 | acpi_evalf(vid_handle, NULL, "VSWT", "v"); | 879 | acpi_evalf(vid_handle, NULL, "VSWT", "v"); |
| 896 | acpi_evalf(vid_handle, NULL, "_DOS", "vd", autosw); | 880 | acpi_evalf(vid_handle, NULL, "_DOS", "vd", autosw); |
| @@ -900,9 +884,9 @@ static int video_switch(void) | |||
| 900 | 884 | ||
| 901 | static int video_expand(void) | 885 | static int video_expand(void) |
| 902 | { | 886 | { |
| 903 | if (video_supported == VIDEO_570) | 887 | if (video_supported == IBMACPI_VIDEO_570) |
| 904 | return acpi_evalf(ec_handle, NULL, "_Q17", "v"); | 888 | return acpi_evalf(ec_handle, NULL, "_Q17", "v"); |
| 905 | else if (video_supported == VIDEO_770) | 889 | else if (video_supported == IBMACPI_VIDEO_770) |
| 906 | return acpi_evalf(vid_handle, NULL, "VEXP", "v"); | 890 | return acpi_evalf(vid_handle, NULL, "VEXP", "v"); |
| 907 | else | 891 | else |
| 908 | return acpi_evalf(NULL, NULL, "\\VEXP", "v"); | 892 | return acpi_evalf(NULL, NULL, "\\VEXP", "v"); |
| @@ -912,10 +896,10 @@ static int video_switch2(int status) | |||
| 912 | { | 896 | { |
| 913 | int ret; | 897 | int ret; |
| 914 | 898 | ||
| 915 | if (video_supported == VIDEO_570) { | 899 | if (video_supported == IBMACPI_VIDEO_570) { |
| 916 | ret = acpi_evalf(NULL, NULL, | 900 | ret = acpi_evalf(NULL, NULL, |
| 917 | "\\_SB.PHS2", "vdd", 0x8b, status | 0x80); | 901 | "\\_SB.PHS2", "vdd", 0x8b, status | 0x80); |
| 918 | } else if (video_supported == VIDEO_770) { | 902 | } else if (video_supported == IBMACPI_VIDEO_770) { |
| 919 | int autosw = video_autosw(); | 903 | int autosw = video_autosw(); |
| 920 | if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 1)) | 904 | if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 1)) |
| 921 | return -EIO; | 905 | return -EIO; |
| @@ -951,10 +935,10 @@ static int video_write(char *buf) | |||
| 951 | enable |= 0x02; | 935 | enable |= 0x02; |
| 952 | } else if (strlencmp(cmd, "crt_disable") == 0) { | 936 | } else if (strlencmp(cmd, "crt_disable") == 0) { |
| 953 | disable |= 0x02; | 937 | disable |= 0x02; |
| 954 | } else if (video_supported == VIDEO_NEW && | 938 | } else if (video_supported == IBMACPI_VIDEO_NEW && |
| 955 | strlencmp(cmd, "dvi_enable") == 0) { | 939 | strlencmp(cmd, "dvi_enable") == 0) { |
| 956 | enable |= 0x08; | 940 | enable |= 0x08; |
| 957 | } else if (video_supported == VIDEO_NEW && | 941 | } else if (video_supported == IBMACPI_VIDEO_NEW && |
| 958 | strlencmp(cmd, "dvi_disable") == 0) { | 942 | strlencmp(cmd, "dvi_disable") == 0) { |
| 959 | disable |= 0x08; | 943 | disable |= 0x08; |
| 960 | } else if (strlencmp(cmd, "auto_enable") == 0) { | 944 | } else if (strlencmp(cmd, "auto_enable") == 0) { |
| @@ -1253,26 +1237,28 @@ static int cmos_write(char *buf) | |||
| 1253 | return 0; | 1237 | return 0; |
| 1254 | } | 1238 | } |
| 1255 | 1239 | ||
| 1256 | static int led_supported; | 1240 | enum led_access_mode { |
| 1257 | 1241 | IBMACPI_LED_NONE = 0, | |
| 1258 | #define LED_570 1 | 1242 | IBMACPI_LED_570, /* 570 */ |
| 1259 | #define LED_OLD 2 | 1243 | IBMACPI_LED_OLD, /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */ |
| 1260 | #define LED_NEW 3 | 1244 | IBMACPI_LED_NEW, /* all others */ |
| 1245 | }; | ||
| 1246 | static enum led_access_mode led_supported; | ||
| 1261 | 1247 | ||
| 1262 | static int led_init(void) | 1248 | static int led_init(void) |
| 1263 | { | 1249 | { |
| 1264 | if (!led_handle) | 1250 | if (!led_handle) |
| 1265 | /* led not supported on R30, R31 */ | 1251 | /* led not supported on R30, R31 */ |
| 1266 | led_supported = 0; | 1252 | led_supported = IBMACPI_LED_NONE; |
| 1267 | else if (strlencmp(led_path, "SLED") == 0) | 1253 | else if (strlencmp(led_path, "SLED") == 0) |
| 1268 | /* 570 */ | 1254 | /* 570 */ |
| 1269 | led_supported = LED_570; | 1255 | led_supported = IBMACPI_LED_570; |
| 1270 | else if (strlencmp(led_path, "SYSL") == 0) | 1256 | else if (strlencmp(led_path, "SYSL") == 0) |
| 1271 | /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */ | 1257 | /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */ |
| 1272 | led_supported = LED_OLD; | 1258 | led_supported = IBMACPI_LED_OLD; |
| 1273 | else | 1259 | else |
| 1274 | /* all others */ | 1260 | /* all others */ |
| 1275 | led_supported = LED_NEW; | 1261 | led_supported = IBMACPI_LED_NEW; |
| 1276 | 1262 | ||
| 1277 | return 0; | 1263 | return 0; |
| 1278 | } | 1264 | } |
| @@ -1289,7 +1275,7 @@ static int led_read(char *p) | |||
| 1289 | } | 1275 | } |
| 1290 | len += sprintf(p + len, "status:\t\tsupported\n"); | 1276 | len += sprintf(p + len, "status:\t\tsupported\n"); |
| 1291 | 1277 | ||
| 1292 | if (led_supported == LED_570) { | 1278 | if (led_supported == IBMACPI_LED_570) { |
| 1293 | /* 570 */ | 1279 | /* 570 */ |
| 1294 | int i, status; | 1280 | int i, status; |
| 1295 | for (i = 0; i < 8; i++) { | 1281 | for (i = 0; i < 8; i++) { |
| @@ -1338,13 +1324,13 @@ static int led_write(char *buf) | |||
| 1338 | } else | 1324 | } else |
| 1339 | return -EINVAL; | 1325 | return -EINVAL; |
| 1340 | 1326 | ||
| 1341 | if (led_supported == LED_570) { | 1327 | if (led_supported == IBMACPI_LED_570) { |
| 1342 | /* 570 */ | 1328 | /* 570 */ |
| 1343 | led = 1 << led; | 1329 | led = 1 << led; |
| 1344 | if (!acpi_evalf(led_handle, NULL, NULL, "vdd", | 1330 | if (!acpi_evalf(led_handle, NULL, NULL, "vdd", |
| 1345 | led, led_sled_arg1[ind])) | 1331 | led, led_sled_arg1[ind])) |
| 1346 | return -EIO; | 1332 | return -EIO; |
| 1347 | } else if (led_supported == LED_OLD) { | 1333 | } else if (led_supported == IBMACPI_LED_OLD) { |
| 1348 | /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20 */ | 1334 | /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20 */ |
| 1349 | led = 1 << led; | 1335 | led = 1 << led; |
| 1350 | ret = ec_write(EC_HLMS, led); | 1336 | ret = ec_write(EC_HLMS, led); |
