Skip to content

Commit d6cca76

Browse files
stephan-ghsre
authored andcommitted
power: supply: qcom_battmgr: Ignore extra __le32 in info payload
Some newer ADSP firmware versions on X1E80100 report an extra __le32 at the end of the battery information request payload, causing qcom_battmgr to fail to initialize. Adjust the check to ignore the extra field in the info payload so we can support both old and newer firmware versions. Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org> Tested-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20240712-x1e80100-battmgr-v1-1-a253d767f493@linaro.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent bf9d5cb commit d6cca76

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/power/supply/qcom_battmgr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,9 @@ static void qcom_battmgr_sc8280xp_callback(struct qcom_battmgr *battmgr,
10071007
battmgr->error = 0;
10081008
break;
10091009
case BATTMGR_BAT_INFO:
1010-
if (payload_len != sizeof(resp->info)) {
1010+
/* some firmware versions report an extra __le32 at the end of the payload */
1011+
if (payload_len != sizeof(resp->info) &&
1012+
payload_len != (sizeof(resp->info) + sizeof(__le32))) {
10111013
dev_warn(battmgr->dev,
10121014
"invalid payload length for battery information request: %zd\n",
10131015
payload_len);

0 commit comments

Comments
 (0)