Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2551847rwd; Mon, 15 May 2023 13:21:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7aY1+AtAdhdgg0NPSSEQ8pIITWFOijlN2d/xmzAfHso6v9r/wGCaA2s2gu6Iq4B1vzyVx8 X-Received: by 2002:a17:902:cec9:b0:1a6:9cb3:5b30 with SMTP id d9-20020a170902cec900b001a69cb35b30mr49272889plg.8.1684182079660; Mon, 15 May 2023 13:21:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684182079; cv=none; d=google.com; s=arc-20160816; b=GW5DFtCrPUf4t2QrSnmulCYr+iBv3x1Qqgs5BftBqTpnVc2X3gQcMJlZDyc8igGn9h eyR04z41UY7dXgPy8M4SeXhH5pxZysINzQr1S3u/r2giLV1RgUdGh9GEyHfWcSpIceCb ocNK65CuvB0xueeK0GkvQqYidti/70Ey9DUQawBFhebpi/6U3tcLcPQ5vcIJwvEEUeiY gIob6THB+dMxiHiyRxOl3fLBW7tvYXWTgPmnTldTzJEpXzhsHvKNrj58ALtbZQ/zRceo SjbwZLPnvRaWjqd3zbTkl2T8Al/5piSfaZoOgDlAKduk5cfgiuJVqWqS0MtUMIm/5Sh2 Ofdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Fg8O9S7CQWLvLBXMCmKEFeFmz8DxFrOra+7NQGOwBwo=; b=WGM0HY0IDIaPrjXCMaTXT56hmzoM4Q07STU5qErDhfujY+td140ASp05t0vYb135nR FI6pl8WksiiYIytzkPpO6ruPRBBtcfkD31ESafDtJ6y6JqNqYT51AxncptDh3/5fEVl5 aYRn7fNd4yk4xUMa+pY1v+to5uzXHst191f8r9iQEXwqKMkK3oUhdZH8dlw1dndiMY+U EzljzG5AZbHkifDn0CtWQjf69jx/VDtP9jn4RdrVzUoowni3tR+HxNc6Um5/qKDfP8Jh EAdTWGcftugaKdszqHBptpD6zJP5hF7b62cX3DVs+rrvPq19aEp2QCUq92pHr4lza+Jm 4zCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rocketmail.com header.s=s2048 header.b=jEBBahPb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rocketmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g3-20020a633743000000b0052c688e6608si10007474pgn.505.2023.05.15.13.20.43; Mon, 15 May 2023 13:21:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rocketmail.com header.s=s2048 header.b=jEBBahPb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rocketmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245078AbjEOUKz (ORCPT + 99 others); Mon, 15 May 2023 16:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243164AbjEOUKv (ORCPT ); Mon, 15 May 2023 16:10:51 -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 0951211B54 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/RQ4xmrjbfA7h6rnCB2K591T0CTfU9No0wxzeVWBlt82bpoAe/Vf1jaRHveTJ8zwN4iPA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1684181431; bh=WppaCNL7syHbhGvX2D8e2xgLa9bkIY2oui8YvfcnOMy=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=Xefv0thz8dDlnC6MR2oMy/UQlNw2k8+NWZIvg5c1ZwtyZJpypBYcq2Z8P2z01zPDGOzzM71Y5XSm9SWh/xm5JR2bjmBssMGm1piMF/kTQluDzbfKGwEF3W88iRscZFMgZRuHGIpIoBEdda6p2+YVujAC6vJBbjoo92lw/jGxXbd9xb6eFf+2B2Z45VirH3Bxia9Z2nKWQJF1464Rao3UYXuvrdkMUu9PWGojrcdGBOyL37LnnLFl/Jg17PS5dQvlL/3AttBFtj2Br/75Fw4yVpAEsLejrwUYWVHaiQ/cN7ctp4BKwuzpgZ86dhy6nNEqHHkyjxAXw6Kiy7c/9MvB1A== X-YMail-OSG: EG_oagUVM1no2rIIGhCyLeOFOVhnAqqo8UpR.Kyo7u747TowdrGJFw0eSAztJgp j.zpRO2BiLdVgSMdj_6.UPYz8wWtiRrmSFr4eLryfRHfUkL6lLCd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0k_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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 -- 2.39.2