[RFC PATCH v2 0/3] Add Xiaomi 12 Lite 5G (taoyao) battery support

user.email posted 3 patches 1 month, 1 week ago
There is a newer version of this series
.../bindings/soc/qcom/qcom,pmic-glink.yaml    |  5 ++
.../boot/dts/qcom/sm7325-xiaomi-taoyao.dts    |  3 +-
drivers/power/supply/qcom_battmgr.c           | 86 ++++++++++++++++++-
3 files changed, 89 insertions(+), 5 deletions(-)
[RFC PATCH v2 0/3] Add Xiaomi 12 Lite 5G (taoyao) battery support
Posted by user.email 1 month, 1 week ago
From: Stanislav Zaikin <zstaseg@gmail.com>

Xiaomi 12 Lite 5G (taoyao) has an additional property with ID 12 that
breaks the parsing in qcom_battmgr. Fix that by introducing separate
maps for lookups properties in both directions.

The other approach that I tried is manual shifting properties:

+	if (battmgr->variant == QCOM_BATTMGR_TAOYAO && prop > BATT_CHG_CTRL_LIM_MAX)
+		prop++;
...
+		if (battmgr->variant == QCOM_BATTMGR_TAOYAO && property > BATT_CHG_CTRL_LIM_MAX + 1)
+			property--;

But I found that more obscure.

Will be happy to switch if the maintainers prefer this one.

Changes in v2:
- Keep the qcom,sm7325-pmic-glink SoC fallback in the compatible chain
  of the taoyao pmic-glink node (review feedback, patch #1 and #3)

Stanislav Zaikin (3):
  dt-bindings: soc: qcom: add xiaomi,taoyao-pmic-glink compatible
  power: supply: qcom_battmgr: add Xiaomi taoyao support
  arm64: dts: qcom: sm7325-xiaomi-taoyao: switch to device-specific
    pmic-glink compatible

 .../bindings/soc/qcom/qcom,pmic-glink.yaml    |  5 ++
 .../boot/dts/qcom/sm7325-xiaomi-taoyao.dts    |  3 +-
 drivers/power/supply/qcom_battmgr.c           | 86 ++++++++++++++++++-
 3 files changed, 89 insertions(+), 5 deletions(-)

-- 
2.53.0