Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3631490imm; Mon, 15 Oct 2018 01:11:43 -0700 (PDT) X-Google-Smtp-Source: ACcGV613YefjqalAzh1iEiSZ0mooXQg0FK7PU+PC+F2i6SFMeZ8c2UGiwJAfhM98dZyiCSUJgFEz X-Received: by 2002:a65:4385:: with SMTP id m5-v6mr14364249pgp.219.1539591103920; Mon, 15 Oct 2018 01:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539591103; cv=none; d=google.com; s=arc-20160816; b=v1dfKQQ97MjQUI57+cIv1HhinLhRLzQWIQJdoPP0A9E6FpWuorCqPYHm0zu79qSfC/ W0g5w9+ThzkL9euA+8FqMb47nRJw11aEaP4RzBfz9Sq3HKiJCku2xTq8Lkd9hmH0bF41 j07XsAk5Jx8V8eRKiI8uY1yyWjDTcqxvJ1LHMn/oW9qerUCRNnMsc+m1DLiFHQcVAG/V SLm04ebp1VGhNcGH8aVHxJZGf/4zQ8jh1H2zczn1pfBI2F6WRVaRqdYqCLmJABSLnlDZ 8lsviV3LtWh5P0nlp59J40F2aFjQuuJOKT9tWJNkP0omuJQDHMgPTFcl2hnwuR8L2Iua 1c4Q== 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=sqt/MvygSPIA+8fRlfiaRWfbJBdMIOuNNb73rehO8sM=; b=qIohBUwHPf8462typWlNOhrfDMMb5OqLoIhxc4MKrhs0ZE/9exKDHicMQQnih/bgMR AFmoAFEGGEVNpZVKEnVDWYptLOP1mck9A5v2TrlN0+Cpw4t7Y9pvQJ7G2yn03fb3ZF1L dmPQrSwui3FvCqaOb9WNnn7nzugclrWC5IkxP1gHbNcJ1dHSGE3dAtzkxdI2nATbVEtt iR2FVckUnaZxNMs0gdYz5kjXMfMp5QEOk78MuXPJEvO2n0kfyq2LO43F+XP/cfypBGfo g6pR6bG9JlDWV+EVPpW8tcQid95+hWSqMupPZENXV6JIA9pLpxqJxU1SwYw14QQ4GBoR 26ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MI+FSJy9; 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 q9-v6si10153502pfk.27.2018.10.15.01.11.29; Mon, 15 Oct 2018 01:11:43 -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=MI+FSJy9; 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 S1727062AbeJOPy5 (ORCPT + 99 others); Mon, 15 Oct 2018 11:54:57 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:37450 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726864AbeJOPy5 (ORCPT ); Mon, 15 Oct 2018 11:54:57 -0400 Received: by mail-pg1-f196.google.com with SMTP id c10-v6so8795373pgq.4 for ; Mon, 15 Oct 2018 01:10:46 -0700 (PDT) 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=sqt/MvygSPIA+8fRlfiaRWfbJBdMIOuNNb73rehO8sM=; b=MI+FSJy9NhuQ26wbC4sMLs8wrc8NJAFPFS79fO5fDuBM+saBdpfbdIrY8dAzZ/QH20 CFDYc697xXonfukCVmmbBtKC/CZ33Vzq5umXRvdmEF4HAyv31jRhIW52hV7HatyuwiQ7 kFV4hvEEczsvYMeKfDqrKvIV2lAiesmTmE7Lw= 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=sqt/MvygSPIA+8fRlfiaRWfbJBdMIOuNNb73rehO8sM=; b=lpWZJR7v1RQj7PGL3VUqK6G9kUSaNKtciI6co5x2QYtte89+TxvzyaFoSwRcSf90kG DtvoAzxfwtXtyBuai14sqCjusz9G9eipalSL9TP4Bs8H9a4811ajyRnbvuwfLfBVqtIc fHhAPBHfO6csMgUNQwGWIgdt14mNTLL17rpKR+H79l6QZtPVZHJZaO2mMy7gkEkG8u6s dNOzhRfQzXj5cQmzV03w1KutS82vL4s2uWOoE+3I8LRCH3g9TnSiZudbuQA88p0lKRaE uHOsT4e7cTYyyxHCsnSs2xmZ8IOYa1j00l/SrE8qVFPJEvNTJpegUm2O9S/RTI7AUY/H imaQ== X-Gm-Message-State: ABuFfogCpIY2RDSCbgzr1xI4leCJ95eU+Plo+vAiGi7YVEjFC9hiVhLO pKVgVJj7A01D8RuCl+JxMK3cuw== X-Received: by 2002:aa7:8001:: with SMTP id j1-v6mr16371569pfi.73.1539591045783; Mon, 15 Oct 2018 01:10:45 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id m27-v6sm16375855pff.187.2018.10.15.01.10.42 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Oct 2018 01:10:44 -0700 (PDT) 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 Subject: [PATCH v4 3/6] dt-bindings: power: Introduce properties to present the battery OCV capacity table Date: Mon, 15 Oct 2018 16:09:22 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: 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 --- 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..1f70e5d 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 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. + 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