Geert Uytterhoeven | 3afe6d0 | 2009-02-19 16:46:49 +0100 | [diff] [blame] | 1 | /* 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 Uytterhoeven | 3afe6d0 | 2009-02-19 16:46:49 +0100 | [diff] [blame] | 12 | static int __init generic_rtc_probe(struct platform_device *dev) |
| 13 | { |
| 14 | struct rtc_device *rtc; |
Arnd Bergmann | 4273b49 | 2016-05-30 20:58:02 +0200 | [diff] [blame] | 15 | const struct rtc_class_ops *ops = dev_get_platdata(&dev->dev); |
Geert Uytterhoeven | 3afe6d0 | 2009-02-19 16:46:49 +0100 | [diff] [blame] | 16 | |
Jingoo Han | 360fe13 | 2013-04-29 16:19:37 -0700 | [diff] [blame] | 17 | rtc = devm_rtc_device_register(&dev->dev, "rtc-generic", |
Arnd Bergmann | 64232fc | 2016-03-01 17:59:57 +0100 | [diff] [blame] | 18 | ops, THIS_MODULE); |
Geert Uytterhoeven | 3afe6d0 | 2009-02-19 16:46:49 +0100 | [diff] [blame] | 19 | if (IS_ERR(rtc)) |
| 20 | return PTR_ERR(rtc); |
| 21 | |
| 22 | platform_set_drvdata(dev, rtc); |
| 23 | |
| 24 | return 0; |
| 25 | } |
| 26 | |
Geert Uytterhoeven | 3afe6d0 | 2009-02-19 16:46:49 +0100 | [diff] [blame] | 27 | static struct platform_driver generic_rtc_driver = { |
| 28 | .driver = { |
| 29 | .name = "rtc-generic", |
Geert Uytterhoeven | 3afe6d0 | 2009-02-19 16:46:49 +0100 | [diff] [blame] | 30 | }, |
Geert Uytterhoeven | 3afe6d0 | 2009-02-19 16:46:49 +0100 | [diff] [blame] | 31 | }; |
| 32 | |
Jingoo Han | a53f9a4 | 2013-04-29 16:18:41 -0700 | [diff] [blame] | 33 | module_platform_driver_probe(generic_rtc_driver, generic_rtc_probe); |
Geert Uytterhoeven | 3afe6d0 | 2009-02-19 16:46:49 +0100 | [diff] [blame] | 34 | |
| 35 | MODULE_AUTHOR("Kyle McMartin <kyle@mcmartin.ca>"); |
| 36 | MODULE_LICENSE("GPL"); |
| 37 | MODULE_DESCRIPTION("Generic RTC driver"); |
| 38 | MODULE_ALIAS("platform:rtc-generic"); |