Linux RTC
 help / color / mirror / Atom feed
* [PATCH] rtc: pm8xxx: Don't fail probe if the UEFI offset variable is missing
@ 2026-11-26  5:50 Gopikrishna Garmidi
  2026-11-26  5:54 ` sashiko-bot
  2026-11-26  7:01 ` Johan Hovold
  0 siblings, 2 replies; 3+ messages in thread
From: Gopikrishna Garmidi @ 2026-11-26  5:50 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Johan Hovold, Bjorn Andersson, Konrad Dybcio, Abel Vesa,
	Rob Herring, Sibi Sankar, Dmitry Baryshkov, linux-rtc,
	linux-arm-msm, Gopikrishna Garmidi

On boards that set qcom,uefi-rtc-info, the RTC offset is read from the
RTCInfo UEFI variable at probe time. Not every firmware creates this
variable. On the Microsoft Surface Laptop 8th Edition the variable store
is accessible but RTCInfo does not exist, so the read returns
EFI_NOT_FOUND and the probe fails:

  rtc-pm8xxx c426000.spmi:pmic@0:rtc@6100: probe with driver
  rtc-pm8xxx failed with error -2

As no RTC device is registered, the time can never be set and the
variable is never created.

Treat a missing variable as a zero offset. It gets written the first
time the time is set, as for any other offset update.

Fixes: bba38b874886 ("rtc: pm8xxx: add support for uefi offset")
Signed-off-by: Gopikrishna Garmidi <gopikrishna.garmidi@oss.qualcomm.com>
---
 drivers/rtc/rtc-pm8xxx.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index 40b6b62116dc..747fd81c8146 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -109,6 +109,16 @@ static int pm8xxx_rtc_read_uefi_offset(struct pm8xxx_rtc *rtc_dd)
 				     &size, rtc_info);
 	efivar_unlock();
 
+	/*
+	 * Not every firmware creates the variable. Start with a zero offset,
+	 * it gets written when the time is set for the first time.
+	 */
+	if (status == EFI_NOT_FOUND) {
+		dev_dbg(dev, "UEFI offset not found, assuming zero\n");
+		rtc_dd->offset = 0;
+		return 0;
+	}
+
 	if (status != EFI_SUCCESS) {
 		dev_dbg(dev, "failed to read UEFI offset: %lu\n", status);
 		return efi_status_to_err(status);
-- 
2.34.1


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

end of thread, other threads:[~2026-11-26  7:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26  5:50 [PATCH] rtc: pm8xxx: Don't fail probe if the UEFI offset variable is missing Gopikrishna Garmidi
2026-11-26  5:54 ` sashiko-bot
2026-11-26  7:01 ` Johan Hovold

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