diff options
author | Angus Ainslie (Purism) <angus@akkea.ca> | 2019-12-14 07:27:54 -0800 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2019-12-19 01:07:53 +0100 |
commit | bc90705bbb570b2507353ba10d6b6788cfb119b1 (patch) | |
tree | 63a325ac9f648200ae1e4a3551560d5d75f083f0 /drivers/power | |
parent | 47a34db3d5d2c04592f2b800b8ba39bcbf48e366 (diff) | |
download | linux-stable-bc90705bbb570b2507353ba10d6b6788cfb119b1.tar.gz linux-stable-bc90705bbb570b2507353ba10d6b6788cfb119b1.tar.bz2 linux-stable-bc90705bbb570b2507353ba10d6b6788cfb119b1.zip |
power: supply: max17042: add MAX17055 support
The MAX17055 is very similar to the MAX17042 so extend the driver.
Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/max17042_battery.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c index 0dfad2cf13fe..69ec4295d55d 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -282,6 +282,8 @@ static int max17042_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: if (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17042) ret = regmap_read(map, MAX17042_V_empty, &data); + else if (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17055) + ret = regmap_read(map, MAX17055_V_empty, &data); else ret = regmap_read(map, MAX17047_V_empty, &data); if (ret < 0) @@ -627,7 +629,8 @@ static void max17042_write_config_regs(struct max17042_chip *chip) config->filter_cfg); regmap_write(map, MAX17042_RelaxCFG, config->relax_cfg); if (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17047 || - chip->chip_type == MAXIM_DEVICE_TYPE_MAX17050) + chip->chip_type == MAXIM_DEVICE_TYPE_MAX17050 || + chip->chip_type == MAXIM_DEVICE_TYPE_MAX17055) regmap_write(map, MAX17047_FullSOCThr, config->full_soc_thresh); } @@ -758,6 +761,8 @@ static inline void max17042_override_por_values(struct max17042_chip *chip) if (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17042) max17042_override_por(map, MAX17042_V_empty, config->vempty); + if (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17055) + max17042_override_por(map, MAX17055_V_empty, config->vempty); else max17042_override_por(map, MAX17047_V_empty, config->vempty); max17042_override_por(map, MAX17042_TempNom, config->temp_nom); @@ -765,7 +770,10 @@ static inline void max17042_override_por_values(struct max17042_chip *chip) max17042_override_por(map, MAX17042_FCTC, config->fctc); max17042_override_por(map, MAX17042_RCOMP0, config->rcomp0); max17042_override_por(map, MAX17042_TempCo, config->tcompc0); - if (chip->chip_type) { + if (chip->chip_type && + ((chip->chip_type == MAXIM_DEVICE_TYPE_MAX17042) || + (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17047) || + (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17050))) { max17042_override_por(map, MAX17042_EmptyTempCo, config->empty_tempco); max17042_override_por(map, MAX17042_K_empty0, @@ -929,7 +937,8 @@ max17042_get_default_pdata(struct max17042_chip *chip) if (!pdata) return pdata; - if (chip->chip_type != MAXIM_DEVICE_TYPE_MAX17042) { + if ((chip->chip_type == MAXIM_DEVICE_TYPE_MAX17047) || + (chip->chip_type == MAXIM_DEVICE_TYPE_MAX17050)) { pdata->init_data = max17047_default_pdata_init_regs; pdata->num_init_data = ARRAY_SIZE(max17047_default_pdata_init_regs); @@ -1167,6 +1176,7 @@ static const struct of_device_id max17042_dt_match[] = { { .compatible = "maxim,max17042" }, { .compatible = "maxim,max17047" }, { .compatible = "maxim,max17050" }, + { .compatible = "maxim,max17055" }, { }, }; MODULE_DEVICE_TABLE(of, max17042_dt_match); @@ -1176,6 +1186,7 @@ static const struct i2c_device_id max17042_id[] = { { "max17042", MAXIM_DEVICE_TYPE_MAX17042 }, { "max17047", MAXIM_DEVICE_TYPE_MAX17047 }, { "max17050", MAXIM_DEVICE_TYPE_MAX17050 }, + { "max17055", MAXIM_DEVICE_TYPE_MAX17055 }, { } }; MODULE_DEVICE_TABLE(i2c, max17042_id); |