From patchwork Mon Dec 17 02:52:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 10732685 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 290BA746 for ; Mon, 17 Dec 2018 02:52:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F46E29CDB for ; Mon, 17 Dec 2018 02:52:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13CF029CF0; Mon, 17 Dec 2018 02:52:31 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 AA9D329CDB for ; Mon, 17 Dec 2018 02:52:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726287AbeLQCwa (ORCPT ); Sun, 16 Dec 2018 21:52:30 -0500 Received: from rere.qmqm.pl ([91.227.64.183]:50125 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731260AbeLQCw3 (ORCPT ); Sun, 16 Dec 2018 21:52:29 -0500 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 43J5J551nBzMy; Mon, 17 Dec 2018 03:51:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1545015061; bh=gsuyRNATvcY+AiX3OuQh0oQfCict15tV1nUV7tiYIhw=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=MsdLqlCTP4sqGVwKyAZRQoQ/aQn+yXFedmVxhsWNgSRgJPmJ2IREJ4upEHaicQR4w FmtcGSmV3KC2BDHSacVv2gEAStaWMiJ6Zmee2VkvJtxVSrzXYBJSob7y8JW1Idqaib ctsUSxh3k6wCBzHQBfH4ul7Lf1EAAwNeuEP7t9SYUQ6cBB5wE6J8jEeReEqqe2Wx+J CTA9lOVIXgzkD3MwEJ5FrXciyKSItVcNVJq9npNfYuipUxCTmsuqdXimT8GrB73pfz nGzvNNTMlPd5/OJ0WP9BonaXhkze8CvKhSOBPPJjf/JHvekuslEBk0XIYIHnpsXeo+ g5KXPxApNK2tg== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.100.2 at mail Date: Mon, 17 Dec 2018 03:52:27 +0100 Message-Id: <5b86085ab672eca5fdef13f7fde27dce066eb0b6.1545014442.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH 2/3] power: supply: bq25890: support BQ25896 MIME-Version: 1.0 To: linux-pm@vger.kernel.org Cc: Sebastian Reichel , Laurentiu Palcu 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 BQ25896 differs only slightly from BQ25890/2. Add the required ID and two additional fields from datasheet. Signed-off-by: Michał Mirosław --- drivers/power/supply/bq25890_charger.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c index db66f38d6b04..a8b2d939cfcd 100644 --- a/drivers/power/supply/bq25890_charger.c +++ b/drivers/power/supply/bq25890_charger.c @@ -32,13 +32,15 @@ #define BQ25890_IRQ_PIN "bq25890_irq" #define BQ25890_ID 3 +#define BQ25896_ID 0 enum bq25890_fields { F_EN_HIZ, F_EN_ILIM, F_IILIM, /* Reg00 */ F_BHOT, F_BCOLD, F_VINDPM_OFS, /* Reg01 */ F_CONV_START, F_CONV_RATE, F_BOOSTF, F_ICO_EN, F_HVDCP_EN, F_MAXC_EN, F_FORCE_DPM, F_AUTO_DPDM_EN, /* Reg02 */ - F_BAT_LOAD_EN, F_WD_RST, F_OTG_CFG, F_CHG_CFG, F_SYSVMIN, /* Reg03 */ + F_BAT_LOAD_EN, F_WD_RST, F_OTG_CFG, F_CHG_CFG, + F_SYSVMIN, F_MIN_VBAT, /* Reg03 */ F_PUMPX_EN, F_ICHG, /* Reg04 */ F_IPRECHG, F_ITERM, /* Reg05 */ F_VREG, F_BATLOWV, F_VRECHG, /* Reg06 */ @@ -47,7 +49,7 @@ enum bq25890_fields { F_BATCMP, F_VCLAMP, F_TREG, /* Reg08 */ F_FORCE_ICO, F_TMR2X_EN, F_BATFET_DIS, F_JEITA_VSET, F_BATFET_DLY, F_BATFET_RST_EN, F_PUMPX_UP, F_PUMPX_DN, /* Reg09 */ - F_BOOSTV, F_BOOSTI, /* Reg0A */ + F_BOOSTV, F_PFM_DIS, F_BOOSTI, /* Reg0A */ F_VBUS_STAT, F_CHG_STAT, F_PG_STAT, F_SDP_STAT, F_VSYS_STAT, /* Reg0B */ F_WD_FAULT, F_BOOST_FAULT, F_CHG_FAULT, F_BAT_FAULT, F_NTC_FAULT, /* Reg0C */ @@ -163,6 +165,7 @@ static const struct reg_field bq25890_reg_fields[] = { [F_OTG_CFG] = REG_FIELD(0x03, 5, 5), [F_CHG_CFG] = REG_FIELD(0x03, 4, 4), [F_SYSVMIN] = REG_FIELD(0x03, 1, 3), + [F_MIN_VBAT] = REG_FIELD(0x03, 0, 0), /* REG04 */ [F_PUMPX_EN] = REG_FIELD(0x04, 7, 7), [F_ICHG] = REG_FIELD(0x04, 0, 6), @@ -195,6 +198,7 @@ static const struct reg_field bq25890_reg_fields[] = { [F_PUMPX_DN] = REG_FIELD(0x09, 0, 0), /* REG0A */ [F_BOOSTV] = REG_FIELD(0x0A, 4, 7), + [F_PFM_DIS] = REG_FIELD(0x0A, 3, 3), [F_BOOSTI] = REG_FIELD(0x0A, 0, 2), /* REG0B */ [F_VBUS_STAT] = REG_FIELD(0x0B, 5, 7), @@ -840,9 +844,11 @@ static int bq25890_probe(struct i2c_client *client, return bq->chip_id; } - if (bq->chip_id != BQ25890_ID) { + if (bq->chip_id != BQ25890_ID && bq->chip_id != BQ25896_ID) { dev_err(dev, "Chip with ID=%d, not supported!\n", bq->chip_id); return -ENODEV; + } else { + dev_info(dev, "Chip ID %d, rev %d\n", bq->chip_id, bq25890_field_read(bq, F_DEV_REV)); } if (!dev->platform_data) {