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: 148810 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp3507379lji; Mon, 15 Oct 2018 01:10:48 -0700 (PDT) X-Google-Smtp-Source: ACcGV61taH+ucW4C9/Ri+xwAfIfoG5Dw9fbmOgSh1hOpdZd5a0EXkPTqJi8FjS7wVJvIsX9LBIht X-Received: by 2002:a63:ed55:: with SMTP id m21-v6mr15205653pgk.147.1539591048101; Mon, 15 Oct 2018 01:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539591048; cv=none; d=google.com; s=arc-20160816; b=p7S8GuFBX2OGo05fuxyWmWkGWpzsF/TboLreG2lyeOMzKL7kSqnUGYZ6PiN0E84pyY oT+NiA/Wsu/Bmpyw6vGFWVvd5d1ei/NZ+JTJzkxZwIv5TOmpvyQ/5U5g1LwpX3p0LNfe fW+iL/Q1qCZ8mmLj+nuCp1oIRW/Uxb3YmSSa+JzM3PxRKhJFRkszWbZZHx4dx+Eb2Pmm A/vNFfYHW+1WjxfbFxHPdgwCPWx3U2QG2dJednuDNorZuR/DzH52w2NxMGPVlJCKMDqY U36XMJpxBvRVSI8aqcrc4gRmlipYfdw6nJXDB/NgVNa2EnbK9ubVG6JWjuC+98VO3UfJ W/tg== 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=HC8XkTxJRG17KpjdZe4ovBgjZ2ny4xd9NpWg/fY7N52Sx/RkH/jXA6G5NAVdNlGkzI KMO+HlhyFSNz/ko+5h3T6AaP82ylKjl1yw+IwulnHPG+JY8eSIMvfHw/JY4QfwSNnAHX 0oGNCGeY7SXSZf6Fi3s52Bug0HTIyeobVAq5rZRRSowsSddBZqmqggiyQraf7bKELmaC PQuKSlKUafx/ZsP624+hs/+X8i4kGHHp7e8OaNa35KcwOxU7pW4YF4PZ9XAKHT1eHwXe /Pgl8Banme16ljppF3cZrjTILKWhtMxgJKeSbo9GWR83xeCsrI+0B/M7iPMJsxKrUGFL 0rxQ== 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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 z11-v6si9854958pgo.470.2018.10.15.01.10.47; Mon, 15 Oct 2018 01:10:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 S1726862AbeJOPy5 (ORCPT + 6 others); Mon, 15 Oct 2018 11:54:57 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45329 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726718AbeJOPy4 (ORCPT ); Mon, 15 Oct 2018 11:54:56 -0400 Received: by mail-pg1-f196.google.com with SMTP id t70-v6so8777409pgd.12 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=E5debtiJI9xkqmekvuKNtd3iJ1kUwl7mgkOM4oDouQEkZegRKnTdAShUO1L+EfpIiK mD0RQn4Hsbj6g9yW1mLiMLfiqc0gsxgesG8JPcPa4tlCP4JhymFro6cjvYU8FQI4+mSf AbATjvb1yTEkrwQMDPvgQm2CLYHES3xCeVyBzTfeffaxKrIY9AwJSdBCnt+Buznis063 8h/aYcu3sguRuhuTxODFPbjDNTRqQQcNfI3LMvHC3Qj0FMdRujEfPy1wpcfqMO5qQ6Wd YD3w0DLmO2TeQAxa1aXgKT+Lm46Ruq/3IIeFyP8UEtBpC9XlaZT5+0MSBTN46WdJTdze 2yHQ== X-Gm-Message-State: ABuFfoiTJ4aDyCAc1PdBOmu7JB++BFKHGKrb2O9KGTCgFY6SBp0S8swM xsiuzHMYcrgkADJ6fPj/EybpfuwoGi3yqw6o 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: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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(+) -- 1.7.9.5 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 { From patchwork Mon Oct 15 08:09:24 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: 148812 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp3507485lji; Mon, 15 Oct 2018 01:10:56 -0700 (PDT) X-Google-Smtp-Source: ACcGV60qB8dPwfpMafYUA5J06uLIitOwLpdcxezu3i3ypwuJFKXUW0EYGdpF/47qGldlsvZbWvDk X-Received: by 2002:a63:b518:: with SMTP id y24-v6mr15271149pge.436.1539591056547; Mon, 15 Oct 2018 01:10:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539591056; cv=none; d=google.com; s=arc-20160816; b=zfdfcZx455+8NRLMosIVndg+nQmoI3ZOA0gaMyHhaTkkIGQEsjf79FOkcUOfibJVFt dcRvnaDRy5XvjvvAPv5z53YwxQA29dLGDtuYOk4JFUKkHT5GSolBt2iAZg5luaSIeyZX BcejCCiIC+RIBZY2BvipRBCIEDW0Y+awsRuLSFSkrLi8mmS1p4uVSbRMl8AIsEg5qze6 dQsCh7RNQ+N19AgX2hI0tGEenUr+AKrD3NyP8gHhZ45qUbQU5m1vZ3bWVQbwZqAJf79u W6CTB1pA2aXxNUU3g9TlnI0n4QWrISsjuR1E6gyga0ft026ESRdunzoEKSgKUoVJexKY HSFg== 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=MD9VCbYMsPzCy5AruI5XWxwxrKvHTLzOyYm9oZJSb+U=; b=WDwwWgZOFSwWz4WNHKTrL4/JTrMpD1X4xj5Dq05UgTcD6NQX2OmCoaiolxuKgfecy8 9qjXH5yg+xgOeIcfIOd3rvUADE44oJHOqUCJiq6OeXm1kOZCKirpk3BomT2M1c/Ya6V/ y1yii6P221EDCPU51XDlr5O6b2logxOZzaX5aOp2Ir2uOUvTvuWlf8ZAxy37ue2v0w+b sGAYC5MJ0Jr7q0gK8jWxdHm2PJMYTMyOx25MHBSzuZ8nwrkrrTZOF9qqI63CaxIeaZf3 /LwsZUhd2G/Ea0t+HnKA9F+zIIODGB/bZClp84ns4M7dclJ5UJII87qIwc+jUxrLZkbr 4GwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GGpW6USU; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 b1-v6si9969160pgb.553.2018.10.15.01.10.56; Mon, 15 Oct 2018 01:10:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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=GGpW6USU; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 S1726784AbeJOPzF (ORCPT + 6 others); Mon, 15 Oct 2018 11:55:05 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:44733 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726956AbeJOPzE (ORCPT ); Mon, 15 Oct 2018 11:55:04 -0400 Received: by mail-pg1-f193.google.com with SMTP id g2-v6so8777378pgu.11 for ; Mon, 15 Oct 2018 01:10:54 -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=MD9VCbYMsPzCy5AruI5XWxwxrKvHTLzOyYm9oZJSb+U=; b=GGpW6USUoWrm+IxxdX+3dxILIV55heU2m86aR/lvjDymMg4dgdGDQ+En9vhfgA6iYz l+z8m23H9jaCyb5JKn3QR1O4EcFNyQQfMNlTgs/YQIH3W/d4v+mYig3FXazMmv7zUjn8 8S3r+fR69tH7bDWwqWUWVkAsLWBtVWexDI1F4= 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=MD9VCbYMsPzCy5AruI5XWxwxrKvHTLzOyYm9oZJSb+U=; b=ZRlfBPKCCDcInjbUY5/9+HaZaT/X8X4k1h0pb1ASpiAy05GbYdj9klr3mu01DFGAht KuAQz1UqezNMBKynX5Co+HbJZ3gWnIlETOGKHEeoDe1Z8NLff0zgKkBsmHSH468OWQM6 Rcvm1Z5YtRfcs7ScVBlydlVF4rkGWfBqEqINVs0EERknsdsk0s8ltB7zWx3RTq/eNptN JQ3rvK0wNyY3zwFUPpZqIUAP4M3vEkMpW5ZepGjPNV9pv+91Lo6H57JFsDnvDpuO6Qon iMMnMForB561rYGIRO8rMBD9/5TxsyUCWcW1xW6lv26eMVpHM1e/W2UzfJCfxJJ/i7wI a7dA== X-Gm-Message-State: ABuFfoh/peBH+BGYrpZpHiP0yrFQWWOrG/ZrMS5LAe1X1WbpnGoK5m3g 3HHx/8SeW3sFU9SAdlxDgRO78gwqOdI1+bpA X-Received: by 2002:a63:3c46:: with SMTP id i6-v6mr15021222pgn.286.1539591053940; Mon, 15 Oct 2018 01:10:53 -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.49 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Oct 2018 01:10:52 -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 5/6] dt-bindings: power: Add Spreadtrum SC27XX fuel gauge unit documentation Date: Mon, 15 Oct 2018 16:09:24 +0800 Message-Id: <3aaeca63d2282d5dea1cbb2dc716cc736b0b0cfa.1539587217.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds the binding documentation for Spreadtrum SC27XX series PMICs fuel gauge unit device, which is used to calculate the battery capacity. Signed-off-by: Baolin Wang Reviewed-by: Linus Walleij Reviewed-by: Rob Herring --- Changes from v3: Add reviewed tag from Rob. Changes from v2: - Add reviewed tag from Linus. Changes from v1: - Renamed GPIO property. - Use standand battery properties instead of 'sprd,inner-resist' and 'sprd,ocv-cap-table'. - Remove battery node's description. --- .../devicetree/bindings/power/supply/sc27xx-fg.txt | 52 ++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/sc27xx-fg.txt -- 1.7.9.5 diff --git a/Documentation/devicetree/bindings/power/supply/sc27xx-fg.txt b/Documentation/devicetree/bindings/power/supply/sc27xx-fg.txt new file mode 100644 index 0000000..98a2400 --- /dev/null +++ b/Documentation/devicetree/bindings/power/supply/sc27xx-fg.txt @@ -0,0 +1,52 @@ +Spreadtrum SC27XX PMICs Fuel Gauge Unit Power Supply Bindings + +Required properties: +- compatible: Should be one of the following: + "sprd,sc2720-fgu", + "sprd,sc2721-fgu", + "sprd,sc2723-fgu", + "sprd,sc2730-fgu", + "sprd,sc2731-fgu". +- reg: The address offset of fuel gauge unit. +- battery-detect-gpios: GPIO for battery detection. +- io-channels: Specify the IIO ADC channel to get temperature. +- io-channel-names: Should be "bat-temp". +- monitored-battery: Phandle of battery characteristics devicetree node. + See Documentation/devicetree/bindings/power/supply/battery.txt + +Example: + + bat: battery { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <1900000>; + constant-charge-voltage-max-microvolt = <4350000>; + ocv-capacity-celsius = <20>; + ocv-capacity-table-0 = <4185000 100>, <4113000 95>, <4066000 90>, + <4022000 85>, <3983000 80>, <3949000 75>, + <3917000 70>, <3889000 65>, <3864000 60>, + <3835000 55>, <3805000 50>, <3787000 45>, + <3777000 40>, <3773000 35>, <3770000 30>, + <3765000 25>, <3752000 20>, <3724000 15>, + <3680000 10>, <3605000 5>, <3400000 0>; + ...... + }; + + sc2731_pmic: pmic@0 { + compatible = "sprd,sc2731"; + reg = <0>; + spi-max-frequency = <26000000>; + interrupts = ; + interrupt-controller; + #interrupt-cells = <2>; + #address-cells = <1>; + #size-cells = <0>; + + fgu@a00 { + compatible = "sprd,sc2731-fgu"; + reg = <0xa00>; + battery-detect-gpios = <&pmic_eic 9 GPIO_ACTIVE_HIGH>; + io-channels = <&pmic_adc 5>; + io-channel-names = "bat-temp"; + monitored-battery = <&bat>; + }; + };