This adds APM support for the generic in-kernel AC status code. Signed-Off-By: Matthew Garrett <mjg59@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx