Re: Query about Open drain flag with active LOW

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

 



On Tue, Mar 28, 2017 at 11:03 AM, Laxman Dewangan <ldewangan@xxxxxxxxxx> wrote:

> I wanted to say that open drain flag should be with ACTIVE_HIGH |
> SINGLE_ENDED which is in inverted as of now.

Oh that seems correct... can you send a patch for this?

>> Else can you try to break down the problem, do you mean there is a bug
>> in inverted handling for open drain lines in gpiolib?
>
> Yes, I am suspecting the bug here with combination of ACTIVE state and
> SINGLE_ENDED flag. The logic to get OPEN DRAIN flag should be in inverted
> form.
> Else we need to decouple the ACTIVE state with SINGLE_ENDED flag to get Open
> drain or open source.
>
> If I want to say logical "1" for the open drain, it is setting pin in
> drive-0 mode. Actually, it should be in input mode so that pin state become
> HIGH.
>
> In function of_find_gpio(), it is as follows:
>
>         if (of_flags & OF_GPIO_SINGLE_ENDED) {
>                 if (of_flags & OF_GPIO_ACTIVE_LOW)
>                         *flags |= GPIO_OPEN_DRAIN;
>                 else
>                         *flags |= GPIO_OPEN_SOURCE;
>         }
>
>
> I think it should be
>         if (of_flags & OF_GPIO_SINGLE_ENDED) {
>                 if (of_flags & OF_GPIO_ACTIVE_LOW)
>                         *flags |= GPIO_OPEN_SOURCE;
>                 else
>                         *flags |= GPIO_OPEN_DRAIN;
>         }
>
>
> Similar change is needed in the dtbinding gpio header also to invert the
> ACTIVE state with open drain/source.

OK I think there are no real users of this feature yet, so it would be great if
you could send a patch, especially if you also have hardware so you can test it.

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



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux