Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp447062imm; Wed, 26 Sep 2018 01:09:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV62WbpX1VyRRjz5IlepNhGCEkxnepQ4oJrw/gGPld/J1XYZIVsRJu5pPnUdx03Er82yQq2wb X-Received: by 2002:a62:6b85:: with SMTP id g127-v6mr5107076pfc.204.1537949395504; Wed, 26 Sep 2018 01:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537949395; cv=none; d=google.com; s=arc-20160816; b=aUAJlQINiKm6mWn9MscIXgNthbPc0O23/cDuH7Q75yn/+PrulM5fVNNb7VxzsjvtR6 Rxdtrr6c4HQRstPSc9ehJib6VsJXjzjlzJNG8k9elDnxwTKw45w9LAoUg8QafBCPoH0b Z8JWLB7VOqr2cHoc6hRC2OYCfILqzYoeavhR5w7fqcy/j0C17k4H4d5ucwsJ+tgLgW2X 81o7zK/RjyfVYDz2Wqjp3vuX+Wv0Z8wcu5fcPJZMpWpHVszA7n/6C6UVThRb7+Ex59GJ HtOw1jZe0kQJJfPxqj2al5lQgVQ2fzl7X1OqjTdTD55SpdIsXrcf9M2lF/eBEYuR630W KboA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=HS8kCifeqHbBsveDxxv3BPwg0Rlbdx8KdB36Y6B5kfI=; b=F08Kl9fY0Ru5txlVAPNoTmcBkmriAf3cgJdzfyumGJScPMD+WL2hBQw9f1hVdvDDhg q6bDfS/BRCM28Of6plM9zRiXhLOH6CG5CpU59Tzpp8VW9Dg5JTwcdwjBW9IazGqzmMBg p4/meCd48/STBujo4PJgZT3Ws6XfbfRwKp3g546eSXjrUyJ4f9uCsEbHMCIFXkXlsa2V x1+6VavelxzRgqriBuro5ujJxrdtvlxH/aSz7K1XIUFbUJI/OLeertBlMljI5lr5L5xa rndvS9YIqqzyzEk2iuHnVHLdnUMk+BxlQ7JYrkD++szuc78JUurvbGoAqnHZb3j1bU5+ QnTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TYmkem4W; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17-v6si4430288pgo.278.2018.09.26.01.09.39; Wed, 26 Sep 2018 01:09:55 -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=pass header.i=@linaro.org header.s=google header.b=TYmkem4W; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727084AbeIZOVP (ORCPT + 99 others); Wed, 26 Sep 2018 10:21:15 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:41370 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726593AbeIZOVO (ORCPT ); Wed, 26 Sep 2018 10:21:14 -0400 Received: by mail-io1-f67.google.com with SMTP id q4-v6so22580285iob.8 for ; Wed, 26 Sep 2018 01:09:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HS8kCifeqHbBsveDxxv3BPwg0Rlbdx8KdB36Y6B5kfI=; b=TYmkem4WTLR0cqwC2Big7yZwU24j1vmgg4GjQuB69Qum8/h4vuKRpDJg9kpFNU7Z9A mZpMmqmQns96G3K594ykd7oCNzMqeACoQd/pXyA5a1+si5xTX+/sEyvMm3mwjXFKuV5A WSdCPgvYvUN4U0fjpgbOD1CWyn6U/I8Oswkb0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HS8kCifeqHbBsveDxxv3BPwg0Rlbdx8KdB36Y6B5kfI=; b=GEcxmZdz7/RIBY8wV8DIGB4Bqh8TfpWcQiTyOhsSlScFE7UrF33wVZ2+e4qN8lvJ29 cOjHrbnFm7PHL/rkyfUmXzAEkyO2R9bZxq9Blgq1Ps7ORFjcZz/0wHSQupxFUKImD/XH TYM6uTlvfU5fbsMtM01szO/KRLHof390r5hXA0hDbp94qBKcyr0F9KHkE9nDsrjG7igD ZjfSzVggM9MeN+WPGaeij0Oekstcc6YTTXMQRqz104Vmw7LCv6wmqmksrhF4C05VHDV9 LbJ0p8aLboAHL3VBc5xV5iXNStYnEblk8LUIBGy7Fpe/tq0Uja+sDNYCq4sv7TRjn8Fn Jmbw== X-Gm-Message-State: ABuFfogaawQvS/7YdYKNtQtDBIXsWUkT0o/+A3AxmDyYBkPfZfF0cjQp FkzY1QAFsqYjClXu4XhwaqC9GShaeLdeSizLViwyiA== X-Received: by 2002:a6b:630a:: with SMTP id p10-v6mr4018603iog.175.1537949372316; Wed, 26 Sep 2018 01:09:32 -0700 (PDT) MIME-Version: 1.0 References: <358665e3f4f9ec105dc2f8a2dc6dd98dbe761fae.1537930252.git.baolin.wang@linaro.org> <707ebff8a188d41de374314414c8bfd927183d33.1537930252.git.baolin.wang@linaro.org> In-Reply-To: <707ebff8a188d41de374314414c8bfd927183d33.1537930252.git.baolin.wang@linaro.org> From: Linus Walleij Date: Wed, 26 Sep 2018 10:09:20 +0200 Message-ID: Subject: Re: [PATCH v2 4/4] power: supply: Add Spreadtrum SC27XX fuel gauge unit driver To: Baolin Wang Cc: Sebastian Reichel , Rob Herring , Mark Rutland , Linux PM list , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "linux-kernel@vger.kernel.org" , yuanjiang.yu@unisoc.com, Mark Brown , Craig Tatlor Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 26, 2018 at 5:00 AM Baolin Wang wrote: > This patch adds the Spreadtrum SC27XX serial PMICs fuel gauge support, > which is used to calculate the battery capacity. > > Original-by: Yuanjiang Yu > Signed-off-by: Baolin Wang > --- > Changes from v1: > - Use battery standard properties to get internal resistance and ocv table. > - Change devm_gpiod_get_optional() to devm_gpiod_get(). > - Add power_supply_changed() when detecting battery present change. > - Return micro volts for sc27xx_fgu_get_vbat_ocv(). Acked-by: Linus Walleij I see that you need to have the internal resistance as parameter to this equation so it needs to come in. (I guess as factor/typical internal resistance as suggested.) IIUC this reliance on an uncertain internal resistance is the reason why fuel gauges / coloumb counters are seen as crude ways to estimate battery capacity, and their accuracy and reliability worsen over the lifetime of the battery, and this is why safety-critical devices include ways to measure the internal resistance as well. But the hardware is as it is, and probably for some good reasons, like cost. Yours, Linus Walleij