diff options
author | Patrice Chotard <patrice.chotard@st.com> | 2018-10-24 14:10:14 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-11-16 16:51:55 -0500 |
commit | 8bbb5b20852aa81024eb7b2dcc3eb58275e83bb0 (patch) | |
tree | abb664eb3cff6672d0496f0304866e33d362f98d /drivers/pinctrl/pinctrl-uclass.c | |
parent | f55a0c0a20cad56440ebe9a9b2999f21ae00f61a (diff) |
dm: pinctrl: Add pinctrl_get_pin_name and pinctrl_get_pins_count
Add pinctrl_get_pin_name() and pinctrl_get_pins_count() methods
to obtain pin's name and pin's muxing given a pin reference.
This will be used by the new pinmux command.
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-uclass.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-uclass.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c index 3833dd2324..6db0445067 100644 --- a/drivers/pinctrl/pinctrl-uclass.c +++ b/drivers/pinctrl/pinctrl-uclass.c @@ -249,6 +249,29 @@ int pinctrl_get_gpio_mux(struct udevice *dev, int banknum, int index) return ops->get_gpio_mux(dev, banknum, index); } +int pinctrl_get_pins_count(struct udevice *dev) +{ + struct pinctrl_ops *ops = pinctrl_get_ops(dev); + + if (!ops->get_pins_count) + return -ENOSYS; + + return ops->get_pins_count(dev); +} + +int pinctrl_get_pin_name(struct udevice *dev, int selector, char *buf, + int size) +{ + struct pinctrl_ops *ops = pinctrl_get_ops(dev); + + if (!ops->get_pin_name) + return -ENOSYS; + + snprintf(buf, size, ops->get_pin_name(dev, selector)); + + return 0; +} + int pinctrl_get_pin_muxing(struct udevice *dev, int selector, char *buf, int size) { |