Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp950589rwb; Thu, 8 Dec 2022 05:09:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ytlYNL5QY/MTGLwo40Bdaduua6bZetgamW+nTVS2iJNC6ldHvEWt8zB8icQuzhv8Sha4T X-Received: by 2002:a17:906:d78d:b0:7c0:fa81:ac42 with SMTP id pj13-20020a170906d78d00b007c0fa81ac42mr12585531ejb.526.1670504960831; Thu, 08 Dec 2022 05:09:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670504960; cv=none; d=google.com; s=arc-20160816; b=tAz0WFCnYLG/GeVVgoGQ9WO5fYyzFRJdrTLZKPpPzwWZhPvsG/e4dAmBScGmrKj2e4 LETgr2R/PnUEc26Fl4cdtNzNQCdK6Lq6VI+CQW3m+NwVyzI8/ueB+tYaSIq2wF6gOhc+ YOaN+F4YiSw9f9ExRZfZ/qU4hOEqljUZq//tz0u+XG2CYyAxHLn1dwp0554nbsX5WchZ vWuBxS9Xxh4wZKavILKxM5gXNUCp3a+3i5QlZvGHpnw9ul1o2r7rg7NyoxoTUQEEThH3 BjqaKKBdjdeFuwoCgsVSPcc/kg7QZSzIxzvCICVnCS/xzQRCKJ0fMYCMwZpBDgCJgjh8 o4rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=qDu3TEd3xvhmn0ysNF+RRDDY8yAbRyd3+TjdXFqT6ns=; b=C+T0da3W9LZREL55uM7TF2RVSJ6UJXnOdA/xaZCV+k0EGPjQz/EQKqbjUkMVIZaIRg oQwBV1wkUopQLsbQkWJICAOU2gEeUVg369TS4+gu3mlgxxJEkQEe5/QO2g6oihjYC4Pq F3Ft6b+r+Mvu5ce/PftLG/LrxryWB9YOvgZDyfKvxCzTjWTX2AOUKM/jVsMmLbjmhvSC pgO0Qi4u+GakUvFch1Mo5HqUMgHzWWuf//3lJkL1XevOaBdE/s15+peJ/VQdB/zcc1qv lToeOFydg4e2BxfR59b3BeMQbargx8rZyAjC0bACIh7hiSJuUCy2u7MDRaVo0Zj61TdI H+Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M9aAZxAv; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w17-20020aa7cb51000000b0046cee3b0cc3si6279569edt.371.2022.12.08.05.09.02; Thu, 08 Dec 2022 05:09:20 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=M9aAZxAv; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229976AbiLHM3T (ORCPT + 72 others); Thu, 8 Dec 2022 07:29:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbiLHM3S (ORCPT ); Thu, 8 Dec 2022 07:29:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A0BE2B185; Thu, 8 Dec 2022 04:29:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BAE8961EEE; Thu, 8 Dec 2022 12:29:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05875C433C1; Thu, 8 Dec 2022 12:29:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670502556; bh=zbX8/ClFA3b2CThz56cTysR/0+gs5BUOcVmr4sqX8fc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=M9aAZxAvft8qRQ0t9SH9a4A7edcdMpmF/DIvHtqVmKMX67+nipkhZzYqP7N6XHAxc 1JsQDSahfmod5QD0xJ1hKD5fJD52lp6afr49c8GETzvJtBtje+7/3V7r16T1UfiiHh ayr29LSi6LVoJdeIlk9lx4Q0JG3kwrZEuxg9MASt07OhBHSHT/rXI1fBKL6AX/7hLV jJkNnifxVnE2oVyIshpvLwLHIDD4L6esgn7DlxEZ/AGmMbA4SWKMk08mrkKizjnwGb uxEK6G9oX8Jbo+ygbvtAHcvNGfuah423J0zsf/SkoPYzygexbie1WzOkOE4qKwcowN dSt/ZwIqSYMig== Date: Thu, 8 Dec 2022 12:29:11 +0000 From: Lee Jones To: Andreas Kemnade Cc: tony@atomide.com, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Bin Liu Subject: Re: [PATCH] mfd: twl: fix TWL6032 phy vbus detection Message-ID: References: <20221119100341.2930647-1-andreas@kemnade.info> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20221119100341.2930647-1-andreas@kemnade.info> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Sat, 19 Nov 2022, Andreas Kemnade wrote: > TWL6032 has a few charging registers prepended before the charging > registers the TWL6030 has. To be able to use common register defines > declare the additional registers as additional module. > At the moment this affects the access to CHARGERUSB_CTRL1 in > phy-twl6030-usb. Without this patch, it is accessing the wrong register > on TWL6032. > The consequence is that presence of Vbus is not reported. > > Cc: Bin Liu > Cc: Tony Lindgren > Signed-off-by: Andreas Kemnade > --- > drivers/mfd/twl-core.c | 8 ++++---- > include/linux/mfd/twl.h | 2 ++ > 2 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c > index f6b4b9d94bbd..5a7ed71d0e30 100644 > --- a/drivers/mfd/twl-core.c > +++ b/drivers/mfd/twl-core.c > @@ -111,6 +111,7 @@ > #define TWL6030_BASEADD_GASGAUGE 0x00C0 > #define TWL6030_BASEADD_PIH 0x00D0 > #define TWL6030_BASEADD_CHARGER 0x00E0 > +/* A few regs prepended before the 6030 regs */ This would be better represented if the defines were in order. The comment is also superfluous. > #define TWL6032_BASEADD_CHARGER 0x00DA Are you sure this is prepended i.e. before the other registers? These looks as though they sit in the middle. > #define TWL6030_BASEADD_LED 0x00F4 > > @@ -353,6 +354,9 @@ static struct twl_mapping twl6030_map[] = { > { 2, TWL6030_BASEADD_ZERO }, > { 1, TWL6030_BASEADD_GPADC_CTRL }, > { 1, TWL6030_BASEADD_GASGAUGE }, > + > + /* TWL6032 specific charger registers */ > + { 1, TWL6032_BASEADD_CHARGER }, > }; > > static const struct regmap_config twl6030_regmap_config[3] = { > @@ -802,10 +806,6 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) > if ((id->driver_data) & TWL6030_CLASS) { > twl_priv->twl_id = TWL6030_CLASS_ID; > twl_priv->twl_map = &twl6030_map[0]; > - /* The charger base address is different in twl6032 */ > - if ((id->driver_data) & TWL6032_SUBCLASS) > - twl_priv->twl_map[TWL_MODULE_MAIN_CHARGE].base = > - TWL6032_BASEADD_CHARGER; > twl_regmap_config = twl6030_regmap_config; > } else { > twl_priv->twl_id = TWL4030_CLASS_ID; > diff --git a/include/linux/mfd/twl.h b/include/linux/mfd/twl.h > index eaa233038254..6e3d99b7a0ee 100644 > --- a/include/linux/mfd/twl.h > +++ b/include/linux/mfd/twl.h > @@ -69,6 +69,8 @@ enum twl6030_module_ids { > TWL6030_MODULE_GPADC, > TWL6030_MODULE_GASGAUGE, > > + /* A few extra registers before the registers shared with the 6030 */ > + TWL6032_MODULE_CHARGE, > TWL6030_MODULE_LAST, > }; > -- Lee Jones [李琼斯]