From: Konrad Dybcio <konradybcio@kernel.org>
To: Sebastian Reichel <sre@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Subject: [PATCH] power: supply: qcom_battmgr: Expose USB connector temperature
Date: Tue, 20 Oct 2026 15:28:08 +0200 [thread overview]
Message-ID: <20261020-topic-usb_temp-v1-1-3dbe390f9834@oss.qualcomm.com> (raw)
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
The firmware is capable of reporting the temperature of the connector.
Expose it at the USB supply.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
Tested on Kodiak/FP5
---
drivers/power/supply/qcom_battmgr.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/power/supply/qcom_battmgr.c b/drivers/power/supply/qcom_battmgr.c
index a7237ba09be1..9410a4a1387c 100644
--- a/drivers/power/supply/qcom_battmgr.c
+++ b/drivers/power/supply/qcom_battmgr.c
@@ -87,6 +87,7 @@ enum qcom_battmgr_variant {
#define USB_ADAP_TYPE 7
#define USB_MOISTURE_DET_EN 8
#define USB_MOISTURE_DET_STS 9
+#define USB_TEMP 10
#define BATTMGR_WLS_PROPERTY_GET 0x34
#define BATTMGR_WLS_PROPERTY_SET 0x35
@@ -298,6 +299,7 @@ struct qcom_battmgr_usb {
unsigned int current_max;
unsigned int current_limit;
unsigned int usb_type;
+ int temperature;
};
struct qcom_battmgr_wireless {
@@ -977,6 +979,7 @@ static const u8 sm8350_usb_prop_map[] = {
[POWER_SUPPLY_PROP_CURRENT_MAX] = USB_CURR_MAX,
[POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT] = USB_INPUT_CURR_LIMIT,
[POWER_SUPPLY_PROP_USB_TYPE] = USB_TYPE,
+ [POWER_SUPPLY_PROP_TEMP] = USB_TEMP,
};
static int qcom_battmgr_usb_sm8350_update(struct qcom_battmgr *battmgr,
@@ -1037,6 +1040,9 @@ static int qcom_battmgr_usb_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_USB_TYPE:
val->intval = battmgr->usb.usb_type;
break;
+ case POWER_SUPPLY_PROP_TEMP:
+ val->intval = battmgr->usb.temperature;
+ break;
default:
return -EINVAL;
}
@@ -1074,6 +1080,7 @@ static const enum power_supply_property sm8350_usb_props[] = {
POWER_SUPPLY_PROP_CURRENT_MAX,
POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
POWER_SUPPLY_PROP_USB_TYPE,
+ POWER_SUPPLY_PROP_TEMP,
};
static const struct power_supply_desc sm8350_usb_psy_desc = {
@@ -1517,6 +1524,10 @@ static void qcom_battmgr_sm8350_callback(struct qcom_battmgr *battmgr,
case USB_TYPE:
battmgr->usb.usb_type = le32_to_cpu(resp->intval.value);
break;
+ case USB_TEMP:
+ battmgr->usb.temperature =
+ DIV_ROUND_CLOSEST((int)le32_to_cpu(resp->intval.value), 10);
+ break;
default:
dev_warn(battmgr->dev, "unknown property %#x\n", property);
break;
---
base-commit: 2efb7a11f1aa4d2dc285fe2680cca22cb9f72f64
change-id: 20261020-topic-usb_temp-3d56ecc9c658
Best regards,
--
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
reply other threads:[~2026-10-20 13:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261020-topic-usb_temp-v1-1-3dbe390f9834@oss.qualcomm.com \
--to=konradybcio@kernel.org \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--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®