From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrice CHOTARD Date: Thu, 2 Jul 2020 07:59:53 +0000 Subject: [PATCH v2 10/11] pinctrl: stmfx: add information on pin configuration In-Reply-To: <20200604143022.v2.10.I1b4851af3f935a0e9b02f80c3f5303f9f80502df@changeid> References: <20200604123033.25499-1-patrick.delaunay@st.com> <20200604143022.v2.10.I1b4851af3f935a0e9b02f80c3f5303f9f80502df@changeid> Message-ID: <55421cef-be5b-8b99-e293-9bf9b791d1d8@st.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Patrick On 6/4/20 2:30 PM, Patrick Delaunay wrote: > Add information on pin configuration used for pinmux command. > > Signed-off-by: Patrick Delaunay > --- > > Changes in v2: None > > drivers/pinctrl/pinctrl-stmfx.c | 32 +++++++++++++++++++++++++++++++- > 1 file changed, 31 insertions(+), 1 deletion(-) > > diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c > index 1d326ecf17..c2ea82770e 100644 > --- a/drivers/pinctrl/pinctrl-stmfx.c > +++ b/drivers/pinctrl/pinctrl-stmfx.c > @@ -358,6 +358,34 @@ static const char *stmfx_pinctrl_get_pin_name(struct udevice *dev, > return pin_name; > } > > +static const char *stmfx_pinctrl_get_pin_conf(struct udevice *dev, > + unsigned int pin, int func) > +{ > + int pupd, type; > + > + type = stmfx_conf_get_type(dev, pin); > + if (type < 0) > + return ""; > + > + if (func == GPIOF_OUTPUT) { > + if (type) > + return "drive-open-drain"; > + else > + return ""; /* default: push-pull*/ > + } > + if (!type) > + return ""; /* default: bias-disable*/ > + > + pupd = stmfx_conf_get_pupd(dev, pin); > + if (pupd < 0) > + return ""; > + > + if (pupd) > + return "bias-pull-up"; > + else > + return "bias-pull-down"; > +} > + > static int stmfx_pinctrl_get_pin_muxing(struct udevice *dev, > unsigned int selector, > char *buf, int size) > @@ -369,7 +397,9 @@ static int stmfx_pinctrl_get_pin_muxing(struct udevice *dev, > if (func < 0) > return func; > > - snprintf(buf, size, "%s", func == GPIOF_INPUT ? "input" : "output"); > + snprintf(buf, size, "%s ", func == GPIOF_INPUT ? "input" : "output"); > + > + strncat(buf, stmfx_pinctrl_get_pin_conf(dev, selector, func), size); > > return 0; > } Reviewed-by: Patrice Chotard Thanks