From patchwork Wed Jul 31 10:00:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 170130 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp3802667ile; Wed, 31 Jul 2019 03:00:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQ4StmhUOjgxYnw/N+G6xkB+HqJAQYsopAYhhJNIbMcx9tB/wMUNHLDk34EoIUFrlpA4Lc X-Received: by 2002:a62:7994:: with SMTP id u142mr47202031pfc.39.1564567257278; Wed, 31 Jul 2019 03:00:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564567257; cv=none; d=google.com; s=arc-20160816; b=R9dVsARxQXsDN31O0Q7u/M/oynnF8NIlkct+XXXqnnbBumilcViwRkvzr+w9wHJKv8 pzCiB6h2YnovZOc/cDGZN9er+5Nw/pZBSZtVttCz3ZJRKb1maQ5/lyjonPe+i0pHqj/v xgw5RB7KKowkx0YhS4zKznlfmY0Mzb+UH8rpH1bJsupuJ2w3a8AxPHhoHLPZPoTR/ESV aC29FLLZDyFGp+3xfuOj4/Dl+zb/I3No9JFs0cWW0p+QTTYt1wR6S9yUgowxwC7DsCVk oG/kxWfREWHaxH24PnGIvrqqUAjMLoS/N0m15QyhFDvUKvyll37kikj2lOXEG7YMm66h kkaQ== 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:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=MmBOwwNeN+W1dC0nmIPZG6LtIHwgJLZWSo5QrSMSqcg=; b=r3Xn8NiE2aDxagQ2AEG4gxSAPFU7zI5Z5+iEJhqE0kZE9otEBJ8+cTXRuW/PZjzkO5 Amgr9AcJMXSyIjhnDXUuY3k5wtsecn2LogG22fmomA9vqmX1vSaIDbzOU2y7zvpOuQkd BGsxEUEwQ62pAhPa9gi1buPg3xZjCXe1EXVdVvW8Ph184prMFIP/rfLJ/qvhXWEncXwl DCkUIi366eodmM7r0z6WZlI1zvLxtPLKB65q5VJsjUoeWz6PJyBILWBV36VwTeJ7WfLK 6+yDDKF2D3+O7Of6ovaPtfQGd6lDzseRBfrpYqLn+ov3wLiZB5Q8hr1HI3sAPJjtRYc4 eJmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F2cmNKe8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si32613928pld.32.2019.07.31.03.00.56; Wed, 31 Jul 2019 03:00:57 -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; dkim=pass header.i=@linaro.org header.s=google header.b=F2cmNKe8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387666AbfGaKAz (ORCPT + 29 others); Wed, 31 Jul 2019 06:00:55 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:43724 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387644AbfGaKAy (ORCPT ); Wed, 31 Jul 2019 06:00:54 -0400 Received: by mail-pf1-f195.google.com with SMTP id i189so31588857pfg.10 for ; Wed, 31 Jul 2019 03:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=MmBOwwNeN+W1dC0nmIPZG6LtIHwgJLZWSo5QrSMSqcg=; b=F2cmNKe82FILmNf5yBHDnTc0fv/W9P8ElxWyX9nD9eNEddHhrjcVcMripReHGh+S0v tSNdYbOTYj5QQBmbdLKklAfAnbsGhNRFF8O/+LB3M71Jf26oCbFHGBxBwHSsBhGdqxyA +KxTVK8klRgp4/pNwu9f2ux4WWomzu+suJyXaCfOMITmKuJ2rNjMgyJNtefNtQk/6Ced +G4XQdEfuvog8fX/p/pcnavzvF0fv3pGjJxnKPAJzsT26oHgPzE1HZaAb08cu8XimFcy Ot89rgQl1jDKVtz6fQ/61d+80sPzURiNrw0u2ctVaFEOZ6aLQg8LP6zliTaQ5zR/CcnX jBig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=MmBOwwNeN+W1dC0nmIPZG6LtIHwgJLZWSo5QrSMSqcg=; b=oJJgog/3Nl65Yhhtrn3VADu/DS59/JHmDVQG9IqFv2Ko7sPycdxLeT4AztUmFeh5wC U/Hu8WQZT68Rx/g9w8mqKmFUDnDyLwpmqS6h94s7OGlmENtLfk1E84uBvHda920rB8NY j3n7pZAmLCHNgCd2KTY9jGIqow1d6dnPb3vhDBi6aJPCBDyN4NzNTZCUmz/3HFmd7e0V CiLWPfpHDi0Frd7lUs5oxg3FyUNSxk3I2XSyj07n93J+tEe0zHHaEyIG0+JD7FeSHqvk MClYsNpVP6hXbXKzpUw3mJm+G7rRoCRZ2WT/SG5JP1Xsht9gCSwnWaAmvcvrKUY5x55w VH/A== X-Gm-Message-State: APjAAAWdMCrLHr3t/2UQaVTkDpFcSjYCAOVcXcyVOtdfqmQm6c1qBh9m XckZapi0b2fIHqBxT5QvCcMl8Q== X-Received: by 2002:a63:d555:: with SMTP id v21mr90143798pgi.179.1564567253116; Wed, 31 Jul 2019 03:00:53 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id m6sm68611352pfb.151.2019.07.31.03.00.50 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Jul 2019 03:00:52 -0700 (PDT) From: Baolin Wang To: sre@kernel.org Cc: orsonzhai@gmail.com, zhang.lyra@gmail.com, yuanjiang.yu@unisoc.com, baolin.wang@linaro.org, vincent.guittot@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] power: supply: sc27xx: Add POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN attribute Date: Wed, 31 Jul 2019 18:00:23 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yuanjiang Yu Add POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN attribute to provide the battery's design capacity for charger manager to calculate the charging counter. Signed-off-by: Yuanjiang Yu Signed-off-by: Baolin Wang --- drivers/power/supply/sc27xx_fuel_gauge.c | 5 +++++ 1 file changed, 5 insertions(+) -- 1.7.9.5 diff --git a/drivers/power/supply/sc27xx_fuel_gauge.c b/drivers/power/supply/sc27xx_fuel_gauge.c index 24895cc..2fe97ae 100644 --- a/drivers/power/supply/sc27xx_fuel_gauge.c +++ b/drivers/power/supply/sc27xx_fuel_gauge.c @@ -587,6 +587,10 @@ static int sc27xx_fgu_get_property(struct power_supply *psy, val->intval = value * 1000; break; + case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN: + val->intval = data->total_cap * 1000; + break; + default: ret = -EINVAL; break; @@ -644,6 +648,7 @@ static int sc27xx_fgu_property_is_writeable(struct power_supply *psy, POWER_SUPPLY_PROP_CURRENT_NOW, POWER_SUPPLY_PROP_CURRENT_AVG, POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, + POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, }; static const struct power_supply_desc sc27xx_fgu_desc = {