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>
Tue, 15 Feb 2022 09:59:57 +0000 (18:59 +0900)
commit4cdba5889691d96e5bd48984684cb1e2909e8297
treebd75534bfe90441a8640aabe66446f37c3f47da5
parentb67435b50ba7a2c9786951a0448490965b70e90d
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]