From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.suse.de (ns.suse.de [195.135.220.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx1.suse.de", Issuer "Thawte Premium Server CA" (verified OK)) by ozlabs.org (Postfix) with ESMTP id DE96368033 for ; Fri, 26 Aug 2005 21:38:32 +1000 (EST) Date: Fri, 26 Aug 2005 13:38:27 +0200 From: Olaf Hering To: Benjamin Herrenschmidt Message-ID: <20050826113827.GA25134@suse.de> References: <20050824115452.GA29148@suse.de> <1124922771.5159.134.camel@gaston> <20050825045108.GA19792@suse.de> <1124946481.7906.8.camel@gaston> <20050825051528.GB19792@suse.de> <1124948071.7907.10.camel@gaston> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 In-Reply-To: <1124948071.7907.10.camel@gaston> Cc: linuxppc-dev@ozlabs.org Subject: Re: AC Power handling broken for desktops List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Thu, Aug 25, Benjamin Herrenschmidt wrote: > On Thu, 2005-08-25 at 07:15 +0200, Olaf Hering wrote: > > On Thu, Aug 25, Benjamin Herrenschmidt wrote: > > > > > Not sure :) I don't fully know how to decode those power things in the > > > device-tree... There are bits in darwin tho. > > > > Maybe just check for !PowerBook and force PMU_PWR_AC_PRESENT in this case. > > Yah, you can check that with pmac_feature, there is a "mobile" flag. Its not obvious how to get to that flag. Is this patch acceptable? No batteries present should mean AC Power == 1. drivers/macintosh/apm_emu.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) Index: linux-2.6.13-rc7-ac-power/drivers/macintosh/apm_emu.c =================================================================== --- linux-2.6.13-rc7-ac-power.orig/drivers/macintosh/apm_emu.c +++ linux-2.6.13-rc7-ac-power/drivers/macintosh/apm_emu.c @@ -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