Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp814217ybk; Wed, 13 May 2020 13:55:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5DrBlJL4l6OPRU1HFRG3zsUbJE8R99Eiwxph98j7uMZdJ52ULalu2/Ju7WAi/DcwMs0GD X-Received: by 2002:a50:8165:: with SMTP id 92mr1353292edc.263.1589403310870; Wed, 13 May 2020 13:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589403310; cv=none; d=google.com; s=arc-20160816; b=yHwoymTXz5plT2w8MtgvcJ5CdNaVmW4b27vSEwb7SfgaX0TX/Xw4MAWhs1m4ilNpPY uNI1J00w9wzRCM3olVSrmIrUC7obo21oqVHbr8BjzRSlQsXM8X7P8JF7KPpLM7EiUG1q G95yljOwgwfMFsi9PfdQ6o2AjmJnPKOKM83Pailn/kEYAvVTXtmWImLb33zcdW+CzSGR G5o2mb3iHC9T/XqDPE4czJExvEMaXcNG3W3MXlR4iZwYRd3GCWxGq2Pn0xYFv+Sd2PvC 2m5Z67OCyZCQVn7yD60EPNbZmrwx+DxJuyV/oaaD2gfuDEzj12lZXlVgZs+BfM5SfUTS J+pg== 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=1VPeGN4rSZm7UR+55HuAZvKD/MwOC0OViW815B2nxyI=; b=BstNDWW2jpeHhS3NsvtumvArz8sIiUBJiI3LdaHckPpgnYXby9rgsMuddh3/ENj+Dz sAvTDsa6yeZ9Ot5WNoWSatE+J0Wrfz1fEMGvkDwxTvHBfhV77hMnylBz1GE9Yld2pGNa UbNxUFuvYL6aZg7SaLY9LJI02AYtYVcztcjsU/IqQKsxe5u7WMHWrF8ROUP+uGa2++Lq dRLHckMpEw34YHKevdpL6mQXkMsfIAQV1qIIz8BwFzc0/6Xc2fRTofgxx6cBREuV19HR DTpC3dRB1YXUcGrArLW4+JH/qqrKfVGOzONalOagu+JIIWZsogoNFIh6QVDdGofdiSV2 cYcg== 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 b12si539532ejz.40.2020.05.13.13.54.48; Wed, 13 May 2020 13:55:10 -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 S2390433AbgEMS4k (ORCPT + 99 others); Wed, 13 May 2020 14:56:40 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:51900 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390381AbgEMS4g (ORCPT ); Wed, 13 May 2020 14:56:36 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 4724A2A0188 Received: by jupiter.universe (Postfix, from userid 1000) id 7203A480103; 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 05/19] power: supply: sbs-battery: Add TI BQ20Z65 support Date: Wed, 13 May 2020 20:56:01 +0200 Message-Id: <20200513185615.508236-6-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 BQ20Z65 manufacturer data to the sbs-battery driver. Implementation has been verified using the public TRM available from [0] and tested using a GE Flex 3S2P battery. [0] http://www.ti.com/lit/pdf/sluu386 Signed-off-by: Sebastian Reichel --- .../bindings/power/supply/sbs_sbs-battery.txt | 1 + drivers/power/supply/sbs-battery.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt b/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt index 4e78e51018eb..fa5a8b516dbf 100644 --- a/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt +++ b/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt @@ -6,6 +6,7 @@ Required properties : part number compatible string might be used in order to take care of vendor specific registers. Known ,: + ti,bq20z65 ti,bq20z75 Optional properties : diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c index 6acd242eed48..a15783802ef8 100644 --- a/drivers/power/supply/sbs-battery.c +++ b/drivers/power/supply/sbs-battery.c @@ -149,8 +149,8 @@ static enum power_supply_property sbs_properties[] = { POWER_SUPPLY_PROP_MODEL_NAME }; -/* Supports special manufacturer commands from TI BQ20Z75 IC. */ -#define SBS_FLAGS_TI_BQ20Z75 BIT(0) +/* Supports special manufacturer commands from TI BQ20Z65 and BQ20Z75 IC. */ +#define SBS_FLAGS_TI_BQ20ZX5 BIT(0) struct sbs_info { struct i2c_client *client; @@ -626,7 +626,7 @@ static int sbs_get_property(struct power_supply *psy, switch (psp) { case POWER_SUPPLY_PROP_PRESENT: case POWER_SUPPLY_PROP_HEALTH: - if (chip->flags & SBS_FLAGS_TI_BQ20Z75) + if (chip->flags & SBS_FLAGS_TI_BQ20ZX5) ret = sbs_get_ti_battery_presence_and_health(client, psp, val); else @@ -950,7 +950,7 @@ static int sbs_suspend(struct device *dev) if (chip->poll_time > 0) cancel_delayed_work_sync(&chip->work); - if (chip->flags & SBS_FLAGS_TI_BQ20Z75) { + if (chip->flags & SBS_FLAGS_TI_BQ20ZX5) { /* Write to manufacturer access with sleep command. */ ret = sbs_write_word_data(client, sbs_data[REG_MANUFACTURER_DATA].addr, @@ -970,6 +970,7 @@ static SIMPLE_DEV_PM_OPS(sbs_pm_ops, sbs_suspend, NULL); #endif static const struct i2c_device_id sbs_id[] = { + { "bq20z65", 0 }, { "bq20z75", 0 }, { "sbs-battery", 1 }, {} @@ -978,9 +979,13 @@ MODULE_DEVICE_TABLE(i2c, sbs_id); static const struct of_device_id sbs_dt_ids[] = { { .compatible = "sbs,sbs-battery" }, + { + .compatible = "ti,bq20z65", + .data = (void *)SBS_FLAGS_TI_BQ20ZX5, + }, { .compatible = "ti,bq20z75", - .data = (void *)SBS_FLAGS_TI_BQ20Z75, + .data = (void *)SBS_FLAGS_TI_BQ20ZX5, }, { } }; -- 2.26.2