From patchwork Mon Nov 5 07:39:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 150145 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2286308ljp; Sun, 4 Nov 2018 23:39:40 -0800 (PST) X-Google-Smtp-Source: AJdET5cF2fotrMGZcQYbMRds0Wk5OPggkX5ZiZ14XA0kPblVbbG0Vuhncs4GQJNKJaXaGse9qXix X-Received: by 2002:a17:902:9044:: with SMTP id w4-v6mr9255596plz.32.1541403580236; Sun, 04 Nov 2018 23:39:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541403580; cv=none; d=google.com; s=arc-20160816; b=XwHMduo1g+5Gfx/dDZ9vTrZ+4eOWx93ItAIvknwCJQkoT1tUwq3d9WiIUMgiqNhSub mxG3jYH9Dm76OA4zEywErFHfI2P03OMD5xPqAUGi7F+CKEMlIHzOWYafGvQYulj/9FDh U6+GBBVvKlFU2zQCU1jGHF/eKi+VR9Xs2WuupdjYWALUvR5Tt0EZYo3LhhBCXHyKS1YM RQ/vcMEjL+fbsq7g34PS85L/rpKgTtPgtXs7MfMrm49Yi+JQzUPfHEvWuMKThuKXSZYS nO5TxHFzVBIOwGI+JE9+fhFiAg7Wgfw58irCZ2Y9B0Mz2mmbKeWgTGcYKzVEYVcFU6NW 0XHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=t6P0NC6uUx2aJ/BT8V+UjrWtOm+Y+ZsbL1DmEhfJd1w=; b=e0s+0q6YwX4Wd1nMv2QA5B/tXJUcmofJPiwLeyKsjWUHxqaKYtIGQBA5SywOjKobvg 7lv9VQ59mnet4cCv9yEFNt+9v/d1oNw9vzGyhpkGkrMFy0M21mlY6RW7PuDngJszYWlw YLj2NWpGc1AVQoXRTBUYxx6aZNgWWamNzidUPHuI3YkrsZu3TEWxrDwhHw+OPHUGjjqu V0bFGOZ4BrEjD7i50FHXHgb7B0xLnuJJhPKM8AMCVAhzR8C73nb2LVAZg2b7x4ULI58q SAbPKAc6Cyt3QNi3/J0QDcUL5t0UDE7OfdDGBdxb1+vSvQJ2QK1uBq7TL2IPyEzKRXrq juHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P9Fcj1yM; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 o31si11791561pgb.273.2018.11.04.23.39.39; Sun, 04 Nov 2018 23:39:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=P9Fcj1yM; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1729496AbeKEQ56 (ORCPT + 11 others); Mon, 5 Nov 2018 11:57:58 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:41453 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729585AbeKEQ56 (ORCPT ); Mon, 5 Nov 2018 11:57:58 -0500 Received: by mail-pl1-f193.google.com with SMTP id p16-v6so4024235plr.8 for ; Sun, 04 Nov 2018 23:39:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=t6P0NC6uUx2aJ/BT8V+UjrWtOm+Y+ZsbL1DmEhfJd1w=; b=P9Fcj1yMgv+H8w+PhmoxV9IUi+jlJEKDkzB0NP8CoZq7+EoCOjuA9hU7JEgzEr+lBV OsUCPJTuHtO8TOHuCCU6TaQiGXvBSLdWnlJrts1iPWrnBnLEdOVLQZLnFhOHdtUaHHAH LlpieYeQ1RQg8lEtiuDA7fVYfaSOWk+CyuSrs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=t6P0NC6uUx2aJ/BT8V+UjrWtOm+Y+ZsbL1DmEhfJd1w=; b=dxOCaWqEouJ+CDKrsReQXePW1MiIA310TmPOSJ+REVgM3zBLdlM+2WRgbk7qMYTzwG kpHIwT7RmZr3w1gZ29u8hwaxMYBlPgK1q/cVWNRrw5L+PqIs3L0BM2cpRSvk2ZS0EQIa XDkYNaRHciwyLM4EQQOWWK2so9j2/auFEHqDn6eCXsE5KgOqTBkRn+rpdZxUd4QoFHjn +5ti6+gfngbq60wgYzOz7UVJlmpyRA+IfnD4Rqnv8cIGgFzGnLXFt/wPzlpcOLW/K3VE KLolZSIWPdyns7Vp+fsfKAjCZEkYZ5NZy+njSItg9GJ4Uwb0bzyu9YhsQlbLiCfwitKx bHUA== X-Gm-Message-State: AGRZ1gIc0YDcZmnIAlnsRugja2zxg8hNMW3ErW7S3bqpgwak978Xyg/b Q1pR39g2Bsc2K9HE1Y8Qi8G44A== X-Received: by 2002:a17:902:9b84:: with SMTP id y4-v6mr21299643plp.332.1541403578182; Sun, 04 Nov 2018 23:39:38 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id d5-v6sm27632040pfo.131.2018.11.04.23.39.34 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Nov 2018 23:39:37 -0800 (PST) From: Baolin Wang To: sre@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, yuanjiang.yu@unisoc.com, baolin.wang@linaro.org, broonie@kernel.org, ctatlor97@gmail.com, linus.walleij@linaro.org, quentin.schulz@bootlin.com Subject: [PATCH v7 3/6] dt-bindings: power: Introduce properties to present the battery OCV capacity table Date: Mon, 5 Nov 2018 15:39:08 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <5640f29e0b7f46f9ee77d80745f8c93eda355c34.1541393063.git.baolin.wang@linaro.org> References: <5640f29e0b7f46f9ee77d80745f8c93eda355c34.1541393063.git.baolin.wang@linaro.org> In-Reply-To: <5640f29e0b7f46f9ee77d80745f8c93eda355c34.1541393063.git.baolin.wang@linaro.org> References: <5640f29e0b7f46f9ee77d80745f8c93eda355c34.1541393063.git.baolin.wang@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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. Suggested-by: Sebastian Reichel Signed-off-by: Baolin Wang Reviewed-by: Linus Walleij Reviewed-by: Rob Herring --- Changes from v6: - Add reviewed tag from Rob. Changes from v5: - None. Changes from v4: - Improve the description of ocv-capacity-table-n to make the order clear. Changes from v3: - Split binding into one separate patch. - Rename ocv-capacity-table-temperatures to ocv-capacity-celsius. - Add some words to specify the OCV's unit. 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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 1.7.9.5 diff --git a/Documentation/devicetree/bindings/power/supply/battery.txt b/Documentation/devicetree/bindings/power/supply/battery.txt index 938d027..89871ab 100644 --- a/Documentation/devicetree/bindings/power/supply/battery.txt +++ b/Documentation/devicetree/bindings/power/supply/battery.txt @@ -23,6 +23,17 @@ 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 open circuit voltage (OCV) + of the battery and corresponding battery capacity percent, which is used + to look up battery capacity according to current OCV value. And the open + circuit voltage unit is microvolt. + - ocv-capacity-table-1: Same as ocv-capacity-table-0 + ...... + - ocv-capacity-table-n: Same as ocv-capacity-table-0 + - ocv-capacity-celsius: 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. Battery properties are named, where possible, for the corresponding elements in enum power_supply_property, defined in @@ -44,6 +55,10 @@ Example: constant-charge-current-max-microamp = <900000>; constant-charge-voltage-max-microvolt = <4200000>; factory-internal-resistance-micro-ohms = <250000>; + ocv-capacity-celsius = <(-10) 0 10>; + ocv-capacity-table-0 = <4185000 100>, <4113000 95>, <4066000 90>, ...; + ocv-capacity-table-1 = <4200000 100>, <4185000 95>, <4113000 90>, ...; + ocv-capacity-table-2 = <4250000 100>, <4200000 95>, <4185000 90>, ...; }; charger: charger@11 {