From patchwork Tue Mar 24 08:31:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 11454801 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 562B5159A for ; Tue, 24 Mar 2020 08:32:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 39E3F20836 for ; Tue, 24 Mar 2020 08:32:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727124AbgCXIcA (ORCPT ); Tue, 24 Mar 2020 04:32:00 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:40748 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726091AbgCXIcA (ORCPT ); Tue, 24 Mar 2020 04:32:00 -0400 Received: by mail-lj1-f195.google.com with SMTP id 19so17598091ljj.7; Tue, 24 Mar 2020 01:31:58 -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=2K08FJcoLeZWjAYlC6fWPluhTTZxEk5E+fKIcES5b4s=; b=LpmqVg2dSJ7tRikx9Jx7qq+RSlONgJL1+/qdoyKssoFcgA9NUJ2H4242JrWF9/FGEI 7YgfqwXADb2FmBPQU6Z9jIZOcPyguHFtMPmcW15vKn2BFrCWsoLDceYeWAUVdS0jMG3B BNBzEk/6YIJH829JDS9bvOd308hiEOZQqO2ifVcgPrquuCuzR9fvVjVIBGXwaV4GXh/X ra5mHXMP5DIakPef1vSk7MePD+K1iqEim/nA5PlYHBiCuLwrxLoz3gbZ9Ml/yBzaZbq5 kmMzZD+/Azp8puOaBCaseCj6bejMzLojG2F/E7x9UN5MYdsxg5stdK6rcw5znSUzCWB6 cO4g== X-Gm-Message-State: ANhLgQ0ue9wqPioUc7whixKvEFaixheDBX94k2zfZcQlzl5C8+m1hyYV SxtTjSW4F8nacJIvuEui9bM= X-Google-Smtp-Source: ADFU+vtik0yQhc1Fh/MHKsd9VQbQKeAVjTUT1imHTy5+oJ06BW5CRMJJ35Hai2gm5Y4p6PIN+23S8Q== X-Received: by 2002:a2e:8612:: with SMTP id a18mr3585407lji.250.1585038717427; Tue, 24 Mar 2020 01:31:57 -0700 (PDT) Received: from localhost.localdomain (dc7t7ryyyyyyyyyyyyybt-3.rev.dnainternet.fi. [2001:14ba:16e1:b700::3]) by smtp.gmail.com with ESMTPSA id q20sm1120908ljj.66.2020.03.24.01.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 01:31:56 -0700 (PDT) Date: Tue, 24 Mar 2020 10:31:49 +0200 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 v6 08/10] power: supply: add battery parameters Message-ID: <4a9dc957163a5ef4ce73dd7e38a1ab6f11b324c2.1584977512.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 --- 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 */