Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1563582
| From | Mika Westerberg <mika.westerberg@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/3] pinctrl / gpio: Introduce .set_config() callback for GPIO chips |
| Date | 2017-01-20 14:40 +0100 |
| Message-ID | <t1HA6-7Ps-27@gated-at.bofh.it> (permalink) |
| References | <t1hvX-8e7-3@gated-at.bofh.it> <t1hFE-8hK-21@gated-at.bofh.it> <t1Dwu-5pq-23@gated-at.bofh.it> |
| Organization | Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo |
On Fri, Jan 20, 2017 at 10:13:05AM +0100, Linus Walleij wrote:
> > +static int gpio_set_drive_mode(struct gpio_chip *gc, unsigned offset,
> > + enum pin_config_param mode)
> > +{
> > + unsigned long config = { PIN_CONF_PACKED(mode, 0) };
> > +
> > + return gc->set_config ? gc->set_config(gc, offset, config) : -ENOTSUPP;
> > +}
>
> I would name it gpio_set_drive_single_ended() as the open source/open
> drain is all we support here.
OK.
> > if (test_bit(FLAG_OPEN_DRAIN, &desc->flags)) {
> > /* First see if we can enable open drain in hardware */
> > - if (gc->set_single_ended) {
> > - ret = gc->set_single_ended(gc, gpio_chip_hwgpio(desc),
> > - LINE_MODE_OPEN_DRAIN);
> > - if (!ret)
> > - goto set_output_value;
> > - }
> > + ret = gpio_set_drive_mode(gc, gpio_chip_hwgpio(desc),
> > + PIN_CONFIG_DRIVE_OPEN_DRAIN);
> > + if (!ret)
> > + goto set_output_value;
>
> Aha I see, so if we fail to set single ended we get to the next step.
> Nice.
>
> > /* Emulate open drain by not actively driving the line high */
> > if (val)
> > return gpiod_direction_input(desc);
> > }
>
> (...)
>
> > - if (gc->set_single_ended) {
> > - ret = gc->set_single_ended(gc, gpio_chip_hwgpio(desc),
> > - LINE_MODE_OPEN_SOURCE);
> > - if (!ret)
> > - goto set_output_value;
> > - }
> > + ret = gpio_set_drive_mode(gc, gpio_chip_hwgpio(desc),
> > + PIN_CONFIG_DRIVE_OPEN_SOURCE);
> > /* Emulate open source by not actively driving the line low */
> > if (!val)
> > return gpiod_direction_input(desc);
>
> But here the handling seems to be wrong? You still need
> the if (!ret) goto set_output_value?
Good point. I'll fix that in the next version.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/3] pinctrl / gpio: Allow GPIO chips to use generic pinconfig Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-01-19 11:00 +0100
[PATCH 1/3] pinctrl: Widen the generic pinconf argument from 16 to 24 bits Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-01-19 11:00 +0100
Re: [PATCH 1/3] pinctrl: Widen the generic pinconf argument from 16 to 24 bits Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-01-19 13:10 +0100
Re: [PATCH 1/3] pinctrl: Widen the generic pinconf argument from 16 to 24 bits Linus Walleij <linus.walleij@linaro.org> - 2017-01-20 10:00 +0100
Re: [PATCH 0/3] pinctrl / gpio: Allow GPIO chips to use generic pinconfig Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-01-19 13:20 +0100
Re: [PATCH 3/3] pinctrl / gpio: Introduce .set_config() callback for GPIO chips Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-01-19 13:20 +0100
Re: [PATCH 3/3] pinctrl / gpio: Introduce .set_config() callback for GPIO chips Linus Walleij <linus.walleij@linaro.org> - 2017-01-20 10:20 +0100
Re: [PATCH 3/3] pinctrl / gpio: Introduce .set_config() callback for GPIO chips Neil Armstrong <narmstrong@baylibre.com> - 2017-01-20 10:30 +0100
Re: [PATCH 3/3] pinctrl / gpio: Introduce .set_config() callback for GPIO chips Linus Walleij <linus.walleij@linaro.org> - 2017-01-20 11:00 +0100
Re: [PATCH 3/3] pinctrl / gpio: Introduce .set_config() callback for GPIO chips Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-01-20 14:40 +0100
csiph-web