power: sequencing: qcom-wcn: support SW_CTRL wake IRQ
Subsystems (5)
cover power: sequencing: qcom-wcn: support SW_CTRL wake IRQ
Some WCN3990-family designs connect the SW_CTRL output to a GPIO on the application processor. On Shikra, the WCN3988 SW_CTRL signal is connected to GPIO88 and is used through the MGPI/AOSS hardware path to request the required RF clocks.
Qualcomm downstream kernels configure this path through msm_gpio_mpm_wake_set(), but upstream does not provide an equivalent API. This series models SW_CTRL as a dedicated wake IRQ. Requesting the GPIO IRQ resource enables POWER_SAVE_WAKEUP_ENABLE in Qualcomm TLMM when WAKEUP_PRESENT is advertised, while the PM core keeps the IRQ disabled during normal operation and arms it for system suspend.
This is an RFC because the intended hardware and software model still needs confirmation. In particular, please advise whether SW_CTRL should be represented as an AP wake source using dev_pm_set_dedicated_wake_irq(), or whether Linux only needs an interface to explicitly configure the TLMM/MGPI power-save path.
The series documents the named wakeup interrupt for the WCN PMU binding, implements dedicated wake IRQ handling in the Qualcomm WCN power sequencer, and enables it on the Shikra CQM, CQS and IQS EVKs. On this base, CQM and CQS share shikra-cqm-som.dtsi, while IQS uses shikra-iqs-som.dtsi.
Testing:
- scripts/checkpatch.pl --strict: passed
- dt-binding-check: passed
- dtb-check: passed
- sparse-check: passed
- Shikra CQM, CQS and IQS DTB builds: passed
- QIPL validation of the equivalent qcom-6.18.y implementation: passed
An earlier experiment confirmed that requesting GPIO88 as an IRQ changes TLMM_GPIO_INTR_CFG88 from 0x942 to 0x9c2, setting POWER_SAVE_WAKEUP_ENABLE.
Linghui Wu (3):
dt-bindings: power: sequencing: qcom-wcn: document wakeup-source
power: sequencing: qcom-wcn: support SW_CTRL wake IRQ
arm64: dts: qcom: shikra: enable WCN SW_CTRL wakeup
.../bindings/regulator/qcom,wcn3990-pmu.yaml | 22 ++++++++++++++ arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi | 4 +++ arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi | 4 +++ drivers/power/sequencing/pwrseq-qcom-wcn.c | 30 +++++++++++++++++++ 4 files changed, 60 insertions(+)
base-commit: a90ee4305c4a5df72c11b31dacfdc76e00fcf78a
Signature · 1 line
2.43.0
RFC PATCH 1/3 dt-bindings: power: sequencing: qcom-wcn: document wakeup-source
Some WCN3990-family designs connect SW_CTRL to an interrupt capable of waking the application processor.
Document the dedicated "wakeup" interrupt and wakeup-source property for the WCN PMU node.
--- .../bindings/regulator/qcom,wcn3990-pmu.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)
Documentation/devicetree/bindings/regulator/qcom,wcn3990-pmu.yaml +22 -0
@@ -42,6 +42,20 @@ properties: maxItems: 1 description: GPIO line indicating the state of the clock supply to the BT module + interrupts: + maxItems: 1 + description: SW_CTRL wake interrupt, asserted when the WCN chip is active + + interrupt-names: + const: wakeup + + wakeup-source: + type: boolean + description: + Mark the PMU as a wakeup source. Requires the "wakeup" interrupt to be + present. When set, the SW_CTRL IRQ is used to wake the application + processor from system suspend. + clocks: maxItems: 1 description: Reference clock handle
@@ -67,6 +81,14 @@ required: - vddrf-supply - vddch0-supply +dependencies: + wakeup-source: + required: + - interrupt-names + anyOf: + - required: [interrupts] + - required: [interrupts-extended] + additionalProperties: false examples:
Signature · 1 line
2.43.0
Bartosz Golaszewski
maintainerRe: [RFC PATCH 1/3] dt-bindings: power: sequencing: qcom-wcn: document wakeup-source
Quoted 8 lines · Linghui Wu
Some WCN3990-family designs connect
SW_CTRLto an interrupt capable of waking the application processor.Document the dedicated "wakeup" interrupt and wakeup-source property for the WCN PMU node.
Signed-off-by Linghui Wu <[email protected]>---
The commit subject should say: "dt-bindings: regulator: ...". There's no such thing as power sequencing as far as DT bindings are concerned.
Bart
RFC PATCH 2/3 power: sequencing: qcom-wcn: support SW_CTRL wake IRQ
In reply to Linghui WuSome WCN3990-family designs route SW_CTRL to an interrupt capable of waking the application processor. Requesting the IRQ resource also enables the Qualcomm TLMM power-save wakeup path when WAKEUP_PRESENT is advertised.
When the PMU is marked as a wakeup source, retrieve the dedicated "wakeup" interrupt and register it as a dedicated wake IRQ. Keep it disabled during normal operation and let the PM core arm it for system suspend.
--- drivers/power/sequencing/pwrseq-qcom-wcn.c | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/power/sequencing/pwrseq-qcom-wcn.c +30 -0
@@ -11,6 +11,8 @@#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/pm_wakeirq.h> +#include <linux/pm_wakeup.h> #include <linux/property.h> #include <linux/regulator/consumer.h> #include <linux/pwrseq/provider.h>
@@ -454,11 +456,17 @@ static int pwrseq_qcom_wcn3990_match(struct pwrseq_device *pwrseq,return pwrseq_qcom_wcn_match_regulator (pwrseq, dev,"vdd-1.8-xo-supply" ); } +static void pwrseq_qcom_wcn_clear_wake_irq (void *data) +{ +dev_pm_clear_wake_irq (data); +} +static int pwrseq_qcom_wcn_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct pwrseq_qcom_wcn_ctx *ctx;struct pwrseq_config config; +int wake_irq;int i, ret; ctx =devm_kzalloc (dev,sizeof (*ctx),GFP_KERNEL );
@@ -496,6 +504,28 @@ static int pwrseq_qcom_wcn_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (ctx->bt_gpio),"Failed to get the Bluetooth enable GPIO\n" ); +if (device_property_read_bool (dev,"wakeup-source" )) { + wake_irq =platform_get_irq_byname (pdev,"wakeup" ); +if (wake_irq <0 ) +return dev_err_probe (dev, wake_irq, +"Failed to get the SW_CTRL wake IRQ\n" ); + + ret =devm_device_init_wakeup (dev); +if (ret) +return dev_err_probe (dev, ret, +"Failed to enable wakeup\n" ); + + ret =dev_pm_set_dedicated_wake_irq (dev, wake_irq); +if (ret) +return dev_err_probe (dev, ret, +"Failed to set the SW_CTRL wake IRQ\n" ); + + ret =devm_add_action_or_reset (dev, + pwrseq_qcom_wcn_clear_wake_irq, dev); +if (ret) +return ret; + } +/* * FIXME: This should actually be GPIOD_OUT_LOW, but doing so would * cause the WLAN power to be toggled, resulting in PCIe link down.
Signature · 1 line
2.43.0
RFC PATCH 3/3 arm64: dts: qcom: shikra: enable WCN SW_CTRL wakeup
In reply to Linghui WuConfigure the WCN power sequencer SW_CTRL signal as a named wake IRQ and mark it as a wakeup source. The CQM SOM DTSI is shared by the CQM and CQS EVKs, while the IQS EVK uses the IQS SOM DTSI.
--- arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi | 4 ++++ arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi | 4 ++++ 2 files changed, 8 insertions(+)
arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi +4 -0
@@ -4,6 +4,7 @@ */ #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> #include "shikra.dtsi"
@@ -39,6 +40,9 @@ wcn3988-pmu { pinctrl-names = "default"; swctrl-gpios = <&tlmm 88 GPIO_ACTIVE_HIGH>; + interrupts-extended = <&tlmm 88 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "wakeup"; + wakeup-source; vddio-supply = <&pm4125_l7>; vddxo-supply = <&pm4125_l13>;
arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi +4 -0
@@ -4,6 +4,7 @@ */ #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> #include "shikra.dtsi"
@@ -46,6 +47,9 @@ wcn3988-pmu { pinctrl-names = "default"; swctrl-gpios = <&tlmm 88 GPIO_ACTIVE_HIGH>; + interrupts-extended = <&tlmm 88 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "wakeup"; + wakeup-source; vddio-supply = <&pm8150_s4>; vddxo-supply = <&pm8150_l12>;
Signature · 1 line
2.43.0
Re: [RFC PATCH 3/3] arm64: dts: qcom: shikra: enable WCN SW_CTRL wakeup
Quoted 3 lines · Linghui Wu
Configure the WCN power sequencer
SW_CTRLsignal as a named wake IRQ and mark it as a wakeup source. The CQM SOM DTSI is shared by the CQM and CQS EVKs, while the IQS EVK uses the IQS SOM DTSI.
You already have a reference to that pin. You can do something like gpiod_to_irq()
Konrad
Quoted 7 lines · Linghui Wu
Some WCN3990-family designs connect the
SW_CTRLoutput to a GPIO on the application processor. On Shikra, the WCN3988SW_CTRLsignal is connected to GPIO88 and is used through the MGPI/AOSS hardware path to request the required RF clocks.Qualcomm downstream kernels configure this path through
msm_gpio_mpm_wake_set(), but upstream does not provide an equivalent API.
This information is not useful to the reader who doesn't follow the Qualcomm downstream kernels.
Quoted 4 lines
This series models
SW_CTRLas a dedicated wake IRQ. Requesting the GPIO IRQ resource enablesPOWER_SAVE_WAKEUP_ENABLEin Qualcomm TLMM whenWAKEUP_PRESENTis advertised, while the PM core keeps the IRQ disabled during normal operation and arms it for system suspend.
This starts off good, but zooms in too much on the specifics, instead of the functional outcome.
Quoted 5 lines
This is an RFC because the intended hardware and software model still needs confirmation. In particular, please advise whether
SW_CTRLshould be represented as an AP wake source usingdev_pm_set_dedicated_wake_irq(), or whether Linux only needs an interface to explicitly configure the TLMM/MGPI power-save path.
You threw a lot of Qualcomm TLAs at potentially non-Qualcomm reviewers, so it's not really possible for them to give you this advice.
Quoted 5 lines
The series documents the named wakeup interrupt for the WCN PMU binding, implements dedicated wake IRQ handling in the Qualcomm WCN power sequencer, and enables it on the Shikra CQM, CQS and IQS EVKs. On this base, CQM and CQS share
shikra-cqm-som.dtsi, while IQS usesshikra-iqs-som.dtsi.
The second sentence brings no value.
Quoted 6 lines
Testing:
-scripts/checkpatch.pl--strict: passed
- dt-binding-check: passed
- dtb-check: passed
- sparse-check: passed
- Shikra CQM, CQS and IQS DTB builds: passed
The above cases are implicitly expected and shouldn't be listed out.
Quoted 1 line
- QIPL validation of the equivalent qcom-6.18.y implementation: passed
This is a useless test on a year-old kernel with a million patches on top that doesn't reflect whether the change works on the target tree (which is approximately linux-next/master). You must test your changes on the base that you intend the patch to be applied to.
Quoted 9 lines
An earlier experiment confirmed that requesting GPIO88 as an IRQ changes
TLMM_GPIO_INTR_CFG88from0x942to0x9c2, settingPOWER_SAVE_WAKEUP_ENABLE.Linghui Wu (3):
dt-bindings: power: sequencing: qcom-wcn: document wakeup-source
power: sequencing: qcom-wcn: supportSW_CTRLwake IRQ
arm64: dts: qcom: shikra: enable WCNSW_CTRLwakeup
Quoted 8 lines
.../bindings/regulator/qcom,wcn3990-pmu.yaml | 22 ++++++++++++++ arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi | 4 +++ arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi | 4 +++ drivers/power/sequencing/pwrseq-qcom-wcn.c | 30 +++++++++++++++++++ 4 files changed, 60 insertions(+)base-commit:
a90ee4305c4a5df72c11b31dacfdc76e00fcf78a
You must base your changes on linux-next, otherwise your base is effectively 3 months behind the current developments.
Konrad
v2 cover power: sequencing: qcom-wcn: support SW_CTRL wake IRQ
In reply to Linghui WuSome WCN3990-family devices use the SW_CTRL GPIO to indicate that resources must remain available while the application processor is suspended.
Teach the Qualcomm WCN power-sequencing driver to use the existing SW_CTRL GPIO as a dedicated wake IRQ when the power sequencer is marked as a wakeup source. The PM core keeps the IRQ disabled during normal operation and arms it for system suspend.
The series documents wakeup-source for the WCN PMU binding and enables it for the Shikra CQM, CQS and IQS EVKs.
The series is based on next-20261014 and has only been build tested because a Shikra setup capable of booting linux-next is not currently available.
Changes in v2:
- Derive the wake IRQ from the existing SW_CTRL GPIO with gpiod_to_irq().
- Drop the separate interrupt description from the binding and DTS.
- Focus the description on the functional behavior.
- Rebase onto next-20261014.
Linghui Wu (3):
dt-bindings: power: sequencing: qcom-wcn: document wakeup-source
power: sequencing: qcom-wcn: support SW_CTRL wake IRQ
arm64: dts: qcom: shikra: enable WCN SW_CTRL wakeup
.../bindings/regulator/qcom,wcn3990-pmu.yaml | 6 ++++ arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi | 1 + arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi | 1 + drivers/power/sequencing/pwrseq-qcom-wcn.c | 36 +++++++++++++++++++ 4 files changed, 44 insertions(+)
base-commit: d419d682257d813f6cb7a28e42b35d0edf4ad038
Signature · 1 line
2.43.0
RFC PATCH v2 1/3 dt-bindings: power: sequencing: qcom-wcn: document wakeup-source
The SW_CTRL GPIO can be used as a wake signal on platforms where the WCN device must wake the application processor.
Document wakeup-source and require the existing swctrl-gpios property when it is present.
--- .../devicetree/bindings/regulator/qcom,wcn3990-pmu.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/regulator/qcom,wcn3990-pmu.yaml +6 -0
@@ -42,6 +42,8 @@ properties: maxItems: 1 description: GPIO line indicating the state of the clock supply to the BT module + wakeup-source: true + clocks: maxItems: 1 description: Reference clock handle
@@ -67,6 +69,10 @@ required: - vddrf-supply - vddch0-supply +dependentRequired: + wakeup-source: + - swctrl-gpios + additionalProperties: false examples:
Signature · 1 line
2.43.0
Re: [RFC PATCH v2 1/3] dt-bindings: power: sequencing: qcom-wcn: document wakeup-source
Quoted 2 lines · Linghui Wu
The
SW_CTRLGPIO can be used as a wake signal on platforms where the WCN device must wake the application processor.
"must"?
Quoted 3 lines
Document wakeup-source and require the existing swctrl-gpios property when it is present.
It's a little strange that the property lands on the power sequencer and not on the WLAN node itself - although presumably it makes some sense given the latter may be dynamically discovered in the general case
Konrad
RFC PATCH v2 2/3 power: sequencing: qcom-wcn: support SW_CTRL wake IRQ
In reply to Linghui WuSome WCN3990-family devices use SW_CTRL to signal that resources must remain available while the application processor is suspended.
When the PMU is marked as a wakeup source, request the existing SW_CTRL GPIO as an input, map it to an IRQ and register it as a dedicated wake IRQ. The PM core then keeps the IRQ disabled during normal operation and arms it for system suspend.
--- drivers/power/sequencing/pwrseq-qcom-wcn.c | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/power/sequencing/pwrseq-qcom-wcn.c +36 -0
@@ -11,6 +11,8 @@#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/pm_wakeirq.h> +#include <linux/pm_wakeup.h> #include <linux/property.h> #include <linux/regulator/consumer.h> #include <linux/pwrseq/provider.h>
@@ -484,11 +486,18 @@ static int pwrseq_qcom_wcn3990_match(struct pwrseq_device *pwrseq,return pwrseq_qcom_wcn_match_regulator (pwrseq, dev,"vdd-1.8-xo-supply" ); } +static void pwrseq_qcom_wcn_clear_wake_irq (void *data) +{ +dev_pm_clear_wake_irq (data); +} +static int pwrseq_qcom_wcn_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct pwrseq_qcom_wcn_ctx *ctx; +struct gpio_desc *swctrl_gpio;struct pwrseq_config config; +int wake_irq;int i, ret; ctx =devm_kzalloc (dev,sizeof (*ctx),GFP_KERNEL );
@@ -526,6 +535,33 @@ static int pwrseq_qcom_wcn_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (ctx->bt_gpio),"Failed to get the Bluetooth enable GPIO\n" ); +if (device_property_read_bool (dev,"wakeup-source" )) { + swctrl_gpio =devm_gpiod_get (dev,"swctrl" ,GPIOD_IN ); +if (IS_ERR (swctrl_gpio)) +return dev_err_probe (dev,PTR_ERR (swctrl_gpio), +"Failed to get the SW_CTRL GPIO\n" ); + + wake_irq =gpiod_to_irq (swctrl_gpio); +if (wake_irq <0 ) +return dev_err_probe (dev, wake_irq, +"Failed to get the SW_CTRL wake IRQ\n" ); + + ret =devm_device_init_wakeup (dev); +if (ret) +return dev_err_probe (dev, ret, +"Failed to enable wakeup\n" ); + + ret =dev_pm_set_dedicated_wake_irq (dev, wake_irq); +if (ret) +return dev_err_probe (dev, ret, +"Failed to set the SW_CTRL wake IRQ\n" ); + + ret =devm_add_action_or_reset (dev, + pwrseq_qcom_wcn_clear_wake_irq, dev); +if (ret) +return ret; + } + ctx->wlan_gpio =devm_gpiod_get_optional (dev,"wlan-enable" ,GPIOD_OUT_LOW );if (IS_ERR (ctx->wlan_gpio))
Signature · 1 line
2.43.0
RFC PATCH v2 3/3 arm64: dts: qcom: shikra: enable WCN SW_CTRL wakeup
In reply to Linghui WuThe WCN3988 SW_CTRL signal can wake the application processor on the Shikra CQM, CQS and IQS EVKs.
Mark the WCN power sequencer as a wakeup source so the driver uses the existing SW_CTRL GPIO as a dedicated wake IRQ.
--- arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi | 1 + arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi | 1 + 2 files changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi +1 -0
@@ -102,6 +102,7 @@ wcn3988-pmu { pinctrl-names = "default"; swctrl-gpios = <&tlmm 88 GPIO_ACTIVE_HIGH>; + wakeup-source; vddio-supply = <&pm4125_l7>; vddxo-supply = <&pm4125_l13>;
arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi +1 -0
@@ -85,6 +85,7 @@ wcn3988-pmu { pinctrl-names = "default"; swctrl-gpios = <&tlmm 88 GPIO_ACTIVE_HIGH>; + wakeup-source; vddio-supply = <&pm8150_s4>; vddxo-supply = <&pm8150_l12>;
Signature · 1 line
2.43.0
Quoted 9 lines · Linghui Wu
Some WCN3990-family devices use the
SW_CTRLGPIO to indicate that resources must remain available while the application processor is suspended.Teach the Qualcomm WCN power-sequencing driver to use the existing
SW_CTRLGPIO as a dedicated wake IRQ when the power sequencer is marked as a wakeup source. The PM core keeps the IRQ disabled during normal operation and arms it for system suspend.
Quoted 6 lines
The series documents wakeup-source for the WCN PMU binding and enables it for the Shikra CQM, CQS and IQS EVKs.
The series is based on next-20261014 and has only been build tested because a Shikra setup capable of booting linux-next is not currently available.
$ git log --oneline arch/arm64/boot/dts/qcom/*shikra* | wc -l 41
$ ls arch/arm64/boot/dts/qcom/*shikra*.dts* -l | wc -l 9
Why are we carrying all of this code then?
Konrad
v3 cover power: sequencing: qcom-wcn: support SW_CTRL wake IRQ
In reply to Linghui WuSome WCN3990-family devices use the SW_CTRL GPIO to indicate that resources need to remain available while the application processor is suspended.
Teach the Qualcomm WCN power-sequencing driver to use the existing SW_CTRL GPIO as a dedicated wake IRQ when the power sequencer is marked as a wakeup source. The PM core keeps the IRQ disabled during normal operation and arms it for system suspend.
The series documents wakeup-source for the WCN PMU binding and enables it for the Shikra CQM, CQS and IQS EVKs.
The series has been runtime-tested on qcom-next and kernel 6.18.y on Shikra hardware.
Changes in v2:
- Derive the wake IRQ from the existing SW_CTRL GPIO with gpiod_to_irq().
- Drop the separate interrupt description from the binding and DTS.
- Focus the description on the functional behavior.
- Rebase onto next-20261014.
Changes in v3:
- Use the "dt-bindings: regulator:" prefix for the binding patch.
- Drop the RFC marker.
- Replace the "must" wording in the wake behavior description.
- Report runtime validation on qcom-next and kernel 6.18.y.
Linghui Wu (3):
dt-bindings: regulator: qcom,wcn3990-pmu: document wakeup-source
power: sequencing: qcom-wcn: support SW_CTRL wake IRQ
arm64: dts: qcom: shikra: enable WCN SW_CTRL wakeup
.../bindings/regulator/qcom,wcn3990-pmu.yaml | 6 ++++ arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi | 1 + arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi | 1 + drivers/power/sequencing/pwrseq-qcom-wcn.c | 36 +++++++++++++++++++ 4 files changed, 44 insertions(+)
base-commit: d419d682257d813f6cb7a28e42b35d0edf4ad038
Signature · 1 line
2.43.0
PATCH v3 1/3 dt-bindings: regulator: qcom,wcn3990-pmu: document
The SW_CTRL GPIO can be used as a wake signal on platforms where the WCN device needs to wake the application processor.
Document wakeup-source and require the existing swctrl-gpios property when wakeup-source is present.
--- .../devicetree/bindings/regulator/qcom,wcn3990-pmu.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/regulator/qcom,wcn3990-pmu.yaml +6 -0
@@ -42,6 +42,8 @@ properties: maxItems: 1 description: GPIO line indicating the state of the clock supply to the BT module + wakeup-source: true + clocks: maxItems: 1 description: Reference clock handle
@@ -67,6 +69,10 @@ required: - vddrf-supply - vddch0-supply +dependentRequired: + wakeup-source: + - swctrl-gpios + additionalProperties: false examples:
Signature · 1 line
2.43.0
Re: [PATCH v3 1/3] dt-bindings: regulator: qcom,wcn3990-pmu: document
Quoted 3 lines · Linghui Wu
The
SW_CTRLGPIO can be used as a wake signal on platforms where the WCN device needs to wake the application processor.
Subject is incomplete and this is somehow buried in RFC huge thread. I guess this is still RFC.
Quoted 2 lines
Document wakeup-source and require the existing swctrl-gpios property when wakeup-source is present.
Best regards,
Krzysztof
PATCH v3 2/3 power: sequencing: qcom-wcn: support SW_CTRL wake
In reply to Linghui WuSome WCN3990-family devices use SW_CTRL to signal that resources need remain available while the application processor is suspended.
When the PMU is marked as a wakeup source, request the existing SW_CTRL GPIO as an input, map it to an IRQ and register it as a dedicated wake IRQ. The PM core then keeps the IRQ disabled during normal operation and arms it for system suspend.
--- drivers/power/sequencing/pwrseq-qcom-wcn.c | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/power/sequencing/pwrseq-qcom-wcn.c +36 -0
@@ -11,6 +11,8 @@#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/pm_wakeirq.h> +#include <linux/pm_wakeup.h> #include <linux/property.h> #include <linux/regulator/consumer.h> #include <linux/pwrseq/provider.h>
@@ -484,11 +486,18 @@ static int pwrseq_qcom_wcn3990_match(struct pwrseq_device *pwrseq,return pwrseq_qcom_wcn_match_regulator (pwrseq, dev,"vdd-1.8-xo-supply" ); } +static void pwrseq_qcom_wcn_clear_wake_irq (void *data) +{ +dev_pm_clear_wake_irq (data); +} +static int pwrseq_qcom_wcn_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct pwrseq_qcom_wcn_ctx *ctx; +struct gpio_desc *swctrl_gpio;struct pwrseq_config config; +int wake_irq;int i, ret; ctx =devm_kzalloc (dev,sizeof (*ctx),GFP_KERNEL );
@@ -526,6 +535,33 @@ static int pwrseq_qcom_wcn_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (ctx->bt_gpio),"Failed to get the Bluetooth enable GPIO\n" ); +if (device_property_read_bool (dev,"wakeup-source" )) { + swctrl_gpio =devm_gpiod_get (dev,"swctrl" ,GPIOD_IN ); +if (IS_ERR (swctrl_gpio)) +return dev_err_probe (dev,PTR_ERR (swctrl_gpio), +"Failed to get the SW_CTRL GPIO\n" ); + + wake_irq =gpiod_to_irq (swctrl_gpio); +if (wake_irq <0 ) +return dev_err_probe (dev, wake_irq, +"Failed to get the SW_CTRL wake IRQ\n" ); + + ret =devm_device_init_wakeup (dev); +if (ret) +return dev_err_probe (dev, ret, +"Failed to enable wakeup\n" ); + + ret =dev_pm_set_dedicated_wake_irq (dev, wake_irq); +if (ret) +return dev_err_probe (dev, ret, +"Failed to set the SW_CTRL wake IRQ\n" ); + + ret =devm_add_action_or_reset (dev, + pwrseq_qcom_wcn_clear_wake_irq, dev); +if (ret) +return ret; + } + ctx->wlan_gpio =devm_gpiod_get_optional (dev,"wlan-enable" ,GPIOD_OUT_LOW );if (IS_ERR (ctx->wlan_gpio))
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH v3 2/3] power: sequencing: qcom-wcn: support SW_CTRL wake
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] power: sequencing: missing wake IRQ trigger type in pwrseq_qcom_wcn_probe() --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] power: sequencing: missing wake IRQ trigger type in pwrseq_qcom_wcn_probe() --
commit 67f02e162090cebd2a43e112d0d0073d05afbfee
Author: Linghui Wu <[email protected]>
power: sequencing: qcom-wcn: support SW_CTRL wake
When the WCN PMU is marked with the wakeup-source property, this commit requests the SW_CTRL GPIO as an input, maps it to an IRQ, and registers it as a dedicated wake IRQ.
Quoted 4 lines
drivers/power/sequencing/pwrseq-qcom-wcn.c +0
-0
[ ... ]
Quoted 11 lines
drivers/power/sequencing/pwrseq-qcom-wcn.c +7
-0@@ -526,6 +535,33 @@ static int pwrseq_qcom_wcn_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (ctx->bt_gpio),"Failed to get the Bluetooth enable GPIO\n" ); +if (device_property_read_bool (dev,"wakeup-source" )) { + swctrl_gpio =devm_gpiod_get (dev,"swctrl" ,GPIOD_IN ); +if (IS_ERR (swctrl_gpio)) +return dev_err_probe (dev,PTR_ERR (swctrl_gpio), +"Failed to get the SW_CTRL GPIO\n" ); + + wake_irq =gpiod_to_irq (swctrl_gpio);
drivers/power/sequencing/pwrseq-qcom-wcn.c static int pwrseq_qcom_wcn_probe(struct platform_device *pdev) · line 554
Quoted 10 lines
drivers/power/sequencing/pwrseq-qcom-wcn.c +10
-0+if (wake_irq <0 ) +return dev_err_probe (dev, wake_irq, +"Failed to get the SW_CTRL wake IRQ\n" ); + + ret =devm_device_init_wakeup (dev); +if (ret) +return dev_err_probe (dev, ret, +"Failed to enable wakeup\n" ); + + ret =dev_pm_set_dedicated_wake_irq (dev, wake_irq);
[Severity: High]
Does wake_irq need an IRQ trigger type configured via irq_set_irq_type() before calling dev_pm_set_dedicated_wake_irq()?
In pwrseq_qcom_wcn_probe(), gpiod_to_irq() maps swctrl_gpio through gpiochip_to_irq() in drivers/gpio/gpiolib.c with IRQ_TYPE_NONE:
spec.fwnode = domain->fwnode;
spec.param_count = 2;
spec.param[0] = gc->irq.child_offset_to_irq(gc, offset);
spec.param[1] = IRQ_TYPE_NONE;
return irq_create_fwspec_mapping(&spec);Then dev_pm_set_dedicated_wake_irq() calls __dev_pm_set_dedicated_wake_irq() in drivers/base/power/wakeirq.c, which requests the threaded IRQ without any IRQF_TRIGGER_* flags:
err = request_threaded_irq(irq, NULL, handle_threaded_wake_irq,
IRQF_ONESHOT | IRQF_NO_AUTOEN, wirq->name, wirq);
In __setup_irq() in kernel/irq/manage.c, because both new->flags and irqd_get_trigger_type() have trigger type 0 (IRQ_TYPE_NONE), __irq_set_trigger() is never called:
if (!shared) {
/* Setup the type (level, edge polarity) if configured: */
if (new->flags & IRQF_TRIGGER_MASK) {
ret = __irq_set_trigger(desc,
new->flags & IRQF_TRIGGER_MASK);
if (ret)
goto out_unlock;
}On Qualcomm TLMM in drivers/pinctrl/qcom/pinctrl-msm.c, msm_gpio_init() initializes GPIO IRQs with IRQ_TYPE_NONE and handle_bad_irq:
girq->default_type = IRQ_TYPE_NONE;
girq->handler = handle_bad_irq;Without .irq_set_type() being invoked, the hardware trigger registers in TLMM/PDC/MPM or SPMI PMIC GPIO are not programmed, and the flow handler on TLMM remains handle_bad_irq when dev_pm_arm_wake_irq() enables wake_irq during system suspend.
Other callers combining gpiod_to_irq() with dev_pm_set_dedicated_wake_irq(), such as pci_configure_wake_irq() in drivers/pci/of.c and stm32_add_pcie_port() in drivers/pci/controller/dwc/pcie-stm32.c, call irq_set_irq_type() first.
Quoted 9 lines
drivers/power/sequencing/pwrseq-qcom-wcn.c +9
-0+if (ret) +return dev_err_probe (dev, ret, +"Failed to set the SW_CTRL wake IRQ\n" ); + + ret =devm_add_action_or_reset (dev, + pwrseq_qcom_wcn_clear_wake_irq, dev); +if (ret) +return ret; + }
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
PATCH v3 3/3 arm64: dts: qcom: shikra: enable WCN SW_CTRL
In reply to Linghui WuThe WCN3988 SW_CTRL signal can wake the application processor on the Shikra CQM, CQS and IQS EVKs.
Mark the WCN power sequencer as a wakeup source so the driver uses the existing SW_CTRL GPIO as a dedicated wake IRQ.
--- arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi | 1 + arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi | 1 + 2 files changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi +1 -0
@@ -102,6 +102,7 @@ wcn3988-pmu { pinctrl-names = "default"; swctrl-gpios = <&tlmm 88 GPIO_ACTIVE_HIGH>; + wakeup-source; vddio-supply = <&pm4125_l7>; vddxo-supply = <&pm4125_l13>;
arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi +1 -0
@@ -85,6 +85,7 @@ wcn3988-pmu { pinctrl-names = "default"; swctrl-gpios = <&tlmm 88 GPIO_ACTIVE_HIGH>; + wakeup-source; vddio-supply = <&pm8150_s4>; vddxo-supply = <&pm8150_l12>;
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH v3 3/3] arm64: dts: qcom: shikra: enable WCN SW_CTRL
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] arm64: dts: qcom: shikra: unconfigured trigger type on wcn3988-pmu wake IRQ --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] arm64: dts: qcom: shikra: unconfigured trigger type on wcn3988-pmu wake IRQ --
commit 0d919d176f5987f0cfa1c7fc5b73e582dabc0bf6
Author: Linghui Wu <[email protected]>
arm64: dts: qcom: shikra: enable WCN SW_CTRL
This commit marks the wcn3988-pmu node as a wakeup source on the Shikra CQM, CQS, and IQS SOMs so the power sequencing driver registers the SW_CTRL GPIO as a dedicated wake IRQ.
Quoted 17 lines
arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi +1
-0@@ -102,6 +102,7 @@ wcn3988-pmu { pinctrl-names = "default"; swctrl-gpios = <&tlmm 88 GPIO_ACTIVE_HIGH>; + wakeup-source; vddio-supply = <&pm4125_l7>; vddxo-supply = <&pm4125_l13>;arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi +0
-0
arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi wcn3988-pmu { · line 88
Quoted 4 lines
arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi +1
-0@@ -85,6 +85,7 @@ wcn3988-pmu { pinctrl-names = "default"; swctrl-gpios = <&tlmm 88 GPIO_ACTIVE_HIGH>; + wakeup-source;
[Severity: High]
Does enabling wakeup-source on wcn3988-pmu leave the TLMM GPIO 88 wake IRQ without a configured trigger type and stuck on handle_bad_irq?
When wakeup-source is present, pwrseq_qcom_wcn_probe() in drivers/power/sequencing/pwrseq-qcom-wcn.c maps swctrl-gpios to an IRQ and registers it as a dedicated wake IRQ:
wake_irq = gpiod_to_irq(swctrl_gpio);
if (wake_irq < 0)
return dev_err_probe(dev, wake_irq,
"Failed to get the SW_CTRL wake IRQ\n");
ret = devm_device_init_wakeup(dev);
if (ret)
return dev_err_probe(dev, ret,
"Failed to enable wakeup\n");
ret = dev_pm_set_dedicated_wake_irq(dev, wake_irq);In drivers/pinctrl/qcom/pinctrl-msm.c, msm_gpio_init() initializes the GPIO IRQ chip with no default trigger type and handle_bad_irq:
girq->default_type = IRQ_TYPE_NONE;
girq->handler = handle_bad_irq;Because tlmm uses a hierarchical IRQ domain with wakeup-parent = <&mpm>, gpiod_to_irq() -> gpiochip_to_irq() creates the mapping with IRQ_TYPE_NONE. Then dev_pm_set_dedicated_wake_irq() -> __dev_pm_set_dedicated_wake_irq() in drivers/base/power/wakeirq.c requests the IRQ without any IRQF_TRIGGER_* flags:
err = request_threaded_irq(irq, NULL, handle_threaded_wake_irq,
IRQF_ONESHOT | IRQF_NO_AUTOEN, wirq->name, wirq);
In __setup_irq(), because neither the request flags nor the existing irq_data specifies any trigger bits, __irq_set_trigger() is skipped and neither msm_gpio_irq_set_type() nor qcom_mpm_set_type() is called. As a result, the TLMM and MPM trigger registers remain unconfigured and desc->handle_irq stays set to handle_bad_irq instead of handle_level_irq or handle_edge_irq.
Should the trigger type be configured before or when registering the wake IRQ, or specified via an interrupts property?
Quoted 3 lines
arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi +0
-0vddio-supply = <&pm8150_s4>; vddxo-supply = <&pm8150_l12>;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Bartosz Golaszewski
maintainerQuoted 9 lines · Linghui Wu
Some WCN3990-family devices use the
SW_CTRLGPIO to indicate that resources need to remain available while the application processor is suspended.Teach the Qualcomm WCN power-sequencing driver to use the existing
SW_CTRLGPIO as a dedicated wake IRQ when the power sequencer is marked as a wakeup source. The PM core keeps the IRQ disabled during normal operation and arms it for system suspend.
Quoted 6 lines
The series documents wakeup-source for the WCN PMU binding and enables it for the Shikra CQM, CQS and IQS EVKs.
The series has been runtime-tested on qcom-next and kernel 6.18.y on Shikra hardware.
Please don't send new iterations in response to previous threads. Use b4 for patch management if that helps.
Bart
Quoted 9 lines · Linghui Wu
Some WCN3990-family devices use the
SW_CTRLGPIO to indicate that resources need to remain available while the application processor is suspended.Teach the Qualcomm WCN power-sequencing driver to use the existing
SW_CTRLGPIO as a dedicated wake IRQ when the power sequencer is marked as a wakeup source. The PM core keeps the IRQ disabled during normal operation and arms it for system suspend.
Quoted 5 lines
The series documents wakeup-source for the WCN PMU binding and enables it for the Shikra CQM, CQS and IQS EVKs.
The series has been runtime-tested on qcom-next and kernel 6.18.y on Shikra hardware.
qcom-next is currently based on v7.3-rc4 (for whatever reason) and has 1398 patches on top of that. Please pick the presumably 2 or 3 you need to boot (I don't know, I'm not following shikra) atop a clean linux-next/master and retest.
Konrad
v4 cover power: sequencing: qcom-wcn: support SW_CTRL wake IRQ
In reply to Linghui WuSome WCN3990-family devices use the SW_CTRL GPIO to indicate that resources need to remain available while the application processor is suspended.
Teach the Qualcomm WCN power-sequencing driver to use the existing SW_CTRL GPIO as a dedicated wake IRQ when the power sequencer is marked as a wakeup source. The PM core keeps the IRQ disabled during normal operation and arms it for system suspend.
The series documents wakeup-source for the WCN PMU binding and enables it for the Shikra CQM, CQS and IQS EVKs.
The series has been validated on linux-next on Shikra hardware.
Changes in v4:
- Rebase onto linux-next next-20261111.
- Revalidate the complete series against linux-next.
Changes in v3:
- Use the "dt-bindings: regulator:" prefix for the binding patch.
- Drop the RFC marker.
- Replace the "must" wording in the wake behavior description.
- Report runtime validation on qcom-next and kernel 6.18.y.
Changes in v2:
- Derive the wake IRQ from the existing SW_CTRL GPIO with gpiod_to_irq().
- Drop the separate interrupt description from the binding and DTS.
- Focus the description on the functional behavior.
- Rebase onto next-20261014.
Linghui Wu (3):
dt-bindings: regulator: qcom,wcn3990-pmu: document wakeup-source
power: sequencing: qcom-wcn: support SW_CTRL wake IRQ
arm64: dts: qcom: shikra: enable WCN SW_CTRL wakeup
.../bindings/regulator/qcom,wcn3990-pmu.yaml | 6 ++++ arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi | 1 + arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi | 1 + drivers/power/sequencing/pwrseq-qcom-wcn.c | 36 +++++++++++++++++++ 4 files changed, 44 insertions(+)
base-commit: aaa2f954c21b205a0bcd0961e5b2be4e82e58455
Signature · 1 line
2.43.0
PATCH v4 1/3 dt-bindings: regulator: qcom,wcn3990-pmu: document wakeup-source
The SW_CTRL GPIO can be used as a wake signal on platforms where the WCN device needs to wake the application processor.
Document wakeup-source and require the existing swctrl-gpios property when wakeup-source is present.
--- .../devicetree/bindings/regulator/qcom,wcn3990-pmu.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/regulator/qcom,wcn3990-pmu.yaml +6 -0
@@ -42,6 +42,8 @@ properties: maxItems: 1 description: GPIO line indicating the state of the clock supply to the BT module + wakeup-source: true + clocks: maxItems: 1 description: Reference clock handle
@@ -67,6 +69,10 @@ required: - vddrf-supply - vddch0-supply +dependentRequired: + wakeup-source: + - swctrl-gpios + additionalProperties: false examples:
Signature · 1 line
2.43.0
Re: [PATCH v4 1/3] dt-bindings: regulator: qcom,wcn3990-pmu: document wakeup-source
Quoted 11 lines · Linghui Wu
The
SW_CTRLGPIO can be used as a wake signal on platforms where the WCN device needs to wake the application processor.Document wakeup-source and require the existing swctrl-gpios property when wakeup-source is present.
Signed-off-by Linghui Wu <[email protected]>--- .../devicetree/bindings/regulator/qcom,wcn3990-pmu.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
PATCH v4 2/3 power: sequencing: qcom-wcn: support SW_CTRL wake IRQ
In reply to Linghui WuSome WCN3990-family devices use SW_CTRL to signal that resources need to remain available while the application processor is suspended.
When the PMU is marked as a wakeup source, request the existing SW_CTRL GPIO as an input, map it to an IRQ and register it as a dedicated wake IRQ. The PM core then keeps the IRQ disabled during normal operation and arms it for system suspend.
--- drivers/power/sequencing/pwrseq-qcom-wcn.c | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/power/sequencing/pwrseq-qcom-wcn.c +36 -0
@@ -11,6 +11,8 @@#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/pm_wakeirq.h> +#include <linux/pm_wakeup.h> #include <linux/property.h> #include <linux/regulator/consumer.h> #include <linux/pwrseq/provider.h>
@@ -484,11 +486,18 @@ static int pwrseq_qcom_wcn3990_match(struct pwrseq_device *pwrseq,return pwrseq_qcom_wcn_match_regulator (pwrseq, dev,"vdd-1.8-xo-supply" ); } +static void pwrseq_qcom_wcn_clear_wake_irq (void *data) +{ +dev_pm_clear_wake_irq (data); +} +static int pwrseq_qcom_wcn_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct pwrseq_qcom_wcn_ctx *ctx; +struct gpio_desc *swctrl_gpio;struct pwrseq_config config; +int wake_irq;int i, ret; ctx =devm_kzalloc_obj (dev, *ctx);
@@ -525,6 +534,33 @@ static int pwrseq_qcom_wcn_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (ctx->bt_gpio),"Failed to get the Bluetooth enable GPIO\n" ); +if (device_property_read_bool (dev,"wakeup-source" )) { + swctrl_gpio =devm_gpiod_get (dev,"swctrl" ,GPIOD_IN ); +if (IS_ERR (swctrl_gpio)) +return dev_err_probe (dev,PTR_ERR (swctrl_gpio), +"Failed to get the SW_CTRL GPIO\n" ); + + wake_irq =gpiod_to_irq (swctrl_gpio); +if (wake_irq <0 ) +return dev_err_probe (dev, wake_irq, +"Failed to get the SW_CTRL wake IRQ\n" ); + + ret =devm_device_init_wakeup (dev); +if (ret) +return dev_err_probe (dev, ret, +"Failed to enable wakeup\n" ); + + ret =dev_pm_set_dedicated_wake_irq (dev, wake_irq); +if (ret) +return dev_err_probe (dev, ret, +"Failed to set the SW_CTRL wake IRQ\n" ); + + ret =devm_add_action_or_reset (dev, + pwrseq_qcom_wcn_clear_wake_irq, dev); +if (ret) +return ret; + } + ctx->wlan_gpio =devm_gpiod_get_optional (dev,"wlan-enable" ,GPIOD_OUT_LOW );if (IS_ERR (ctx->wlan_gpio))
Signature · 1 line
2.43.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] power: sequencing: missing wake IRQ trigger type in pwrseq_qcom_wcn_probe() - [Low] power…
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [High] power: sequencing: missing wake IRQ trigger type in pwrseq_qcom_wcn_probe()
- [Low] power: sequencing: qcom-wcn: direct inclusion of linux/pm_wakeup.h
--
commit 832aa68ed4662747e202e91c3f57f19829c22253
Author: Linghui Wu <[email protected]>
power: sequencing: qcom-wcn: support SW_CTRL wake IRQ
This commit adds support for requesting the SW_CTRL GPIO and registering it as a dedicated wake IRQ when the WCN PMU is marked as a wakeup source.
drivers/power/sequencing/pwrseq-qcom-wcn.c line 15
Quoted 10 lines
drivers/power/sequencing/pwrseq-qcom-wcn.c +2
-0@@ -11,6 +11,8 @@#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/pm_wakeirq.h> +#include <linux/pm_wakeup.h>
[Severity: Low]include/linux/pm_wakeup.h forbids direct inclusion (#error "Please do not include this file directly.") and is already included via <linux/device.h>.
[ ... ]
Quoted 11 lines
drivers/power/sequencing/pwrseq-qcom-wcn.c +7
-0@@ -525,6 +534,33 @@ static int pwrseq_qcom_wcn_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (ctx->bt_gpio),"Failed to get the Bluetooth enable GPIO\n" ); +if (device_property_read_bool (dev,"wakeup-source" )) { + swctrl_gpio =devm_gpiod_get (dev,"swctrl" ,GPIOD_IN ); +if (IS_ERR (swctrl_gpio)) +return dev_err_probe (dev,PTR_ERR (swctrl_gpio), +"Failed to get the SW_CTRL GPIO\n" ); + + wake_irq =gpiod_to_irq (swctrl_gpio);
drivers/power/sequencing/pwrseq-qcom-wcn.c static int pwrseq_qcom_wcn_probe(struct platform_device *pdev) · line 553
Quoted 10 lines
drivers/power/sequencing/pwrseq-qcom-wcn.c +10
-0+if (wake_irq <0 ) +return dev_err_probe (dev, wake_irq, +"Failed to get the SW_CTRL wake IRQ\n" ); + + ret =devm_device_init_wakeup (dev); +if (ret) +return dev_err_probe (dev, ret, +"Failed to enable wakeup\n" ); + + ret =dev_pm_set_dedicated_wake_irq (dev, wake_irq);
[Severity: High]
Does wake_irq ever get an interrupt trigger type configured?
gpiod_to_irq() maps the GPIO line with IRQ_TYPE_NONE, and dev_pm_set_dedicated_wake_irq() calls request_threaded_irq() with only IRQF_ONESHOT | IRQF_NO_AUTOEN. Because neither supplies trigger flags, __setup_irq() skips __irq_set_trigger(). On Qualcomm TLMM GPIOs, msm_gpio_init() initializes the IRQ with IRQ_TYPE_NONE and handle_bad_irq, relying on .irq_set_type to program hardware trigger registers and install the real flow handler, so SW_CTRL wake interrupts will either fail to fire or hit handle_bad_irq() instead of waking the system.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
PATCH v4 3/3 arm64: dts: qcom: shikra: enable WCN SW_CTRL wakeup
In reply to Linghui WuThe WCN3988 SW_CTRL signal can wake the application processor on the Shikra CQM, CQS and IQS EVKs.
Mark the WCN power sequencer as a wakeup source so the driver uses the existing SW_CTRL GPIO as a dedicated wake IRQ.
--- arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi | 1 + arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi | 1 + 2 files changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi +1 -0
@@ -102,6 +102,7 @@ wcn3988-pmu { pinctrl-names = "default"; swctrl-gpios = <&tlmm 88 GPIO_ACTIVE_HIGH>; + wakeup-source; vddio-supply = <&pm4125_l7>; vddxo-supply = <&pm4125_l13>;
arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi +1 -0
@@ -85,6 +85,7 @@ wcn3988-pmu { pinctrl-names = "default"; swctrl-gpios = <&tlmm 88 GPIO_ACTIVE_HIGH>; + wakeup-source; vddio-supply = <&pm8150_s4>; vddxo-supply = <&pm8150_l12>;
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH v4 3/3] arm64: dts: qcom: shikra: enable WCN SW_CTRL wakeup
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] arm64: dts: qcom: shikra: unconfigured trigger type on wcn3988-pmu wake IRQ --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] arm64: dts: qcom: shikra: unconfigured trigger type on wcn3988-pmu wake IRQ
--
commit a2fb22de0f4bb902b0590abe34c32d49b1aa90fd
Author: Linghui Wu <[email protected]>
arm64: dts: qcom: shikra: enable WCN SW_CTRL wakeup
This commit adds the wakeup-source property to the wcn3988-pmu nodes on the Shikra CQM and IQS SoMs so the WCN power sequencer uses the SW_CTRL GPIO as a wake IRQ.
Quoted 17 lines
arch/arm64/boot/dts/qcom/shikra-cqm-som.dtsi +1
-0@@ -102,6 +102,7 @@ wcn3988-pmu { pinctrl-names = "default"; swctrl-gpios = <&tlmm 88 GPIO_ACTIVE_HIGH>; + wakeup-source; vddio-supply = <&pm4125_l7>; vddxo-supply = <&pm4125_l13>;arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi +0
-0
arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi wcn3988-pmu { · line 91
Quoted 7 lines
arch/arm64/boot/dts/qcom/shikra-iqs-som.dtsi +1
-0@@ -85,6 +85,7 @@ wcn3988-pmu { pinctrl-names = "default"; swctrl-gpios = <&tlmm 88 GPIO_ACTIVE_HIGH>; + wakeup-source; vddio-supply = <&pm8150_s4>; vddxo-supply = <&pm8150_l12>;
[Severity: High]
Does enabling wakeup-source here leave the SW_CTRL wake IRQ without a configured trigger type?
In pwrseq_qcom_wcn_probe(), the driver maps swctrl_gpio via gpiod_to_irq() and passes it to dev_pm_set_dedicated_wake_irq():
drivers/power/sequencing/pwrseq-qcom-wcn.c:pwrseq_qcom_wcn_probe() {
...
wake_irq = gpiod_to_irq(swctrl_gpio);
if (wake_irq < 0)
return dev_err_probe(dev, wake_irq,
"Failed to get the SW_CTRL wake IRQ\n");
ret = devm_device_init_wakeup(dev);
if (ret)
return dev_err_probe(dev, ret,
"Failed to enable wakeup\n");
ret = dev_pm_set_dedicated_wake_irq(dev, wake_irq);
...
}gpiochip_to_irq() creates the hierarchical TLMM/MPM mapping with IRQ_TYPE_NONE, where msm_gpio_init() initializes the flow handler to handle_bad_irq, and __dev_pm_set_dedicated_wake_irq() requests the threaded IRQ without any IRQF_TRIGGER_* flags. Because both the requested flags and existing trigger type are IRQ_TYPE_NONE, __setup_irq() skips __irq_set_trigger().
Neither msm_gpio_irq_set_type() nor qcom_mpm_set_type() runs for GPIO 88, leaving TLMM and vMPM trigger registers unprogrammed and the flow handler set to handle_bad_irq when the wake IRQ is armed on suspend.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Bartosz Golaszewski
maintainerQuoted 9 lines · Linghui Wu
Some WCN3990-family devices use the
SW_CTRLGPIO to indicate that resources need to remain available while the application processor is suspended.Teach the Qualcomm WCN power-sequencing driver to use the existing
SW_CTRLGPIO as a dedicated wake IRQ when the power sequencer is marked as a wakeup source. The PM core keeps the IRQ disabled during normal operation and arms it for system suspend.
Quoted 5 lines
The series documents wakeup-source for the WCN PMU binding and enables it for the Shikra CQM, CQS and IQS EVKs.
The series has been validated on linux-next on Shikra hardware.
When addressing sashiko comments in v5, please make sure to send this as a new thread, not a reply to existing threads on the list.
Thanks,
Bart
Bartosz Golaszewski
maintainerQuoted 9 lines · Linghui Wu
Some WCN3990-family devices use the
SW_CTRLGPIO to indicate that resources need to remain available while the application processor is suspended.Teach the Qualcomm WCN power-sequencing driver to use the existing
SW_CTRLGPIO as a dedicated wake IRQ when the power sequencer is marked as a wakeup source. The PM core keeps the IRQ disabled during normal operation and arms it for system suspend.
Quoted 5 lines
The series documents wakeup-source for the WCN PMU binding and enables it for the Shikra CQM, CQS and IQS EVKs.
The series has been validated on linux-next on Shikra hardware.
When addressing sashiko's comments in v5 - please send it as a new thread, not a reply to existing threads.
Thanks,
Bartosz