Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5302114imu; Wed, 19 Dec 2018 08:50:11 -0800 (PST) X-Google-Smtp-Source: AFSGD/UzXRsXGMqVWurSnpzUUbHtlfsZEJwK4ZA+ygCrMAwYUafXXjyOk2u7FH1OdOcuubuDB9qn X-Received: by 2002:a17:902:2ec1:: with SMTP id r59mr21275232plb.254.1545238211083; Wed, 19 Dec 2018 08:50:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545238211; cv=none; d=google.com; s=arc-20160816; b=Qp0KuymeZ+jvWV1WtlK75CKSn2PFvDCJjL7AqUXwsFr97uYwHyu3BJItxZMOJBMZYz SzF3VbDnL+s6B6kVSn93EP/4c1nD8BECxSjZeOf5bs6KCvYqebz241a+qnaFCNuTWCc9 LlDOdsVCWTmOcXcMoniABFY76nl9k1eMq4ArCfhzOUTBlGsEU0iidMoWXdMkA7qGnRWz V4VsM1KKRwh+pUk6bq0aFoqz/2zZMZxMbSMkBM9Uhs7uUFUkKCmhYAtC4zUUKxAPygRY cY1EnSHjItnFjaJVKzpW6qIky9JucYLJHfEmXsKKn3NdRZAt66Wmd2kuiuOoAy5mHh9i x4sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:date:message-id:autocrypt :openpgp:from:references:cc:to:subject:dkim-signature; bh=xGa2ICyEKMipdlDD0WrN11F2swN1FjgUP7+OQw6214E=; b=eFkfsJSM+vDKqkaCQEtbVFso7zD3fY5qjsjIbD9m2WVzqJb/k71htrRKUUSre9OrJk zqmCGWJ0FPw5tknu0cLRAzwVCSyklB5Cqt1pUgF4NhB1q2K2aBQkdvZDVlueavJaHmtN 3ap/jGLCYDOwbFrd8OflamJmurrcIbaLUeQMFEFv7kqjKuQwcKenDACdL9onyM6cfIXh kLIYESfS24pkYGylW8T42tWQjnuZ8aP5rsTBF+iRluOtYed1U15sC/6QoCYJgcRHawWv 3DfcZai3//KcPhoWr0Whasxe8OvHj/CJ2kbMwa0xiCyqWA7xfn4SLCm/SKTgiPf5AVpX NeWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F7nUbK72; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c8si15784268pgl.507.2018.12.19.08.49.54; Wed, 19 Dec 2018 08:50:11 -0800 (PST) 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=@linaro.org header.s=google header.b=F7nUbK72; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729608AbeLSOhe (ORCPT + 99 others); Wed, 19 Dec 2018 09:37:34 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42151 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729459AbeLSOhe (ORCPT ); Wed, 19 Dec 2018 09:37:34 -0500 Received: by mail-wr1-f68.google.com with SMTP id q18so19753494wrx.9 for ; Wed, 19 Dec 2018 06:37:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=xGa2ICyEKMipdlDD0WrN11F2swN1FjgUP7+OQw6214E=; b=F7nUbK72pxExytCs9g8c4/3cd0hk4vuYfwUK5sCSZwfP/XjiMktS5fVjVadv9aJA2t qNk8SVYNG1m0VuAZ8tnepXOVaVLzWY54A9+3IQHOcO1zxWLkJUp03a2zx5ZcRYjB6Ypq keBo5swZBl7znMLOeyiQXFxMAdbuTP3WN6hyU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=xGa2ICyEKMipdlDD0WrN11F2swN1FjgUP7+OQw6214E=; b=mILNWu7ddARnz5aHzfhh9jGGYlgIeipFBZZYN3p3meqangx3H1x4UWfge0IhZ3MpgA N084APiT8987W+jdnAZdCQeXZxoAl2Sr9waF0MphvaaFnfGvuKrkc9hRFsrnLwq2uTGA 7TLnnQKkvmXRZnmUAjfcbEPK4hLTmdPOUc6p7SDZrFajjJxbh7kzHk3x3/ZVzfLRoxSg C3TC9wGR6wcYvNG56T11qiaUtiRzM3XfJ1CV4hCKFsYaddPXUdjB68KtkwwWgzZj3m+O xBvPo2crdBZvnF6cy6bNrtH0csJkNfYMBqJFhL6mmJAUWdHhTPjDLVsPJWI+lXqUUYWb bVzQ== X-Gm-Message-State: AA+aEWa6lbtH6upDQhPIN5DBHzulQnXhKgrwj8vTPzi3QBCI/zWdn72k 1RTawUgZFunInG8Lw8LrBdAL7w== X-Received: by 2002:adf:dcd0:: with SMTP id x16mr18453899wrm.143.1545230251406; Wed, 19 Dec 2018 06:37:31 -0800 (PST) Received: from [10.44.66.8] ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id h16sm12351949wrb.62.2018.12.19.06.37.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 06:37:30 -0800 (PST) Subject: Re: [PATCH v3 2/3] drm/msm/dpu: Integrate interconnect API in MDSS To: Sravanthi Kollukuduru , dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org, robdclark@gmail.com, seanpaul@chromium.org, sean@poorly.run References: <20181122090653.3523-1-skolluku@codeaurora.org> <20181122090653.3523-3-skolluku@codeaurora.org> From: Georgi Djakov Openpgp: preference=signencrypt Autocrypt: addr=georgi.djakov@linaro.org; prefer-encrypt=mutual; keydata= mQINBFjTuRcBEACyAOVzghvyN19Sa/Nit4LPBWkICi5W20p6bwiZvdjhtuh50H5q4ktyxJtp 1+s8dMSa/j58hAWhrc2SNL3fttOCo+MM1bQWwe8uMBQJP4swgXf5ZUYkSssQlXxGKqBSbWLB uFHOOBTzaQBaNgsdXo+mQ1h8UCgM0zQOmbs2ort8aHnH2i65oLs5/Xgv/Qivde/FcFtvEFaL 0TZ7odM67u+M32VetH5nBVPESmnEDjRBPw/DOPhFBPXtal53ZFiiRr6Bm1qKVu3dOEYXHHDt nF13gB+vBZ6x5pjl02NUEucSHQiuCc2Aaavo6xnuBc3lnd4z/xk6GLBqFP3P/eJ56eJv4d0B 0LLgQ7c1T3fU4/5NDRRCnyk6HJ5+HSxD4KVuluj0jnXW4CKzFkKaTxOp7jE6ZD/9Sh74DM8v etN8uwDjtYsM07I3Szlh/I+iThxe/4zVtUQsvgXjwuoOOBWWc4m4KKg+W4zm8bSCqrd1DUgL f67WiEZgvN7tPXEzi84zT1PiUOM98dOnmREIamSpKOKFereIrKX2IcnZn8jyycE12zMkk+Sc ASMfXhfywB0tXRNmzsywdxQFcJ6jblPNxscnGMh2VlY2rezmqJdcK4G4Lprkc0jOHotV/6oJ mj9h95Ouvbq5TDHx+ERn8uytPygDBR67kNHs18LkvrEex/Z1cQARAQABtChHZW9yZ2kgRGph a292IDxnZW9yZ2kuZGpha292QGxpbmFyby5vcmc+iQI+BBMBAgAoBQJY07kXAhsDBQkHhM4A BgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRCyi/eZ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JkdTw== Message-ID: Date: Wed, 19 Dec 2018 16:37:27 +0200 MIME-Version: 1.0 In-Reply-To: <20181122090653.3523-3-skolluku@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sravanthi, Thanks for the patch! On 11/22/18 11:06, Sravanthi Kollukuduru wrote: > The interconnect framework is designed to provide a > standard kernel interface to control the settings of > the interconnects on a SoC. > > The interconnect API uses a consumer/provider-based model, > where the providers are the interconnect buses and the > consumers could be various drivers. > > MDSS is one of the interconnect consumers which uses the > interconnect APIs to get the path between endpoints and > set its bandwidth/latency/QoS requirements for the given > interconnected path. > > Changes in v2: > - Remove error log and unnecessary check (Jordan Crouse) > > Changes in v3: > - Code clean involving variable name change, removal > of extra paranthesis and variables (Matthias Kaehlcke) > > Signed-off-by: Sravanthi Kollukuduru > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 49 ++++++++++++++++++++++++++++---- > 1 file changed, 44 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c > index 38576f8b90b6..1387a6b1b39e 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c > @@ -4,10 +4,12 @@ > */ > > #include "dpu_kms.h" > +#include > > #define to_dpu_mdss(x) container_of(x, struct dpu_mdss, base) > > -#define HW_INTR_STATUS 0x0010 > +#define HW_INTR_STATUS 0x0010 Unrelated change? > +#define MAX_BW 6800000 In what units? Maybe add a comment. > > struct dpu_mdss { > struct msm_mdss base; > @@ -16,8 +18,30 @@ struct dpu_mdss { > u32 hwversion; > struct dss_module_power mp; > struct dpu_irq_controller irq_controller; > + struct icc_path *path[2]; > + u32 num_paths; > }; > > +static int dpu_mdss_parse_data_bus_icc_path( > + struct drm_device *dev, struct dpu_mdss *dpu_mdss) Nit: Lines should not end with a '('. Please move the first argument up: static int dpu_mdss_parse_data_bus_icc_path(struct drm_device *dev, struct dpu_mdss *dpu_mdss) > +{ > + struct icc_path *path0 = of_icc_get(dev->dev, "port0"); > + struct icc_path *path1 = of_icc_get(dev->dev, "port1"); In DT it's preferred that the name contains both the source and destination, so maybe of_icc_get(dev->dev, "mdp0-mem") etc. > + > + if (IS_ERR(path0)) > + return PTR_ERR(path0); > + > + dpu_mdss->path[0] = path0; > + dpu_mdss->num_paths = 1; > + > + if (!IS_ERR(path1)) { > + dpu_mdss->path[1] = path1; > + dpu_mdss->num_paths++; > + } > + > + return 0; > +} > + > static irqreturn_t dpu_mdss_irq(int irq, void *arg) > { > struct dpu_mdss *dpu_mdss = arg; > @@ -127,7 +151,11 @@ static int dpu_mdss_enable(struct msm_mdss *mdss) > { > struct dpu_mdss *dpu_mdss = to_dpu_mdss(mdss); > struct dss_module_power *mp = &dpu_mdss->mp; > - int ret; > + int ret, i; > + u64 avg_bw = dpu_mdss->num_paths ? MAX_BW/dpu_mdss->num_paths : 0; Nit: Please add spaces around "/" > + > + for (i = 0; i < dpu_mdss->num_paths; i++) > + icc_set(dpu_mdss->path[i], avg_bw, MAX_BW); Now we have macros in the header, that can be used to specify the bandwidth units. So please use kBps_to_icc or MBps_to_icc etc. If we decide in the future to change the internal units, we will be able to do it without touching the users. Thanks, Georgi > > ret = msm_dss_enable_clk(mp->clk_config, mp->num_clk, true); > if (ret) > @@ -140,12 +168,15 @@ static int dpu_mdss_disable(struct msm_mdss *mdss) > { > struct dpu_mdss *dpu_mdss = to_dpu_mdss(mdss); > struct dss_module_power *mp = &dpu_mdss->mp; > - int ret; > + int ret, i; > > ret = msm_dss_enable_clk(mp->clk_config, mp->num_clk, false); > if (ret) > DPU_ERROR("clock disable failed, ret:%d\n", ret); > > + for (i = 0; i < dpu_mdss->num_paths; i++) > + icc_set(dpu_mdss->path[i], 0, 0); > + > return ret; > } > > @@ -155,6 +186,7 @@ static void dpu_mdss_destroy(struct drm_device *dev) > struct msm_drm_private *priv = dev->dev_private; > struct dpu_mdss *dpu_mdss = to_dpu_mdss(priv->mdss); > struct dss_module_power *mp = &dpu_mdss->mp; > + int i; > > pm_runtime_disable(dev->dev); > _dpu_mdss_irq_domain_fini(dpu_mdss); > @@ -162,6 +194,9 @@ static void dpu_mdss_destroy(struct drm_device *dev) > msm_dss_put_clk(mp->clk_config, mp->num_clk); > devm_kfree(&pdev->dev, mp->clk_config); > > + for (i = 0; i < dpu_mdss->num_paths; i++) > + icc_put(dpu_mdss->path[i]); > + > if (dpu_mdss->mmio) > devm_iounmap(&pdev->dev, dpu_mdss->mmio); > dpu_mdss->mmio = NULL; > @@ -200,6 +235,10 @@ int dpu_mdss_init(struct drm_device *dev) > } > dpu_mdss->mmio_len = resource_size(res); > > + ret = dpu_mdss_parse_data_bus_icc_path(dev, dpu_mdss); > + if (ret) > + return ret; > + > mp = &dpu_mdss->mp; > ret = msm_dss_parse_clock(pdev, mp); > if (ret) { > @@ -221,14 +260,14 @@ int dpu_mdss_init(struct drm_device *dev) > goto irq_error; > } > > + priv->mdss = &dpu_mdss->base; > + > pm_runtime_enable(dev->dev); > > pm_runtime_get_sync(dev->dev); > dpu_mdss->hwversion = readl_relaxed(dpu_mdss->mmio); > pm_runtime_put_sync(dev->dev); > > - priv->mdss = &dpu_mdss->base; > - > return ret; > > irq_error: >