From patchwork Sat May 6 15:54:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Hauser X-Patchwork-Id: 680171 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 867C5C7EE2E for ; Sat, 6 May 2023 15:55:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233179AbjEFPzO (ORCPT ); Sat, 6 May 2023 11:55:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232975AbjEFPzI (ORCPT ); Sat, 6 May 2023 11:55:08 -0400 Received: from sonic308-18.consmr.mail.ir2.yahoo.com (sonic308-18.consmr.mail.ir2.yahoo.com [77.238.178.146]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22CF113C37 for ; Sat, 6 May 2023 08:55:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1683388504; bh=BgnxKccDW0hD4wBKD/wGrzdwGz4y7GQfSjWtC1jgF84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=UfadBhbI9VtF1wxEGJ3H7hb766TB7uvihxuyKpmC3klAR+V0OihCmdcmXJi+1INZ075veT8BwnerMbfHioyE6KLycf7QROMGvf67pAc74uz+PEsFeKmiG2pKtqnvyT/0QCLGnbeUd42Q3YXioU7+SbuFaJSiSeCN6QsjHY8BjWCrOCawxTPRw0CLmWWs+rKBq2e9I3D+nYsuA4lOpFOsDwSB/p3yX7yk3OKw+sbKifu29a5Zyr5XS/NclN4K3EAnUTbJOMFuDm8kOZ+olqz6GfhHynysULcZnDzgF8NwSaUMULsO96caXTPBsNBWXKBjTU86j0E8cbI1zCa28vD+tQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1683388504; bh=RNV/JCjeLztT9viv2T43hMVNespAeCRByTEg8dNf8wi=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=oCY6/0FeqsIDyjjgnHnzar6t3qKAWIT6grM1BiI0xvsYsAA2ciA9nAD61jN7xFXEUwQZ0eHHkBDbWcmsO6AmkGP7bfEZMwhFfMBNajIx8NJwXPFmYUy59pjHkdRj9wVn6Q0cQPjI4wQ2bWCXc6M5Lh6n8avDIqq7FlAOPcZBxyGNbU0e8XKxaTLJYIPFORfSH/P6D/aWoLXWSTFv03yba9dbsRks/zY7GZhx98mWKQvDaztmkxHxhOx6N2giWTH9MdUelHt45UyUYyee6cxPeK1R0/5PT1w2LkcVOydIcMeuHP2j0jqeNPO1CKmF/ZEICyX6nQT/1wHHMM0CGHMh0w== X-YMail-OSG: .EoXj1sVM1lMET6iIQaEh88oWOhfkp1zUO.qZIYIPaOOOQlFDITJUuvI7TlEeow ftUouzjxfcP64YFDzg_nH01EeAbzH_a_sWyEY_hZBqBISXRn6ppZ6j0YLZIjBMVfGmUL81z71wcf EucITv7Pt_4Y0EPoBudH_EpIEOKKYD7hPlF7CApX9vNbEaPbsQPP8wd3OEAwcDSeVEOn5DsTFrXc FF2ZtSnrUyVDSrvFOQdBoylq9eGolfPiN7YoGUBH6B1u4C5VyeaocAIcIBFMJVTkSUpvjKJzn0c4 XyOkRXiVWycp7UrK0QrnzwTBjr2UIpoWzYXS7UYVnmpewfYz05S9yb.XRGi2xJUo0o41ea1R_ZAq PYMVWcAGJJzVu9Yg0ViZoo0_LRRmL2AyT79KdcG2F5DK.m6V2D0X1IrM3h3A26hXaevldFSo7vc9 dfZYuwqrldiLBkth7qcBMrYtcIhUO3Fkov.NjXxMgBaCDdTv4kSBr6e8VslJp20uVilcRBepNtYm xVGyNK7d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bFbYuSlIYtllfNMrLarQxWWIz_ADvIRZpasQyG07MyWy19sE8AKT8N l7mVNWFZoe8sZOHKemen5NEl6N8v47UoUjbmfvmtD2jO47OVyiyNGdIs0GQGkwyIQa9RAxOZUjeB FXxCrjOJDD_tSJZnnvICIk298SBqXX5LWXrXoyO9RchixFuqfkPXW47fLl8zQFE1zw3crFOGx6hT s.0aSbdkidbPHVzLEbmQ7kSpfVPBmBLQgKKuZIB5wdO_XMzfizONwR0IdTpBaFyHFW3C0P4pK0np dVOzKLDo1_EzTvNFnpTRnLGZ1CaO3m8um7muaVy2NW3DH3bBZueeF6w_CNlVD1mVu7WSCekCeq7J 6QioTa3Qt3SGDDdhBi_aoSNbm7Eg6QN9xV1nnLHVorM_a8S80a51G8sCuD7afnClzBFezfHpVfwZ ttxuM1nsWLEUPwQ4fOy8yk2.WxgdLdfyIwtGzItvwGVDx4n3le0oo9qHeweWhlqUle.Q_ftZ0Oqu 3vu2HMc3tV1ld1goQQmm3Z8tMN5s7e949q71m7yA4QbksbjC_awy5GpZrhXriQXdRjL6kyBRi1MP yBFcrfJrHKymrRX5shaXcehN0J3nNryw.16l0khD7XzZnHhB3W02Bcm3Po3sCMfU_S0wBmdcT7BR XEgWriYjDSDzc3NsxJvLTNb1.TX9R4PeGJveNwSmG3aZnBetNu0LdsI7eQN.Gs5_99zWQXW6hTnX sF3_Kyc33mgrgaF5eeH9RsA-- X-Sonic-MF: X-Sonic-ID: daf1be99-739a-4c97-bd31-81579ac28943 Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.ir2.yahoo.com with HTTP; Sat, 6 May 2023 15:55:04 +0000 Received: by hermes--production-ir2-74cd8fc864-s5qrx (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 2f796affa0781b2e3002453351a4dea5; Sat, 06 May 2023 15:55:03 +0000 (UTC) From: Jakob Hauser To: Sebastian Reichel , Lee Jones , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski Cc: Beomho Seo , Chanwoo Choi , Stephan Gerhold , Raymond Hackley , Pavel Machek , Axel Lin , ChiYuan Huang , Linus Walleij , Henrik Grimler , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht Subject: [PATCH v4 3/8] mfd: rt5033: Fix STAT_MASK, HZ_MASK and AICR defines Date: Sat, 6 May 2023 17:54:30 +0200 Message-Id: <20230506155435.3005-4-jahau@rocketmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230506155435.3005-1-jahau@rocketmail.com> References: <20230506155435.3005-1-jahau@rocketmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The charger state mask RT5033_CHG_STAT_MASK should be 0x30 [1][2]. The high impedance mask RT5033_RT_HZ_MASK is actually value 0x02 [3] and is assosiated to the RT5033 CHGCTRL1 register [4]. Accordingly also change RT5033_CHARGER_HZ_ENABLE to 0x02 to avoid the need of a bit shift upon application. For input current limiting AICR mode, the define for the 1000 mA step was missing [5]. Additionally add the define for DISABLE option. Concerning the mask, remove RT5033_AICR_MODE_MASK because there is already RT5033_CHGCTRL1_IAICR_MASK further up. They are redundant and the upper one makes more sense to have the masks of a register colleted there as an overview. [1] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/drivers/battery/rt5033_charger.c#L669-L682 [2] https://github.com/torvalds/linux/blob/v6.0/include/linux/mfd/rt5033-private.h#L59-L62 [3] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/include/linux/battery/charger/rt5033_charger.h#L44 [4] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/drivers/battery/rt5033_charger.c#L223 [5] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/drivers/battery/rt5033_charger.c#L278 Signed-off-by: Jakob Hauser Acked-for-MFD-by: Lee Jones --- include/linux/mfd/rt5033-private.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/linux/mfd/rt5033-private.h b/include/linux/mfd/rt5033-private.h index b035a67cec73..b6773ebf4e6b 100644 --- a/include/linux/mfd/rt5033-private.h +++ b/include/linux/mfd/rt5033-private.h @@ -55,7 +55,7 @@ enum rt5033_reg { }; /* RT5033 Charger state register */ -#define RT5033_CHG_STAT_MASK 0x20 +#define RT5033_CHG_STAT_MASK 0x30 #define RT5033_CHG_STAT_DISCHARGING 0x00 #define RT5033_CHG_STAT_FULL 0x10 #define RT5033_CHG_STAT_CHARGING 0x20 @@ -67,6 +67,7 @@ enum rt5033_reg { /* RT5033 CHGCTRL1 register */ #define RT5033_CHGCTRL1_IAICR_MASK 0xe0 #define RT5033_CHGCTRL1_MODE_MASK 0x01 +#define RT5033_CHGCTRL1_HZ_MASK 0x02 /* RT5033 CHGCTRL2 register */ #define RT5033_CHGCTRL2_CV_MASK 0xfc @@ -92,7 +93,6 @@ enum rt5033_reg { /* RT5033 RT CTRL1 register */ #define RT5033_RT_CTRL1_UUG_MASK 0x02 -#define RT5033_RT_HZ_MASK 0x01 /* RT5033 control register */ #define RT5033_CTRL_FCCM_BUCK_MASK BIT(0) @@ -119,13 +119,14 @@ enum rt5033_reg { * register), AICR mode limits the input current. For example, the AIRC 100 * mode limits the input current to 100 mA. */ +#define RT5033_AICR_DISABLE 0x00 #define RT5033_AICR_100_MODE 0x20 #define RT5033_AICR_500_MODE 0x40 #define RT5033_AICR_700_MODE 0x60 #define RT5033_AICR_900_MODE 0x80 +#define RT5033_AICR_1000_MODE 0xa0 #define RT5033_AICR_1500_MODE 0xc0 #define RT5033_AICR_2000_MODE 0xe0 -#define RT5033_AICR_MODE_MASK 0xe0 /* RT5033 use internal timer need to set time */ #define RT5033_FAST_CHARGE_TIMER4 0x00 @@ -195,7 +196,7 @@ enum rt5033_reg { /* RT5033 charger high impedance mode */ #define RT5033_CHARGER_HZ_DISABLE 0x00 -#define RT5033_CHARGER_HZ_ENABLE 0x01 +#define RT5033_CHARGER_HZ_ENABLE 0x02 /* RT5033 regulator BUCK output voltage uV */ #define RT5033_REGULATOR_BUCK_VOLTAGE_MIN 1000000U