From patchwork Fri Oct 19 10:53:12 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: 149253 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp3143349lji; Fri, 19 Oct 2018 03:53:49 -0700 (PDT) X-Google-Smtp-Source: ACcGV63JkImMwBhv0WCrVQnLbYeB1dcHkEE6rl8IQsGgn+47Tr8BerJlKv1ko5yMhLoBeqzdUtWw X-Received: by 2002:a17:902:9002:: with SMTP id a2-v6mr10386212plp.291.1539946429197; Fri, 19 Oct 2018 03:53:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539946429; cv=none; d=google.com; s=arc-20160816; b=XrpQYYMYGcIFEpoSBXYnT8TC4BKr0XP5fsIryp5MPMn4AgTVXItBAvmFf46+5xNcu+ D+tXyyXX8JnGLlDD26hJQ//AsCLTATHL25RweCVZRzrtPOBdwDZbPIfKTffrcYu05m6s Jfkq1rLiJCbFZGtYZf5KDTaYg6f2GH09ak1Yyy0U4etFdFTEDaLdiQIgj7gGUp25NY0j upDfD2c1F1qpydFfqQ3M0n7+7zUuht13xvMuu7cwCQBBb6jBw8qDjlm+C7qU2STkL5a7 AYq0mx70NNz2e8JKwFz0h7UZt9BizwnNTCMy0mhPyuzTURXIG5vMx1ebd5KlmukhHHll 1M/w== 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=IZj3v1SW4CS/dfK2+z6yc+Dtbx1/tbGykpj1YfOFLRk=; b=E78XIcThlLd1QVOMlf99s9QLvsu2r3rkArM8zjbzw8eEyjdRwOGr9ykH2bkjhIHfm7 b9m5aJjaMzQztfpocmIIOPl5jHEdVuW/9OlW8ikBUY51uYNcnhVaefyknwXOQz7ZEfPd fcc8QDox/NqoJnZQIk7Jl9ubbdTo90hofZ6rQFXeFLzw7vHfirCMJtOGXpW3tdXQotqB azWAX4hIIiBPk9Ok1e+MBWnaoPpMR5ArlqEWLfuj3NrjJWDQw1mFQmDcKLHu5Ff7Uk+v S+cWXbnt44/4DhFgsdUiWtsd6zM8GDJQjvUnKRNaHz3mW+vYiGnQALK8oXbgSv2sQM8v YRjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jCj+8VG6; 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 q13-v6si23310790pgq.526.2018.10.19.03.53.48; Fri, 19 Oct 2018 03:53:49 -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=jCj+8VG6; 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 S1727242AbeJSS7N (ORCPT + 32 others); Fri, 19 Oct 2018 14:59:13 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:42224 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727178AbeJSS7N (ORCPT ); Fri, 19 Oct 2018 14:59:13 -0400 Received: by mail-pf1-f195.google.com with SMTP id f26-v6so16315716pfn.9 for ; Fri, 19 Oct 2018 03:53:41 -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=IZj3v1SW4CS/dfK2+z6yc+Dtbx1/tbGykpj1YfOFLRk=; b=jCj+8VG6l9AH69XTMJY6zE7PAKm5zlf0reQKiCaZ1hl8Kp4Sl3zhyQsCny4/2NKwsF 59hmweq5vwTIziFMfW91uNvtuCab873/lRepjzYeUa/pntNEwmTl9/tikYDXei/M7t7L NFyFyVlnShPTMsEZ2j0W/ySwz+0OT558UEFrk= 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=IZj3v1SW4CS/dfK2+z6yc+Dtbx1/tbGykpj1YfOFLRk=; b=P8sfV0awqJuRhzL4O3EraZKp0vMCRnj16OTsPzEl1U7+s/bqebOpo7oEFRJV+41VBV jemmOKchVdnCyi9uXCaSxNo8ON2nCPZGqZGwoeN1bWnSOZ1gQXySg/VWRq7Iu/mQedy+ JbIVx0O7yLplEspDERSRNoqZW7As14BB5thlF2l+we7rAKCqqQbJwJFm/e0ckTRUQmTw gCFnrlOtT2qbCCzczFQpwikqkpHYzUFuy2irG0D9Cxe7ksykGSmQGt7UHud5AuRJ8XbK QjTS3FOMmG8oBukweUmNbu8YruvO07ptO/dFrkOy04YesqkLEBsAXPvC3fl2PMVR3ZS2 978w== X-Gm-Message-State: ABuFfoji1MUr7QFxqAHBgmjcd/or04Is5bTz+NOVKRXKIdzihdMxQ3oG 3z/yCepDXA8Asm1tPFgUaqt0vQ== X-Received: by 2002:a63:cc:: with SMTP id 195-v6mr31477894pga.44.1539946420740; Fri, 19 Oct 2018 03:53:40 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id m67-v6sm54918pfm.13.2018.10.19.03.53.37 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Oct 2018 03:53:39 -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 v5 3/6] dt-bindings: power: Introduce properties to present the battery OCV capacity table Date: Fri, 19 Oct 2018 18:53:12 +0800 Message-Id: <3a0c6487c9503cf64432f630e65790cc5c3f70ab.1539915051.git.baolin.wang@linaro.org> 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 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 {