From patchwork Mon Oct 22 07:43:59 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: 149376 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp2317919lji; Mon, 22 Oct 2018 00:44:38 -0700 (PDT) X-Google-Smtp-Source: ACcGV62h8G27FWf0o2Qx9Ua+pj5jiOG5qTD8ki2jsoB3r0oCAOdeZ5fumXPSsfBqKJqUkOpJ3eaD X-Received: by 2002:a62:1985:: with SMTP id 127-v6mr43500463pfz.51.1540194278456; Mon, 22 Oct 2018 00:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540194278; cv=none; d=google.com; s=arc-20160816; b=F41U5GT0rDeIzm5B79ii9xxfKH4gohKDaNCLCUQK71QvjA3q8/zMup6fBH8fdPH/Pk jFEAqR5m9p7SrKxKdC/Zmps1ied8wYX4AZQWd2apQzbFsyhNqSVL1qILqvmWjcfE2v9I TXQaN4gsOus/+PI9O6nFA6D1mw5RTY6gXCm7b9Sec4kqli4rSMPL9/8Fn+v2EQWi0gh4 pCLUiTOxTtPkirRlCnIUSqHyaCwIDvNDRjLAUjWkFWBGtpeKO+eYJooHbw/jRPipvrZI 6QfZJ6Ml5AVkFam1QWLng1jiQcNKS8/enfPikmBT8yKhp9DzX+mT1x6xG8lNEcQkPwv6 4uCw== 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=Rzrg3Nb5SBp7VXw/4XGUW1RnZO/wOXB9fjUvxLQgixU=; b=C7BCnVJHiBdkDH8HOc/glM3leI4+GPFHOJfqx72Xylfp0Cbr/H1eak24Xf8BrbDo0c ZhmbFtfY5bV2zd26AonuI9kvJAR3fJobt+5BNEtyp5miqcLrO8BcuOKHVwPy8dPSVBMf talGzGrFl0Eo0oUakgRr2qoAnJiIG+ZpMEOKCwd3fZte7kFfHPzMWUUH17d17U78O8Dq go55BdjNvJzUcSEktkUdcrsAHotMt7fMuKFkxz8XdakHcRAXvQnw/a2YTRkrjJFH09Ip kbg2JhlMz9c2WKN+p9miHqry/2gkWlMW8t/6Ker2XvCcqvq5cI6RR4JyEiVo7jXzeNCF 4a6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CNSutfge; 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 e193-v6si32528205pfc.131.2018.10.22.00.44.38; Mon, 22 Oct 2018 00:44:38 -0700 (PDT) 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=CNSutfge; 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 S1727850AbeJVQB7 (ORCPT + 10 others); Mon, 22 Oct 2018 12:01:59 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:33335 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727793AbeJVQB6 (ORCPT ); Mon, 22 Oct 2018 12:01:58 -0400 Received: by mail-pl1-f196.google.com with SMTP id x6-v6so1834996pln.0 for ; Mon, 22 Oct 2018 00:44:35 -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=Rzrg3Nb5SBp7VXw/4XGUW1RnZO/wOXB9fjUvxLQgixU=; b=CNSutfgeYez61SScuGiZBcS0sQx0HpKErIh5fP+To7wM2JI32SOunMCA8/x8jM2yUh VKfZpJY7VYNnwcP4RO/uawA5icXn/x0urmaoMLC4ZWOE5AacGLOTt5/pfFvBYy4WGIai AAZcz/UplOKkCsmP5pxU6NgnrzZyvIuyvhPmM= 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=Rzrg3Nb5SBp7VXw/4XGUW1RnZO/wOXB9fjUvxLQgixU=; b=dp36ltLsNbhFxUTYyf5Mi2nScBgeJN+bv+5DYaGk3cNmpCgj3eiApIX3a7ReFr2d9J IJo8N2Z/ODfGWf9XF+MuvgxFjf1hsSbN5a89OHPxrQKCReudreJXAmHHhqyDoqR+3Ggd C51ihIPPUKDku/hQwhFiLH5mMdIBMxz5Gag3VckhWjWU5sj2kSQXKFiFwinCeRl8LGDQ ebqlRhyhy7SNU5WvwQziL6zwiJkTlMu/0uAZ1wxKkQUyeFFcG/hWIMMcZqkMp3DLhrc5 DnICRZLSsf2Lsf3lA8hIF18nt8W7nBb4KyG9HusKtqZw1nRuiGNpPzErzPalfO8POCPK TGkw== X-Gm-Message-State: AGRZ1gJNkR9pR3S6UojXB9ESkMSbJWtdO2EpEY+94HYoK6ND3I3oYC3I DyTCY0lo7WW3tdWfWLT9x2kXog== X-Received: by 2002:a17:902:6b04:: with SMTP id o4-v6mr3255754plk.333.1540194275537; Mon, 22 Oct 2018 00:44:35 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id d186-v6sm43704253pfg.173.2018.10.22.00.44.32 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Oct 2018 00:44:34 -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 v6 3/6] dt-bindings: power: Introduce properties to present the battery OCV capacity table Date: Mon, 22 Oct 2018 15:43:59 +0800 Message-Id: <3a0c6487c9503cf64432f630e65790cc5c3f70ab.1540189330.git.baolin.wang@linaro.org> 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 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 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 {