Skip to content

Commit ead4532

Browse files
jhovoldalexandrebelloni
authored andcommitted
rtc: pm8xxx: fix uefi offset lookup
On many Qualcomm platforms the PMIC RTC control and time registers are read-only so that the RTC time can not be updated. Instead an offset needs be stored in some machine-specific non-volatile memory, which a driver can take into account. On platforms where the offset is stored in a Qualcomm specific UEFI variable the variables are also accessed in a non-standard way, which means that the OS cannot assume that the variable service is available by the time the driver probes. Use the new 'qcom,uefi-rtc-info' property to determine whether to probe defer until the UEFI offset becomes available so that the offset can be used also when the RTC driver is built in or when a dependency of the UEFI variable driver is built as a module (e.g. the driver for the SCM interconnects). Fixes: bba38b8 ("rtc: pm8xxx: add support for uefi offset") Reported-by: Rob Clark <[email protected]> Link: https://lore.kernel.org/lkml/CAF6AEGsfke=x0p1b2-uNX6DuQfRyEjVbJaxTbVLDT2YvSkGJbg@mail.gmail.com/ Signed-off-by: Johan Hovold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent b23b91d commit ead4532

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

drivers/rtc/rtc-pm8xxx.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -576,13 +576,20 @@ static int pm8xxx_rtc_probe_offset(struct pm8xxx_rtc *rtc_dd)
576576
}
577577

578578
/* Use UEFI storage as fallback if available */
579-
if (efivar_is_available()) {
580-
rc = pm8xxx_rtc_read_uefi_offset(rtc_dd);
581-
if (rc == 0)
582-
rtc_dd->use_uefi = true;
579+
rtc_dd->use_uefi = of_property_read_bool(rtc_dd->dev->of_node,
580+
"qcom,uefi-rtc-info");
581+
if (!rtc_dd->use_uefi)
582+
return 0;
583+
584+
if (!efivar_is_available()) {
585+
if (IS_ENABLED(CONFIG_EFI))
586+
return -EPROBE_DEFER;
587+
588+
dev_warn(rtc_dd->dev, "efivars not available\n");
589+
rtc_dd->use_uefi = false;
583590
}
584591

585-
return 0;
592+
return pm8xxx_rtc_read_uefi_offset(rtc_dd);
586593
}
587594

588595
static int pm8xxx_rtc_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)