Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2589919rwd; Mon, 15 May 2023 14:00:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ZSrGPqeXaxHeK8W5tsRRtYayHp7TdJs/8Ts19AgZTZfuJwgrmkkriK3Dv+4deT/etBMN7 X-Received: by 2002:a05:6a20:8f22:b0:101:1e75:78e with SMTP id b34-20020a056a208f2200b001011e75078emr26526462pzk.14.1684184417878; Mon, 15 May 2023 14:00:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684184417; cv=none; d=google.com; s=arc-20160816; b=HUHO4SSJyUiitvXlr1TP7/1X3gy0XzIdT5sKzeFF/H0HaceusFB8b20QTWjZJ33R1U bFybTjx3OL/68oizdHv5Z3eiNxlawX7quvSDo+t8ICKWHNcvPvydCqR2k5m0rzgSxCFs dWDoG3WlBZzH5BS54Aq6m5JzUVIXJL6Ym+G9mjEBLgTQHJ+OCHcynmbJySqGJvF9hoLn 5mVLjqAMlsRG/BdP+jxXoLL2dds05W3ZrVU2bmWdXhJZgO5URoPEpjicJwJGDFDc+ckl aWwFyZOo9YFqtfX8WTJIRelU3Ncncc19r060/MQM8eyWhe+zfLSZorvxsFmjo0GlKozv 28Vw== 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=Fg8O9S7CQWLvLBXMCmKEFeFmz8DxFrOra+7NQGOwBwo=; b=do9b3eTW9JnbtQYXva5ji7wjpO4C/Y5x/wvgF/Y/YANLl0x7FvXolI39yREtyZ6f6w xl45P0HX+AaUbVGJAlO8WnVHJGP582jYw9toYLrRa/9ZWQ+D5dtdx0wWW8LNO2YS/zT8 8y78WNuzyrWML1bImUENZDKI91Ub8wcQiDZRqtaaLPfxdHrdiQ2lxN77AIQphzuH0AbW D4lnLtHln1p7y8w99ZJt7jh/aEkatXlq/554o/tK++BBj0v1xlY9sFhg6VV8Szm2nmTM tmJvne28El6q4JSaeRucpiJmXah0C0jdm3moyNYtjjaJxF8KYM2UiXqZQ9RdKI3qpEbo a+Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rocketmail.com header.s=s2048 header.b=KLgw59si; 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 h191-20020a6383c8000000b0053439c1712csi104491pge.716.2023.05.15.14.00.04; Mon, 15 May 2023 14:00:17 -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=KLgw59si; 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 S245428AbjEOU5n (ORCPT + 99 others); Mon, 15 May 2023 16:57:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245426AbjEOU5j (ORCPT ); Mon, 15 May 2023 16:57:39 -0400 Received: from sonic307-54.consmr.mail.ir2.yahoo.com (sonic307-54.consmr.mail.ir2.yahoo.com [87.248.110.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01F88AD26 for ; Mon, 15 May 2023 13:57:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1684184256; bh=Fg8O9S7CQWLvLBXMCmKEFeFmz8DxFrOra+7NQGOwBwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=KLgw59siLP5aTwyTLirAAR7oTmgqFrV09vVVj5D1YfewesFxRHGIXIUNL6JbaBHBKW+72axH92LMHj5iJW4B+BGd6o+L7m4cDooZkrNVbw3uU93SaDjn+3dx9rfu1ePVckrEseI+9XKrpqTQWL+Eavt4ftUIYj1JCFngjLbVB+262/7QyVcq1fNiHrF/bDzxnlbmFNN65DMHS8luN1nnQ1hSu+nD9fhmNqGEx0SG8pJbj+5q1IDsecFIuy8ssAMoYgsRw1nKoRjYykVzmFKHuaBWUqKH4oJg60GrQQRWrpkBX63vnuKFZCNVUQ30qYC2AKNchgc1/FJStxbkHvNuSQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1684184256; bh=o2GHG1LhsZHk0TqMZ3cA2SyivK5FR+kgQeoAp/d/GMr=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=f91xZ0WhSjjiTWDwp9+/z/kvEFvWymp7AfgsK+n2cpYamyW1fU3f6w+xNE209MdjOc7u9t8RJPFRIGCDGIcPM+6XcsgyIvT6SmU6FtASVActn9mBrcHi4EBHqMEcokYGUTaYU4zm8+vDHgCLNyLg2baxSIbi2aJtffmpeDnuoL+V8PAm+73At2lAHfkhko6SYiuvMo9ZHeoq6Wy1O5+0payOZimo4+x7Ih0u853K+0AlrtC0FM2F5Yap0jWPwBfWHcz8C2OdMSy+lN1bHHYFMrUnNeRIPzct31RWwZpp87zPhiiSHA2IxTje0srQy8Zu1onnExnC8FgfAud1hkQSCg== X-YMail-OSG: XCDPuLUVM1l7gVzRyked2O3i4BOOmEyKDOPIbPujlG5bbMlCgmEwiajKyVtR0Pl 8dQtvYkgiFANoxT7cctOIgxHueUQnq.EvtsVWn3WE6CMlZMAQsnuAslrLS4bak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JJe7Z.1HlNw1atjDqTy8yHZGIYXKrV651JxDmlShz1QKWidgRAQYjjQJY2NV_VbYag3 xD7.k7Gs.ndXeSNRP8sOf X-Sonic-MF: X-Sonic-ID: 2a3477bd-9daa-4464-95fe-ecaf6f77d76b Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.ir2.yahoo.com with HTTP; Mon, 15 May 2023 20:57:36 +0000 Received: by hermes--production-ir2-7867f454fc-mmctx (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 9295bf04d78301a0059f933a0cc30ae0; Mon, 15 May 2023 20:57:32 +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 02/10 RESEND] mfd: rt5033: Fix chip revision readout Date: Mon, 15 May 2023 22:57:11 +0200 Message-Id: <9a98521ffdf76851d5d344afa6ce65f692ecc024.1684182964.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,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 After reading the data from the DEVICE_ID register, mask 0x0f needs to be applied to extract the revision of the chip [1]. The other part of the DEVICE_ID register, mask 0xf0, is a vendor identification code. That's how it is set up at similar products of Richtek, e.g. RT9455 [2] page 21 top. [1] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/drivers/mfd/rt5033_core.c#L484 [2] https://www.richtek.com/assets/product_file/RT9455/DS9455-00.pdf Signed-off-by: Jakob Hauser --- drivers/mfd/rt5033.c | 5 +++-- include/linux/mfd/rt5033-private.h | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/rt5033.c b/drivers/mfd/rt5033.c index 8029d444b794..3eee4242ee02 100644 --- a/drivers/mfd/rt5033.c +++ b/drivers/mfd/rt5033.c @@ -55,7 +55,7 @@ static const struct regmap_config rt5033_regmap_config = { static int rt5033_i2c_probe(struct i2c_client *i2c) { struct rt5033_dev *rt5033; - unsigned int dev_id; + unsigned int dev_id, chip_rev; int ret; rt5033 = devm_kzalloc(&i2c->dev, sizeof(*rt5033), GFP_KERNEL); @@ -78,7 +78,8 @@ static int rt5033_i2c_probe(struct i2c_client *i2c) dev_err(&i2c->dev, "Device not found\n"); return -ENODEV; } - dev_info(&i2c->dev, "Device found Device ID: %04x\n", dev_id); + chip_rev = dev_id & RT5033_CHIP_REV_MASK; + dev_info(&i2c->dev, "Device found (rev. %d)\n", chip_rev); ret = regmap_add_irq_chip(rt5033->regmap, rt5033->irq, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, diff --git a/include/linux/mfd/rt5033-private.h b/include/linux/mfd/rt5033-private.h index 6bb432f6a96c..b035a67cec73 100644 --- a/include/linux/mfd/rt5033-private.h +++ b/include/linux/mfd/rt5033-private.h @@ -71,6 +71,10 @@ enum rt5033_reg { /* RT5033 CHGCTRL2 register */ #define RT5033_CHGCTRL2_CV_MASK 0xfc +/* RT5033 DEVICE_ID register */ +#define RT5033_VENDOR_ID_MASK 0xf0 +#define RT5033_CHIP_REV_MASK 0x0f + /* RT5033 CHGCTRL3 register */ #define RT5033_CHGCTRL3_CFO_EN_MASK 0x40 #define RT5033_CHGCTRL3_TIMER_MASK 0x38 -- 2.39.2