Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ properties:
- items:
- enum:
- qcom,sm7325-pmic-glink
- xiaomi,taoyao-pmic-glink
- const: qcom,qcm6490-pmic-glink
- const: qcom,pmic-glink
- items:
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/boot/dts/qcom/sm7325-xiaomi-taoyao.dts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
};

pmic-glink {
compatible = "qcom,sm7325-pmic-glink",
compatible = "xiaomi,taoyao-pmic-glink",
"qcom,qcm6490-pmic-glink",
"qcom,pmic-glink";

Expand Down
11 changes: 11 additions & 0 deletions drivers/power/supply/qcom_battmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ enum qcom_battmgr_variant {
QCOM_BATTMGR_SM8350,
QCOM_BATTMGR_SM8550,
QCOM_BATTMGR_X1E80100,
QCOM_BATTMGR_SM8350_TAOYAO,
};

#define BATTMGR_BAT_STATUS 0x1
Expand Down Expand Up @@ -462,6 +463,10 @@ static int qcom_battmgr_bat_sm8350_update(struct qcom_battmgr *battmgr,

prop = sm8350_bat_prop_map[psp];

// taoyao battery has an additional property between BATT_CHG_CTRL_LIM_MAX and BATT_TEMP
if (battmgr->variant == QCOM_BATTMGR_SM8350_TAOYAO && prop > BATT_CHG_CTRL_LIM_MAX)
prop++;

mutex_lock(&battmgr->lock);
ret = qcom_battmgr_request_property(battmgr, BATTMGR_BAT_PROPERTY_GET, prop, 0);
mutex_unlock(&battmgr->lock);
Expand Down Expand Up @@ -1390,6 +1395,11 @@ static void qcom_battmgr_sm8350_callback(struct qcom_battmgr *battmgr,
switch (opcode) {
case BATTMGR_BAT_PROPERTY_GET:
property = le32_to_cpu(resp->intval.property);

// taoyao battery has an additional property between BATT_CHG_CTRL_LIM_MAX and BATT_TEMP
if (battmgr->variant == QCOM_BATTMGR_SM8350_TAOYAO && property > BATT_CHG_CTRL_LIM_MAX + 1)
property--;

if (property == BATT_MODEL_NAME) {
if (payload_len != sizeof(resp->strval)) {
dev_warn(battmgr->dev,
Expand Down Expand Up @@ -1624,6 +1634,7 @@ static const struct of_device_id qcom_battmgr_of_variants[] = {
{ .compatible = "qcom,sc8280xp-pmic-glink", .data = (void *)QCOM_BATTMGR_SC8280XP },
{ .compatible = "qcom,sm8550-pmic-glink", .data = (void *)QCOM_BATTMGR_SM8550 },
{ .compatible = "qcom,x1e80100-pmic-glink", .data = (void *)QCOM_BATTMGR_X1E80100 },
{ .compatible = "xiaomi,taoyao-pmic-glink", .data = (void *)QCOM_BATTMGR_SM8350_TAOYAO },
/* Unmatched devices falls back to QCOM_BATTMGR_SM8350 */
{}
};
Expand Down