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: 150144 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2286264ljp; Sun, 4 Nov 2018 23:39:36 -0800 (PST) X-Google-Smtp-Source: AJdET5dC5k+bpwfIhdOuCRKYMdTpeKodsgXZfzIW+orcZgtk39TWEyC+4a9GBZreLau3HyNh0Qqc X-Received: by 2002:a17:902:584:: with SMTP id f4-v6mr20919227plf.132.1541403576546; Sun, 04 Nov 2018 23:39:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541403576; cv=none; d=google.com; s=arc-20160816; b=BIDx1ZrXRzTq8+Tu/M1I8KwHZ4lvghfRvPCHTpXK608c1tntCS7gpcmQ2ruhx2aK2i FGaxC2SnA/ZGgbs6pV85as8ADsXrSp45+UbYpQp5XkiaAN6ZtAx2UmkZquCiYJ9Yz7sH DEZ2DNWVhcchaQj+pGE34ZgkUbIz5/gbWWg1eMLJxQT0KEuxfMLP1tdgVEoZBi8MGS/8 JDKqG9fBkTs52KN2gf4N+2AdkbubPlIPc4Enkj3vz4CvZgTbeLDzet75JxAtqJX6vHuf xPwz2GPjjr8xa54Oo0uV8JS6IYO2lC9GcoeQpBV+zVjo7utSTDwT3Ty1yIpNwUNjl6xx KY9w== 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=j2tmUgh6tRu6QqzVSQLrFCxkt/YAU9SuinNlw7cTUGE=; b=hhzKXxn+MO/c4Ef5Mp2A70fr2rLJVy1PjKFjvxYL36oSgSnQlVPO6PI/p1hHfzaWpp RkUqLqSADRGz0DEbDNAva4lz7rzXktNHPT2REfxVisM4dBFTfD4WP7EV7pPzrcY3fUdd +XGY0KIA5e5RCG9TK2c44wW3RE+wUMIlN03mnFwnhNtURPfqPv7r1KYIasHs1HIzDIWh XkIk+EinZKjz7oz7SZra5rsCPLmtVfZBWuHAxJztuvxIyvYZ6SHskf6LOnbE8KVN/csP rB2UJJePx9DN1qv24KxB3k04T0hlX79UBGrK5LczAtIi2zJQfz4+Dg7/0o2tSh0EChL3 Ltrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UhZiNlry; 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 o31si11791561pgb.273.2018.11.04.23.39.36; Sun, 04 Nov 2018 23:39:36 -0800 (PST) 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=UhZiNlry; 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 S1729676AbeKEQ5y (ORCPT + 32 others); Mon, 5 Nov 2018 11:57:54 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:35703 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729496AbeKEQ5y (ORCPT ); Mon, 5 Nov 2018 11:57:54 -0500 Received: by mail-pl1-f196.google.com with SMTP id n4-v6so4035452plp.2 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=K8dRW43cE7mprA6S6IWMKJchp+EnYX7FrY59GU4n5p2hH0Syd3GPSPIgVAT45XJOko SJYfnv+LDRETHM18IcvX8o14Zh2YlQnp+TR60xVmF8ELwY19JV7bK8YT8flHMFWMZERr kySAA1wP+2+AG4+QxAC9gnbG72eFcuOWbwDUIWN8J2/H3oxsGYZzGcGEyWhY5u7Nix2Y QvcbVD81j/Csb/623r39VSJ/yMQEdggtLW9k8Y9S1EDGnaQOJDFGP5dLECV/DxEn6yCr 8TFxyQGY8zy1QFUMj+6nmn04GW5r4ynPvBaNTXx+gO0Rc3y5MMqXipGayt0/M9BWcvAW ouIA== X-Gm-Message-State: AGRZ1gIlYuNFPEtGLWC7pDJl4rrdl4zoURRDeg43A1Jmf+Tg2xkAw4YJ U0cNcN6QnIk2yeuC9fvS6fkA1w== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 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(+) -- 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;