From patchwork Mon Oct 22 07:43:57 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: 149374 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp2317821lji; Mon, 22 Oct 2018 00:44:30 -0700 (PDT) X-Google-Smtp-Source: ACcGV62+0GNpeFlDwWt9r0J0i1zu9bVQVjy+41Tpx2iNaMAhr29O/gxBj5DXKf4+wk/Z2E1SIsG3 X-Received: by 2002:a62:2683:: with SMTP id m125-v6mr20467612pfm.74.1540194270254; Mon, 22 Oct 2018 00:44:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540194270; cv=none; d=google.com; s=arc-20160816; b=zwQNt6OWhIC1fbUsF78Ra+gPAVDxnSuE0OcmbDx5h/J0taTcErW8UNZANafRW0JcPl 0RRox29/5YaLiMCJuboCeQ6mbjRY6Vj5GFpF2YjRrACwrYT1ASnZEQdMnrUHWiBBHtEF pDFnq2cDFrlWNHpWdbtHkW2U7RRCm7YuZZFXYlaOR7kK3aErbz4i/nivaNqt9kRMqOuM vkFkrC+46c89vTaDl7vhleOAg4DdRQ4UNW5seWacb60wvZjjPO3wbYjY3kjELtq4TyIe tlmWv5qfQKFfmQ4XSofAndzpfUATiMff/EuHHwx1toKVCYuCJHOYgVR6c7UqWdEUuN7X SJHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=HxdXYZYCNB4J2ZC97d1xBOZ7FLXQWXjI38HmOhTVoSw=; b=wyTMyqIeSDYopwfUPJK5GHdqB3SHfEkj077YpZE7y5nAtKV4smYKcogduetmc0JJ6u xbpeDcHSnK+fRbH3KwJsWy8RKbspB8F2avexqX0O/wXcFeoQsUsec3aGPZgGzNbL102Q uh7/ibFyqmig3C4PaDyhd3kT823m+aJz59gT7QjgN0fTSGPCN+WUb10R0btfLHBNfkXi nD0cjrmmffM+mpI2qn8fCZ/AvH+3uH51/Sd23QubQFCtu8oYQfRTXQURAfooARnm6jxX hoeZn77CRcmgBycPYj0uvf6S/BZcYuknwBZOJpOexi6PPfLT1YTbhgDNjd30pfYm4rAe TtAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aAalhCiN; 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 n15-v6si34054941pgc.143.2018.10.22.00.44.30; Mon, 22 Oct 2018 00:44:30 -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=aAalhCiN; 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 S1727638AbeJVQBv (ORCPT + 6 others); Mon, 22 Oct 2018 12:01:51 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:40725 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727458AbeJVQBv (ORCPT ); Mon, 22 Oct 2018 12:01:51 -0400 Received: by mail-pf1-f193.google.com with SMTP id g21-v6so12481068pfi.7 for ; Mon, 22 Oct 2018 00:44:28 -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; bh=HxdXYZYCNB4J2ZC97d1xBOZ7FLXQWXjI38HmOhTVoSw=; b=aAalhCiNgB6Ioh/26yzv9I2bf+ho9BQ0HndWKi9+/y6mH4s5S3mgWxyPWC8/XR41pH Fpr/gDjLzNtBOtaNha6DaWAucPNzAV4TsgmJfJ/A8rcpgTBoCNDkCLVdV1IMxwuducJE LTk6UH4tZiIYYFVkBXeinvoKn54TUnb4o+trU= 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; bh=HxdXYZYCNB4J2ZC97d1xBOZ7FLXQWXjI38HmOhTVoSw=; b=FayM/W/C4ckC/qeevuo93vF8RcrSp3Aa8v+oy9lUcsvVWJ2pP3otIpFZVfzUNiWDnm eAmVzDXhQLHi+PBguPHfnn2y2ZLJKKm2lvWJdxpHaNPW9OS/WQJ6v4FipiBUPU/jisuv dbUnsBJjvO3XGRIrfKOOK1HzXoLTcJbM76E/mSh5UjP9ArX9/PclvOAPkdvtslPE9BO2 uyhUO4i6X+mol7a2Zb4dWoLUwJJ6VK3QXvx4h/UrYe4Kpp7vnbuln29arCCu3U7kMLa3 n9FmTH5A3/mXtg+NM6ibjf69/eYcqA8l1cABM3IdTwpEapMRhl4WBGzlzffBXOOTp/aM Ekcw== X-Gm-Message-State: ABuFfohvhVcWsIWBnz15CEsA8UNXiDs3Tk1X8gzrHd2ybpWU6cDFVRwM yVBI0RVp5Cy/YQH5h39Z0occaQ== X-Received: by 2002:a62:f909:: with SMTP id o9-v6mr44870245pfh.160.1540194268355; Mon, 22 Oct 2018 00:44:28 -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.24 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Oct 2018 00:44:27 -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 1/6] dt-bindings: power: Introduce one property to present the battery internal resistance Date: Mon, 22 Oct 2018 15:43:57 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The internal resistance of a battery is not a constant in its life cycle, this varies over the age of the battery or temperature and so on. But we just want use one constant battery internal resistance to estimate the battery capacity. Thus this patch introduces one property to present the battery factory internal resistance for battery information. Signed-off-by: Baolin Wang Reviewed-by: Linus Walleij --- Changes from v5: - None. Changes from v4: - None. Changes from v3: - Split binding into one separate patch. - Add LinusW reviewed tag. Changes from v2: - Rename the property. - Improve the commit message. Changes from v1: - New patch in v2. --- .../devicetree/bindings/power/supply/battery.txt | 2 ++ 1 file changed, 2 insertions(+) -- 1.7.9.5 Reviewed-by: Rob Herring diff --git a/Documentation/devicetree/bindings/power/supply/battery.txt b/Documentation/devicetree/bindings/power/supply/battery.txt index f4d3b4a..938d027 100644 --- a/Documentation/devicetree/bindings/power/supply/battery.txt +++ b/Documentation/devicetree/bindings/power/supply/battery.txt @@ -22,6 +22,7 @@ Optional Properties: - charge-term-current-microamp: current for charge termination phase - 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 Battery properties are named, where possible, for the corresponding elements in enum power_supply_property, defined in @@ -42,6 +43,7 @@ Example: charge-term-current-microamp = <128000>; constant-charge-current-max-microamp = <900000>; constant-charge-voltage-max-microvolt = <4200000>; + factory-internal-resistance-micro-ohms = <250000>; }; charger: charger@11 { From patchwork Mon Oct 22 07:43:58 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: 149375 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp2317872lji; Mon, 22 Oct 2018 00:44:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV60VBGBFNM8IuP9Y4u5B8s/n7XxL8sdaD6QUGCK3e1g+x96WwQ8JUYuHtghrmA5QJ0ZmWu8D X-Received: by 2002:a17:902:6684:: with SMTP id e4-v6mr23518838plk.173.1540194274638; Mon, 22 Oct 2018 00:44:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540194274; cv=none; d=google.com; s=arc-20160816; b=flHxUdzIjav/UeUbjkaECcvFj3uXYZRZ58PQoQPHa9gDYbZU7Gjsuof+gjrR8rIyuf /UO4UASvT0b46Es5aZ+Je9xETHaDERAPGKhn3wffsAaMKFJYXAMSjFpy16gYD5QTbTPM 1913odAiMCPH0f8TY+nStW6lAH/g8cYYcZemYKw2XALGWjUJ+1ig2R7QCngRK5kJPfQV SlcybKYWpN5jLlXXK4008+gvyn6INtzakW47OceCg7tItJ/i6/i9yHAGWMvinczp9JW9 pxJYSUoNRS/O+s8rWsiNa972QsnDN0p1/K29lZxFCYkgCWyff9b2eEwpXMuGoRkCzn6K rcAQ== 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=guur6UyotJRvkPcD8qm7dKJt581cqentxqfsCagosRE=; b=Wnvv//db93aideBB3WTe5qIy3KREpZgFnJpmz64YpgwUga55cwdLVfSwXjRIEyvqdL dL4/sUQAI57kaH9L0jNd7Dwt/iVX8beli3DcRYD9D6Rbg+5pfw2NJ98eW6nkmKQ6i2iY 60t70kSV48wqNUkverELd8QcfoNi9JSmRxqnL+aVaatygceKL/xntW/C425hMuZIebC2 0BSiRR3D3k+2iqpCN/Djf129TSS47e2bc4HMJljV3kyyFqGE3YWZT5Q28RqCtmlKoP1y Jt3imL+xfC1zIiBcy2igbEXJk3/SbgMLk6mKkdbvDWe2XWX7Df0UOuMRHlaQRy7ZzG6A Dm5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ER3ytPTW; 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 u21-v6si33002930pgm.406.2018.10.22.00.44.34; Mon, 22 Oct 2018 00:44:34 -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=ER3ytPTW; 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 S1727783AbeJVQBz (ORCPT + 6 others); Mon, 22 Oct 2018 12:01:55 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:36564 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727764AbeJVQBy (ORCPT ); Mon, 22 Oct 2018 12:01:54 -0400 Received: by mail-pl1-f195.google.com with SMTP id y11-v6so18676153plt.3 for ; Mon, 22 Oct 2018 00:44:32 -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=guur6UyotJRvkPcD8qm7dKJt581cqentxqfsCagosRE=; b=ER3ytPTWaZVWB6HqyvTwfVfqbgoKAzRbeWzpCxKitcikd8Cdvar6URv9XWUmN5zExI B7jTB6oTwFC76x6teGcjynI5RnntVwpGqOUP58SNiISEk6KbJwduBSoUznAGC8lnv4SC SKjvsQMKxELkX543I1hDl3bJI8eFzqPsd6+kg= 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=guur6UyotJRvkPcD8qm7dKJt581cqentxqfsCagosRE=; b=TJoZJnNNvBuspZNDNJpDxkS1aPkT0K5CMglqjId+Gf4s7Z1PR9mT+K+O7Le40Ijq8Y USQ8K7Umkwv8OESgCnTvi/Ef7VWInR7e5Vzs56DhPiPVUV03fr1wVCpGqnWLdzc7CGQw Il095bF8G12ocDuwnAxQXRgsz3ooIJFj+Nv0ZXL4VsOu6cXO01hPoJj1woN5zC8OFZkM VyoePtmDqs0q/zgBQF+u52OUd9U5kidnHL9KQ4xcMaK6rCEB665e9cmdmn82WTUS9Kdj 5L2j+8j5NXtn0PcydISwcfYI5KCrHhywsSglrXBf194xTnQEFo0eao7PhWSD30BYMwz2 H9IA== X-Gm-Message-State: ABuFfoiDxg5okD/XsZeXp3/XkV8pHo6y9PFtQg8lcAic2yNzOwFYfnrW MH/txfgvaBUIw7wZaQxQ6QuL4A== X-Received: by 2002:a17:902:d01:: with SMTP id 1-v6mr44237644plu.88.1540194272040; Mon, 22 Oct 2018 00:44:32 -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.28 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Oct 2018 00:44:31 -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 2/6] power: supply: core: Add one field to present the battery internal resistance Date: Mon, 22 Oct 2018 15:43:58 +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 Add one field for 'struct power_supply_battery_info' to present the battery factory internal resistance. Signed-off-by: Baolin Wang Reviewed-by: Linus Walleij --- Changes from v5: - None. Changes from v4: - None. Changes from v3: - New patch in v3, which splits code into one separate patch. - Add Linusw reviewed tag. --- drivers/power/supply/power_supply_core.c | 3 +++ include/linux/power_supply.h | 1 + 2 files changed, 4 insertions(+) -- 1.7.9.5 diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index e853618..307e0995 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -579,6 +579,7 @@ int power_supply_get_battery_info(struct power_supply *psy, info->charge_term_current_ua = -EINVAL; info->constant_charge_current_max_ua = -EINVAL; info->constant_charge_voltage_max_uv = -EINVAL; + info->factory_internal_resistance_uohm = -EINVAL; if (!psy->of_node) { dev_warn(&psy->dev, "%s currently only supports devicetree\n", @@ -616,6 +617,8 @@ int power_supply_get_battery_info(struct power_supply *psy, &info->constant_charge_current_max_ua); of_property_read_u32(battery_np, "constant_charge_voltage_max_microvolt", &info->constant_charge_voltage_max_uv); + of_property_read_u32(battery_np, "factory-internal-resistance-micro-ohms", + &info->factory_internal_resistance_uohm); return 0; } diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index f807691..d089566 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -326,6 +326,7 @@ struct power_supply_battery_info { int charge_term_current_ua; /* microAmps */ int constant_charge_current_max_ua; /* microAmps */ int constant_charge_voltage_max_uv; /* microVolts */ + int factory_internal_resistance_uohm; /* microOhms */ }; extern struct atomic_notifier_head power_supply_notifier;