From patchwork Thu May 11 13:42:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 99650 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp738657qge; Thu, 11 May 2017 06:43:13 -0700 (PDT) X-Received: by 10.99.104.69 with SMTP id d66mr394711pgc.93.1494510193006; Thu, 11 May 2017 06:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494510193; cv=none; d=google.com; s=arc-20160816; b=Kb+A4OOX8qrq//uTsZem7jtSeVYsCCafPp1TZZx6Xx/2wQfN6oGIC7rLxh5wwFYMAE p7PCbr5v4OhM2mKL7fF7Yn8bxmFow6cFD6EEqRT9mlQlWEByHp/dcMFmTPsp0a5qn82m x3w7mSV4X3efaBoyMcJN4S+hLb5LNhL7i/V4LjiBtOGINEpj1v+aHyiqaaU/Mc2M6Nw/ KEvIoDJkQw0DcBgbwsEx4TX/xfM8+aWRARnD0viB3Ty6inGF2pVUURy2IJMENrcCnr6n 2Jy6rwOyDVfrPKa9lD9WctVoH8deux3wB+ZVYRpNOr7ONrEQGgixVEtNlX0v5KSh7CCg JuPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=jED6WrsZRKqZIQRouz5kXWj3CTSZkvKrW3NFJDW6G80=; b=MYvzTUsPbMXx5NiCb/mcJ2P18BTo7pMKQYzmLEOMh1PZjA7cQ8iBSUKm2vRlz7LcLU gqY1bu0hqn8zuQGjPo3z9JJvi1jn8ixZAgyUJRTcD0Ez7vXngak+D/1STV3hyZw82zoo 84Gl44ESSqsyb44u35D2OaPRkRe6fh9xGqfpmdFnzg1HWSRAmIOHO1sjXA5lyGhN4Z3E u3QZ1/l+xhO33vs7mSDuCep4p97wYZo0Ty/K6P68zCCbm1eadGsvEwLOf5O1tso3IcSY JS+ZDz/sf2+QH3e/jobuZZ+iy3dC+C2Ja1rpRfJp2ATZiQkpa+wbRlzKj61fvlX+J/nt hvXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n190si189817pga.80.2017.05.11.06.43.12; Thu, 11 May 2017 06:43:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932717AbdEKNmt (ORCPT + 25 others); Thu, 11 May 2017 09:42:49 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:34123 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755741AbdEKNmm (ORCPT ); Thu, 11 May 2017 09:42:42 -0400 Received: by mail.free-electrons.com (Postfix, from userid 110) id EBFCA21FF2; Thu, 11 May 2017 15:42:40 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id AC9C420F67; Thu, 11 May 2017 15:42:40 +0200 (CEST) From: Quentin Schulz To: sre@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org Cc: Quentin Schulz , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, liam@networkimprov.net, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com Subject: [PATCH 3/4] power: supply: power_supply_core: add constant-charge-current optional property Date: Thu, 11 May 2017 15:42:19 +0200 Message-Id: <20170511134221.5569-4-quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170511134221.5569-1-quentin.schulz@free-electrons.com> References: <20170511134221.5569-1-quentin.schulz@free-electrons.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds the constant-charge-current property to the list of optional properties for the battery. The constant charge current is critical for batteries as they can't handle all charge currents. Signed-off-by: Quentin Schulz --- drivers/power/supply/power_supply_core.c | 3 +++ include/linux/power_supply.h | 1 + 2 files changed, 4 insertions(+) -- 2.11.0 diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 5019bdee0f0b..23887739c95c 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -508,6 +508,7 @@ 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->constant_charge_current_max_ua = -EINVAL; if (!psy->of_node) { dev_warn(&psy->dev, "%s currently only supports devicetree\n", @@ -537,6 +538,8 @@ 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, "constant-charge-current-max-microamp", + &info->constant_charge_current_max_ua); return 0; } diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index e84f1d31d987..6f9c28187caf 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -301,6 +301,7 @@ 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 constant_charge_current_max_ua; /* microAmps */ }; extern struct atomic_notifier_head power_supply_notifier;