aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/Kconfig2
-rw-r--r--drivers/acpi/glue.c112
2 files changed, 1 insertions, 113 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 12cf5d491f0d..da49b006bcc5 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -259,7 +259,7 @@ config ACPI_ASUS
259 259
260config ACPI_TOSHIBA 260config ACPI_TOSHIBA
261 tristate "Toshiba Laptop Extras" 261 tristate "Toshiba Laptop Extras"
262 depends on X86 262 depends on X86 && INPUT
263 select INPUT_POLLDEV 263 select INPUT_POLLDEV
264 select NET 264 select NET
265 select RFKILL 265 select RFKILL
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 3c578ef78c48..24649ada08df 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -260,115 +260,3 @@ static int __init init_acpi_device_notify(void)
260} 260}
261 261
262arch_initcall(init_acpi_device_notify); 262arch_initcall(init_acpi_device_notify);
263
264
265#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE)
266
267#ifdef CONFIG_PM
268static u32 rtc_handler(void *context)
269{
270 acpi_clear_event(ACPI_EVENT_RTC);
271 acpi_disable_event(ACPI_EVENT_RTC, 0);
272 return ACPI_INTERRUPT_HANDLED;
273}
274
275static inline void rtc_wake_setup(void)
276{
277 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL);
278 /*
279 * After the RTC handler is installed, the Fixed_RTC event should
280 * be disabled. Only when the RTC alarm is set will it be enabled.
281 */
282 acpi_clear_event(ACPI_EVENT_RTC);
283 acpi_disable_event(ACPI_EVENT_RTC, 0);
284}
285
286static void rtc_wake_on(struct device *dev)
287{
288 acpi_clear_event(ACPI_EVENT_RTC);
289 acpi_enable_event(ACPI_EVENT_RTC, 0);
290}
291
292static void rtc_wake_off(struct device *dev)
293{
294 acpi_disable_event(ACPI_EVENT_RTC, 0);
295}
296#else
297#define rtc_wake_setup() do{}while(0)
298#define rtc_wake_on NULL
299#define rtc_wake_off NULL
300#endif
301
302/* Every ACPI platform has a mc146818 compatible "cmos rtc". Here we find
303 * its device node and pass extra config data. This helps its driver use
304 * capabilities that the now-obsolete mc146818 didn't have, and informs it
305 * that this board's RTC is wakeup-capable (per ACPI spec).
306 */
307#include <linux/mc146818rtc.h>
308
309static struct cmos_rtc_board_info rtc_info;
310
311
312/* PNP devices are registered in a subsys_initcall();
313 * ACPI specifies the PNP IDs to use.
314 */
315#include <linux/pnp.h>
316
317static int __init pnp_match(struct device *dev, void *data)
318{
319 static const char *ids[] = { "PNP0b00", "PNP0b01", "PNP0b02", };
320 struct pnp_dev *pnp = to_pnp_dev(dev);
321 int i;
322
323 for (i = 0; i < ARRAY_SIZE(ids); i++) {
324 if (compare_pnp_id(pnp->id, ids[i]) != 0)
325 return 1;
326 }
327 return 0;
328}
329
330static struct device *__init get_rtc_dev(void)
331{
332 return bus_find_device(&pnp_bus_type, NULL, NULL, pnp_match);
333}
334
335static int __init acpi_rtc_init(void)
336{
337 struct device *dev = get_rtc_dev();
338
339 if (acpi_disabled)
340 return 0;
341
342 if (dev) {
343 rtc_wake_setup();
344 rtc_info.wake_on = rtc_wake_on;
345 rtc_info.wake_off = rtc_wake_off;
346
347 /* workaround bug in some ACPI tables */
348 if (acpi_gbl_FADT.month_alarm && !acpi_gbl_FADT.day_alarm) {
349 DBG("bogus FADT month_alarm\n");
350 acpi_gbl_FADT.month_alarm = 0;
351 }
352
353 rtc_info.rtc_day_alarm = acpi_gbl_FADT.day_alarm;
354 rtc_info.rtc_mon_alarm = acpi_gbl_FADT.month_alarm;
355 rtc_info.rtc_century = acpi_gbl_FADT.century;
356
357 /* NOTE: S4_RTC_WAKE is NOT currently useful to Linux */
358 if (acpi_gbl_FADT.flags & ACPI_FADT_S4_RTC_WAKE)
359 printk(PREFIX "RTC can wake from S4\n");
360
361
362 dev->platform_data = &rtc_info;
363
364 /* RTC always wakes from S1/S2/S3, and often S4/STD */
365 device_init_wakeup(dev, 1);
366
367 put_device(dev);
368 } else
369 DBG("RTC unavailable?\n");
370 return 0;
371}
372module_init(acpi_rtc_init);
373
374#endif