From patchwork Fri May 26 11:04:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo i Serra X-Patchwork-Id: 9750357 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9D6196037E for ; Fri, 26 May 2017 11:05:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F51027EED for ; Fri, 26 May 2017 11:05:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80599283BB; Fri, 26 May 2017 11:05:04 +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=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable 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 163FA27EED for ; Fri, 26 May 2017 11:05:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S940125AbdEZLE0 (ORCPT ); Fri, 26 May 2017 07:04:26 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:38960 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S939989AbdEZLEX (ORCPT ); Fri, 26 May 2017 07:04:23 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id B497226AB4A From: Enric Balletbo i Serra To: sre@kernel.org, robh@kernel.org Cc: mark.rutland@arm.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@networkimprov.net Subject: [PATCH v3 2/4] power: supply: core: add charging voltage/current battery info Date: Fri, 26 May 2017 13:04:11 +0200 Message-Id: <20170526110413.24836-2-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170526110413.24836-1-enric.balletbo@collabora.com> References: <20170526110413.24836-1-enric.balletbo@collabora.com> 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 the parameters to define the battery charging voltage and charging current. Charger driver can get this information from the struct power_supply_battery_info and apply the desired value. Signed-off-by: Enric Balletbo i Serra --- Changes since v2: - Requested by Sebastian Reichel - Move to its own patch and apply to simple-battery framework. Changes since v1: - Requested by Rob Herring - Rename ti,charge-* to charge-* to be standard properties. - Use unit suffixes as per bindings/property-units.txt drivers/power/supply/power_supply_core.c | 6 ++++++ include/linux/power_supply.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 862fa8fc..a6857c2 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -530,6 +530,8 @@ int power_supply_get_battery_info(struct power_supply *psy, info->energy_full_design_uwh = -EINVAL; info->charge_full_design_uah = -EINVAL; info->voltage_min_design_uv = -EINVAL; + info->charge_voltage_uv = -EINVAL; + info->charge_current_ua = -EINVAL; if (!psy->of_node) { dev_warn(&psy->dev, "%s currently only supports devicetree\n", @@ -559,6 +561,10 @@ int power_supply_get_battery_info(struct power_supply *psy, &info->charge_full_design_uah); of_property_read_u32(battery_np, "voltage-min-design-microvolt", &info->voltage_min_design_uv); + of_property_read_u32(battery_np, "charge-voltage-microvolt", + &info->charge_voltage_uv); + of_property_read_u32(battery_np, "charge-current-microamp", + &info->charge_current_ua); return 0; } diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 8220f7b..3eea323 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -302,6 +302,8 @@ struct power_supply_battery_info { int energy_full_design_uwh; /* microWatt-hours */ int charge_full_design_uah; /* microAmp-hours */ int voltage_min_design_uv; /* microVolts */ + int charge_voltage_uv; /* microVolts */ + int charge_current_ua; /* microAmp */ }; extern struct atomic_notifier_head power_supply_notifier;