Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 48662
b: refs/heads/master
c: a74388e
h: refs/heads/master
v: v3
  • Loading branch information
David Brownell authored and Len Brown committed Feb 9, 2007
1 parent 61e2d6c commit 8722bdd
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1c0f0575fd02a3996f09cac2ef29c4cc5c2d279d
refs/heads/master: a74388e21ef2adbba4450f7b3f05ffe88df630d5
89 changes: 89 additions & 0 deletions trunk/drivers/acpi/glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,92 @@ static int __init init_acpi_device_notify(void)
}

arch_initcall(init_acpi_device_notify);


#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE)

/* Every ACPI platform has a mc146818 compatible "cmos rtc". Here we find
* its device node and pass extra config data. This helps its driver use
* capabilities that the now-obsolete mc146818 didn't have, and informs it
* that this board's RTC is wakeup-capable (per ACPI spec).
*/
#include <linux/mc146818rtc.h>

static struct cmos_rtc_board_info rtc_info;


#ifdef CONFIG_PNPACPI

/* PNP devices are registered in a subsys_initcall();
* ACPI specifies the PNP IDs to use.
*/
#include <linux/pnp.h>

static int __init pnp_match(struct device *dev, void *data)
{
static const char *ids[] = { "PNP0b00", "PNP0b01", "PNP0b02", };
struct pnp_dev *pnp = to_pnp_dev(dev);
int i;

for (i = 0; i < ARRAY_SIZE(ids); i++) {
if (compare_pnp_id(pnp->id, ids[i]) != 0)
return 1;
}
return 0;
}

static struct device *__init get_rtc_dev(void)
{
return bus_find_device(&pnp_bus_type, NULL, NULL, pnp_match);
}

#else

/* We expect non-PNPACPI platforms to register an RTC device, usually
* at or near arch_initcall(). That also helps for example PCs that
* aren't configured with ACPI (where this code wouldn't run, but the
* RTC would still be available). The device name matches the driver;
* that's how the platform bus works.
*/
#include <linux/platform_device.h>

static int __init platform_match(struct device *dev, void *data)
{
struct platform_device *pdev;

pdev = container_of(dev, struct platform_device, dev);
return strcmp(pdev->name, "rtc_cmos") == 0;
}

static struct device *__init get_rtc_dev(void)
{
return bus_find_device(&platform_bus_type, NULL, NULL, platform_match);
}

#endif

static int __init acpi_rtc_init(void)
{
struct device *dev = get_rtc_dev();

if (dev) {
rtc_info.rtc_day_alarm = acpi_gbl_FADT.day_alarm;
rtc_info.rtc_mon_alarm = acpi_gbl_FADT.month_alarm;
rtc_info.rtc_century = acpi_gbl_FADT.century;

/* NOTE: acpi_gbl_FADT->rtcs4 is NOT currently useful */

dev->platform_data = &rtc_info;

/* RTC always wakes from S1/S2/S3, and often S4/STD */
device_init_wakeup(dev, 1);

put_device(dev);
} else
pr_debug("ACPI: RTC unavailable?\n");
return 0;
}
/* do this between RTC subsys_initcall() and rtc_cmos driver_initcall() */
fs_initcall(acpi_rtc_init);

#endif

0 comments on commit 8722bdd

Please sign in to comment.