lkml.org 
[lkml]   [2021]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 2/7] gpio: regmap: Add configurable dir/value order
+Matti

On Tue, May 18, 2021 at 11:39 AM Michael Walle <michael@walle.cc> wrote:
> Am 2021-05-17 21:28, schrieb Sander Vanheule:

...

> Instead of adding a new one, we can also just check no_set_on_input
> in gpio_regmap_direction_output(), which I'd prefer.

+! here.

> static int gpio_regmap_direction_output(struct gpio_chip *chip,
> unsigned int offset, int value)
> {
> struct gpio_regmap *gpio = gpiochip_get_data(chip);
> int ret;
>
> if (gpio->no_set_on_input) {
> /* some smart comment here, also mention gliches */
> ret = gpio_regmap_set_direction(chip, offset, true);
> gpio_regmap_set(chip, offset, value);
> } else {
> gpio_regmap_set(chip, offset, value);
> ret = gpio_regmap_set_direction(chip, offset, true);
> }
>
> return ret;
> }

...

> > + * @no_set_on_input: Set if output value can only be set when the
> > direction
> > + * is configured as output.
>
> set_direction_first ?

Perhaps we need to establish rather something like

/* Broken hardware can't set value on input pin, we have to set it to
output first */
#define GPIO_REGMAP_QUIRK_... BIT(0)

unsigned int quirks;

?

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2021-05-18 12:40    [W:0.194 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site