public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: "Song Bao Hua (Barry Song)" <song.bao.hua@hisilicon.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: yangyicong <yangyicong@huawei.com>,
	"wsa@kernel.org" <wsa@kernel.org>,
	"andriy.shevchenko@linux.intel.com" 
	<andriy.shevchenko@linux.intel.com>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"Sergey.Semin@baikalelectronics.ru" 
	<Sergey.Semin@baikalelectronics.ru>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"digetx@gmail.com" <digetx@gmail.com>,
	"treding@nvidia.com" <treding@nvidia.com>,
	"jarkko.nikula@linux.intel.com" <jarkko.nikula@linux.intel.com>,
	"rmk+kernel@armlinux.org.uk" <rmk+kernel@armlinux.org.uk>,
	John Garry <john.garry@huawei.com>,
	"mika.westerberg@linux.intel.com"
	<mika.westerberg@linux.intel.com>,
	"Zengtao (B)" <prime.zeng@hisilicon.com>,
	Linuxarm <linuxarm@huawei.com>
Subject: RE: [PATCH 5/5] i2c: designware: Switch over to i2c_freq_mode_string()
Date: Wed, 31 Mar 2021 08:53:02 +0000	[thread overview]
Message-ID: <793f587a5bc744b393cf677258bce50e@hisilicon.com> (raw)
In-Reply-To: <CAHp75VeTj-wk3WP2-Unoti0+Cajx33b8NOUbBiSBQLmJHn=YAg@mail.gmail.com>


> 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:

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;
			dev->hs_hcnt = 0;
			dev->hs_lcnt = 0;
		}

the original code was printing the mode based on the new
fallback dev->master_cfg but not the mode calculated from
frequency:

	switch (dev->master_cfg & DW_IC_CON_SPEED_MASK) {
	case DW_IC_CON_SPEED_STD:
		mode_str = "Standard Mode";
		break;
	case DW_IC_CON_SPEED_HIGH:
		mode_str = "High Speed Mode";
		break;
	default:
		mode_str = "Fast Mode";
	}

> > +     return 0;
> >  }
> >
> >  /**
> > --
> > 2.8.1
> 
> 
> --
> With Best Regards,
> Andy Shevchenko


-- 
With Best Regards,
Andy Shevchenko


  parent reply	other threads:[~2021-03-31  8:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 14:19 [PATCH v5 0/5] Add support for HiSilicon I2C controller Yicong Yang
2021-03-30 14:19 ` [PATCH v5 1/5] i2c: core: add managed function for adding i2c adapters Yicong Yang
2021-03-30 16:28   ` Dmitry Osipenko
2021-03-30 14:19 ` [PATCH v5 2/5] i2c: core: add api to provide frequency mode strings Yicong Yang
2021-03-31  8:35   ` Jarkko Nikula
2021-03-31 13:03     ` Yicong Yang
2021-03-30 14:19 ` [PATCH v5 3/5] i2c: add support for HiSilicon I2C controller Yicong Yang
2021-03-30 16:24   ` Dmitry Osipenko
2021-03-30 16:32     ` Dmitry Osipenko
2021-03-30 16:33   ` Dmitry Osipenko
2021-03-30 14:19 ` [PATCH v5 4/5] MAINTAINERS: Add maintainer for HiSilicon I2C driver Yicong Yang
2021-03-30 14:19 ` [PATCH 5/5] i2c: designware: Switch over to i2c_freq_mode_string() Yicong Yang
2021-03-30 21:36   ` Song Bao Hua (Barry Song)
     [not found]     ` <CAHp75VdY58Tm0FDcoVDWuw0LBKUFWC_hBCb5t=4WX_MPzsLvZw@mail.gmail.com>
2021-03-30 22:01       ` Song Bao Hua (Barry Song)
2021-03-30 22:06       ` Song Bao Hua (Barry Song)
     [not found]         ` <CAHp75VeTj-wk3WP2-Unoti0+Cajx33b8NOUbBiSBQLmJHn=YAg@mail.gmail.com>
2021-03-31  8:53           ` Song Bao Hua (Barry Song) [this message]
2021-03-31 10:19             ` Andy Shevchenko
2021-03-31 10:37   ` Andy Shevchenko
2021-03-31 13:02     ` Yicong Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=793f587a5bc744b393cf677258bce50e@hisilicon.com \
    --to=song.bao.hua@hisilicon.com \
    --cc=Sergey.Semin@baikalelectronics.ru \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=digetx@gmail.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=john.garry@huawei.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=prime.zeng@hisilicon.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=treding@nvidia.com \
    --cc=wsa@kernel.org \
    --cc=yangyicong@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox