linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Matt Walker <m@allocor.tech>
Cc: linux-gpio@vger.kernel.org
Subject: Re: MCP23S08 Pincontroller Bias Configuration and GpioLib
Date: Thu, 19 Sep 2024 12:11:34 +0800	[thread overview]
Message-ID: <20240919041134.GA54544@rigel> (raw)
In-Reply-To: <CACjtZiReNNqzonwri51fCPArKR-D9nzQ4HgZAM_EFdzUW0LGOg@mail.gmail.com>

On Wed, Sep 18, 2024 at 09:21:11PM -0400, Matt Walker wrote:
> Hi all -- I'm trying to do GPIO from userspace and have run into some
> confusion I could use some clarification on.
>
> Assumption: It is not possible to set the pull up bias for a specific
> line from the device tree and expose the line to user space. And it is
> not possible to set the bias from the old sysfs gpio configuration.
>
> I'm therefore trying to use the GPIO_V2_LINE_SET_CONFIG_IOCTL to set
> the bias of the line. However, the MCP23S08 (pinctrl-mcp23s08.c)
> driver does not have its implementation of struct
> pinconf_ops.pin_config_set called. Instead I had to add an
> implementation of struct gpiochip.set_config.
>
> Confusion: I thought the pin controller was solely responsible for
> configuration of bias and that the gpiolib would magically know that
> it needs to call pinconf_ops.pin_config_set. Since it seems like an
> unnecessary duplication of effort to set bias config in both pinctrl
> and gpiochip, I figure I'm missing something. I thought it might be
> that the MCP driver does not have an explicit call to
> gpiochip_add_pin_range, but that wasn't it. I also tried adding the
> pinctrl definitions suggested in the device tree mapping, and that
> also didn't work.
>
> Thanks for any insights anyone might have! And if there's not a better
> way, I'll clean up the driver and submit it as a patch.
>

Not my bailiwick, but looking through the code (both gpiolib and drivers)
it seems to me you should set

	mcp->chip.set_config = gpiochip_generic_config;

to hook into the magic that you are expecting.

Cheers,
Kent.

  reply	other threads:[~2024-09-19  4:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-19  1:21 MCP23S08 Pincontroller Bias Configuration and GpioLib Matt Walker
2024-09-19  4:11 ` Kent Gibson [this message]
2024-09-19 16:38   ` Matt Walker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240919041134.GA54544@rigel \
    --to=warthog618@gmail.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=m@allocor.tech \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).