From patchwork Wed Sep 26 02:59:11 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: 10615173 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 EA85A3E9D for ; Wed, 26 Sep 2018 03:00:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB0802A933 for ; Wed, 26 Sep 2018 03:00:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCE8A2A971; Wed, 26 Sep 2018 03:00:23 +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 6B9862A971 for ; Wed, 26 Sep 2018 03:00:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726536AbeIZJKi (ORCPT ); Wed, 26 Sep 2018 05:10:38 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:43811 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726534AbeIZJKh (ORCPT ); Wed, 26 Sep 2018 05:10:37 -0400 Received: by mail-pg1-f194.google.com with SMTP id q19-v6so12142425pgn.10 for ; Tue, 25 Sep 2018 19:59:57 -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=C683NJzRjGNOhU3KRWttGdic5R9Ub04NEzSVb+GXFUY=; b=gxVIQnhTc1JhfGjxOi0iWJwXD69vXw9++B7ukjRwTl49cPqYE+31s2C9ATysXbcq7I ODOa9yj3nldLkLlOI1JAsqDZm+YinL5cKV6DWu5pDF6w3bidQmL9c/xuEdu1cK99IVY/ zdozqmIgEp+8ASqN7VP4uDm5dMUJFTbSNtcJ4= 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=C683NJzRjGNOhU3KRWttGdic5R9Ub04NEzSVb+GXFUY=; b=WTmQWQ3T3h2b+FNDFnR4rcJ9UFN6PD4t2yIs/gMm2vPFrRGbhVkNhwbOJM6wovEflk DBoiKFWbScLHzTX2LI4sTLZzv46qFmVMDQM0yg0tqY9p4WFxdegVcDjS+Lmr6VLrlmV8 zvEZowakdd7usXDn3UOX9qrUSePlHHm8ZAk0EDjeveVMFmworblM6QVplFIMxAG+1lz4 Qnoq+GBmsiTr92zptuR78gpsD6pQ2gHSBf5MUaKAehL3pEqSRhuQDkitB47ZUMWh6j2T pb1IvwvfwJt91o9oFhMxRAdEplMn9BrKpqPyK5OSvMKISOjeIFqmYwOIXv60jK0zOPfb rZCw== X-Gm-Message-State: ABuFfogwfgBrnxfaTJchQGEs4PRXx3RZxvURwbdydGs1dKFoYukPJI9n ZUErVyl6x0rQi6K4hiQLHfEHPeURmJK8gw== X-Google-Smtp-Source: ACcGV60qHI5orHu2lAWMnHCKedcKt0q5Uo2M/vQT9aHOz5x54y9R2zWc/8hpTUxJdT1+uzqcuo06LA== X-Received: by 2002:a63:7c1d:: with SMTP id x29-v6mr3590885pgc.273.1537930796746; Tue, 25 Sep 2018 19:59:56 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id s13-v6sm5471703pfj.105.2018.09.25.19.59.52 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Sep 2018 19:59:55 -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 v2 1/4] power: supply: core: Introduce one property to present the battery internal resistance Date: Wed, 26 Sep 2018 10:59:11 +0800 Message-Id: <358665e3f4f9ec105dc2f8a2dc6dd98dbe761fae.1537930252.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 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 Introduce one property to present the battery internal resistance for battery information. Signed-off-by: Baolin Wang --- Changes from v1: - New patch in v2. --- .../devicetree/bindings/power/supply/battery.txt | 2 ++ drivers/power/supply/power_supply_core.c | 3 +++ include/linux/power_supply.h | 1 + 3 files changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/power/supply/battery.txt b/Documentation/devicetree/bindings/power/supply/battery.txt index f4d3b4a..25b9d2e 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 + - internal-resistance-micro-ohms: battery 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>; + internal-resistance-micro-ohms = <250000>; }; charger: charger@11 { diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index e853618..9f3452f 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->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, "internal-resistance-micro-ohms", + &info->internal_resistance_uohm); return 0; } diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index f807691..019452d 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 internal_resistance_uohm; /* microOhms */ }; extern struct atomic_notifier_head power_supply_notifier;