2022-12-28 13:41:55

by Bryan O'Donoghue

[permalink] [raw]
Subject: [PATCH v4 0/2 RESEND] Fix pm8941-misc extcon interrupt dependency assumptions

RESEND December 2022:

Hey Chanwoo could you please pick this up ?

RESEND September 2022:
- I thought I resent these at the start of this month, can't find them
in linux-msm I think I just sent them to myself.

No change since July 17th

V4:
- Added suggested extra log text from Marjin to extcon patch

V3:
- Adds a cover-letter since we are now doing two patches a dt-bindings fix and
platform_get_irq_byname_optional fix.
- Add Review-by -> Rob Herring, Marijn Suijten
- Add additional patch to negate warning when one of usb_id or usb_vbus
is not declared in the platform DTS.

Bryan O'Donoghue (2):
dt-bindings: pm8941-misc: Fix usb_id and usb_vbus definitions
extcon: qcom-spmi: Switch to platform_get_irq_byname_optional

.../devicetree/bindings/extcon/qcom,pm8941-misc.yaml | 12 ++++++++----
drivers/extcon/extcon-qcom-spmi-misc.c | 4 ++--
2 files changed, 10 insertions(+), 6 deletions(-)

--
2.34.1


2022-12-28 13:43:00

by Bryan O'Donoghue

[permalink] [raw]
Subject: [PATCH v4 2/2 RESEND] extcon: qcom-spmi: Switch to platform_get_irq_byname_optional

Valid configurations for the extcon interrupt declarations are

- usb_id
- usb_vbus
- (usb_id | usb_vbus)

In the case of a standalone usb_id or usb_vbus failure to find one of the
interrupts shouldn't generate a warning message. A warning is already in
place if both IRQs are missing.

Switch to using platform_get_irq_byname_optional() in order to facilitate
this behaviour.

Suggested-by: Marijn Suijten <[email protected]>
Signed-off-by: Bryan O'Donoghue <[email protected]>
---
drivers/extcon/extcon-qcom-spmi-misc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/extcon/extcon-qcom-spmi-misc.c b/drivers/extcon/extcon-qcom-spmi-misc.c
index eb02cb962b5e1..f72e90ceca53d 100644
--- a/drivers/extcon/extcon-qcom-spmi-misc.c
+++ b/drivers/extcon/extcon-qcom-spmi-misc.c
@@ -123,7 +123,7 @@ static int qcom_usb_extcon_probe(struct platform_device *pdev)
if (ret)
return ret;

- info->id_irq = platform_get_irq_byname(pdev, "usb_id");
+ info->id_irq = platform_get_irq_byname_optional(pdev, "usb_id");
if (info->id_irq > 0) {
ret = devm_request_threaded_irq(dev, info->id_irq, NULL,
qcom_usb_irq_handler,
@@ -136,7 +136,7 @@ static int qcom_usb_extcon_probe(struct platform_device *pdev)
}
}

- info->vbus_irq = platform_get_irq_byname(pdev, "usb_vbus");
+ info->vbus_irq = platform_get_irq_byname_optional(pdev, "usb_vbus");
if (info->vbus_irq > 0) {
ret = devm_request_threaded_irq(dev, info->vbus_irq, NULL,
qcom_usb_irq_handler,
--
2.34.1

2022-12-28 13:43:22

by Bryan O'Donoghue

[permalink] [raw]
Subject: [PATCH v4 1/2 RESEND] dt-bindings: pm8941-misc: Fix usb_id and usb_vbus definitions

dts validation is throwing an error for me on 8916 and 8939 with
extcon@1300. In that case we have usb_vbus but not usb_id.

It wasn't immediately obvious if there was a valid use-case for the
existing code for usb_id in isolation, however discussing further, we
concluded that usb_id, usb_vbus or (usb_id | usb_vbus) are valid
combinations as an external IC may be responsible for usb_id or usb_vbus.

Expand the definition with anyOf to capture the three different valid
modes.

Fixes: 4fcdd677c4ea ("bindings: pm8941-misc: Add support for VBUS detection")
Reviewed-by: Rob Herring <[email protected]>
Reviewed-by: Marijn Suijten <[email protected]>
Signed-off-by: Bryan O'Donoghue <[email protected]>
---
.../devicetree/bindings/extcon/qcom,pm8941-misc.yaml | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml b/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml
index 6a9c96f0352ac..1bc412a4ac5e6 100644
--- a/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml
+++ b/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml
@@ -27,10 +27,14 @@ properties:

interrupt-names:
minItems: 1
- items:
- - const: usb_id
- - const: usb_vbus
-
+ anyOf:
+ - items:
+ - const: usb_id
+ - const: usb_vbus
+ - items:
+ - const: usb_id
+ - items:
+ - const: usb_vbus
required:
- compatible
- reg
--
2.34.1

2022-12-28 23:15:16

by Marijn Suijten

[permalink] [raw]
Subject: Re: [PATCH v4 2/2 RESEND] extcon: qcom-spmi: Switch to platform_get_irq_byname_optional

On 2022-12-28 13:30:58, Bryan O'Donoghue wrote:
> Valid configurations for the extcon interrupt declarations are
>
> - usb_id
> - usb_vbus
> - (usb_id | usb_vbus)
>
> In the case of a standalone usb_id or usb_vbus failure to find one of the
> interrupts shouldn't generate a warning message. A warning is already in
> place if both IRQs are missing.
>
> Switch to using platform_get_irq_byname_optional() in order to facilitate
> this behaviour.
>
> Suggested-by: Marijn Suijten <[email protected]>
> Signed-off-by: Bryan O'Donoghue <[email protected]>

Reviewed-by: Marijn Suijten <[email protected]>

> ---
> drivers/extcon/extcon-qcom-spmi-misc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/extcon/extcon-qcom-spmi-misc.c b/drivers/extcon/extcon-qcom-spmi-misc.c
> index eb02cb962b5e1..f72e90ceca53d 100644
> --- a/drivers/extcon/extcon-qcom-spmi-misc.c
> +++ b/drivers/extcon/extcon-qcom-spmi-misc.c
> @@ -123,7 +123,7 @@ static int qcom_usb_extcon_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - info->id_irq = platform_get_irq_byname(pdev, "usb_id");
> + info->id_irq = platform_get_irq_byname_optional(pdev, "usb_id");
> if (info->id_irq > 0) {
> ret = devm_request_threaded_irq(dev, info->id_irq, NULL,
> qcom_usb_irq_handler,
> @@ -136,7 +136,7 @@ static int qcom_usb_extcon_probe(struct platform_device *pdev)
> }
> }
>
> - info->vbus_irq = platform_get_irq_byname(pdev, "usb_vbus");
> + info->vbus_irq = platform_get_irq_byname_optional(pdev, "usb_vbus");
> if (info->vbus_irq > 0) {
> ret = devm_request_threaded_irq(dev, info->vbus_irq, NULL,
> qcom_usb_irq_handler,
> --
> 2.34.1
>

2023-01-10 13:38:17

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH v4 1/2 RESEND] dt-bindings: pm8941-misc: Fix usb_id and usb_vbus definitions

On 22. 12. 28. 22:30, Bryan O'Donoghue wrote:
> dts validation is throwing an error for me on 8916 and 8939 with
> extcon@1300. In that case we have usb_vbus but not usb_id.
>
> It wasn't immediately obvious if there was a valid use-case for the
> existing code for usb_id in isolation, however discussing further, we
> concluded that usb_id, usb_vbus or (usb_id | usb_vbus) are valid
> combinations as an external IC may be responsible for usb_id or usb_vbus.
>
> Expand the definition with anyOf to capture the three different valid
> modes.
>
> Fixes: 4fcdd677c4ea ("bindings: pm8941-misc: Add support for VBUS detection")
> Reviewed-by: Rob Herring <[email protected]>
> Reviewed-by: Marijn Suijten <[email protected]>
> Signed-off-by: Bryan O'Donoghue <[email protected]>
> ---
> .../devicetree/bindings/extcon/qcom,pm8941-misc.yaml | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml b/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml
> index 6a9c96f0352ac..1bc412a4ac5e6 100644
> --- a/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml
> +++ b/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml
> @@ -27,10 +27,14 @@ properties:
>
> interrupt-names:
> minItems: 1
> - items:
> - - const: usb_id
> - - const: usb_vbus
> -
> + anyOf:
> + - items:
> + - const: usb_id
> + - const: usb_vbus
> + - items:
> + - const: usb_id
> + - items:
> + - const: usb_vbus
> required:
> - compatible
> - reg

Reviewed-by: Chanwoo Choi <[email protected]>

--
Best Regards,
Samsung Electronics
Chanwoo Choi

2023-01-10 14:06:44

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH v4 2/2 RESEND] extcon: qcom-spmi: Switch to platform_get_irq_byname_optional

On 22. 12. 28. 22:30, Bryan O'Donoghue wrote:
> Valid configurations for the extcon interrupt declarations are
>
> - usb_id
> - usb_vbus
> - (usb_id | usb_vbus)
>
> In the case of a standalone usb_id or usb_vbus failure to find one of the
> interrupts shouldn't generate a warning message. A warning is already in
> place if both IRQs are missing.
>
> Switch to using platform_get_irq_byname_optional() in order to facilitate
> this behaviour.
>
> Suggested-by: Marijn Suijten <[email protected]>
> Signed-off-by: Bryan O'Donoghue <[email protected]>
> ---
> drivers/extcon/extcon-qcom-spmi-misc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/extcon/extcon-qcom-spmi-misc.c b/drivers/extcon/extcon-qcom-spmi-misc.c
> index eb02cb962b5e1..f72e90ceca53d 100644
> --- a/drivers/extcon/extcon-qcom-spmi-misc.c
> +++ b/drivers/extcon/extcon-qcom-spmi-misc.c
> @@ -123,7 +123,7 @@ static int qcom_usb_extcon_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - info->id_irq = platform_get_irq_byname(pdev, "usb_id");
> + info->id_irq = platform_get_irq_byname_optional(pdev, "usb_id");
> if (info->id_irq > 0) {
> ret = devm_request_threaded_irq(dev, info->id_irq, NULL,
> qcom_usb_irq_handler,
> @@ -136,7 +136,7 @@ static int qcom_usb_extcon_probe(struct platform_device *pdev)
> }
> }
>
> - info->vbus_irq = platform_get_irq_byname(pdev, "usb_vbus");
> + info->vbus_irq = platform_get_irq_byname_optional(pdev, "usb_vbus");
> if (info->vbus_irq > 0) {
> ret = devm_request_threaded_irq(dev, info->vbus_irq, NULL,
> qcom_usb_irq_handler,

Applied it. Thanks.

--
Best Regards,
Samsung Electronics
Chanwoo Choi

2023-01-10 14:45:27

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH v4 1/2 RESEND] dt-bindings: pm8941-misc: Fix usb_id and usb_vbus definitions

On 22. 12. 28. 22:30, Bryan O'Donoghue wrote:
> dts validation is throwing an error for me on 8916 and 8939 with
> extcon@1300. In that case we have usb_vbus but not usb_id.
>
> It wasn't immediately obvious if there was a valid use-case for the
> existing code for usb_id in isolation, however discussing further, we
> concluded that usb_id, usb_vbus or (usb_id | usb_vbus) are valid
> combinations as an external IC may be responsible for usb_id or usb_vbus.
>
> Expand the definition with anyOf to capture the three different valid
> modes.
>
> Fixes: 4fcdd677c4ea ("bindings: pm8941-misc: Add support for VBUS detection")
> Reviewed-by: Rob Herring <[email protected]>
> Reviewed-by: Marijn Suijten <[email protected]>
> Signed-off-by: Bryan O'Donoghue <[email protected]>
> ---
> .../devicetree/bindings/extcon/qcom,pm8941-misc.yaml | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml b/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml
> index 6a9c96f0352ac..1bc412a4ac5e6 100644
> --- a/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml
> +++ b/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml
> @@ -27,10 +27,14 @@ properties:
>
> interrupt-names:
> minItems: 1
> - items:
> - - const: usb_id
> - - const: usb_vbus
> -
> + anyOf:
> + - items:
> + - const: usb_id
> + - const: usb_vbus
> + - items:
> + - const: usb_id
> + - items:
> + - const: usb_vbus
> required:
> - compatible
> - reg

Applied it. Thanks
--
Best Regards,
Samsung Electronics
Chanwoo Choi