[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<DU0PR04MB94179C67B46BD5F644FC2DF288E22@DU0PR04MB9417.eurprd04.prod.outlook.com>
Date: Mon, 13 May 2024 09:09:04 +0000
From: Peng Fan <peng.fan@....com>
To: Andy Shevchenko <andy.shevchenko@...il.com>, "Peng Fan (OSS)"
<peng.fan@....nxp.com>
CC: Sudeep Holla <sudeep.holla@....com>, Cristian Marussi
<cristian.marussi@....com>, Rob Herring <robh@...nel.org>, Krzysztof
Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Shawn Guo
<shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>, Pengutronix
Kernel Team <kernel@...gutronix.de>, Fabio Estevam <festevam@...il.com>,
Linus Walleij <linus.walleij@...aro.org>, Aisheng Dong
<aisheng.dong@....com>, Jacky Bai <ping.bai@....com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "imx@...ts.linux.dev" <imx@...ts.linux.dev>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>
Subject: RE: [PATCH v4 3/3] pinctrl: imx: support SCMI pinctrl protocol for
i.MX95
> 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@....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
>
Powered by blists - more mailing lists