Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2160987rda; Tue, 24 Oct 2023 14:29:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDoeFtvsS0FUSRKQyLlhbZ4xt6g6FUxtL1sViSFEUqYROgGbzoN+zi01iuDANlttVFXR4R X-Received: by 2002:a17:902:f54f:b0:1c5:c546:fece with SMTP id h15-20020a170902f54f00b001c5c546fecemr22268451plf.34.1698182945856; Tue, 24 Oct 2023 14:29:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698182945; cv=none; d=google.com; s=arc-20160816; b=GM6GsnSkw/rv+eiw8L3uJqYwSTBYezmQWk6Cve/4tDQnfroE8kKShEISgErxpTuBLs VyZOL3dUjcjNAACN5hGcox4fsCLHcXRuTaHQpH39CNv7tq4FNhUGRwE7FPHuj0pWnkfS qwkWhJvGLN7mf1onZyUeyc6wplOt8jdClGhhloFXZAguCXnSplRqFQ0RahBPyXQt4EEn TZrgZI53+uLYDdCPlNWjxj1x0NHnXScJH+DN0Fp6IN61vRJE8+tn51I4j1OG33+vbnoT ZyWYqT/FiGyyF4g5B8fMVIzXfYRNw5QykxCoXHyqui6k4FTc7/y9bjZVGKGUFVYqAY8t 7Sww== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cnwSZDOWbygiPnL+Tzhq3EWqfiW8rutNooWtQyoSYo0=; fh=SwXRDT3wef7eYr+GiOVvHhMXJPt0P6DhPR6I4tBQCDQ=; b=OVqmvDTBUnTjqd6JHoHKsG6imP2ruYO8pBgICOLdnVKEDquf818YmLFsXGUOebMTPw Jymzh0CBEfl9CJ8ceSpO7S58w6g/CqobWpTIzm+bScNopXPlp6T+XoUQxJGAUKpdL6uS iggJzDUxevLfoLSn2XoledyPSkoJemWl+YSB7XwYYRDxWM4epTZZy8B6mclKyiFRizqa meAMwqd6n81czcmC6vrSZlIH2cC4Hzb85FWJMhFJFJWUiPl95R+YHjkPqUqCABjgyS+b kDlgaOcC1Hjh1udGwR/ZhU65qWJ8bLJKUpIT6X8nF+4leHtb7oJMD39Dlhjdinc1OZdI RThA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qGBIhNIa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id 4-20020a170902e9c400b001c76a06b5b5si8737997plk.298.2023.10.24.14.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 14:29:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qGBIhNIa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id BD9D980D292A; Tue, 24 Oct 2023 14:29:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344338AbjJXV2v (ORCPT + 99 others); Tue, 24 Oct 2023 17:28:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234957AbjJXV2u (ORCPT ); Tue, 24 Oct 2023 17:28:50 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5982E129; Tue, 24 Oct 2023 14:28:48 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ABD0C433C8; Tue, 24 Oct 2023 21:28:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698182928; bh=dxrhK6LCO9BflPWhC3GRe1Rdi4pkkGtj7kI+Qk5b8Bo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qGBIhNIaE1xH+1+qgWIGeTpbwW6/cxmSTreC4JXj7U7jpsoNatrwQYhNouN8K8X4/ BK7fzq3jI5TVq+LkuEcCfhBOvonhE5xciHw/BMfOkK2ovzKw2RjDgAYCGI5PycCQeR tdRCIMawrNz6Ou/vJKp0ZOe3wvVICTChriqBmHzsRqfAIAYKDQxhMD2XQHVsrdgOA2 b3/Pn30hF+QEWvtykpZiN85JnGn2Zry85e1RE3PaU0Ngh+/Yam1wt8tlErlbuKFYd2 1JAmpfLxR50gxbKX26KPvWyyDnm1nMCVLeQ+4QzC7LD+DRst+B4tDhV3d9ZXrDO+os 8yaC0MWrcnSOQ== Date: Tue, 24 Oct 2023 23:28:45 +0200 From: Andi Shyti To: Huangzheng Lai Cc: Orson Zhai , Baolin Wang , Chunyan Zhang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, huangzheng lai , Xiongpeng Wu Subject: Re: [PATCH V2 4/7] i2c: sprd: Add I2C controller driver to support dynamic switching of 400K/1M/3.4M frequency Message-ID: <20231024212845.htjc2uwtg36mig5j@zenone.zhora.eu> References: <20231023081158.10654-1-Huangzheng.Lai@unisoc.com> <20231023081158.10654-5-Huangzheng.Lai@unisoc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231023081158.10654-5-Huangzheng.Lai@unisoc.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 24 Oct 2023 14:29:03 -0700 (PDT) Hi Huangzheng, On Mon, Oct 23, 2023 at 04:11:55PM +0800, Huangzheng Lai wrote: > When I2C-slaves supporting different frequencies use the same I2C > controller, the I2C controller usually only operates at lower frequencies. > In order to improve the performance of I2C-slaves transmission supporting > faster frequencies, we dynamically configure the I2C operating frequency > based on the value of the input parameter msg ->flag. > > Signed-off-by: Huangzheng Lai > --- > drivers/i2c/busses/i2c-sprd.c | 101 +++++++++++++++++++--------------- > 1 file changed, 57 insertions(+), 44 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c > index dec627ef408c..f1f7fad42ecd 100644 > --- a/drivers/i2c/busses/i2c-sprd.c > +++ b/drivers/i2c/busses/i2c-sprd.c > @@ -75,7 +75,14 @@ > #define SPRD_I2C_PM_TIMEOUT 1000 > /* timeout (ms) for transfer message */ > #define I2C_XFER_TIMEOUT 1000 > - > +/* dynamic modify clk_freq flag */ > +#define I2C_3M4_FLAG 0x0100 > +#define I2C_1M_FLAG 0x0080 > +#define I2C_400K_FLAG 0x0040 > + > +#define I2C_FREQ_400K 400000 > +#define I2C_FREQ_1M 1000000 > +#define I2C_FREQ_3_4M 3400000 Why are you redefining these values? You could use the defines you already have or, if you really want a different name you could do: #define I2C_FREQ_3_4M I2C_MAX_HIGH_SPEED_MODE_FREQ Rest looks good. Andi