hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/rtc/rtc-tps65910.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * rtc-tps65910.c -- TPS65910 Real Time Clock interface
34 *
....@@ -7,11 +8,6 @@
78 * Based on original TI driver rtc-twl.c
89 * Copyright (C) 2007 MontaVista Software, Inc
910 * Author: Alexandre Rusev <source@mvista.com>
10
- *
11
- * This program is free software; you can redistribute it and/or
12
- * modify it under the terms of the GNU General Public License
13
- * as published by the Free Software Foundation; either version
14
- * 2 of the License, or (at your option) any later version.
1511 */
1612
1713 #include <linux/kernel.h>
....@@ -147,7 +143,7 @@
147143 struct tps65910 *tps = dev_get_drvdata(dev->parent);
148144 int ret;
149145
150
- ret = regmap_bulk_read(tps->regmap, TPS65910_SECONDS, alarm_data,
146
+ ret = regmap_bulk_read(tps->regmap, TPS65910_ALARM_SECONDS, alarm_data,
151147 NUM_TIME_REGS);
152148 if (ret < 0) {
153149 dev_err(dev, "rtc_read_alarm error %d\n", ret);
....@@ -365,6 +361,13 @@
365361 .set_offset = tps65910_set_offset,
366362 };
367363
364
+static const struct rtc_class_ops tps65910_rtc_ops_noirq = {
365
+ .read_time = tps65910_rtc_read_time,
366
+ .set_time = tps65910_rtc_set_time,
367
+ .read_offset = tps65910_read_offset,
368
+ .set_offset = tps65910_set_offset,
369
+};
370
+
368371 static int tps65910_rtc_probe(struct platform_device *pdev)
369372 {
370373 struct tps65910 *tps65910 = NULL;
....@@ -418,24 +421,20 @@
418421 ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
419422 tps65910_rtc_interrupt, IRQF_TRIGGER_LOW,
420423 dev_name(&pdev->dev), &pdev->dev);
421
- if (ret < 0) {
422
- dev_err(&pdev->dev, "IRQ is not free.\n");
423
- return ret;
424
- }
425
- tps_rtc->irq = irq;
426
- device_set_wakeup_capable(&pdev->dev, 1);
424
+ if (ret < 0)
425
+ irq = -1;
427426
428
- tps_rtc->rtc->ops = &tps65910_rtc_ops;
427
+ tps_rtc->irq = irq;
428
+ if (irq != -1) {
429
+ device_set_wakeup_capable(&pdev->dev, 1);
430
+ tps_rtc->rtc->ops = &tps65910_rtc_ops;
431
+ } else
432
+ tps_rtc->rtc->ops = &tps65910_rtc_ops_noirq;
433
+
429434 tps_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
430435 tps_rtc->rtc->range_max = RTC_TIMESTAMP_END_2099;
431436
432
- ret = rtc_register_device(tps_rtc->rtc);
433
- if (ret) {
434
- dev_err(&pdev->dev, "RTC device register: err %d\n", ret);
435
- return ret;
436
- }
437
-
438
- return 0;
437
+ return rtc_register_device(tps_rtc->rtc);
439438 }
440439
441440 #ifdef CONFIG_PM_SLEEP