summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Cloutier <vincent@cloutier.co>2026-07-26 21:13:00 -0400
committerSebastian Reichel <sebastian.reichel@collabora.com>2026-07-27 20:32:38 +0200
commitf05e30fd2ffd962e6f30dc0abd528b4182ecdf4b (patch)
treeeeb13b85e191fb2b0b834e2878d49bcfb933ace4
parentc1eb5905fdce35a66173658a93819641e5220c18 (diff)
downloadlinux-next-f05e30fd2ffd962e6f30dc0abd528b4182ecdf4b.tar.gz
linux-next-f05e30fd2ffd962e6f30dc0abd528b4182ecdf4b.zip
power: supply: max17042_battery: Separate MAX17055 initialization
MAX17055 uses ModelCfg.Refresh instead of the characterization-data flow used by the other supported gauges. Move its existing initialization steps into a dedicated helper without changing behavior. This isolates the chip-specific path for subsequent EZ Config changes. Assisted-by: OpenCode:gpt-5.6-sol Signed-off-by: Vincent Cloutier <vincent@cloutier.co> Link: https://patch.msgid.link/20260727011319.621794-3-vincent.cloutier@icloud.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-rw-r--r--drivers/power/supply/max17042_battery.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
index 581699335a5f..16b7ef52419d 100644
--- a/drivers/power/supply/max17042_battery.c
+++ b/drivers/power/supply/max17042_battery.c
@@ -848,18 +848,24 @@ static inline void max17042_override_por_values(struct max17042_chip *chip)
max17042_override_por(map, MAX17055_ModelCfg, config->model_cfg);
}
+static void max17055_init_chip(struct max17042_chip *chip)
+{
+ max17042_override_por_values(chip);
+
+ regmap_write_bits(chip->regmap, MAX17055_ModelCfg,
+ MAX17055_MODELCFG_REFRESH_BIT,
+ MAX17055_MODELCFG_REFRESH_BIT);
+}
+
static int max17042_init_chip(struct max17042_chip *chip)
{
struct regmap *map = chip->regmap;
int ret;
- max17042_override_por_values(chip);
-
- if (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17055) {
- regmap_write_bits(map, MAX17055_ModelCfg,
- MAX17055_MODELCFG_REFRESH_BIT,
- MAX17055_MODELCFG_REFRESH_BIT);
- }
+ if (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17055)
+ max17055_init_chip(chip);
+ else
+ max17042_override_por_values(chip);
/* After Power up, the MAX17042 requires 500mS in order
* to perform signal debouncing and initial SOC reporting