From patchwork Tue Jan 12 15:22:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 8018431 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 549C49F6FA for ; Tue, 12 Jan 2016 15:24:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 87EA720219 for ; Tue, 12 Jan 2016 15:24:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8262D20120 for ; Tue, 12 Jan 2016 15:24:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aJ0mt-0003yY-KI; Tue, 12 Jan 2016 15:23:11 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aJ0mq-0003lP-CN for linux-arm-kernel@lists.infradead.org; Tue, 12 Jan 2016 15:23:09 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id u0CFMLsY016182; Tue, 12 Jan 2016 09:22:21 -0600 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u0CFML7M007547; Tue, 12 Jan 2016 09:22:21 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Tue, 12 Jan 2016 09:22:20 -0600 Received: from [128.247.8.252] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id u0CFMKbI008785; Tue, 12 Jan 2016 09:22:20 -0600 Subject: Re: /sys/class/power_supply/bq27200-0/capacity changed meaning between 4.1 and 4.4? To: Pavel Machek References: <20160109230709.GA30551@amd> <5693BB75.70409@ti.com> <20160111214247.GA9735@amd> <56942344.9070609@ti.com> From: "Andrew F. Davis" Message-ID: <56951A2C.9010602@ti.com> Date: Tue, 12 Jan 2016 09:22:20 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <56942344.9070609@ti.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160112_072308_698109_6A2FC93A X-CRM114-Status: GOOD ( 17.58 ) X-Spam-Score: -6.9 (------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ivo.g.dimitrov.75@gmail.com, khilman@kernel.org, tony@atomide.com, sre@debian.org, aaro.koskinen@iki.fi, kernel list , a.hajda@samsung.com, sre@ring0.de, pali.rohar@gmail.com, linux-omap@vger.kernel.org, patrikbachan@gmail.com, linux-arm-kernel , serge@hallyn.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 01/11/2016 03:48 PM, Andrew F. Davis wrote: > On 01/11/2016 03:42 PM, Pavel Machek wrote: >> Hi! >> >>>> Did /sys/class/power_supply/bq27200-0/capacity change meaning between >>>> 4.1 and 4.4? >> >>> There was a resent overhaul of this driver and a lot of code is >>> vestigial as you have seen. I've been meaning to continue >>> cleaning it up, my next step would probably to bring up regmap >> >> Ok, 1wire is probably reasonable approach. But we have an regression >> between 4.1 and 4.4, and to debug it is probably by reading code. >> >> I can't prove you caused the regression, but you basically rewrote the >> driver, so it should be easier for you to spot the bug. >> > > Makes sense. > >> n900 has this variant: >> >> bq27200: bq27200@55 { >> compatible = "ti,bq27200"; >> reg = <0x55>; >> }; >> > > Hmmm, not sure if I have this one on hand, I'll see if I can find an > n900 around here (they seem to be pretty popular around here for testing > (had a lot of TI parts)). > >> Will you try? >> >> If not, tell me, and I can do it, but it will involve a lot of swaring... >> > > I'll give it a look over. OK, I'm still looking for a test setup, but this was definitely a problem, could you give this a try?: Tested-by: Pavel Machek Acked-by: Pavel Machek Reported-by: Pavel Machek diff --git a/drivers/power/bq27xxx_battery.c b/drivers/power/bq27xxx_battery.c index 880233c..4fec3cf 100644 --- a/drivers/power/bq27xxx_battery.c +++ b/drivers/power/bq27xxx_battery.c @@ -470,8 +470,9 @@ static inline int bq27xxx_read(struct bq27xxx_device_info *di, int reg_index, static int bq27xxx_battery_read_soc(struct bq27xxx_device_info *di) { int soc; + bool single = di->chip == BQ27000 || di->chip == BQ27010; - soc = bq27xxx_read(di, BQ27XXX_REG_SOC, false); + soc = bq27xxx_read(di, BQ27XXX_REG_SOC, single); if (soc < 0) dev_dbg(di->dev, "error reading State-of-Charge\n");