Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp250031imu; Sun, 4 Nov 2018 23:40:33 -0800 (PST) X-Google-Smtp-Source: AJdET5caGA57pu7snsSoQ2s5bjh8xrq8COsvT2W13GXPX8ZNNjSKClnUQZq3TAgjVpj27UHZjGgS X-Received: by 2002:a63:8c4:: with SMTP id 187-v6mr19280009pgi.396.1541403633230; Sun, 04 Nov 2018 23:40:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541403633; cv=none; d=google.com; s=arc-20160816; b=oWY2FNamy9OevvuGkhUV6IzESEeLAYnq2VfdBMfABwQOlp/hsXj/cBmtHTeWGWRS1Y pfNgMhgsgwM+Q0p3s6hLy90rEwkVLMrJj+mTolfpVyJ7/x6NGAVA9PwaRITK2wCN3cKE RfE6a4sTzyWECxtr/DThGMXNPsfntINuqcUkHh+zxurP0NVlyijGuxHsGYvB5zRV7t2+ GV69p834j8rPY3SIJJrsSSSMTc+/r4KWtKIFMS9mY22ge3aTtvsXLiYE8yv4nnCEUTjC i2dQ2arwqyOJym3Ti18cMl/y3N0rYY62Yvku0+t3/f7P8mEqaLYy0ajrqNmpB3nZFvdr UNJw== 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=pTgpDMQJOoMNIGy2WI0lycCbK22G/wjELYiI671ILzRJ0z8DQjVkik+JwSV9Ef2FMr tmMicEXolh1ASwS9/f7itlaRzQ8TQ7l2TWZK80zo+yHm5DgEs40yS/QV/YMoJ4mAwwyq ErhUwmT/2iFBqhNyheFkgAOtluwodnkYoZo53QAzJvxENqzkfrdn4EbRbd6ZeIdrd968 BCNej2vKO/RafnV4rIVe+/3N64dlUG/1F3HGau+q80lHlSs/sIGalJ5dQwD62nfVjM3e iw+2KxiJ4W/U0bwYb9sfNU0fufm6+7BfAWoVViwwZ2hfGqyyTlezAXIs54jJfAPi6EHO lW5Q== 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-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 c11si3764910pgj.255.2018.11.04.23.40.18; Sun, 04 Nov 2018 23:40:33 -0800 (PST) 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=P9Fcj1yM; 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 S1729692AbeKEQ56 (ORCPT + 99 others); Mon, 5 Nov 2018 11:57:58 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45129 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729558AbeKEQ56 (ORCPT ); Mon, 5 Nov 2018 11:57:58 -0500 Received: by mail-pl1-f195.google.com with SMTP id o19-v6so4012066pll.12 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=mGA7adPqLHfoHEGy943M4jZyb46PFwCFbhCnextNLooSbxJUW/l0R85cVoBaf329K0 czX2/1FxlvtuVkwwwWrNSwFGB4S/8GuJP86JUGkPxkifWrRSKQGVOBpe0/PisoiggzHA yxu5NCnRlOm9z4vgzuv1PVKrz6q70k8yJW+IRx7cVT7L+jYqihL+3cZnV5e27l8pv8BT 9dhlafnhxQzR0gt4iaWb3qHR/s5yU+0+W/Xr4FlJFsRuC8ai++HrMzm+hB7tZckjf7zn A39qX38NaTrtfKkeBtsBZ0ToJU5S/4e57PkWIOcQflkf9zWI26cx1Sex08YXgTIzNbd6 DyrA== X-Gm-Message-State: AGRZ1gKoYKLQ/XHo1fs+IQg06zgEdUMCJFi2+mUCRZezuC42D8Y/NcOF O7UVvDfeaRzdmZcRJafcMOt9Lw== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(+) 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 { -- 1.7.9.5