From 2ac87efc2cbebbdc68ccb873847a84cbdbd85e64 Mon Sep 17 00:00:00 2001 From: Rakesh Kota Date: Tue, 18 Jul 2023 12:28:06 +0530 Subject: [PATCH] regulator: rpm-smd: Update sync_state call Due to below upstream change, the sync_state functionality of our RPM-SMD regulator driver has been broken: Upstream commit 3a2dbc510c43 ("driver core: fw_devlink: Don't purge child fwnode's consumer links") With this change, consumers of the child node (rpm-smd regulator) are now marked as consumers of the parent node (rpm-smd resource). Since those consumers use the child node's phandle, but sync_state is defined for the parent node, sync_state will not get called as expected when the child node's last consumer is probed, which could cause issues for regulator clients depending on proxy votes. Define sync_state call for proxy votes under regulator device rather than resource to ensure it gets called and also register regulator device for proxy voting rather than regulator resource. Change-Id: Ic9943585657190d8808f4b8608dd82df228d381e Signed-off-by: Rakesh Kota --- drivers/regulator/rpm-smd-regulator.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/regulator/rpm-smd-regulator.c b/drivers/regulator/rpm-smd-regulator.c index b512f2ebaa9b..a9001607e666 100644 --- a/drivers/regulator/rpm-smd-regulator.c +++ b/drivers/regulator/rpm-smd-regulator.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2012-2015, 2018-2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved. */ #define pr_fmt(fmt) "%s: " fmt, __func__ @@ -1807,10 +1807,9 @@ static int rpm_vreg_device_probe(struct platform_device *pdev) goto fail_remove_from_list; } - rc = devm_regulator_proxy_consumer_register(pdev->dev.parent, node); + rc = devm_regulator_proxy_consumer_register(dev, node); if (rc) - vreg_err(reg, "failed to register proxy consumer, rc=%d\n", - rc); + vreg_err(reg, "failed to register proxy consumer, rc=%d\n", rc); platform_set_drvdata(pdev, reg); @@ -2102,6 +2101,7 @@ static struct platform_driver rpm_vreg_device_driver = { .driver = { .name = "qcom,rpm-smd-regulator", .of_match_table = rpm_vreg_match_table_device, + .sync_state = regulator_proxy_consumer_sync_state, }, }; @@ -2111,7 +2111,6 @@ static struct platform_driver rpm_vreg_resource_driver = { .driver = { .name = "qcom,rpm-smd-regulator-resource", .of_match_table = rpm_vreg_match_table_resource, - .sync_state = regulator_proxy_consumer_sync_state, }, };