From patchwork Sun May 14 12:31:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Hauser X-Patchwork-Id: 681911 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 805D1C7EE22 for ; Sun, 14 May 2023 12:32:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229987AbjENMcA (ORCPT ); Sun, 14 May 2023 08:32:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235134AbjENMb6 (ORCPT ); Sun, 14 May 2023 08:31:58 -0400 Received: from sonic314-19.consmr.mail.ir2.yahoo.com (sonic314-19.consmr.mail.ir2.yahoo.com [77.238.177.145]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A96E826BB for ; Sun, 14 May 2023 05:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1684067515; bh=Fg8O9S7CQWLvLBXMCmKEFeFmz8DxFrOra+7NQGOwBwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=XlIWbq8PlxqdwrN301ADyRkhQXCiF993mORFVh/QN53NhnDCUYNFCGpTaqyu5mc3fODy68uA9E5GhrV+chzRZrC/IvaVor0PE+2YbwXGO/s3PcC/l+PD+cNk8U7Bu05vh0nd43McoGvJjhBfnPNb62Fg4gdpn0H89SuAYcjhZv+ocfHT8MGMyAoCgJBkGlyGIuUtoU1TUVGw/UCNZwDYetMpuNFkvIoPBnH9x8Uw28T+GbTso/jEgVBbZ2hKBvbCaMqwHxMd3aSykq7p7VOW8PYw17SSb3PPRd79vJ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9E3pKESWzCxGogVYgM5mf1igYNBXtf15KZRzDWprDLHKQlf1 52DVIgLbeaRFGTPqlDhaTLDsCbUQc2MP7w2.OUrt0mSWR05b6yMW3QLAe9JvlZ_Ug3MkAnO5Wm80 gL4VCeThfabE_E2szDQMoyxdBuGD8XJQAWrmsdMRQXAPYOjfozVo5Gc8FkhmczocgYPC_jjM_ltC wzHV6V1hcpPDiP3AehXTigrWMMAQkwhWtW7IYr4dOtuqmtfZfZwJr8WSGbyMvtVknepxScfkcZrM hix3qQin8mkVhMGosK_.7bMIbQUiHjdNN5f4428bo0QHcXz_00UOQL7laP0E._I_6.RSrjwP4qOl _2nxIf5owOcqdeb_JzKK9Qpfr6n5D4Cae9fa2QnbPjyBpZXbrdAfV1yjpczQBqoMIlunucgkCOMJ F4rDjpXp.JiXnS9PwE1TgtsVrucr6NaT_ZpVLLYvCYp3zj2A4Nk9HUm_FFeSvihCpbiaxh56S295 uBOy5VfsvUc1Dx.0Tq6lsSEInRjI6hC2aMOt3hCfdUpWwOEJgwMUL1rKfWi1qLU2BBLjaQaypY2u _WQlNWuksqtVIV0y2vMxi.dScVOFaIKErgK8GStv0z8gzVXiMm_VNFzSc1FoI.h6ShPvVZpD_SOy c3NNfwwtsphQqVhnCkR2krLmtJavzipgmT9g6IJBO3CMsiEPAAC6U1K53uYm5qfY55m00tcARf2K N.WAxjXX7hud8P4Uj7zYkC1v9 X-Sonic-MF: X-Sonic-ID: f11cbd54-bba3-4800-a368-3581eb786e2a Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.ir2.yahoo.com with HTTP; Sun, 14 May 2023 12:31:55 +0000 Received: by hermes--production-ir2-7867f454fc-kqstn (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 32d47a946aad3f7d203db987b930ba8f; Sun, 14 May 2023 12:31:52 +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 , 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 v5 02/10] mfd: rt5033: Fix chip revision readout Date: Sun, 14 May 2023 14:31:22 +0200 Message-Id: <20230514123130.41172-3-jahau@rocketmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230514123130.41172-1-jahau@rocketmail.com> References: <20230514123130.41172-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