Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp748948ybk; Wed, 13 May 2020 12:02:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztDkkBFrD691LvGrb8dIxNEcf6A6s//fedJ3YvYoNGTFXWiP9UYhzNnBA2SoB/elayM2Xn X-Received: by 2002:a17:906:ae18:: with SMTP id le24mr428136ejb.155.1589396531734; Wed, 13 May 2020 12:02:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589396531; cv=none; d=google.com; s=arc-20160816; b=As2yIQOHXGwlzhdLLht1gJMZZAzSAHvvv35Eo5lENQ3Qx/j+OBXgRB79iNkUZt3Dv9 CHIwhywqBoJjaJB0aBjhAXazrI1H/xVsyOVpXe1MjV/l6M/+AuP7T/+575gnqVmNydln o1RpxCqEUlF8c5czqfgUADkyBmtdsscWbsygvgfpBVjhlI0QF0VKdBG53bnaYS7wDcDv X5t8OUGqrlEIzmU66XZW5gN0fVyUQzy+/LTkef0f2Qicm+Y0Mhw4Au8qechPf/YHynB+ dIyPyuBWgI27jEUfJo0I7j/uP7C9bCcsAws/XhAaYUKAvang0bpU9TTl3ZmXAwf02rrE GqSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Wia3PUYqSVHj5zspsvbk5rVBFDcGAX0BEBGH2eCRLi4=; b=gyVZ0Qf1cPH1ojHBV6iZ5Tvx5JS5NHl5WHGM+Zpc6e1qN5bCi15xZDZnoDCA6XJFaa OiZkpqsJyy36pats/Bjwduxao8cPPFhkf7jid4JQ5Vs0NZLoUHFV3jPjKNxummAt4qww siVupyeIGV/7HdLkCnLX5Vqwv6mslk5JNleSKzYmBkwcHX94mMsv9VVyYqnrqug/bpUL SnDoC/cn+bxj3uS51jt5JeXg+8kZv+mcsD1TFS/RoVLPaJ5y/sMg1uW8jgoN5UqTbpFG CqcCfR9+ZseRwIdFC/LXmVrDopaLcCz/tX/e3dYMDVHgGQ7GHxk1zLVo91k70tRe/7ot pmog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si374223ejr.438.2020.05.13.12.01.47; Wed, 13 May 2020 12:02:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390567AbgEMS5g (ORCPT + 99 others); Wed, 13 May 2020 14:57:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2390389AbgEMS4f (ORCPT ); Wed, 13 May 2020 14:56:35 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7721EC061A0C; Wed, 13 May 2020 11:56:35 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 4A0F92A251E Received: by jupiter.universe (Postfix, from userid 1000) id 74B84480104; Wed, 13 May 2020 20:56:29 +0200 (CEST) From: Sebastian Reichel To: Sebastian Reichel , Rob Herring , Greg Kroah-Hartman , "Rafael J . Wysocki" Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Sebastian Reichel Subject: [PATCHv1 06/19] power: supply: sbs-battery: add POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN support Date: Wed, 13 May 2020 20:56:02 +0200 Message-Id: <20200513185615.508236-7-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200513185615.508236-1-sebastian.reichel@collabora.com> References: <20200513185615.508236-1-sebastian.reichel@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for reporting the MaxError register from battery fuel gauges following the smart battery standard. Signed-off-by: Sebastian Reichel --- drivers/power/supply/sbs-battery.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c index a15783802ef8..4356fdf25d4a 100644 --- a/drivers/power/supply/sbs-battery.c +++ b/drivers/power/supply/sbs-battery.c @@ -26,6 +26,7 @@ enum { REG_TEMPERATURE, REG_VOLTAGE, REG_CURRENT, + REG_MAX_ERR, REG_CAPACITY, REG_TIME_TO_EMPTY, REG_TIME_TO_FULL, @@ -85,6 +86,8 @@ static const struct chip_data { SBS_DATA(POWER_SUPPLY_PROP_VOLTAGE_NOW, 0x09, 0, 20000), [REG_CURRENT] = SBS_DATA(POWER_SUPPLY_PROP_CURRENT_NOW, 0x0A, -32768, 32767), + [REG_MAX_ERR] = + SBS_DATA(POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN, 0x0c, 0, 100), [REG_CAPACITY] = SBS_DATA(POWER_SUPPLY_PROP_CAPACITY, 0x0D, 0, 100), [REG_REMAINING_CAPACITY] = @@ -132,6 +135,7 @@ static enum power_supply_property sbs_properties[] = { POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_CURRENT_NOW, POWER_SUPPLY_PROP_CAPACITY, + POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN, POWER_SUPPLY_PROP_TEMP, POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, @@ -676,6 +680,7 @@ static int sbs_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: case POWER_SUPPLY_PROP_CAPACITY: + case POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN: ret = sbs_get_property_index(client, psp); if (ret < 0) break; -- 2.26.2