Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp2797324rwe; Sun, 16 Apr 2023 05:45:58 -0700 (PDT) X-Google-Smtp-Source: AKy350bocMePsecfsFc4SqozU/XyYafEZw+K13gXC8E0O/MUw9muXIko9mKRaJzCUwKJ4I8y6VSj X-Received: by 2002:a05:6a20:2451:b0:ef:6e5a:8b1e with SMTP id t17-20020a056a20245100b000ef6e5a8b1emr1659249pzc.24.1681649158044; Sun, 16 Apr 2023 05:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681649158; cv=none; d=google.com; s=arc-20160816; b=C5BnmXAty2sCh31hJsnJVA6yVuvA1aJPD8JmnOxF68eKp/OW6eHrOlM72WLftX3QAo ClKOtrq6Qo8//cy1lxALVZNlog+8Nhs1TXlee4q+ov/K6x+niq6rDP9G/hDolbCeDrC8 +Kk+04tISmauF8TgTyypxgf0M3rLsaxuONlUEtCSZm5SsHLZFHi7V0T5Kdjq93Ek2/tD g4h0cL16XthOnEYD41hW7fhsx6NGclBB07FoTD4/IUZzb/cwxJjVIlRLt3XWOmxlLMTJ DCtSVHofBmAE24NhBaiOasmdFtO+d5Q7UZXKuh+aBeYWiC9OwpFfslB1YYML3dubAAXk o+6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BgnxKccDW0hD4wBKD/wGrzdwGz4y7GQfSjWtC1jgF84=; b=rCt4BbWLdVFsn/X46RWGF0PlI8baEAazuk2H10mBwdXayuQLvXcX+AtxoU+NJEi3Ge FRY2Dd+aXEHkUpe68VGlExKK9E0WqG8h0XmCXjsOc8rgEfoI2ZT9S25zr2bfVzeuMtM8 I0pw4lw1iRO7eE4+97a0zTb1devBSgz/2ed8q0nS6Dl6yF6l63jdUxnLPV8VPR4vowmF h4ryDiEsxh3BjC8/b1k7/dpjrliQnVem1KK3l36rLSavcz4DIFSXGtX1NoeKWYEjFv60 G3l4xYoTktMjxQ6Tyj0XJgMZRKReCNuFNfb3uXLHmnL6L5fGxzxZkkXgf4++8C39DFwo /GqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rocketmail.com header.s=s2048 header.b=WrGLvDI0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rocketmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e27-20020a631e1b000000b0051391dd5dbcsi9400526pge.566.2023.04.16.05.45.45; Sun, 16 Apr 2023 05:45:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rocketmail.com header.s=s2048 header.b=WrGLvDI0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rocketmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229549AbjDPMpV (ORCPT + 99 others); Sun, 16 Apr 2023 08:45:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230422AbjDPMpR (ORCPT ); Sun, 16 Apr 2023 08:45:17 -0400 Received: from sonic314-19.consmr.mail.ir2.yahoo.com (sonic314-19.consmr.mail.ir2.yahoo.com [77.238.177.145]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B36295240 for ; Sun, 16 Apr 2023 05:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1681649107; bh=BgnxKccDW0hD4wBKD/wGrzdwGz4y7GQfSjWtC1jgF84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=WrGLvDI03t9ixKW8BXIrR4+Q+gua8L8MuaHIr2+gMD89i+nyI1OEfFhrZl3i5YxMJgnTV/IUgOH7pO1Ifz9piZ0BfdbF0A9KGyFMzfF58FOYCX17f5iUvx4uUYTdNN0XLjw5bF4pxG934CqBLExiiFMIV+W/wDhLdziZJDrzpw+F09wvScBeZriuhLB06wx21dbBnOfwafDFbYTqF+aU10/sQ4mXlXn20MBtDNFPD3iVtBTOotmFZB/J45ujSTcmGGJ+UObRf94vhurMK179l4Kljul8rDPUgjrC5LupBYYLluOToOWf54z27ik/UYeXmOlQ5PuSgor9DxOO9F1hWA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1681649107; bh=NW+YohgAJIbbu+CgcHo6KoDs37jn6lf4CpBsx9o0SLx=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=dJUlraXL6u+S2u75PB06KZo/r+CbL253gXEzSZC5EisMN4m0wm7nU8Ygj5wyRGEPo4yhCp81iBEIlvmCdJ1KOrpRhc5nuiCy067OltLrfIeDAozDwFmM6GsOnjTBshwokQmw05Yup91ycGP7Ykfb16UBN7QSnVTuuGIgV96HsggZptUu8LhU6PJoOhEX3WagkU3tkpHpyIbnng8GuDqT4XqsxdbRTvLYUP00RFiz3TwE4ihPSPGM6DdYXfMgEQR8Xvqlb631j8vXpvDNrUzCU28scjG0L05QcUyF7YimfsJRpEN1xpj6apK/53dK9khyyoP6YA+a7RIQozoUaWFT2A== X-YMail-OSG: 0xG1sX0VM1nFpK4qSSijT7Eo3.3W6j2mCRJwPArQWwvzLUQ17rf61lj8gHzNZnO o1LFuZ4.PegTxUrjbrXTI56K2eqOAiRfloL8w8EbkCt5LCEN0iNtxmJGvDwL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OVgT5m4g2C.p0 JQTtdIjZw7Jst3HQMPiSlzGqb5qNDW6tR5.F8tmblFJS9bD1qf7DuU1XoZ68inGz1mDv7GgTbber yyChx.ZEZHlNjntEnoH8KxrzvDuflKu0elz3cMzSmcYYbsko- X-Sonic-MF: X-Sonic-ID: 8127dbfb-da10-4c3d-b8b5-d9c2217b666d Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.ir2.yahoo.com with HTTP; Sun, 16 Apr 2023 12:45:07 +0000 Received: by hermes--production-ir2-74cd8fc864-4bl68 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 8a53f7a8722383f9609d619e4fab1862; Sun, 16 Apr 2023 12:45:04 +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 , 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 v2 3/9] mfd: rt5033: Fix STAT_MASK, HZ_MASK and AICR defines Date: Sun, 16 Apr 2023 14:44:30 +0200 Message-Id: <7eda1f8751b4f5a5bd88063b7fbf3cfdb911019c.1681646904.git.jahau@rocketmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 -- 2.39.2