rtc-generic.c 952 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /* rtc-generic: RTC driver using the generic RTC abstraction
  3. *
  4. * Copyright (C) 2008 Kyle McMartin <[email protected]>
  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. static int __init generic_rtc_probe(struct platform_device *dev)
  12. {
  13. struct rtc_device *rtc;
  14. const struct rtc_class_ops *ops = dev_get_platdata(&dev->dev);
  15. rtc = devm_rtc_device_register(&dev->dev, "rtc-generic",
  16. ops, THIS_MODULE);
  17. if (IS_ERR(rtc))
  18. return PTR_ERR(rtc);
  19. platform_set_drvdata(dev, rtc);
  20. return 0;
  21. }
  22. static struct platform_driver generic_rtc_driver = {
  23. .driver = {
  24. .name = "rtc-generic",
  25. },
  26. };
  27. module_platform_driver_probe(generic_rtc_driver, generic_rtc_probe);
  28. MODULE_AUTHOR("Kyle McMartin <[email protected]>");
  29. MODULE_LICENSE("GPL");
  30. MODULE_DESCRIPTION("Generic RTC driver");
  31. MODULE_ALIAS("platform:rtc-generic");