LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [patch 36/43] ppc64: AC Power handling broken for desktops
@ 2005-10-29  0:46 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2005-10-29  0:46 UTC (permalink / raw)
  To: paulus; +Cc: akpm, linuxppc-dev, olh, linuxppc64-dev


From: Olaf Hering <olh@suse.de>

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: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/macintosh/apm_emu.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff -puN drivers/macintosh/apm_emu.c~ppc64-ac-power-handling-broken-for-desktops drivers/macintosh/apm_emu.c
--- devel/drivers/macintosh/apm_emu.c~ppc64-ac-power-handling-broken-for-desktops	2005-10-28 17:44:04.000000000 -0700
+++ devel-akpm/drivers/macintosh/apm_emu.c	2005-10-28 17:44:04.000000000 -0700
@@ -430,8 +430,8 @@ static int apm_emu_get_info(char *buf, c
 	      -1: Unknown
 	   8) min = minutes; sec = seconds */
 
-	unsigned short  ac_line_status = 0xff;
-	unsigned short  battery_status = 0xff;
+	unsigned short  ac_line_status;
+	unsigned short  battery_status = 0;
 	unsigned short  battery_flag   = 0xff;
 	int		percentage     = -1;
 	int             time_units     = -1;
@@ -446,6 +446,7 @@ static int apm_emu_get_info(char *buf, c
 	ac_line_status = ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0);
 	for (i=0; i<pmu_battery_count; i++) {
 		if (pmu_batteries[i].flags & PMU_BATT_PRESENT) {
+			battery_status++;
 			if (percentage < 0)
 				percentage = 0;
 			if (charge < 0)
@@ -461,6 +462,9 @@ static int apm_emu_get_info(char *buf, c
 				charging++;
 		}
 	}
+	if (0 == battery_status)
+		ac_line_status = 1;
+	battery_status = 0xff;
 	if (real_count) {
 		if (amperage < 0) {
 			if (btype == PMU_BATT_TYPE_SMART)
_

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-10-29  0:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-29  0:46 [patch 36/43] ppc64: AC Power handling broken for desktops akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox