blob: 89ae78e93b839be6768c0ac9437066c1998e3ad1 [file] [log] [blame]
Thomas Gleixner09c434b2019-05-19 13:08:20 +01001// SPDX-License-Identifier: GPL-2.0-only
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +01002/* rtc-generic: RTC driver using the generic RTC abstraction
3 *
4 * Copyright (C) 2008 Kyle McMartin <kyle@mcmartin.ca>
5 */
6
7#include <linux/kernel.h>
8#include <linux/module.h>
9#include <linux/time.h>
10#include <linux/platform_device.h>
11#include <linux/rtc.h>
12
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +010013static int __init generic_rtc_probe(struct platform_device *dev)
14{
15 struct rtc_device *rtc;
Arnd Bergmann4273b492016-05-30 20:58:02 +020016 const struct rtc_class_ops *ops = dev_get_platdata(&dev->dev);
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +010017
Jingoo Han360fe132013-04-29 16:19:37 -070018 rtc = devm_rtc_device_register(&dev->dev, "rtc-generic",
Arnd Bergmann64232fc2016-03-01 17:59:57 +010019 ops, THIS_MODULE);
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +010020 if (IS_ERR(rtc))
21 return PTR_ERR(rtc);
22
23 platform_set_drvdata(dev, rtc);
24
25 return 0;
26}
27
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +010028static struct platform_driver generic_rtc_driver = {
29 .driver = {
30 .name = "rtc-generic",
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +010031 },
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +010032};
33
Jingoo Hana53f9a42013-04-29 16:18:41 -070034module_platform_driver_probe(generic_rtc_driver, generic_rtc_probe);
Geert Uytterhoeven3afe6d02009-02-19 16:46:49 +010035
36MODULE_AUTHOR("Kyle McMartin <kyle@mcmartin.ca>");
37MODULE_LICENSE("GPL");
38MODULE_DESCRIPTION("Generic RTC driver");
39MODULE_ALIAS("platform:rtc-generic");