Re: [PATCH V2 1/2] gpio: inverter: Add Inverter controller for gpio configuration

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

 



On Mon, Jun 17, 2019 at 5:14 PM Harish Jenny K N
<harish_kandiga@xxxxxxxxxx> wrote:

> +static int gpio_inverter_get(struct gpio_chip *chip,
> +                            unsigned int offset)
> +{
> +       struct gpio_inverter *inv = gpiochip_get_data(chip);
> +
> +       return gpiod_get_value(inv->gpios[offset]);
> +}
> +
> +static void gpio_inverter_set(struct gpio_chip *chip,
> +                             unsigned int offset, int value)
> +{
> +       struct gpio_inverter *inv = gpiochip_get_data(chip);
> +
> +       return gpiod_set_value(inv->gpios[offset], value);
> +}

The only reason this works is because you added GPIO_ACTIVE_LOW
to all the lines in the device tree. But those are consumer flags, not
producer flags.

These should be removed, use GPIO_ACTIVE_HIGH and rewrite the
code so that it actually does the inversion here:

return !gpiod_get_value(inv->gpios[offset]);

and

return gpiod_set_value(inv->gpios[offset], !value);

respectively (notice ! inversions)

Yours,
Linus Walleij



[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