Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4388499pxf; Tue, 30 Mar 2021 06:48:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIxHm5iMJI991viRLNKGqELtc8KSZPRSP8H79HPjZd9Q73/msLivdU/FuGK/0aB3AiLj2k X-Received: by 2002:a05:6402:8c2:: with SMTP id d2mr34580910edz.4.1617112097458; Tue, 30 Mar 2021 06:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617112097; cv=none; d=google.com; s=arc-20160816; b=VJwT+7VnKwfXgPGsDrSiccTqV86vHzHmX8Hlpj9Iz461B2asiEVsaGNQxwGFDw0VgK 3/qbBTe61W78S+kiLoMpCrAhPQVv2Ein30W1C2U4e6vydzmZKSZVe7HC8oAF8oF20Hlg WY2yBRzjsB7oa9k8lCyX8V8NCdxgp/WBwmSGWq4xjrbWVMAR7z7uqHGN6QWekhSHkM9N Z6RcVc0ZeO5mwTnVqV3ZhQjDx1/cxYoAEkJQ5VuYHMykO+gIuoh2kZEdQn19s7dSi/9K HongkDuANM+WvlSnzgbX1I0Yl0zSL54XIfGC9PP7UAMPU2liSRNHbnWY8g7WCoiGXZJr iQPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=8uNjoTVCww1ZCMTnSRV/S9adx5sD9EZMh3yDEvf2XDg=; b=msk9HD3gC0a54WTHVloAQU/xeZ3BNHCCOxr/4XFZLN9HlNCjHsloX4uXBHiOSjE31a EMCRz47S2QuBTPJaU256ci7Vm+YoJU+SOymuYx3xbM66firhixUl6blRo6MT4aBowd4+ IcXc4t8w2plT5yr3YIhvzt9E46DOG6MSH7hCgvFpWp72XK/itP8pX7Nnac2uexoYz7F8 gjPpWDgII/PDn0xPEmnZ8ZfZ4a+M5gGaMhbheHiCUCdMKTB6NEQhQaBT63qZ+2qdAXTq jOH+ga4sBGsWNZMqNGdtdufCUG2FjKBV1jBgFTcsUn6EdG67jcRLcFeUfrmwcQX/0+LA qmlQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q23si14791554edr.167.2021.03.30.06.47.54; Tue, 30 Mar 2021 06:48:17 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232181AbhC3Nqq (ORCPT + 99 others); Tue, 30 Mar 2021 09:46:46 -0400 Received: from mga14.intel.com ([192.55.52.115]:6690 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232152AbhC3NqY (ORCPT ); Tue, 30 Mar 2021 09:46:24 -0400 IronPort-SDR: /J3n23RKS3z/C3QmdVraSquGJQd7N5ulejCySABo9edEXDRURqlFtNbddNZeZ8EXmHXW5jKMHE fc3n6He2Li/A== X-IronPort-AV: E=McAfee;i="6000,8403,9939"; a="191242471" X-IronPort-AV: E=Sophos;i="5.81,290,1610438400"; d="scan'208";a="191242471" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2021 06:46:23 -0700 IronPort-SDR: uLRJx/z8D/gps1Zyl7f6ZtbScajYLm0i3sFCskqyDytfFnneyrPnOGMm+t6la4ROnhVilynRpJ WXtrvHD2pRrQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,290,1610438400"; d="scan'208";a="595470948" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 30 Mar 2021 06:46:20 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9971AF2; Tue, 30 Mar 2021 16:46:35 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Wolfram Sang , Serge Semin , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jarkko Nikula , Mika Westerberg , Yicong Yang Subject: [PATCH v1 1/1] i2c: designware: Switch over to i2c_freq_mode_string() Date: Tue, 30 Mar 2021 16:46:33 +0300 Message-Id: <20210330134633.29889-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use generic i2c_freq_mode_string() helper to print chosen bus speed. Signed-off-by: Andy Shevchenko --- Depends on the "Add support for HiSilicon I2C controller" series. Message-Id - 1617109549-4013-1-git-send-email-yangyicong@hisilicon.com Yicong, feel free to attach to your new version of it. drivers/i2c/busses/i2c-designware-master.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c index dd27b9dbe931..b64c4c8d1421 100644 --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c @@ -35,10 +35,10 @@ static void i2c_dw_configure_fifo_master(struct dw_i2c_dev *dev) static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) { - const char *mode_str, *fp_str = ""; u32 comp_param1; u32 sda_falling_time, scl_falling_time; struct i2c_timings *t = &dev->timings; + const char *fp_str = ""; u32 ic_clk; int ret; @@ -153,22 +153,10 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) ret = i2c_dw_set_sda_hold(dev); if (ret) - goto out; - - 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"; - } - dev_dbg(dev->dev, "Bus speed: %s%s\n", mode_str, fp_str); + return ret; -out: - return ret; + dev_dbg(dev->dev, "Bus speed: %s\n", i2c_freq_mode_string(t->bus_freq_hz)); + return 0; } /** -- 2.30.2