FROMLIST: 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@quicinc.com>

Bug: 211709650
Link: https://lore.kernel.org/linux-pm/1640162489-7847-2-git-send-email-quic_manafm@quicinc.com/
Change-Id: Ie0d527543adb8590ec52df96bf3e4d0f1f022d0a
Signed-off-by: Manaf Meethalavalappu Pallikunhi <quic_manafm@quicinc.com>
(cherry picked from commit 2a2327c4e8ac335069586354b280031105b9980e)
This commit is contained in:
Manaf Meethalavalappu Pallikunhi 2021-12-14 11:49:26 +05:30 committed by Todd Kjos
parent 291dfda577
commit 149474c544
1 changed files with 9 additions and 3 deletions

View File

@ -1153,9 +1153,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);
}
}