Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] ppc64: AC Power handling broken for desktops

Currently, AC Power is 0 on a desktop G4. No batteries present should mean
AC Power == 1.

Signed-off-by: Olaf Hering <olh@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by

Olaf Hering and committed by
Paul Mackerras
08124f95 7e658118

+6 -2
+6 -2
drivers/macintosh/apm_emu.c
··· 430 430 -1: Unknown 431 431 8) min = minutes; sec = seconds */ 432 432 433 - unsigned short ac_line_status = 0xff; 434 - unsigned short battery_status = 0xff; 433 + unsigned short ac_line_status; 434 + unsigned short battery_status = 0; 435 435 unsigned short battery_flag = 0xff; 436 436 int percentage = -1; 437 437 int time_units = -1; ··· 446 446 ac_line_status = ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0); 447 447 for (i=0; i<pmu_battery_count; i++) { 448 448 if (pmu_batteries[i].flags & PMU_BATT_PRESENT) { 449 + battery_status++; 449 450 if (percentage < 0) 450 451 percentage = 0; 451 452 if (charge < 0) ··· 462 461 charging++; 463 462 } 464 463 } 464 + if (0 == battery_status) 465 + ac_line_status = 1; 466 + battery_status = 0xff; 465 467 if (real_count) { 466 468 if (amperage < 0) { 467 469 if (btype == PMU_BATT_TYPE_SMART)