x1e80100 RTC support
Subsystems (4)
v2 cover x1e80100 RTC support
x1e80100 needs a workaround because the RTC alarm is not owned by HLOS. It also needs the same offset workaround as sc8280xp/etc.
v2: remove duplicated ops and use RTC_FEATURE_ALARM instead
Jonathan Marek (5):
rtc: pm8xxx: implement no-alarm flag for non-HLOS owned alarm
dt-bindings: rtc: qcom-pm8xxx: document no-alarm flag
arm64: dts: qcom: x1e80100-pmics: enable RTC
arm64: dts: qcom: x1e80100-crd: add rtc offset to set rtc time
arm64: dts: qcom: x1e78100-t14s: add rtc offset to set rtc time
.../bindings/rtc/qcom-pm8xxx-rtc.yaml | 5 +++ .../qcom/x1e78100-lenovo-thinkpad-t14s.dts | 11 +++++ arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 11 +++++ arch/arm64/boot/dts/qcom/x1e80100-pmics.dtsi | 8 ++-- drivers/rtc/rtc-pm8xxx.c | 43 +++++++++++++------ 5 files changed, 59 insertions(+), 19 deletions(-)
Signature · 1 line
2.45.1
PATCH v2 1/5 rtc: pm8xxx: implement no-alarm flag for non-HLOS owned alarm
Qualcomm x1e80100 firmware sets the ownership of the RTC alarm to ADSP. Thus writing to RTC alarm registers and receiving alarm interrupts is not possible.
Add a no-alarm flag to support RTC on this platform.
--- drivers/rtc/rtc-pm8xxx.c | 43 +++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 14 deletions(-)
drivers/rtc/rtc-pm8xxx.c +29 -14
@@ -61,6 +61,7 @@ struct pm8xxx_rtc {struct rtc_device *rtc;struct regmap *regmap;bool allow_set_time; +bool no_alarm;int alarm_irq;const struct pm8xxx_rtc_regs *regs;struct device *dev;
@@ -473,9 +474,13 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)if (!rtc_dd->regmap)return -ENXIO ; - rtc_dd->alarm_irq =platform_get_irq (pdev,0 ); -if (rtc_dd->alarm_irq <0 ) -return -ENXIO ; + rtc_dd->no_alarm =of_property_read_bool (pdev->dev.of_node,"no-alarm" ); + +if (!rtc_dd->no_alarm) { + rtc_dd->alarm_irq =platform_get_irq (pdev,0 ); +if (rtc_dd->alarm_irq <0 ) +return -ENXIO ; + } rtc_dd->allow_set_time =of_property_read_bool (pdev->dev.of_node,"allow-set-time" );
@@ -503,7 +508,8 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)platform_set_drvdata (pdev, rtc_dd); -device_init_wakeup (&pdev->dev,1 ); +if (!rtc_dd->no_alarm) +device_init_wakeup (&pdev->dev,1 ); rtc_dd->rtc =devm_rtc_allocate_device (&pdev->dev);if (IS_ERR (rtc_dd->rtc))
@@ -512,27 +518,36 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev) rtc_dd->rtc->ops = &pm8xxx_rtc_ops; rtc_dd->rtc->range_max =U32_MAX ; - rc =devm_request_any_context_irq (&pdev->dev, rtc_dd->alarm_irq, - pm8xxx_alarm_trigger, -IRQF_TRIGGER_RISING , -"pm8xxx_rtc_alarm" , rtc_dd); -if (rc <0 ) -return rc; +if (!rtc_dd->no_alarm) { + rc =devm_request_any_context_irq (&pdev->dev, rtc_dd->alarm_irq, + pm8xxx_alarm_trigger, +IRQF_TRIGGER_RISING , +"pm8xxx_rtc_alarm" , rtc_dd); +if (rc <0 ) +return rc; + } rc =devm_rtc_register_device (rtc_dd->rtc);if (rc)return rc; - rc =dev_pm_set_wake_irq (&pdev->dev, rtc_dd->alarm_irq); -if (rc) -return rc; +if (!rtc_dd->no_alarm) { + rc =dev_pm_set_wake_irq (&pdev->dev, rtc_dd->alarm_irq); +if (rc) +return rc; + }else { +clear_bit (RTC_FEATURE_ALARM , rtc_dd->rtc->features); + }return 0 ; }static void pm8xxx_remove (struct platform_device *pdev) { -dev_pm_clear_wake_irq (&pdev->dev); +struct pm8xxx_rtc *rtc_dd =platform_get_drvdata (pdev); + +if (!rtc_dd->no_alarm) +dev_pm_clear_wake_irq (&pdev->dev); }static struct platform_driver pm8xxx_rtc_driver = {
Signature · 1 line
2.45.1
PATCH v2 2/5 dt-bindings: rtc: qcom-pm8xxx: document no-alarm flag
In reply to Jonathan MarekQualcomm x1e80100 firmware sets the ownership of the RTC alarm to ADSP. Thus writing to RTC alarm registers and receiving alarm interrupts is not possible.
Add a no-alarm flag to support RTC on this platform.
--- Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml +5 -0
@@ -40,6 +40,11 @@ properties: description: Indicates that the setting of RTC time is allowed by the host CPU. + no-alarm: + $ref: /schemas/types.yaml#/definitions/flag + description: + Indicates that RTC alarm is not owned by HLOS (Linux). + nvmem-cells: items: - description:
Signature · 1 line
2.45.1
Re: [PATCH v2 2/5] dt-bindings: rtc: qcom-pm8xxx: document no-alarm flag
Quoted 16 lines · Jonathan Marek
Qualcomm x1e80100 firmware sets the ownership of the RTC alarm to ADSP. Thus writing to RTC alarm registers and receiving alarm interrupts is not possible.
Add a no-alarm flag to support RTC on this platform.
Signed-off-by Jonathan Marek <[email protected]>--- Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml | 5 +++++ 1 file changed, 5 insertions(+)Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml +0
-0
Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml properties: · line 46
Quoted 7 lines
Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml +4
-0@@ -40,6 +40,11 @@ properties: description: Indicates that the setting of RTC time is allowed by the host CPU. + no-alarm: + $ref: /schemas/types.yaml#/definitions/flag + description: + Indicates that RTC alarm is not owned by HLOS (Linux).
This is not even properly used/tested, because you disable the RTC entirely in your DTS.
I expect here unified property for all Qualcomm devices for this case. We already have "remotely-controlled" and other flavors. I don't want each device to express the same with different name...
Also: missing vendor prefix.
Best regards,
Krzysztof
Re: [PATCH v2 2/5] dt-bindings: rtc: qcom-pm8xxx: document no-alarm flag
Quoted 20 lines · Krzysztof Kozlowski
Quoted 19 lines · Jonathan Marek
Qualcomm x1e80100 firmware sets the ownership of the RTC alarm to ADSP. Thus writing to RTC alarm registers and receiving alarm interrupts is not possible.
Add a no-alarm flag to support RTC on this platform.
Signed-off-by Jonathan Marek <[email protected]>--- Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml | 5 +++++ 1 file changed, 5 insertions(+)Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml +0
-0@@ -40,6 +40,11 @@ properties: description: Indicates that the setting of RTC time is allowed by the host CPU.
Quoted 8 lines
Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml properties: · line 46
Quoted 4 lines
Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml +4
-0+ no-alarm: + $ref: /schemas/types.yaml#/definitions/flag + description: + Indicates that RTC alarm is not owned by HLOS (Linux).This is not even properly used/tested, because you disable the RTC entirely in your DTS.
What? The next patch in this series is enabling RTC on x1e using this flag
Quoted 6 lines
I expect here unified property for all Qualcomm devices for this case. We already have "remotely-controlled" and other flavors. I don't want each device to express the same with different name...
Also: missing vendor prefix.
I don't care what the property is named (as long as its a bool property), if you have a name you prefer I will use it.
The existing 'allow-set-time' property (also related to HLOS permissions to the RTC) is also specific to this driver doesn't have a vendor prefix.
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH v2 2/5] dt-bindings: rtc: qcom-pm8xxx: document no-alarm flag
Quoted 30 lines · Jonathan Marek
Quoted 20 lines · Krzysztof Kozlowski
Quoted 19 lines · Jonathan Marek
Qualcomm x1e80100 firmware sets the ownership of the RTC alarm to ADSP. Thus writing to RTC alarm registers and receiving alarm interrupts is not possible.
Add a no-alarm flag to support RTC on this platform.
Signed-off-by Jonathan Marek <[email protected]>--- Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml | 5 +++++ 1 file changed, 5 insertions(+)Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml +0
-0@@ -40,6 +40,11 @@ properties: description: Indicates that the setting of RTC time is allowed by the host CPU.Quoted 8 lines
Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml properties: · line 46
Quoted 4 lines
Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml +4
-0+ no-alarm: + $ref: /schemas/types.yaml#/definitions/flag + description: + Indicates that RTC alarm is not owned by HLOS (Linux).This is not even properly used/tested, because you disable the RTC entirely in your DTS.
Quoted 1 line
What? The next patch in this series is enabling RTC on x1e using this flag
D'oh, right, I must have looked at wrong diff hunks. I had somehow impression you add status=reserved, but you just dropped it.
Quoted 5 lines
Quoted 5 lines
I expect here unified property for all Qualcomm devices for this case. We already have "remotely-controlled" and other flavors. I don't want each device to express the same with different name...
Quoted 8 lines
Quoted 2 lines
Also: missing vendor prefix.
I don't care what the property is named (as long as its a bool property), if you have a name you prefer I will use it.
The existing 'allow-set-time' property (also related to HLOS permissions to the RTC) is also specific to this driver doesn't have a vendor prefix.
Yeah, that one sneaked in some years ago.
So you can set time, but not alarm? Some previous platforms could not set time, but could set alarm?
I wonder whether we actually describe the real issue here. It looks like group of band-aids.
Best regards,
Krzysztof
Re: [PATCH v2 2/5] dt-bindings: rtc: qcom-pm8xxx: document no-alarm flag
Quoted 52 lines · Krzysztof Kozlowski
Quoted 30 lines · Jonathan Marek
Quoted 20 lines · Krzysztof Kozlowski
Quoted 19 lines · Jonathan Marek
Qualcomm x1e80100 firmware sets the ownership of the RTC alarm to ADSP. Thus writing to RTC alarm registers and receiving alarm interrupts is not possible.
Add a no-alarm flag to support RTC on this platform.
Signed-off-by Jonathan Marek <[email protected]>--- Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml | 5 +++++ 1 file changed, 5 insertions(+)Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml +0
-0@@ -40,6 +40,11 @@ properties: description: Indicates that the setting of RTC time is allowed by the host CPU.Quoted 8 lines
Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml properties: · line 46
Quoted 4 lines
Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml +4
-0+ no-alarm: + $ref: /schemas/types.yaml#/definitions/flag + description: + Indicates that RTC alarm is not owned by HLOS (Linux).This is not even properly used/tested, because you disable the RTC entirely in your DTS.
Quoted 1 line
What? The next patch in this series is enabling RTC on x1e using this flag
D'oh, right, I must have looked at wrong diff hunks. I had somehow impression you add status=reserved, but you just dropped it.
Quoted 5 lines
Quoted 5 lines
I expect here unified property for all Qualcomm devices for this case. We already have "remotely-controlled" and other flavors. I don't want each device to express the same with different name...
Quoted 8 lines
Quoted 2 lines
Also: missing vendor prefix.
I don't care what the property is named (as long as its a bool property), if you have a name you prefer I will use it.
The existing 'allow-set-time' property (also related to HLOS permissions to the RTC) is also specific to this driver doesn't have a vendor prefix.
Yeah, that one sneaked in some years ago.
Quoted 9 lines
So you can set time, but not alarm? Some previous platforms could not set time, but could set alarm?
I wonder whether we actually describe the real issue here. It looks like group of band-aids.
Best regards,
Krzysztof
Firmware can set different permissions for the RTC time (0x61xx) and RTC alarm (0x62xx) regions. So it makes sense to have one flag for each region.
RTC time is almost always read-only (not owned by HLOS/Linux), so the 'allow-set-time' property is almost never used (the driver supports using nvmem to store an offset for setting time as a workaround).
The "can set time, but not alarm" combination will probably never be used, but the 3 other combinations are possible (the common one is "can't set time, but can set alarm").
(in the next patch I deleted the "alarm" region/interrupt from the dts but that's wrong, the HW still exists, the patch should be only replacing the reserved status with the new flag)
Re: [PATCH v2 2/5] dt-bindings: rtc: qcom-pm8xxx: document no-alarm flag
Quoted 70 lines · Jonathan Marek
Quoted 52 lines · Krzysztof Kozlowski
Quoted 30 lines · Jonathan Marek
Quoted 20 lines · Krzysztof Kozlowski
Quoted 19 lines · Jonathan Marek
Qualcomm x1e80100 firmware sets the ownership of the RTC alarm to ADSP. Thus writing to RTC alarm registers and receiving alarm interrupts is not possible.
Add a no-alarm flag to support RTC on this platform.
Signed-off-by Jonathan Marek <[email protected]>--- Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml | 5 +++++ 1 file changed, 5 insertions(+)Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml +0
-0@@ -40,6 +40,11 @@ properties: description: Indicates that the setting of RTC time is allowed by the host CPU.Quoted 8 lines
Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml properties: · line 46
Quoted 4 lines
Documentation/devicetree/bindings/rtc/qcom-pm8xxx-rtc.yaml +4
-0+ no-alarm: + $ref: /schemas/types.yaml#/definitions/flag + description: + Indicates that RTC alarm is not owned by HLOS (Linux).This is not even properly used/tested, because you disable the RTC entirely in your DTS.
Quoted 1 line
What? The next patch in this series is enabling RTC on x1e using this flag
D'oh, right, I must have looked at wrong diff hunks. I had somehow impression you add status=reserved, but you just dropped it.
Quoted 5 lines
Quoted 5 lines
I expect here unified property for all Qualcomm devices for this case. We already have "remotely-controlled" and other flavors. I don't want each device to express the same with different name...
Quoted 8 lines
Quoted 2 lines
Also: missing vendor prefix.
I don't care what the property is named (as long as its a bool property), if you have a name you prefer I will use it.
The existing 'allow-set-time' property (also related to HLOS permissions to the RTC) is also specific to this driver doesn't have a vendor prefix.
Yeah, that one sneaked in some years ago.
Quoted 9 lines
So you can set time, but not alarm? Some previous platforms could not set time, but could set alarm?
I wonder whether we actually describe the real issue here. It looks like group of band-aids.
Best regards,
KrzysztofFirmware can set different permissions for the RTC time (0x61xx) and RTC alarm (0x62xx) regions. So it makes sense to have one flag for each region.
RTC time is almost always read-only (not owned by HLOS/Linux), so the 'allow-set-time' property is almost never used (the driver supports using nvmem to store an offset for setting time as a workaround).
Quoted 7 lines
The "can set time, but not alarm" combination will probably never be used, but the 3 other combinations are possible (the common one is "can't set time, but can set alarm").
(in the next patch I deleted the "alarm" region/interrupt from the dts but that's wrong, the HW still exists, the patch should be only replacing the reserved status with the new flag)
OK, let's just add vendor prefix and describe actual hardware property, e.g. qcom,no-alarm or qcom,alarm-restricted
Best regards,
Krzysztof
PATCH v2 3/5 arm64: dts: qcom: x1e80100-pmics: enable RTC
In reply to Jonathan MarekOnly access to RTC alarm is blocked.
Enable RTC access by setting the no-alarm flag.
--- arch/arm64/boot/dts/qcom/x1e80100-pmics.dtsi | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/qcom/x1e80100-pmics.dtsi +3 -5
@@ -220,11 +220,9 @@ pon_resin: resin { pmk8550_rtc: rtc@6100 { compatible = "qcom,pmk8350-rtc"; - reg = <0x6100>, <0x6200>; - reg-names = "rtc", "alarm"; - interrupts = <0x0 0x62 0x1 IRQ_TYPE_EDGE_RISING>; - /* Not yet sure what blocks access */ - status = "reserved"; + reg = <0x6100>; + reg-names = "rtc"; + no-alarm; /* alarm owned by ADSP */ }; pmk8550_sdam_2: nvram@7100 {
Signature · 1 line
2.45.1
PATCH v2 4/5 arm64: dts: qcom: x1e80100-crd: add rtc offset to set rtc time
In reply to Jonathan MarekSee commit e67b45582c5e for explanation.
Note: the 0xbc offset is arbitrary, it just needs to not be already in use.
--- arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/qcom/x1e80100-crd.dts +11 -0
@@ -1224,6 +1224,17 @@ edp_bl_en: edp-bl-en-state { }; }; +&pmk8550_rtc { + nvmem-cells = <&rtc_offset>; + nvmem-cell-names = "offset"; +}; + +&pmk8550_sdam_2 { + rtc_offset: rtc-offset@bc { + reg = <0xbc 0x4>; + }; +}; + &qupv3_0 { status = "okay"; };
Signature · 1 line
2.45.1
PATCH v2 5/5 arm64: dts: qcom: x1e78100-t14s: add rtc offset to set rtc time
In reply to Jonathan MarekSee commit e67b45582c5e for explanation.
Note: the 0xbc offset is arbitrary, it just needs to not be already in use.
--- .../boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts +11 -0
@@ -897,6 +897,17 @@ edp_bl_en: edp-bl-en-state { }; }; +&pmk8550_rtc { + nvmem-cells = <&rtc_offset>; + nvmem-cell-names = "offset"; +}; + +&pmk8550_sdam_2 { + rtc_offset: rtc-offset@bc { + reg = <0xbc 0x4>; + }; +}; + &qupv3_0 { status = "okay"; };
Signature · 1 line
2.45.1
Rob Herring (Arm)
maintainerQuoted 19 lines · Jonathan Marek
x1e80100 needs a workaround because the RTC alarm is not owned by HLOS. It also needs the same offset workaround as sc8280xp/etc.
v2: remove duplicated ops and use
RTC_FEATURE_ALARMinsteadJonathan Marek (5):
rtc: pm8xxx: implement no-alarm flag for non-HLOS owned alarm
dt-bindings: rtc: qcom-pm8xxx: document no-alarm flag
arm64: dts: qcom: x1e80100-pmics: enable RTC
arm64: dts: qcom: x1e80100-crd: add rtc offset to set rtc time
arm64: dts: qcom: x1e78100-t14s: add rtc offset to set rtc time.../bindings/rtc/qcom-pm8xxx-rtc.yaml | 5 +++ .../qcom/x1e78100-lenovo-thinkpad-t14s.dts | 11 +++++ arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 11 +++++ arch/arm64/boot/dts/qcom/x1e80100-pmics.dtsi | 8 ++-- drivers/rtc/rtc-pm8xxx.c | 43 +++++++++++++------ 5 files changed, 59 insertions(+), 19 deletions(-)
Quoted 5 lines
--
2.45.1
My bot found new DTB warnings on the .dts files added or changed in this series.
Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.
If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:
pip3 install dtschema --upgrade
New warnings running 'make CHECK_DTBS=y qcom/x1e78100-lenovo-thinkpad-t14s.dtb qcom/x1e80100-crd.dtb' for [email protected]:
arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dtb: pmic@0: rtc@6100: 'oneOf' conditional failed, one must be fixed:
'interrupts' is a required property
'interrupts-extended' is a required property
from schema $id: http://devicetree.org/schemas/mfd/qcom,spmi-pmic.yaml#arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dtb: rtc@6100: 'oneOf' conditional failed, one must be fixed:
'interrupts' is a required property
'interrupts-extended' is a required property
from schema $id: http://devicetree.org/schemas/rtc/qcom-pm8xxx-rtc.yaml#arch/arm64/boot/dts/qcom/x1e80100-crd.dtb: pmic@0: rtc@6100: 'oneOf' conditional failed, one must be fixed:
'interrupts' is a required property
'interrupts-extended' is a required property
from schema $id: http://devicetree.org/schemas/mfd/qcom,spmi-pmic.yaml#arch/arm64/boot/dts/qcom/x1e80100-crd.dtb: rtc@6100: 'oneOf' conditional failed, one must be fixed:
'interrupts' is a required property
'interrupts-extended' is a required property
from schema $id: http://devicetree.org/schemas/rtc/qcom-pm8xxx-rtc.yaml#