From patchwork Mon Oct 15 08:09:22 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: 10641257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 14243157A for ; Mon, 15 Oct 2018 08:10:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 056F0295E3 for ; Mon, 15 Oct 2018 08:10:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 033EE29613; Mon, 15 Oct 2018 08:10:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B2D3295E3 for ; Mon, 15 Oct 2018 08:10:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727050AbeJOPy5 (ORCPT ); Mon, 15 Oct 2018 11:54:57 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:36097 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726862AbeJOPy4 (ORCPT ); Mon, 15 Oct 2018 11:54:56 -0400 Received: by mail-pg1-f193.google.com with SMTP id f18-v6so8801843pgv.3 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=WRNh00Sg9K1DrVKPoQx3HBmV3YEXfDPInISUxdRsPvM0LHDZzKfU6vsAmFktMt3+Qu iOScQDLU3TGyvc+cRe8IatPJkialMaxThqBMHQ6ZPUFNEMPzh0Nc2Mf83TNHvuv1Canl B5exXTtC9A6EW3TXdoLJmzitqDuSTCO90mZobCeoxaIccnMWP/DfUQjmKkODk13UWwNI oH5YJbKHC20uI//27IXmLFf9ssxlmJb42UZsTnwwmv/1Gq4/b9n6i1mhwcqjpVI6MYxU SpzDMD1r/qGyvFL4QRTBQz91iFz5AwlGm+XFpSsNUle5n2wJvthPibwV5ybgfCNeQ/zS gY9w== X-Gm-Message-State: ABuFfohMMHcDdrwqx1PRLcBvXLXjRoYEy3aH/YGjl3P5JRWS3guoKTZq 2HRO0bW886OJkiC3g983487UtQ== X-Google-Smtp-Source: ACcGV63BtWRuyjln9zet303GngfUCoui50hS4rmm7GGdiL5+97O7IE7shSpM/0U7b+72qTQ0ZWR8cg== 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 {