Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8900300ybi; Thu, 6 Jun 2019 23:17:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxud6d35N19+6c5h/68etxC2od9hXKJ4ONv8odtEc2NH4klO4Yz9T4Gdp5yCx8UgVTrb+eY X-Received: by 2002:a63:4c1c:: with SMTP id z28mr1367095pga.122.1559888246825; Thu, 06 Jun 2019 23:17:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559888246; cv=none; d=google.com; s=arc-20160816; b=I6gFCGWuwrHF33gzvxEloHTNs1adyebaZ0gI1It0i4cwzQO7kwi75LQWPVVDesW/Ow rgD+UyrPhmSeRHj7wxzbvY7FnwzPOIiZFYnoVP+ZioyLZumRBSlqhlVC/pzMcQDAd1kW 0mzERt0DsLhuuvIVWyA4AeWkkqMvGlobRK8GBiZSYjRjyY7F6TBVwxiud02RGms+rZ17 2qLiipBxk2f343FLkLhRcAbe24f6ZD5qdwPMaTyvucW3spGWuSJ12suza40l45SPuPHM AJbkxW5mu0MrS7drBZkasD1lVvOZ2S99+yjKvEyUl+1iYZpPhe4X7qfgz2wbE2kWvL5X KIPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter; bh=JTIdOf4q9i6u6iRJTmQCDtCZM0ySuHwp5IeDLfRv2Fc=; b=kE1ttpystpRRWIR/CFSgw+/0itrMD6b+9c33pG9Z/qLwSqmxu/LR8x2jVdnH+4ErRD 2Mf0R6Qvd2bJUQAd+KaAEB9XM2FijnnXP1i/psluZ9XO8fuHB8nYuqp1+MGHJyjvj6xb DAeqOkswn6eLL+GKV0vE/BpgW2MQhbz4E/k9XniIXBci3JzI5omnsuT5HgE3DsUJdlVM eWpB9eF6ZXg/2j+LCLKeAPQpsyIaj4lYPEDWjR3hdxD4sNHpmrNRMYdy1m0LbgkOrrl/ nBheuxpAlwet2lKTqAyVUN8V/gcyo8RtDhLYWsW2LFwxfIUR2/Mj2U7JeKCF4z9IETHm rF/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Jib87QJk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q23si1045947pfc.179.2019.06.06.23.17.10; Thu, 06 Jun 2019 23:17:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Jib87QJk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727121AbfFGGPh (ORCPT + 99 others); Fri, 7 Jun 2019 02:15:37 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:36205 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbfFGGPh (ORCPT ); Fri, 7 Jun 2019 02:15:37 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190607061535euoutp013f648157d0df9f7face771df33017426~l1f6oJ_pJ3086130861euoutp01o for ; Fri, 7 Jun 2019 06:15:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190607061535euoutp013f648157d0df9f7face771df33017426~l1f6oJ_pJ3086130861euoutp01o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1559888135; bh=JTIdOf4q9i6u6iRJTmQCDtCZM0ySuHwp5IeDLfRv2Fc=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=Jib87QJk+oc3rAu0B0hNKp2g51Pgntv5hbypFoq4YKrXFPAU+fgZw3TYYRsLzetAp hDYJao2FCiId7oiYTAWRFcNK/kTGN75YFuaK5ZAIpETJZxNbDGpsz1zQb7oPHgby+q H70PxS6QONKonZYCbUY3XllXk1RDTWACHyzqO4iE= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190607061534eucas1p2a29e9a90c9ca901cf15fd11e28a06ed6~l1f57fI4z0190001900eucas1p2S; Fri, 7 Jun 2019 06:15:34 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 73.68.04298.6010AFC5; Fri, 7 Jun 2019 07:15:34 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20190607061534eucas1p1bd90a699e88649a5af1b3f0da2ea8587~l1f5ONAKc1393713937eucas1p1A; Fri, 7 Jun 2019 06:15:34 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190607061533eusmtrp2248c764b08636df309bb68015e3c1825~l1f4_lz1t2024820248eusmtrp2V; Fri, 7 Jun 2019 06:15:33 +0000 (GMT) X-AuditID: cbfec7f2-f2dff700000010ca-96-5cfa0106b510 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id ED.DA.04146.5010AFC5; Fri, 7 Jun 2019 07:15:33 +0100 (BST) Received: from [106.120.51.74] (unknown [106.120.51.74]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190607061532eusmtip2e494029b58080ebdcedcd6aadea5278e~l1f32ltaD0058200582eusmtip2S; Fri, 7 Jun 2019 06:15:32 +0000 (GMT) Subject: Re: [PATCH v4 11/15] drm/bridge: tc358767: Introduce tc_set_syspllparam() To: Andrey Smirnov , dri-devel@lists.freedesktop.org Cc: Laurent Pinchart , Archit Taneja , Tomi Valkeinen , Andrey Gusakov , Philipp Zabel , Chris Healy , Cory Tusar , Lucas Stach , linux-kernel@vger.kernel.org From: Andrzej Hajda Message-ID: Date: Fri, 7 Jun 2019 08:15:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190607044550.13361-12-andrew.smirnov@gmail.com> Content-Transfer-Encoding: 8bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA01SfUhTcRTt9772Zk2ey9jNPqQlQYFaEPWg0gKpVxBYBEUqtfJp5TZlT1cZ 4ZgW09LSHOFUFEsSSxyW5ab0MasVlq4alUFOSzKMJVijXJn5fIv879xz7rnnXrg0rvSQUfRR fS5v0Gu0aiqMuP14oi+WQsHU1R3WFWyhZRNrdplI1mzxk+xPbzfBPuhyY6w3MEaxg7X9GFtc flXGvnLWUOz7gScE21r3jto8l3tVVopxg9YpjHPY3su4aksVyfnOuTHuwuRqzv32DsZ9a1vK 9VqfY8ny/WEb03ntUSNviE84GHbk+v1RlGNfdMJZfgs3oZEFJUhOA7MWJoor8RIURiuZJgTV LjslFd8RNHaZQ8o3BLaWAPHP8nDUTkjCNQQVpmekVPgR+Mo+Tvtpej6zBz6bUkRDJJMM42bH zFicCWBw9tFnJAoUsxImb/ZTIlYwCdDrcc4kEEwMVHZ/ncELmH3ge2wnpZ4IeFo1TIjz5Uwi OKcMIo0z0VDYXo1LWAXvhuswMQsYvwx+jXzBpa2ToM53N4Tnw6j7lkzCi2HKIRpEXAC+piJ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1sSy4srcQ4wSHMxKIrxlF37ECPGmJFZW pRblxxeV5qQWH2I0BfptIrOUaHI+MLnklcQbmhqaW1gamhubG5tZKInzdggcjBESSE8sSc1O TS1ILYLpY+LglGpgDEwLnpt/tmjS3df87BHy5ipy5SFdv7dlruiaxDj5+CVHe1Ex5iIbUx4W tU7hsuPCW4/Psen/IPl/ceHchY4s+woPfRRIvZBulvfjoYFkl0fBvYrG3faHJHNEnKYvnJx/ tflWmGH+M/agr7PEfqprv/xVt/Bfy30/gUzvM2o3GbqdjxY1uV9UYinOSDTUYi4qTgQA6GoI oPYCAAA= X-CMS-MailID: 20190607061534eucas1p1bd90a699e88649a5af1b3f0da2ea8587 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190607044646epcas1p29293d79cf80db6b15cc97336ebcc8d4e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190607044646epcas1p29293d79cf80db6b15cc97336ebcc8d4e References: <20190607044550.13361-1-andrew.smirnov@gmail.com> <20190607044550.13361-12-andrew.smirnov@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07.06.2019 06:45, Andrey Smirnov wrote: > Move common code converting clock rate to an appropriate constant and > configuring SYS_PLLPARAM register into a separate routine and convert > the rest of the code to use it. No functional change intended. > > Signed-off-by: Andrey Smirnov > Reviewed-by: Laurent Pinchart Reviewed-by: Andrzej Hajda  -- Regards Andrzej > Cc: Archit Taneja > Cc: Andrzej Hajda > Cc: Laurent Pinchart > Cc: Tomi Valkeinen > Cc: Andrey Gusakov > Cc: Philipp Zabel > Cc: Chris Healy > Cc: Cory Tusar > Cc: Lucas Stach > Cc: dri-devel@lists.freedesktop.org > Cc: linux-kernel@vger.kernel.org > --- > drivers/gpu/drm/bridge/tc358767.c | 46 +++++++++++-------------------- > 1 file changed, 16 insertions(+), 30 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c > index 4bb9b15e1324..ac55b59249e3 100644 > --- a/drivers/gpu/drm/bridge/tc358767.c > +++ b/drivers/gpu/drm/bridge/tc358767.c > @@ -581,35 +581,40 @@ static int tc_stream_clock_calc(struct tc_data *tc) > return regmap_write(tc->regmap, DP0_VIDMNGEN1, 32768); > } > > -static int tc_aux_link_setup(struct tc_data *tc) > +static int tc_set_syspllparam(struct tc_data *tc) > { > unsigned long rate; > - u32 dp0_auxcfg1; > - u32 value; > - int ret; > + u32 pllparam = SYSCLK_SEL_LSCLK | LSCLK_DIV_2; > > rate = clk_get_rate(tc->refclk); > switch (rate) { > case 38400000: > - value = REF_FREQ_38M4; > + pllparam |= REF_FREQ_38M4; > break; > case 26000000: > - value = REF_FREQ_26M; > + pllparam |= REF_FREQ_26M; > break; > case 19200000: > - value = REF_FREQ_19M2; > + pllparam |= REF_FREQ_19M2; > break; > case 13000000: > - value = REF_FREQ_13M; > + pllparam |= REF_FREQ_13M; > break; > default: > dev_err(tc->dev, "Invalid refclk rate: %lu Hz\n", rate); > return -EINVAL; > } > > + return regmap_write(tc->regmap, SYS_PLLPARAM, pllparam); > +} > + > +static int tc_aux_link_setup(struct tc_data *tc) > +{ > + int ret; > + u32 dp0_auxcfg1; > + > /* Setup DP-PHY / PLL */ > - value |= SYSCLK_SEL_LSCLK | LSCLK_DIV_2; > - ret = regmap_write(tc->regmap, SYS_PLLPARAM, value); > + ret = tc_set_syspllparam(tc); > if (ret) > goto err; > > @@ -868,7 +873,6 @@ static int tc_main_link_enable(struct tc_data *tc) > { > struct drm_dp_aux *aux = &tc->aux; > struct device *dev = tc->dev; > - unsigned int rate; > u32 dp_phy_ctrl; > u32 value; > int ret; > @@ -896,25 +900,7 @@ static int tc_main_link_enable(struct tc_data *tc) > if (ret) > return ret; > > - rate = clk_get_rate(tc->refclk); > - switch (rate) { > - case 38400000: > - value = REF_FREQ_38M4; > - break; > - case 26000000: > - value = REF_FREQ_26M; > - break; > - case 19200000: > - value = REF_FREQ_19M2; > - break; > - case 13000000: > - value = REF_FREQ_13M; > - break; > - default: > - return -EINVAL; > - } > - value |= SYSCLK_SEL_LSCLK | LSCLK_DIV_2; > - ret = regmap_write(tc->regmap, SYS_PLLPARAM, value); > + ret = tc_set_syspllparam(tc); > if (ret) > return ret; >