mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: qcom: mahua-t14s: store the RTC offset in SDAM
@ 2026-10-16 23:25 Luke Macken
  2026-10-21 10:39 ` Konrad Dybcio
  0 siblings, 1 reply; 2+ messages in thread
From: Luke Macken @ 2026-10-16 23:25 UTC (permalink / raw)
  To: andersson, konradybcio
  Cc: abelvesa, robh, krzk+dt, conor+dt, srinivas.kandagatla,
	linux-arm-msm, devicetree, linux-kernel, Luke Macken

The PMIC RTC registers on the Lenovo ThinkPad T14s Gen 7 are read-only,
so an offset needs to be stored in machine-specific non-volatile memory
which the RTC driver can take into account when reading or updating the
time.

The firmware on this machine does not provide the RTCInfo UEFI variable
that other Glymur based machines use for this purpose, so, as on
sc8280xp-crd and the QCS8550 boards, reserve four bytes in one of the
PMIC SDAM blocks to hold the RTC offset. SDAM 2 on PMK8850 is 128 bytes
and its last word is not used by the firmware.

Without this the RTC reports the time elapsed since the PMIC was first
powered, setting the time fails and the system clock starts in 1970 on
every boot until it is corrected from the network.

Assisted-by: LLM
Signed-off-by: Luke Macken <luke@phorex.org>
---
Note for reviewers: Qualcomm's "rtc: Add Qualcomm PMIC RTC-GLINK support
for Glymur" (August 2026) would move the RTC behind the charger firmware
on these machines, but it has not been resubmitted and needs firmware
that at least the ThinkPad does not ship yet. This patch uses the
existing rtc-pm8xxx nvmem offset mechanism in the meantime and does not
conflict with that work.

 .../boot/dts/qcom/mahua-lenovo-thinkpad-t14s-gen7-lcd.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/mahua-lenovo-thinkpad-t14s-gen7-lcd.dts b/arch/arm64/boot/dts/qcom/mahua-lenovo-thinkpad-t14s-gen7-lcd.dts
index 35afcb5ae..28c2da5d9 100644
--- a/arch/arm64/boot/dts/qcom/mahua-lenovo-thinkpad-t14s-gen7-lcd.dts
+++ b/arch/arm64/boot/dts/qcom/mahua-lenovo-thinkpad-t14s-gen7-lcd.dts
@@ -941,9 +941,17 @@ &pmk8850_pwm {
 };
 
 &pmk8850_rtc {
+	nvmem-cells = <&rtc_offset>;
+	nvmem-cell-names = "offset";
 	qcom,no-alarm;
 };
 
+&pmk8850_sdam_2 {
+	rtc_offset: rtc-offset@bc {
+		reg = <0xbc 0x4>;
+	};
+};
+
 &remoteproc_adsp {
 	firmware-name = "qcom/glymur/LENOVO/22A8/qcadsp8480.mbn",
 			"qcom/glymur/LENOVO/22A8/adsp_dtbs.elf";

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm64: dts: qcom: mahua-t14s: store the RTC offset in SDAM
  2026-10-16 23:25 [PATCH] arm64: dts: qcom: mahua-t14s: store the RTC offset in SDAM Luke Macken
@ 2026-10-21 10:39 ` Konrad Dybcio
  0 siblings, 0 replies; 2+ messages in thread
From: Konrad Dybcio @ 2026-10-21 10:39 UTC (permalink / raw)
  To: Luke Macken, andersson, konradybcio
  Cc: abelvesa, robh, krzk+dt, conor+dt, srinivas.kandagatla,
	linux-arm-msm, devicetree, linux-kernel

On 10/17/26 1:25 AM, Luke Macken wrote:
> The PMIC RTC registers on the Lenovo ThinkPad T14s Gen 7 are read-only,
> so an offset needs to be stored in machine-specific non-volatile memory
> which the RTC driver can take into account when reading or updating the
> time.
> 
> The firmware on this machine does not provide the RTCInfo UEFI variable
> that other Glymur based machines use for this purpose, so, as on
> sc8280xp-crd and the QCS8550 boards, reserve four bytes in one of the
> PMIC SDAM blocks to hold the RTC offset. SDAM 2 on PMK8850 is 128 bytes
> and its last word is not used by the firmware.

Bold claim, there's a lot of firmware!

On Glymur machines, the RTC is coordinated through SoCCP. We're working
on providing an interface to that.

[...]


> Note for reviewers: Qualcomm's "rtc: Add Qualcomm PMIC RTC-GLINK support
> for Glymur" (August 2026) would move the RTC behind the charger firmware
> on these machines, but it has not been resubmitted and needs firmware
> that at least the ThinkPad does not ship yet. This patch uses the
> existing rtc-pm8xxx nvmem offset mechanism in the meantime and does not
> conflict with that work.

There's another access mechanism to pmic-glink that may unblock this.

Konrad

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-21 10:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-16 23:25 [PATCH] arm64: dts: qcom: mahua-t14s: store the RTC offset in SDAM Luke Macken
2026-10-21 10:39 ` Konrad Dybcio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®