linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] usb: typec: mux: gpio-sbu: Make enable gpio optional
@ 2024-06-03  8:35 Francesco Dolcini
  2024-06-03  8:35 ` [PATCH v2 1/2] dt-bindings: usb: gpio-sbu-mux: Make 'enable-gpios' optional Francesco Dolcini
  2024-06-03  8:35 ` [PATCH v2 2/2] usb: typec: mux: gpio-sbu: Make enable gpio optional Francesco Dolcini
  0 siblings, 2 replies; 5+ messages in thread
From: Francesco Dolcini @ 2024-06-03  8:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Heikki Krogerus, Bjorn Andersson
  Cc: Francesco Dolcini, linux-usb, devicetree, linux-kernel,
	Dmitry Baryshkov

From: Francesco Dolcini <francesco.dolcini@toradex.com>

The enable gpio is not required when the SBU mux is used only for orientation,
make it optional.

v2:
 - add Acked-by: Conor Dooley
 - remove useless NULL checks for the optional enable GPIO
v1:
 - https://lore.kernel.org/all/20240524071034.4441-1-francesco@dolcini.it/

Francesco Dolcini (2):
  dt-bindings: usb: gpio-sbu-mux: Make 'enable-gpios' optional
  usb: typec: mux: gpio-sbu: Make enable gpio optional

 Documentation/devicetree/bindings/usb/gpio-sbu-mux.yaml | 7 ++++++-
 drivers/usb/typec/mux/gpio-sbu-mux.c                    | 6 +++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

-- 
2.39.2


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

* [PATCH v2 1/2] dt-bindings: usb: gpio-sbu-mux: Make 'enable-gpios' optional
  2024-06-03  8:35 [PATCH v2 0/2] usb: typec: mux: gpio-sbu: Make enable gpio optional Francesco Dolcini
@ 2024-06-03  8:35 ` Francesco Dolcini
  2024-06-03  8:35 ` [PATCH v2 2/2] usb: typec: mux: gpio-sbu: Make enable gpio optional Francesco Dolcini
  1 sibling, 0 replies; 5+ messages in thread
From: Francesco Dolcini @ 2024-06-03  8:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Bjorn Andersson
  Cc: Francesco Dolcini, linux-usb, devicetree, linux-kernel,
	Dmitry Baryshkov, Conor Dooley

From: Francesco Dolcini <francesco.dolcini@toradex.com>

The enable gpio is not required when the SBU mux is used only for
orientation, make enable-gpios required only for alternate mode
switch use case.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
v2:
 - add Acked-by: Conor Dooley
---
 Documentation/devicetree/bindings/usb/gpio-sbu-mux.yaml | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/gpio-sbu-mux.yaml b/Documentation/devicetree/bindings/usb/gpio-sbu-mux.yaml
index 88e1607cf053..30edcce82f97 100644
--- a/Documentation/devicetree/bindings/usb/gpio-sbu-mux.yaml
+++ b/Documentation/devicetree/bindings/usb/gpio-sbu-mux.yaml
@@ -44,13 +44,18 @@ properties:
 
 required:
   - compatible
-  - enable-gpios
   - select-gpios
   - orientation-switch
   - port
 
 allOf:
   - $ref: usb-switch.yaml#
+  - if:
+      required:
+        - mode-switch
+    then:
+      required:
+        - enable-gpios
 
 additionalProperties: false
 
-- 
2.39.2


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

* [PATCH v2 2/2] usb: typec: mux: gpio-sbu: Make enable gpio optional
  2024-06-03  8:35 [PATCH v2 0/2] usb: typec: mux: gpio-sbu: Make enable gpio optional Francesco Dolcini
  2024-06-03  8:35 ` [PATCH v2 1/2] dt-bindings: usb: gpio-sbu-mux: Make 'enable-gpios' optional Francesco Dolcini
@ 2024-06-03  8:35 ` Francesco Dolcini
  2024-06-03 10:10   ` Dmitry Baryshkov
  2024-06-03 10:38   ` Heikki Krogerus
  1 sibling, 2 replies; 5+ messages in thread
From: Francesco Dolcini @ 2024-06-03  8:35 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman
  Cc: Francesco Dolcini, linux-usb, linux-kernel, Dmitry Baryshkov,
	Bjorn Andersson

From: Francesco Dolcini <francesco.dolcini@toradex.com>

The enable gpio is not required when the SBU mux is used only for
orientation, make it optional.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
v2:
 - removed useless NULL check for optional enable gpio
---
 drivers/usb/typec/mux/gpio-sbu-mux.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/mux/gpio-sbu-mux.c b/drivers/usb/typec/mux/gpio-sbu-mux.c
index 374168482d36..8902102c05a8 100644
--- a/drivers/usb/typec/mux/gpio-sbu-mux.c
+++ b/drivers/usb/typec/mux/gpio-sbu-mux.c
@@ -66,6 +66,9 @@ static int gpio_sbu_mux_set(struct typec_mux_dev *mux,
 {
 	struct gpio_sbu_mux *sbu_mux = typec_mux_get_drvdata(mux);
 
+	if (!sbu_mux->enable_gpio)
+		return -EOPNOTSUPP;
+
 	mutex_lock(&sbu_mux->lock);
 
 	switch (state->mode) {
@@ -102,7 +105,8 @@ static int gpio_sbu_mux_probe(struct platform_device *pdev)
 
 	mutex_init(&sbu_mux->lock);
 
-	sbu_mux->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
+	sbu_mux->enable_gpio = devm_gpiod_get_optional(dev, "enable",
+						       GPIOD_OUT_LOW);
 	if (IS_ERR(sbu_mux->enable_gpio))
 		return dev_err_probe(dev, PTR_ERR(sbu_mux->enable_gpio),
 				     "unable to acquire enable gpio\n");
-- 
2.39.2


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

* Re: [PATCH v2 2/2] usb: typec: mux: gpio-sbu: Make enable gpio optional
  2024-06-03  8:35 ` [PATCH v2 2/2] usb: typec: mux: gpio-sbu: Make enable gpio optional Francesco Dolcini
@ 2024-06-03 10:10   ` Dmitry Baryshkov
  2024-06-03 10:38   ` Heikki Krogerus
  1 sibling, 0 replies; 5+ messages in thread
From: Dmitry Baryshkov @ 2024-06-03 10:10 UTC (permalink / raw)
  To: Francesco Dolcini
  Cc: Heikki Krogerus, Greg Kroah-Hartman, Francesco Dolcini, linux-usb,
	linux-kernel, Bjorn Andersson

On Mon, Jun 03, 2024 at 10:35:58AM +0200, Francesco Dolcini wrote:
> From: Francesco Dolcini <francesco.dolcini@toradex.com>
> 
> The enable gpio is not required when the SBU mux is used only for
> orientation, make it optional.
> 
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> ---
> v2:
>  - removed useless NULL check for optional enable gpio
> ---
>  drivers/usb/typec/mux/gpio-sbu-mux.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>


-- 
With best wishes
Dmitry

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

* Re: [PATCH v2 2/2] usb: typec: mux: gpio-sbu: Make enable gpio optional
  2024-06-03  8:35 ` [PATCH v2 2/2] usb: typec: mux: gpio-sbu: Make enable gpio optional Francesco Dolcini
  2024-06-03 10:10   ` Dmitry Baryshkov
@ 2024-06-03 10:38   ` Heikki Krogerus
  1 sibling, 0 replies; 5+ messages in thread
From: Heikki Krogerus @ 2024-06-03 10:38 UTC (permalink / raw)
  To: Francesco Dolcini
  Cc: Greg Kroah-Hartman, Francesco Dolcini, linux-usb, linux-kernel,
	Dmitry Baryshkov, Bjorn Andersson

On Mon, Jun 03, 2024 at 10:35:58AM +0200, Francesco Dolcini wrote:
> From: Francesco Dolcini <francesco.dolcini@toradex.com>
> 
> The enable gpio is not required when the SBU mux is used only for
> orientation, make it optional.
> 
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> v2:
>  - removed useless NULL check for optional enable gpio
> ---
>  drivers/usb/typec/mux/gpio-sbu-mux.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/mux/gpio-sbu-mux.c b/drivers/usb/typec/mux/gpio-sbu-mux.c
> index 374168482d36..8902102c05a8 100644
> --- a/drivers/usb/typec/mux/gpio-sbu-mux.c
> +++ b/drivers/usb/typec/mux/gpio-sbu-mux.c
> @@ -66,6 +66,9 @@ static int gpio_sbu_mux_set(struct typec_mux_dev *mux,
>  {
>  	struct gpio_sbu_mux *sbu_mux = typec_mux_get_drvdata(mux);
>  
> +	if (!sbu_mux->enable_gpio)
> +		return -EOPNOTSUPP;
> +
>  	mutex_lock(&sbu_mux->lock);
>  
>  	switch (state->mode) {
> @@ -102,7 +105,8 @@ static int gpio_sbu_mux_probe(struct platform_device *pdev)
>  
>  	mutex_init(&sbu_mux->lock);
>  
> -	sbu_mux->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
> +	sbu_mux->enable_gpio = devm_gpiod_get_optional(dev, "enable",
> +						       GPIOD_OUT_LOW);
>  	if (IS_ERR(sbu_mux->enable_gpio))
>  		return dev_err_probe(dev, PTR_ERR(sbu_mux->enable_gpio),
>  				     "unable to acquire enable gpio\n");
> -- 
> 2.39.2

-- 
heikki

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

end of thread, other threads:[~2024-06-03 10:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-03  8:35 [PATCH v2 0/2] usb: typec: mux: gpio-sbu: Make enable gpio optional Francesco Dolcini
2024-06-03  8:35 ` [PATCH v2 1/2] dt-bindings: usb: gpio-sbu-mux: Make 'enable-gpios' optional Francesco Dolcini
2024-06-03  8:35 ` [PATCH v2 2/2] usb: typec: mux: gpio-sbu: Make enable gpio optional Francesco Dolcini
2024-06-03 10:10   ` Dmitry Baryshkov
2024-06-03 10:38   ` Heikki Krogerus

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