From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B122DC433C1 for ; Wed, 31 Mar 2021 10:20:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 752C861985 for ; Wed, 31 Mar 2021 10:20:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234830AbhCaKTz (ORCPT ); Wed, 31 Mar 2021 06:19:55 -0400 Received: from mga03.intel.com ([134.134.136.65]:11279 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234666AbhCaKTb (ORCPT ); Wed, 31 Mar 2021 06:19:31 -0400 IronPort-SDR: b9oBMQVCNAq1Fam8+ng5SSrxY10P3D/MCJ3IUzy9OO4f48ZhEDAGoKF3pxRjrrVcjAgmb66zxa qrdVcSHTb9Pw== X-IronPort-AV: E=McAfee;i="6000,8403,9939"; a="192000399" X-IronPort-AV: E=Sophos;i="5.81,293,1610438400"; d="scan'208";a="192000399" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2021 03:19:30 -0700 IronPort-SDR: nvXmnEjyshWxla5V2Rhzsc6w4ZoUr4MFfjFjrVGNOcUT7WSW9nhtKpbb0bZZm9A/GKFUplHX5j 1rXTxGlLjhfw== X-IronPort-AV: E=Sophos;i="5.81,293,1610438400"; d="scan'208";a="377210369" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2021 03:19:27 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lRXwa-00HZih-G9; Wed, 31 Mar 2021 13:19:24 +0300 Date: Wed, 31 Mar 2021 13:19:24 +0300 From: Andy Shevchenko To: "Song Bao Hua (Barry Song)" Cc: yangyicong , "wsa@kernel.org" , "linux-i2c@vger.kernel.org" , "Sergey.Semin@baikalelectronics.ru" , "linux-kernel@vger.kernel.org" , "digetx@gmail.com" , "treding@nvidia.com" , "jarkko.nikula@linux.intel.com" , "rmk+kernel@armlinux.org.uk" , John Garry , "mika.westerberg@linux.intel.com" , "Zengtao (B)" , Linuxarm Subject: Re: [PATCH 5/5] i2c: designware: Switch over to i2c_freq_mode_string() Message-ID: References: <1617113966-40498-1-git-send-email-yangyicong@hisilicon.com> <1617113966-40498-6-git-send-email-yangyicong@hisilicon.com> <7e82e13b245a4b11917a2e0191acdb1a@hisilicon.com> <793f587a5bc744b393cf677258bce50e@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <793f587a5bc744b393cf677258bce50e@hisilicon.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org On Wed, Mar 31, 2021 at 08:53:02AM +0000, Song Bao Hua (Barry Song) wrote: > > > No, please read the code carefully. > > We can duplicate conditional, but it brings a bit of inconsistency to how the counters are printed. > > Thanks for clarification, I am still confused as the original > code print the real mode based on dev->master_cfg, the new > code is printing mode based on frequency. > > My understanding is the original code could fall back to a lower > speed when higher speed modes were not set successfully. For > example, high speed mode falls back to fast mode: This is a good catch! I should be fixed by a separate patch I assume. > if ((dev->master_cfg & DW_IC_CON_SPEED_MASK) == > DW_IC_CON_SPEED_HIGH) { > if ((comp_param1 & DW_IC_COMP_PARAM_1_SPEED_MODE_MASK) > != DW_IC_COMP_PARAM_1_SPEED_MODE_HIGH) { > dev_err(dev->dev, "High Speed not supported!\n"); > dev->master_cfg &= ~DW_IC_CON_SPEED_MASK; > dev->master_cfg |= DW_IC_CON_SPEED_FAST; Basically we have to adjust timings here to reflect this change. > dev->hs_hcnt = 0; > dev->hs_lcnt = 0; > } -- With Best Regards, Andy Shevchenko