From: Olaf Hering <olh@suse.de>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: AC Power handling broken for desktops
Date: Fri, 26 Aug 2005 13:38:27 +0200 [thread overview]
Message-ID: <20050826113827.GA25134@suse.de> (raw)
In-Reply-To: <1124948071.7907.10.camel@gaston>
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<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)
next prev parent reply other threads:[~2005-08-26 11:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-24 11:54 AC Power handling broken for desktops Olaf Hering
2005-08-24 22:32 ` Benjamin Herrenschmidt
2005-08-25 4:51 ` Olaf Hering
2005-08-25 5:08 ` Benjamin Herrenschmidt
2005-08-25 5:15 ` Olaf Hering
2005-08-25 5:34 ` Benjamin Herrenschmidt
2005-08-26 11:38 ` Olaf Hering [this message]
2005-09-19 0:44 ` Benjamin Herrenschmidt
2005-10-10 17:08 ` [PATCH] " Olaf Hering
2005-08-25 15:10 ` Segher Boessenkool
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050826113827.GA25134@suse.de \
--to=olh@suse.de \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).