devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Fix pm8941-misc extcon interrupt dependency assumptions
@ 2022-07-04  1:06 Bryan O'Donoghue
  2022-07-04  1:06 ` [PATCH v3 1/2] dt-bindings: pm8941-misc: Fix usb_id and usb_vbus definitions Bryan O'Donoghue
  2022-07-04  1:06 ` [PATCH v3 2/2] extcon: qcom-spmi: Switch to platform_get_irq_byname_optional Bryan O'Donoghue
  0 siblings, 2 replies; 4+ messages in thread
From: Bryan O'Donoghue @ 2022-07-04  1:06 UTC (permalink / raw)
  To: agross, bjorn.andersson, myungjoo.ham, cw00.choi, robh+dt,
	krzysztof.kozlowski+dt, stephan, marijn.suijten
  Cc: linux-arm-msm, devicetree, bryan.odonoghue

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


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

* [PATCH v3 1/2] dt-bindings: pm8941-misc: Fix usb_id and usb_vbus definitions
  2022-07-04  1:06 [PATCH v3 0/2] Fix pm8941-misc extcon interrupt dependency assumptions Bryan O'Donoghue
@ 2022-07-04  1:06 ` Bryan O'Donoghue
  2022-07-04  1:06 ` [PATCH v3 2/2] extcon: qcom-spmi: Switch to platform_get_irq_byname_optional Bryan O'Donoghue
  1 sibling, 0 replies; 4+ messages in thread
From: Bryan O'Donoghue @ 2022-07-04  1:06 UTC (permalink / raw)
  To: agross, bjorn.andersson, myungjoo.ham, cw00.choi, robh+dt,
	krzysztof.kozlowski+dt, stephan, marijn.suijten
  Cc: linux-arm-msm, devicetree, bryan.odonoghue, Rob Herring

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 <robh@kernel.org>
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 .../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.36.1


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

* [PATCH v3 2/2] extcon: qcom-spmi: Switch to platform_get_irq_byname_optional
  2022-07-04  1:06 [PATCH v3 0/2] Fix pm8941-misc extcon interrupt dependency assumptions Bryan O'Donoghue
  2022-07-04  1:06 ` [PATCH v3 1/2] dt-bindings: pm8941-misc: Fix usb_id and usb_vbus definitions Bryan O'Donoghue
@ 2022-07-04  1:06 ` Bryan O'Donoghue
  2022-07-04 21:44   ` Marijn Suijten
  1 sibling, 1 reply; 4+ messages in thread
From: Bryan O'Donoghue @ 2022-07-04  1:06 UTC (permalink / raw)
  To: agross, bjorn.andersson, myungjoo.ham, cw00.choi, robh+dt,
	krzysztof.kozlowski+dt, stephan, marijn.suijten
  Cc: linux-arm-msm, devicetree, bryan.odonoghue

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.

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

Suggested-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 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.36.1


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

* Re: [PATCH v3 2/2] extcon: qcom-spmi: Switch to platform_get_irq_byname_optional
  2022-07-04  1:06 ` [PATCH v3 2/2] extcon: qcom-spmi: Switch to platform_get_irq_byname_optional Bryan O'Donoghue
@ 2022-07-04 21:44   ` Marijn Suijten
  0 siblings, 0 replies; 4+ messages in thread
From: Marijn Suijten @ 2022-07-04 21:44 UTC (permalink / raw)
  To: Bryan O'Donoghue
  Cc: agross, bjorn.andersson, myungjoo.ham, cw00.choi, robh+dt,
	krzysztof.kozlowski+dt, stephan, linux-arm-msm, devicetree

On 2022-07-04 02:06:59, 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.
> 
> Switch to using platform_get_irq_byname_optional() in order to facilitate
> this behaviour.
> 
> Suggested-by: Marijn Suijten <marijn.suijten@somainline.org>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

Thanks for cleaning this up!  Not sure if it is useful to mention in the
patch description that a warning is already in place if _both_ IRQs
happened to be missing, but that's a nit for a completely unrealistic
case where v4 is required for other reasons.

Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>

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

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

end of thread, other threads:[~2022-07-04 21:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-04  1:06 [PATCH v3 0/2] Fix pm8941-misc extcon interrupt dependency assumptions Bryan O'Donoghue
2022-07-04  1:06 ` [PATCH v3 1/2] dt-bindings: pm8941-misc: Fix usb_id and usb_vbus definitions Bryan O'Donoghue
2022-07-04  1:06 ` [PATCH v3 2/2] extcon: qcom-spmi: Switch to platform_get_irq_byname_optional Bryan O'Donoghue
2022-07-04 21:44   ` Marijn Suijten

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).