Commit a3e20083 authored by Romain Izard's avatar Romain Izard Committed by Felipe Balbi

usb: gadget: udc: atmel: GPIO inversion is handled by gpiod

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: 3df03408 ("usb: gadget: udc: atmel: convert to use GPIO descriptors")
Acked-by: default avatarLudovic Desroches <ludovic.desroches@microchip.com>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: default avatarRomain Izard <romain.izard.pro@gmail.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 1ca532e9
...@@ -417,7 +417,7 @@ static inline void usba_int_enb_set(struct usba_udc *udc, u32 val) ...@@ -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) static int vbus_is_present(struct usba_udc *udc)
{ {
if (udc->vbus_pin) 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 */ /* No Vbus detection: Assume always present */
return 1; return 1;
...@@ -2076,7 +2076,6 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, ...@@ -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", udc->vbus_pin = devm_gpiod_get_optional(&pdev->dev, "atmel,vbus",
GPIOD_IN); GPIOD_IN);
udc->vbus_pin_inverted = gpiod_is_active_low(udc->vbus_pin);
if (fifo_mode == 0) { if (fifo_mode == 0) {
pp = NULL; pp = NULL;
......
...@@ -326,7 +326,6 @@ struct usba_udc { ...@@ -326,7 +326,6 @@ struct usba_udc {
const struct usba_udc_errata *errata; const struct usba_udc_errata *errata;
int irq; int irq;
struct gpio_desc *vbus_pin; struct gpio_desc *vbus_pin;
int vbus_pin_inverted;
int num_ep; int num_ep;
int configured_ep; int configured_ep;
struct usba_fifo_cfg *fifo_cfg; struct usba_fifo_cfg *fifo_cfg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment