Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp211899ybe; Tue, 3 Sep 2019 21:09:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwErKrSzH7/SxHS0ViCv6TQSkK8zJlFrRhobiAHt1K40dI3Uj8o6+M9Pw+9tNHMWfEzNVqd X-Received: by 2002:a17:90a:2e86:: with SMTP id r6mr2829484pjd.67.1567570166618; Tue, 03 Sep 2019 21:09:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567570166; cv=none; d=google.com; s=arc-20160816; b=zcevmkdHvV89QKCjUGuvzeCd3oVQ4pMxb9rLrY/G4NSAqLXJoYuGdkIQKIF50+okD9 6jtnZhupqrxaeobVAogJo4sHYSS7WFkq+DHPMTW07lN6/1DkBWg8twbjGb/7GSDqhkwM PB+z7MQ+P5PWjT8gcfeIkxSUr+vSJmS4ym516BnvHk1+YIA+xETZbBvmS2EFGZQru378 gYUjTohCA1taqgGeGZE/gARRzpRyCaXJ9Cxt7mrKvsi5G1pK8E7aIyqOSQoIeWM6oEZe SJ2qCaI2g/mlxceV173YBaT7+T2p0hpmSgZSmuMcBCkJp3/v6tt1beLOyL+WaY7pggpX lwow== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=WR9RwslGCgsu1FUrle5RdNTBBdzxARrpGIzQ2oQKWzk=; b=Prfwcafa5DjYjN2mWlNfz5sgiQEo7Ct1RjiYzuLY/sRdgcP2Xh6RjgQ/36HQZZxMwJ eP9JRcR3Y4BVEEEFdyqSHp7YWQxksTOZFQ0jBZTRiqW/NTmjfy1e2aZtx9VriZbHuBBN wnLMfJ/GMAzDSgSG+omnLV1ma/8Gi3O4oysHghL7gnnRfEPW20sicUtEsvZE/fT4fFwu wNg4pGUaCGBAy0YZRlOHW/pH+lMMkdNO42p3ppjfMjlDek5VjTjKoT6iLG9IkaGcrf+c OcgmV9ArTAe4LJqTvtkZJV0cDF1+FXRj+NqsqA2cu0dRJ+Y79bq2SFLek9AbraG9uUU3 FgWQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 130si16572467pgg.18.2019.09.03.21.09.10; Tue, 03 Sep 2019 21:09: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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726082AbfIDEIF (ORCPT + 99 others); Wed, 4 Sep 2019 00:08:05 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:10701 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726012AbfIDEIF (ORCPT ); Wed, 4 Sep 2019 00:08:05 -0400 X-UUID: c8c948f33d2047f3bdfa7905ae66264b-20190904 X-UUID: c8c948f33d2047f3bdfa7905ae66264b-20190904 Received: from mtkcas32.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 561403735; Wed, 04 Sep 2019 12:07:57 +0800 Received: from MTKCAS32.mediatek.inc (172.27.4.184) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 4 Sep 2019 12:07:54 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS32.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 4 Sep 2019 12:07:53 +0800 Message-ID: <1567570074.31301.19.camel@mhfsdcap03> Subject: Re: [PATCH v3 06/14] media: mtk-mdp: Get rid of mtk_smi_larb_get/put From: houlong wei To: Yong Wu , Matthias Brugger , Joerg Roedel , Rob Herring CC: Evan Green , Robin Murphy , Tomasz Figa , Will Deacon , , , , , , , , , Nicolas Boichat , Matthias Kaehlcke , , , , , , Date: Wed, 4 Sep 2019 12:07:54 +0800 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-SNTS-SMTP: 500850E9C33D38436DBF3DA1D3DC54035EACB51BDE85BE19A0327058E6BBD5A42000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Yong, I have inline comment below. > MediaTek IOMMU has already added the device_link between the consumer > and smi-larb device. If the mdp device call the pm_runtime_get_sync, > the smi-larb's pm_runtime_get_sync also be called automatically. > > CC: Minghsiu Tsai > Signed-off-by: Yong Wu > Reviewed-by: Evan Green > --- > drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 38 --------------------------- > drivers/media/platform/mtk-mdp/mtk_mdp_comp.h | 2 -- > drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 1 - > 3 files changed, 41 deletions(-) > > diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c > index 9afe816..5985a9b 100644 > --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c > +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c > @@ -9,7 +9,6 @@ > #include > #include > #include > -#include > > #include "mtk_mdp_comp.h" > > @@ -58,14 +57,6 @@ void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp) > { > int i, err; > > - if (comp->larb_dev) { > - err = mtk_smi_larb_get(comp->larb_dev); > - if (err) > - dev_err(dev, > - "failed to get larb, err %d. type:%d id:%d\n", > - err, comp->type, comp->id); > - } In previous design,mtk_mdp_comp_clock_on() is called by each MDP hardware component, and mtk_smi_larb_get() is also called for each MDP hardware component which accesses DRAM via SMI larb. Since mdp device only contains mdp_rdma component, so pm_runtime_get_sync() will ignore other smi-larb clock. We need consider how to enable clocks of other smi-larb associated with other mdp component, e.g. mdp_wdma, mdp_wrot. > for (i = 0; i < ARRAY_SIZE(comp->clk); i++) { > if (IS_ERR(comp->clk[i])) > continue; > @@ -86,16 +77,11 @@ void mtk_mdp_comp_clock_off(struct device *dev, struct mtk_mdp_comp *comp) > continue; > clk_disable_unprepare(comp->clk[i]); > } > - > - if (comp->larb_dev) > - mtk_smi_larb_put(comp->larb_dev); > } > > int mtk_mdp_comp_init(struct device *dev, struct device_node *node, > struct mtk_mdp_comp *comp, enum mtk_mdp_comp_id comp_id) > { > - struct device_node *larb_node; > - struct platform_device *larb_pdev; > int i; > > if (comp_id < 0 || comp_id >= MTK_MDP_COMP_ID_MAX) { > @@ -116,30 +102,6 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node, > break; > } > > - /* Only DMA capable components need the LARB property */ > - comp->larb_dev = NULL; > - if (comp->type != MTK_MDP_RDMA && > - comp->type != MTK_MDP_WDMA && > - comp->type != MTK_MDP_WROT) > - return 0; > - > - larb_node = of_parse_phandle(node, "mediatek,larb", 0); > - if (!larb_node) { > - dev_err(dev, > - "Missing mediadek,larb phandle in %pOF node\n", node); > - return -EINVAL; > - } > - > - larb_pdev = of_find_device_by_node(larb_node); > - if (!larb_pdev) { > - dev_warn(dev, "Waiting for larb device %pOF\n", larb_node); > - of_node_put(larb_node); > - return -EPROBE_DEFER; > - } > - of_node_put(larb_node); > - > - comp->larb_dev = &larb_pdev->dev; > - > return 0; > } > > diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h > index 998a4b9..a2da8df 100644 > --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h > +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h > @@ -39,7 +39,6 @@ enum mtk_mdp_comp_id { > * @dev_node: component device node > * @clk: clocks required for component > * @regs: Mapped address of component registers. > - * @larb_dev: SMI device required for component > * @type: component type > * @id: component ID > */ > @@ -47,7 +46,6 @@ struct mtk_mdp_comp { > struct device_node *dev_node; > struct clk *clk[2]; > void __iomem *regs; > - struct device *larb_dev; > enum mtk_mdp_comp_type type; > enum mtk_mdp_comp_id id; > }; > diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c > index fc9faec..c237ed9 100644 > --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c > +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c > @@ -17,7 +17,6 @@ > #include > #include > #include > -#include > > #include "mtk_mdp_core.h" > #include "mtk_mdp_m2m.h"