From patchwork Mon Nov 5 07:39:07 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: 10667511 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 A983617D5 for ; Mon, 5 Nov 2018 07:39:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 981E9295A8 for ; Mon, 5 Nov 2018 07:39:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BCE7295D8; Mon, 5 Nov 2018 07:39:39 +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 30F92295A8 for ; Mon, 5 Nov 2018 07:39:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729655AbeKEQ5y (ORCPT ); Mon, 5 Nov 2018 11:57:54 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:45120 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729634AbeKEQ5y (ORCPT ); Mon, 5 Nov 2018 11:57:54 -0500 Received: by mail-pl1-f193.google.com with SMTP id o19-v6so4011988pll.12 for ; Sun, 04 Nov 2018 23:39:34 -0800 (PST) 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=j2tmUgh6tRu6QqzVSQLrFCxkt/YAU9SuinNlw7cTUGE=; b=UhZiNlry/KXodTpr9qhU/8IkmbDzfvjCqlQWKTrGVJvs7F5XvczSTRFtdQ/ujwo8LS VaBB7GJ1eRxdJ57vsgCM7FXu/O3AgyvspchwxTXvBdDEZvq9oTIBfV7BHoYaRBkxX02a TEVC5b7IHUf52qwp96YzKDKpukJdQLWBUS3hM= 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=j2tmUgh6tRu6QqzVSQLrFCxkt/YAU9SuinNlw7cTUGE=; b=BKUkHVVO3chypZuPUwmc08i8QEkXOP6eaSBreCAVThdkFSMah/ViPb1K9mnV/LXrpF FUX+6tNE83fn18Ojr9Z6r0KysooaWRlm1AmqU5AaG5TBN6KjkyPl6RBCcnLyKy9YAtX7 UwMajcAROsi0qVikIjv/SChTHtAxxabe/d9gBrdP8FfszhLTOcfHh56uXP3CHiCYZNlo 3Cx+W16P1LqJ/3VxjKRkGwoybd+/4/RYDmm7quqCFYxBmBKuPKwdYb6/HCQP4oKQ6nWy SRyO8W2tm4c5xr8cuPXK4vuhz88dPT1VFS/A+HfpjZRCYb0SuUlUwDZhqGnfr/srJ5/u eJfg== X-Gm-Message-State: AGRZ1gKajXFMinl9AgXZbbffPXyRCYPVIxQcjtqLIjN7MdQP5TgXZhv5 pY6A/3CuiRgw+GWKeU0vrHNtpA== X-Google-Smtp-Source: AJdET5fRuLIjHGiKwaiAWhaOw3teQLIuemIi8ZX4evJ31W8xc5KIhGsHoRfuutnM15IPMh9CatzBjg== X-Received: by 2002:a17:902:32a4:: with SMTP id z33-v6mr21057060plb.85.1541403574125; Sun, 04 Nov 2018 23:39:34 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id d5-v6sm27632040pfo.131.2018.11.04.23.39.30 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Nov 2018 23:39:33 -0800 (PST) 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, quentin.schulz@bootlin.com Subject: [PATCH v7 2/6] power: supply: core: Add one field to present the battery internal resistance Date: Mon, 5 Nov 2018 15:39:07 +0800 Message-Id: <5253c12da08295914dda82d47a130916d0ed0407.1541393063.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <5640f29e0b7f46f9ee77d80745f8c93eda355c34.1541393063.git.baolin.wang@linaro.org> References: <5640f29e0b7f46f9ee77d80745f8c93eda355c34.1541393063.git.baolin.wang@linaro.org> In-Reply-To: <5640f29e0b7f46f9ee77d80745f8c93eda355c34.1541393063.git.baolin.wang@linaro.org> References: <5640f29e0b7f46f9ee77d80745f8c93eda355c34.1541393063.git.baolin.wang@linaro.org> 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 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 v6: - None. 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(+) 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;