From patchwork Mon May 15 20:57:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Hauser X-Patchwork-Id: 13242232 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 00846C77B7D for ; Mon, 15 May 2023 20:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245427AbjEOU5m (ORCPT ); Mon, 15 May 2023 16:57:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244780AbjEOU5k (ORCPT ); Mon, 15 May 2023 16:57:40 -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 01B6CAD13 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+5q1IDsecFIuy8ssAMoYgsRw1nKoRjYykVzmFKHuaBWUqKH4oJg60GrQQ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wfctlvGjfAqZ9QmafHk92li1gUQZerDg38sZ0peh.4Mp8I9tXQV DSgyVXZiWBae.rEo7da0q9vi6EyOT2h7Sm_4qUImZMaPBZopdDz54qb_h96T9cxPBJh_jqMxsz02 3Al1k60_ChdKLDWEGY8uJJLxlqIyPbOAG_9zRUDwKovCAF5OrvKwnIPVusEGt1bC8AcxtNsdFY3U oA48cEanRPfeJ8i9jN5IIo5c59ytT9K_aTPdGwCunZFvnWfqVSnvEzq6qXfEZZ9VfrEh.iz2scqv OQSLv8nkN4O.KINZS00K6QSMtnJh26Bp5wl9G0l1Qn8i1eQZ1LOizGGsz2E7AWjsU86GHelo7ozG 66UFuT7IGhiutjx_t43sKUdW5WSJnTRBxKIQr6FzyJJ8xt.nkU5GwTYWXTNTsMspTeSXo1N2541j J2T88Q6kTf6CQMbftxfaWbU8pYj.2P2JhLYHwE5qLSd8ECI1lpCLy7ma.Q4mrv9p7sh6CHp13Qsp qxhc_13vY_3E6LsLnJrVRzXG5mqacX8LVC1Gjf9WYwNuhKbQ6kwvTHFq5iuOoI2Mhia45DDqSKI3 hBVyJ6nBx20.I4QXcBr0_vxmV7JYscWHK0siBugNaIkvmivTzcAb2aP62W3rz4R.yCJCiKGyiTZj BOlrZbG16JJe7Z.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 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