Linux-OMAP Archive on lore.kernel.org
 help / color / Atom feed
* Re: gpio-omap: add support gpiolib bias (pull-up/down) flags?
       [not found] ` <CACRpkdaPoMGZ7jGh6j4dYexx+qCcoMQ37vS7kbpf=3TtcA9zQQ@mail.gmail.com>
@ 2020-03-13  0:39   ` Drew Fustini
  2020-03-13  5:23     ` Haojian Zhuang
  0 siblings, 1 reply; 2+ messages in thread
From: Drew Fustini @ 2020-03-13  0:39 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Grygorii Strashko, Santosh Shilimkar, Kevin Hilman, linux-gpio,
	Drew Fustini, Jason Kridner, Robert Nelson, Tony Lindgren,
	Haojian Zhuang, linux-omap

On Thu, Mar 12, 2020 at 1:43 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> Do we have a datasheet for this GPIO block somewhere? Should
> be the datasheet for the ASIC.

I am looking at the AM335x reference manual [0] but I can not actually
find any references to pull-up/down or bias for GPIO pins.  I guess I
was making of the mistake of assuming this would be something the gpio
pins support.

> We already have the required .set_config() callback on the OMAP
> driver, it's just that it only uses it for debounce.
>
> The driver is a bit convoluted with register offsets in a struct
> omap_gpio_reg_offs depending on variant, but if they have
> a register for this I'd say just get hacking.
>
> If the GPIO driver is using pin control as back-end you are
> looking at something more complex similar to what Intel is
> doing inside drivers/pinctrl/intel/pinctrl-intel.c: this driver
> is just calling up to gpiochip_generic_config() which will
> try to configure the lines behind the GPIO using pin config,
> which works if the proper ranges are defined so the
> framework can map a GPIO line to a pin control pin.

Thank you for the feedback, Linus.

Upon further review of drivers/pinctrl/pinctrl-single.c, I am not
certain it actually supports pull-up/down.

I see there is pcs_pinconf_clear_bias() and pcs_pinconf_bias_disable()
but I don't see a place where the PIN_CONFIG_BIAS_PULL_DOWN or
PIN_CONFIG_BIAS_PULL_UP get set.

I'll have to look at that some more before I go back to thinking about
how to integrate into gpio-omap.

Thanks,
Drew

[0] http://www.ti.com/lit/ug/spruh73q/spruh73q.pdf

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: gpio-omap: add support gpiolib bias (pull-up/down) flags?
  2020-03-13  0:39   ` gpio-omap: add support gpiolib bias (pull-up/down) flags? Drew Fustini
@ 2020-03-13  5:23     ` Haojian Zhuang
  0 siblings, 0 replies; 2+ messages in thread
From: Haojian Zhuang @ 2020-03-13  5:23 UTC (permalink / raw)
  To: Drew Fustini
  Cc: Linus Walleij, Grygorii Strashko, Santosh Shilimkar,
	Kevin Hilman, linux-gpio, Drew Fustini, Jason Kridner,
	Robert Nelson, Tony Lindgren, linux-omap

On Fri, 13 Mar 2020 at 08:38, Drew Fustini <pdp7pdp7@gmail.com> wrote:
>
> On Thu, Mar 12, 2020 at 1:43 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> > Do we have a datasheet for this GPIO block somewhere? Should
> > be the datasheet for the ASIC.
>
> I am looking at the AM335x reference manual [0] but I can not actually
> find any references to pull-up/down or bias for GPIO pins.  I guess I
> was making of the mistake of assuming this would be something the gpio
> pins support.
>
> > We already have the required .set_config() callback on the OMAP
> > driver, it's just that it only uses it for debounce.
> >
> > The driver is a bit convoluted with register offsets in a struct
> > omap_gpio_reg_offs depending on variant, but if they have
> > a register for this I'd say just get hacking.
> >
> > If the GPIO driver is using pin control as back-end you are
> > looking at something more complex similar to what Intel is
> > doing inside drivers/pinctrl/intel/pinctrl-intel.c: this driver
> > is just calling up to gpiochip_generic_config() which will
> > try to configure the lines behind the GPIO using pin config,
> > which works if the proper ranges are defined so the
> > framework can map a GPIO line to a pin control pin.
>
> Thank you for the feedback, Linus.
>
> Upon further review of drivers/pinctrl/pinctrl-single.c, I am not
> certain it actually supports pull-up/down.
>
> I see there is pcs_pinconf_clear_bias() and pcs_pinconf_bias_disable()
> but I don't see a place where the PIN_CONFIG_BIAS_PULL_DOWN or
> PIN_CONFIG_BIAS_PULL_UP get set.
>

                        /* 4 parameters */
                        case PIN_CONFIG_BIAS_DISABLE:
                                pcs_pinconf_clear_bias(pctldev, pin);
                                break;
                        case PIN_CONFIG_BIAS_PULL_DOWN:
                        case PIN_CONFIG_BIAS_PULL_UP:
                                if (arg)
                                        pcs_pinconf_clear_bias(pctldev, pin);
                                /* fall through */
                        case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
                                data &= ~func->conf[i].mask;
                                if (arg)
                                        data |= func->conf[i].enable;
                                else
                                        data |= func->conf[i].disable;
                                break;

Because it does fall through, pullup/pulldown is set in the snippet of
"PIN_CONFIG_INPUT_SCHMITT_ENABLE".

Best Regards
Haojian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAEf4M_Du6Egn-3nZHtSnMMwohc+-DyEdtWU5DqSJi71+nDthFw@mail.gmail.com>
     [not found] ` <CACRpkdaPoMGZ7jGh6j4dYexx+qCcoMQ37vS7kbpf=3TtcA9zQQ@mail.gmail.com>
2020-03-13  0:39   ` gpio-omap: add support gpiolib bias (pull-up/down) flags? Drew Fustini
2020-03-13  5:23     ` Haojian Zhuang

Linux-OMAP Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-omap/0 linux-omap/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-omap linux-omap/ https://lore.kernel.org/linux-omap \
		linux-omap@vger.kernel.org
	public-inbox-index linux-omap

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-omap


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git