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

* Re: [PATCH] rtc: pm8xxx: Don't fail probe if the UEFI offset variable is missing
  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
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-26  5:54 UTC (permalink / raw)
  To: Gopikrishna Garmidi; +Cc: linux-rtc, Alexandre Belloni

> 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>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126055009.758156-1-gopikrishna.garmidi@oss.qualcomm.com?part=1

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

* Re: [PATCH] rtc: pm8xxx: Don't fail probe if the UEFI offset variable is missing
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2026-11-26  7:01 UTC (permalink / raw)
  To: Gopikrishna Garmidi
  Cc: Alexandre Belloni, Johan Hovold, Bjorn Andersson, Konrad Dybcio,
	Abel Vesa, Rob Herring, Sibi Sankar, Dmitry Baryshkov, linux-rtc,
	linux-arm-msm

On Wed, Nov 25, 2026 at 09:50:09PM -0800, Gopikrishna Garmidi wrote:
> 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.

No, this is working as intended and the driver should not create this
variable.

If the firmware doesn't set this variable then this platform uses some
other means to store the RTC time. Please add support for that so that
the time is synchronised with UEFI setup (and any other OS).

The devicetree property in question describes how the platform works,
it's not a configuration flag.

Also see:

	https://lore.kernel.org/all/aoxrOaY7RIFEqVr2@hovoldconsulting.com/

> 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")

This is clearly not a fix in any case.

> Signed-off-by: Gopikrishna Garmidi <gopikrishna.garmidi@oss.qualcomm.com>

Johan

^ permalink raw reply	[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