linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [1/3] usb: gadget: udc: atmel: GPIO inversion is handled by gpiod
@ 2018-04-16  9:34 Romain Izard
  0 siblings, 0 replies; 3+ messages in thread
From: Romain Izard @ 2018-04-16  9:34 UTC (permalink / raw)
  To: Nicolas Ferre, Felipe Balbi, Greg Kroah-Hartman,
	Alexandre Belloni, Ludovic Desroches
  Cc: linux-kernel, linux-arm-kernel, linux-usb, Romain Izard

When converting to GPIO descriptors, gpiod_get_value automatically
handles the line inversion flags from the device tree.

Do not invert the line twice.

Fixes: 3df034081021fa4b6967ce3364bc7d867ec1c870

Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 3 +--
 drivers/usb/gadget/udc/atmel_usba_udc.h | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 27c16399c7e8..0fe3d0feb8f7 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -417,7 +417,7 @@ static inline void usba_int_enb_set(struct usba_udc *udc, u32 val)
 static int vbus_is_present(struct usba_udc *udc)
 {
 	if (udc->vbus_pin)
-		return gpiod_get_value(udc->vbus_pin) ^ udc->vbus_pin_inverted;
+		return gpiod_get_value(udc->vbus_pin);
 
 	/* No Vbus detection: Assume always present */
 	return 1;
@@ -2076,7 +2076,6 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
 
 	udc->vbus_pin = devm_gpiod_get_optional(&pdev->dev, "atmel,vbus",
 						GPIOD_IN);
-	udc->vbus_pin_inverted = gpiod_is_active_low(udc->vbus_pin);
 
 	if (fifo_mode == 0) {
 		pp = NULL;
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h
index 969ce8f3c3e2..d7eb7cf4fd5c 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.h
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.h
@@ -326,7 +326,6 @@ struct usba_udc {
 	const struct usba_udc_errata *errata;
 	int irq;
 	struct gpio_desc *vbus_pin;
-	int vbus_pin_inverted;
 	int num_ep;
 	int configured_ep;
 	struct usba_fifo_cfg *fifo_cfg;

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

* [1/3] usb: gadget: udc: atmel: GPIO inversion is handled by gpiod
@ 2018-04-16 11:42 Ludovic Desroches
  0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Desroches @ 2018-04-16 11:42 UTC (permalink / raw)
  To: Romain Izard
  Cc: Nicolas Ferre, Felipe Balbi, Greg Kroah-Hartman,
	Alexandre Belloni, Ludovic Desroches, linux-kernel,
	linux-arm-kernel, linux-usb

On Mon, Apr 16, 2018 at 11:34:03AM +0200, Romain Izard wrote:
> When converting to GPIO descriptors, gpiod_get_value automatically
> handles the line inversion flags from the device tree.

Thanks, I totally missed it.

Regards

> 
> Do not invert the line twice.
> 
> Fixes: 3df034081021fa4b6967ce3364bc7d867ec1c870
> 
> Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>

> ---
>  drivers/usb/gadget/udc/atmel_usba_udc.c | 3 +--
>  drivers/usb/gadget/udc/atmel_usba_udc.h | 1 -
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
> index 27c16399c7e8..0fe3d0feb8f7 100644
> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
> @@ -417,7 +417,7 @@ static inline void usba_int_enb_set(struct usba_udc *udc, u32 val)
>  static int vbus_is_present(struct usba_udc *udc)
>  {
>  	if (udc->vbus_pin)
> -		return gpiod_get_value(udc->vbus_pin) ^ udc->vbus_pin_inverted;
> +		return gpiod_get_value(udc->vbus_pin);
>  
>  	/* No Vbus detection: Assume always present */
>  	return 1;
> @@ -2076,7 +2076,6 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
>  
>  	udc->vbus_pin = devm_gpiod_get_optional(&pdev->dev, "atmel,vbus",
>  						GPIOD_IN);
> -	udc->vbus_pin_inverted = gpiod_is_active_low(udc->vbus_pin);
>  
>  	if (fifo_mode == 0) {
>  		pp = NULL;
> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h
> index 969ce8f3c3e2..d7eb7cf4fd5c 100644
> --- a/drivers/usb/gadget/udc/atmel_usba_udc.h
> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.h
> @@ -326,7 +326,6 @@ struct usba_udc {
>  	const struct usba_udc_errata *errata;
>  	int irq;
>  	struct gpio_desc *vbus_pin;
> -	int vbus_pin_inverted;
>  	int num_ep;
>  	int configured_ep;
>  	struct usba_fifo_cfg *fifo_cfg;
> -- 
> 2.14.1
>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [1/3] usb: gadget: udc: atmel: GPIO inversion is handled by gpiod
@ 2018-04-25  9:53 Felipe Balbi
  0 siblings, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2018-04-25  9:53 UTC (permalink / raw)
  To: Romain Izard, Nicolas Ferre, Greg Kroah-Hartman,
	Alexandre Belloni, Ludovic Desroches
  Cc: linux-kernel, linux-arm-kernel, linux-usb

Romain Izard <romain.izard.pro@gmail.com> writes:

> When converting to GPIO descriptors, gpiod_get_value automatically
> handles the line inversion flags from the device tree.
>
> Do not invert the line twice.
>
> Fixes: 3df034081021fa4b6967ce3364bc7d867ec1c870

your fixes line is incorrect. Please fix and resend. While at that,
please collect Acked-bys and Tested-bys, etc.

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

end of thread, other threads:[~2018-04-25  9:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-25  9:53 [1/3] usb: gadget: udc: atmel: GPIO inversion is handled by gpiod Felipe Balbi
  -- strict thread matches above, loose matches on Subject: below --
2018-04-16 11:42 Ludovic Desroches
2018-04-16  9:34 Romain Izard

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