Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2593649imm; Sat, 13 Oct 2018 23:56:08 -0700 (PDT) X-Google-Smtp-Source: ACcGV61Jh0dddNSNseNBHlcBHU9SSuzMFXnljlFl+ZlCKIlaCpmMuVeNUOb0UdP6X6ifTgLNsb6y X-Received: by 2002:a62:2a07:: with SMTP id q7-v6mr12885168pfq.103.1539500168039; Sat, 13 Oct 2018 23:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539500168; cv=none; d=google.com; s=arc-20160816; b=oENZW4FmP+h8xPSVnOKMHErQ9A74cwZNdTJkgYts96oVF5RZrIOzWI+17DvE2DHO+V L2oFCz0ICqDrQhCep58+4+41jOA5/EsyPYlYBnY4hCbaJf3yMOMTOEEt1BS4U/vrqVf+ FIZh8cHVceZ3zo8VXhzGsCimVd4noNBcVxjBJtX5ZqwWYCKD3PQJMy1DHPmhp7T6gcwf 1C2J5nPz0LVdVbnsFiWkQJw277MsiEXEECaVq37wJ8S5bdT2q3j9T0nrhDiH0y/LpRfz 9P/HUQnSfwMxpQYHehS/sV2alTKcIkkL0HLSJauhCxe1bMqtVYuO5dgz9HdjSA/S3eyc m7Zw== 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 :references:in-reply-to:mime-version:dkim-signature; bh=M6W+/QMjs1HJ2Qy8aAyCyWYoWpUGfff6SgHNSznsQ/g=; b=SknpYJNlEBoD5pdL7JrwMUTC4GmMEaldCBxK9GlS6tjZzet7TyvRcPe/YGEezodyTA 3PfLKUcstKgRFxOVbrF4E1Y43w+tywP8i6DEn5aFWH9k04HNg7fam04dUUkU5G7PGJOO lsDHKBB1Vf4Y341mZmE/FbMJb1zZ6iA1S/MnpDPK7DWl7dF9PvPsPbd7/b09ENkks1Zf H1hr2r2RiZ5zjSYwPYwYSkjjc+fVhvRBMSIXa8T/mVNwuYQlOhO+eGXMM6262xeV2nn+ dRjIkxN03Z7SaBlFRjdu5tCaYm9i8xaYvnC0unvQbt6LHp3yIDqP+lztEcR1j2+RPxOq QbTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HLyrAZ0t; 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 p9-v6si7540149pli.395.2018.10.13.23.55.52; Sat, 13 Oct 2018 23:56:08 -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=HLyrAZ0t; 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 S1726444AbeJNOdU (ORCPT + 99 others); Sun, 14 Oct 2018 10:33:20 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:44314 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726356AbeJNOdU (ORCPT ); Sun, 14 Oct 2018 10:33:20 -0400 Received: by mail-lj1-f194.google.com with SMTP id v6-v6so14677572ljc.11 for ; Sat, 13 Oct 2018 23:53:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=M6W+/QMjs1HJ2Qy8aAyCyWYoWpUGfff6SgHNSznsQ/g=; b=HLyrAZ0tac77WVZkkUZOgg3O0qOy+bg0ysQo0vosA8wsa9lyb7hbGCa7GSYXLG/6dq btNDR7KY24mbIe/ET5LzOEZwoWeKuPNAQL8PvoQIwsJf6aIs0re1HbuQe5RUVXpEnHtW HA6EHXDOFmkSMi8Z2GfyQJgbFi5vu9f3Z1wko= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=M6W+/QMjs1HJ2Qy8aAyCyWYoWpUGfff6SgHNSznsQ/g=; b=tdfTqzAkpmAZIaipYdzitJ6Pt/A9CiPF2xyeaDOxwF1ERD+vqWL+QSUYniu/NT24Zc i2hlbnT/AG9K1me2x//zhnI0u9xQpPLL5VsFW3uP13YQDaKWF9zkGk/t6/5St49iHi9q GPNv1a1NUhvAGvOxvsrKhzejacUu5nUnvvQLFVhEoJIp2lAOe1Cs336DyuFNXpXwuEb6 Fxmyy2W9l70xSO0JF8SIjW6DLs2/0tE06x3ViulZTpaM417TwBGrbqmFyFE9rWI5Povn zdE4kyOSjBVce1B1ucQ+MW6eUeHr6qkpcrIfN1s3WIwxD7jLcT5xTlLjy8jpPdfcnsij 83Gw== X-Gm-Message-State: ABuFfoiZugsYH9MnpdZVPK0DRx1fFq20TmBeLbxelqkOMEOKcjzjmacr VBlzlDzETeqIF1lfSWWgi4EwqjnwigE8i/DrUfaqoaUvA1wCm6zY X-Received: by 2002:a2e:9b46:: with SMTP id o6-v6mr8551093ljj.78.1539500000136; Sat, 13 Oct 2018 23:53:20 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:95d7:0:0:0:0:0 with HTTP; Sat, 13 Oct 2018 23:53:19 -0700 (PDT) In-Reply-To: <20181012143530.GA28145@bogus> References: <2787f18a0366576959557d05112a069dca982269.1538033078.git.baolin.wang@linaro.org> <7dccec1694a05a524710e59a63859974b4cdae89.1538033078.git.baolin.wang@linaro.org> <20181012143530.GA28145@bogus> From: Baolin Wang Date: Sun, 14 Oct 2018 14:53:19 +0800 Message-ID: Subject: Re: [PATCH v3 2/4] power: supply: core: Introduce properties to present the battery OCV capacity table To: Rob Herring Cc: Sebastian Reichel , Mark Rutland , Linux PM list , DTML , LKML , yuanjiang.yu@unisoc.com, Mark Brown , Craig Tatlor , Linus Walleij 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 Hi Rob, On 12 October 2018 at 22:35, Rob Herring wrote: > On Thu, Sep 27, 2018 at 03:26:55PM +0800, Baolin Wang wrote: >> Some battery driver will use the open circuit voltage (OCV) value to look >> up the corresponding battery capacity percent in one certain degree Celsius. >> Thus this patch provides some battery properties to present the OCV table >> temperatures and OCV capacity table values. Moreover it also provides some >> helper functions to use the OCV capacity table for users. >> >> Suggested-by: Sebastian Reichel >> Signed-off-by: Baolin Wang >> Reviewed-by: Linus Walleij >> --- >> Changes from v2: >> - Use type __be32 to calculate the table length. >> - Update error messages. >> - Add some helper functions. >> >> Changes from v1: >> - New patch in v2. >> --- >> .../devicetree/bindings/power/supply/battery.txt | 14 +++ > > Please split binding patches. Sure. > >> drivers/power/supply/power_supply_core.c | 125 +++++++++++++++++++- >> include/linux/power_supply.h | 19 +++ >> 3 files changed, 157 insertions(+), 1 deletion(-) >> >> diff --git a/Documentation/devicetree/bindings/power/supply/battery.txt b/Documentation/devicetree/bindings/power/supply/battery.txt >> index 938d027..cad38df 100644 >> --- a/Documentation/devicetree/bindings/power/supply/battery.txt >> +++ b/Documentation/devicetree/bindings/power/supply/battery.txt >> @@ -23,6 +23,16 @@ Optional Properties: >> - constant-charge-current-max-microamp: maximum constant input current >> - constant-charge-voltage-max-microvolt: maximum constant input voltage >> - factory-internal-resistance-micro-ohms: battery factory internal resistance >> + - ocv-capacity-table-0: An array providing the battery capacity percent >> + with corresponding open circuit voltage (OCV) of the battery, which >> + is used to look up battery capacity according to current OCV value. >> + - ocv-capacity-table-1: Same as ocv-capacity-table-0 >> + ...... >> + - ocv-capacity-table-n: Same as ocv-capacity-table-0 > > So it is tubles of (percent, voltage)? What's the units for voltage? Yes. The units for voltage is microvolt, and I will add some words to make it clear in next version. > > What determines the # of entries for each table? Do all tables have the > same number of entries? Not same, that depends on the battery drivers' requirement. >> + - ocv-capacity-table-temperatures: An array containing the temperature >> + in degree Celsius, for each of the battery capacity lookup table. >> + The first temperature value specifies the OCV table 0, and the second >> + temperature value specifies the OCV table 1, and so on. > > This should have unit suffix. Perhaps just "ocv-capacity-celsius" to > avoid being too long. I am fine with this. Thanks for your comments. Sebastian and Linusw, what do you think about Rob's suggestion? Thanks. -- Baolin Wang Best Regards