From patchwork Mon May 15 20:09:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Hauser X-Patchwork-Id: 683214 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 160C5C7EE25 for ; Mon, 15 May 2023 20:10:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245221AbjEOUKy (ORCPT ); Mon, 15 May 2023 16:10:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244707AbjEOUKw (ORCPT ); Mon, 15 May 2023 16:10:52 -0400 Received: from sonic309-25.consmr.mail.ir2.yahoo.com (sonic309-25.consmr.mail.ir2.yahoo.com [77.238.179.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0863E11608 for ; Mon, 15 May 2023 13:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1684181431; bh=Fg8O9S7CQWLvLBXMCmKEFeFmz8DxFrOra+7NQGOwBwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=jEBBahPb3SQ9TeLL/uJ+x41sD4UL2AAa/47ug7aWCX0bnkX3GmZLT7f3weD/kC57koLEKlIXEvvg4pyuyOPGF59YuMthUOcvSRqkUMDluFZdqa9M1LSrv6IvAMSFpd0glkLOW8ZQH5IhrZOruQoz/6dtMTGLO8fO0vo1ciS/3LqbaiAKHCevdaJtiD7whEZ20X7hmREcGtJ5Uu+qTHUHdfwbprS4VhV8Z8hkqQNGw052avciCYOkBZ2+Mw5lAIM2dOxGrokcwsJ7bC1lq/RQ4xmrjbfA7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VWVwiyF6 uagBS.At8Cp93ntcZ.meVmeOCVzCfNG26VcKrl4HiGWQ5sgJ2y0K1LvZEV9Xk8XA7y466uQ8PD6u 2MDyW1Cw8k3au90lKRBSEvZHwgR_SwyffLsUKkPVQFkA6QWrbQ.yp8YsWmc0vCDq.5JAzDG8_4hl C5CIUYxWLUPokQ3tV7sq9Y1OhRzSjezZEX_CupiC3wQ1E6FR9gSMHbs4CcyiqVaOMMbQJgf8KQbA qT0jvndges7mjqxT.7ZfIoPJVFK3aBmm1OM_nSQHxvI8yu1ALfHuMumlH0BD.ZiLeoXlVI7R3JBU 9oljZGvesstZAgI.FN6jA5lFdU5cKNjWeSVnWLGxXqKbnCN0siBJkFQ0hS67EwT72lx3CpvIGHPb Bv9EaD5ocvCojJziUJKec71TXV6DgcqoZO3eYRf6alun8yC5qpIOkktQ5.KpxCBwpjnh_VaaN01Z x1UjEiWivAeHqm1lxTy7z8YPhw3FuGNIoe_B.LpOy935Wbvju85.p80PvybfCLGtY_qX8RG_q_f_ WqxmWc2y5rkHEz_xEOhpCc4gtbocunR6ZxHbY5xQj7ZPvv_TPY23J8Hw.aTbJd1tHKEc0fi7vLRK TPnhVhxYEtUBE1qoGqWK8jyliOMcdZgcyg0NT_FgmFqLMS0k_goZIDPR5McVlgHYKPunP30lpE4o hhjW_QrpGluX9TBFjSHmuoB9gVbGcdNOxAW8i8P5dgXLj9zNwxauDxY_FHJOSQGfMFMqBio_FZ4_ DwNQ5wUklVuqEMX4lG2Kj X-Sonic-MF: X-Sonic-ID: 80ed7746-577e-4060-8dd5-e78275993d36 Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.ir2.yahoo.com with HTTP; Mon, 15 May 2023 20:10:31 +0000 Received: by hermes--production-ir2-7867f454fc-nvr6n (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID a7905ff065b8716c1e39bbada6be8236; Mon, 15 May 2023 20:10:26 +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] mfd: rt5033: Fix chip revision readout Date: Mon, 15 May 2023 22:09:54 +0200 Message-Id: <20230515201002.29599-3-jahau@rocketmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230515201002.29599-1-jahau@rocketmail.com> References: <20230515201002.29599-1-jahau@rocketmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@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