> The MT6365 device tree lists mediatek,mt6359 as a fallback, but slave
> selection compares only the first compatible string. Consequently the
> wrapper reports that no PMIC slave was found even though its existing
> MT6359 support matches the node.
>
> Use ofnode_device_is_compatible() to consider the full compatible list,
> as the regulator-binding path already does. This allows the Genio 510
> and 700 USB supplies to be resolved without changing the device tree's
> PMIC identity.
>
> Signed-off-by: Carlo Caione <[email protected]>
>
> diff --git a/drivers/power/pmic/mtk-pwrap.c b/drivers/power/pmic/mtk-pwrap.c
> index 468af1fba04..2e206207136 100644
> --- a/drivers/power/pmic/mtk-pwrap.c
> +++ b/drivers/power/pmic/mtk-pwrap.c
> @@ -692,7 +692,7 @@ static int mtk_pwrap_find_slave(const struct
> pwrap_slv_type **slave, ofnode pmic
> }
>
> while (of_match->compatible) {
> - if (!strcmp(of_match->compatible, pmic_name)) {
> + if (ofnode_device_is_compatible(pmic_node,
> of_match->compatible)) {
> *slave = (struct pwrap_slv_type *)of_match->data;
Hi Carlo,
With this change, the pmic_name lookup at the top of the function can be
dropped:
pmic_name = ofnode_get_property(pmic_node, "compatible", NULL);
if (!pmic_name) {
log_err("%s: missing compatible property\n", __func__);
return -EINVAL;
}
pmic_name is now only used to check that the compatible property exists,
and ofnode_device_is_compatible() already handles that case: it returns
false and we end up returning -ENOENT. The pmic_name declaration can be
dropped as well.
Also the "REVISIT" comment above the mediatek,mt6366 compatible entry in
mtk_pmic_ids can be reworded: this patch fixes half of the issue (the
limitation of ofnode_get_property())
Cheers
--
Julien Stephan <[email protected]>