Skip to content

Commit bf64499

Browse files
committed
Merge tag 'rtc-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Pull RTC updates from Alexandre Belloni: "Not much this cycle. I've pushed the at32ap700x removal late but it is unlikely to cause any issues. Summary: Subsystem: - Move ABI documentation to Documentation/ABI New driver: - NXP i.MX53 SRTC - Chrome OS EC RTC Drivers: - Remove at32ap700x - Many fixes in various error paths" * tag 'rtc-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: rtc: remove rtc-at32ap700x Documentation: rtc: move iotcl interface documentation to ABI Documentation: rtc: add sysfs file permissions Documentation: rtc: move sysfs documentation to ABI rtc: mxc_v2: remove __exit annotation rtc: mxc_v2: Remove unnecessary platform_get_resource() error check rtc: add mxc driver for i.MX53 SRTC dt-bindings: rtc: add bindings for i.MX53 SRTC rtc: r7301: Fix a possible sleep-in-atomic bug in rtc7301_set_time rtc: r7301: Fix a possible sleep-in-atomic bug in rtc7301_read_time rtc: omap: fix unbalanced clk_prepare_enable/clk_disable_unprepare rtc: ac100: Fix multiple race conditions rtc: sun6i: ensure rtc is kfree'd on error rtc: cros-ec: add cros-ec-rtc driver. mfd: cros_ec: Introduce RTC commands and events definitions. rtc: stm32: Fix copyright rtc: Remove unused RTC_DEVICE_NAME_SIZE rtc: r9701: Remove r9701_remove function rtc: brcmstb-waketimer: fix error handling in brcmstb_waketmr_probe()
2 parents b89e32c + 4402be2 commit bf64499

18 files changed

Lines changed: 1049 additions & 397 deletions

File tree

‎Documentation/ABI/testing/rtc-cdev‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
What: /dev/rtcX
2+
Date: April 2005
3+
KernelVersion: 2.6.12
4+
Contact: linux-rtc@vger.kernel.org
5+
Description:
6+
The ioctl interface to drivers for real-time clocks (RTCs).
7+
Following actions are supported:
8+
9+
* RTC_RD_TIME, RTC_SET_TIME: Read or set the RTC time. Time
10+
format is a Gregorian calendar date and 24 hour wall clock
11+
time.
12+
13+
* RTC_AIE_ON, RTC_AIE_OFF: Enable or disable the alarm interrupt
14+
for RTCs that support alarms
15+
16+
* RTC_ALM_READ, RTC_ALM_SET: Read or set the alarm time for
17+
RTCs that support alarms. Can be set upto 24 hours in the
18+
future. Requires a separate RTC_AIE_ON call to enable the
19+
alarm interrupt. (Prefer to use RTC_WKALM_*)
20+
21+
* RTC_WKALM_RD, RTC_WKALM_SET: For RTCs that support a more
22+
powerful interface, which can issue alarms beyond 24 hours and
23+
enable IRQs in the same request.
24+
25+
* RTC_PIE_ON, RTC_PIE_OFF: Enable or disable the periodic
26+
interrupt for RTCs that support periodic interrupts.
27+
28+
* RTC_UIE_ON, RTC_UIE_OFF: Enable or disable the update
29+
interrupt for RTCs that support it.
30+
31+
* RTC_IRQP_READ, RTC_IRQP_SET: Read or set the frequency for
32+
periodic interrupts for RTCs that support periodic interrupts.
33+
Requires a separate RTC_PIE_ON call to enable the periodic
34+
interrupts.
35+
36+
The ioctl() calls supported by the older /dev/rtc interface are
37+
also supported by the newer RTC class framework. However,
38+
because the chips and systems are not standardized, some PC/AT
39+
functionality might not be provided. And in the same way, some
40+
newer features -- including those enabled by ACPI -- are exposed
41+
by the RTC class framework, but can't be supported by the older
42+
driver.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
What: /sys/class/rtc/
2+
Date: March 2006
3+
KernelVersion: 2.6.17
4+
Contact: linux-rtc@vger.kernel.org
5+
Description:
6+
The rtc/ class subdirectory belongs to the RTC subsystem.
7+
8+
What: /sys/class/rtc/rtcX/
9+
Date: March 2006
10+
KernelVersion: 2.6.17
11+
Contact: linux-rtc@vger.kernel.org
12+
Description:
13+
The /sys/class/rtc/rtc{0,1,2,3,...} directories correspond
14+
to each RTC device.
15+
16+
What: /sys/class/rtc/rtcX/date
17+
Date: March 2006
18+
KernelVersion: 2.6.17
19+
Contact: linux-rtc@vger.kernel.org
20+
Description:
21+
(RO) RTC-provided date in YYYY-MM-DD format
22+
23+
What: /sys/class/rtc/rtcX/hctosys
24+
Date: September 2009
25+
KernelVersion: 2.6.32
26+
Contact: linux-rtc@vger.kernel.org
27+
Description:
28+
(RO) 1 if the RTC provided the system time at boot via the
29+
CONFIG_RTC_HCTOSYS kernel option, 0 otherwise
30+
31+
What: /sys/class/rtc/rtcX/max_user_freq
32+
Date: October 2007
33+
KernelVersion: 2.6.24
34+
Contact: linux-rtc@vger.kernel.org
35+
Description:
36+
(RW) The maximum interrupt rate an unprivileged user may request
37+
from this RTC.
38+
39+
What: /sys/class/rtc/rtcX/name
40+
Date: March 2006
41+
KernelVersion: 2.6.17
42+
Contact: linux-rtc@vger.kernel.org
43+
Description:
44+
(RO) The name of the RTC corresponding to this sysfs directory
45+
46+
What: /sys/class/rtc/rtcX/since_epoch
47+
Date: March 2006
48+
KernelVersion: 2.6.17
49+
Contact: linux-rtc@vger.kernel.org
50+
Description:
51+
(RO) RTC-provided time as the number of seconds since the epoch
52+
53+
What: /sys/class/rtc/rtcX/time
54+
Date: March 2006
55+
KernelVersion: 2.6.17
56+
Contact: linux-rtc@vger.kernel.org
57+
Description:
58+
(RO) RTC-provided time in 24-hour notation (hh:mm:ss)
59+
60+
What: /sys/class/rtc/rtcX/*/nvmem
61+
Date: February 2016
62+
KernelVersion: 4.6
63+
Contact: linux-rtc@vger.kernel.org
64+
Description:
65+
(RW) The non volatile storage exported as a raw file, as
66+
described in Documentation/nvmem/nvmem.txt
67+
68+
What: /sys/class/rtc/rtcX/offset
69+
Date: February 2016
70+
KernelVersion: 4.6
71+
Contact: linux-rtc@vger.kernel.org
72+
Description:
73+
(RW) The amount which the rtc clock has been adjusted in
74+
firmware. Visible only if the driver supports clock offset
75+
adjustment. The unit is parts per billion, i.e. The number of
76+
clock ticks which are added to or removed from the rtc's base
77+
clock per billion ticks. A positive value makes a day pass more
78+
slowly, longer, and a negative value makes a day pass more
79+
quickly.
80+
81+
What: /sys/class/rtc/rtcX/wakealarm
82+
Date: February 2007
83+
KernelVersion: 2.6.20
84+
Contact: linux-rtc@vger.kernel.org
85+
Description:
86+
(RW) The time at which the clock will generate a system wakeup
87+
event. This is a one shot wakeup event, so must be reset after
88+
wake if a daily wakeup is required. Format is seconds since the
89+
epoch by default, or if there's a leading +, seconds in the
90+
future, or if there is a leading +=, seconds ahead of the
91+
current alarm.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
* i.MX53 Secure Real Time Clock (SRTC)
2+
3+
Required properties:
4+
- compatible: should be: "fsl,imx53-rtc"
5+
- reg: physical base address of the controller and length of memory mapped
6+
region.
7+
- clocks: should contain the phandle for the rtc clock
8+
- interrupts: rtc alarm interrupt
9+
10+
Example:
11+
12+
rtc@53fa4000 {
13+
compatible = "fsl,imx53-rtc";
14+
reg = <0x53fa4000 0x4000>;
15+
interrupts = <24>;
16+
clocks = <&clks IMX5_CLK_SRTC_GATE>;
17+
};

‎Documentation/rtc.txt‎

Lines changed: 2 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -136,82 +136,5 @@ a high functionality RTC is integrated into the SOC. That system might read
136136
the system clock from the discrete RTC, but use the integrated one for all
137137
other tasks, because of its greater functionality.
138138

139-
SYSFS interface
140-
---------------
141-
142-
The sysfs interface under /sys/class/rtc/rtcN provides access to various
143-
rtc attributes without requiring the use of ioctls. All dates and times
144-
are in the RTC's timezone, rather than in system time.
145-
146-
================ ==============================================================
147-
date RTC-provided date
148-
hctosys 1 if the RTC provided the system time at boot via the
149-
CONFIG_RTC_HCTOSYS kernel option, 0 otherwise
150-
max_user_freq The maximum interrupt rate an unprivileged user may request
151-
from this RTC.
152-
name The name of the RTC corresponding to this sysfs directory
153-
since_epoch The number of seconds since the epoch according to the RTC
154-
time RTC-provided time
155-
wakealarm The time at which the clock will generate a system wakeup
156-
event. This is a one shot wakeup event, so must be reset
157-
after wake if a daily wakeup is required. Format is seconds
158-
since the epoch by default, or if there's a leading +, seconds
159-
in the future, or if there is a leading +=, seconds ahead of
160-
the current alarm.
161-
offset The amount which the rtc clock has been adjusted in firmware.
162-
Visible only if the driver supports clock offset adjustment.
163-
The unit is parts per billion, i.e. The number of clock ticks
164-
which are added to or removed from the rtc's base clock per
165-
billion ticks. A positive value makes a day pass more slowly,
166-
longer, and a negative value makes a day pass more quickly.
167-
*/nvmem The non volatile storage exported as a raw file, as described
168-
in Documentation/nvmem/nvmem.txt
169-
================ ==============================================================
170-
171-
IOCTL interface
172-
---------------
173-
174-
The ioctl() calls supported by /dev/rtc are also supported by the RTC class
175-
framework. However, because the chips and systems are not standardized,
176-
some PC/AT functionality might not be provided. And in the same way, some
177-
newer features -- including those enabled by ACPI -- are exposed by the
178-
RTC class framework, but can't be supported by the older driver.
179-
180-
* RTC_RD_TIME, RTC_SET_TIME ... every RTC supports at least reading
181-
time, returning the result as a Gregorian calendar date and 24 hour
182-
wall clock time. To be most useful, this time may also be updated.
183-
184-
* RTC_AIE_ON, RTC_AIE_OFF, RTC_ALM_SET, RTC_ALM_READ ... when the RTC
185-
is connected to an IRQ line, it can often issue an alarm IRQ up to
186-
24 hours in the future. (Use RTC_WKALM_* by preference.)
187-
188-
* RTC_WKALM_SET, RTC_WKALM_RD ... RTCs that can issue alarms beyond
189-
the next 24 hours use a slightly more powerful API, which supports
190-
setting the longer alarm time and enabling its IRQ using a single
191-
request (using the same model as EFI firmware).
192-
193-
* RTC_UIE_ON, RTC_UIE_OFF ... if the RTC offers IRQs, the RTC framework
194-
will emulate this mechanism.
195-
196-
* RTC_PIE_ON, RTC_PIE_OFF, RTC_IRQP_SET, RTC_IRQP_READ ... these icotls
197-
are emulated via a kernel hrtimer.
198-
199-
In many cases, the RTC alarm can be a system wake event, used to force
200-
Linux out of a low power sleep state (or hibernation) back to a fully
201-
operational state. For example, a system could enter a deep power saving
202-
state until it's time to execute some scheduled tasks.
203-
204-
Note that many of these ioctls are handled by the common rtc-dev interface.
205-
Some common examples:
206-
207-
* RTC_RD_TIME, RTC_SET_TIME: the read_time/set_time functions will be
208-
called with appropriate values.
209-
210-
* RTC_ALM_SET, RTC_ALM_READ, RTC_WKALM_SET, RTC_WKALM_RD: gets or sets
211-
the alarm rtc_timer. May call the set_alarm driver function.
212-
213-
* RTC_IRQP_SET, RTC_IRQP_READ: These are emulated by the generic code.
214-
215-
* RTC_PIE_ON, RTC_PIE_OFF: These are also emulated by the generic code.
216-
217-
If all else fails, check out the tools/testing/selftests/timers/rtctest.c test!
139+
Check out tools/testing/selftests/timers/rtctest.c for an example usage of the
140+
ioctl interface.

‎drivers/rtc/Kconfig‎

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,16 @@ config RTC_DRV_ZYNQMP
12551255
If you say yes here you get support for the RTC controller found on
12561256
Xilinx Zynq Ultrascale+ MPSoC.
12571257

1258+
config RTC_DRV_CROS_EC
1259+
tristate "Chrome OS EC RTC driver"
1260+
depends on MFD_CROS_EC
1261+
help
1262+
If you say yes here you will get support for the
1263+
Chrome OS Embedded Controller's RTC.
1264+
1265+
This driver can also be built as a module. If so, the module
1266+
will be called rtc-cros-ec.
1267+
12581268
comment "on-CPU RTC drivers"
12591269

12601270
config RTC_DRV_ASM9260
@@ -1392,13 +1402,6 @@ config RTC_DRV_PL031
13921402
To compile this driver as a module, choose M here: the
13931403
module will be called rtc-pl031.
13941404

1395-
config RTC_DRV_AT32AP700X
1396-
tristate "AT32AP700X series RTC"
1397-
depends on PLATFORM_AT32AP || COMPILE_TEST
1398-
help
1399-
Driver for the internal RTC (Realtime Clock) on Atmel AVR32
1400-
AT32AP700x family processors.
1401-
14021405
config RTC_DRV_AT91RM9200
14031406
tristate "AT91RM9200 or some AT91SAM9 RTC"
14041407
depends on ARCH_AT91 || COMPILE_TEST
@@ -1689,6 +1692,16 @@ config RTC_DRV_MXC
16891692
This driver can also be built as a module, if so, the module
16901693
will be called "rtc-mxc".
16911694

1695+
config RTC_DRV_MXC_V2
1696+
tristate "Freescale MXC Real Time Clock for i.MX53"
1697+
depends on ARCH_MXC
1698+
help
1699+
If you say yes here you get support for the Freescale MXC
1700+
SRTC module in i.MX53 processor.
1701+
1702+
This driver can also be built as a module, if so, the module
1703+
will be called "rtc-mxc_v2".
1704+
16921705
config RTC_DRV_SNVS
16931706
tristate "Freescale SNVS RTC support"
16941707
select REGMAP_MMIO

‎drivers/rtc/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ obj-$(CONFIG_RTC_DRV_AC100) += rtc-ac100.o
3333
obj-$(CONFIG_RTC_DRV_ARMADA38X) += rtc-armada38x.o
3434
obj-$(CONFIG_RTC_DRV_AS3722) += rtc-as3722.o
3535
obj-$(CONFIG_RTC_DRV_ASM9260) += rtc-asm9260.o
36-
obj-$(CONFIG_RTC_DRV_AT32AP700X)+= rtc-at32ap700x.o
3736
obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o
3837
obj-$(CONFIG_RTC_DRV_AT91SAM9) += rtc-at91sam9.o
3938
obj-$(CONFIG_RTC_DRV_AU1XXX) += rtc-au1xxx.o
@@ -44,6 +43,7 @@ obj-$(CONFIG_RTC_DRV_BQ4802) += rtc-bq4802.o
4443
obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o
4544
obj-$(CONFIG_RTC_DRV_COH901331) += rtc-coh901331.o
4645
obj-$(CONFIG_RTC_DRV_CPCAP) += rtc-cpcap.o
46+
obj-$(CONFIG_RTC_DRV_CROS_EC) += rtc-cros-ec.o
4747
obj-$(CONFIG_RTC_DRV_DA9052) += rtc-da9052.o
4848
obj-$(CONFIG_RTC_DRV_DA9055) += rtc-da9055.o
4949
obj-$(CONFIG_RTC_DRV_DA9063) += rtc-da9063.o
@@ -106,6 +106,7 @@ obj-$(CONFIG_RTC_DRV_MT6397) += rtc-mt6397.o
106106
obj-$(CONFIG_RTC_DRV_MT7622) += rtc-mt7622.o
107107
obj-$(CONFIG_RTC_DRV_MV) += rtc-mv.o
108108
obj-$(CONFIG_RTC_DRV_MXC) += rtc-mxc.o
109+
obj-$(CONFIG_RTC_DRV_MXC_V2) += rtc-mxc_v2.o
109110
obj-$(CONFIG_RTC_DRV_NUC900) += rtc-nuc900.o
110111
obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o
111112
obj-$(CONFIG_RTC_DRV_OPAL) += rtc-opal.o

‎drivers/rtc/rtc-ac100.c‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,12 @@ static int ac100_rtc_probe(struct platform_device *pdev)
569569
return chip->irq;
570570
}
571571

572+
chip->rtc = devm_rtc_allocate_device(&pdev->dev);
573+
if (IS_ERR(chip->rtc))
574+
return PTR_ERR(chip->rtc);
575+
576+
chip->rtc->ops = &ac100_rtc_ops;
577+
572578
ret = devm_request_threaded_irq(&pdev->dev, chip->irq, NULL,
573579
ac100_rtc_irq,
574580
IRQF_SHARED | IRQF_ONESHOT,
@@ -588,17 +594,16 @@ static int ac100_rtc_probe(struct platform_device *pdev)
588594
/* clear counter alarm pending interrupts */
589595
regmap_write(chip->regmap, AC100_ALM_INT_STA, AC100_ALM_INT_ENABLE);
590596

591-
chip->rtc = devm_rtc_device_register(&pdev->dev, "rtc-ac100",
592-
&ac100_rtc_ops, THIS_MODULE);
593-
if (IS_ERR(chip->rtc)) {
594-
dev_err(&pdev->dev, "unable to register device\n");
595-
return PTR_ERR(chip->rtc);
596-
}
597-
598597
ret = ac100_rtc_register_clks(chip);
599598
if (ret)
600599
return ret;
601600

601+
ret = rtc_register_device(chip->rtc);
602+
if (ret) {
603+
dev_err(&pdev->dev, "unable to register device\n");
604+
return ret;
605+
}
606+
602607
dev_info(&pdev->dev, "RTC enabled\n");
603608

604609
return 0;

0 commit comments

Comments
 (0)