linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Grimm <matthiasgrimm@users.sourceforge.net>
To: linuxppc-dev@lists.linuxppc.org
Subject: [BUG] Problem in via-pmu.c, various kernel versions
Date: Sun, 8 Aug 2004 14:34:50 +0200	[thread overview]
Message-ID: <200408081434.50582.matthiasgrimm@users.sourceforge.net> (raw)


Hi,
The current pmu driver have a problem with detecting AC-Power.

The following code snippet shows that the battery states will only be updated
if TICK interrupts are received. The AC power flags will be taken from the
battery request answered by the PMU (see done_battery_state_ohare() and
done_battery_state_smart() ).

--- code snippet from via-pmu.c, kernel 2.6.7 ---

	/* Tick interrupt */
	else if ((1 << pirq) & PMU_INT_TICK) {
#ifdef CONFIG_PMAC_PBOOK
		/* Environement or tick interrupt, query batteries */
		if (pmu_battery_count) {
			if ((--query_batt_timer) == 0) {
				query_battery_state();
				query_batt_timer = BATTERY_POLLING_COUNT;
----

On my Powerbook G3 (Pismo) there won't be any TICK interrupts if it is running
on AC only (No batteries plugged in). Therefore neither the battery states
nor the AC power flags will be updated in this case.

This leads to incorrect power flags under following circumstances:
Machine runs on battery, put machine to sleep, connect AC plug, remove
battery, wakeup machine -> AC flag in /proc/pmu/info  still signals 'running
on battery'.

The same problem occur if the machine boots without batteries plugged in: the
AC flag is false.

My recommendations:
- update battery states independently from TICK or environment interrupts on a
regular time basis or
- distangle battery states and power flags. You could get the power flags also
with the PMU_GET_COVER request (only tested on PBG3 Pismo yet). Let the
battery states bounded to TICK interrupts but update the power flags on a
regular tiime basis.

  Best Regards
     Matthias

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

                 reply	other threads:[~2004-08-08 12:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200408081434.50582.matthiasgrimm@users.sourceforge.net \
    --to=matthiasgrimm@users.sourceforge.net \
    --cc=linuxppc-dev@lists.linuxppc.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).