Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933101AbdGKOXT (ORCPT ); Tue, 11 Jul 2017 10:23:19 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:37296 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932651AbdGKOXR (ORCPT ); Tue, 11 Jul 2017 10:23:17 -0400 Date: Tue, 11 Jul 2017 16:23:09 +0200 From: Ladislav Michl To: Dragos Bogdan Cc: Sebastian Reichel , Rob Herring , Mark Rutland , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] power: supply: ltc2941-battery-gauge: Add LTC2944 support Message-ID: <20170711142309.2kumpn4mcbzp6ebo@lenoch> References: <20170711140509.31346-1-dragos.bogdan@analog.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170711140509.31346-1-dragos.bogdan@analog.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3612 Lines: 80 On Tue, Jul 11, 2017 at 05:05:09PM +0300, Dragos Bogdan wrote: > The only difference between the already supported LTC2943 and LTC2944 is the > operating range (3.6V - 20V compared to 3.6V - 60V). So it is using different voltage and current conversion, but patch does not handle it at all resulting into incorrect values being reported. > Signed-off-by: Dragos Bogdan > --- > Documentation/devicetree/bindings/power/supply/ltc2941.txt | 10 +++++----- > drivers/power/supply/ltc2941-battery-gauge.c | 11 ++++++++--- > 2 files changed, 13 insertions(+), 8 deletions(-) > > diff --git a/Documentation/devicetree/bindings/power/supply/ltc2941.txt b/Documentation/devicetree/bindings/power/supply/ltc2941.txt > index a9d7aa60558b..ed0f02846d10 100644 > --- a/Documentation/devicetree/bindings/power/supply/ltc2941.txt > +++ b/Documentation/devicetree/bindings/power/supply/ltc2941.txt > @@ -1,9 +1,9 @@ > -binding for LTC2941 and LTC2943 battery gauges > +binding for LTC2941, LTC2943 and LTC2944 battery gauges > > -Both the LTC2941 and LTC2943 measure battery capacity. > -The LTC2943 is compatible with the LTC2941, it adds voltage and > -temperature monitoring, and uses a slightly different conversion > -formula for the charge counter. > +All the LTC2941, LTC2943 and LTC2944 measure battery capacity. > +The LTC2943 and LTC2944 are compatible with the LTC2941, they add voltage and > +temperature monitoring, and use a slightly different conversion formula for the > +charge counter. > > Required properties: > - compatible: Should contain "lltc,ltc2941" or "lltc,ltc2943" which also > diff --git a/drivers/power/supply/ltc2941-battery-gauge.c b/drivers/power/supply/ltc2941-battery-gauge.c > index 7efb908f4451..48af7b6fb704 100644 > --- a/drivers/power/supply/ltc2941-battery-gauge.c > +++ b/drivers/power/supply/ltc2941-battery-gauge.c > @@ -1,5 +1,5 @@ > /* > - * I2C client/driver for the Linear Technology LTC2941 and LTC2943 > + * I2C client/driver for the Linear Technology LTC2941, LTC2943 and LTC2944 > * Battery Gas Gauge IC > * > * Copyright (C) 2014 Topic Embedded Systems > @@ -145,7 +145,7 @@ static int ltc294x_reset(const struct ltc294x_info *info, int prescaler_exp) > > control = LTC294X_REG_CONTROL_PRESCALER_SET(prescaler_exp) | > LTC294X_REG_CONTROL_ALCC_CONFIG_DISABLED; > - /* Put the 2943 into "monitor" mode, so it measures every 10 sec */ > + /* Put the 2943/4 into "monitor" mode, so it measures every 10 sec */ > if (info->num_regs == LTC2943_NUM_REGS) > control |= LTC2943_REG_CONTROL_MODE_SCAN; > > @@ -494,6 +494,7 @@ static SIMPLE_DEV_PM_OPS(ltc294x_pm_ops, ltc294x_suspend, ltc294x_resume); > static const struct i2c_device_id ltc294x_i2c_id[] = { > {"ltc2941", LTC2941_NUM_REGS}, > {"ltc2943", LTC2943_NUM_REGS}, > + {"ltc2944", LTC2943_NUM_REGS}, > { }, > }; > MODULE_DEVICE_TABLE(i2c, ltc294x_i2c_id); > @@ -507,6 +508,10 @@ static const struct of_device_id ltc294x_i2c_of_match[] = { > .compatible = "lltc,ltc2943", > .data = (void *)LTC2943_NUM_REGS > }, > + { > + .compatible = "lltc,ltc2944", > + .data = (void *)LTC2943_NUM_REGS > + }, > { }, > }; > MODULE_DEVICE_TABLE(of, ltc294x_i2c_of_match); > @@ -525,5 +530,5 @@ module_i2c_driver(ltc294x_driver); > > MODULE_AUTHOR("Auryn Verwegen, Topic Embedded Systems"); > MODULE_AUTHOR("Mike Looijmans, Topic Embedded Products"); > -MODULE_DESCRIPTION("LTC2941/LTC2943 Battery Gas Gauge IC driver"); > +MODULE_DESCRIPTION("LTC2941/LTC2943/LTC2944 Battery Gas Gauge IC driver"); > MODULE_LICENSE("GPL"); > -- > 2.11.0