diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 00:44:28 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 00:45:14 -0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/asus_acpi.c | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/asus_acpi.c')
-rw-r--r-- | drivers/acpi/asus_acpi.c | 690 |
1 files changed, 344 insertions, 346 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index a560b1e2da77..fec895af6ae6 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -61,7 +61,7 @@ | |||
61 | /* | 61 | /* |
62 | * Some events we use, same for all Asus | 62 | * Some events we use, same for all Asus |
63 | */ | 63 | */ |
64 | #define BR_UP 0x10 | 64 | #define BR_UP 0x10 |
65 | #define BR_DOWN 0x20 | 65 | #define BR_DOWN 0x20 |
66 | 66 | ||
67 | /* | 67 | /* |
@@ -75,7 +75,6 @@ MODULE_AUTHOR("Julien Lerouge, Karol Kozimor"); | |||
75 | MODULE_DESCRIPTION(ACPI_HOTK_NAME); | 75 | MODULE_DESCRIPTION(ACPI_HOTK_NAME); |
76 | MODULE_LICENSE("GPL"); | 76 | MODULE_LICENSE("GPL"); |
77 | 77 | ||
78 | |||
79 | static uid_t asus_uid; | 78 | static uid_t asus_uid; |
80 | static gid_t asus_gid; | 79 | static gid_t asus_gid; |
81 | module_param(asus_uid, uint, 0); | 80 | module_param(asus_uid, uint, 0); |
@@ -83,26 +82,25 @@ MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n"); | |||
83 | module_param(asus_gid, uint, 0); | 82 | module_param(asus_gid, uint, 0); |
84 | MODULE_PARM_DESC(gid, "GID for entries in /proc/acpi/asus.\n"); | 83 | MODULE_PARM_DESC(gid, "GID for entries in /proc/acpi/asus.\n"); |
85 | 84 | ||
86 | |||
87 | /* For each model, all features implemented, | 85 | /* For each model, all features implemented, |
88 | * those marked with R are relative to HOTK, A for absolute */ | 86 | * those marked with R are relative to HOTK, A for absolute */ |
89 | struct model_data { | 87 | struct model_data { |
90 | char *name; //name of the laptop________________A | 88 | char *name; //name of the laptop________________A |
91 | char *mt_mled; //method to handle mled_____________R | 89 | char *mt_mled; //method to handle mled_____________R |
92 | char *mled_status; //node to handle mled reading_______A | 90 | char *mled_status; //node to handle mled reading_______A |
93 | char *mt_wled; //method to handle wled_____________R | 91 | char *mt_wled; //method to handle wled_____________R |
94 | char *wled_status; //node to handle wled reading_______A | 92 | char *wled_status; //node to handle wled reading_______A |
95 | char *mt_tled; //method to handle tled_____________R | 93 | char *mt_tled; //method to handle tled_____________R |
96 | char *tled_status; //node to handle tled reading_______A | 94 | char *tled_status; //node to handle tled reading_______A |
97 | char *mt_lcd_switch; //method to turn LCD ON/OFF_________A | 95 | char *mt_lcd_switch; //method to turn LCD ON/OFF_________A |
98 | char *lcd_status; //node to read LCD panel state______A | 96 | char *lcd_status; //node to read LCD panel state______A |
99 | char *brightness_up; //method to set brightness up_______A | 97 | char *brightness_up; //method to set brightness up_______A |
100 | char *brightness_down; //guess what ?______________________A | 98 | char *brightness_down; //guess what ?______________________A |
101 | char *brightness_set; //method to set absolute brightness_R | 99 | char *brightness_set; //method to set absolute brightness_R |
102 | char *brightness_get; //method to get absolute brightness_R | 100 | char *brightness_get; //method to get absolute brightness_R |
103 | char *brightness_status; //node to get brightness____________A | 101 | char *brightness_status; //node to get brightness____________A |
104 | char *display_set; //method to set video output________R | 102 | char *display_set; //method to set video output________R |
105 | char *display_get; //method to get video output________R | 103 | char *display_get; //method to get video output________R |
106 | }; | 104 | }; |
107 | 105 | ||
108 | /* | 106 | /* |
@@ -110,34 +108,34 @@ struct model_data { | |||
110 | * about the hotk device | 108 | * about the hotk device |
111 | */ | 109 | */ |
112 | struct asus_hotk { | 110 | struct asus_hotk { |
113 | struct acpi_device *device; //the device we are in | 111 | struct acpi_device *device; //the device we are in |
114 | acpi_handle handle; //the handle of the hotk device | 112 | acpi_handle handle; //the handle of the hotk device |
115 | char status; //status of the hotk, for LEDs, ... | 113 | char status; //status of the hotk, for LEDs, ... |
116 | struct model_data *methods; //methods available on the laptop | 114 | struct model_data *methods; //methods available on the laptop |
117 | u8 brightness; //brightness level | 115 | u8 brightness; //brightness level |
118 | enum { | 116 | enum { |
119 | A1x = 0, //A1340D, A1300F | 117 | A1x = 0, //A1340D, A1300F |
120 | A2x, //A2500H | 118 | A2x, //A2500H |
121 | D1x, //D1 | 119 | D1x, //D1 |
122 | L2D, //L2000D | 120 | L2D, //L2000D |
123 | L3C, //L3800C | 121 | L3C, //L3800C |
124 | L3D, //L3400D | 122 | L3D, //L3400D |
125 | L3H, //L3H, but also L2000E | 123 | L3H, //L3H, but also L2000E |
126 | L4R, //L4500R | 124 | L4R, //L4500R |
127 | L5x, //L5800C | 125 | L5x, //L5800C |
128 | L8L, //L8400L | 126 | L8L, //L8400L |
129 | M1A, //M1300A | 127 | M1A, //M1300A |
130 | M2E, //M2400E, L4400L | 128 | M2E, //M2400E, L4400L |
131 | M6N, //M6800N | 129 | M6N, //M6800N |
132 | M6R, //M6700R | 130 | M6R, //M6700R |
133 | P30, //Samsung P30 | 131 | P30, //Samsung P30 |
134 | S1x, //S1300A, but also L1400B and M2400A (L84F) | 132 | S1x, //S1300A, but also L1400B and M2400A (L84F) |
135 | S2x, //S200 (J1 reported), Victor MP-XP7210 | 133 | S2x, //S200 (J1 reported), Victor MP-XP7210 |
136 | xxN, //M2400N, M3700N, M5200N, S1300N, S5200N, W1OOON | 134 | xxN, //M2400N, M3700N, M5200N, S1300N, S5200N, W1OOON |
137 | //(Centrino) | 135 | //(Centrino) |
138 | END_MODEL | 136 | END_MODEL |
139 | } model; //Models currently supported | 137 | } model; //Models currently supported |
140 | u16 event_count[128]; //count for each event TODO make this better | 138 | u16 event_count[128]; //count for each event TODO make this better |
141 | }; | 139 | }; |
142 | 140 | ||
143 | /* Here we go */ | 141 | /* Here we go */ |
@@ -150,7 +148,7 @@ struct asus_hotk { | |||
150 | #define xxN_PREFIX "\\_SB.PCI0.SBRG.EC0." | 148 | #define xxN_PREFIX "\\_SB.PCI0.SBRG.EC0." |
151 | 149 | ||
152 | static struct model_data model_conf[END_MODEL] = { | 150 | static struct model_data model_conf[END_MODEL] = { |
153 | /* | 151 | /* |
154 | * Those pathnames are relative to the HOTK / ATKD device : | 152 | * Those pathnames are relative to the HOTK / ATKD device : |
155 | * - mt_mled | 153 | * - mt_mled |
156 | * - mt_wled | 154 | * - mt_wled |
@@ -165,215 +163,197 @@ static struct model_data model_conf[END_MODEL] = { | |||
165 | */ | 163 | */ |
166 | 164 | ||
167 | { | 165 | { |
168 | .name = "A1x", | 166 | .name = "A1x", |
169 | .mt_mled = "MLED", | 167 | .mt_mled = "MLED", |
170 | .mled_status = "\\MAIL", | 168 | .mled_status = "\\MAIL", |
171 | .mt_lcd_switch = A1x_PREFIX "_Q10", | 169 | .mt_lcd_switch = A1x_PREFIX "_Q10", |
172 | .lcd_status = "\\BKLI", | 170 | .lcd_status = "\\BKLI", |
173 | .brightness_up = A1x_PREFIX "_Q0E", | 171 | .brightness_up = A1x_PREFIX "_Q0E", |
174 | .brightness_down = A1x_PREFIX "_Q0F" | 172 | .brightness_down = A1x_PREFIX "_Q0F"}, |
175 | }, | ||
176 | 173 | ||
177 | { | 174 | { |
178 | .name = "A2x", | 175 | .name = "A2x", |
179 | .mt_mled = "MLED", | 176 | .mt_mled = "MLED", |
180 | .mt_wled = "WLED", | 177 | .mt_wled = "WLED", |
181 | .wled_status = "\\SG66", | 178 | .wled_status = "\\SG66", |
182 | .mt_lcd_switch = "\\Q10", | 179 | .mt_lcd_switch = "\\Q10", |
183 | .lcd_status = "\\BAOF", | 180 | .lcd_status = "\\BAOF", |
184 | .brightness_set = "SPLV", | 181 | .brightness_set = "SPLV", |
185 | .brightness_get = "GPLV", | 182 | .brightness_get = "GPLV", |
186 | .display_set = "SDSP", | 183 | .display_set = "SDSP", |
187 | .display_get = "\\INFB" | 184 | .display_get = "\\INFB"}, |
188 | }, | ||
189 | 185 | ||
190 | { | 186 | { |
191 | .name = "D1x", | 187 | .name = "D1x", |
192 | .mt_mled = "MLED", | 188 | .mt_mled = "MLED", |
193 | .mt_lcd_switch = "\\Q0D", | 189 | .mt_lcd_switch = "\\Q0D", |
194 | .lcd_status = "\\GP11", | 190 | .lcd_status = "\\GP11", |
195 | .brightness_up = "\\Q0C", | 191 | .brightness_up = "\\Q0C", |
196 | .brightness_down = "\\Q0B", | 192 | .brightness_down = "\\Q0B", |
197 | .brightness_status = "\\BLVL", | 193 | .brightness_status = "\\BLVL", |
198 | .display_set = "SDSP", | 194 | .display_set = "SDSP", |
199 | .display_get = "\\INFB" | 195 | .display_get = "\\INFB"}, |
200 | }, | ||
201 | 196 | ||
202 | { | 197 | { |
203 | .name = "L2D", | 198 | .name = "L2D", |
204 | .mt_mled = "MLED", | 199 | .mt_mled = "MLED", |
205 | .mled_status = "\\SGP6", | 200 | .mled_status = "\\SGP6", |
206 | .mt_wled = "WLED", | 201 | .mt_wled = "WLED", |
207 | .wled_status = "\\RCP3", | 202 | .wled_status = "\\RCP3", |
208 | .mt_lcd_switch = "\\Q10", | 203 | .mt_lcd_switch = "\\Q10", |
209 | .lcd_status = "\\SGP0", | 204 | .lcd_status = "\\SGP0", |
210 | .brightness_up = "\\Q0E", | 205 | .brightness_up = "\\Q0E", |
211 | .brightness_down = "\\Q0F", | 206 | .brightness_down = "\\Q0F", |
212 | .display_set = "SDSP", | 207 | .display_set = "SDSP", |
213 | .display_get = "\\INFB" | 208 | .display_get = "\\INFB"}, |
214 | }, | ||
215 | 209 | ||
216 | { | 210 | { |
217 | .name = "L3C", | 211 | .name = "L3C", |
218 | .mt_mled = "MLED", | 212 | .mt_mled = "MLED", |
219 | .mt_wled = "WLED", | 213 | .mt_wled = "WLED", |
220 | .mt_lcd_switch = L3C_PREFIX "_Q10", | 214 | .mt_lcd_switch = L3C_PREFIX "_Q10", |
221 | .lcd_status = "\\GL32", | 215 | .lcd_status = "\\GL32", |
222 | .brightness_set = "SPLV", | 216 | .brightness_set = "SPLV", |
223 | .brightness_get = "GPLV", | 217 | .brightness_get = "GPLV", |
224 | .display_set = "SDSP", | 218 | .display_set = "SDSP", |
225 | .display_get = "\\_SB.PCI0.PCI1.VGAC.NMAP" | 219 | .display_get = "\\_SB.PCI0.PCI1.VGAC.NMAP"}, |
226 | }, | ||
227 | 220 | ||
228 | { | 221 | { |
229 | .name = "L3D", | 222 | .name = "L3D", |
230 | .mt_mled = "MLED", | 223 | .mt_mled = "MLED", |
231 | .mled_status = "\\MALD", | 224 | .mled_status = "\\MALD", |
232 | .mt_wled = "WLED", | 225 | .mt_wled = "WLED", |
233 | .mt_lcd_switch = "\\Q10", | 226 | .mt_lcd_switch = "\\Q10", |
234 | .lcd_status = "\\BKLG", | 227 | .lcd_status = "\\BKLG", |
235 | .brightness_set = "SPLV", | 228 | .brightness_set = "SPLV", |
236 | .brightness_get = "GPLV", | 229 | .brightness_get = "GPLV", |
237 | .display_set = "SDSP", | 230 | .display_set = "SDSP", |
238 | .display_get = "\\INFB" | 231 | .display_get = "\\INFB"}, |
239 | }, | ||
240 | 232 | ||
241 | { | 233 | { |
242 | .name = "L3H", | 234 | .name = "L3H", |
243 | .mt_mled = "MLED", | 235 | .mt_mled = "MLED", |
244 | .mt_wled = "WLED", | 236 | .mt_wled = "WLED", |
245 | .mt_lcd_switch = "EHK", | 237 | .mt_lcd_switch = "EHK", |
246 | .lcd_status = "\\_SB.PCI0.PM.PBC", | 238 | .lcd_status = "\\_SB.PCI0.PM.PBC", |
247 | .brightness_set = "SPLV", | 239 | .brightness_set = "SPLV", |
248 | .brightness_get = "GPLV", | 240 | .brightness_get = "GPLV", |
249 | .display_set = "SDSP", | 241 | .display_set = "SDSP", |
250 | .display_get = "\\INFB" | 242 | .display_get = "\\INFB"}, |
251 | }, | ||
252 | 243 | ||
253 | { | 244 | { |
254 | .name = "L4R", | 245 | .name = "L4R", |
255 | .mt_mled = "MLED", | 246 | .mt_mled = "MLED", |
256 | .mt_wled = "WLED", | 247 | .mt_wled = "WLED", |
257 | .wled_status = "\\_SB.PCI0.SBRG.SG13", | 248 | .wled_status = "\\_SB.PCI0.SBRG.SG13", |
258 | .mt_lcd_switch = xxN_PREFIX "_Q10", | 249 | .mt_lcd_switch = xxN_PREFIX "_Q10", |
259 | .lcd_status = "\\_SB.PCI0.SBSM.SEO4", | 250 | .lcd_status = "\\_SB.PCI0.SBSM.SEO4", |
260 | .brightness_set = "SPLV", | 251 | .brightness_set = "SPLV", |
261 | .brightness_get = "GPLV", | 252 | .brightness_get = "GPLV", |
262 | .display_set = "SDSP", | 253 | .display_set = "SDSP", |
263 | .display_get = "\\_SB.PCI0.P0P1.VGA.GETD" | 254 | .display_get = "\\_SB.PCI0.P0P1.VGA.GETD"}, |
264 | }, | ||
265 | 255 | ||
266 | { | 256 | { |
267 | .name = "L5x", | 257 | .name = "L5x", |
268 | .mt_mled = "MLED", | 258 | .mt_mled = "MLED", |
269 | /* WLED present, but not controlled by ACPI */ | 259 | /* WLED present, but not controlled by ACPI */ |
270 | .mt_tled = "TLED", | 260 | .mt_tled = "TLED", |
271 | .mt_lcd_switch = "\\Q0D", | 261 | .mt_lcd_switch = "\\Q0D", |
272 | .lcd_status = "\\BAOF", | 262 | .lcd_status = "\\BAOF", |
273 | .brightness_set = "SPLV", | 263 | .brightness_set = "SPLV", |
274 | .brightness_get = "GPLV", | 264 | .brightness_get = "GPLV", |
275 | .display_set = "SDSP", | 265 | .display_set = "SDSP", |
276 | .display_get = "\\INFB" | 266 | .display_get = "\\INFB"}, |
277 | }, | ||
278 | 267 | ||
279 | { | 268 | { |
280 | .name = "L8L" | 269 | .name = "L8L" |
281 | /* No features, but at least support the hotkeys */ | 270 | /* No features, but at least support the hotkeys */ |
282 | }, | 271 | }, |
283 | 272 | ||
284 | { | 273 | { |
285 | .name = "M1A", | 274 | .name = "M1A", |
286 | .mt_mled = "MLED", | 275 | .mt_mled = "MLED", |
287 | .mt_lcd_switch = M1A_PREFIX "Q10", | 276 | .mt_lcd_switch = M1A_PREFIX "Q10", |
288 | .lcd_status = "\\PNOF", | 277 | .lcd_status = "\\PNOF", |
289 | .brightness_up = M1A_PREFIX "Q0E", | 278 | .brightness_up = M1A_PREFIX "Q0E", |
290 | .brightness_down = M1A_PREFIX "Q0F", | 279 | .brightness_down = M1A_PREFIX "Q0F", |
291 | .brightness_status = "\\BRIT", | 280 | .brightness_status = "\\BRIT", |
292 | .display_set = "SDSP", | 281 | .display_set = "SDSP", |
293 | .display_get = "\\INFB" | 282 | .display_get = "\\INFB"}, |
294 | }, | ||
295 | 283 | ||
296 | { | 284 | { |
297 | .name = "M2E", | 285 | .name = "M2E", |
298 | .mt_mled = "MLED", | 286 | .mt_mled = "MLED", |
299 | .mt_wled = "WLED", | 287 | .mt_wled = "WLED", |
300 | .mt_lcd_switch = "\\Q10", | 288 | .mt_lcd_switch = "\\Q10", |
301 | .lcd_status = "\\GP06", | 289 | .lcd_status = "\\GP06", |
302 | .brightness_set = "SPLV", | 290 | .brightness_set = "SPLV", |
303 | .brightness_get = "GPLV", | 291 | .brightness_get = "GPLV", |
304 | .display_set = "SDSP", | 292 | .display_set = "SDSP", |
305 | .display_get = "\\INFB" | 293 | .display_get = "\\INFB"}, |
306 | }, | ||
307 | 294 | ||
308 | { | 295 | { |
309 | .name = "M6N", | 296 | .name = "M6N", |
310 | .mt_mled = "MLED", | 297 | .mt_mled = "MLED", |
311 | .mt_wled = "WLED", | 298 | .mt_wled = "WLED", |
312 | .wled_status = "\\_SB.PCI0.SBRG.SG13", | 299 | .wled_status = "\\_SB.PCI0.SBRG.SG13", |
313 | .mt_lcd_switch = xxN_PREFIX "_Q10", | 300 | .mt_lcd_switch = xxN_PREFIX "_Q10", |
314 | .lcd_status = "\\_SB.BKLT", | 301 | .lcd_status = "\\_SB.BKLT", |
315 | .brightness_set = "SPLV", | 302 | .brightness_set = "SPLV", |
316 | .brightness_get = "GPLV", | 303 | .brightness_get = "GPLV", |
317 | .display_set = "SDSP", | 304 | .display_set = "SDSP", |
318 | .display_get = "\\SSTE" | 305 | .display_get = "\\SSTE"}, |
319 | }, | ||
320 | { | 306 | { |
321 | .name = "M6R", | 307 | .name = "M6R", |
322 | .mt_mled = "MLED", | 308 | .mt_mled = "MLED", |
323 | .mt_wled = "WLED", | 309 | .mt_wled = "WLED", |
324 | .mt_lcd_switch = xxN_PREFIX "_Q10", | 310 | .mt_lcd_switch = xxN_PREFIX "_Q10", |
325 | .lcd_status = "\\_SB.PCI0.SBSM.SEO4", | 311 | .lcd_status = "\\_SB.PCI0.SBSM.SEO4", |
326 | .brightness_set = "SPLV", | 312 | .brightness_set = "SPLV", |
327 | .brightness_get = "GPLV", | 313 | .brightness_get = "GPLV", |
328 | .display_set = "SDSP", | 314 | .display_set = "SDSP", |
329 | .display_get = "\\SSTE" | 315 | .display_get = "\\SSTE"}, |
330 | }, | ||
331 | |||
332 | 316 | ||
333 | { | 317 | { |
334 | .name = "P30", | 318 | .name = "P30", |
335 | .mt_wled = "WLED", | 319 | .mt_wled = "WLED", |
336 | .mt_lcd_switch = P30_PREFIX "_Q0E", | 320 | .mt_lcd_switch = P30_PREFIX "_Q0E", |
337 | .lcd_status = "\\BKLT", | 321 | .lcd_status = "\\BKLT", |
338 | .brightness_up = P30_PREFIX "_Q68", | 322 | .brightness_up = P30_PREFIX "_Q68", |
339 | .brightness_down = P30_PREFIX "_Q69", | 323 | .brightness_down = P30_PREFIX "_Q69", |
340 | .brightness_get = "GPLV", | 324 | .brightness_get = "GPLV", |
341 | .display_set = "SDSP", | 325 | .display_set = "SDSP", |
342 | .display_get = "\\DNXT" | 326 | .display_get = "\\DNXT"}, |
343 | }, | ||
344 | 327 | ||
345 | { | 328 | { |
346 | .name = "S1x", | 329 | .name = "S1x", |
347 | .mt_mled = "MLED", | 330 | .mt_mled = "MLED", |
348 | .mled_status = "\\EMLE", | 331 | .mled_status = "\\EMLE", |
349 | .mt_wled = "WLED", | 332 | .mt_wled = "WLED", |
350 | .mt_lcd_switch = S1x_PREFIX "Q10" , | 333 | .mt_lcd_switch = S1x_PREFIX "Q10", |
351 | .lcd_status = "\\PNOF", | 334 | .lcd_status = "\\PNOF", |
352 | .brightness_set = "SPLV", | 335 | .brightness_set = "SPLV", |
353 | .brightness_get = "GPLV" | 336 | .brightness_get = "GPLV"}, |
354 | }, | ||
355 | 337 | ||
356 | { | 338 | { |
357 | .name = "S2x", | 339 | .name = "S2x", |
358 | .mt_mled = "MLED", | 340 | .mt_mled = "MLED", |
359 | .mled_status = "\\MAIL", | 341 | .mled_status = "\\MAIL", |
360 | .mt_lcd_switch = S2x_PREFIX "_Q10", | 342 | .mt_lcd_switch = S2x_PREFIX "_Q10", |
361 | .lcd_status = "\\BKLI", | 343 | .lcd_status = "\\BKLI", |
362 | .brightness_up = S2x_PREFIX "_Q0B", | 344 | .brightness_up = S2x_PREFIX "_Q0B", |
363 | .brightness_down = S2x_PREFIX "_Q0A" | 345 | .brightness_down = S2x_PREFIX "_Q0A"}, |
364 | }, | ||
365 | 346 | ||
366 | { | 347 | { |
367 | .name = "xxN", | 348 | .name = "xxN", |
368 | .mt_mled = "MLED", | 349 | .mt_mled = "MLED", |
369 | /* WLED present, but not controlled by ACPI */ | 350 | /* WLED present, but not controlled by ACPI */ |
370 | .mt_lcd_switch = xxN_PREFIX "_Q10", | 351 | .mt_lcd_switch = xxN_PREFIX "_Q10", |
371 | .lcd_status = "\\BKLT", | 352 | .lcd_status = "\\BKLT", |
372 | .brightness_set = "SPLV", | 353 | .brightness_set = "SPLV", |
373 | .brightness_get = "GPLV", | 354 | .brightness_get = "GPLV", |
374 | .display_set = "SDSP", | 355 | .display_set = "SDSP", |
375 | .display_get = "\\ADVG" | 356 | .display_get = "\\ADVG"} |
376 | } | ||
377 | }; | 357 | }; |
378 | 358 | ||
379 | /* procdir we use */ | 359 | /* procdir we use */ |
@@ -395,13 +375,13 @@ static struct asus_hotk *hotk; | |||
395 | static int asus_hotk_add(struct acpi_device *device); | 375 | static int asus_hotk_add(struct acpi_device *device); |
396 | static int asus_hotk_remove(struct acpi_device *device, int type); | 376 | static int asus_hotk_remove(struct acpi_device *device, int type); |
397 | static struct acpi_driver asus_hotk_driver = { | 377 | static struct acpi_driver asus_hotk_driver = { |
398 | .name = ACPI_HOTK_NAME, | 378 | .name = ACPI_HOTK_NAME, |
399 | .class = ACPI_HOTK_CLASS, | 379 | .class = ACPI_HOTK_CLASS, |
400 | .ids = ACPI_HOTK_HID, | 380 | .ids = ACPI_HOTK_HID, |
401 | .ops = { | 381 | .ops = { |
402 | .add = asus_hotk_add, | 382 | .add = asus_hotk_add, |
403 | .remove = asus_hotk_remove, | 383 | .remove = asus_hotk_remove, |
404 | }, | 384 | }, |
405 | }; | 385 | }; |
406 | 386 | ||
407 | /* | 387 | /* |
@@ -423,11 +403,10 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val, | |||
423 | in_obj.type = ACPI_TYPE_INTEGER; | 403 | in_obj.type = ACPI_TYPE_INTEGER; |
424 | in_obj.integer.value = val; | 404 | in_obj.integer.value = val; |
425 | 405 | ||
426 | status = acpi_evaluate_object(handle, (char *) method, ¶ms, output); | 406 | status = acpi_evaluate_object(handle, (char *)method, ¶ms, output); |
427 | return (status == AE_OK); | 407 | return (status == AE_OK); |
428 | } | 408 | } |
429 | 409 | ||
430 | |||
431 | static int read_acpi_int(acpi_handle handle, const char *method, int *val) | 410 | static int read_acpi_int(acpi_handle handle, const char *method, int *val) |
432 | { | 411 | { |
433 | struct acpi_buffer output; | 412 | struct acpi_buffer output; |
@@ -437,7 +416,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val) | |||
437 | output.length = sizeof(out_obj); | 416 | output.length = sizeof(out_obj); |
438 | output.pointer = &out_obj; | 417 | output.pointer = &out_obj; |
439 | 418 | ||
440 | status = acpi_evaluate_object(handle, (char *) method, NULL, &output); | 419 | status = acpi_evaluate_object(handle, (char *)method, NULL, &output); |
441 | *val = out_obj.integer.value; | 420 | *val = out_obj.integer.value; |
442 | return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER); | 421 | return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER); |
443 | } | 422 | } |
@@ -449,7 +428,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val) | |||
449 | */ | 428 | */ |
450 | static int | 429 | static int |
451 | proc_read_info(char *page, char **start, off_t off, int count, int *eof, | 430 | proc_read_info(char *page, char **start, off_t off, int count, int *eof, |
452 | void *data) | 431 | void *data) |
453 | { | 432 | { |
454 | int len = 0; | 433 | int len = 0; |
455 | int temp; | 434 | int temp; |
@@ -460,7 +439,7 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, | |||
460 | */ | 439 | */ |
461 | 440 | ||
462 | len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n"); | 441 | len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n"); |
463 | len += sprintf(page + len, "Model reference : %s\n", | 442 | len += sprintf(page + len, "Model reference : %s\n", |
464 | hotk->methods->name); | 443 | hotk->methods->name); |
465 | /* | 444 | /* |
466 | * The SFUN method probably allows the original driver to get the list | 445 | * The SFUN method probably allows the original driver to get the list |
@@ -469,7 +448,8 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, | |||
469 | * The significance of others is yet to be found. | 448 | * The significance of others is yet to be found. |
470 | */ | 449 | */ |
471 | if (read_acpi_int(hotk->handle, "SFUN", &temp)) | 450 | if (read_acpi_int(hotk->handle, "SFUN", &temp)) |
472 | len += sprintf(page + len, "SFUN value : 0x%04x\n", temp); | 451 | len += |
452 | sprintf(page + len, "SFUN value : 0x%04x\n", temp); | ||
473 | /* | 453 | /* |
474 | * Another value for userspace: the ASYM method returns 0x02 for | 454 | * Another value for userspace: the ASYM method returns 0x02 for |
475 | * battery low and 0x04 for battery critical, its readings tend to be | 455 | * battery low and 0x04 for battery critical, its readings tend to be |
@@ -478,7 +458,8 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, | |||
478 | * silently ignored. | 458 | * silently ignored. |
479 | */ | 459 | */ |
480 | if (read_acpi_int(hotk->handle, "ASYM", &temp)) | 460 | if (read_acpi_int(hotk->handle, "ASYM", &temp)) |
481 | len += sprintf(page + len, "ASYM value : 0x%04x\n", temp); | 461 | len += |
462 | sprintf(page + len, "ASYM value : 0x%04x\n", temp); | ||
482 | if (asus_info) { | 463 | if (asus_info) { |
483 | snprintf(buf, 16, "%d", asus_info->length); | 464 | snprintf(buf, 16, "%d", asus_info->length); |
484 | len += sprintf(page + len, "DSDT length : %s\n", buf); | 465 | len += sprintf(page + len, "DSDT length : %s\n", buf); |
@@ -501,7 +482,6 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, | |||
501 | return len; | 482 | return len; |
502 | } | 483 | } |
503 | 484 | ||
504 | |||
505 | /* | 485 | /* |
506 | * /proc handlers | 486 | * /proc handlers |
507 | * We write our info in page, we begin at offset off and cannot write more | 487 | * We write our info in page, we begin at offset off and cannot write more |
@@ -510,8 +490,7 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, | |||
510 | */ | 490 | */ |
511 | 491 | ||
512 | /* Generic LED functions */ | 492 | /* Generic LED functions */ |
513 | static int | 493 | static int read_led(const char *ledname, int ledmask) |
514 | read_led(const char *ledname, int ledmask) | ||
515 | { | 494 | { |
516 | if (ledname) { | 495 | if (ledname) { |
517 | int led_status; | 496 | int led_status; |
@@ -525,7 +504,7 @@ read_led(const char *ledname, int ledmask) | |||
525 | return (hotk->status & ledmask) ? 1 : 0; | 504 | return (hotk->status & ledmask) ? 1 : 0; |
526 | } | 505 | } |
527 | 506 | ||
528 | static int parse_arg(const char __user *buf, unsigned long count, int *val) | 507 | static int parse_arg(const char __user * buf, unsigned long count, int *val) |
529 | { | 508 | { |
530 | char s[32]; | 509 | char s[32]; |
531 | if (!count) | 510 | if (!count) |
@@ -542,8 +521,8 @@ static int parse_arg(const char __user *buf, unsigned long count, int *val) | |||
542 | 521 | ||
543 | /* FIXME: kill extraneous args so it can be called independently */ | 522 | /* FIXME: kill extraneous args so it can be called independently */ |
544 | static int | 523 | static int |
545 | write_led(const char __user *buffer, unsigned long count, | 524 | write_led(const char __user * buffer, unsigned long count, |
546 | char *ledname, int ledmask, int invert) | 525 | char *ledname, int ledmask, int invert) |
547 | { | 526 | { |
548 | int value; | 527 | int value; |
549 | int led_out = 0; | 528 | int led_out = 0; |
@@ -555,16 +534,16 @@ write_led(const char __user *buffer, unsigned long count, | |||
555 | hotk->status = | 534 | hotk->status = |
556 | (led_out) ? (hotk->status | ledmask) : (hotk->status & ~ledmask); | 535 | (led_out) ? (hotk->status | ledmask) : (hotk->status & ~ledmask); |
557 | 536 | ||
558 | if (invert) /* invert target value */ | 537 | if (invert) /* invert target value */ |
559 | led_out = !led_out & 0x1; | 538 | led_out = !led_out & 0x1; |
560 | 539 | ||
561 | if (!write_acpi_int(hotk->handle, ledname, led_out, NULL)) | 540 | if (!write_acpi_int(hotk->handle, ledname, led_out, NULL)) |
562 | printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", ledname); | 541 | printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", |
542 | ledname); | ||
563 | 543 | ||
564 | return count; | 544 | return count; |
565 | } | 545 | } |
566 | 546 | ||
567 | |||
568 | /* | 547 | /* |
569 | * Proc handlers for MLED | 548 | * Proc handlers for MLED |
570 | */ | 549 | */ |
@@ -572,12 +551,12 @@ static int | |||
572 | proc_read_mled(char *page, char **start, off_t off, int count, int *eof, | 551 | proc_read_mled(char *page, char **start, off_t off, int count, int *eof, |
573 | void *data) | 552 | void *data) |
574 | { | 553 | { |
575 | return sprintf(page, "%d\n", read_led(hotk->methods->mled_status, MLED_ON)); | 554 | return sprintf(page, "%d\n", |
555 | read_led(hotk->methods->mled_status, MLED_ON)); | ||
576 | } | 556 | } |
577 | 557 | ||
578 | |||
579 | static int | 558 | static int |
580 | proc_write_mled(struct file *file, const char __user *buffer, | 559 | proc_write_mled(struct file *file, const char __user * buffer, |
581 | unsigned long count, void *data) | 560 | unsigned long count, void *data) |
582 | { | 561 | { |
583 | return write_led(buffer, count, hotk->methods->mt_mled, MLED_ON, 1); | 562 | return write_led(buffer, count, hotk->methods->mt_mled, MLED_ON, 1); |
@@ -590,11 +569,12 @@ static int | |||
590 | proc_read_wled(char *page, char **start, off_t off, int count, int *eof, | 569 | proc_read_wled(char *page, char **start, off_t off, int count, int *eof, |
591 | void *data) | 570 | void *data) |
592 | { | 571 | { |
593 | return sprintf(page, "%d\n", read_led(hotk->methods->wled_status, WLED_ON)); | 572 | return sprintf(page, "%d\n", |
573 | read_led(hotk->methods->wled_status, WLED_ON)); | ||
594 | } | 574 | } |
595 | 575 | ||
596 | static int | 576 | static int |
597 | proc_write_wled(struct file *file, const char __user *buffer, | 577 | proc_write_wled(struct file *file, const char __user * buffer, |
598 | unsigned long count, void *data) | 578 | unsigned long count, void *data) |
599 | { | 579 | { |
600 | return write_led(buffer, count, hotk->methods->mt_wled, WLED_ON, 0); | 580 | return write_led(buffer, count, hotk->methods->mt_wled, WLED_ON, 0); |
@@ -607,35 +587,36 @@ static int | |||
607 | proc_read_tled(char *page, char **start, off_t off, int count, int *eof, | 587 | proc_read_tled(char *page, char **start, off_t off, int count, int *eof, |
608 | void *data) | 588 | void *data) |
609 | { | 589 | { |
610 | return sprintf(page, "%d\n", read_led(hotk->methods->tled_status, TLED_ON)); | 590 | return sprintf(page, "%d\n", |
591 | read_led(hotk->methods->tled_status, TLED_ON)); | ||
611 | } | 592 | } |
612 | 593 | ||
613 | static int | 594 | static int |
614 | proc_write_tled(struct file *file, const char __user *buffer, | 595 | proc_write_tled(struct file *file, const char __user * buffer, |
615 | unsigned long count, void *data) | 596 | unsigned long count, void *data) |
616 | { | 597 | { |
617 | return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0); | 598 | return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0); |
618 | } | 599 | } |
619 | 600 | ||
620 | |||
621 | static int get_lcd_state(void) | 601 | static int get_lcd_state(void) |
622 | { | 602 | { |
623 | int lcd = 0; | 603 | int lcd = 0; |
624 | 604 | ||
625 | if (hotk->model != L3H) { | 605 | if (hotk->model != L3H) { |
626 | /* We don't have to check anything if we are here */ | 606 | /* We don't have to check anything if we are here */ |
627 | if (!read_acpi_int(NULL, hotk->methods->lcd_status, &lcd)) | 607 | if (!read_acpi_int(NULL, hotk->methods->lcd_status, &lcd)) |
628 | printk(KERN_WARNING "Asus ACPI: Error reading LCD status\n"); | 608 | printk(KERN_WARNING |
629 | 609 | "Asus ACPI: Error reading LCD status\n"); | |
610 | |||
630 | if (hotk->model == L2D) | 611 | if (hotk->model == L2D) |
631 | lcd = ~lcd; | 612 | lcd = ~lcd; |
632 | } else { /* L3H and the like have to be handled differently */ | 613 | } else { /* L3H and the like have to be handled differently */ |
633 | acpi_status status = 0; | 614 | acpi_status status = 0; |
634 | struct acpi_object_list input; | 615 | struct acpi_object_list input; |
635 | union acpi_object mt_params[2]; | 616 | union acpi_object mt_params[2]; |
636 | struct acpi_buffer output; | 617 | struct acpi_buffer output; |
637 | union acpi_object out_obj; | 618 | union acpi_object out_obj; |
638 | 619 | ||
639 | input.count = 2; | 620 | input.count = 2; |
640 | input.pointer = mt_params; | 621 | input.pointer = mt_params; |
641 | /* Note: the following values are partly guessed up, but | 622 | /* Note: the following values are partly guessed up, but |
@@ -647,15 +628,17 @@ static int get_lcd_state(void) | |||
647 | 628 | ||
648 | output.length = sizeof(out_obj); | 629 | output.length = sizeof(out_obj); |
649 | output.pointer = &out_obj; | 630 | output.pointer = &out_obj; |
650 | 631 | ||
651 | status = acpi_evaluate_object(NULL, hotk->methods->lcd_status, &input, &output); | 632 | status = |
633 | acpi_evaluate_object(NULL, hotk->methods->lcd_status, | ||
634 | &input, &output); | ||
652 | if (status != AE_OK) | 635 | if (status != AE_OK) |
653 | return -1; | 636 | return -1; |
654 | if (out_obj.type == ACPI_TYPE_INTEGER) | 637 | if (out_obj.type == ACPI_TYPE_INTEGER) |
655 | /* That's what the AML code does */ | 638 | /* That's what the AML code does */ |
656 | lcd = out_obj.integer.value >> 8; | 639 | lcd = out_obj.integer.value >> 8; |
657 | } | 640 | } |
658 | 641 | ||
659 | return (lcd & 1); | 642 | return (lcd & 1); |
660 | } | 643 | } |
661 | 644 | ||
@@ -669,10 +652,13 @@ static int set_lcd_state(int value) | |||
669 | /* switch */ | 652 | /* switch */ |
670 | if (hotk->model != L3H) { | 653 | if (hotk->model != L3H) { |
671 | status = | 654 | status = |
672 | acpi_evaluate_object(NULL, hotk->methods->mt_lcd_switch, | 655 | acpi_evaluate_object(NULL, |
656 | hotk->methods->mt_lcd_switch, | ||
673 | NULL, NULL); | 657 | NULL, NULL); |
674 | } else { /* L3H and the like have to be handled differently */ | 658 | } else { /* L3H and the like have to be handled differently */ |
675 | if (!write_acpi_int(hotk->handle, hotk->methods->mt_lcd_switch, 0x07, NULL)) | 659 | if (!write_acpi_int |
660 | (hotk->handle, hotk->methods->mt_lcd_switch, 0x07, | ||
661 | NULL)) | ||
676 | status = AE_ERROR; | 662 | status = AE_ERROR; |
677 | /* L3H's AML executes EHK (0x07) upon Fn+F7 keypress, | 663 | /* L3H's AML executes EHK (0x07) upon Fn+F7 keypress, |
678 | the exact behaviour is simulated here */ | 664 | the exact behaviour is simulated here */ |
@@ -691,33 +677,33 @@ proc_read_lcd(char *page, char **start, off_t off, int count, int *eof, | |||
691 | return sprintf(page, "%d\n", get_lcd_state()); | 677 | return sprintf(page, "%d\n", get_lcd_state()); |
692 | } | 678 | } |
693 | 679 | ||
694 | |||
695 | static int | 680 | static int |
696 | proc_write_lcd(struct file *file, const char __user *buffer, | 681 | proc_write_lcd(struct file *file, const char __user * buffer, |
697 | unsigned long count, void *data) | 682 | unsigned long count, void *data) |
698 | { | 683 | { |
699 | int value; | 684 | int value; |
700 | 685 | ||
701 | count = parse_arg(buffer, count, &value); | 686 | count = parse_arg(buffer, count, &value); |
702 | if (count > 0) | 687 | if (count > 0) |
703 | set_lcd_state(value); | 688 | set_lcd_state(value); |
704 | return count; | 689 | return count; |
705 | } | 690 | } |
706 | 691 | ||
707 | |||
708 | static int read_brightness(void) | 692 | static int read_brightness(void) |
709 | { | 693 | { |
710 | int value; | 694 | int value; |
711 | 695 | ||
712 | if(hotk->methods->brightness_get) { /* SPLV/GPLV laptop */ | 696 | if (hotk->methods->brightness_get) { /* SPLV/GPLV laptop */ |
713 | if (!read_acpi_int(hotk->handle, hotk->methods->brightness_get, | 697 | if (!read_acpi_int(hotk->handle, hotk->methods->brightness_get, |
714 | &value)) | 698 | &value)) |
715 | printk(KERN_WARNING "Asus ACPI: Error reading brightness\n"); | 699 | printk(KERN_WARNING |
716 | } else if (hotk->methods->brightness_status) { /* For D1 for example */ | 700 | "Asus ACPI: Error reading brightness\n"); |
717 | if (!read_acpi_int(NULL, hotk->methods->brightness_status, | 701 | } else if (hotk->methods->brightness_status) { /* For D1 for example */ |
702 | if (!read_acpi_int(NULL, hotk->methods->brightness_status, | ||
718 | &value)) | 703 | &value)) |
719 | printk(KERN_WARNING "Asus ACPI: Error reading brightness\n"); | 704 | printk(KERN_WARNING |
720 | } else /* No GPLV method */ | 705 | "Asus ACPI: Error reading brightness\n"); |
706 | } else /* No GPLV method */ | ||
721 | value = hotk->brightness; | 707 | value = hotk->brightness; |
722 | return value; | 708 | return value; |
723 | } | 709 | } |
@@ -730,23 +716,25 @@ static void set_brightness(int value) | |||
730 | acpi_status status = 0; | 716 | acpi_status status = 0; |
731 | 717 | ||
732 | /* SPLV laptop */ | 718 | /* SPLV laptop */ |
733 | if(hotk->methods->brightness_set) { | 719 | if (hotk->methods->brightness_set) { |
734 | if (!write_acpi_int(hotk->handle, hotk->methods->brightness_set, | 720 | if (!write_acpi_int(hotk->handle, hotk->methods->brightness_set, |
735 | value, NULL)) | 721 | value, NULL)) |
736 | printk(KERN_WARNING "Asus ACPI: Error changing brightness\n"); | 722 | printk(KERN_WARNING |
723 | "Asus ACPI: Error changing brightness\n"); | ||
737 | return; | 724 | return; |
738 | } | 725 | } |
739 | 726 | ||
740 | /* No SPLV method if we are here, act as appropriate */ | 727 | /* No SPLV method if we are here, act as appropriate */ |
741 | value -= read_brightness(); | 728 | value -= read_brightness(); |
742 | while (value != 0) { | 729 | while (value != 0) { |
743 | status = acpi_evaluate_object(NULL, (value > 0) ? | 730 | status = acpi_evaluate_object(NULL, (value > 0) ? |
744 | hotk->methods->brightness_up : | 731 | hotk->methods->brightness_up : |
745 | hotk->methods->brightness_down, | 732 | hotk->methods->brightness_down, |
746 | NULL, NULL); | 733 | NULL, NULL); |
747 | (value > 0) ? value-- : value++; | 734 | (value > 0) ? value-- : value++; |
748 | if (ACPI_FAILURE(status)) | 735 | if (ACPI_FAILURE(status)) |
749 | printk(KERN_WARNING "Asus ACPI: Error changing brightness\n"); | 736 | printk(KERN_WARNING |
737 | "Asus ACPI: Error changing brightness\n"); | ||
750 | } | 738 | } |
751 | return; | 739 | return; |
752 | } | 740 | } |
@@ -759,7 +747,7 @@ proc_read_brn(char *page, char **start, off_t off, int count, int *eof, | |||
759 | } | 747 | } |
760 | 748 | ||
761 | static int | 749 | static int |
762 | proc_write_brn(struct file *file, const char __user *buffer, | 750 | proc_write_brn(struct file *file, const char __user * buffer, |
763 | unsigned long count, void *data) | 751 | unsigned long count, void *data) |
764 | { | 752 | { |
765 | int value; | 753 | int value; |
@@ -767,7 +755,7 @@ proc_write_brn(struct file *file, const char __user *buffer, | |||
767 | count = parse_arg(buffer, count, &value); | 755 | count = parse_arg(buffer, count, &value); |
768 | if (count > 0) { | 756 | if (count > 0) { |
769 | value = (0 < value) ? ((15 < value) ? 15 : value) : 0; | 757 | value = (0 < value) ? ((15 < value) ? 15 : value) : 0; |
770 | /* 0 <= value <= 15 */ | 758 | /* 0 <= value <= 15 */ |
771 | set_brightness(value); | 759 | set_brightness(value); |
772 | } else if (count < 0) { | 760 | } else if (count < 0) { |
773 | printk(KERN_WARNING "Asus ACPI: Error reading user input\n"); | 761 | printk(KERN_WARNING "Asus ACPI: Error reading user input\n"); |
@@ -779,7 +767,7 @@ proc_write_brn(struct file *file, const char __user *buffer, | |||
779 | static void set_display(int value) | 767 | static void set_display(int value) |
780 | { | 768 | { |
781 | /* no sanity check needed for now */ | 769 | /* no sanity check needed for now */ |
782 | if (!write_acpi_int(hotk->handle, hotk->methods->display_set, | 770 | if (!write_acpi_int(hotk->handle, hotk->methods->display_set, |
783 | value, NULL)) | 771 | value, NULL)) |
784 | printk(KERN_WARNING "Asus ACPI: Error setting display\n"); | 772 | printk(KERN_WARNING "Asus ACPI: Error setting display\n"); |
785 | return; | 773 | return; |
@@ -791,13 +779,14 @@ static void set_display(int value) | |||
791 | */ | 779 | */ |
792 | static int | 780 | static int |
793 | proc_read_disp(char *page, char **start, off_t off, int count, int *eof, | 781 | proc_read_disp(char *page, char **start, off_t off, int count, int *eof, |
794 | void *data) | 782 | void *data) |
795 | { | 783 | { |
796 | int value = 0; | 784 | int value = 0; |
797 | 785 | ||
798 | if (!read_acpi_int(hotk->handle, hotk->methods->display_get, &value)) | 786 | if (!read_acpi_int(hotk->handle, hotk->methods->display_get, &value)) |
799 | printk(KERN_WARNING "Asus ACPI: Error reading display status\n"); | 787 | printk(KERN_WARNING |
800 | value &= 0x07; /* needed for some models, shouldn't hurt others */ | 788 | "Asus ACPI: Error reading display status\n"); |
789 | value &= 0x07; /* needed for some models, shouldn't hurt others */ | ||
801 | return sprintf(page, "%d\n", value); | 790 | return sprintf(page, "%d\n", value); |
802 | } | 791 | } |
803 | 792 | ||
@@ -808,8 +797,8 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof, | |||
808 | * simultaneously, so be warned. See the acpi4asus README for more info. | 797 | * simultaneously, so be warned. See the acpi4asus README for more info. |
809 | */ | 798 | */ |
810 | static int | 799 | static int |
811 | proc_write_disp(struct file *file, const char __user *buffer, | 800 | proc_write_disp(struct file *file, const char __user * buffer, |
812 | unsigned long count, void *data) | 801 | unsigned long count, void *data) |
813 | { | 802 | { |
814 | int value; | 803 | int value; |
815 | 804 | ||
@@ -822,19 +811,19 @@ proc_write_disp(struct file *file, const char __user *buffer, | |||
822 | return count; | 811 | return count; |
823 | } | 812 | } |
824 | 813 | ||
825 | 814 | typedef int (proc_readfunc) (char *page, char **start, off_t off, int count, | |
826 | typedef int (proc_readfunc)(char *page, char **start, off_t off, int count, | 815 | int *eof, void *data); |
827 | int *eof, void *data); | 816 | typedef int (proc_writefunc) (struct file * file, const char __user * buffer, |
828 | typedef int (proc_writefunc)(struct file *file, const char __user *buffer, | 817 | unsigned long count, void *data); |
829 | unsigned long count, void *data); | ||
830 | 818 | ||
831 | static int | 819 | static int |
832 | __init asus_proc_add(char *name, proc_writefunc *writefunc, | 820 | __init asus_proc_add(char *name, proc_writefunc * writefunc, |
833 | proc_readfunc *readfunc, mode_t mode, | 821 | proc_readfunc * readfunc, mode_t mode, |
834 | struct acpi_device *device) | 822 | struct acpi_device *device) |
835 | { | 823 | { |
836 | struct proc_dir_entry *proc = create_proc_entry(name, mode, acpi_device_dir(device)); | 824 | struct proc_dir_entry *proc = |
837 | if(!proc) { | 825 | create_proc_entry(name, mode, acpi_device_dir(device)); |
826 | if (!proc) { | ||
838 | printk(KERN_WARNING " Unable to create %s fs entry\n", name); | 827 | printk(KERN_WARNING " Unable to create %s fs entry\n", name); |
839 | return -1; | 828 | return -1; |
840 | } | 829 | } |
@@ -851,14 +840,14 @@ static int __init asus_hotk_add_fs(struct acpi_device *device) | |||
851 | { | 840 | { |
852 | struct proc_dir_entry *proc; | 841 | struct proc_dir_entry *proc; |
853 | mode_t mode; | 842 | mode_t mode; |
854 | 843 | ||
855 | /* | 844 | /* |
856 | * If parameter uid or gid is not changed, keep the default setting for | 845 | * If parameter uid or gid is not changed, keep the default setting for |
857 | * our proc entries (-rw-rw-rw-) else, it means we care about security, | 846 | * our proc entries (-rw-rw-rw-) else, it means we care about security, |
858 | * and then set to -rw-rw---- | 847 | * and then set to -rw-rw---- |
859 | */ | 848 | */ |
860 | 849 | ||
861 | if ((asus_uid == 0) && (asus_gid == 0)){ | 850 | if ((asus_uid == 0) && (asus_gid == 0)) { |
862 | mode = S_IFREG | S_IRUGO | S_IWUGO; | 851 | mode = S_IFREG | S_IRUGO | S_IWUGO; |
863 | } else { | 852 | } else { |
864 | mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP; | 853 | mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP; |
@@ -881,15 +870,18 @@ static int __init asus_hotk_add_fs(struct acpi_device *device) | |||
881 | } | 870 | } |
882 | 871 | ||
883 | if (hotk->methods->mt_wled) { | 872 | if (hotk->methods->mt_wled) { |
884 | asus_proc_add(PROC_WLED, &proc_write_wled, &proc_read_wled, mode, device); | 873 | asus_proc_add(PROC_WLED, &proc_write_wled, &proc_read_wled, |
874 | mode, device); | ||
885 | } | 875 | } |
886 | 876 | ||
887 | if (hotk->methods->mt_mled) { | 877 | if (hotk->methods->mt_mled) { |
888 | asus_proc_add(PROC_MLED, &proc_write_mled, &proc_read_mled, mode, device); | 878 | asus_proc_add(PROC_MLED, &proc_write_mled, &proc_read_mled, |
879 | mode, device); | ||
889 | } | 880 | } |
890 | 881 | ||
891 | if (hotk->methods->mt_tled) { | 882 | if (hotk->methods->mt_tled) { |
892 | asus_proc_add(PROC_TLED, &proc_write_tled, &proc_read_tled, mode, device); | 883 | asus_proc_add(PROC_TLED, &proc_write_tled, &proc_read_tled, |
884 | mode, device); | ||
893 | } | 885 | } |
894 | 886 | ||
895 | /* | 887 | /* |
@@ -897,35 +889,40 @@ static int __init asus_hotk_add_fs(struct acpi_device *device) | |||
897 | * from keyboard | 889 | * from keyboard |
898 | */ | 890 | */ |
899 | if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) { | 891 | if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) { |
900 | asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode, device); | 892 | asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode, |
893 | device); | ||
901 | } | 894 | } |
902 | 895 | ||
903 | if ((hotk->methods->brightness_up && hotk->methods->brightness_down) || | 896 | if ((hotk->methods->brightness_up && hotk->methods->brightness_down) || |
904 | (hotk->methods->brightness_get && hotk->methods->brightness_set)) { | 897 | (hotk->methods->brightness_get && hotk->methods->brightness_set)) { |
905 | asus_proc_add(PROC_BRN, &proc_write_brn, &proc_read_brn, mode, device); | 898 | asus_proc_add(PROC_BRN, &proc_write_brn, &proc_read_brn, mode, |
899 | device); | ||
906 | } | 900 | } |
907 | 901 | ||
908 | if (hotk->methods->display_set) { | 902 | if (hotk->methods->display_set) { |
909 | asus_proc_add(PROC_DISP, &proc_write_disp, &proc_read_disp, mode, device); | 903 | asus_proc_add(PROC_DISP, &proc_write_disp, &proc_read_disp, |
904 | mode, device); | ||
910 | } | 905 | } |
911 | 906 | ||
912 | return 0; | 907 | return 0; |
913 | } | 908 | } |
914 | 909 | ||
915 | static int asus_hotk_remove_fs(struct acpi_device* device) | 910 | static int asus_hotk_remove_fs(struct acpi_device *device) |
916 | { | 911 | { |
917 | if(acpi_device_dir(device)) { | 912 | if (acpi_device_dir(device)) { |
918 | remove_proc_entry(PROC_INFO,acpi_device_dir(device)); | 913 | remove_proc_entry(PROC_INFO, acpi_device_dir(device)); |
919 | if (hotk->methods->mt_wled) | 914 | if (hotk->methods->mt_wled) |
920 | remove_proc_entry(PROC_WLED,acpi_device_dir(device)); | 915 | remove_proc_entry(PROC_WLED, acpi_device_dir(device)); |
921 | if (hotk->methods->mt_mled) | 916 | if (hotk->methods->mt_mled) |
922 | remove_proc_entry(PROC_MLED,acpi_device_dir(device)); | 917 | remove_proc_entry(PROC_MLED, acpi_device_dir(device)); |
923 | if (hotk->methods->mt_tled) | 918 | if (hotk->methods->mt_tled) |
924 | remove_proc_entry(PROC_TLED,acpi_device_dir(device)); | 919 | remove_proc_entry(PROC_TLED, acpi_device_dir(device)); |
925 | if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) | 920 | if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) |
926 | remove_proc_entry(PROC_LCD, acpi_device_dir(device)); | 921 | remove_proc_entry(PROC_LCD, acpi_device_dir(device)); |
927 | if ((hotk->methods->brightness_up && hotk->methods->brightness_down) || | 922 | if ((hotk->methods->brightness_up |
928 | (hotk->methods->brightness_get && hotk->methods->brightness_set)) | 923 | && hotk->methods->brightness_down) |
924 | || (hotk->methods->brightness_get | ||
925 | && hotk->methods->brightness_set)) | ||
929 | remove_proc_entry(PROC_BRN, acpi_device_dir(device)); | 926 | remove_proc_entry(PROC_BRN, acpi_device_dir(device)); |
930 | if (hotk->methods->display_set) | 927 | if (hotk->methods->display_set) |
931 | remove_proc_entry(PROC_DISP, acpi_device_dir(device)); | 928 | remove_proc_entry(PROC_DISP, acpi_device_dir(device)); |
@@ -933,16 +930,15 @@ static int asus_hotk_remove_fs(struct acpi_device* device) | |||
933 | return 0; | 930 | return 0; |
934 | } | 931 | } |
935 | 932 | ||
936 | |||
937 | static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) | 933 | static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) |
938 | { | 934 | { |
939 | /* TODO Find a better way to handle events count.*/ | 935 | /* TODO Find a better way to handle events count. */ |
940 | if (!hotk) | 936 | if (!hotk) |
941 | return; | 937 | return; |
942 | 938 | ||
943 | if ((event & ~((u32) BR_UP)) < 16) { | 939 | if ((event & ~((u32) BR_UP)) < 16) { |
944 | hotk->brightness = (event & ~((u32) BR_UP)); | 940 | hotk->brightness = (event & ~((u32) BR_UP)); |
945 | } else if ((event & ~((u32) BR_DOWN)) < 16 ) { | 941 | } else if ((event & ~((u32) BR_DOWN)) < 16) { |
946 | hotk->brightness = (event & ~((u32) BR_DOWN)); | 942 | hotk->brightness = (event & ~((u32) BR_DOWN)); |
947 | } | 943 | } |
948 | 944 | ||
@@ -976,7 +972,7 @@ static int __init asus_hotk_get_info(void) | |||
976 | if (ACPI_FAILURE(status)) | 972 | if (ACPI_FAILURE(status)) |
977 | printk(KERN_WARNING " Couldn't get the DSDT table header\n"); | 973 | printk(KERN_WARNING " Couldn't get the DSDT table header\n"); |
978 | else | 974 | else |
979 | asus_info = (struct acpi_table_header *) dsdt.pointer; | 975 | asus_info = (struct acpi_table_header *)dsdt.pointer; |
980 | 976 | ||
981 | /* We have to write 0 on init this far for all ASUS models */ | 977 | /* We have to write 0 on init this far for all ASUS models */ |
982 | if (!write_acpi_int(hotk->handle, "INIT", 0, &buffer)) { | 978 | if (!write_acpi_int(hotk->handle, "INIT", 0, &buffer)) { |
@@ -988,15 +984,17 @@ static int __init asus_hotk_get_info(void) | |||
988 | if (!read_acpi_int(hotk->handle, "BSTS", &bsts_result)) | 984 | if (!read_acpi_int(hotk->handle, "BSTS", &bsts_result)) |
989 | printk(KERN_WARNING " Error calling BSTS\n"); | 985 | printk(KERN_WARNING " Error calling BSTS\n"); |
990 | else if (bsts_result) | 986 | else if (bsts_result) |
991 | printk(KERN_NOTICE " BSTS called, 0x%02x returned\n", bsts_result); | 987 | printk(KERN_NOTICE " BSTS called, 0x%02x returned\n", |
988 | bsts_result); | ||
992 | 989 | ||
993 | /* Samsung P30 has a device with a valid _HID whose INIT does not | 990 | /* Samsung P30 has a device with a valid _HID whose INIT does not |
994 | * return anything. Catch this one and any similar here */ | 991 | * return anything. Catch this one and any similar here */ |
995 | if (buffer.pointer == NULL) { | 992 | if (buffer.pointer == NULL) { |
996 | if (asus_info && /* Samsung P30 */ | 993 | if (asus_info && /* Samsung P30 */ |
997 | strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) { | 994 | strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) { |
998 | hotk->model = P30; | 995 | hotk->model = P30; |
999 | printk(KERN_NOTICE " Samsung P30 detected, supported\n"); | 996 | printk(KERN_NOTICE |
997 | " Samsung P30 detected, supported\n"); | ||
1000 | } else { | 998 | } else { |
1001 | hotk->model = M2E; | 999 | hotk->model = M2E; |
1002 | printk(KERN_WARNING " no string returned by INIT\n"); | 1000 | printk(KERN_WARNING " no string returned by INIT\n"); |
@@ -1006,10 +1004,11 @@ static int __init asus_hotk_get_info(void) | |||
1006 | hotk->methods = &model_conf[hotk->model]; | 1004 | hotk->methods = &model_conf[hotk->model]; |
1007 | return AE_OK; | 1005 | return AE_OK; |
1008 | } | 1006 | } |
1009 | 1007 | ||
1010 | model = (union acpi_object *) buffer.pointer; | 1008 | model = (union acpi_object *)buffer.pointer; |
1011 | if (model->type == ACPI_TYPE_STRING) { | 1009 | if (model->type == ACPI_TYPE_STRING) { |
1012 | printk(KERN_NOTICE " %s model detected, ", model->string.pointer); | 1010 | printk(KERN_NOTICE " %s model detected, ", |
1011 | model->string.pointer); | ||
1013 | } | 1012 | } |
1014 | 1013 | ||
1015 | hotk->model = END_MODEL; | 1014 | hotk->model = END_MODEL; |
@@ -1035,7 +1034,7 @@ static int __init asus_hotk_get_info(void) | |||
1035 | strncmp(model->string.pointer, "M6N", 3) == 0 || | 1034 | strncmp(model->string.pointer, "M6N", 3) == 0 || |
1036 | strncmp(model->string.pointer, "S1N", 3) == 0 || | 1035 | strncmp(model->string.pointer, "S1N", 3) == 0 || |
1037 | strncmp(model->string.pointer, "S5N", 3) == 0 || | 1036 | strncmp(model->string.pointer, "S5N", 3) == 0 || |
1038 | strncmp(model->string.pointer, "W1N", 3) == 0) | 1037 | strncmp(model->string.pointer, "W1N", 3) == 0) |
1039 | hotk->model = xxN; | 1038 | hotk->model = xxN; |
1040 | else if (strncmp(model->string.pointer, "M1", 2) == 0) | 1039 | else if (strncmp(model->string.pointer, "M1", 2) == 0) |
1041 | hotk->model = M1A; | 1040 | hotk->model = M1A; |
@@ -1069,21 +1068,21 @@ static int __init asus_hotk_get_info(void) | |||
1069 | 1068 | ||
1070 | /* Sort of per-model blacklist */ | 1069 | /* Sort of per-model blacklist */ |
1071 | if (strncmp(model->string.pointer, "L2B", 3) == 0) | 1070 | if (strncmp(model->string.pointer, "L2B", 3) == 0) |
1072 | hotk->methods->lcd_status = NULL; | 1071 | hotk->methods->lcd_status = NULL; |
1073 | /* L2B is similar enough to L3C to use its settings, with this only | 1072 | /* L2B is similar enough to L3C to use its settings, with this only |
1074 | exception */ | 1073 | exception */ |
1075 | else if (strncmp(model->string.pointer, "S5N", 3) == 0 || | 1074 | else if (strncmp(model->string.pointer, "S5N", 3) == 0 || |
1076 | strncmp(model->string.pointer, "M5N", 3) == 0) | 1075 | strncmp(model->string.pointer, "M5N", 3) == 0) |
1077 | hotk->methods->mt_mled = NULL; | 1076 | hotk->methods->mt_mled = NULL; |
1078 | /* S5N and M5N have no MLED */ | 1077 | /* S5N and M5N have no MLED */ |
1079 | else if (strncmp(model->string.pointer, "M2N", 3) == 0 || | 1078 | else if (strncmp(model->string.pointer, "M2N", 3) == 0 || |
1080 | strncmp(model->string.pointer, "W1N", 3) == 0) | 1079 | strncmp(model->string.pointer, "W1N", 3) == 0) |
1081 | hotk->methods->mt_wled = "WLED"; | 1080 | hotk->methods->mt_wled = "WLED"; |
1082 | /* M2N and W1N have a usable WLED */ | 1081 | /* M2N and W1N have a usable WLED */ |
1083 | else if (asus_info) { | 1082 | else if (asus_info) { |
1084 | if (strncmp(asus_info->oem_table_id, "L1", 2) == 0) | 1083 | if (strncmp(asus_info->oem_table_id, "L1", 2) == 0) |
1085 | hotk->methods->mled_status = NULL; | 1084 | hotk->methods->mled_status = NULL; |
1086 | /* S1300A reports L84F, but L1400B too, account for that */ | 1085 | /* S1300A reports L84F, but L1400B too, account for that */ |
1087 | } | 1086 | } |
1088 | 1087 | ||
1089 | acpi_os_free(model); | 1088 | acpi_os_free(model); |
@@ -1091,7 +1090,6 @@ static int __init asus_hotk_get_info(void) | |||
1091 | return AE_OK; | 1090 | return AE_OK; |
1092 | } | 1091 | } |
1093 | 1092 | ||
1094 | |||
1095 | static int __init asus_hotk_check(void) | 1093 | static int __init asus_hotk_check(void) |
1096 | { | 1094 | { |
1097 | int result = 0; | 1095 | int result = 0; |
@@ -1110,7 +1108,6 @@ static int __init asus_hotk_check(void) | |||
1110 | return result; | 1108 | return result; |
1111 | } | 1109 | } |
1112 | 1110 | ||
1113 | |||
1114 | static int __init asus_hotk_add(struct acpi_device *device) | 1111 | static int __init asus_hotk_add(struct acpi_device *device) |
1115 | { | 1112 | { |
1116 | acpi_status status = AE_OK; | 1113 | acpi_status status = AE_OK; |
@@ -1123,7 +1120,7 @@ static int __init asus_hotk_add(struct acpi_device *device) | |||
1123 | ASUS_ACPI_VERSION); | 1120 | ASUS_ACPI_VERSION); |
1124 | 1121 | ||
1125 | hotk = | 1122 | hotk = |
1126 | (struct asus_hotk *) kmalloc(sizeof(struct asus_hotk), GFP_KERNEL); | 1123 | (struct asus_hotk *)kmalloc(sizeof(struct asus_hotk), GFP_KERNEL); |
1127 | if (!hotk) | 1124 | if (!hotk) |
1128 | return -ENOMEM; | 1125 | return -ENOMEM; |
1129 | memset(hotk, 0, sizeof(struct asus_hotk)); | 1126 | memset(hotk, 0, sizeof(struct asus_hotk)); |
@@ -1134,7 +1131,6 @@ static int __init asus_hotk_add(struct acpi_device *device) | |||
1134 | acpi_driver_data(device) = hotk; | 1131 | acpi_driver_data(device) = hotk; |
1135 | hotk->device = device; | 1132 | hotk->device = device; |
1136 | 1133 | ||
1137 | |||
1138 | result = asus_hotk_check(); | 1134 | result = asus_hotk_check(); |
1139 | if (result) | 1135 | if (result) |
1140 | goto end; | 1136 | goto end; |
@@ -1153,17 +1149,22 @@ static int __init asus_hotk_add(struct acpi_device *device) | |||
1153 | printk(KERN_ERR " Error installing notify handler\n"); | 1149 | printk(KERN_ERR " Error installing notify handler\n"); |
1154 | 1150 | ||
1155 | /* For laptops without GPLV: init the hotk->brightness value */ | 1151 | /* For laptops without GPLV: init the hotk->brightness value */ |
1156 | if ((!hotk->methods->brightness_get) && (!hotk->methods->brightness_status) && | 1152 | if ((!hotk->methods->brightness_get) |
1157 | (hotk->methods->brightness_up && hotk->methods->brightness_down)) { | 1153 | && (!hotk->methods->brightness_status) |
1158 | status = acpi_evaluate_object(NULL, hotk->methods->brightness_down, | 1154 | && (hotk->methods->brightness_up |
1159 | NULL, NULL); | 1155 | && hotk->methods->brightness_down)) { |
1156 | status = | ||
1157 | acpi_evaluate_object(NULL, hotk->methods->brightness_down, | ||
1158 | NULL, NULL); | ||
1160 | if (ACPI_FAILURE(status)) | 1159 | if (ACPI_FAILURE(status)) |
1161 | printk(KERN_WARNING " Error changing brightness\n"); | 1160 | printk(KERN_WARNING " Error changing brightness\n"); |
1162 | else { | 1161 | else { |
1163 | status = acpi_evaluate_object(NULL, hotk->methods->brightness_up, | 1162 | status = |
1164 | NULL, NULL); | 1163 | acpi_evaluate_object(NULL, |
1164 | hotk->methods->brightness_up, | ||
1165 | NULL, NULL); | ||
1165 | if (ACPI_FAILURE(status)) | 1166 | if (ACPI_FAILURE(status)) |
1166 | printk(KERN_WARNING " Strange, error changing" | 1167 | printk(KERN_WARNING " Strange, error changing" |
1167 | " brightness\n"); | 1168 | " brightness\n"); |
1168 | } | 1169 | } |
1169 | } | 1170 | } |
@@ -1176,7 +1177,6 @@ static int __init asus_hotk_add(struct acpi_device *device) | |||
1176 | return result; | 1177 | return result; |
1177 | } | 1178 | } |
1178 | 1179 | ||
1179 | |||
1180 | static int asus_hotk_remove(struct acpi_device *device, int type) | 1180 | static int asus_hotk_remove(struct acpi_device *device, int type) |
1181 | { | 1181 | { |
1182 | acpi_status status = 0; | 1182 | acpi_status status = 0; |
@@ -1196,7 +1196,6 @@ static int asus_hotk_remove(struct acpi_device *device, int type) | |||
1196 | return 0; | 1196 | return 0; |
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | |||
1200 | static int __init asus_acpi_init(void) | 1199 | static int __init asus_acpi_init(void) |
1201 | { | 1200 | { |
1202 | int result; | 1201 | int result; |
@@ -1204,9 +1203,9 @@ static int __init asus_acpi_init(void) | |||
1204 | if (acpi_disabled) | 1203 | if (acpi_disabled) |
1205 | return -ENODEV; | 1204 | return -ENODEV; |
1206 | 1205 | ||
1207 | if (!acpi_specific_hotkey_enabled){ | 1206 | if (!acpi_specific_hotkey_enabled) { |
1208 | printk(KERN_ERR "Using generic hotkey driver\n"); | 1207 | printk(KERN_ERR "Using generic hotkey driver\n"); |
1209 | return -ENODEV; | 1208 | return -ENODEV; |
1210 | } | 1209 | } |
1211 | asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir); | 1210 | asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir); |
1212 | if (!asus_proc_dir) { | 1211 | if (!asus_proc_dir) { |
@@ -1225,7 +1224,6 @@ static int __init asus_acpi_init(void) | |||
1225 | return 0; | 1224 | return 0; |
1226 | } | 1225 | } |
1227 | 1226 | ||
1228 | |||
1229 | static void __exit asus_acpi_exit(void) | 1227 | static void __exit asus_acpi_exit(void) |
1230 | { | 1228 | { |
1231 | acpi_bus_unregister_driver(&asus_hotk_driver); | 1229 | acpi_bus_unregister_driver(&asus_hotk_driver); |