From patchwork Tue Apr 14 08:05: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: 11487025 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 1B67B6CA for ; Tue, 14 Apr 2020 08:06:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EC8202072D for ; Tue, 14 Apr 2020 08:05:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NF7F41la" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC8202072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fi.rohmeurope.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kPwOZUp4AiP3kLJVErlOLJPB7tKWQr1bz8lc5U+0G+I=; b=NF7F41lavPAd5Y JLdgP8mtiARbIcaU9n6dQDpN0+kDBrRkuLZyCSTn/UGGTy1ccmo77GU+Z1Brskk2wZAy541aP6pHU V35xphoMYG7HVE+L+DWZVQ4Vi8dE/hrHpkB9sVWex7hBblu64QizRPMOGclYQE+6m7h4Ru5aHt+4T A5YtlVCevm+PBd/JYNL937PaIg3GL7tKvRDWfy9cMoeApWO+cSElo1ttru1+GROcGnUSVbjYs4HT4 x1k3+C3nCc+cPHvnfxPc/QPxBgKuw8coGpD39H6u2Gg0IKhr2MODOZNOwPHki6he7Bw27emKgtJx5 LLsnEBDISL+yMV0jYGkQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOGZv-00007X-Le; Tue, 14 Apr 2020 08:05:55 +0000 Received: from mail-lf1-f66.google.com ([209.85.167.66]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOGZt-00006k-57; Tue, 14 Apr 2020 08:05:54 +0000 Received: by mail-lf1-f66.google.com with SMTP id w145so8648571lff.3; Tue, 14 Apr 2020 01:05:53 -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=uXBBLC51I01jMthOumtLiZBaTEIsbpU2/NFNpFRAREc=; b=kDfubYHBTAS9ns5fgGjc/TgzehLci9sSL6rXddU0TlX7wHwwpFN1Z+BN90vU/PdXWW 0du0y+R8Q2kK4aWk1ju28FgAFinnC5dQz5VDnyKnBltdFFm+rF6N3yQ5c8b5Pe0H58Ct ER2kIF6XCWpSVkq+4cWv+fHqllU5KVySMEC0eDkt2itjtyua+5o5gSep2HdenOCObWVF vc1f9uczuc/0EcIJJ8R46j78TL+Du6mYBbquZH3G0SVopI+kYcSfoZpT1IPU6q1aRBp8 KsacVwzEorU4qyWO5suKcoSTJ1ZbuYELIarIIq4DdBlemo0RogDI8fGsGQ8oMKWm/eAs VkuQ== X-Gm-Message-State: AGi0PuaqtHv0x+8nam+8rBaotm7k9LZcm0zy6WQc2GVxEbXVRLp2WSBF fLWDalSQGEdqLd9ibLlXUlM= X-Google-Smtp-Source: APiQypLj9h3zbzYnYE3ZGoQTKubl1HUCkkplNhlTZ2Y0sHUshOeIRw6I5TR1qgyK8Gz6eO/BlyUlNw== X-Received: by 2002:ac2:4da7:: with SMTP id h7mr12643704lfe.95.1586851551731; Tue, 14 Apr 2020 01:05:51 -0700 (PDT) Received: from localhost.localdomain (dc7t7ryyyyyyyyyyyyybt-3.rev.dnainternet.fi. [2001:14ba:16e1:b700::3]) by smtp.gmail.com with ESMTPSA id j22sm9975883lfg.96.2020.04.14.01.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 01:05:51 -0700 (PDT) Date: Tue, 14 Apr 2020 11:05:43 +0300 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Subject: [PATCH v9 07/10] power: supply: add battery parameters Message-ID: <2a244c4cca0e443e3bc37f9657d39acfaf0e4427.1586849281.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) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200414_010553_201936_76E7EB55 X-CRM114-Status: GOOD ( 11.23 ) X-Spam-Score: -0.3 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.167.66 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [mazziesaccount[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.8 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.167.66 listed in wl.mailspike.net] 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Andrei Stefanescu , Heiko Stuebner , "Rafael J. Wysocki" , Tony Lindgren , Linus Walleij , Brendan Higgins , Sebastian Reichel , Andreas Kemnade , "Angelo G. Del Regno" , Hsin-Hsiung Wang , linux-samsung-soc@vger.kernel.org, Andy Shevchenko , Axel Lin , Gregory CLEMENT , linux-pm@vger.kernel.org, Krzysztof Kozlowski , Markus Reichl , Bartosz Golaszewski , Chen-Yu Tsai , Andy Gross , markus.laine@fi.rohmeurope.com, Adam Thomson , devicetree@vger.kernel.org, Charles Keepax , linux-omap@vger.kernel.org, Bartlomiej Zolnierkiewicz , linux-arm-msm@vger.kernel.org, Richard Fitzgerald , Mark Brown , linux-mediatek@lists.infradead.org, Matthias Brugger , Thomas Gleixner , Bjorn Andersson , linux-arm-kernel@lists.infradead.org, Support Opensource , Baolin Wang , Sangbeom Kim , Greg Kroah-Hartman , Randy Dunlap , Matti Vaittinen , Liam Girdwood , linux-kernel@vger.kernel.org, mikko.mutanen@fi.rohmeurope.com, Vinod Koul , Rob Herring , patches@opensource.cirrus.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 Reviewed-by: Sebastian Reichel --- Changes since v8 - rebased and reordered series. 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 */