@@ -672,9 +672,8 @@ static const struct udevice_id mtk_pmic_ids[] = {
{ .compatible = "mediatek,mt6357", .data = (ulong)&pmic_mt6357 },
{ .compatible = "mediatek,mt6359", .data = (ulong)&pmic_mt6359 },
/*
- * REVISIT: Cooresponding regulator driver only supports MT6366 for
- * now. We can change this to mediatek,mt6358 when the regulator driver
- * is updated, but will also have to change ofnode_get_property() below.
+ * REVISIT: The regulator driver only supports MT6366 for now.
+ * Change this to mediatek,mt6358 when MT6358 support is added.
*/
{ .compatible = "mediatek,mt6366", .data = (ulong)&pmic_mt6358 },
{ }
@@ -683,16 +682,9 @@ static const struct udevice_id mtk_pmic_ids[] = {
static int mtk_pwrap_find_slave(const struct pwrap_slv_type **slave, ofnode pmic_node)
{
const struct udevice_id *of_match = mtk_pmic_ids;
- const char *pmic_name;
-
- pmic_name = ofnode_get_property(pmic_node, "compatible", NULL);
- if (!pmic_name) {
- log_err("%s: missing compatible property\n", __func__);
- return -EINVAL;
- }
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;
return 0;
}
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 <ccaione@baylibre.com> --- drivers/power/pmic/mtk-pwrap.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)