From: Manaf Meethalavalappu Pallikunhi <quic_manafm@quicinc.com>
To: Sebastian Reichel <sre@kernel.org>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<gregkh@google.com>,
Subbaraman Narayanamurthy <quic_subbaram@quicinc.com>,
Manaf Meethalavalappu Pallikunhi <quic_manafm@quicinc.com>
Subject: [RESEND 2/2] power_supply: Use of-thermal cdev registration API
Date: Wed, 1 Jun 2022 00:00:54 +0530 [thread overview]
Message-ID: <20220531183054.6476-2-quic_manafm@quicinc.com> (raw)
In-Reply-To: <20220531183054.6476-1-quic_manafm@quicinc.com>
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>
---
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 74623c4977db..4593450920a4 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -1157,9 +1157,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);
}
}
next prev parent reply other threads:[~2022-05-31 18:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-31 18:30 [RESEND 1/2] power_supply: Register cooling device outside of probe Manaf Meethalavalappu Pallikunhi
2022-05-31 18:30 ` Manaf Meethalavalappu Pallikunhi [this message]
2022-06-09 22:17 ` [RESEND 2/2] power_supply: Use of-thermal cdev registration API Sebastian Reichel
2022-06-09 22:12 ` [RESEND 1/2] power_supply: Register cooling device outside of probe Sebastian Reichel
2023-02-27 21:46 ` Subbaraman Narayanamurthy
2023-02-28 0:23 ` Sebastian Reichel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220531183054.6476-2-quic_manafm@quicinc.com \
--to=quic_manafm@quicinc.com \
--cc=gregkh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=quic_subbaram@quicinc.com \
--cc=sre@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®