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>
This commit is contained in:
Vincent Cloutier
2026-07-26 21:13:00 -04:00
committed by Sebastian Reichel
parent c1eb5905fd
commit f05e30fd2f

View File

@@ -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