Received: by 10.213.65.68 with SMTP id h4csp793362imn; Sat, 7 Apr 2018 09:41:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx495gsU9aDnNVS2bwzjZKM/8O+RA5OKPuZ6CoMDJ7jIhEdqCyjVmrDxavoVE0XuKNPoc3ZNe X-Received: by 2002:a17:902:3e5:: with SMTP id d92-v6mr32593291pld.104.1523119278431; Sat, 07 Apr 2018 09:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523119278; cv=none; d=google.com; s=arc-20160816; b=q11pv6DQDGabEI3UHZllT9ySLOMI0M4eXUujli0H2SEPlq8i8DbaVcoA4QP1hOtnZS i7dEd/OpxUAk182DgxD7ofoJb5yk0wljwOXJXEaC1p5YONBtDrOf8bEIdFaGHN4bdXe6 Vn4/IisBkNH0FVe9GGAZOx/DWQ40HpBxmvUAW9t0AerdKrTZLx2Mqk7pgigLVJWel4KY CDgsXSkxxMO9GoXDC5xJ+kBWmjN51fSB9fi/O8i6GjRDgWq/LI2+NyCQOqySHGkqn7gI JdF2HdZV3KhNpkxk4QuBS3h/9gxd9nZ53Cc5/bfVOXLpdBADBD0r5uXO0Pppon94heK4 5OQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=ctSeIar2ygbFRVwutq5ieCCAm5rJJYcR0L+ogxSNcDY=; b=SJo4Aj+8Lt8694N7e0rC8pyr9ACKZG/2FGaJXQLfx0GBBnNe8tWA/EEe/xLUmiVLDb L95e1uV9prGKvPzThD0owDt4Oem2VrBfYwCoE19PzzpHxLwwCj65nmKxc3UeVU5RWZaj OfrSnwYzpeyz2Mrt2fDXrpdkTO/puHbl/yelQhzvQuXwK6lRj2X4q93Qi8dt5zv4osCt zNb0VZvy7BJDgour2JciF77jGW5T+gsejlXRWweTcyTj1j4mWRxdLsR6s27hErhFJzJZ XR2GAxm3LwdmiQHrj2pFRMOPmILHn9AddDzoSdgQN4zs7yyVgqzWWMXFonBSarTRbJkM wIrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Pq9U2Wtg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si8432753pgt.576.2018.04.07.09.40.41; Sat, 07 Apr 2018 09:41:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Pq9U2Wtg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752108AbeDGQh2 (ORCPT + 99 others); Sat, 7 Apr 2018 12:37:28 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:38120 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751956AbeDGQh0 (ORCPT ); Sat, 7 Apr 2018 12:37:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ctSeIar2ygbFRVwutq5ieCCAm5rJJYcR0L+ogxSNcDY=; b=Pq9U2Wtg0HG5bdLFj5DbbITdK V+Aw2WdkJ3z3nHnTZLM9WDnHI5FhmElYgRYnwPkgb74YbijndIRjViB/jmcIU2oQsU7QcZZMvtj29 LNHwhbKE+4ca0LBofyLOuNZ/ldJZF5w6nkm+Rw4zF7rZPufO/g1iT8NQBaQxseBz6YJqPssNJvUEv 4UKtIaCFx2wy+jTawErdA20OuFSNV8aJ/c4aogmsrvRozCsc2xuTHZChAxWaEAsnpfGXM+YmdjR/M HS4JdU2iHQ/aT8JzMT4Fcf8wQgh/wtZtBAErZumsQD8qzH0IgQGV0wNutZJYqGYCMB/+b+qyEFXFu nozUiTckw==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1f4qqB-0007OA-RI; Sat, 07 Apr 2018 16:37:23 +0000 Subject: Re: [PATCH v3 1/3] power: supply: Add support for the Qualcomm Battery Monitoring System To: Craig Tatlor Cc: linux-arm-msm@vger.kernel.org, Sebastian Reichel , Rob Herring , Mark Rutland , Mauro Carvalho Chehab , "David S. Miller" , Greg Kroah-Hartman , Linus Walleij , Andrew Morton , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180407135934.26122-1-ctatlor97@gmail.com> From: Randy Dunlap Message-ID: Date: Sat, 7 Apr 2018 09:37:21 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180407135934.26122-1-ctatlor97@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/07/2018 06:59 AM, Craig Tatlor wrote: > This patch adds a driver for the BMS (Battery Monitoring System) > block of the PM8941 PMIC, it uses a lookup table defined in the > device tree to generate a capacity from the BMS supplied OCV, it > then ammends the coulomb counter to that to increase the accuracy > of the estimated capacity. > > Signed-off-by: Craig Tatlor > --- > drivers/power/supply/Kconfig | 9 + > drivers/power/supply/Makefile | 1 + > drivers/power/supply/qcom_bms.c | 500 ++++++++++++++++++++++++++++++++ > 3 files changed, 510 insertions(+) > create mode 100644 drivers/power/supply/qcom_bms.c > diff --git a/drivers/power/supply/qcom_bms.c b/drivers/power/supply/qcom_bms.c > new file mode 100644 > index 000000000000..5aa6e906d1b9 > --- /dev/null > +++ b/drivers/power/supply/qcom_bms.c > @@ -0,0 +1,500 @@ Hi, > +static unsigned int between(int left, int right, int val) > +{ > + if (left <= val && val >= right) maybe double-check those if() conditions? [or I need my morning coffee] > + return 1; > + > + return 0; > +} thanks, -- ~Randy