From patchwork Thu Apr 27 23:30:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Hauser X-Patchwork-Id: 677655 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 AA500C77B7C for ; Thu, 27 Apr 2023 23:30:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344431AbjD0Xao (ORCPT ); Thu, 27 Apr 2023 19:30:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344424AbjD0Xam (ORCPT ); Thu, 27 Apr 2023 19:30:42 -0400 Received: from sonic313-21.consmr.mail.ir2.yahoo.com (sonic313-21.consmr.mail.ir2.yahoo.com [77.238.179.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A8DB421A 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=1682638236; bh=Fg8O9S7CQWLvLBXMCmKEFeFmz8DxFrOra+7NQGOwBwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=izqek3gebLUiMUc++qyVsn6UxbtTlO6eLBY78E6g1uHBnCFMspBzLw89x9hcC7Us5j/b6Ap84i7bRwDiUgKP+kDN47oRG6ncHm5hbDALcZf+aYQaBYIypQ1qlK311wuGWgsQ4PaOey1crKi6vA2/qIyOctLCY2a33HL+mLTx+IemPx/+kkKdYnjS94K4OvAG6xInl775mh/gStsu9nFaXiRJWPkb93uRQeml9+z0WRJpL2sBmkI3DSnNeZIMK7hDmXupoSi4WeN6ZOuBFN+lceSD8ePbbjT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k.PuAOTkHm3a2_c 3Ofrcvq4xUDXQCS0UUcHKvNIj9XyHEJchYe0tzGkoZmCaowxdSXeBkKneKfLNpat8oDKRs6SmdVn Cld51L5MYcbNj9EoUWo5H1ARGokXTgHWPkvGQA5DqL2qwX4RIheFnyIZheu6DDKXC4vfzekvBJs9 Txjum4dZuCJ5aghNvHZVPTrzz7GFs.WCAnplrvuuDjJdju2opqAAu3pR6HIQz8OymWwmiMSIESrM CVAhSDUaZnYX.V79rwsw3BPPGcozLgEndmyYpYfL4h2c0Wdsn3WUvSbxJ6b4pR20c7Io4H4_AAI6 Fp.oCNdWMgR9ViPmLk4csOQNzCt7vhzWREIkGBxlru9kn2JVdlNiqffW6I3yQCTG0kkFGQF_rlFR YSUfAGjyLLBxL39Gwy6zkpzejCINQ4PmfpbguWF74sMmZCkrj8gwGZanS1_nrwMcCh03BN6Uv6M4 RSE47uf242B4jZrFezkeR7JXXxn7Aw5wrucbvRFQijOYUy5fcynwRnRZJ6TiWxFsz3JprIRWqINv 0An_KVzh2d_Z26xVQ0mGgN1J5HpM2oSfdO998ZtIVA_zOJXesdtVI_hJaZ9YWe527pcGUhVVjybu UWXRFnKQGs76TIEp1ZmncXIJtzXInQirfrHZK.GG_1konzXfsGj9N8x3bHBZ4hFSuiVXLAf5wmHY 3baoYku9FQLU1GnECNx_JOWvBAWFJ.RR2ltvUqkhexCM9lw1Jp2yoVtM2_EVQv0qedaxW3Vzqmwy 7x0DCrymQUNf_RrKJnidErQ-- X-Sonic-MF: X-Sonic-ID: 2e63afa5-df03-43b5-bf09-af9c6ec7a812 Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ir2.yahoo.com with HTTP; Thu, 27 Apr 2023 23:30:36 +0000 Received: by hermes--production-ir2-74cd8fc864-9w846 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 912b1d1a256b22e43f453e00130c1256; Thu, 27 Apr 2023 23:30:34 +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 2/8] mfd: rt5033: Fix chip revision readout Date: Fri, 28 Apr 2023 01:30:05 +0200 Message-Id: <36e5dfcd1c724060e44798dbb1eeee2321cac583.1682636929.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 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