blob: 1bf5d23479285f1f29dba5fc43efa9bdba40f6e4 [file] [log] [blame]
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +01001/* rtc-generic: RTC driver using the generic RTC abstraction
2 *
3 * Copyright (C) 2008 Kyle McMartin <kyle@mcmartin.ca>
4 */
5
6#include <linux/kernel.h>
7#include <linux/module.h>
8#include <linux/time.h>
9#include <linux/platform_device.h>
10#include <linux/rtc.h>
11
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +010012static int __init generic_rtc_probe(struct platform_device *dev)
13{
14 struct rtc_device *rtc;
Arnd Bergmann4273b492016-05-30 20:58:02 +020015 const struct rtc_class_ops *ops = dev_get_platdata(&dev->dev);
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +010016
Jingoo Han360fe132013-04-29 16:19:37 -070017 rtc = devm_rtc_device_register(&dev->dev, "rtc-generic",
Arnd Bergmann64232fc2016-03-01 17:59:57 +010018 ops, THIS_MODULE);
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +010019 if (IS_ERR(rtc))
20 return PTR_ERR(rtc);
21
22 platform_set_drvdata(dev, rtc);
23
24 return 0;
25}
26
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +010027static struct platform_driver generic_rtc_driver = {
28 .driver = {
29 .name = "rtc-generic",
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +010030 },
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +010031};
32
Jingoo Hana53f9a42013-04-29 16:18:41 -070033module_platform_driver_probe(generic_rtc_driver, generic_rtc_probe);
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +010034
35MODULE_AUTHOR("Kyle McMartin <kyle@mcmartin.ca>");
36MODULE_LICENSE("GPL");
37MODULE_DESCRIPTION("Generic RTC driver");
38MODULE_ALIAS("platform:rtc-generic");