Re: [PATCH] gpio: sifive: use the correct register to read output values

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

 



On Sat, Feb 05, 2022 at 05:39:35PM +0100, Linus Walleij wrote:
> On Fri, Feb 4, 2022 at 2:02 PM Niklas Cassel <Niklas.Cassel@xxxxxxx> wrote:
> 
> > From: Niklas Cassel <niklas.cassel@xxxxxxx>
> 
> Hi Niklas, long time no C!

I C what you did there ;)

I've been working mostly on spdk and fio, unfortunately,
both projects are written in C :)

Learning Rust is still on the todo list...


> 
> > Setting the output of a GPIO to 1 using gpiod_set_value(), followed by
> > reading the same GPIO using gpiod_get_value(), will currently yield an
> > incorrect result.
> >
> > This is because the SiFive GPIO device stores the output values in reg_set,
> > not reg_dat.
> >
> > Supply the flag BGPIOF_READ_OUTPUT_REG_SET to bgpio_init() so that the
> > generic driver reads the correct register.
> >
> > Signed-off-by: Niklas Cassel <niklas.cassel@xxxxxxx>
> 
> Looks like a straight-forward fix so:
> Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

Thanks for the review!

Indeed, I can't understand how no one has caught this bug before.

I guess most drivers simply use gpiod_set_value() to control a pin,
e.g. chip select, but rarely care about the existing value of the pin,
so gpiod_get_value() being broken does not really matter to most drivers.


Kind regards,
Niklas



[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