Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp813486ybk; Wed, 13 May 2020 13:53:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyh2UyW05WRLupi8+O6qP+yGBES3X5Qzpvcv/rKmSeR2q+sZBa/W2mUL/fv05qrzoJls0Y0 X-Received: by 2002:a17:906:cd18:: with SMTP id oz24mr856474ejb.179.1589403220424; Wed, 13 May 2020 13:53:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589403220; cv=none; d=google.com; s=arc-20160816; b=wSq/IBVfVb67hYzFghveG2R665qSk2H8yu9z2cb0lk7M1VaR+XHt4TClZRmr/Rhqw+ RBIvc+48HhAHyCoegocpAQTEJ1AGIf09q0dalxufFCc/fAWHv5etTfa9r97PkUQJfjrV h68ZuJBX2QYpsCMjMfXy4lrtka9oYtRe1v/QxPkvBdLqKkB6UdgbzuHBEdaksPSUDijT TaDCt0VyFwjeAQfktI00XdtaKfi868evQPC8NhHGoZXQ1YhDu2HXN3LRZHbfsgMi2NWp T4cWb8zx01clBvSwbg+kFAnXo3BmrPIJRst+QItOaU3asAm/p3AoLDtBftT6yguRrcKR 8Heg== 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=0+9EjReQDxzR+LPBfvDhTg5I1hVLepTGFXSrvZq+9EI=; b=jqtorlRAxOTrqbrH61vVwKxEccCNuzFLv3bJQpobIJu55s4FUJhyCQYDuU0gD30L1E 11hEbVOcuy4RIS3uZ0oXH4GaB6SPWFisFejKYHV8cXBhCKAIOBW9OFimcSxKrPtlJTX2 WlrceLtqJO/gaLV8Jlw/Y41V6l9eIWDng6nAdCGQWzVSoJsP+95l7l4h/ybAaE9T0zlj 0svBNTMvn4scsL7NT5v+0U7GJYtkB5rr5V5CiNBUzlDm1n0rMX1ew5NWmzQpiPKT6FqF i8poRS8mFpFrYlA+E09cb8waqYmSBbLX5pylrrfLzFKSBOgdWd+VS0GQ6Av3BEQRKGMf REZA== 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 qk11si525207ejb.436.2020.05.13.13.53.17; Wed, 13 May 2020 13:53:40 -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 S2390539AbgEMS5a (ORCPT + 99 others); Wed, 13 May 2020 14:57:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2390395AbgEMS4g (ORCPT ); Wed, 13 May 2020 14:56:36 -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 D747AC05BD0A; 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 8CCAA2A29D1 Received: by jupiter.universe (Postfix, from userid 1000) id 844EA480109; 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 11/19] power: supply: sbs-battery: add POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT/VOLTAGE_MAX support Date: Wed, 13 May 2020 20:56:07 +0200 Message-Id: <20200513185615.508236-12-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 Expose maximum charge current/voltage information requested by the battery. Signed-off-by: Sebastian Reichel --- drivers/power/supply/sbs-battery.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c index b697a42d9ccf..e6f61baa9bed 100644 --- a/drivers/power/supply/sbs-battery.c +++ b/drivers/power/supply/sbs-battery.c @@ -46,6 +46,8 @@ enum { REG_CHEMISTRY, REG_MANUFACTURER, REG_MODEL_NAME, + REG_CHARGE_CURRENT, + REG_CHARGE_VOLTAGE, }; #define REG_ADDR_SPEC_INFO 0x1A @@ -114,6 +116,10 @@ static const struct chip_data { SBS_DATA(POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, 0x12, 0, 65535), [REG_TIME_TO_FULL] = SBS_DATA(POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, 0x13, 0, 65535), + [REG_CHARGE_CURRENT] = + SBS_DATA(POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, 0x14, 0, 65535), + [REG_CHARGE_VOLTAGE] = + SBS_DATA(POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX, 0x15, 0, 65535), [REG_STATUS] = SBS_DATA(POWER_SUPPLY_PROP_STATUS, 0x16, 0, 65535), [REG_CAPACITY_LEVEL] = @@ -163,6 +169,8 @@ static enum power_supply_property sbs_properties[] = { POWER_SUPPLY_PROP_CHARGE_NOW, POWER_SUPPLY_PROP_CHARGE_FULL, POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, + POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, + POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX, /* Properties of type `const char *' */ POWER_SUPPLY_PROP_MANUFACTURER, POWER_SUPPLY_PROP_MODEL_NAME @@ -531,6 +539,8 @@ static void sbs_unit_adjustment(struct i2c_client *client, case POWER_SUPPLY_PROP_CURRENT_NOW: case POWER_SUPPLY_PROP_CURRENT_AVG: case POWER_SUPPLY_PROP_CHARGE_NOW: + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX: + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX: case POWER_SUPPLY_PROP_CHARGE_FULL: case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: val->intval *= BASE_UNIT_CONVERSION; @@ -749,6 +759,8 @@ static int sbs_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_TIME_TO_FULL_AVG: case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX: + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX: case POWER_SUPPLY_PROP_CAPACITY: case POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN: ret = sbs_get_property_index(client, psp); -- 2.26.2