From: "Michael Walle" <mwalle@kernel.org>
To: "William Breathitt Gray" <wbg@kernel.org>,
"Mark Cave-Ayland" <mark.caveayland@nutanix.com>
Cc: <linus.walleij@linaro.org>, <brgl@bgdev.pl>,
<andriy.shevchenko@linux.intel.com>, <broonie@kernel.org>,
<linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Ioana Ciornei" <ioana.ciornei@nxp.com>
Subject: Re: gpio: gpio-pci-idio-16 regression after LTS upgrade
Date: Tue, 14 Oct 2025 11:03:25 +0200 [thread overview]
Message-ID: <DDHX9YA0ZMKO.C1MA3CHLT4ZZ@kernel.org> (raw)
In-Reply-To: <20251009094905.223456-1-wbg@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 2671 bytes --]
Hi,
On Thu Oct 9, 2025 at 11:49 AM CEST, William Breathitt Gray wrote:
> On Thu, Oct 09, 2025 at 10:05:58AM +0100, Mark Cave-Ayland wrote:
>> On 07/10/2025 09:16, William Breathitt Gray wrote:
>> > So the intention I had with gpio-idio-16 was to provide reg_dat_base and
>> > reg_set_base to define the input and output bases, and then
>> > reg_mask_xlate would do the translation between input and outputs. I
>> > think this design is allowed by gpio-regmap, is it not Michael?
>> >
>> > In theory, gpio_regmap_get_direction should call gpio->reg_mask_xlate()
>> > which is mapped to idio_16_reg_mask_xlate(), and thus set reg and mask
>> > which then is evaluated at the end of gpio_regmap_get_direction() to
>> > determine which direction to return.
>> >
>> > Is it possible idio_16_reg_mask_xlate() is returning the wrong values
>> > for reg and mask?
>> >
>> > William Breathitt Gray
>>
>> The only logic around .reg_dat_base and .reg_set_base in
>> gpio_regmap_get_direction() is this:
>>
>> if (gpio->reg_dat_base && !gpio->reg_set_base)
>> return GPIO_LINE_DIRECTION_IN;
>> if (gpio->reg_set_base && !gpio->reg_dat_base)
>> return GPIO_LINE_DIRECTION_OUT;
>>
>> Otherwise it attempts to use .reg_dir_out_base and .reg_dir_in_base
>> which are not set for gpio-idio-16 because the GPIO directions are fixed
>> and not controlled via a data-direction register. And as these are not
>> set, gpio_regmap_get_direction() returns -ENOTSUPP.
>>
>> Were you thinking that gpio_regmap_get_direction() should have some
>> additional direction logic if both .reg_dat_base and .reg_set_base are
>> set, based upon their comparative values?
>
> Ah you're right, I misunderstood the logic in gpio_regmap_get_direction.
> So essentially the problem is that gpio-idio-16 has no way of indicating
> the direction of its I/O because it's mixed.
>
> The IDIO-16 series lacks a direction setting register, so I think the
> proper solution is as you suggest: add support for a get_direction
> callback to struct gpio_regmap_config in the same vein as the existing
> reg_mask_xlate callback. Then in gpio_regmap_register you can set
> gpio->get_direction = config->get_direction in the same way
> config->reg_mask_xlate is handled.
IIUC the chip has fixed input and outputs. In that case this should
help:
https://lore.kernel.org/all/20250922142427.3310221-8-ioana.ciornei@nxp.com/
I guess Ioana will resubmit the series for this cycle. To fix the
regression, I guess the patch can then be picked up by the stable
team along with the driver patch which will set the
.fixed_direction_output config field.
-michael
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
next prev parent reply other threads:[~2025-10-14 9:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-06 8:37 gpio: gpio-pci-idio-16 regression after LTS upgrade Mark Cave-Ayland
2025-10-07 8:16 ` William Breathitt Gray
2025-10-09 9:05 ` Mark Cave-Ayland
2025-10-09 9:49 ` William Breathitt Gray
2025-10-14 9:03 ` Michael Walle [this message]
2025-10-14 11:21 ` Ioana Ciornei
2025-10-14 11:25 ` Michael Walle
2025-10-14 11:40 ` Ioana Ciornei
2025-10-12 14:22 ` William Breathitt Gray
2025-10-13 10:32 ` Mark Cave-Ayland
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=DDHX9YA0ZMKO.C1MA3CHLT4ZZ@kernel.org \
--to=mwalle@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=ioana.ciornei@nxp.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.caveayland@nutanix.com \
--cc=wbg@kernel.org \
/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).