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 Thu, Sep 25, 2014 at 11:47 AM,  <robert.jarzmik@xxxxxxx> wrote:
> De: "Linus Walleij" <linus.walleij@xxxxxxxxxx>
>> @@ -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.
>
> Yeah, but my problem is in the if statement, not in the else. The else is for
> the DT/ACPI cases, in which there is no problem.

In that case, that whole clause is actually using the old API without
explicit request, so you can just do this:

if (mach) {
              /* This clause will go away when we have transitioned to
just using descriptors */
              if (devm_gpio_request_one(&pdev->dev, mach->gpio_pullup,
                                        mach->gpio_pullup_inverted ?
GPIOF_ACTIVE_LOW : 0,
"my pin"))
                  goto err;
              udc->gpiod = gpio_to_desc(mach->gpio_pullup);
              udc->mach = mach;
} else {
...
}

> On the other hand, the "if" is for the legacy platform_data cases which bother me.
> The mach info contains :
>  - gpio_pullup : number of the gpio
>  - gpio_pullup_inverted : the active low state
>
> What I would have needed would be something like :
> if (mach) {
>         udc->gpiod = gpio_to_desc(mach->gpio_pullup);
>         gpiod_MAGIC_FUNC_set_flags(udc->gpiod, mach->gpio_pullup_inverted ? ACTIVE_LOW : 0);
>         udc->mach = mach;
> } else {
>     udv->gpiod = devm_gpiod_get(&pdev->dev, ...);
> }
>
> The "MAGIC_FUNC" is what I'm missing here. And I agree this is something that is bound in
> electronics, and eventually will have to be shifted to platform code. The porting issue I
> have is that I don't want the dependency of changing *all* pxa27x machines as a dependency
> for a patch to pxa27x_udc to support device-tree.
> Or alternatively have something like :
>         udc->gpiod = gpio_to_desc_with_flags(mach->gpio_pullup, flags).
> Or another way, to enable a smooth transition without the dependency.
>
> Even I have not found any machine code using this inverted flag, I might have overlooked
> something, and I'm not feeling confortable killing a platform because I made a wrong
> decision.
>
> Cheers.
>
> --
> Robert
--
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