Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp388147pxf; Wed, 31 Mar 2021 06:05:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZZRcDcfm43TGZi+vAvuo8RIOKojh+FS7lVktujeBfRXZr+JJ+QwzeVgmo7tbkJhBPGguw X-Received: by 2002:a17:906:a413:: with SMTP id l19mr3424515ejz.421.1617195948808; Wed, 31 Mar 2021 06:05:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617195948; cv=none; d=google.com; s=arc-20160816; b=jWK42MyocP1zBY8mi+C1HIsbzAc4kJ48ZzWfWnkxZZC2xKNRfp66u0pG6FldWrMx/D ylSDXQi6xlfJkqBQhAmx2yOx4p3E5Eiw46bGDPF5F/lr553UPd6f3GK0xMw2CBt1f0la YD1q5a4SWO6A6CEiRPXv6iYv90oSd6WQv0N9mzU2/pldUkXmmNWJSyR0VPbSXEZzk7+o k+ujBnEWxkDMvU+8lvQSXUIS2MW3UYC3dUKmwvb0goDlVsY2C5g/8aOdnMkJtWKsCoa7 2v3FKUrjyLH3sKHHGqg/mHmdYRjdHQlhNKO3S9XojnznIUeUWctLOh5NQ0UjA9OqUc/M q2bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=aUnUEu7ZArVgB/20UL9gpgok6NiFLUoL8dQK2E9IgWo=; b=MIUble60evcB3Td3si7VEp5NyiU1FTnj2Gd1Z/N+cPqg5jXB7exu0BcPEO549vHSmU Q6YQNEBBHzPZhe57PD8pK4YtJHnTcNvZZS13wKoQeQl8bV3ceMPV22icvlrn2Rp1bQeY aJeVhePdSZtQiWE0gnBHYVjSi9iTSXLQ9gJhSk9SfQH1O/Iqxhf9+V8bU8ruN6XKv5td 9jKIHcIay8sKmgmKTF+0Ur6dTyE31DlpXJbHjlFSsfFH6wixFh9VlTtt7+BLTUsTJ0o9 +vPL6yNdmA5taEmk7yk7WRKmuDCuQ9aHugKVbHBhqCEmQCND7lpo23pykdnlx69Q5EJI 1VEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l24si1775830eds.501.2021.03.31.06.05.26; Wed, 31 Mar 2021 06:05:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235630AbhCaND4 (ORCPT + 99 others); Wed, 31 Mar 2021 09:03:56 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:14656 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235347AbhCaNDv (ORCPT ); Wed, 31 Mar 2021 09:03:51 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4F9RJj41kzzmcVq; Wed, 31 Mar 2021 21:01:09 +0800 (CST) Received: from [10.69.38.196] (10.69.38.196) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.498.0; Wed, 31 Mar 2021 21:03:30 +0800 Subject: Re: [PATCH v5 2/5] i2c: core: add api to provide frequency mode strings To: Jarkko Nikula , , , , , CC: , , , , , , , References: <1617113966-40498-1-git-send-email-yangyicong@hisilicon.com> <1617113966-40498-3-git-send-email-yangyicong@hisilicon.com> <0561a225-3dbb-97b1-a0a8-223520885c05@linux.intel.com> From: Yicong Yang Message-ID: Date: Wed, 31 Mar 2021 21:03:30 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <0561a225-3dbb-97b1-a0a8-223520885c05@linux.intel.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.69.38.196] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/3/31 16:35, Jarkko Nikula wrote: > 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 >> Signed-off-by: Yicong Yang >> --- >>   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) will address. thanks! > > With those changes you may add my > > Reviewed-by: Jarkko Nikula > Tested-by: Jarkko Nikula > .