From patchwork Mon May 15 20:57:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Hauser X-Patchwork-Id: 683209 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 0683BC7EE2C for ; Mon, 15 May 2023 20:57:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244443AbjEOU5u (ORCPT ); Mon, 15 May 2023 16:57:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245353AbjEOU5m (ORCPT ); Mon, 15 May 2023 16:57:42 -0400 Received: from sonic311-31.consmr.mail.ir2.yahoo.com (sonic311-31.consmr.mail.ir2.yahoo.com [77.238.176.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70BBF9EFF for ; Mon, 15 May 2023 13:57:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1684184259; bh=BgnxKccDW0hD4wBKD/wGrzdwGz4y7GQfSjWtC1jgF84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=Hs0xNoDB3Cwf6Qa3uLdqHL5dT+bK0u+Uj9thWmZoNNTCaTbrJ1muQzBL72Dnyr9fuJheMd0aexMcUxZRuXIPVsz1ENEGf45vqU2UTJgMV6WPCBmvGa5NU5q+5J95R7RKwKKJDN1KqU7w8n73yoaKxvXVN9GYaQgLhb+DSn7WrkItO8yzYJI1oEIRSV8WJtxaWerebzgTNguOoBhQ6/grkF6dyAO6jyvupT+0NcoEdJgd6IGSztbq/5MCEioiFED7CdxBNlDIy7BuyzgEJlJoPvpsgKDnT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eOdlmUDhRo1SkQN2uFV5Ct7sbek6gQ.E4mRRbQy0mjAHL.kwCm4Q8Tyl9aDpvD.jZ_ERjolb _zMuM3kyIocQLOTiD3662KjNQA2EaGpkv.x.Tf7bSIsFpRVL2Uc940EdrQmq0ByEFplciFx7jx45 Snx3CByJZqb4BqL_zQ0K3f2w9ioHF5C1lwnSBgq.YjykC3z.6l2Ujnh2YrCeZZqLYgQcMwMuxn7a GG.CUdpK_8s5RFS3l4oWNhyCzm57GOMZU0QwQOq15ZbRPlmvFBxBTYuS7Cq4zCtK5X8.IuHMVUge r9SzvYl2fPLDet8SP98uWxI7zRrJEEqHrhV7ZPwzxCIWHKAzPTWj4Cbn4xQdRxu_l91EWM7NxCuT Qq_j5_wkEnS.fccfC5BTwVsUUNwJ26T1EeAKGjctNeP2oWl5ETwq21mU8dunChQAFOU5Gf1_tJSU BxE6xZpOsN1XsLg12VSVXs7Ku3Xhu3wP_9p3WrYYL6QuLgPjpOtIpRmonJKP10n19OTB0a8TyPL. .4NY_97S4alPLipWvx8kQ6ARnutjr88aahnFpkA9Euc9m2WgIoZuekGBz_cP3ypfTqBy6bWRCwW4 tBcY.2FT0AQYMALg0hPeXwIeMdPE_aS9hmFFIuHGG5T7rsVhY9Vw2qrLxIWHjLsEBQGWijd4FDMW zhKCbxCWr7q5asspcU_Iso6haj8h34XFY15dkoXuJyGe0KS0gLHbp_mkPSFrl59j7R7cE2g0OrFo TGZzvk5hlsZ0U.M_xrw0Q X-Sonic-MF: X-Sonic-ID: 048277fc-78fa-475a-90e5-6e47dc034bc2 Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ir2.yahoo.com with HTTP; Mon, 15 May 2023 20:57:39 +0000 Received: by hermes--production-ir2-7867f454fc-mmctx (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 9295bf04d78301a0059f933a0cc30ae0; Mon, 15 May 2023 20:57:33 +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 , Christophe Jaillet , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Jakob Hauser Subject: [PATCH v6 03/10 RESEND] mfd: rt5033: Fix STAT_MASK, HZ_MASK and AICR defines Date: Mon, 15 May 2023 22:57:12 +0200 Message-Id: <2f17beec3d6c59b41d7e2451d177dc8aaeb7efe2.1684182964.git.jahau@rocketmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: 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