From patchwork Sun Apr 16 12:44:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Hauser X-Patchwork-Id: 673772 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 BFCD6C77B61 for ; Sun, 16 Apr 2023 12:45:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230424AbjDPMpR (ORCPT ); Sun, 16 Apr 2023 08:45:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230343AbjDPMpK (ORCPT ); Sun, 16 Apr 2023 08:45:10 -0400 Received: from sonic301-21.consmr.mail.ir2.yahoo.com (sonic301-21.consmr.mail.ir2.yahoo.com [77.238.176.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D93843A80 for ; Sun, 16 Apr 2023 05:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1681649106; bh=Fg8O9S7CQWLvLBXMCmKEFeFmz8DxFrOra+7NQGOwBwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=KszPe5nUvNjng6faEv3yoQCb0HsZzD2YGWMLl/YxpjKxzXDXSgY8/SMEOHg81nvlSOQwKPrR0btBR5Uo42mog+ShPLwnLkLJTXjxE3aHterfs7/oVofN9quuRpfbK4dUfw/y1NHLbhqSsdT3/b1Ud3x3JV43YuXknZ9Uc9J2QAhgIkBSaWByxvWcdlyvM5KsbGnt9xhfPe5ztPMWTa65JO2xCliYgPmHkX39gSVBsK/8/8uuX5hi8IBFcwQFnFmfztSCQL2a8t0tJ39DPdYGb25/89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lxc3CG0eOdcQ1x7AwTpjAskrdTy4r0 ubSseTslvfRdcAWAgBpnFTNZbwL2tcwkhqmrQWTbNK3.dPGHldlmJtm0Mf09K6T0JZO8lUGGcsN_ vz22_lOGa_KHtP7jFFpX1UgnTjjldrnFTN4l_xMdY3QJYjwmVongkNJws7nZIaYWBBxE7zVnF6hH pzpkYmd01n7SrnQwCJtmXxlhfwwvyMxt8VqB6v3EhNE1i1TQcK2c7rVTV.zKM1ciR.3_oHE0MymP w6Td1y3XZzDI6CEyG_8zsb.QNQrJ1Xt9rIZaZLBgwz14e.i.bKOjXotYLnTIRLrfPsxwyYa8ovQX Ze6d9wHSJuAzMpIv8KvcqJZybbJ_IGC67wGBNICrBFrZCBqeoPeP5X4oN7ukpkBOpmIJBWjqrZoW rOdMii_4MIxzA2M6jB7lY1MAw7BsSdekdIIkeflwSLttVusNlzETwsmknOhXkfmNQrNFFsskwAYW Dj9y6iL0nG6Q9LzoAwOVYmMjjsz4CiHtb5151u78mM2TXT33SWoh99ijkLcFImqWgbKTE1.1oCxd xU4ssssvH9CSbmNmXYgNaifk0fTPPUfEYcp_u8eQcnChYAhb5_xPIIuVHd8PehXiuUh5cSXTjAJ0 NvmmufAezPNg2RZWXLNYeeYGC60KJr2o5wGVQtl36vlR24.5Lcy81Bnqw6xkdjvsrlED1ZNcUIjF CCMTPWgjmnSexjzuXHzj26oqcfMATY.3sfuN1rZ.smrizQnnj6eHatURYV64YTmGYvfCe7FG6jy8 nhCu5JlTaT6xrsXeJ7SfjmMbGOFp77RInhYlCaW01Y_U79EY- X-Sonic-MF: X-Sonic-ID: e071def9-0b1c-4e98-8221-260d1abc3263 Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.ir2.yahoo.com with HTTP; Sun, 16 Apr 2023 12:45:06 +0000 Received: by hermes--production-ir2-74cd8fc864-4bl68 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 8a53f7a8722383f9609d619e4fab1862; Sun, 16 Apr 2023 12:45:03 +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 2/9] mfd: rt5033: Fix chip revision readout Date: Sun, 16 Apr 2023 14:44:29 +0200 Message-Id: <7eab1fd42adf0428cd80cc2b4c2fb3d928014125.1681646904.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