[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0561a225-3dbb-97b1-a0a8-223520885c05@linux.intel.com>
Date: Wed, 31 Mar 2021 11:35:23 +0300
From: Jarkko Nikula <jarkko.nikula@...ux.intel.com>
To: Yicong Yang <yangyicong@...ilicon.com>, wsa@...nel.org,
andriy.shevchenko@...ux.intel.com, linux-i2c@...r.kernel.org,
Sergey.Semin@...kalelectronics.ru, linux-kernel@...r.kernel.org
Cc: digetx@...il.com, treding@...dia.com, rmk+kernel@...linux.org.uk,
song.bao.hua@...ilicon.com, john.garry@...wei.com,
mika.westerberg@...ux.intel.com, prime.zeng@...wei.com,
linuxarm@...wei.com
Subject: Re: [PATCH v5 2/5] i2c: core: add api to provide frequency mode
strings
Hi
On 3/30/21 5:19 PM, Yicong Yang wrote:
> Some I2C drivers like Designware and HiSilicon will print the
> bus frequency mode information, so add a public one that everyone
> can make use of.
>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Signed-off-by: Yicong Yang <yangyicong@...ilicon.com>
> ---
> include/linux/i2c.h | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> index 10bd0b0..6837e64 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -47,6 +47,26 @@ typedef int (*i2c_slave_cb_t)(struct i2c_client *client,
> #define I2C_MAX_HIGH_SPEED_MODE_FREQ 3400000
> #define I2C_MAX_ULTRA_FAST_MODE_FREQ 5000000
>
> +static inline const char *i2c_freq_mode_string(u32 bus_freq_hz)
> +{
> + switch (bus_freq_hz) {
> + case I2C_MAX_STANDARD_MODE_FREQ:
> + return "Standard Mode(100KHz)";
> + case I2C_MAX_FAST_MODE_FREQ:
> + return "Fast Mode(400KHz)";
> + case I2C_MAX_FAST_MODE_PLUS_FREQ:
> + return "Fast Mode Plus(1.0MHz)";
> + case I2C_MAX_TURBO_MODE_FREQ:
> + return "Turbo Mode(1.4MHz)";
> + case I2C_MAX_HIGH_SPEED_MODE_FREQ:
> + return "High Speed Mode(3.4MHz)";
> + case I2C_MAX_ULTRA_FAST_MODE_FREQ:
> + return "Ultra Fast Mode(5.0MHz)";
> + default:
> + return "Unknown Mode";
> + }
A few minor nits here:
- KHz -> kHz
- Space between text and opening parenthesis: "Mode(" -> "Mode ("
- Space between number and unit: (1.0MHz) -> (1.0 MHz)
With those changes you may add my
Reviewed-by: Jarkko Nikula <jarkko.nikula@...ux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@...ux.intel.com>
Powered by blists - more mailing lists