From patchwork Mon Dec 17 19:28:15 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: 10734175 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 56FC96C5 for ; Mon, 17 Dec 2018 19:28:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A37629870 for ; Mon, 17 Dec 2018 19:28:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E8F429937; Mon, 17 Dec 2018 19:28:19 +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 D962729727 for ; Mon, 17 Dec 2018 19:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727896AbeLQT2S (ORCPT ); Mon, 17 Dec 2018 14:28:18 -0500 Received: from rere.qmqm.pl ([91.227.64.183]:64257 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727155AbeLQT2S (ORCPT ); Mon, 17 Dec 2018 14:28:18 -0500 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 43JWP51Plgz60; Mon, 17 Dec 2018 20:26:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1545074809; bh=HaoI/ENv3WxubsyUxvPuasJrSjears6aOirlWOH9fcw=; h=Date:From:Subject:To:Cc:From; b=eClHVyhOeozQEz0dqsUy8r1wvyh+jKnAfm9ueWHnsLdxEA5z1LzM6GIbXo9R5wDx6 1rTmYGezEK/xWupjqav5R+UAcFbeGZKG3NZo2K7KdJ9WWjf35KwrySB1DxCL9JKnFF OFZSdNYTFzFUREwft9jNZncNpGviXS1Dbw4xvChc5dTa2qxY2ifQg9DmPkccEitv3z 7nJMRdhO0ZL8U1TmokQRq4wztSya2RdPBEfefu7yLpLg/bsNg0rwRKvQE+00/tzWac 7AId3z2rXeBBikwImILXqf5T94elU8gDMze4nfJHi+ZlsKsDcZfpD7NgQQ6Kz8WABk wJ01qmVBDSbxw== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.100.2 at mail Date: Mon, 17 Dec 2018 20:28:15 +0100 Message-Id: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH v2 1/2] power: supply: bq25890: fix BAT_COMP field definition MIME-Version: 1.0 To: linux-pm@vger.kernel.org Cc: Sebastian Reichel , Angus Ainslie (Purism) , Krzysztof Kozlowski 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 According to datasheet, BAT_COMP field spans bits 5-7. The rest of the code seems to assume this already. Fixes: 4aeae9cb0dad ("power_supply: Add support for TI BQ25890 charger chip") Signed-off-by: Michał Mirosław --- v2: rebased onto v4.20-rc7 --- drivers/power/supply/bq25890_charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c index 70b90db5ae38..3f6fb49c956c 100644 --- a/drivers/power/supply/bq25890_charger.c +++ b/drivers/power/supply/bq25890_charger.c @@ -183,7 +183,7 @@ static const struct reg_field bq25890_reg_fields[] = { [F_CHG_TMR] = REG_FIELD(0x07, 1, 2), [F_JEITA_ISET] = REG_FIELD(0x07, 0, 0), /* REG08 */ - [F_BATCMP] = REG_FIELD(0x08, 6, 7), // 5-7 on BQ25896 + [F_BATCMP] = REG_FIELD(0x08, 5, 7), [F_VCLAMP] = REG_FIELD(0x08, 2, 4), [F_TREG] = REG_FIELD(0x08, 0, 1), /* REG09 */ From patchwork Mon Dec 17 19:28:16 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: 10734177 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 A6C1514E5 for ; Mon, 17 Dec 2018 19:28:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B10D29727 for ; Mon, 17 Dec 2018 19:28:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F2D129937; Mon, 17 Dec 2018 19:28:19 +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 4538129727 for ; Mon, 17 Dec 2018 19:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727155AbeLQT2S (ORCPT ); Mon, 17 Dec 2018 14:28:18 -0500 Received: from rere.qmqm.pl ([91.227.64.183]:33378 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727887AbeLQT2S (ORCPT ); Mon, 17 Dec 2018 14:28:18 -0500 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 43JWP56wbXz9F; Mon, 17 Dec 2018 20:26:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1545074810; bh=d+ZxgTSnz8hxfQBL8XM92LV/6Kkl7F7CRxrstqHjUsQ=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=IPMQsgGHUgAQ+5W5OsGUznznuYvLdWcMmG5BZR8DmdVR//XnkGxH8nwm3ojBas+6k 9ODqZnCzMiE8SDUaWeIDQewA49Bbx4m0hL1y3EfEbZ8vABUdTG3KMKXpyQJ5TwAz3h xlx7NTH6bxyejAy3S6VoWDC593ZglUTp++4WISbRndgZHgWGgm+T9smp4ENjEALOPa 1y9hnv55JwgZ+MeDEYFJPPI/lHO1HYw6ZrMJmMBTnxu41/HMWYp2zIkFWkYT8jwWr/ atpXin0B8jlYl+7BZkWCGiQ0Rivq5sO2D0CG1WrbyxBae8xwa9YvCIu3i79LNJH949 u8E7JE3NmB3zQ== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.100.2 at mail Date: Mon, 17 Dec 2018 20:28:16 +0100 Message-Id: <8759633facb15e014d93dac6a1ece4627c70c54a.1545074364.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH v2 2/2] power: supply: bq25890: show max charge current/voltage as configured MIME-Version: 1.0 To: linux-pm@vger.kernel.org Cc: Sebastian Reichel , Angus Ainslie (Purism) , Krzysztof Kozlowski 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 Use firmware-provided limits for POWER_SUPPLY_*_MAX properties instead of chip max values. This will reflect the battery limits as those are the important ones. Signed-off-by: Michał Mirosław --- v2: rebased onto v4.20-rc7 --- drivers/power/supply/bq25890_charger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c index 3f6fb49c956c..66991e6f75d9 100644 --- a/drivers/power/supply/bq25890_charger.c +++ b/drivers/power/supply/bq25890_charger.c @@ -436,7 +436,7 @@ static int bq25890_power_supply_get_property(struct power_supply *psy, break; case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX: - val->intval = bq25890_tables[TBL_ICHG].rt.max; + val->intval = bq25890_find_val(bq->init_data.ichg, TBL_ICHG); break; case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: @@ -454,7 +454,7 @@ static int bq25890_power_supply_get_property(struct power_supply *psy, break; case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX: - val->intval = bq25890_tables[TBL_VREG].rt.max; + val->intval = bq25890_find_val(bq->init_data.vreg, TBL_VREG); break; case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT: