From patchwork Wed Jun 7 18:37:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Liam Breck X-Patchwork-Id: 9772285 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D987B60393 for ; Wed, 7 Jun 2017 18:38:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BABBC2842B for ; Wed, 7 Jun 2017 18:38:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF742284D4; Wed, 7 Jun 2017 18:38:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 029BA28455 for ; Wed, 7 Jun 2017 18:38:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752366AbdFGSib (ORCPT ); Wed, 7 Jun 2017 14:38:31 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36831 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752277AbdFGSi3 (ORCPT ); Wed, 7 Jun 2017 14:38:29 -0400 Received: by mail-pg0-f65.google.com with SMTP id v18so2154856pgb.3 for ; Wed, 07 Jun 2017 11:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RVIHp2aBq2fp3mBPYIWMXe7lC9iLeEK5qd9SQPeUDRc=; b=SYOB+qvr1efL+TVsgz8RSiWOAbbu0mIq9+VF01fL5a5QObMUWh6glluTlH1xtvOGHA +7br4xwuwhv0AgO3dy19J9BiS6GHTSY5ms6pU+kgnoIQssuyC9LbG014mZHsSkOGqOmV HTexu7tz5eoIMucp9MA1YFUV7GbgCZPUAngLSi+yvLYCvhzeflYR9C5qmK5Uk3SVXmwR 0jxJWk5XQbt6bOz7ExBb85skddORjFSPxRSmqzvRZ9DQOdeCJZLBJRazKER6wENRDmff +ww5s7U/8M3FNXtx3URLLk09e2DsZ+ujHQMcZ/XGdpsK7ybKuqpKdPcThU2DXCngCxFj KHKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=RVIHp2aBq2fp3mBPYIWMXe7lC9iLeEK5qd9SQPeUDRc=; b=h7esKHZ87KtlTDfscWN1FqICMlghOwKBAoPSMlkFoZX42EhDGn8dM923KTKcJ+bIa7 gR7U+lr+34cmI4YKX2/4N3JVXlbKstqftFFfEOHebdm9K+y1c2C80Tu9nSCS3Cur8gOn mR56rMCmOoXCTirB9gStNoNSOaDydnyCaNPRfui+IA/feCcQUn37UIHc4wlsQhpjnIob 0ZXL7TS+JrzsEyAwcNQ2hYUGJDjxOXn2/nJ/1xUxI+tKDp194j7xfO+uILV7Q0xVfB/U CTGFmkAlJNfj1lFgvpVp2jK2/tZFUabAHote4FkXlGi409h01Q8oE/oQpDYGk5v/bM24 3MTw== X-Gm-Message-State: AODbwcBx7mQvOJFE1LiseqRaqrDNXP2ydO/AyfNgyv+3Jbj7mZaj82Bu /wtxbD3+o5T/Ww== X-Received: by 10.99.44.68 with SMTP id s65mr23314699pgs.73.1496860708652; Wed, 07 Jun 2017 11:38:28 -0700 (PDT) Received: from localhost.localdomain (c-73-223-93-234.hsd1.ca.comcast.net. [73.223.93.234]) by smtp.gmail.com with ESMTPSA id q85sm319529pfd.7.2017.06.07.11.38.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Jun 2017 11:38:28 -0700 (PDT) From: Liam Breck To: Sebastian Reichel , "Pali Rohar" , linux-pm@vger.kernel.org Cc: Enric Balletbo , Paul Kocialkowski , Quentin Schulz , Liam Breck Subject: [PATCH v14 04/11] power: supply: core: Add power_supply_prop_precharge Date: Wed, 7 Jun 2017 11:37:52 -0700 Message-Id: <20170607183759.20261-5-liam@networkimprov.net> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170607183759.20261-1-liam@networkimprov.net> References: <20170607183759.20261-1-liam@networkimprov.net> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Liam Breck Battery chargers use POWER_SUPPLY_PROP_PRECHARGE_CURRENT Clarify related item POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT Signed-off-by: Liam Breck --- Documentation/power/power_supply_class.txt | 19 ++++++++++++------- drivers/power/supply/power_supply_sysfs.c | 1 + include/linux/power_supply.h | 3 +++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Documentation/power/power_supply_class.txt b/Documentation/power/power_supply_class.txt index 01f00759..300d3789 100644 --- a/Documentation/power/power_supply_class.txt +++ b/Documentation/power/power_supply_class.txt @@ -115,28 +115,33 @@ of charge when battery became full/empty". It also could mean "value of charge when battery considered full/empty at given conditions (temperature, age)". I.e. these attributes represents real thresholds, not design values. +ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. + CHARGE_COUNTER - the current charge counter (in µAh). This could easily be negative; there is no empty or full value. It is only useful for relative, time-based measurements. +PRECHARGE_CURRENT - the maximum charge current during precharge phase +of charge cycle (typically 20% of battery capacity). +CHARGE_TERM_CURRENT - Charge termination current. The charge cycle +terminates when battery voltage is above recharge threshold, and charge +current is below this setting (typically 10% of battery capacity). + CONSTANT_CHARGE_CURRENT - constant charge current programmed by charger. CONSTANT_CHARGE_CURRENT_MAX - maximum charge current supported by the power supply object. -INPUT_CURRENT_LIMIT - input current limit programmed by charger. Indicates -the current drawn from a charging source. -CHARGE_TERM_CURRENT - Charge termination current used to detect the end of charge -condition. - -CALIBRATE - battery or coulomb counter calibration status CONSTANT_CHARGE_VOLTAGE - constant charge voltage programmed by charger. CONSTANT_CHARGE_VOLTAGE_MAX - maximum charge voltage supported by the power supply object. +INPUT_CURRENT_LIMIT - input current limit programmed by charger. Indicates +the current drawn from a charging source. + CHARGE_CONTROL_LIMIT - current charge control limit setting CHARGE_CONTROL_LIMIT_MAX - maximum charge control limit setting -ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. +CALIBRATE - battery or coulomb counter calibration status CAPACITY - capacity in percents. CAPACITY_ALERT_MIN - minimum capacity alert value in percents. diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c index bcde8d13..937b03c7 100644 --- a/drivers/power/supply/power_supply_sysfs.c +++ b/drivers/power/supply/power_supply_sysfs.c @@ -196,6 +196,7 @@ static struct device_attribute power_supply_attrs[] = { POWER_SUPPLY_ATTR(time_to_full_avg), POWER_SUPPLY_ATTR(type), POWER_SUPPLY_ATTR(scope), + POWER_SUPPLY_ATTR(precharge_current), POWER_SUPPLY_ATTR(charge_term_current), POWER_SUPPLY_ATTR(calibrate), /* Properties of type `const char *' */ diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 85853834..31c4961b 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -146,6 +146,7 @@ enum power_supply_property { POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */ POWER_SUPPLY_PROP_SCOPE, + POWER_SUPPLY_PROP_PRECHARGE_CURRENT, POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT, POWER_SUPPLY_PROP_CALIBRATE, /* Properties of type `const char *' */ @@ -381,6 +382,8 @@ static inline bool power_supply_is_amp_property(enum power_supply_property psp) case POWER_SUPPLY_PROP_CHARGE_NOW: case POWER_SUPPLY_PROP_CHARGE_AVG: case POWER_SUPPLY_PROP_CHARGE_COUNTER: + case POWER_SUPPLY_PROP_PRECHARGE_CURRENT: + case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT: case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT: case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX: case POWER_SUPPLY_PROP_CURRENT_MAX: