diff options
Diffstat (limited to 'drivers/acpi/glue.c')
-rw-r--r-- | drivers/acpi/glue.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 7b6c9ff9bebe..4334c208841a 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -241,3 +241,65 @@ static int __init init_acpi_device_notify(void) | |||
241 | } | 241 | } |
242 | 242 | ||
243 | arch_initcall(init_acpi_device_notify); | 243 | arch_initcall(init_acpi_device_notify); |
244 | |||
245 | |||
246 | #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) | ||
247 | |||
248 | /* Every ACPI platform has a mc146818 compatible "cmos rtc". Here we find | ||
249 | * its device node and pass extra config data. This helps its driver use | ||
250 | * capabilities that the now-obsolete mc146818 didn't have, and informs it | ||
251 | * that this board's RTC is wakeup-capable (per ACPI spec). | ||
252 | */ | ||
253 | #include <linux/mc146818rtc.h> | ||
254 | |||
255 | static struct cmos_rtc_board_info rtc_info; | ||
256 | |||
257 | |||
258 | /* PNP devices are registered in a subsys_initcall(); | ||
259 | * ACPI specifies the PNP IDs to use. | ||
260 | */ | ||
261 | #include <linux/pnp.h> | ||
262 | |||
263 | static int __init pnp_match(struct device *dev, void *data) | ||
264 | { | ||
265 | static const char *ids[] = { "PNP0b00", "PNP0b01", "PNP0b02", }; | ||
266 | struct pnp_dev *pnp = to_pnp_dev(dev); | ||
267 | int i; | ||
268 | |||
269 | for (i = 0; i < ARRAY_SIZE(ids); i++) { | ||
270 | if (compare_pnp_id(pnp->id, ids[i]) != 0) | ||
271 | return 1; | ||
272 | } | ||
273 | return 0; | ||
274 | } | ||
275 | |||
276 | static struct device *__init get_rtc_dev(void) | ||
277 | { | ||
278 | return bus_find_device(&pnp_bus_type, NULL, NULL, pnp_match); | ||
279 | } | ||
280 | |||
281 | static int __init acpi_rtc_init(void) | ||
282 | { | ||
283 | struct device *dev = get_rtc_dev(); | ||
284 | |||
285 | if (dev) { | ||
286 | rtc_info.rtc_day_alarm = acpi_gbl_FADT.day_alarm; | ||
287 | rtc_info.rtc_mon_alarm = acpi_gbl_FADT.month_alarm; | ||
288 | rtc_info.rtc_century = acpi_gbl_FADT.century; | ||
289 | |||
290 | /* NOTE: acpi_gbl_FADT->rtcs4 is NOT currently useful */ | ||
291 | |||
292 | dev->platform_data = &rtc_info; | ||
293 | |||
294 | /* RTC always wakes from S1/S2/S3, and often S4/STD */ | ||
295 | device_init_wakeup(dev, 1); | ||
296 | |||
297 | put_device(dev); | ||
298 | } else | ||
299 | pr_debug("ACPI: RTC unavailable?\n"); | ||
300 | return 0; | ||
301 | } | ||
302 | /* do this between RTC subsys_initcall() and rtc_cmos driver_initcall() */ | ||
303 | fs_initcall(acpi_rtc_init); | ||
304 | |||
305 | #endif | ||