Commit d6cca763 authored by Stephan Gerhold's avatar Stephan Gerhold Committed by Sebastian Reichel

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: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarStephan Gerhold <stephan.gerhold@linaro.org>
Tested-by: default avatarJohan Hovold <johan+linaro@kernel.org>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20240712-x1e80100-battmgr-v1-1-a253d767f493@linaro.orgSigned-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent bf9d5cb5
......@@ -1007,7 +1007,9 @@ static void qcom_battmgr_sc8280xp_callback(struct qcom_battmgr *battmgr,
battmgr->error = 0;
break;
case BATTMGR_BAT_INFO:
if (payload_len != sizeof(resp->info)) {
/* some firmware versions report an extra __le32 at the end of the payload */
if (payload_len != sizeof(resp->info) &&
payload_len != (sizeof(resp->info) + sizeof(__le32))) {
dev_warn(battmgr->dev,
"invalid payload length for battery information request: %zd\n",
payload_len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment