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)
committerJens Axboe <axboe@kernel.dk>
Tue, 1 Mar 2022 17:52:57 +0000 (10:52 -0700)
commit3fe612564e96d7931956c2c8af47b7d40a7f5e1c
treeda0e20ff239e29bff3f20dadb482c379f7a420c6
parentf081226418ef589036786c9b3eb2b7af6b417611
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]