linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Dario Binacchi <dariobin@libero.it>
To: Tony Lindgren <tony@atomide.com>
Cc: linux-kernel@vger.kernel.org,
	Haojian Zhuang <haojian.zhuang@linaro.org>,
	 Linus Walleij <linus.walleij@linaro.org>,
	linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-omap@vger.kernel.org
Subject: Re: [PATCH v2 2/2] pinctrl: single: set pinmux from pins debug file
Date: Tue, 18 May 2021 10:57:31 +0200 (CEST)	[thread overview]
Message-ID: <1340368809.152927.1621328251188@mail1.libero.it> (raw)
In-Reply-To: <YKNZIzyO5Q/XGLRs@atomide.com>

Hi Tony,

> Il 18/05/2021 08:05 Tony Lindgren <tony@atomide.com> ha scritto:
> 
>  
> Hi,
> 
> I noticed few more things I started to wonder about after
> looking at this again.
> 
> * Dario Binacchi <dariobin@libero.it> [210517 20:00]:
> > +static int pcs_pin_dbg_set(struct pinctrl_dev *pctldev, unsigned int pin,
> > +			   char *buf)
> > +{
> > +	struct pcs_device *pcs;
> > +	unsigned int val, mux_bytes;
> > +
> > +	buf = skip_spaces(buf);
> > +	if (kstrtouint(buf, 0, &val))
> > +		return -EINVAL;
> > +
> > +	pcs = pinctrl_dev_get_drvdata(pctldev);
> > +
> > +	mux_bytes = pcs->width / BITS_PER_BYTE;
> > +	pcs->write(val, pcs->base + pin * mux_bytes);
> > +	return 0;
> > +}
> 
> Since you're adding a new interface, how about pass unsigned
> int val instead of char *buf?

I thought about passing char *buf because it seemed more generic 
to me. As the output of pin_dbg_show() depends on the platform 
driver, perhaps pin_dbg_set() may need driver-dependent data.
Is it possible that only the value to be set in the register 
(unsigned int) is required?

> 
> >  static void pcs_dt_free_map(struct pinctrl_dev *pctldev,
> >  				struct pinctrl_map *map, unsigned num_maps)
> >  {
> > @@ -331,6 +348,9 @@ static const struct pinctrl_ops pcs_pinctrl_ops = {
> >  	.get_group_name = pinctrl_generic_get_group_name,
> >  	.get_group_pins = pinctrl_generic_get_group_pins,
> >  	.pin_dbg_show = pcs_pin_dbg_show,
> > +#if IS_ENABLED(CONFIG_DEVMEM)
> > +	.pin_dbg_set = pcs_pin_dbg_set,
> > +#endif
> >  	.dt_node_to_map = pcs_dt_node_to_map,
> >  	.dt_free_map = pcs_dt_free_map,
> >  };
> 
> It might be better to always have the .pin_dbg_set around to
> avoid the IS_ENABLED(CONFIG_DEVMEM).

Ok, I'll remove the CONFIG_DEVMEM dependency

> 
> Does the new interface need something under Documentation too?

Yes, the description of `pins` in Documentation/driver-api/pin-control.rst 
needs to be updated. I'll add another patch to the series.

Thanks and regards,
Dario

> 
> Regards,
> 
> Tony

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-05-18  8:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17 20:00 [PATCH v2 0/2] am335x: set pinmux registers from pins debug file Dario Binacchi
2021-05-17 20:00 ` [PATCH v2 2/2] pinctrl: single: set pinmux " Dario Binacchi
2021-05-18  6:05   ` Tony Lindgren
2021-05-18  8:57     ` Dario Binacchi [this message]
2021-05-21  9:25       ` Tony Lindgren
2021-05-19 11:31 ` [PATCH v2 0/2] am335x: set pinmux registers " 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=1340368809.152927.1621328251188@mail1.libero.it \
    --to=dariobin@libero.it \
    --cc=haojian.zhuang@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.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).