diff options
Diffstat (limited to 'drivers/acpi/sbs.c')
-rw-r--r-- | drivers/acpi/sbs.c | 282 |
1 files changed, 135 insertions, 147 deletions
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 7bb8c62fb92c..f35fe63cef3d 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -88,10 +88,10 @@ extern void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); | |||
88 | /* 0 - every time, > 0 - by update_time */ | 88 | /* 0 - every time, > 0 - by update_time */ |
89 | static unsigned int update_time = 120; | 89 | static unsigned int update_time = 120; |
90 | 90 | ||
91 | static unsigned int capacity_mode = CAPACITY_UNIT; | 91 | static unsigned int mode = CAPACITY_UNIT; |
92 | 92 | ||
93 | module_param(update_time, uint, 0644); | 93 | module_param(update_time, uint, 0644); |
94 | module_param(capacity_mode, uint, 0444); | 94 | module_param(mode, uint, 0444); |
95 | 95 | ||
96 | static int acpi_sbs_add(struct acpi_device *device); | 96 | static int acpi_sbs_add(struct acpi_device *device); |
97 | static int acpi_sbs_remove(struct acpi_device *device, int type); | 97 | static int acpi_sbs_remove(struct acpi_device *device, int type); |
@@ -114,59 +114,43 @@ static struct acpi_driver acpi_sbs_driver = { | |||
114 | }, | 114 | }, |
115 | }; | 115 | }; |
116 | 116 | ||
117 | struct acpi_ac { | ||
118 | int ac_present; | ||
119 | }; | ||
120 | |||
121 | struct acpi_battery_info { | ||
122 | int capacity_mode; | ||
123 | s16 full_charge_capacity; | ||
124 | s16 design_capacity; | ||
125 | s16 design_voltage; | ||
126 | int vscale; | ||
127 | int ipscale; | ||
128 | s16 serial_number; | ||
129 | char manufacturer_name[ACPI_SBS_BLOCK_MAX + 3]; | ||
130 | char device_name[ACPI_SBS_BLOCK_MAX + 3]; | ||
131 | char device_chemistry[ACPI_SBS_BLOCK_MAX + 3]; | ||
132 | }; | ||
133 | |||
134 | struct acpi_battery_state { | ||
135 | s16 voltage; | ||
136 | s16 amperage; | ||
137 | s16 remaining_capacity; | ||
138 | s16 battery_state; | ||
139 | }; | ||
140 | |||
141 | struct acpi_battery_alarm { | ||
142 | s16 remaining_capacity; | ||
143 | }; | ||
144 | |||
145 | struct acpi_battery { | 117 | struct acpi_battery { |
146 | int alive; | ||
147 | int id; | ||
148 | int init_state; | ||
149 | int battery_present; | ||
150 | struct acpi_sbs *sbs; | 118 | struct acpi_sbs *sbs; |
151 | struct acpi_battery_info info; | 119 | struct proc_dir_entry *proc_entry; |
152 | struct acpi_battery_state state; | 120 | int vscale; |
153 | struct acpi_battery_alarm alarm; | 121 | int ipscale; |
154 | struct proc_dir_entry *battery_entry; | 122 | char manufacturer_name[ACPI_SBS_BLOCK_MAX]; |
123 | char device_name[ACPI_SBS_BLOCK_MAX]; | ||
124 | char device_chemistry[ACPI_SBS_BLOCK_MAX]; | ||
125 | u16 full_charge_capacity; | ||
126 | u16 design_capacity; | ||
127 | u16 design_voltage; | ||
128 | u16 serial_number; | ||
129 | u16 voltage_now; | ||
130 | s16 current_now; | ||
131 | u16 capacity_now; | ||
132 | u16 state; | ||
133 | u16 alarm_capacity; | ||
134 | u16 mode; | ||
135 | u8 id; | ||
136 | u8 alive:1; | ||
137 | u8 init_state:1; | ||
138 | u8 present:1; | ||
155 | }; | 139 | }; |
156 | 140 | ||
157 | struct acpi_sbs { | 141 | struct acpi_sbs { |
158 | struct acpi_device *device; | 142 | struct acpi_device *device; |
159 | struct acpi_smb_hc *hc; | 143 | struct acpi_smb_hc *hc; |
160 | struct mutex mutex; | 144 | struct mutex mutex; |
161 | int sbsm_present; | ||
162 | int sbsm_batteries_supported; | ||
163 | struct proc_dir_entry *ac_entry; | 145 | struct proc_dir_entry *ac_entry; |
164 | struct acpi_ac ac; | ||
165 | struct acpi_battery battery[MAX_SBS_BAT]; | 146 | struct acpi_battery battery[MAX_SBS_BAT]; |
166 | int zombie; | 147 | int zombie; |
167 | struct timer_list update_timer; | 148 | struct timer_list update_timer; |
168 | int run_cnt; | 149 | int run_cnt; |
169 | int update_proc_flg; | 150 | int update_proc_flg; |
151 | u8 batteries_supported; | ||
152 | u8 manager_present:1; | ||
153 | u8 charger_present:1; | ||
170 | }; | 154 | }; |
171 | 155 | ||
172 | static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type); | 156 | static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type); |
@@ -231,7 +215,7 @@ static int acpi_battery_get_present(struct acpi_battery *battery) | |||
231 | if (!result) { | 215 | if (!result) { |
232 | is_present = (state & 0x000f) & (1 << battery->id); | 216 | is_present = (state & 0x000f) & (1 << battery->id); |
233 | } | 217 | } |
234 | battery->battery_present = is_present; | 218 | battery->present = is_present; |
235 | 219 | ||
236 | return result; | 220 | return result; |
237 | } | 221 | } |
@@ -243,14 +227,14 @@ static int acpi_battery_select(struct acpi_battery *battery) | |||
243 | s16 state; | 227 | s16 state; |
244 | int foo; | 228 | int foo; |
245 | 229 | ||
246 | if (sbs->sbsm_present) { | 230 | if (sbs->manager_present) { |
247 | 231 | ||
248 | /* Take special care not to knobble other nibbles of | 232 | /* Take special care not to knobble other nibbles of |
249 | * state (aka selector_state), since | 233 | * state (aka selector_state), since |
250 | * it causes charging to halt on SBSELs */ | 234 | * it causes charging to halt on SBSELs */ |
251 | 235 | ||
252 | result = | 236 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, |
253 | acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SBSM_SMBUS_ADDR, 0x01, (u8 *)&state); | 237 | ACPI_SBSM_SMBUS_ADDR, 0x01, (u8 *)&state); |
254 | if (result) { | 238 | if (result) { |
255 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 239 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
256 | "acpi_smbus_read() failed")); | 240 | "acpi_smbus_read() failed")); |
@@ -258,8 +242,8 @@ static int acpi_battery_select(struct acpi_battery *battery) | |||
258 | } | 242 | } |
259 | 243 | ||
260 | foo = (state & 0x0fff) | (1 << (battery->id + 12)); | 244 | foo = (state & 0x0fff) | (1 << (battery->id + 12)); |
261 | result = | 245 | result = acpi_smbus_write(battery->sbs->hc, SMBUS_WRITE_WORD, |
262 | acpi_smbus_write(battery->sbs->hc, SMBUS_WRITE_WORD, ACPI_SBSM_SMBUS_ADDR, 0x01, (u8 *)&foo, 2); | 246 | ACPI_SBSM_SMBUS_ADDR, 0x01, (u8 *)&foo, 2); |
263 | if (result) { | 247 | if (result) { |
264 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 248 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
265 | "acpi_smbus_write() failed")); | 249 | "acpi_smbus_write() failed")); |
@@ -283,8 +267,7 @@ static int acpi_sbsm_get_info(struct acpi_sbs *sbs) | |||
283 | "acpi_smbus_read() failed")); | 267 | "acpi_smbus_read() failed")); |
284 | goto end; | 268 | goto end; |
285 | } | 269 | } |
286 | sbs->sbsm_present = 1; | 270 | sbs->manager_present = 1; |
287 | sbs->sbsm_batteries_supported = battery_system_info & 0x000f; | ||
288 | 271 | ||
289 | end: | 272 | end: |
290 | 273 | ||
@@ -304,10 +287,10 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
304 | "acpi_smbus_read() failed")); | 287 | "acpi_smbus_read() failed")); |
305 | goto end; | 288 | goto end; |
306 | } | 289 | } |
307 | battery->info.capacity_mode = (battery_mode & 0x8000) >> 15; | 290 | battery->mode = (battery_mode & 0x8000) >> 15; |
308 | 291 | ||
309 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x10, | 292 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x10, |
310 | (u8 *)&battery->info.full_charge_capacity); | 293 | (u8 *)&battery->full_charge_capacity); |
311 | if (result) { | 294 | if (result) { |
312 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 295 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
313 | "acpi_smbus_read() failed")); | 296 | "acpi_smbus_read() failed")); |
@@ -315,7 +298,7 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
315 | } | 298 | } |
316 | 299 | ||
317 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x18, | 300 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x18, |
318 | (u8 *)&battery->info.design_capacity); | 301 | (u8 *)&battery->design_capacity); |
319 | 302 | ||
320 | if (result) { | 303 | if (result) { |
321 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 304 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
@@ -324,7 +307,7 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
324 | } | 307 | } |
325 | 308 | ||
326 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x19, | 309 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x19, |
327 | (u8 *)&battery->info.design_voltage); | 310 | (u8 *)&battery->design_voltage); |
328 | if (result) { | 311 | if (result) { |
329 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 312 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
330 | "acpi_smbus_read() failed")); | 313 | "acpi_smbus_read() failed")); |
@@ -341,34 +324,34 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
341 | 324 | ||
342 | switch ((specification_info & 0x0f00) >> 8) { | 325 | switch ((specification_info & 0x0f00) >> 8) { |
343 | case 1: | 326 | case 1: |
344 | battery->info.vscale = 10; | 327 | battery->vscale = 10; |
345 | break; | 328 | break; |
346 | case 2: | 329 | case 2: |
347 | battery->info.vscale = 100; | 330 | battery->vscale = 100; |
348 | break; | 331 | break; |
349 | case 3: | 332 | case 3: |
350 | battery->info.vscale = 1000; | 333 | battery->vscale = 1000; |
351 | break; | 334 | break; |
352 | default: | 335 | default: |
353 | battery->info.vscale = 1; | 336 | battery->vscale = 1; |
354 | } | 337 | } |
355 | 338 | ||
356 | switch ((specification_info & 0xf000) >> 12) { | 339 | switch ((specification_info & 0xf000) >> 12) { |
357 | case 1: | 340 | case 1: |
358 | battery->info.ipscale = 10; | 341 | battery->ipscale = 10; |
359 | break; | 342 | break; |
360 | case 2: | 343 | case 2: |
361 | battery->info.ipscale = 100; | 344 | battery->ipscale = 100; |
362 | break; | 345 | break; |
363 | case 3: | 346 | case 3: |
364 | battery->info.ipscale = 1000; | 347 | battery->ipscale = 1000; |
365 | break; | 348 | break; |
366 | default: | 349 | default: |
367 | battery->info.ipscale = 1; | 350 | battery->ipscale = 1; |
368 | } | 351 | } |
369 | 352 | ||
370 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x1c, | 353 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x1c, |
371 | (u8 *)&battery->info.serial_number); | 354 | (u8 *)&battery->serial_number); |
372 | if (result) { | 355 | if (result) { |
373 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 356 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
374 | "acpi_smbus_read() failed")); | 357 | "acpi_smbus_read() failed")); |
@@ -376,7 +359,7 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
376 | } | 359 | } |
377 | 360 | ||
378 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_BLOCK, ACPI_SB_SMBUS_ADDR, 0x20, | 361 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_BLOCK, ACPI_SB_SMBUS_ADDR, 0x20, |
379 | (u8 *)battery->info.manufacturer_name); | 362 | (u8 *)battery->manufacturer_name); |
380 | if (result) { | 363 | if (result) { |
381 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 364 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
382 | "acpi_sbs_read_str() failed")); | 365 | "acpi_sbs_read_str() failed")); |
@@ -384,7 +367,7 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
384 | } | 367 | } |
385 | 368 | ||
386 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_BLOCK, ACPI_SB_SMBUS_ADDR, 0x21, | 369 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_BLOCK, ACPI_SB_SMBUS_ADDR, 0x21, |
387 | (u8 *)battery->info.device_name); | 370 | (u8 *)battery->device_name); |
388 | if (result) { | 371 | if (result) { |
389 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 372 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
390 | "acpi_sbs_read_str() failed")); | 373 | "acpi_sbs_read_str() failed")); |
@@ -392,7 +375,7 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
392 | } | 375 | } |
393 | 376 | ||
394 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_BLOCK, ACPI_SB_SMBUS_ADDR, 0x22, | 377 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_BLOCK, ACPI_SB_SMBUS_ADDR, 0x22, |
395 | (u8 *)battery->info.device_chemistry); | 378 | (u8 *)battery->device_chemistry); |
396 | if (result) { | 379 | if (result) { |
397 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 380 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
398 | "acpi_sbs_read_str() failed")); | 381 | "acpi_sbs_read_str() failed")); |
@@ -408,7 +391,7 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
408 | int result = 0; | 391 | int result = 0; |
409 | 392 | ||
410 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x09, | 393 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x09, |
411 | (u8 *)&battery->state.voltage); | 394 | (u8 *)&battery->voltage_now); |
412 | if (result) { | 395 | if (result) { |
413 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 396 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
414 | "acpi_smbus_read() failed")); | 397 | "acpi_smbus_read() failed")); |
@@ -416,7 +399,7 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
416 | } | 399 | } |
417 | 400 | ||
418 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x0a, | 401 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x0a, |
419 | (u8 *)&battery->state.amperage); | 402 | (u8 *)&battery->current_now); |
420 | if (result) { | 403 | if (result) { |
421 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 404 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
422 | "acpi_smbus_read() failed")); | 405 | "acpi_smbus_read() failed")); |
@@ -424,7 +407,7 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
424 | } | 407 | } |
425 | 408 | ||
426 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x0f, | 409 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x0f, |
427 | (u8 *)&battery->state.remaining_capacity); | 410 | (u8 *)&battery->capacity_now); |
428 | if (result) { | 411 | if (result) { |
429 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 412 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
430 | "acpi_smbus_read() failed")); | 413 | "acpi_smbus_read() failed")); |
@@ -432,7 +415,7 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
432 | } | 415 | } |
433 | 416 | ||
434 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x16, | 417 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x16, |
435 | (u8 *)&battery->state.battery_state); | 418 | (u8 *)&battery->state); |
436 | if (result) { | 419 | if (result) { |
437 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 420 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
438 | "acpi_smbus_read() failed")); | 421 | "acpi_smbus_read() failed")); |
@@ -448,7 +431,7 @@ static int acpi_battery_get_alarm(struct acpi_battery *battery) | |||
448 | int result = 0; | 431 | int result = 0; |
449 | 432 | ||
450 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x01, | 433 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x01, |
451 | (u8 *)&battery->alarm.remaining_capacity); | 434 | (u8 *)&battery->alarm_capacity); |
452 | if (result) { | 435 | if (result) { |
453 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 436 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
454 | "acpi_smbus_read() failed")); | 437 | "acpi_smbus_read() failed")); |
@@ -497,8 +480,9 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery, | |||
497 | } | 480 | } |
498 | } | 481 | } |
499 | 482 | ||
500 | foo = alarm / (battery->info.capacity_mode ? 10 : 1); | 483 | foo = alarm / (battery->mode ? 10 : 1); |
501 | result = acpi_smbus_write(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x01, (u8 *)&foo, 2); | 484 | result = acpi_smbus_write(battery->sbs->hc, SMBUS_READ_WORD, ACPI_SB_SMBUS_ADDR, 0x01, |
485 | (u8 *)&foo, 2); | ||
502 | if (result) { | 486 | if (result) { |
503 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 487 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
504 | "acpi_smbus_write() failed")); | 488 | "acpi_smbus_write() failed")); |
@@ -515,25 +499,25 @@ static int acpi_battery_set_mode(struct acpi_battery *battery) | |||
515 | int result = 0; | 499 | int result = 0; |
516 | s16 battery_mode; | 500 | s16 battery_mode; |
517 | 501 | ||
518 | if (capacity_mode == DEF_CAPACITY_UNIT) { | 502 | if (mode == DEF_CAPACITY_UNIT) { |
519 | goto end; | 503 | goto end; |
520 | } | 504 | } |
521 | 505 | ||
522 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, | 506 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, |
523 | ACPI_SB_SMBUS_ADDR, 0x03, (u8 *)&battery_mode); | 507 | ACPI_SB_SMBUS_ADDR, 0x03, (u8 *)&battery_mode); |
524 | if (result) { | 508 | if (result) { |
525 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 509 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
526 | "acpi_smbus_read() failed")); | 510 | "acpi_smbus_read() failed")); |
527 | goto end; | 511 | goto end; |
528 | } | 512 | } |
529 | 513 | ||
530 | if (capacity_mode == MAH_CAPACITY_UNIT) { | 514 | if (mode == MAH_CAPACITY_UNIT) { |
531 | battery_mode &= 0x7fff; | 515 | battery_mode &= 0x7fff; |
532 | } else { | 516 | } else { |
533 | battery_mode |= 0x8000; | 517 | battery_mode |= 0x8000; |
534 | } | 518 | } |
535 | result = acpi_smbus_write(battery->sbs->hc, SMBUS_READ_WORD, | 519 | result = acpi_smbus_write(battery->sbs->hc, SMBUS_READ_WORD, |
536 | ACPI_SB_SMBUS_ADDR, 0x03, (u8 *)&battery_mode, 2); | 520 | ACPI_SB_SMBUS_ADDR, 0x03, (u8 *)&battery_mode, 2); |
537 | if (result) { | 521 | if (result) { |
538 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 522 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
539 | "acpi_smbus_write() failed")); | 523 | "acpi_smbus_write() failed")); |
@@ -541,7 +525,7 @@ static int acpi_battery_set_mode(struct acpi_battery *battery) | |||
541 | } | 525 | } |
542 | 526 | ||
543 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, | 527 | result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD, |
544 | ACPI_SB_SMBUS_ADDR, 0x03, (u8 *)&battery_mode); | 528 | ACPI_SB_SMBUS_ADDR, 0x03, (u8 *)&battery_mode); |
545 | if (result) { | 529 | if (result) { |
546 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 530 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
547 | "acpi_smbus_read() failed")); | 531 | "acpi_smbus_read() failed")); |
@@ -601,7 +585,7 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs) | |||
601 | s16 charger_status; | 585 | s16 charger_status; |
602 | 586 | ||
603 | result = acpi_smbus_read(sbs->hc, SMBUS_READ_WORD, ACPI_SBC_SMBUS_ADDR, 0x13, | 587 | result = acpi_smbus_read(sbs->hc, SMBUS_READ_WORD, ACPI_SBC_SMBUS_ADDR, 0x13, |
604 | (u8 *)&charger_status); | 588 | (u8 *)&charger_status); |
605 | 589 | ||
606 | if (result) { | 590 | if (result) { |
607 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 591 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
@@ -609,7 +593,7 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs) | |||
609 | goto end; | 593 | goto end; |
610 | } | 594 | } |
611 | 595 | ||
612 | sbs->ac.ac_present = (charger_status & 0x8000) >> 15; | 596 | sbs->charger_present = (charger_status & 0x8000) >> 15; |
613 | 597 | ||
614 | end: | 598 | end: |
615 | 599 | ||
@@ -726,30 +710,30 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) | |||
726 | } | 710 | } |
727 | } | 711 | } |
728 | 712 | ||
729 | if (battery->battery_present) { | 713 | if (battery->present) { |
730 | seq_printf(seq, "present: yes\n"); | 714 | seq_printf(seq, "present: yes\n"); |
731 | } else { | 715 | } else { |
732 | seq_printf(seq, "present: no\n"); | 716 | seq_printf(seq, "present: no\n"); |
733 | goto end; | 717 | goto end; |
734 | } | 718 | } |
735 | 719 | ||
736 | if (battery->info.capacity_mode) { | 720 | if (battery->mode) { |
737 | cscale = battery->info.vscale * battery->info.ipscale; | 721 | cscale = battery->vscale * battery->ipscale; |
738 | } else { | 722 | } else { |
739 | cscale = battery->info.ipscale; | 723 | cscale = battery->ipscale; |
740 | } | 724 | } |
741 | seq_printf(seq, "design capacity: %i%s\n", | 725 | seq_printf(seq, "design capacity: %i%s\n", |
742 | battery->info.design_capacity * cscale, | 726 | battery->design_capacity * cscale, |
743 | battery->info.capacity_mode ? "0 mWh" : " mAh"); | 727 | battery->mode ? "0 mWh" : " mAh"); |
744 | 728 | ||
745 | seq_printf(seq, "last full capacity: %i%s\n", | 729 | seq_printf(seq, "last full capacity: %i%s\n", |
746 | battery->info.full_charge_capacity * cscale, | 730 | battery->full_charge_capacity * cscale, |
747 | battery->info.capacity_mode ? "0 mWh" : " mAh"); | 731 | battery->mode ? "0 mWh" : " mAh"); |
748 | 732 | ||
749 | seq_printf(seq, "battery technology: rechargeable\n"); | 733 | seq_printf(seq, "battery technology: rechargeable\n"); |
750 | 734 | ||
751 | seq_printf(seq, "design voltage: %i mV\n", | 735 | seq_printf(seq, "design voltage: %i mV\n", |
752 | battery->info.design_voltage * battery->info.vscale); | 736 | battery->design_voltage * battery->vscale); |
753 | 737 | ||
754 | seq_printf(seq, "design capacity warning: unknown\n"); | 738 | seq_printf(seq, "design capacity warning: unknown\n"); |
755 | seq_printf(seq, "design capacity low: unknown\n"); | 739 | seq_printf(seq, "design capacity low: unknown\n"); |
@@ -757,16 +741,16 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) | |||
757 | seq_printf(seq, "capacity granularity 2: unknown\n"); | 741 | seq_printf(seq, "capacity granularity 2: unknown\n"); |
758 | 742 | ||
759 | seq_printf(seq, "model number: %s\n", | 743 | seq_printf(seq, "model number: %s\n", |
760 | battery->info.device_name); | 744 | battery->device_name); |
761 | 745 | ||
762 | seq_printf(seq, "serial number: %i\n", | 746 | seq_printf(seq, "serial number: %i\n", |
763 | battery->info.serial_number); | 747 | battery->serial_number); |
764 | 748 | ||
765 | seq_printf(seq, "battery type: %s\n", | 749 | seq_printf(seq, "battery type: %s\n", |
766 | battery->info.device_chemistry); | 750 | battery->device_chemistry); |
767 | 751 | ||
768 | seq_printf(seq, "OEM info: %s\n", | 752 | seq_printf(seq, "OEM info: %s\n", |
769 | battery->info.manufacturer_name); | 753 | battery->manufacturer_name); |
770 | 754 | ||
771 | end: | 755 | end: |
772 | 756 | ||
@@ -804,49 +788,49 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) | |||
804 | } | 788 | } |
805 | } | 789 | } |
806 | 790 | ||
807 | if (battery->battery_present) { | 791 | if (battery->present) { |
808 | seq_printf(seq, "present: yes\n"); | 792 | seq_printf(seq, "present: yes\n"); |
809 | } else { | 793 | } else { |
810 | seq_printf(seq, "present: no\n"); | 794 | seq_printf(seq, "present: no\n"); |
811 | goto end; | 795 | goto end; |
812 | } | 796 | } |
813 | 797 | ||
814 | if (battery->info.capacity_mode) { | 798 | if (battery->mode) { |
815 | cscale = battery->info.vscale * battery->info.ipscale; | 799 | cscale = battery->vscale * battery->ipscale; |
816 | } else { | 800 | } else { |
817 | cscale = battery->info.ipscale; | 801 | cscale = battery->ipscale; |
818 | } | 802 | } |
819 | 803 | ||
820 | if (battery->state.battery_state & 0x0010) { | 804 | if (battery->state & 0x0010) { |
821 | seq_printf(seq, "capacity state: critical\n"); | 805 | seq_printf(seq, "capacity state: critical\n"); |
822 | } else { | 806 | } else { |
823 | seq_printf(seq, "capacity state: ok\n"); | 807 | seq_printf(seq, "capacity state: ok\n"); |
824 | } | 808 | } |
825 | 809 | ||
826 | foo = (s16) battery->state.amperage * battery->info.ipscale; | 810 | foo = (s16) battery->current_now * battery->ipscale; |
827 | if (battery->info.capacity_mode) { | 811 | if (battery->mode) { |
828 | foo = foo * battery->info.design_voltage / 1000; | 812 | foo = foo * battery->design_voltage / 1000; |
829 | } | 813 | } |
830 | if (battery->state.amperage < 0) { | 814 | if (battery->current_now < 0) { |
831 | seq_printf(seq, "charging state: discharging\n"); | 815 | seq_printf(seq, "charging state: discharging\n"); |
832 | seq_printf(seq, "present rate: %d %s\n", | 816 | seq_printf(seq, "present rate: %d %s\n", |
833 | -foo, battery->info.capacity_mode ? "mW" : "mA"); | 817 | -foo, battery->mode ? "mW" : "mA"); |
834 | } else if (battery->state.amperage > 0) { | 818 | } else if (battery->current_now > 0) { |
835 | seq_printf(seq, "charging state: charging\n"); | 819 | seq_printf(seq, "charging state: charging\n"); |
836 | seq_printf(seq, "present rate: %d %s\n", | 820 | seq_printf(seq, "present rate: %d %s\n", |
837 | foo, battery->info.capacity_mode ? "mW" : "mA"); | 821 | foo, battery->mode ? "mW" : "mA"); |
838 | } else { | 822 | } else { |
839 | seq_printf(seq, "charging state: charged\n"); | 823 | seq_printf(seq, "charging state: charged\n"); |
840 | seq_printf(seq, "present rate: 0 %s\n", | 824 | seq_printf(seq, "present rate: 0 %s\n", |
841 | battery->info.capacity_mode ? "mW" : "mA"); | 825 | battery->mode ? "mW" : "mA"); |
842 | } | 826 | } |
843 | 827 | ||
844 | seq_printf(seq, "remaining capacity: %i%s\n", | 828 | seq_printf(seq, "remaining capacity: %i%s\n", |
845 | battery->state.remaining_capacity * cscale, | 829 | battery->capacity_now * cscale, |
846 | battery->info.capacity_mode ? "0 mWh" : " mAh"); | 830 | battery->mode ? "0 mWh" : " mAh"); |
847 | 831 | ||
848 | seq_printf(seq, "present voltage: %i mV\n", | 832 | seq_printf(seq, "present voltage: %i mV\n", |
849 | battery->state.voltage * battery->info.vscale); | 833 | battery->voltage_now * battery->vscale); |
850 | 834 | ||
851 | end: | 835 | end: |
852 | 836 | ||
@@ -883,22 +867,22 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) | |||
883 | } | 867 | } |
884 | } | 868 | } |
885 | 869 | ||
886 | if (!battery->battery_present) { | 870 | if (!battery->present) { |
887 | seq_printf(seq, "present: no\n"); | 871 | seq_printf(seq, "present: no\n"); |
888 | goto end; | 872 | goto end; |
889 | } | 873 | } |
890 | 874 | ||
891 | if (battery->info.capacity_mode) { | 875 | if (battery->mode) { |
892 | cscale = battery->info.vscale * battery->info.ipscale; | 876 | cscale = battery->vscale * battery->ipscale; |
893 | } else { | 877 | } else { |
894 | cscale = battery->info.ipscale; | 878 | cscale = battery->ipscale; |
895 | } | 879 | } |
896 | 880 | ||
897 | seq_printf(seq, "alarm: "); | 881 | seq_printf(seq, "alarm: "); |
898 | if (battery->alarm.remaining_capacity) { | 882 | if (battery->alarm_capacity) { |
899 | seq_printf(seq, "%i%s\n", | 883 | seq_printf(seq, "%i%s\n", |
900 | battery->alarm.remaining_capacity * cscale, | 884 | battery->alarm_capacity * cscale, |
901 | battery->info.capacity_mode ? "0 mWh" : " mAh"); | 885 | battery->mode ? "0 mWh" : " mAh"); |
902 | } else { | 886 | } else { |
903 | seq_printf(seq, "disabled\n"); | 887 | seq_printf(seq, "disabled\n"); |
904 | } | 888 | } |
@@ -928,7 +912,7 @@ acpi_battery_write_alarm(struct file *file, const char __user * buffer, | |||
928 | if (result) | 912 | if (result) |
929 | goto end; | 913 | goto end; |
930 | 914 | ||
931 | if (!battery->battery_present) { | 915 | if (!battery->present) { |
932 | result = -ENODEV; | 916 | result = -ENODEV; |
933 | goto end; | 917 | goto end; |
934 | } | 918 | } |
@@ -945,7 +929,7 @@ acpi_battery_write_alarm(struct file *file, const char __user * buffer, | |||
945 | 929 | ||
946 | alarm_string[count] = 0; | 930 | alarm_string[count] = 0; |
947 | 931 | ||
948 | old_alarm = battery->alarm.remaining_capacity; | 932 | old_alarm = battery->alarm_capacity; |
949 | new_alarm = simple_strtoul(alarm_string, NULL, 0); | 933 | new_alarm = simple_strtoul(alarm_string, NULL, 0); |
950 | 934 | ||
951 | result = acpi_battery_set_alarm(battery, new_alarm); | 935 | result = acpi_battery_set_alarm(battery, new_alarm); |
@@ -1025,7 +1009,7 @@ static int acpi_ac_read_state(struct seq_file *seq, void *offset) | |||
1025 | } | 1009 | } |
1026 | 1010 | ||
1027 | seq_printf(seq, "state: %s\n", | 1011 | seq_printf(seq, "state: %s\n", |
1028 | sbs->ac.ac_present ? "on-line" : "off-line"); | 1012 | sbs->charger_present ? "on-line" : "off-line"); |
1029 | 1013 | ||
1030 | sbs_mutex_unlock(sbs); | 1014 | sbs_mutex_unlock(sbs); |
1031 | 1015 | ||
@@ -1080,7 +1064,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
1080 | goto end; | 1064 | goto end; |
1081 | } | 1065 | } |
1082 | 1066 | ||
1083 | is_present = battery->battery_present; | 1067 | is_present = battery->present; |
1084 | 1068 | ||
1085 | if (is_present) { | 1069 | if (is_present) { |
1086 | result = acpi_battery_init(battery); | 1070 | result = acpi_battery_init(battery); |
@@ -1094,7 +1078,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
1094 | 1078 | ||
1095 | sprintf(dir_name, ACPI_BATTERY_DIR_NAME, id); | 1079 | sprintf(dir_name, ACPI_BATTERY_DIR_NAME, id); |
1096 | 1080 | ||
1097 | result = acpi_sbs_generic_add_fs(&battery->battery_entry, | 1081 | result = acpi_sbs_generic_add_fs(&battery->proc_entry, |
1098 | acpi_battery_dir, | 1082 | acpi_battery_dir, |
1099 | dir_name, | 1083 | dir_name, |
1100 | &acpi_battery_info_fops, | 1084 | &acpi_battery_info_fops, |
@@ -1109,7 +1093,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
1109 | 1093 | ||
1110 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", | 1094 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", |
1111 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), dir_name, | 1095 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), dir_name, |
1112 | sbs->battery->battery_present ? "present" : "absent"); | 1096 | sbs->battery->present ? "present" : "absent"); |
1113 | 1097 | ||
1114 | end: | 1098 | end: |
1115 | return result; | 1099 | return result; |
@@ -1118,8 +1102,8 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
1118 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) | 1102 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) |
1119 | { | 1103 | { |
1120 | 1104 | ||
1121 | if (sbs->battery[id].battery_entry) { | 1105 | if (sbs->battery[id].proc_entry) { |
1122 | acpi_sbs_generic_remove_fs(&(sbs->battery[id].battery_entry), | 1106 | acpi_sbs_generic_remove_fs(&(sbs->battery[id].proc_entry), |
1123 | acpi_battery_dir); | 1107 | acpi_battery_dir); |
1124 | } | 1108 | } |
1125 | } | 1109 | } |
@@ -1147,7 +1131,7 @@ static int acpi_ac_add(struct acpi_sbs *sbs) | |||
1147 | 1131 | ||
1148 | printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n", | 1132 | printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n", |
1149 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), | 1133 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), |
1150 | ACPI_AC_DIR_NAME, sbs->ac.ac_present ? "on-line" : "off-line"); | 1134 | ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line"); |
1151 | 1135 | ||
1152 | end: | 1136 | end: |
1153 | 1137 | ||
@@ -1172,9 +1156,9 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type) | |||
1172 | struct acpi_battery *battery; | 1156 | struct acpi_battery *battery; |
1173 | int result = 0, cnt; | 1157 | int result = 0, cnt; |
1174 | int old_ac_present = -1; | 1158 | int old_ac_present = -1; |
1175 | int old_battery_present = -1; | 1159 | int old_present = -1; |
1176 | int new_ac_present = -1; | 1160 | int new_ac_present = -1; |
1177 | int new_battery_present = -1; | 1161 | int new_present = -1; |
1178 | int id_min = 0, id_max = MAX_SBS_BAT - 1; | 1162 | int id_min = 0, id_max = MAX_SBS_BAT - 1; |
1179 | char dir_name[32]; | 1163 | char dir_name[32]; |
1180 | int do_battery_init = 0, do_ac_init = 0; | 1164 | int do_battery_init = 0, do_ac_init = 0; |
@@ -1199,7 +1183,11 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type) | |||
1199 | 1183 | ||
1200 | sbs->run_cnt++; | 1184 | sbs->run_cnt++; |
1201 | 1185 | ||
1202 | old_ac_present = sbs->ac.ac_present; | 1186 | if (!update_battery) { |
1187 | goto end; | ||
1188 | } | ||
1189 | |||
1190 | old_ac_present = sbs->charger_present; | ||
1203 | 1191 | ||
1204 | result = acpi_ac_get_present(sbs); | 1192 | result = acpi_ac_get_present(sbs); |
1205 | if (result) { | 1193 | if (result) { |
@@ -1207,7 +1195,7 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type) | |||
1207 | "acpi_ac_get_present() failed")); | 1195 | "acpi_ac_get_present() failed")); |
1208 | } | 1196 | } |
1209 | 1197 | ||
1210 | new_ac_present = sbs->ac.ac_present; | 1198 | new_ac_present = sbs->charger_present; |
1211 | 1199 | ||
1212 | do_ac_init = (old_ac_present != new_ac_present); | 1200 | do_ac_init = (old_ac_present != new_ac_present); |
1213 | if (sbs->run_cnt == 1 && data_type == DATA_TYPE_COMMON) { | 1201 | if (sbs->run_cnt == 1 && data_type == DATA_TYPE_COMMON) { |
@@ -1244,9 +1232,9 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type) | |||
1244 | continue; | 1232 | continue; |
1245 | } | 1233 | } |
1246 | 1234 | ||
1247 | old_remaining_capacity = battery->state.remaining_capacity; | 1235 | old_remaining_capacity = battery->capacity_now; |
1248 | 1236 | ||
1249 | old_battery_present = battery->battery_present; | 1237 | old_present = battery->present; |
1250 | 1238 | ||
1251 | result = acpi_battery_select(battery); | 1239 | result = acpi_battery_select(battery); |
1252 | if (result) { | 1240 | if (result) { |
@@ -1260,11 +1248,11 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type) | |||
1260 | "acpi_battery_get_present() failed")); | 1248 | "acpi_battery_get_present() failed")); |
1261 | } | 1249 | } |
1262 | 1250 | ||
1263 | new_battery_present = battery->battery_present; | 1251 | new_present = battery->present; |
1264 | 1252 | ||
1265 | do_battery_init = ((old_battery_present != new_battery_present) | 1253 | do_battery_init = ((old_present != new_present) |
1266 | && new_battery_present); | 1254 | && new_present); |
1267 | if (!new_battery_present) | 1255 | if (!new_present) |
1268 | goto event; | 1256 | goto event; |
1269 | if (do_ac_init || do_battery_init) { | 1257 | if (do_ac_init || do_battery_init) { |
1270 | result = acpi_battery_init(battery); | 1258 | result = acpi_battery_init(battery); |
@@ -1280,7 +1268,7 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type) | |||
1280 | 1268 | ||
1281 | if ((data_type == DATA_TYPE_COMMON | 1269 | if ((data_type == DATA_TYPE_COMMON |
1282 | || data_type == DATA_TYPE_INFO) | 1270 | || data_type == DATA_TYPE_INFO) |
1283 | && new_battery_present) { | 1271 | && new_present) { |
1284 | result = acpi_battery_get_info(battery); | 1272 | result = acpi_battery_get_info(battery); |
1285 | if (result) { | 1273 | if (result) { |
1286 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 1274 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
@@ -1296,7 +1284,7 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type) | |||
1296 | 1284 | ||
1297 | if ((data_type == DATA_TYPE_COMMON | 1285 | if ((data_type == DATA_TYPE_COMMON |
1298 | || data_type == DATA_TYPE_STATE) | 1286 | || data_type == DATA_TYPE_STATE) |
1299 | && new_battery_present) { | 1287 | && new_present) { |
1300 | result = acpi_battery_get_state(battery); | 1288 | result = acpi_battery_get_state(battery); |
1301 | if (result) { | 1289 | if (result) { |
1302 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 1290 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
@@ -1312,7 +1300,7 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type) | |||
1312 | 1300 | ||
1313 | if ((data_type == DATA_TYPE_COMMON | 1301 | if ((data_type == DATA_TYPE_COMMON |
1314 | || data_type == DATA_TYPE_ALARM) | 1302 | || data_type == DATA_TYPE_ALARM) |
1315 | && new_battery_present) { | 1303 | && new_present) { |
1316 | result = acpi_battery_get_alarm(battery); | 1304 | result = acpi_battery_get_alarm(battery); |
1317 | if (result) { | 1305 | if (result) { |
1318 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 1306 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
@@ -1329,17 +1317,17 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type) | |||
1329 | 1317 | ||
1330 | event: | 1318 | event: |
1331 | 1319 | ||
1332 | if (old_battery_present != new_battery_present || do_ac_init || | 1320 | if (old_present != new_present || do_ac_init || |
1333 | old_remaining_capacity != | 1321 | old_remaining_capacity != |
1334 | battery->state.remaining_capacity) { | 1322 | battery->capacity_now) { |
1335 | sprintf(dir_name, ACPI_BATTERY_DIR_NAME, id); | 1323 | sprintf(dir_name, ACPI_BATTERY_DIR_NAME, id); |
1336 | result = acpi_bus_generate_proc_event4(ACPI_BATTERY_CLASS, | 1324 | result = acpi_bus_generate_proc_event4(ACPI_BATTERY_CLASS, |
1337 | dir_name, | 1325 | dir_name, |
1338 | ACPI_SBS_BATTERY_NOTIFY_STATUS, | 1326 | ACPI_SBS_BATTERY_NOTIFY_STATUS, |
1339 | new_battery_present); | 1327 | new_present); |
1340 | acpi_bus_generate_netlink_event(ACPI_BATTERY_CLASS, dir_name, | 1328 | acpi_bus_generate_netlink_event(ACPI_BATTERY_CLASS, dir_name, |
1341 | ACPI_SBS_BATTERY_NOTIFY_STATUS, | 1329 | ACPI_SBS_BATTERY_NOTIFY_STATUS, |
1342 | new_battery_present); | 1330 | new_present); |
1343 | if (result) { | 1331 | if (result) { |
1344 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 1332 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
1345 | "acpi_bus_generate_proc_event4() " | 1333 | "acpi_bus_generate_proc_event4() " |
@@ -1426,7 +1414,7 @@ static int acpi_sbs_add(struct acpi_device *device) | |||
1426 | 1414 | ||
1427 | acpi_sbsm_get_info(sbs); | 1415 | acpi_sbsm_get_info(sbs); |
1428 | 1416 | ||
1429 | if (!sbs->sbsm_present) { | 1417 | if (!sbs->manager_present) { |
1430 | result = acpi_battery_add(sbs, 0); | 1418 | result = acpi_battery_add(sbs, 0); |
1431 | if (result) { | 1419 | if (result) { |
1432 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 1420 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
@@ -1435,7 +1423,7 @@ static int acpi_sbs_add(struct acpi_device *device) | |||
1435 | } | 1423 | } |
1436 | } else { | 1424 | } else { |
1437 | for (id = 0; id < MAX_SBS_BAT; id++) { | 1425 | for (id = 0; id < MAX_SBS_BAT; id++) { |
1438 | if ((sbs->sbsm_batteries_supported & (1 << id))) { | 1426 | if ((sbs->batteries_supported & (1 << id))) { |
1439 | result = acpi_battery_add(sbs, id); | 1427 | result = acpi_battery_add(sbs, id); |
1440 | if (result) { | 1428 | if (result) { |
1441 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 1429 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
@@ -1535,11 +1523,11 @@ static int __init acpi_sbs_init(void) | |||
1535 | if (acpi_disabled) | 1523 | if (acpi_disabled) |
1536 | return -ENODEV; | 1524 | return -ENODEV; |
1537 | 1525 | ||
1538 | if (capacity_mode != DEF_CAPACITY_UNIT | 1526 | if (mode != DEF_CAPACITY_UNIT |
1539 | && capacity_mode != MAH_CAPACITY_UNIT | 1527 | && mode != MAH_CAPACITY_UNIT |
1540 | && capacity_mode != MWH_CAPACITY_UNIT) { | 1528 | && mode != MWH_CAPACITY_UNIT) { |
1541 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 1529 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
1542 | "invalid capacity_mode = %d", capacity_mode)); | 1530 | "invalid mode = %d", mode)); |
1543 | return -EINVAL; | 1531 | return -EINVAL; |
1544 | } | 1532 | } |
1545 | 1533 | ||