[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1640162489-7847-2-git-send-email-quic_manafm@quicinc.com>
Date: Wed, 22 Dec 2021 14:11:29 +0530
From: Manaf Meethalavalappu Pallikunhi <quic_manafm@...cinc.com>
To: Sebastian Reichel <sre@...nel.org>
CC: <linux-pm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
David Collins <quic_collinsd@...cinc.com>,
Subbaraman Narayanamurthy <quic_subbaram@...cinc.com>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
"thara . gopinath @ linaro . org" <thara.gopinath@...aro.org>,
"Manaf Meethalavalappu Pallikunhi" <quic_manafm@...cinc.com>
Subject: [PATCH v4 2/2] power_supply: Use of-thermal cdev registration API
With thermal frameworks of-thermal interface, thermal zone parameters can
be defined in devicetree. This includes cooling device mitigation levels
for a thermal zone. To take advantage of this, cooling device should use
the thermal_of_cooling_device_register API to register a cooling device.
Use thermal_of_cooling_device_register API to register the power supply
cooling device. This enables power supply cooling device be included in the
thermal zone parameter in devicetree.
Signed-off-by: Manaf Meethalavalappu Pallikunhi <quic_manafm@...cinc.com>
---
drivers/power/supply/power_supply_core.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index ef6f290..f42031c 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -1134,9 +1134,15 @@ static int psy_register_cooler(struct power_supply *psy)
for (i = 0; i < psy->desc->num_properties; i++) {
if (psy->desc->properties[i] ==
POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT) {
- psy->tcd = thermal_cooling_device_register(
- (char *)psy->desc->name,
- psy, &psy_tcd_ops);
+ if (psy->dev.parent)
+ psy->tcd = thermal_of_cooling_device_register(
+ dev_of_node(psy->dev.parent),
+ (char *)psy->desc->name,
+ psy, &psy_tcd_ops);
+ else
+ psy->tcd = thermal_cooling_device_register(
+ (char *)psy->desc->name,
+ psy, &psy_tcd_ops);
return PTR_ERR_OR_ZERO(psy->tcd);
}
}
Powered by blists - more mailing lists