linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Clément Leger" <cleger@kalray.eu>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Hoan Tran <hoan@os.amperecomputing.com>,
	"open list, GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH 4/5] pinctrl: dw: add pinctrl support for dwapb gpio driver
Date: Wed, 4 Dec 2019 15:50:03 +0100 (CET)	[thread overview]
Message-ID: <1988869450.95325741.1575471003953.JavaMail.zimbra@kalray.eu> (raw)
In-Reply-To: <CAHp75VdQ6VooLVAfA1z98-bBcfQuR7AomaO8F19AGRjeBtByEQ@mail.gmail.com>


----- On 4 Dec, 2019, at 13:43, Andy Shevchenko andy.shevchenko@gmail.com wrote:

> On Wed, Dec 4, 2019 at 12:12 PM Clement Leger <cleger@kalray.eu> wrote:
>>
>> Synopsys designware gpio controller also has pinmuxing functionnality.
> 
> DesignWare
> pin muxing
> functionality
> 
> (Please, run a spell checker)
> 
>> Pinmuxing allows to choose between software and hardware mode. When
> 
> Pin muxing
> 
>> using hardware mode, an external signal controls the pin output.
>>
>> This patch adds support for pinctrl framework in the gpio driver. This
> 
> GPIO
> 
>> support is conditionned by the snps,has-pinctrl device tree property.
> 
> conditioned
> 
>> Indeed, the functionnality can be detected only if the gpio IP has been
> 
> functionality
> 
>> configured using paremeters encoding which is not always present. If
> 
> parameters
> 
>> property is present, then the pinctrl will be registered and will
> 
>> allow switching to the "hw" functionnality and hence enable the
> 
> functionality
> 
>> alternate function.

Sorry, I will do some spellchecking before resending the serie.

> 
>> +static const struct pinctrl_pin_desc dwapb_pins[] = {
> ...
>> +       DWAPB_PINCTRL_PIN(31)
> 
> Keep comma in such cases.
> 
>> +};
> 
> Can't you split adding pin control data to a separate patch?

Yes even if the first one will not be buildable.

> 
>> +/* One pin per group */
>> +static const char * const dwapb_gpio_groups[] = {
> ...
>> +       "pin31"
> 
> Keep comma here.
> 
>> +};
> 
> Can't we generate these lists dynamically?

Indeed, these list could be dynamically generated. However, since they
can be shared between all pinctrl instances of this driver I thought
it was better to keep them common and simply restrict the number
of pins at pinctrl registration. But as I said, I can generate them if
you want.

> 
>> +       dev_info(gpio->dev, "Setting func %s on pin %d",
>> +               dwapb_gpio_functions[selector], group);
> 
> Noise!

I will remove that.

> 
>> +       ret = pinctrl_enable(port->pctl);
>> +       if (ret) {
>> +               dev_err(gpio->dev, "pinctrl enable failed\n");
>> +               return ret;
>> +       }
> 
> Not sure why it's needed at all.

I saw a comment over "pinctrl_register" in pinctrl.h saying:

/* Please use pinctrl_register_and_init() and pinctrl_enable() instead */

So I switched to pinctrl_register_and_init + pinctrl_enable.

> 
>> +       range = &port->range;
>> +       range->name = dev_name(gpio->dev);
>> +       range->id = port->idx;
>> +       range->pin_base = 0;
>> +       range->base = port->gc.base;
>> +       range->npins = pp->ngpio;
>> +       range->gc = &port->gc;
>> +
>> +       pinctrl_add_gpio_range(port->pctl, range);
> 
> Can you use new callback for this?

Do you mean the gpiochip add_pin_ranges callback ?
If so, I will look at it.

> 
>> -               .name   = "gpio-dwapb",
>> +               .name   = "pinctrl-dwapb",
> 
> This will break existing users.

Ok, I will revert that.

Thanks,

> 
> --
> With Best Regards,
> Andy Shevchenko

  reply	other threads:[~2019-12-04 14:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04 10:10 [PATCH 4/5] pinctrl: dw: add pinctrl support for dwapb gpio driver Clement Leger
2019-12-04 12:43 ` Andy Shevchenko
2019-12-04 14:50   ` Clément Leger [this message]
2019-12-04 17:58     ` Andy Shevchenko

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=1988869450.95325741.1575471003953.JavaMail.zimbra@kalray.eu \
    --to=cleger@kalray.eu \
    --cc=andy.shevchenko@gmail.com \
    --cc=hoan@os.amperecomputing.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.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).