Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Real-Time Clock via SAM #9

Open
qzed opened this issue Jun 7, 2022 · 6 comments
Open

Support for Real-Time Clock via SAM #9

qzed opened this issue Jun 7, 2022 · 6 comments
Labels
A: SAM Area: Surface Aggregator Module

Comments

@qzed
Copy link
Member

qzed commented Jun 7, 2022

The Surface Pro X exposes a standard real-time clock ACPI interface (ACPI000E). This calls to the Surface Aggregator EC via the SAN interface. Add direct support for the RCT as SAM client device/driver combo. While not directly apparent in ACPI, there also seems to be a dedicated wake interrupt GPIO pin associated with the RTC.

@qzed qzed added the A: SAM Area: Surface Aggregator Module label Jun 7, 2022
@qzed qzed mentioned this issue Jun 12, 2022
@qzed
Copy link
Member Author

qzed commented Jun 13, 2022

Some notes:

  • TLMM pin 81 should be RTC wake interrupt pin, but that is not apparent in ACPI. ACPI only notifies the RTC via _WAK method, but where does the wakeup signal originate from?
  • _GWS accesses some system memory region in DSDT and is not implemented in via SAM. What provides this region and sets the wake status?
  • The Linux ACPI000E driver does not implement a RTC.
  • The Qualcomm SoC may also provide a RTC via PMIC (qcom,pm8941-rtc?).

@qzed
Copy link
Member Author

qzed commented Jun 14, 2022

There is indeed a qcom,pm8941-rtc present (code here), but that shows a date of 1971 on my SPX and can't be changed. We can set the allow-set-time property in DT, but then the set command stalls. So we should probably implement the SAM RTC as proper RTC device (unlike the ACPI TAD implementation), since it seems to be the only working RTC around.

More open questions:

  • Does the timezone field work? It's currently set to 2047, i.e. "invalid".
  • Can we get the weekday from SAM?
  • How do we handle AC/DC alarms and the wake status memory stuff?

@qzed
Copy link
Member Author

qzed commented Jun 14, 2022

  • _GWS accesses some system memory region in DSDT and is not implemented in via SAM. What provides this region and sets the wake status?

Clarification on this: The respective SAM request still works (provided one gives the index to the timer as payload, i.e. 0 or 1 as u32, see ACPI spec). So do we actually need to access system memory or can we rely on SAM here?

@qzed
Copy link
Member Author

qzed commented Jun 17, 2022

Very basic RTC support has been implemented in linux-surface/kernel@6b289bf. This does not support any kind of alarms yet. For testing wake alarms/interrupts properly, we may need to make suspend work first.

@qzed
Copy link
Member Author

qzed commented Jun 27, 2022

Discussion on the built-in Qualcomm RTC and why that doesn't allow setting time: https://discuss.96boards.org/t/how-to-enable-rtc-on-dragonboard-410c-with-linaro-15-07/188/19.

@qzed
Copy link
Member Author

qzed commented Feb 22, 2023

The RTC used by Qualcomm uses an offset stored as UEFI variable for correction (882f8c2b-9646-435f-8de5-f208ff80c1bd-RTCInfo). See https://lore.kernel.org/lkml/20230126142057.25715-20-johan+linaro@kernel.org/ for details.

A series to better support this RTC is being upstreamed: https://lore.kernel.org/lkml/20230202155448.6715-1-johan+linaro@kernel.org/ for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: SAM Area: Surface Aggregator Module
Projects
Status: Todo
Development

No branches or pull requests

1 participant