From patchwork Tue Feb 25 08:55:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 212738 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90ED5C35DFB for ; Tue, 25 Feb 2020 08:55:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7264C218AC for ; Tue, 25 Feb 2020 08:55:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729614AbgBYIz1 (ORCPT ); Tue, 25 Feb 2020 03:55:27 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:35051 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729557AbgBYIz1 (ORCPT ); Tue, 25 Feb 2020 03:55:27 -0500 Received: by mail-lj1-f195.google.com with SMTP id q8so13107463ljb.2; Tue, 25 Feb 2020 00:55:25 -0800 (PST) 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=BMNDx585fWxvgvlqixFKa4jgKDaCj9UHtNp0mLIEiig=; b=T606kywBV4wlGT87vjNaDu+wSnyc2RGUvoZjkaf2xAY55SN13Z5Lg0mVaQd3d/KgA0 3YV1dVGjY0Nj3UfPjBhG7xIb28op389hqxLgdH2jHzXyuU0rSBo1x3JsS16eQ8lwdTr0 1/QCsJ85kyEIXkQ4lSv8b70M+tqSDU7qIInvDa11TZ+wSTeIkNW98k41Ohrzl5k5IL7u iUpVHSqj+UoxxbwCvjcrhZIoYRYHLHOTelFLfnzRsWRHbgu9kmkcHlPRbft/LKI7iT/b oalHws99fPyLsrYrtdzsU6j5JRYmljPkE6q/y0VjzbzJ1nBSYDunrOiy5Xk+9j5LFWCV Z7gw== X-Gm-Message-State: APjAAAWWfnjmCF1ZT/w32ygcecMXxyUBdePYGeYZQJjBQVz7CRmp8DlI FX3BGA+vtsV063aqBmG9MqE= X-Google-Smtp-Source: APXvYqwNr/URCRocLnXgacWQCtdANw129IINYcnCMkxl4+Zrzz8qldyha3qyp+tGkV1sx1K4fYwSHg== X-Received: by 2002:a2e:9213:: with SMTP id k19mr30045818ljg.141.1582620925102; Tue, 25 Feb 2020 00:55:25 -0800 (PST) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id z3sm7379477ljh.83.2020.02.25.00.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2020 00:55:24 -0800 (PST) Date: Tue, 25 Feb 2020 10:55:18 +0200 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Cc: Sebastian Reichel , Rob Herring , Mark Rutland , Greg Kroah-Hartman , "Rafael J. Wysocki" , Liam Girdwood , Mark Brown , Matti Vaittinen , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Markus Laine , Mikko Mutanen Subject: [PATCH v4 8/9] power: supply: add battery parameters Message-ID: <4a4edf57e3328b8bf4cbe1a95224944b8286516d.1582617178.git.matti.vaittinen@fi.rohmeurope.com> 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 rfc-v3 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 */