public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Garrett <mjg59@srcf.ucam.org>
To: linux-pm@lists.osdl.org, linux-kernel@vger.kernel.org,
	sfr@canb.auug.org.au
Subject: [PATCH, RFC] [3/3] APM support for generic in-kernel AC status
Date: Wed, 8 Feb 2006 13:05:43 +0000	[thread overview]
Message-ID: <20060208130543.GC25659@srcf.ucam.org> (raw)
In-Reply-To: <20060208130422.GB25659@srcf.ucam.org>

This adds APM support for the generic in-kernel AC status code.

Signed-Off-By: Matthew Garrett <mjg59@srcf.ucam.org>

diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index 6c8e483..e63f533 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -1627,6 +1627,18 @@ static int do_open(struct inode * inode,
 	return 0;
 }
 
+static int apm_get_online_status(void)
+{
+	unsigned short bx;
+	unsigned short cx;
+	unsigned short dx;
+
+	if (apm_get_power_status(&bx, &cx, &dx))
+		return 0;
+	
+	return ((bx >> 8) & 0xff);
+};
+
 static int apm_get_info(char *buf, char **start, off_t fpos, int length)
 {
 	char *		p;
@@ -2372,6 +2384,8 @@ static int __init apm_init(void)
 
 	misc_register(&apm_device);
 
+	pm_set_ac_status(apm_get_online_status);
+
 	if (HZ != 100)
 		idle_period = (idle_period * HZ) / 100;
 	if (idle_threshold < 100) {
@@ -2396,6 +2410,9 @@ static void __exit apm_exit(void)
 		 */
 		cpu_idle_wait();
 	}
+
+	pm_set_ac_status(NULL);
+
 	if (((apm_info.bios.flags & APM_BIOS_DISENGAGED) == 0)
 	    && (apm_info.connection_version > 0x0100)) {
 		error = apm_engage_power_management(APM_DEVICE_ALL, 0);

-- 
Matthew Garrett | mjg59@srcf.ucam.org

  reply	other threads:[~2006-02-08 13:05 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-08 12:57 [PATCH, RFC] [1/3] Generic in-kernel AC status Matthew Garrett
2006-02-08 13:03 ` [PATCH, RFC] [2/3] ACPI support for generic " Matthew Garrett
2006-02-08 13:04 ` [PATCH, RFC] [1/3] Generic " Matthew Garrett
2006-02-08 13:05   ` Matthew Garrett [this message]
2006-02-08 16:58   ` [linux-pm] " Greg KH
2006-02-08 17:08     ` Matthew Garrett
2006-02-08 17:16       ` Greg KH
2006-02-08 17:49         ` Matthew Garrett
2006-02-09  5:46           ` Greg KH
2006-02-09  8:53       ` Gabor Gombas
2006-02-10 12:21         ` Pavel Machek
2006-02-10 13:13           ` Gabor Gombas
2006-02-10 13:19             ` Matthew Garrett
2006-02-10 13:54             ` Pavel Machek
2006-02-10 13:56               ` Gabor Gombas
2006-02-08 22:25   ` Philipp Matthias Hahn
2006-02-10 12:21     ` Pavel Machek
2006-02-10  8:06 ` Stefan Seyfried
2006-02-10 12:19   ` Pavel Machek
2006-02-10 12:32     ` Stefan Seyfried
2006-02-10 13:46       ` Pavel Machek
2006-02-12 10:17         ` Jan Engelhardt
2006-02-12 11:27           ` Kyle Moffett
2006-02-14 17:44     ` Thomas Renninger
2006-02-14 20:17       ` Rafael J. Wysocki
2006-02-15 12:36         ` Thomas Renninger
2006-02-15 12:47           ` Matthew Garrett
2006-02-15 15:04             ` Thomas Renninger
2006-02-16 22:44           ` Pavel Machek
2006-02-16 22:39         ` Pavel Machek

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=20060208130543.GC25659@srcf.ucam.org \
    --to=mjg59@srcf.ucam.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.osdl.org \
    --cc=sfr@canb.auug.org.au \
    /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