Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1734041ybe; Tue, 3 Sep 2019 02:41:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzipp0E6LqBS+OBGXV9bjuXHkhgi0mZpv/UoKidxn9mli2NnadZi2Ooh6iSmNyvA0L7UJUS X-Received: by 2002:a17:902:8ecc:: with SMTP id x12mr26320901plo.258.1567503666815; Tue, 03 Sep 2019 02:41:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567503666; cv=none; d=google.com; s=arc-20160816; b=Sb1Yu8x4ocYiDnmqNfmuKD+oJhhXIr9LVu0h0hn5xa2ik3m6n7sgHi0G2EPbzX4Cbp TJLoB2oVmYbkIxj75uSjbFdoapu45qgH1sGmlGQjFKuEuCuPmvMKEREQHZ7IieppdSdT TruGwfIXaKB6b+TIWFsL8DAHnAc9na1tnjuq7bE4OskhTQAN6VmW5MddDMv24GSUWKYy 4p/J7o1EIFQmV8FmoodKSpJSWZ/am1I/xS8oWtyyVQwYPa44w/lOxVBT9wHolvIkxr2g zG6sYeAL73KjAwxYLaYFQhjrvTmH7TD4VoTXvJp5/IbG9D5wW8TIuH3kV+iFiAvw1I5w FYXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=WKwHKBbXFqtKQBRc/zurGit9RtAekRRH7M8KsWEAXx4=; b=h+ZhkMNvPzh+gPyN8gkp6SUgPwXnaizKzGuw4HTQiaVF3hDcYAd5YRH4iH2fdKC3FY k1pFuPhrh8ZhMTYkneAyv0piRTdHZcGDOmFrtexMBN+warLotDNiP9Bnd4kwU0jHz2Z8 V5Wi9F5mmk0bhd2syd3JYV1TOca/aH2DtIs6ELYXVzyGV6M9oopNgqdEx/NBYPZr6jH8 ZCNS7JNJWOtEmW0suz9P6+L2t4Q2GjgAsCKsEGqq2trDNm2mbVQQ8RFYgMnjni/qaFeA +EURPWzQorsBUSt3/FuauFtHi1QzJa2+zXnaOsfvE1B0JpAsCZGiXX64QX79zSBlg4tN 11oA== 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 p8si5226714pgk.85.2019.09.03.02.40.47; Tue, 03 Sep 2019 02:41:06 -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 S1728671AbfICJje (ORCPT + 99 others); Tue, 3 Sep 2019 05:39:34 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:30086 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728426AbfICJjd (ORCPT ); Tue, 3 Sep 2019 05:39:33 -0400 X-UUID: e7da68bb1a0d45b89c52f6352bcac7af-20190903 X-UUID: e7da68bb1a0d45b89c52f6352bcac7af-20190903 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 849789412; Tue, 03 Sep 2019 17:39:29 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 3 Sep 2019 17:39:24 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 3 Sep 2019 17:39:23 +0800 From: Yong Wu To: Matthias Brugger , Joerg Roedel , Rob Herring CC: Evan Green , Robin Murphy , Tomasz Figa , Will Deacon , , , , , , , , , Nicolas Boichat , Matthias Kaehlcke , , , , , CK Hu , Philipp Zabel Subject: [PATCH v3 08/14] drm/mediatek: Get rid of mtk_smi_larb_get/put Date: Tue, 3 Sep 2019 17:37:30 +0800 Message-ID: <1567503456-24725-9-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1567503456-24725-1-git-send-email-yong.wu@mediatek.com> References: <1567503456-24725-1-git-send-email-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the drm device call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: CK Hu CC: Philipp Zabel Signed-off-by: Yong Wu Reviewed-by: Evan Green --- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 14 +------------- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 30 ----------------------------- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 1 - 3 files changed, 1 insertion(+), 44 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index a900721..c1e891e 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -10,7 +10,6 @@ #include #include #include -#include #include "mtk_drm_drv.h" #include "mtk_drm_crtc.h" @@ -359,22 +358,13 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); - struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0]; int ret; DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id); - ret = mtk_smi_larb_get(comp->larb_dev); - if (ret) { - DRM_ERROR("Failed to get larb: %d\n", ret); - return; - } - ret = mtk_crtc_ddp_hw_init(mtk_crtc); - if (ret) { - mtk_smi_larb_put(comp->larb_dev); + if (ret) return; - } drm_crtc_vblank_on(crtc); mtk_crtc->enabled = true; @@ -384,7 +374,6 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); - struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0]; int i; DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id); @@ -407,7 +396,6 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc, drm_crtc_vblank_off(crtc); mtk_crtc_ddp_hw_fini(mtk_crtc); - mtk_smi_larb_put(comp->larb_dev); mtk_crtc->enabled = false; } diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c index b38963f..7dc8496 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c @@ -256,15 +256,9 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node, struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id comp_id, const struct mtk_ddp_comp_funcs *funcs) { - enum mtk_ddp_comp_type type; - struct device_node *larb_node; - struct platform_device *larb_pdev; - if (comp_id < 0 || comp_id >= DDP_COMPONENT_ID_MAX) return -EINVAL; - type = mtk_ddp_matches[comp_id].type; - comp->id = comp_id; comp->funcs = funcs ?: mtk_ddp_matches[comp_id].funcs; @@ -288,30 +282,6 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node, if (IS_ERR(comp->clk)) return PTR_ERR(comp->clk); - /* Only DMA capable components need the LARB property */ - comp->larb_dev = NULL; - if (type != MTK_DISP_OVL && - type != MTK_DISP_RDMA && - type != MTK_DISP_WDMA) - 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/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h index 0ad287f..108de60 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h @@ -83,7 +83,6 @@ struct mtk_ddp_comp { struct clk *clk; void __iomem *regs; int irq; - struct device *larb_dev; enum mtk_ddp_comp_id id; const struct mtk_ddp_comp_funcs *funcs; }; -- 1.9.1