[PATCH v2 01/11] pinctrl: scmi: send the drive strength in microamperes

Geert Uytterhoeven geert at linux-m68k.org
Tue Nov 17 06:35:05 PST 2026


Hi Clément,

On Fri, 13 Nov 2026 at 16:02, Clément Le Goffic <clegoffic at baylibre.com> wrote:
> SCMI gives the drive strength in microamperes, but
> PIN_CONFIG_DRIVE_STRENGTH is in milliamperes and was sent unchanged.
> Convert it on set and on get. It is the only unit that differs: the
> debounce is in microseconds and the pull resistances in ohms on both
> sides, and every other value is a flag or implementation defined.
>
> Fixes: eb524cb651b7 ("pinctrl: Implementation of the generic scmi-pinctrl driver")
> Reviewed-by: Cristian Marussi <cristian.marussi at arm.com>
> Signed-off-by: Clément Le Goffic <clegoffic at baylibre.com>

Thanks for your patch, which is now commit cc2f90768e971bcc ("pinctrl:
scmi: send the drive strength in microamperes") in pinctrl/for-next.

> --- a/drivers/pinctrl/pinctrl-scmi.c
> +++ b/drivers/pinctrl/pinctrl-scmi.c
> @@ -14,6 +14,7 @@
>  #include <linux/scmi_protocol.h>
>  #include <linux/slab.h>
>  #include <linux/types.h>
> +#include <linux/units.h>
>
>  #include <linux/pinctrl/machine.h>
>  #include <linux/pinctrl/pinconf.h>
> @@ -155,6 +156,14 @@ static int pinctrl_scmi_map_pinconf_type(enum pin_config_param param,
>         return 0;
>  }
>
> +static u32 pinctrl_scmi_map_pinconf_arg_get(enum pin_config_param param, u32 value)
> +{
> +       if (param == PIN_CONFIG_DRIVE_STRENGTH)
> +               return value / MILLI;

Does this need rounding?

While MILLI = 1000UL is correct from a numerical point of view,
it is not correct from a semantical point of view.

<linux/units.h> has:

    #define MICROWATT_PER_MILLIWATT 1000UL

In the absence of a generic conversion value, "(MICRO / MILLI)" might
be better.

> +
> +       return value;
> +}
> +
>  static int pinctrl_scmi_map_pinconf_type_get(enum pin_config_param param,
>                                              enum scmi_pinctrl_conf_type *type)
>  {
> @@ -167,13 +176,17 @@ static int pinctrl_scmi_map_pinconf_type_get(enum pin_config_param param,
>  }
>
>  static int pinctrl_scmi_map_pinconf_type_set(enum pin_config_param param,
> -                                            enum scmi_pinctrl_conf_type *type)
> +                                            enum scmi_pinctrl_conf_type *type,
> +                                            u32 *arg)
>  {
>         if (param == PIN_CONFIG_LEVEL) {
>                 *type = SCMI_PIN_OUTPUT_VALUE;
>                 return 0;
>         }
>
> +       if (param == PIN_CONFIG_DRIVE_STRENGTH)
> +               *arg *= MILLI;

What happens if the result differs from the original value in µA,
due to truncation or rounding?

Likewise about the use of MILLI.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



More information about the linux-arm-kernel mailing list