rtc: Add new rtc-macsmc driver for Apple Silicon Macs
authorHector Martin <marcan@marcan.st>
Tue, 15 Feb 2022 09:47:13 +0000 (18:47 +0900)
committerHector Martin <marcan@marcan.st>
Sat, 19 Feb 2022 10:31:32 +0000 (19:31 +0900)
commit94cd8faea09c31872d072f74509e0c0aec1eaf75
treeaeb22212948475178330243452e6c7d3ed68beb7
parentee9b96523e8b16828083c7ef15dcd090f31f9e0c
rtc: Add new rtc-macsmc driver for Apple Silicon Macs

Apple Silicon Macs (M1, etc.) have an RTC that is part of the PMU IC,
but most of the PMU functionality is abstracted out by the SMC.
On T600x machines, the RTC counter must be accessed via the SMC to
get full functionality, and it seems likely that future machines
will move towards making SMC handle all RTC functionality.

The SMC RTC counter access is implemented on all current machines
as of the time of this writing, on firmware 12.x. However, the RTC
offset (needed to set the time) is still only accessible via direct
PMU access. To handle this, we expose the RTC offset as an NVMEM
cell from the SPMI PMU device node, and this driver consumes that
cell and uses it to compute/set the current time.

Alarm functionality is not yet implemented. This would also go via
the PMU today, but could change in the future.

Signed-off-by: Hector Martin <marcan@marcan.st>
drivers/rtc/Kconfig
drivers/rtc/Makefile
drivers/rtc/rtc-macsmc.c [new file with mode: 0644]