From patchwork Tue Mar 31 12:26:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 11467761 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D716692C for ; Tue, 31 Mar 2020 12:26:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B674C20B80 for ; Tue, 31 Mar 2020 12:26:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730806AbgCaM0y (ORCPT ); Tue, 31 Mar 2020 08:26:54 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:42938 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730864AbgCaM0y (ORCPT ); Tue, 31 Mar 2020 08:26:54 -0400 Received: by mail-lj1-f196.google.com with SMTP id q19so21696327ljp.9; Tue, 31 Mar 2020 05:26:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=bBqysWd5ntQ/8u1/Yq6TpX5MR7RrqjxP0UyOJBoZA0Q=; b=XIvyyOxboyKwFc2JeBxCoUnPyu8zLKOoEUy2rNqib+lKTtLePVOPWDPDj9pouNwfMW uaVs9yAB4tAsdWnEYvOHb3OEbHnwzdDOXb8h/JDgEGCg5IrEc0utGYFpbrgEBXZP4CjH auGT0BSOqO23esYTKW9cT7WRPYut9gIbycfDfeuC3fB7DDnyLMUljUpV+P73DuiqFKgz 00MqRb1exU3mVkPoZGOGEG8I8O5xGSTejENWK9QZdeo6/UPjWeXYyUMvuaPKTzbXigGC nNDP9F+0jS7dknjZ3ZBRWgZXD72SpdvlEje5qGGrh7hrW6F63WjkATqhSUiMBY0wAW5n KGRw== X-Gm-Message-State: AGi0PuYtZGagCkuReKFpepAUbMfOMOzQIzSAwtNZzI/0qUmJfyhviitC Kt07nlnE45mJtpd+xrmtR08= X-Google-Smtp-Source: APiQypKdLpmVuvDniqInNISq4GFK6fVOwsX23K+yvreVv3AnPs08tBzUWFof+f59zwAryktmUDjzLA== X-Received: by 2002:a2e:97c2:: with SMTP id m2mr9790923ljj.228.1585657611666; Tue, 31 Mar 2020 05:26:51 -0700 (PDT) Received: from localhost.localdomain (dc7t7ryyyyyyyyyyyyybt-3.rev.dnainternet.fi. [2001:14ba:16e1:b700::3]) by smtp.gmail.com with ESMTPSA id v79sm9696489lfa.21.2020.03.31.05.26.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 05:26:51 -0700 (PDT) Date: Tue, 31 Mar 2020 15:26:43 +0300 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Cc: Greg Kroah-Hartman , Linus Walleij , Mikko Mutanen , Markus Laine , Andrew Morton , Andy Shevchenko , Andy Shevchenko , Ard Biesheuvel , Borislav Petkov , Brendan Higgins , Changbin Du , Dan Williams , David Gow , "David S. Miller" , devicetree@vger.kernel.org, Gary Hook , Herbert Xu , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Mark Rutland , Masahiro Yamada , Masami Hiramatsu , Matti Vaittinen , Mikhail Zaslonko , Randy Dunlap , Rob Herring , Sebastian Reichel , Shuah Khan , Tal Gilboa , Thomas Gleixner , Uwe =?iso-8859-1?q?Kleine-K=F6nig?= , Vincenzo Frascino , Vladimir Oltean , Mark Brown , Liam Girdwood Subject: [PATCH v7 08/10] power: supply: add battery parameters Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add parsing of new device-tree battery bindings. - trickle-charge-current-microamp - precharge-upper-limit-microvolt - re-charge-voltage-microvolt - over-voltage-threshold-microvolt Signed-off-by: Matti Vaittinen --- No changes since v6 drivers/power/supply/power_supply_core.c | 8 ++++++++ include/linux/power_supply.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 1a9a9fae73d3..02b37fe6061c 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -620,10 +620,18 @@ int power_supply_get_battery_info(struct power_supply *psy, &info->voltage_min_design_uv); of_property_read_u32(battery_np, "voltage-max-design-microvolt", &info->voltage_max_design_uv); + of_property_read_u32(battery_np, "trickle-charge-current-microamp", + &info->tricklecharge_current_ua); of_property_read_u32(battery_np, "precharge-current-microamp", &info->precharge_current_ua); + of_property_read_u32(battery_np, "precharge-upper-limit-microvolt", + &info->precharge_voltage_max_uv); of_property_read_u32(battery_np, "charge-term-current-microamp", &info->charge_term_current_ua); + of_property_read_u32(battery_np, "re-charge-voltage-microvolt", + &info->charge_restart_voltage_uv); + of_property_read_u32(battery_np, "over-voltage-threshold-microvolt", + &info->overvoltage_limit_uv); of_property_read_u32(battery_np, "constant-charge-current-max-microamp", &info->constant_charge_current_max_ua); of_property_read_u32(battery_np, "constant-charge-voltage-max-microvolt", diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index dcd5a71e6c67..d01322d1ab52 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -346,8 +346,12 @@ struct power_supply_battery_info { int charge_full_design_uah; /* microAmp-hours */ int voltage_min_design_uv; /* microVolts */ int voltage_max_design_uv; /* microVolts */ + int tricklecharge_current_ua; /* microAmps */ int precharge_current_ua; /* microAmps */ + int precharge_voltage_max_uv; /* microVolts */ int charge_term_current_ua; /* microAmps */ + int charge_restart_voltage_uv; /* microVolts */ + int overvoltage_limit_uv; /* microVolts */ int constant_charge_current_max_ua; /* microAmps */ int constant_charge_voltage_max_uv; /* microVolts */ int factory_internal_resistance_uohm; /* microOhms */