[U-Boot] [PATCH v3 1/9] dm: pinctrl: Add get_pin_muxing() ops
Simon Glass
sjg at chromium.org
Fri Oct 19 03:28:00 UTC 2018
Hi Patrice,
On 9 October 2018 at 07:31, Patrice Chotard <patrice.chotard at st.com> wrote:
> Add get_pin_muxing() which allows to display the muxing
> of a given pin belonging to a pin-controller.
>
> Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
> ---
>
> Changes in v3:
> - Replace const char **buf parameter by char *buf, int size parameters
> for pinctrl_get_pin_muxing()
>
> Changes in v2:
> - Replace pinmux_show ops which displayed the complete pin-controller
> muxing by get_pin_muxing ops which displays the muxing of one pin
>
> drivers/pinctrl/pinctrl-uclass.c | 13 +++++++++++++
> include/dm/pinctrl.h | 32 ++++++++++++++++++++++++++++++++
> 2 files changed, 45 insertions(+)
Reviewed-by: Simon Glass <sjg at chromium.org>
But please see below.
>
> diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
> index c38bb212ed74..cd2ca4e4950e 100644
> --- a/drivers/pinctrl/pinctrl-uclass.c
> +++ b/drivers/pinctrl/pinctrl-uclass.c
> @@ -249,6 +249,19 @@ int pinctrl_get_gpio_mux(struct udevice *dev, int banknum, int index)
> return ops->get_gpio_mux(dev, banknum, index);
> }
>
> +int pinctrl_get_pin_muxing(struct udevice *dev, int selector, char *buf,
> + int size)
> +{
> + struct pinctrl_ops *ops = pinctrl_get_ops(dev);
> +
> + if (!ops->get_pin_muxing)
> + return -ENOSYS;
> +
> + snprintf(buf, size, ops->get_pin_muxing(dev, selector));
I wonder if it would be easy to return -ENOSPC if the string is too long?
Regards,
Simon
More information about the U-Boot
mailing list