linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Mark Brown <broonie@kernel.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: Re: [PATCH v6 2/3] gpio: add a reusable generic gpio_chip using regmap
Date: Thu, 28 May 2020 19:03:02 +0200	[thread overview]
Message-ID: <7d281a1e30ea40837ab1a156c561ca6b@walle.cc> (raw)
In-Reply-To: <adb4eba6-c6c4-a403-dead-1951050eec26@linux.intel.com>

Am 2020-05-28 17:55, schrieb Pierre-Louis Bossart:
>> +    /* if we have a direction register we need both input and
>> output */
>> +    if ((config->reg_dir_out_base || config->reg_dir_in_base) &&
>> +        (!config->reg_dat_base || !config->reg_set_base))
>> +        return ERR_PTR(-EINVAL);
>  This failed for me since I didn't have the 'dat' base assigned. I
> still can't figure out what 'dat' stands for...I just assigned it to
> the same offset as the 'set' base but really don't understand what
> this is supposed to do.

DAT is the data register, aka input register, if the GPIO is in input
mode.

If I read the datasheet correctly you should use the following:

PCM512x_GPIO_EN should be reg_dir_out_base
PCM512x_GPIO_CONTROL_1 should be reg_set_base
PCM512x_GPIN should be reg_dat_base

no custom xlate necessary. GPIN looks a bit fishy in that datasheet:
  http://www.ti.com/lit/ds/symlink/pcm5121.pdf?ts=1590684141147

PCM512x_GPIO_OUTPUT_1..6 is pinmux control and shouldn't be part of
the gpio-regmap. Your driver needs to take care of that.

>> +
>> +    /* we don't support having both registers simultaneously for
>> now */
>> +    if (config->reg_dir_out_base && config->reg_dir_in_base)
>> +        return ERR_PTR(-EINVAL);
> 
> and this second test seems to contradict the notion of 'both input and
> output' above?

dir_out_base is used if the register is high active to select an output.
dir_in_base is used for a low active register. Thus both bases are used
to switch a GPIO between input and output.

> re-adding comment from previous series:
>  >> I still have a series of odd warnings I didn't have before: >> >>
> [  101.400263] WARNING: CPU: 3 PID: 1129 at >>
> drivers/gpio/gpiolib.c:4084 gpiod_set_value+0x3f/0x50 >> >> This seems
> to come from >>     /* Should be using gpiod_set_value_cansleep() */
>>>     WARN_ON(desc->gdev->chip->can_sleep); > > Right now,
> gpio-regmap hardcodes can_sleep to true. But the only regmap > which
> don't sleep is regmap-mmio. The PCM512x seems to be either I2C or >
> SPI, which can both sleep. So this warning is actually correct and >
> wherever this gpio is set should do it by calling the _cansleep() >
> version.
> 
> I still have the warnings with this version, not sure if you wanted to
> fix it in the v6 or is this needs to be fixed in another piece of
> code/patch. How would we go about removing this warning?

There is no fix in gpio-regmap. wherever this GPIO is connected to must
not call gpiod_set_value() but have to use gpiod_set_value_cansleep().

-michael

  parent reply	other threads:[~2020-05-28 17:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 14:58 [PATCH v6 0/3] gpio: generic regmap implementation Michael Walle
2020-05-28 14:58 ` [PATCH v6 1/3] gpiolib: Introduce gpiochip_irqchip_add_domain() Michael Walle
2020-05-28 14:58 ` [PATCH v6 2/3] gpio: add a reusable generic gpio_chip using regmap Michael Walle
     [not found]   ` <adb4eba6-c6c4-a403-dead-1951050eec26@linux.intel.com>
2020-05-28 17:03     ` Michael Walle [this message]
2020-05-28 18:15       ` Pierre-Louis Bossart
2020-05-28 14:58 ` [PATCH v6 3/3] MAINTAINERS: Add gpio regmap section Michael Walle
2020-05-28 15:11 ` [PATCH v6 0/3] gpio: generic regmap implementation Andy Shevchenko
2020-06-03  8:50 ` Linus Walleij

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=7d281a1e30ea40837ab1a156c561ca6b@walle.cc \
    --to=michael@walle.cc \
    --cc=andy.shevchenko@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    /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).