Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp217554imm; Tue, 25 Sep 2018 20:00:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV60qLCgDqxsvwHAvYMgQH4w4Ns5CF4iE5dWYZoOSeKUwFkrGIBUUloVzzjyqi3mEgXMc8CZ2 X-Received: by 2002:a17:902:ba8b:: with SMTP id k11-v6mr3983060pls.12.1537930825665; Tue, 25 Sep 2018 20:00:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537930825; cv=none; d=google.com; s=arc-20160816; b=xOhl5q8EjQxrgGpYFGxw9GqPVSC6yCtK8E9U/JSM0qmAoww+fAZoem8T7SL4w4UeCg ExsiCQ2HjjXdn5kwKMkr2nH7w+7Ce417/Pn84hlXWfZSi4FAsKg7Fp/yW9B3ScdMZzVE uqBwcuyenDLgc8Yxjbaqt4Uga7XEVYUz7SYpH1i8lndb/qL/bNxPT/yMQiQXGE28GTp5 8SjTt2gRnaDpEnMlnCkqNX9W/18WlTl/djJQX4a1McTvQQHOTWmJWVl+qlwsL61bxf93 VHM/yDVw9z3MfGNQFHyby09CK/OkYJYOtbofy2yNWSRI8bLpDx1ZDDEJjSxukd2IhZBZ lsvQ== 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=C683NJzRjGNOhU3KRWttGdic5R9Ub04NEzSVb+GXFUY=; b=D+yY0LdbS9Bs77hhD/LEit3uQugbW002I1DiKF/h+DHBcfmIxGlbER0Z9SHs+yjYfP EUAZmb8oLTPkdtgozfUG9s6/fP9BXhfRteEZvJSvFgCiAQ0HuPfVpI52Yk2TbuKET/he OTBmej00WZTXqZ5rBet51nSPdqVnxpWmQkSiJsBrbZ5EyYn5Iw3ypbYU786G3jeuUd1E ds/jFvpmoKU47Bk83mWHHDV+75xmbgjCs8Xx4URmig1d0Sx9KyEqJ8gtic1UD5eDl1pr 7SY0sTkHatgFSgCkQPZIWaOXgX8pKi/qOcjCvE8V3U0QBH3b26aO6a6a+yA+K2bIrja4 7/QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gxVIQnhT; 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 c5-v6si4175319pll.414.2018.09.25.20.00.10; Tue, 25 Sep 2018 20:00:25 -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=gxVIQnhT; 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 S1726602AbeIZJKi (ORCPT + 99 others); Wed, 26 Sep 2018 05:10:38 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:39754 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726242AbeIZJKh (ORCPT ); Wed, 26 Sep 2018 05:10:37 -0400 Received: by mail-pg1-f196.google.com with SMTP id 85-v6so9939365pge.6 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=H7Astf7NH18zjP/q+7J6Xvl4A9wLXG1jy+tG4+2ls7RT8M/Swwjtt3sNrZZWsTcLke X3a5jUo2eCQ46/F3K4c2o/Zh5cqHAvrA89lF1JY8lC7ZcfMPU4uKPh/bsyOFS7dcyRHL NfXWCzJ2MTV9ximhwccDeh4WQH0+l3UnWOeyIF2HqAlFygglk1GZBPAI2iofXu8f5Gkx vmzkA6XbOCw13Vf8AyAnI7+Jg7ilWQ4skaHCxKOTRUWidBMqSJyrTcPKMFeqDd33cyV4 6nBbwg9zCraAoArrhqvbE7yqrldyew9J0+DioKFJD8vBzpMN6O93Bg9wvJi4B4OhHNQd dhmQ== X-Gm-Message-State: ABuFfohbVKu8VBO7hwDUmN+pKZOXNgDO0EK6p/oq1J9OY0HNR4Dp7l83 WACoRpM3+VuS6quhw/8vc3Un1Q== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 1.7.9.5