Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1341817rwr; Thu, 27 Apr 2023 16:32:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5NpMo6E9UbRV2PTvcA1EBWIjSOwavrpiQYIDLbYSKqPlbXy14yAb8NtM56eWnsYBPKfew3 X-Received: by 2002:a05:6a00:2451:b0:627:f0e1:4fbf with SMTP id d17-20020a056a00245100b00627f0e14fbfmr4330648pfj.33.1682638354108; Thu, 27 Apr 2023 16:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682638354; cv=none; d=google.com; s=arc-20160816; b=GZhMlf8YN3Z1hRzF6B0dMVqVX1cogn9K/uuDRqO504GNky0vTg1gl/K81ruOipnBZ5 Ntu2q/JnvYNW6N+g4hli2OCmr1sep/EEtC8JUMePa8VN8qQGG08hFKO4XJJeq9NpUSGx LcgR9MuscAm/945upsa6U4AjBPTlJk6WhzcDdZKky9IF1obwl7eCBvUZ7p8uM1WcfKeo 8G8PQBed2VXQYGIQUgyLx1ktMenaOUF7tcZ5YVZfFOWKlWdxSc6gM0gi4I1i/nKJwDi4 Q0TMMUUiyO0SebufVN+yS+VAJq6hrTv1ZGEqK/n0pJ9XYSPOV1DpawvKbu9QGFvGxkAJ YIpA== 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=jEPI52bfEpbdxYXhBuMTP1N5oCBUkPtaSCZilvepGwC2EO+409/8dUJqfAcNkQYBqI ZCMqOtTf6i1qDssetrlaO5qdki5KdCvcbo4GUa2jE7FDr/LARQaH6IZHx1trfSbcMDiC a1hQyrNsOzqwijRVKExXaFx3G6NAduq43OG9GeHxdyXVP1R87NAd4SxONtNVT7tVvURC rT70AUCtdpPWGYTC/AkdfHeBuT+b6YCEvQUQ/9HNY0V0PV1XlGpPROwqTM3/rRf9OUGa AnDHPCbpKFT233MFDQujdKl0LfZRFdUhpRZFybptrpSw3GcAX19CNV00lKNkS5ZpMcGC RhmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rocketmail.com header.s=s2048 header.b=PQKjhQf0; 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 p10-20020aa79e8a000000b0063b7ab0b1aasi20314973pfq.242.2023.04.27.16.32.23; Thu, 27 Apr 2023 16:32:34 -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=PQKjhQf0; 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 S1344227AbjD0Xa6 (ORCPT + 99 others); Thu, 27 Apr 2023 19:30:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344433AbjD0Xaq (ORCPT ); Thu, 27 Apr 2023 19:30:46 -0400 Received: from sonic306-21.consmr.mail.ir2.yahoo.com (sonic306-21.consmr.mail.ir2.yahoo.com [77.238.176.207]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A69C14680 for ; Thu, 27 Apr 2023 16:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1682638237; bh=BgnxKccDW0hD4wBKD/wGrzdwGz4y7GQfSjWtC1jgF84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=PQKjhQf0IZKJMvQi7N9dhnmn7aouaXPgOFtQPXtWZwq1RmCbsAc8jnYENaYkp5HVF9XK33u6Adp/H/NZK/8L3Rcwtadk2F6ZbxHtQ+IIeuwBvH/0PdfWahezGCTcKEKyUPUC0hVBqqr9eDFb36pFXjEPBOnIbH7f2y15kn3kD2yRI0zK6cmBBPAVRKrcNHqj47WEOiEK3Kg++30sfKJMm2yRuG9jeFDkHYuX1fxt3jyb9JISn2QY0Lvpzh2Z6DTVsI0S0hsq18nz+jyG2PbX4fuOZ45M/xlYvLTeXsfQEE5dptbY5i8a0JRi+DIlnpU8eLrh9M++RujM2jJNiD23JQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1682638237; bh=YleMwHgEakViniISIjbeHeefdZSR23tchtT2HsYzT3i=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=YWQJOi64ApcawUCjkQf1dbmCFK5EwMUedqVRjKMKCJj8Plt/sPX6gJwnMuyazswrr/0V1BRWfcAqt36vqwBTqzfHU5eZBrQ8NneqkbdILOB5r8qWRbJJLrAdcsb9YAt6BU8lyyDIfZTJ4SnB9+S4ocx73orDbFcxVKSVEfCm/vmG/JEtqgeF1Vl/qH0G4sz6hPpu5LZL9NSdMjmXx83Kc33TIuhnJstK3RcnS9BY1batCSlfONkI5yUH4La8066SJNyvVa4Esprv1yttJjd15Xic6r1Ybcd+siKFqdAX4SWJFZO6jjWmlzxMkNNPUgM5wVVjGZK5fKGgwes4zn0RoA== X-YMail-OSG: zc4eXssVM1m9uhj2LuHZGyMOiYHu_hNQR_9KT6z8KzHNrYtaxkjcX3CB0pATnGY wDA0SK1hHo36Vck0qWQFhDn90g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MA0hQvz87YgGZdBurPF8L4tHDBn0LqFqqMAFE jYflevAF2pExTgOUr0jOfRr__8lNF6LNzhOLp36lI9rneCFsOWOko.m2RKjfhfgb7UOvTTXIFqJl 1DCwxToLH_hy8BrYiEVPwCzE- X-Sonic-MF: X-Sonic-ID: 613b4756-daa9-440d-a15a-85cdf205f9d2 Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ir2.yahoo.com with HTTP; Thu, 27 Apr 2023 23:30:37 +0000 Received: by hermes--production-ir2-74cd8fc864-9w846 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 912b1d1a256b22e43f453e00130c1256; Thu, 27 Apr 2023 23:30:36 +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 , 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 v3 3/8] mfd: rt5033: Fix STAT_MASK, HZ_MASK and AICR defines Date: Fri, 28 Apr 2023 01:30:06 +0200 Message-Id: <8e4c8cfb7820081e62fd6d86db6c53cd2792a29c.1682636929.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 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