Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4200450ybi; Tue, 18 Jun 2019 13:42:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7FlojbS75qqIc1DCY/VMMLvQ8yydhNZLIM4RNZQHxaa38PlkcUHndLHexQFh5Xm+J5zZP X-Received: by 2002:a17:902:a504:: with SMTP id s4mr46218482plq.117.1560890547961; Tue, 18 Jun 2019 13:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560890547; cv=none; d=google.com; s=arc-20160816; b=jr7tOqlPOSYM+cn31VtPSovgFJle2fV/aIgp3zlXLKJ8Zoa69krRYqaL86jt718ZQ7 B/oMi5sBk6y7Gg4EYDsMaPt3kATapHUHCsqYYk4sjAcXYSf+gIl8YJAmKtVmnpOx26GC FIPjjua11NhMq1PNmSYNIN1q2+BQukF+1DKe1JDxEYlSogeOquLeHOcdQXm0lFPOWk5+ xTf6CrPegG0LvLWju4HG58CviSo2/q/1aqCW2XXW+u/WyIPnYaF0gIsTb+oiJWliZ/zn rMklw5bbR9ws/Tu96Xa3t7RyXt9HLXv/sqvqxcyduyBbieWUzjwfiyg9j34SHVoxlejI 1IVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=sIyXF/EzZipTYqrIluZkq/5+UTS8byL1khSMDYNgjl0=; b=woSQM46gJCsox7KQ6cfWRBsOTb1l405J4RfBbpVa9XrSDJ6iE2nHHr+NIf3nJ1FHL1 Jn9FwM1eiAC+h9gv0oLaWS/A05Ga9xCFLynyZBkz2cAq+/apc4ASc2xPclzMwptVKCRM 6CEvz4YO6dIlW0GooWTGzBBcil8oQ6ruci9KU0m7Y/WtKIp9I1MLO0oxNMQs11DxGo7M 0Nkni78BxgOw081T1jCiey0Tm7+2eG3dTAD34DkjMqrdnhSNYRMZ+VrzmIryQTb5PWyS zydZnlkdvYhWY7iyMNHQ3M01F+HamSrHiG9jjIv/ETTxev8xKopJGtNjuOfU8QhMyRIL 3swQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=Z0iwbsTW; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si13097615plh.59.2019.06.18.13.42.11; Tue, 18 Jun 2019 13:42:27 -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=@poorly.run header.s=google header.b=Z0iwbsTW; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730613AbfFRUmF (ORCPT + 99 others); Tue, 18 Jun 2019 16:42:05 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:44709 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730341AbfFRUmF (ORCPT ); Tue, 18 Jun 2019 16:42:05 -0400 Received: by mail-qt1-f193.google.com with SMTP id x47so17113417qtk.11 for ; Tue, 18 Jun 2019 13:42:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=sIyXF/EzZipTYqrIluZkq/5+UTS8byL1khSMDYNgjl0=; b=Z0iwbsTWYrYJl7fKykmsYH4TK1f6rLcLerOklZtHs1BMCUQd12tIkE5PnTFzM4n7pi crG+hbmqoSCM+QNJHlAkGWa7zxUJCzQM+SDlUbSJaqUcVBeZgRTxk5vUzPLF5UoyWa3P aL0Kh9ji0ML4btsWj+JuIo0Vw5uaA5WGu8yM9vTgMDpYUj9JD29qyk0OpAMRdP/nfJ4I zrccJrHyfN1+BZE/xEs8xCjMgLk7Qgv3hnf5Ge+jShrcb2+OeJl8l2f+lQZ4iR0jwLsN gaUa5oFUkCKE/dv9K38yeujMGf6Vzed0U9TC8mlX1nS+dgWyiqHDp2b8fn3NhCUYnkF4 WXnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=sIyXF/EzZipTYqrIluZkq/5+UTS8byL1khSMDYNgjl0=; b=F8AjVEz0q8XUgYfa0M2qXoNN4CFoM/NLLwt+VmdsLL/5wF+AeIX45AWcVnGKaOezPL KVMf4+V5fEXdRpdz149wRngPUB4/fpAvg5X4aqVhd5dfuKBjHplfPegEzVoNLXx2umP2 8jRDMjb+zvyPudLrOqc/udVdBtubee+cfLwbUoEBqI73SE8QJfDi8wxopH20A/HkVByA HLw41WDUMnhomqe2RRv+e1HByVPmx4YDZCZ4r51bpXLJlfp19k9jx3xQyGLge5gY/Ym+ GD7wdlx96QEZPIVEzZInYJJOweJk2p+njguDy1jVr27epHSdV5arKrseYDkF69rz2jUv pZOg== X-Gm-Message-State: APjAAAXA0nfolbjk6Df+P03KM2oZkCANUzib+otCxfIRUlPqQU0v5XPv mwDwFoA11RH7KSiA1JxvgYv8vw== X-Received: by 2002:aed:3fc5:: with SMTP id w5mr85910114qth.317.1560890523926; Tue, 18 Jun 2019 13:42:03 -0700 (PDT) Received: from localhost ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id g10sm8262045qki.37.2019.06.18.13.42.02 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 18 Jun 2019 13:42:03 -0700 (PDT) Date: Tue, 18 Jun 2019 16:42:02 -0400 From: Sean Paul To: Rob Clark Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Sean Paul , Georgi Djakov , Jayant Shekhar , Sravanthi Kollukuduru , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Jordan Crouse , Jeykumar Sankaran , Stephen Boyd , Abhinav Kumar , freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/5] drm/msm/dpu: Integrate interconnect API in MDSS Message-ID: <20190618204202.GE25413@art_vandelay> References: <20190618202425.15259-1-robdclark@gmail.com> <20190618202425.15259-3-robdclark@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190618202425.15259-3-robdclark@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 18, 2019 at 01:24:10PM -0700, Rob Clark wrote: > From: Jayant Shekhar > > 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 requirement 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) > > Changes in v4: > - Add comments, spacings, tabs, proper port name > and icc macro (Georgi Djakov) > > Changes in v5: > - Commit text and parenthesis alignment (Georgi Djakov) > > Changes in v6: > - Change to new icc_set API's (Doug Anderson) > > Changes in v7: > - Fixed a typo > > Changes in v8: > - Handle the of_icc_get() returning NULL case. In practice > icc_set_bw() will gracefully handle the case of a NULL path, > but it's probably best for clarity to keep num_paths=0 in > this case. > > Signed-off-by: Sravanthi Kollukuduru > Signed-off-by: Jayant Shekhar > Signed-off-by: Rob Clark > Acked-by: Georgi Djakov Reviewed-by: Sean Paul > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 49 ++++++++++++++++++++++-- > 1 file changed, 45 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c > index 7316b4ab1b85..b1d0437ac7b6 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c > @@ -4,11 +4,15 @@ > */ > > #include "dpu_kms.h" > +#include > > #define to_dpu_mdss(x) container_of(x, struct dpu_mdss, base) > > #define HW_INTR_STATUS 0x0010 > > +/* Max BW defined in KBps */ > +#define MAX_BW 6800000 > + > struct dpu_irq_controller { > unsigned long enabled_mask; > struct irq_domain *domain; > @@ -21,8 +25,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) > +{ > + struct icc_path *path0 = of_icc_get(dev->dev, "mdp0-mem"); > + struct icc_path *path1 = of_icc_get(dev->dev, "mdp1-mem"); > + > + if (IS_ERR_OR_NULL(path0)) > + return PTR_ERR_OR_ZERO(path0); > + > + dpu_mdss->path[0] = path0; > + dpu_mdss->num_paths = 1; > + > + if (!IS_ERR_OR_NULL(path1)) { > + dpu_mdss->path[1] = path1; > + dpu_mdss->num_paths++; > + } > + > + return 0; > +} > + > static void dpu_mdss_irq(struct irq_desc *desc) > { > struct dpu_mdss *dpu_mdss = irq_desc_get_handler_data(desc); > @@ -134,7 +160,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; > + > + for (i = 0; i < dpu_mdss->num_paths; i++) > + icc_set_bw(dpu_mdss->path[i], avg_bw, kBps_to_icc(MAX_BW)); > > ret = msm_dss_enable_clk(mp->clk_config, mp->num_clk, true); > if (ret) > @@ -147,12 +177,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_bw(dpu_mdss->path[i], 0, 0); > + > return ret; > } > > @@ -163,6 +196,7 @@ static void dpu_mdss_destroy(struct drm_device *dev) > struct dpu_mdss *dpu_mdss = to_dpu_mdss(priv->mdss); > struct dss_module_power *mp = &dpu_mdss->mp; > int irq; > + int i; > > pm_runtime_suspend(dev->dev); > pm_runtime_disable(dev->dev); > @@ -172,6 +206,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; > @@ -211,6 +248,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) { > @@ -232,14 +273,14 @@ int dpu_mdss_init(struct drm_device *dev) > irq_set_chained_handler_and_data(irq, dpu_mdss_irq, > dpu_mdss); > > + 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: > -- > 2.20.1 > -- Sean Paul, Software Engineer, Google / Chromium OS