Skip to content

Commit 4672c2f

Browse files
committed
Merge tag 'rtc-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Pull RTC updates from Alexandre Belloni: "A lot of unnecessary code removal in here that ends up decreasing the number of lines in the subsystem. The ds1343 and ds1347 drivers got cleaned up. The rest are the usual fixes and new features. Subsystem: - fix warnings and errors with make W=1 - UIE are now disabled while setting the RTC time - UIE are now disallowed when the RTC time is not set. Drivers: - remove unecessary .remove callbacks - Set RTC range for cros-ec, ds1343, ds1347, m41t80, s35390a, vt8500 - Use devm_platform_ioremap_resource where applicable - rv3028: add clock out support" * tag 'rtc-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (81 commits) rtc: Fix Kconfig indentation rtc: xgene: Remove unused struct device in struct xgene_rtc_dev rtc: sun6i: Remove struct device from sun6i_rtc_dev rtc: st-lpc: Remove struct resource from struct st_rtc rtc: pcf8523: Remove struct pcf8523 rtc: meson: remove redundant assignment to variable retries rtc: v3020: remove set but unused variable rtc: tegra: remove set but unused variable rtc: pm8xxx: update kerneldoc for struct pm8xxx_rtc rtc: m41t80: remove excess kerneldoc rtc: ds1685: fix build error with make W=1 rtc: ds1685: remove set but unused variables rtc: ds1374: remove unused variable rtc: sysfs: fix hctosys_show kerneldoc rtc: interface: fix kerneldoc comments rtc: msm6242: Remove unneeded msm6242_set()/msm6242_clear() functions rtc: msm6242: Fix reading of 10-hour digit rtc: tps65910: allow using RTC without alarm interrupt rtc: fsl-ftm-alarm: remove select FSL_RCPM and default y from Kconfig rtc: pcf8563: Constify clkout_rates ...
2 parents 2a31aca + f830f7c commit 4672c2f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+566
-678
lines changed

arch/mips/sgi-ip32/ip32-platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ ip32_rtc_platform_data[] = {
115115
.bcd_mode = true,
116116
.no_irq = false,
117117
.uie_unsupported = false,
118-
.alloc_io_resources = true,
118+
.access_type = ds1685_reg_direct,
119119
.plat_prepare_poweroff = ip32_prepare_poweroff,
120120
},
121121
};

drivers/rtc/Kconfig

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -373,17 +373,6 @@ config RTC_DRV_MAX77686
373373
This driver can also be built as a module. If so, the module
374374
will be called rtc-max77686.
375375

376-
config RTC_DRV_MESON_VRTC
377-
tristate "Amlogic Meson Virtual RTC"
378-
depends on ARCH_MESON || COMPILE_TEST
379-
default m if ARCH_MESON
380-
help
381-
If you say yes here you will get support for the
382-
Virtual RTC of Amlogic SoCs.
383-
384-
This driver can also be built as a module. If so, the module
385-
will be called rtc-meson-vrtc.
386-
387376
config RTC_DRV_RK808
388377
tristate "Rockchip RK805/RK808/RK809/RK817/RK818 RTC"
389378
depends on MFD_RK808
@@ -1337,8 +1326,6 @@ config RTC_DRV_IMXDI
13371326
config RTC_DRV_FSL_FTM_ALARM
13381327
tristate "Freescale FlexTimer alarm timer"
13391328
depends on ARCH_LAYERSCAPE || SOC_LS1021A
1340-
select FSL_RCPM
1341-
default y
13421329
help
13431330
For the FlexTimer in LS1012A, LS1021A, LS1028A, LS1043A, LS1046A,
13441331
LS1088A, LS208xA, we can use FTM as the wakeup source.
@@ -1360,6 +1347,17 @@ config RTC_DRV_MESON
13601347
This driver can also be built as a module, if so, the module
13611348
will be called "rtc-meson".
13621349

1350+
config RTC_DRV_MESON_VRTC
1351+
tristate "Amlogic Meson Virtual RTC"
1352+
depends on ARCH_MESON || COMPILE_TEST
1353+
default m if ARCH_MESON
1354+
help
1355+
If you say yes here you will get support for the
1356+
Virtual RTC of Amlogic SoCs.
1357+
1358+
This driver can also be built as a module. If so, the module
1359+
will be called rtc-meson-vrtc.
1360+
13631361
config RTC_DRV_OMAP
13641362
tristate "TI OMAP Real Time Clock"
13651363
depends on ARCH_OMAP || ARCH_DAVINCI || COMPILE_TEST
@@ -1459,6 +1457,7 @@ config RTC_DRV_PL031
14591457
config RTC_DRV_AT91RM9200
14601458
tristate "AT91RM9200 or some AT91SAM9 RTC"
14611459
depends on ARCH_AT91 || COMPILE_TEST
1460+
depends on OF
14621461
help
14631462
Driver for the internal RTC (Realtime Clock) module found on
14641463
Atmel AT91RM9200's and some AT91SAM9 chips. On AT91SAM9 chips
@@ -1510,9 +1509,9 @@ config RTC_DRV_PXA
15101509
depends on ARCH_PXA
15111510
select RTC_DRV_SA1100
15121511
help
1513-
If you say Y here you will get access to the real time clock
1514-
built into your PXA27x or PXA3xx CPU. This RTC is actually 2 RTCs
1515-
consisting of an SA1100 compatible RTC and the extended PXA RTC.
1512+
If you say Y here you will get access to the real time clock
1513+
built into your PXA27x or PXA3xx CPU. This RTC is actually 2 RTCs
1514+
consisting of an SA1100 compatible RTC and the extended PXA RTC.
15161515

15171516
This RTC driver uses PXA RTC registers available since pxa27x
15181517
series (RDxR, RYxR) instead of legacy RCNR, RTAR.

drivers/rtc/interface.c

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static int rtc_valid_range(struct rtc_device *rtc, struct rtc_time *tm)
7070
time64_t time = rtc_tm_to_time64(tm);
7171
time64_t range_min = rtc->set_start_time ? rtc->start_secs :
7272
rtc->range_min;
73-
time64_t range_max = rtc->set_start_time ?
73+
timeu64_t range_max = rtc->set_start_time ?
7474
(rtc->start_secs + rtc->range_max - rtc->range_min) :
7575
rtc->range_max;
7676

@@ -125,7 +125,7 @@ EXPORT_SYMBOL_GPL(rtc_read_time);
125125

126126
int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
127127
{
128-
int err;
128+
int err, uie;
129129

130130
err = rtc_valid_tm(tm);
131131
if (err != 0)
@@ -137,6 +137,17 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
137137

138138
rtc_subtract_offset(rtc, tm);
139139

140+
#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
141+
uie = rtc->uie_rtctimer.enabled || rtc->uie_irq_active;
142+
#else
143+
uie = rtc->uie_rtctimer.enabled;
144+
#endif
145+
if (uie) {
146+
err = rtc_update_irq_enable(rtc, 0);
147+
if (err)
148+
return err;
149+
}
150+
140151
err = mutex_lock_interruptible(&rtc->ops_lock);
141152
if (err)
142153
return err;
@@ -153,6 +164,12 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
153164
/* A timer might have just expired */
154165
schedule_work(&rtc->irqwork);
155166

167+
if (uie) {
168+
err = rtc_update_irq_enable(rtc, 1);
169+
if (err)
170+
return err;
171+
}
172+
156173
trace_rtc_set_time(rtc_tm_to_time64(tm), err);
157174
return err;
158175
}
@@ -528,7 +545,7 @@ EXPORT_SYMBOL_GPL(rtc_alarm_irq_enable);
528545

529546
int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled)
530547
{
531-
int err;
548+
int rc = 0, err;
532549

533550
err = mutex_lock_interruptible(&rtc->ops_lock);
534551
if (err)
@@ -553,7 +570,9 @@ int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled)
553570
struct rtc_time tm;
554571
ktime_t now, onesec;
555572

556-
__rtc_read_time(rtc, &tm);
573+
rc = __rtc_read_time(rtc, &tm);
574+
if (rc)
575+
goto out;
557576
onesec = ktime_set(1, 0);
558577
now = rtc_tm_to_ktime(tm);
559578
rtc->uie_rtctimer.node.expires = ktime_add(now, onesec);
@@ -565,6 +584,16 @@ int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled)
565584

566585
out:
567586
mutex_unlock(&rtc->ops_lock);
587+
588+
/*
589+
* __rtc_read_time() failed, this probably means that the RTC time has
590+
* never been set or less probably there is a transient error on the
591+
* bus. In any case, avoid enabling emulation has this will fail when
592+
* reading the time too.
593+
*/
594+
if (rc)
595+
return rc;
596+
568597
#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
569598
/*
570599
* Enable emulation if the driver returned -EINVAL to signal that it has
@@ -581,6 +610,8 @@ EXPORT_SYMBOL_GPL(rtc_update_irq_enable);
581610
/**
582611
* rtc_handle_legacy_irq - AIE, UIE and PIE event hook
583612
* @rtc: pointer to the rtc device
613+
* @num: number of occurence of the event
614+
* @mode: type of the event, RTC_AF, RTC_UF of RTC_PF
584615
*
585616
* This function is called when an AIE, UIE or PIE mode interrupt
586617
* has occurred (or been emulated).
@@ -761,8 +792,8 @@ int rtc_irq_set_freq(struct rtc_device *rtc, int freq)
761792

762793
/**
763794
* rtc_timer_enqueue - Adds a rtc_timer to the rtc_device timerqueue
764-
* @rtc rtc device
765-
* @timer timer being added.
795+
* @rtc: rtc device
796+
* @timer: timer being added.
766797
*
767798
* Enqueues a timer onto the rtc devices timerqueue and sets
768799
* the next alarm event appropriately.
@@ -821,8 +852,8 @@ static void rtc_alarm_disable(struct rtc_device *rtc)
821852

822853
/**
823854
* rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue
824-
* @rtc rtc device
825-
* @timer timer being removed.
855+
* @rtc: rtc device
856+
* @timer: timer being removed.
826857
*
827858
* Removes a timer onto the rtc devices timerqueue and sets
828859
* the next alarm event appropriately.
@@ -859,8 +890,7 @@ static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer)
859890

860891
/**
861892
* rtc_timer_do_work - Expires rtc timers
862-
* @rtc rtc device
863-
* @timer timer being removed.
893+
* @work: work item
864894
*
865895
* Expires rtc timers. Reprograms next alarm event if needed.
866896
* Called via worktask.
@@ -993,8 +1023,8 @@ void rtc_timer_cancel(struct rtc_device *rtc, struct rtc_timer *timer)
9931023

9941024
/**
9951025
* rtc_read_offset - Read the amount of rtc offset in parts per billion
996-
* @ rtc: rtc device to be used
997-
* @ offset: the offset in parts per billion
1026+
* @rtc: rtc device to be used
1027+
* @offset: the offset in parts per billion
9981028
*
9991029
* see below for details.
10001030
*
@@ -1022,8 +1052,8 @@ int rtc_read_offset(struct rtc_device *rtc, long *offset)
10221052

10231053
/**
10241054
* rtc_set_offset - Adjusts the duration of the average second
1025-
* @ rtc: rtc device to be used
1026-
* @ offset: the offset in parts per billion
1055+
* @rtc: rtc device to be used
1056+
* @offset: the offset in parts per billion
10271057
*
10281058
* Some rtc's allow an adjustment to the average duration of a second
10291059
* to compensate for differences in the actual clock rate due to temperature,

drivers/rtc/rtc-ab-b5ze-s3.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -900,16 +900,6 @@ static int abb5zes3_probe(struct i2c_client *client,
900900
return ret;
901901
}
902902

903-
static int abb5zes3_remove(struct i2c_client *client)
904-
{
905-
struct abb5zes3_rtc_data *rtc_data = dev_get_drvdata(&client->dev);
906-
907-
if (rtc_data->irq > 0)
908-
device_init_wakeup(&client->dev, false);
909-
910-
return 0;
911-
}
912-
913903
#ifdef CONFIG_PM_SLEEP
914904
static int abb5zes3_rtc_suspend(struct device *dev)
915905
{
@@ -956,7 +946,6 @@ static struct i2c_driver abb5zes3_driver = {
956946
.of_match_table = of_match_ptr(abb5zes3_dt_match),
957947
},
958948
.probe = abb5zes3_probe,
959-
.remove = abb5zes3_remove,
960949
.id_table = abb5zes3_id,
961950
};
962951
module_i2c_driver(abb5zes3_driver);

drivers/rtc/rtc-armada38x.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ struct armada38x_rtc {
7474
int irq;
7575
bool initialized;
7676
struct value_to_freq *val_to_freq;
77-
struct armada38x_rtc_data *data;
77+
const struct armada38x_rtc_data *data;
7878
};
7979

8080
#define ALARM1 0
@@ -501,17 +501,14 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev)
501501
{
502502
struct resource *res;
503503
struct armada38x_rtc *rtc;
504-
const struct of_device_id *match;
505-
506-
match = of_match_device(armada38x_rtc_of_match_table, &pdev->dev);
507-
if (!match)
508-
return -ENODEV;
509504

510505
rtc = devm_kzalloc(&pdev->dev, sizeof(struct armada38x_rtc),
511506
GFP_KERNEL);
512507
if (!rtc)
513508
return -ENOMEM;
514509

510+
rtc->data = of_device_get_match_data(&pdev->dev);
511+
515512
rtc->val_to_freq = devm_kcalloc(&pdev->dev, SAMPLE_NR,
516513
sizeof(struct value_to_freq), GFP_KERNEL);
517514
if (!rtc->val_to_freq)
@@ -553,7 +550,6 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev)
553550
*/
554551
rtc->rtc_dev->ops = &armada38x_rtc_ops_noirq;
555552
}
556-
rtc->data = (struct armada38x_rtc_data *)match->data;
557553

558554
/* Update RTC-MBUS bridge timing parameters */
559555
rtc->data->update_mbus_timing(rtc);

drivers/rtc/rtc-asm9260.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ static int asm9260_rtc_probe(struct platform_device *pdev)
245245
{
246246
struct asm9260_rtc_priv *priv;
247247
struct device *dev = &pdev->dev;
248-
struct resource *res;
249248
int irq_alarm, ret;
250249
u32 ccr;
251250

@@ -260,8 +259,7 @@ static int asm9260_rtc_probe(struct platform_device *pdev)
260259
if (irq_alarm < 0)
261260
return irq_alarm;
262261

263-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
264-
priv->iobase = devm_ioremap_resource(dev, res);
262+
priv->iobase = devm_platform_ioremap_resource(pdev, 0);
265263
if (IS_ERR(priv->iobase))
266264
return PTR_ERR(priv->iobase);
267265

drivers/rtc/rtc-aspeed.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,12 @@ static const struct rtc_class_ops aspeed_rtc_ops = {
8585
static int aspeed_rtc_probe(struct platform_device *pdev)
8686
{
8787
struct aspeed_rtc *rtc;
88-
struct resource *res;
8988

9089
rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
9190
if (!rtc)
9291
return -ENOMEM;
9392

94-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
95-
rtc->base = devm_ioremap_resource(&pdev->dev, res);
93+
rtc->base = devm_platform_ioremap_resource(pdev, 0);
9694
if (IS_ERR(rtc->base))
9795
return PTR_ERR(rtc->base);
9896

drivers/rtc/rtc-at91rm9200.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ static const struct at91_rtc_config at91sam9x5_config = {
319319
.use_shadow_imr = true,
320320
};
321321

322-
#ifdef CONFIG_OF
323322
static const struct of_device_id at91_rtc_dt_ids[] = {
324323
{
325324
.compatible = "atmel,at91rm9200-rtc",
@@ -332,22 +331,6 @@ static const struct of_device_id at91_rtc_dt_ids[] = {
332331
}
333332
};
334333
MODULE_DEVICE_TABLE(of, at91_rtc_dt_ids);
335-
#endif
336-
337-
static const struct at91_rtc_config *
338-
at91_rtc_get_config(struct platform_device *pdev)
339-
{
340-
const struct of_device_id *match;
341-
342-
if (pdev->dev.of_node) {
343-
match = of_match_node(at91_rtc_dt_ids, pdev->dev.of_node);
344-
if (!match)
345-
return NULL;
346-
return (const struct at91_rtc_config *)match->data;
347-
}
348-
349-
return &at91rm9200_config;
350-
}
351334

352335
static const struct rtc_class_ops at91_rtc_ops = {
353336
.read_time = at91_rtc_readtime,
@@ -367,7 +350,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
367350
struct resource *regs;
368351
int ret = 0;
369352

370-
at91_rtc_config = at91_rtc_get_config(pdev);
353+
at91_rtc_config = of_device_get_match_data(&pdev->dev);
371354
if (!at91_rtc_config)
372355
return -ENODEV;
373356

drivers/rtc/rtc-at91sam9.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ static const struct rtc_class_ops at91_rtc_ops = {
334334
*/
335335
static int at91_rtc_probe(struct platform_device *pdev)
336336
{
337-
struct resource *r;
338337
struct sam9_rtc *rtc;
339338
int ret, irq;
340339
u32 mr;
@@ -358,8 +357,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
358357

359358
platform_set_drvdata(pdev, rtc);
360359

361-
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
362-
rtc->rtt = devm_ioremap_resource(&pdev->dev, r);
360+
rtc->rtt = devm_platform_ioremap_resource(pdev, 0);
363361
if (IS_ERR(rtc->rtt))
364362
return PTR_ERR(rtc->rtt);
365363

drivers/rtc/rtc-bd70528.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,3 +491,4 @@ module_platform_driver(bd70528_rtc);
491491
MODULE_AUTHOR("Matti Vaittinen <[email protected]>");
492492
MODULE_DESCRIPTION("BD70528 RTC driver");
493493
MODULE_LICENSE("GPL");
494+
MODULE_ALIAS("platform:bd70528-rtc");

0 commit comments

Comments
 (0)