[U-Boot] [PATCH] power: extend prefix match to regulator-name property

Simon Glass sjg at chromium.org
Thu Oct 12 02:07:21 UTC 2017


Hi Felix,

On 9 October 2017 at 03:04, Felix Brack <fb at ltec.ch> wrote:
>
> This patch extends pmic_bind_children prefix matching. In addition to
> the node name the property regulator-name is used while trying to match
> prefixes. This allows assigning different drivers to regulator nodes
> named regulator at 1 and regulator at 10 for example.
> Signed-off-by: Felix Brack <fb at ltec.ch>
> ---
>
>  drivers/power/pmic/pmic-uclass.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)

Can you please add a sandbox test and documentation for this?

See:

test/dm/pmic.c
doc/driver-model/pmic-framework.txt

>
> diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c
> index 64964e4..5a034f0 100644
> --- a/drivers/power/pmic/pmic-uclass.c
> +++ b/drivers/power/pmic/pmic-uclass.c
> @@ -26,6 +26,7 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent,
>         struct driver *drv;
>         struct udevice *child;
>         const char *node_name;
> +       const char *reg_name;
>         int bind_count = 0;
>         ofnode node;
>         int prefix_len;
> @@ -44,8 +45,18 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent,
>                         debug("  - compatible prefix: '%s'\n", info->prefix);
>
>                         prefix_len = strlen(info->prefix);
> -                       if (strncmp(info->prefix, node_name, prefix_len))
> -                               continue;
> +                       if (strncmp(info->prefix, node_name, prefix_len)) {
> +                               reg_name = ofnode_read_string(node,
> +                                                             "regulator-name");
> +                               if (reg_name) {
> +                                       if (strncmp(info->prefix, reg_name,
> +                                                   prefix_len)) {
> +                                               continue;
> +                                       }
> +                               } else {
> +                                       continue;
> +                               }
> +                       }
>
>                         drv = lists_driver_lookup_name(info->driver);
>                         if (!drv) {
> --
> 2.7.4
>

Regards,
Simon


More information about the U-Boot mailing list