Linux-GPIO Archive mirror
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@nxp.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>,
	"Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>,
	Cristian Marussi <cristian.marussi@arm.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Aisheng Dong <aisheng.dong@nxp.com>, Jacky Bai <ping.bai@nxp.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: RE: [PATCH v4 3/3] pinctrl: imx: support SCMI pinctrl protocol for i.MX95
Date: Mon, 13 May 2024 09:09:04 +0000	[thread overview]
Message-ID: <DU0PR04MB94179C67B46BD5F644FC2DF288E22@DU0PR04MB9417.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <Zj_HFxHMV57EXfYm@surfacebook.localdomain>

> Subject: Re: [PATCH v4 3/3] pinctrl: imx: support SCMI pinctrl protocol for
> i.MX95
> 
> Sun, May 05, 2024 at 11:47:19AM +0800, Peng Fan (OSS) kirjoitti:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > The generic pinctrl-scmi.c driver could not be used for i.MX95 because
> > i.MX95 SCMI firmware not supports functions, groups or generic 'Pin
> > Configuration Type and Enumerations' listed in SCMI Specification.
> >
> > i.MX95 System Control Management Interface(SCMI) firmware only
> > supports below pin configuration types which are OEM specific types:
> >     192: PIN MUX
> >     193: PIN CONF
> >     194: DAISY ID
> >     195: DAISY VAL
> >
> > To support Linux generic pinctrl properties(pinmux, bias-pull-[up,
> > down], and etc), need extract the value from the property and map them
> > to the format that i.MX95 SCMI pinctrl protocol understands, so add
> > this driver.
> 

Thanks for refining this.

> ...
> 
> > +struct imx_pin_group {
> > +	struct pingroup data;
> > +};
> 
> I don't see the necessity of having this wrapper structure. Can't you simply
> use struct pingroup directly?

Yeah. Let me drop the wrapper in v6.

> 
> ...
> 
> > +static int scmi_pinctrl_imx_probe(struct scmi_device *sdev) {
> > +	int ret;
> > +	struct device *dev = &sdev->dev;
> > +	struct scmi_pinctrl_imx *pmx;
> > +	const struct scmi_handle *handle;
> > +	struct scmi_protocol_handle *ph;
> > +	struct device_node *np __free(device_node) =
> of_find_node_by_path("/");
> > +	const struct scmi_pinctrl_proto_ops *pinctrl_ops;
> 
> > +	if (!sdev->handle)
> > +		return -EINVAL;
> 
> When this conditional can be true?

Just follow what other SCMI drivers do.
scmi_set_handle will get handles, per the code, there
might be NULL.

> 
> > +	if (!of_match_node(scmi_pinctrl_imx_allowlist, np))
> > +		return -ENODEV;
> 
> > +	handle = sdev->handle;
> 
> It's even better to assign first and then check if the above check is needed at
> all.

Yeah. Update in v6.

> 
> > +	pinctrl_ops = handle->devm_protocol_get(sdev,
> SCMI_PROTOCOL_PINCTRL, &ph);
> > +	if (IS_ERR(pinctrl_ops))
> > +		return PTR_ERR(pinctrl_ops);
> > +
> > +	pmx = devm_kzalloc(dev, sizeof(*pmx), GFP_KERNEL);
> > +	if (!pmx)
> > +		return -ENOMEM;
> > +
> > +	pmx->ph = ph;
> > +	pmx->ops = pinctrl_ops;
> > +
> > +	pmx->dev = dev;
> > +	pmx->pctl_desc.name = DRV_NAME;
> > +	pmx->pctl_desc.owner = THIS_MODULE;
> > +	pmx->pctl_desc.pctlops = &pinctrl_scmi_imx_pinctrl_ops;
> > +	pmx->pctl_desc.pmxops = &pinctrl_scmi_imx_pinmux_ops;
> > +	pmx->pctl_desc.confops = &pinctrl_scmi_imx_pinconf_ops;
> > +
> > +	ret = scmi_pinctrl_imx_get_pins(pmx, &pmx->pctl_desc);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = scmi_pinctrl_imx_probe_dt(sdev, pmx);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = devm_pinctrl_register_and_init(dev, &pmx->pctl_desc, pmx,
> > +					     &pmx->pctldev);
> > +	if (ret)
> > +		return dev_err_probe(dev, ret, "Failed to register pinctrl\n");
> > +
> > +	return pinctrl_enable(pmx->pctldev); }

Thanks,
Peng.
> 
> --
> With Best Regards,
> Andy Shevchenko
> 


      reply	other threads:[~2024-05-13  9:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-05  3:47 [PATCH v4 0/3] pinctrl: scmi: support i.MX95 OEM extensions Peng Fan (OSS)
2024-05-05  3:47 ` [PATCH v4 1/3] dt-bindings: firmware: arm,scmi: Add properties for i.MX95 Pinctrl " Peng Fan (OSS)
2024-05-07 19:11   ` Rob Herring
2024-05-05  3:47 ` [PATCH v4 2/3] pinctrl: scmi: add blocklist Peng Fan (OSS)
2024-05-07 19:14   ` Rob Herring
2024-05-05  3:47 ` [PATCH v4 3/3] pinctrl: imx: support SCMI pinctrl protocol for i.MX95 Peng Fan (OSS)
2024-05-11 19:29   ` Andy Shevchenko
2024-05-13  9:09     ` Peng Fan [this message]

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=DU0PR04MB94179C67B46BD5F644FC2DF288E22@DU0PR04MB9417.eurprd04.prod.outlook.com \
    --to=peng.fan@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=cristian.marussi@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.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=peng.fan@oss.nxp.com \
    --cc=ping.bai@nxp.com \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=sudeep.holla@arm.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 read-only IMAP folder(s) and NNTP newsgroup(s).