Re: [PATCH v1 3/6] leds: gpio: Avoid using GPIOF_ACTIVE_LOW

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

 



Hi Andy,

On Mon, Nov 11, 2024 at 10:57 AM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> On Mon, Nov 11, 2024 at 10:45:13AM +0100, Geert Uytterhoeven wrote:
> > On Mon, Nov 4, 2024 at 10:37 AM Andy Shevchenko
> > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> ...
>
> > > -       if (template->active_low)
> > > -               flags |= GPIOF_ACTIVE_LOW;
> > > -
> > > -       ret = devm_gpio_request_one(dev, template->gpio, flags,
> > > +       ret = devm_gpio_request_one(dev, template->gpio, GPIOF_OUT_INIT_LOW,
> > >                                     template->name);
> >
> > Just wondering, as I am not 100% sure: can this change change the
> > initial state of the GPIO?
>
> You probably wonder how ACTIVE_LOW affects the OUT_INIT_LOW given above.
> I have an answer to you, however I might be mistaken as well, but I spent some
> time to investigate.
>
> The above mentioned call ends up in the gpiod_direction_output_raw_commit() which
> uses the value (low in this case) as an absolute value. It does not include the
> ACTIVE_LOW in the value calculations. Hence, setting ACTIVE_LOW before or afterwards
> has no effect on the existing flow.
>
> If you notice a mistake, please elaborate this, so I can fix the approach!

Thanks, I had discovered the same, but wanted to double-check!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds





[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux