]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pinctrl: stmfx: add information on pin configuration
authorPatrick Delaunay <patrick.delaunay@st.com>
Thu, 4 Jun 2020 12:30:32 +0000 (14:30 +0200)
committerPatrick Delaunay <patrick.delaunay@st.com>
Tue, 7 Jul 2020 14:01:23 +0000 (16:01 +0200)
Add information on pin configuration used for pinmux command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
drivers/pinctrl/pinctrl-stmfx.c

index 1d326ecf17a5c7d8ed81d9fddb3b3d2aa5b67eb7..c2ea82770e6300688fe2d3e33914e46bdc527ae1 100644 (file)
@@ -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;
 }