Re: [PATCH v6 partial v2 1/3] usb: gadget: pxa27x_udc: prepare device-tree support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 24, 2014 at 11:05 PM, Robert Jarzmik <robert.jarzmik@xxxxxxx> wrote:

> For this preparation, a preliminary cleanup is done :
>   - convert the probing of pxa27x_udc to gpio_desc.
>     The conversion is partial because :
>      - the platform data still provides a gpio number, not a gpio desc
>      - the "invert" attribute is lost, hence a loss in the translation
>
> The drawback with the gpio_desc conversion is that the "inverted" gpio
> attribute is lost, as no gpiod_*() function exists to set the
> "active_low" state of a gpio, and that attribute was at driver's
> creation forecast to be set up by the driver and not the machine
> specific code.

This can be fixed as of kernel v3.17.

>  #include <linux/gpio.h>
> +#include <linux/gpio/consumer.h>

You should only need the lower include, remove
<linux/gpio.h>.


> @@ -2415,7 +2411,13 @@ static int pxa_udc_probe(struct platform_device *pdev)
>  {
>         struct resource *regs;
>         struct pxa_udc *udc = &memory;
> -       int retval = 0, gpio;
> +       struct pxa2xx_udc_mach_info *mach = dev_get_platdata(&pdev->dev);
> +       int retval = 0;
> +
> +       if (mach) {
> +               udc->gpiod = gpio_to_desc(mach->gpio_pullup);
> +               udc->mach = mach;
> +       }

} else {
    udv->gpiod = devm_gpiod_get(&pdev->dev, ...);
}

Here you can also use the flags.

So the idea is to use device-bound GPIOs for the future.

Please consult Documentation/gpio/consumer.txt

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux