Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf644990 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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()
parents b89e32cc 4402be2b
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
What:		/dev/rtcX
Date:		April 2005
KernelVersion:	2.6.12
Contact:	linux-rtc@vger.kernel.org
Description:
		The ioctl interface to drivers for real-time clocks (RTCs).
		Following actions are supported:

		* RTC_RD_TIME, RTC_SET_TIME: Read or set the RTC time. Time
		  format is a Gregorian calendar date and 24 hour wall clock
		  time.

		* RTC_AIE_ON, RTC_AIE_OFF: Enable or disable the alarm interrupt
		  for RTCs that support alarms

		* RTC_ALM_READ, RTC_ALM_SET: Read or set the alarm time for
		  RTCs that support alarms. Can be set upto 24 hours in the
		  future. Requires a separate RTC_AIE_ON call to enable the
		  alarm interrupt. (Prefer to use RTC_WKALM_*)

		* RTC_WKALM_RD, RTC_WKALM_SET: For RTCs that support a more
		  powerful interface, which can issue alarms beyond 24 hours and
		  enable IRQs in the same request.

		* RTC_PIE_ON, RTC_PIE_OFF: Enable or disable the periodic
		  interrupt for RTCs that support periodic interrupts.

		* RTC_UIE_ON, RTC_UIE_OFF: Enable or disable the update
		  interrupt for RTCs that support it.

		* RTC_IRQP_READ, RTC_IRQP_SET: Read or set the frequency for
		  periodic interrupts for RTCs that support periodic interrupts.
		  Requires a separate RTC_PIE_ON call to enable the periodic
		  interrupts.

		The ioctl() calls supported by the older /dev/rtc interface are
		also supported by the newer RTC class framework. However,
		because the chips and systems are not standardized, some PC/AT
		functionality might not be provided. And in the same way, some
		newer features -- including those enabled by ACPI -- are exposed
		by the RTC class framework, but can't be supported by the older
		driver.
+91 −0
Original line number Diff line number Diff line
What:		/sys/class/rtc/
Date:		March 2006
KernelVersion:	2.6.17
Contact:	linux-rtc@vger.kernel.org
Description:
		The rtc/ class subdirectory belongs to the RTC subsystem.

What:		/sys/class/rtc/rtcX/
Date:		March 2006
KernelVersion:	2.6.17
Contact:	linux-rtc@vger.kernel.org
Description:
		The /sys/class/rtc/rtc{0,1,2,3,...} directories correspond
		to each RTC device.

What:		/sys/class/rtc/rtcX/date
Date:		March 2006
KernelVersion:	2.6.17
Contact:	linux-rtc@vger.kernel.org
Description:
		(RO) RTC-provided date in YYYY-MM-DD format

What:		/sys/class/rtc/rtcX/hctosys
Date:		September 2009
KernelVersion:	2.6.32
Contact:	linux-rtc@vger.kernel.org
Description:
		(RO) 1 if the RTC provided the system time at boot via the
		CONFIG_RTC_HCTOSYS kernel option, 0 otherwise

What:		/sys/class/rtc/rtcX/max_user_freq
Date:		October 2007
KernelVersion:	2.6.24
Contact:	linux-rtc@vger.kernel.org
Description:
		(RW) The maximum interrupt rate an unprivileged user may request
		from this RTC.

What:		/sys/class/rtc/rtcX/name
Date:		March 2006
KernelVersion:	2.6.17
Contact:	linux-rtc@vger.kernel.org
Description:
		(RO) The name of the RTC corresponding to this sysfs directory

What:		/sys/class/rtc/rtcX/since_epoch
Date:		March 2006
KernelVersion:	2.6.17
Contact:	linux-rtc@vger.kernel.org
Description:
		(RO) RTC-provided time as the number of seconds since the epoch

What:		/sys/class/rtc/rtcX/time
Date:		March 2006
KernelVersion:	2.6.17
Contact:	linux-rtc@vger.kernel.org
Description:
		(RO) RTC-provided time in 24-hour notation (hh:mm:ss)

What:		/sys/class/rtc/rtcX/*/nvmem
Date:		February 2016
KernelVersion:	4.6
Contact:	linux-rtc@vger.kernel.org
Description:
		(RW) The non volatile storage exported as a raw file, as
		described in Documentation/nvmem/nvmem.txt

What:		/sys/class/rtc/rtcX/offset
Date:		February 2016
KernelVersion:	4.6
Contact:	linux-rtc@vger.kernel.org
Description:
		(RW) The amount which the rtc clock has been adjusted in
		firmware. Visible only if the driver supports clock offset
		adjustment. The unit is parts per billion, i.e. The number of
		clock ticks which are added to or removed from the rtc's base
		clock per billion ticks. A positive value makes a day pass more
		slowly, longer, and a negative value makes a day pass more
		quickly.

What:		/sys/class/rtc/rtcX/wakealarm
Date:		February 2007
KernelVersion:	2.6.20
Contact:	linux-rtc@vger.kernel.org
Description:
		(RW) The time at which the clock will generate a system wakeup
		event. This is a one shot wakeup event, so must be reset after
		wake if a daily wakeup is required. Format is seconds since the
		epoch by default, or if there's a leading +, seconds in the
		future, or if there is a leading +=, seconds ahead of the
		current alarm.
+17 −0
Original line number Diff line number Diff line
* i.MX53 Secure Real Time Clock (SRTC)

Required properties:
- compatible: should be: "fsl,imx53-rtc"
- reg: physical base address of the controller and length of memory mapped
  region.
- clocks: should contain the phandle for the rtc clock
- interrupts: rtc alarm interrupt

Example:

rtc@53fa4000 {
	compatible = "fsl,imx53-rtc";
	reg = <0x53fa4000 0x4000>;
	interrupts = <24>;
	clocks = <&clks IMX5_CLK_SRTC_GATE>;
};
+2 −79
Original line number Diff line number Diff line
@@ -136,82 +136,5 @@ a high functionality RTC is integrated into the SOC. That system might read
the system clock from the discrete RTC, but use the integrated one for all
other tasks, because of its greater functionality.

SYSFS interface
---------------

The sysfs interface under /sys/class/rtc/rtcN provides access to various
rtc attributes without requiring the use of ioctls. All dates and times
are in the RTC's timezone, rather than in system time.

================ ==============================================================
date  	   	 RTC-provided date
hctosys   	 1 if the RTC provided the system time at boot via the
		 CONFIG_RTC_HCTOSYS kernel option, 0 otherwise
max_user_freq	 The maximum interrupt rate an unprivileged user may request
		 from this RTC.
name		 The name of the RTC corresponding to this sysfs directory
since_epoch	 The number of seconds since the epoch according to the RTC
time		 RTC-provided time
wakealarm	 The time at which the clock will generate a system wakeup
		 event. This is a one shot wakeup event, so must be reset
		 after wake if a daily wakeup is required. Format is seconds
		 since the epoch by default, or if there's a leading +, seconds
		 in the future, or if there is a leading +=, seconds ahead of
		 the current alarm.
offset		 The amount which the rtc clock has been adjusted in firmware.
		 Visible only if the driver supports clock offset adjustment.
		 The unit is parts per billion, i.e. The number of clock ticks
		 which are added to or removed from the rtc's base clock per
		 billion ticks. A positive value makes a day pass more slowly,
		 longer, and a negative value makes a day pass more quickly.
*/nvmem		 The non volatile storage exported as a raw file, as described
		 in Documentation/nvmem/nvmem.txt
================ ==============================================================

IOCTL interface
---------------

The ioctl() calls supported by /dev/rtc are also supported by the RTC class
framework.  However, because the chips and systems are not standardized,
some PC/AT functionality might not be provided.  And in the same way, some
newer features -- including those enabled by ACPI -- are exposed by the
RTC class framework, but can't be supported by the older driver.

    *	RTC_RD_TIME, RTC_SET_TIME ... every RTC supports at least reading
	time, returning the result as a Gregorian calendar date and 24 hour
	wall clock time.  To be most useful, this time may also be updated.

    *	RTC_AIE_ON, RTC_AIE_OFF, RTC_ALM_SET, RTC_ALM_READ ... when the RTC
	is connected to an IRQ line, it can often issue an alarm IRQ up to
	24 hours in the future.  (Use RTC_WKALM_* by preference.)

    *	RTC_WKALM_SET, RTC_WKALM_RD ... RTCs that can issue alarms beyond
	the next 24 hours use a slightly more powerful API, which supports
	setting the longer alarm time and enabling its IRQ using a single
	request (using the same model as EFI firmware).

    *	RTC_UIE_ON, RTC_UIE_OFF ... if the RTC offers IRQs, the RTC framework
	will emulate this mechanism.

    *	RTC_PIE_ON, RTC_PIE_OFF, RTC_IRQP_SET, RTC_IRQP_READ ... these icotls
	are emulated via a kernel hrtimer.

In many cases, the RTC alarm can be a system wake event, used to force
Linux out of a low power sleep state (or hibernation) back to a fully
operational state.  For example, a system could enter a deep power saving
state until it's time to execute some scheduled tasks.

Note that many of these ioctls are handled by the common rtc-dev interface.
Some common examples:

    *	RTC_RD_TIME, RTC_SET_TIME: the read_time/set_time functions will be
	called with appropriate values.

    *	RTC_ALM_SET, RTC_ALM_READ, RTC_WKALM_SET, RTC_WKALM_RD: gets or sets
	the alarm rtc_timer. May call the set_alarm driver function.

    *	RTC_IRQP_SET, RTC_IRQP_READ: These are emulated by the generic code.

    *	RTC_PIE_ON, RTC_PIE_OFF: These are also emulated by the generic code.

If all else fails, check out the tools/testing/selftests/timers/rtctest.c test!
Check out tools/testing/selftests/timers/rtctest.c for an example usage of the
ioctl interface.
+20 −7
Original line number Diff line number Diff line
@@ -1255,6 +1255,16 @@ config RTC_DRV_ZYNQMP
	  If you say yes here you get support for the RTC controller found on
	  Xilinx Zynq Ultrascale+ MPSoC.

config RTC_DRV_CROS_EC
	tristate "Chrome OS EC RTC driver"
	depends on MFD_CROS_EC
	help
	  If you say yes here you will get support for the
	  Chrome OS Embedded Controller's RTC.

	  This driver can also be built as a module. If so, the module
	  will be called rtc-cros-ec.

comment "on-CPU RTC drivers"

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

config RTC_DRV_AT32AP700X
	tristate "AT32AP700X series RTC"
	depends on PLATFORM_AT32AP || COMPILE_TEST
	help
	  Driver for the internal RTC (Realtime Clock) on Atmel AVR32
	  AT32AP700x family processors.

config RTC_DRV_AT91RM9200
	tristate "AT91RM9200 or some AT91SAM9 RTC"
	depends on ARCH_AT91 || COMPILE_TEST
@@ -1689,6 +1692,16 @@ config RTC_DRV_MXC
	   This driver can also be built as a module, if so, the module
	   will be called "rtc-mxc".

config RTC_DRV_MXC_V2
	tristate "Freescale MXC Real Time Clock for i.MX53"
	depends on ARCH_MXC
	help
	   If you say yes here you get support for the Freescale MXC
	   SRTC module in i.MX53 processor.

	   This driver can also be built as a module, if so, the module
	   will be called "rtc-mxc_v2".

config RTC_DRV_SNVS
	tristate "Freescale SNVS RTC support"
	select REGMAP_MMIO
Loading