Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752410AbdGMPYs (ORCPT ); Thu, 13 Jul 2017 11:24:48 -0400 Received: from mail-by2nam01on0087.outbound.protection.outlook.com ([104.47.34.87]:40992 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751193AbdGMPYo (ORCPT ); Thu, 13 Jul 2017 11:24:44 -0400 Authentication-Results: spf=pass (sender IP is 137.71.25.55) smtp.mailfrom=analog.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=analog.com; From: "Bogdan, Dragos" To: Ladislav Michl CC: Sebastian Reichel , Rob Herring , Mark Rutland , Mike Looijmans , "linux-pm@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2] power: supply: ltc2941-battery-gauge: Add LTC2944 support Thread-Topic: [PATCH v2] power: supply: ltc2941-battery-gauge: Add LTC2944 support Thread-Index: AQHS+l/UtbNYVP/adEazPbdqCXkHKg== Date: Thu, 13 Jul 2017 15:24:39 +0000 Message-ID: <6067964B99C6A049AA5840B6F7BB2D0ABDAACEA4@NWD2MBX5.ad.analog.com> References: <20170711160732.16170-1-dragos.bogdan@analog.com> <20170711205911.w6pp2kdaeo5iv2yo@lenoch> <20170711231156.mavruc6xsiv4gvla@lenoch> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.64.7.152] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.55;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(39860400002)(39840400002)(39450400003)(39850400002)(39410400002)(39400400002)(2980300002)(438002)(199003)(189002)(377454003)(24454002)(53546010)(8676002)(229853002)(2906002)(97756001)(575784001)(86362001)(7736002)(626005)(4326008)(55016002)(106466001)(50466002)(305945005)(54906002)(356003)(8746002)(7636002)(54356999)(110136004)(76176999)(55846006)(2900100001)(230783001)(14454004)(6246003)(50986999)(2920100001)(23726003)(478600001)(7696004)(102836003)(33656002)(6916009)(5660300001)(8936002)(72206003)(5250100002)(47776003)(189998001)(6116002)(38730400002)(3846002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR03MB3173;H:nwd2mta1.analog.com;FPR:;SPF:Pass;MLV:sfv;A:1;MX:1;LANG:en; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0bdcfbd2-f4db-4983-3899-08d4ca034882 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(8251501002)(2017030254075)(300000503095)(300135400095)(2017052603031)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY4PR03MB3173; X-MS-TrafficTypeDiagnostic: CY4PR03MB3173: X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB3173;20:FM9DF86u5nHRWJXJiFFh4aeinwlWE5BhDzckfRH6aNlpY4Em1h3NdaA4fO6HzfhrTMMavoyYy35Be2hP85qbSVmqn0t4tVfvN7JWDY585n/kbtUWI+4GbvgxyTFwYIs8tnYZQAjyD3jyyQWTraj1gFlV4XeD8LhBa9gdndQXVrENOPQGPGTzpxDXX8Vq74qlbeWbthcDa5ZwSPoz5pJId8L+YA+0SL0xvy2XbTx8M7PJkxqkM3JMFL7C66JCWqFBaTVSy2Z8BuFkE6w5TNL8zlivFBOU1YqbU/17T6bHZQnilEj9lyC8ShLrPgVa/GKswsO6pNzAkWjUeajKc5Yc9Y4V4VTio+eJJemDMJSx99eCS6i6YzcN5dSANBElEuH9tfsYR2y5dyRwvy2ySMBD6KOFf0u6WgeEXYhbM83Fr/zYQYc2n1JfL1uHjSM8X0AnMdOOYmoTwwonxJbUHWUKxuuEfm4Eotc33P0IOZTeq3IKcv30i7BE2mEhRBD/QEmo X-Exchange-Antispam-Report-Test: UriScan:(133145235818549)(278428928389397)(72170088055959)(236129657087228)(232431446821674)(48057245064654); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(13018025)(2017060910075)(8121501046)(5005006)(13016025)(3002001)(10201501046)(93006095)(93004095)(100000703101)(100105400095)(6055026)(6041248)(20161123560025)(20161123564025)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY4PR03MB3173;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY4PR03MB3173; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR03MB3173;4:7VzDw2DM/VfchARJ7ZKSBiQJ29yv1ZRe+FwDKe7Y2G?= =?us-ascii?Q?CxuHosIqwUzM0JZsLNJqYb31BCQGn8XeIsYRBjOkPM78Ye/4+CeVHC5v9uIK?= =?us-ascii?Q?5CRv3jveI29BlQgYHPmElba0oBJgjdmzFZ4QlRGK384xeAMH7pkTrqWrZ3zc?= =?us-ascii?Q?o7Ty6/zOGsaXixBf54kyIEmVFhnvJAFJYVqDnTNuZO706ZzlKi3oQFc6i+NE?= =?us-ascii?Q?TWM6drJEW0kqZMmvAebRGvqD9wnFICRMtcXmsVAxmp8HfmrqLhL/6GHkl65v?= =?us-ascii?Q?lQxdgzSe3nWFu5J8nPPGdyvszRZl4bIBxMPnEVoo9H+fCx68dfLNNrVKgP8T?= =?us-ascii?Q?Qg5fw1yTGR1mHuJ4Qs20n0YRmaBaERvBb7cL+Bi+uvRPn0jGA+UPNRtc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4?= =?us-ascii?Q?I9aiz9P8fyHcpiDqeG3IL0?= X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB3173;5:YD5I3XF7nGNZJSFX8zCHKvLVVPEfqe3XX5Z8MPK79QKkecf+LgtOE+lj1nI4rhLAeKWhVhjWSxuBXypjSj8Vm4UF/ufH0PFwXIuFAJb2I7mkKv+86QUpM4nf53Gh+YK/usH6NDU2tL/20H0wBMzpC2N8FeelL4u1mmzsg4Cwm91Ic9mzjgMVNUywzfvQvIsv1V5Rhqs2NOX1r0lghA+tXE33f+E8YBbBJijIVaOP5+N+gXw4tKugqC25YrWeKT9Pk0QXk9YPslDh/kWhFACdW/88uMWJtZyHHtpcGH04s8Wk7e1N5H+lC/86ht4ZQEA+W3Ztfgv3I/HIakO4P8NrD7YBYS8XzYXkyEwzz2yMyQj8bxBQ49woeqCrTEzJOQIpXrw5vbgba1eym2g0gFkjE+sUvNqKWj47ygzOljNVaAT0x5iKImayBlTs64l7TJwlb8rH3CcZS9xmuMCyYKVHPn8hXGZiYt8PXkVylbgB4D7jP6iEjmoDF1X+ucYhxVII;24:96zr9+8oitL759xgjejq3ykPua1Ss1Cixjy+Wi2/fZaUDG7mQeD1yiDtzUWILn12nk0dR/wETzFC/Odqnys2KZl17Ltl0YUUS1uWL/KJUOY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB3173;7:1FGEMn69bvPcnkl+N/Jrtw5cFt2iIJqxvPdd2nXSXltbsoAAhM2GwqapxDWXZsT5UhYHWov1OmDfbUTi8H4u9RCh5UG+nZOLpCcfRwshtrznXzUN7UVnv8VRUC/gIGRGmMiRNseinKjQAcB6Ijs85EKSA8lb7uvQb5o1GQz16g8tX6vKnWjn+CkP6gQXWa5saLcsJYTuJsTNu26U+n+mhr8ppK2izIbIFwXude+hP2X0s324pv6cQqMDWHCKz1TLM2CC5ad4wmAxE5I/VW2gzb5upWSIU2AD/9Ot5h33f+p4J0ytQ//khZ2EeUwyWfQulNy1z0uNVtwWY3ZhLfIrtBuBHY4JMAKifSHRJaSzwPqy0yxElj3J7Pz+3brhaCHga6S8FYZiw8aWAAoc+qkoIEUBdPuq0PDR6BUPHo01B/LbYEn5wOq3YhLjfyIT3ecXJuQOYt0LXMHcMBaiNh2hHI47oQ6VRNAXdk7Kq5xKyTdpmGLBL1Hhy8WlfFocCDJEzGxZAh7RT9z3zJ+/RdYiVVGtjv2+/BPAREqWDJ5QnZRiR8O75FPIyCVWxAd9MuptEuWMYdCYaxs6WTfEyBStVf3y1WEdixGeqAhNA+lpv3wxj/8tq93+jxWmra6SxkvFy++wFPWuFPvRvKfzmbW1p4l9uAfsQFSZsCj9CYiptSRo3WMTOs3A0SC7o4qKsEVuqoG3x8VlyvZ5xXqFFVgymQNpLVj0aj3/2QGgegRPpN1qoFidGpDbaj2TxDybmnH8CDVgZ/h+iSvdYhV8tOu5ps7TuSMkoFk92G3xOD/Yeb8= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2017 15:24:41.4884 (UTC) X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a;Ip=[137.71.25.55];Helo=[nwd2mta1.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB3173 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v6DFOw5w029012 Content-Length: 7529 Lines: 193 On 07/12/2017 02:12 AM, Ladislav Michl wrote: > On Tue, Jul 11, 2017 at 10:59:11PM +0200, Ladislav Michl wrote: >> On Tue, Jul 11, 2017 at 07:07:32PM +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). >> Please wrap commit message correctly. >> >>> Signed-off-by: Dragos Bogdan >>> --- >>> Changes in v2: >>> - Fix the voltage and current conversion. >> That's better :-) However it conflicts with LTC2942 patch. I can fix > Well, still not good enough. You overlooked different temperature > computing formula. For a bug, see bellow. The Full-Scale Temperature is 510 K (as it is displayed in the Electrical Characteristics section) for both LTC2943 and LTC2944 parts, so the same computing formula is valid. For LTC2944, the 500 K value used in the Applications Information section is an error that will be fixed in the next version of the datasheet. > >> this and extend LTC2942 patch serie to add LTC2944. Okay to proceed >> or do you want to take care about this yourself? Also it is nice to > I'll provide patchset myself, it is mostly done now. I'd appreciate > if you could test it on your device. > >> Cc driver author (done now). >> >> ladis >> >>> .../devicetree/bindings/power/supply/ltc2941.txt | 10 ++--- >>> drivers/power/supply/ltc2941-battery-gauge.c | 46 +++++++++++++++++----- >>> 2 files changed, 41 insertions(+), 15 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..4c979b1a022b 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 >>> @@ -57,6 +57,12 @@ enum ltc294x_reg { >>> #define LTC2941_NUM_REGS 0x08 >>> #define LTC2943_NUM_REGS 0x18 >>> >>> +enum ltc294x_id { >>> + LTC2941_ID, >>> + LTC2943_ID, >>> + LTC2944_ID, >>> +}; >>> + >>> struct ltc294x_info { >>> struct i2c_client *client; /* I2C Client pointer */ >>> struct power_supply *supply; /* Supply pointer */ >>> @@ -66,6 +72,7 @@ struct ltc294x_info { >>> int charge; /* Last charge register content */ >>> int r_sense; /* mOhm */ >>> int Qlsb; /* nAh */ >>> + enum ltc294x_id id; >>> }; >>> >>> static inline int convert_bin_to_uAh( >>> @@ -145,7 +152,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; >>> >>> @@ -248,11 +255,16 @@ static int ltc294x_get_voltage(const struct ltc294x_info *info, int *val) >>> int ret; >>> u8 datar[2]; >>> u32 value; >>> + u32 full_scale; >>> >>> ret = ltc294x_read_regs(info->client, >>> LTC294X_REG_VOLTAGE_MSB, &datar[0], 2); >>> value = (datar[0] << 8) | datar[1]; >>> - *val = ((value * 23600) / 0xFFFF) * 1000; /* in uV */ >>> + if (info->id == LTC2944_ID) >>> + full_scale = 70800; >>> + else >>> + full_scale = 23600; >>> + *val = ((value * full_scale) / 0xFFFF) * 1000; /* in uV */ > Here result of 14bit ADC conversion is stored in 16bit register with > lowest two bits being zero. Multiplying that with 70800 will overflow > 32bit unsigned integer. > >>> return ret; >>> } >>> >>> @@ -261,15 +273,20 @@ static int ltc294x_get_current(const struct ltc294x_info *info, int *val) >>> int ret; >>> u8 datar[2]; >>> s32 value; >>> + u32 full_scale; >>> >>> ret = ltc294x_read_regs(info->client, >>> LTC294X_REG_CURRENT_MSB, &datar[0], 2); >>> value = (datar[0] << 8) | datar[1]; >>> value -= 0x7FFF; >>> + if (info->id == LTC2944_ID) >>> + full_scale = 64000; >>> + else >>> + full_scale = 60000; >>> /* Value is in range -32k..+32k, r_sense is usually 10..50 mOhm, >>> * the formula below keeps everything in s32 range while preserving >>> * enough digits */ >>> - *val = 1000 * ((60000 * value) / (info->r_sense * 0x7FFF)); /* in uA */ >>> + *val = 1000 * ((full_scale * value) / (info->r_sense * 0x7FFF)); /* in uA */ >>> return ret; >>> } >>> >>> @@ -388,7 +405,11 @@ static int ltc294x_i2c_probe(struct i2c_client *client, >>> >>> np = of_node_get(client->dev.of_node); >>> >>> - info->num_regs = (unsigned long)of_device_get_match_data(&client->dev); >>> + info->id = (enum ltc294x_id)of_device_get_match_data(&client->dev); >>> + if (info->id == LTC2941_ID) >>> + info->num_regs = LTC2941_NUM_REGS; >>> + else >>> + info->num_regs = LTC2943_NUM_REGS; >>> info->supply_desc.name = np->name; >>> >>> /* r_sense can be negative, when sense+ is connected to the battery >>> @@ -492,8 +513,9 @@ 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}, >>> + {"ltc2941", LTC2941_ID}, >>> + {"ltc2943", LTC2943_ID}, >>> + {"ltc2944", LTC2944_ID}, >>> { }, >>> }; >>> MODULE_DEVICE_TABLE(i2c, ltc294x_i2c_id); >>> @@ -501,11 +523,15 @@ MODULE_DEVICE_TABLE(i2c, ltc294x_i2c_id); >>> static const struct of_device_id ltc294x_i2c_of_match[] = { >>> { >>> .compatible = "lltc,ltc2941", >>> - .data = (void *)LTC2941_NUM_REGS >>> + .data = (void *)LTC2941_ID >>> }, >>> { >>> .compatible = "lltc,ltc2943", >>> - .data = (void *)LTC2943_NUM_REGS >>> + .data = (void *)LTC2943_ID >>> + }, >>> + { >>> + .compatible = "lltc,ltc2944", >>> + .data = (void *)LTC2944_ID >>> }, >>> { }, >>> }; >>> @@ -525,5 +551,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 >