Commit 08124f95 authored by Olaf Hering's avatar Olaf Hering Committed by Paul Mackerras

[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: default avatarOlaf Hering <olh@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 7e658118
...@@ -430,8 +430,8 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length) ...@@ -430,8 +430,8 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length)
-1: Unknown -1: Unknown
8) min = minutes; sec = seconds */ 8) min = minutes; sec = seconds */
unsigned short ac_line_status = 0xff; unsigned short ac_line_status;
unsigned short battery_status = 0xff; unsigned short battery_status = 0;
unsigned short battery_flag = 0xff; unsigned short battery_flag = 0xff;
int percentage = -1; int percentage = -1;
int time_units = -1; int time_units = -1;
...@@ -446,6 +446,7 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length) ...@@ -446,6 +446,7 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length)
ac_line_status = ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0); ac_line_status = ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0);
for (i=0; i<pmu_battery_count; i++) { for (i=0; i<pmu_battery_count; i++) {
if (pmu_batteries[i].flags & PMU_BATT_PRESENT) { if (pmu_batteries[i].flags & PMU_BATT_PRESENT) {
battery_status++;
if (percentage < 0) if (percentage < 0)
percentage = 0; percentage = 0;
if (charge < 0) if (charge < 0)
...@@ -461,6 +462,9 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length) ...@@ -461,6 +462,9 @@ static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length)
charging++; charging++;
} }
} }
if (0 == battery_status)
ac_line_status = 1;
battery_status = 0xff;
if (real_count) { if (real_count) {
if (amperage < 0) { if (amperage < 0) {
if (btype == PMU_BATT_TYPE_SMART) if (btype == PMU_BATT_TYPE_SMART)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment