Message ID | 20231019055619.19358-16-shawn.sung@mediatek.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp180710vqb; Wed, 18 Oct 2023 22:58:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFSWomiD7p7DbgHq+qkjJu3uGcUt7wzC3qJJ+huI7JrnoCY0ILGnNQH4POS8/D1aIc+oz3e X-Received: by 2002:a25:9f8a:0:b0:d9a:c218:817c with SMTP id u10-20020a259f8a000000b00d9ac218817cmr1380328ybq.4.1697695095221; Wed, 18 Oct 2023 22:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697695095; cv=none; d=google.com; s=arc-20160816; b=TbmK8RObIuPsbiu0Db+ZiBCuxLPLLfWqwH1Z30wBLgvhgD+uw+eyuSDXH0Eopq3P3b 6V3sRalx2wLn4209gIkkgXQVgzFVTSByWNkjZZDLFpLbh/yOJWxd+wektJGUMFGMH1Ob sB46DDGlvbNdRDbDAPbDfcwCKj03BIypWma1C9Akf62cmfXfzi9L1Noz5+Fo9fpgXJ1t 5xUxSDEiKOvAkjyzC3UK7B+SY0pVZsg22MqMmY8kupX85bVA6kuNrEzIA5pdvKza4lB/ 77Rqx7S00nIlqPP48dhQaRS1SbfiIAjT95vcyqwKVVoZxBAUXHXC+31yMkf5SzsBzsiO 5vMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hCddrdlDqKBenFHKsmGj9TdLiwG7aCIS6uamT9ldeW0=; fh=fv4tbCKTXdNtjEvV4h1+g1nnsRjdLHbhnCNyWnoFRfI=; b=bPZvoq062ItD4h5VOWs63zf9OIw8HwENBNpk1+BwSjuDvOkADc/lIHBLT9VdF2EHsH PYfZ6xz5UEpAzmhnO22/YndXBBDtZrWfGvyx94z60PrpvAbj6Cl7mLO+kbRTCWpkEDD+ x914g5swuYULOLa2sfNfoXiRgJ7kW8YC5tRNkCq9BsH9yKPi/C1Pee1X18XJYt9TktAG mQqWW4zy4i7I3tIetEpKT3sNG2YmAs5cjXretH0y182U8QNLtLk2lfV5UKmAB2srhfQ8 PF/7NaR3MjLj2r/uDWD+QNetd38mfzT4KaEJiwBjNS1RS6j1FsbnP9ZrZVlk5JUYbiCC HRjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=dBY78zsj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id b1-20020a056a00114100b0068fac3509a9si5825357pfm.350.2023.10.18.22.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 22:58:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=dBY78zsj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 2EB0782909A3; Wed, 18 Oct 2023 22:58:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232818AbjJSF4o (ORCPT <rfc822;zwp10758@gmail.com> + 24 others); Thu, 19 Oct 2023 01:56:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231705AbjJSF4e (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Oct 2023 01:56:34 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5FC4112; Wed, 18 Oct 2023 22:56:28 -0700 (PDT) X-UUID: 3c3a52266e4411eea33bb35ae8d461a2-20231019 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=hCddrdlDqKBenFHKsmGj9TdLiwG7aCIS6uamT9ldeW0=; b=dBY78zsjgnqvcVrisbsOmlD4Ll5niGxTj5Twt6E/dI/V+goRii5xV0wm2+ozGG+DVuSuRiwolpVxzOXQt20Hoaj0Ayrnh/1sQ+R4eHljba4TWt2ymZ01u7ZaV8NiE7+NSCqzLypDqHGJfm30LKMuA9RJnExW0+CBhQkHbJ4gEP4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32,REQID:14511d16-4d23-4285-a55d-b704ebda40c0,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:5f78ec9,CLOUDID:d9671cc0-14cc-44ca-b657-2d2783296e72,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: 3c3a52266e4411eea33bb35ae8d461a2-20231019 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from <shawn.sung@mediatek.com>) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1650186100; Thu, 19 Oct 2023 13:56:24 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 19 Oct 2023 13:56:23 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 19 Oct 2023 13:56:22 +0800 From: Hsiao Chien Sung <shawn.sung@mediatek.com> To: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, CK Hu <ck.hu@mediatek.com>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Matthias Brugger <matthias.bgg@gmail.com>, Rob Herring <robh+dt@kernel.org> CC: Chun-Kuang Hu <chunkuang.hu@kernel.org>, Philipp Zabel <p.zabel@pengutronix.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Fei Shao <fshao@chromium.org>, Sean Paul <sean@poorly.run>, Johnson Wang <johnson.wang@mediatek.corp-partner.google.com>, "Nancy . Lin" <nancy.lin@mediatek.com>, Moudy Ho <moudy.ho@mediatek.com>, Hsiao Chien Sung <shawn.sung@mediatek.com>, "Jason-JH . Lin" <jason-jh.lin@mediatek.com>, Nathan Lu <nathan.lu@mediatek.com>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <dri-devel@lists.freedesktop.org>, <linux-mediatek@lists.infradead.org>, <linux-arm-kernel@lists.infradead.org> Subject: [PATCH v10 15/24] drm/mediatek: Remove ineffectual power management codes Date: Thu, 19 Oct 2023 13:56:10 +0800 Message-ID: <20231019055619.19358-16-shawn.sung@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231019055619.19358-1-shawn.sung@mediatek.com> References: <20231019055619.19358-1-shawn.sung@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=1.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,TVD_SUBJ_WIPE_DEBT,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 18 Oct 2023 22:58:05 -0700 (PDT) X-Spam-Level: * X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780162332095304195 X-GMAIL-MSGID: 1780162332095304195 |
Series |
Add display driver for MT8188 VDOSYS1
|
|
Commit Message
Shawn Sung (宋孝謙)
Oct. 19, 2023, 5:56 a.m. UTC
Display modules will be powered on when .atomic_enable(),
there is no need to do it again in mtk_crtc_ddp_hw_init().
Besides, the DRM devices are created manually when mtk-mmsys
is probed and there is no power domain linked to it.
Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
Comments
Il 19/10/23 07:56, Hsiao Chien Sung ha scritto: > Display modules will be powered on when .atomic_enable(), > there is no need to do it again in mtk_crtc_ddp_hw_init(). > Besides, the DRM devices are created manually when mtk-mmsys > is probed and there is no power domain linked to it. > > Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.") > > Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com> > --- > drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 18 +++--------------- > 1 file changed, 3 insertions(+), 15 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > index bc4cc75cca18..c7edd80be428 100644 > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > @@ -6,7 +6,6 @@ > #include <linux/clk.h> > #include <linux/dma-mapping.h> > #include <linux/mailbox_controller.h> > -#include <linux/pm_runtime.h> > #include <linux/soc/mediatek/mtk-cmdq.h> > #include <linux/soc/mediatek/mtk-mmsys.h> > #include <linux/soc/mediatek/mtk-mutex.h> > @@ -362,22 +361,16 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc, struct drm_atomic > drm_connector_list_iter_end(&conn_iter); > } > > - ret = pm_runtime_resume_and_get(crtc->dev->dev); > - if (ret < 0) { > - DRM_ERROR("Failed to enable power domain: %d\n", ret); > - return ret; > - } > - Are you really sure that writes to DISP_REG_OVL_xxx and others in other modules, called by the .layer_config() callback, can be successfully done on an unpowered and/or unclocked module, on all MediaTek SoCs? This looks a bit odd. > ret = mtk_mutex_prepare(mtk_crtc->mutex); > if (ret < 0) { > DRM_ERROR("Failed to enable mutex clock: %d\n", ret); > - goto err_pm_runtime_put; > + goto error; > } > > ret = mtk_crtc_ddp_clk_enable(mtk_crtc); > if (ret < 0) { > DRM_ERROR("Failed to enable component clocks: %d\n", ret); > - goto err_mutex_unprepare; > + goto error; > } > > for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) { > @@ -426,16 +419,13 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc, struct drm_atomic > ...because you could otherwise just call pm_runtime_put() here, instead of removing the pm_runtime_resume_and_get() call, which is something I would advise to do. Regards, Angelo > return 0; > > -err_mutex_unprepare: > +error: > mtk_mutex_unprepare(mtk_crtc->mutex); > -err_pm_runtime_put: > - pm_runtime_put(crtc->dev->dev); > return ret; > } > > static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc *mtk_crtc) > { > - struct drm_device *drm = mtk_crtc->base.dev; > struct drm_crtc *crtc = &mtk_crtc->base; > int i; > > @@ -465,8 +455,6 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc *mtk_crtc) > mtk_crtc_ddp_clk_disable(mtk_crtc); > mtk_mutex_unprepare(mtk_crtc->mutex); > > - pm_runtime_put(drm->dev); > - > if (crtc->state->event && !crtc->state->active) { > spin_lock_irq(&crtc->dev->event_lock); > drm_crtc_send_vblank_event(crtc, crtc->state->event);
Hi Angelo, On Thu, 2023-10-19 at 11:07 +0200, AngeloGioacchino Del Regno wrote: > Il 19/10/23 07:56, Hsiao Chien Sung ha scritto: > > Display modules will be powered on when .atomic_enable(), > > there is no need to do it again in mtk_crtc_ddp_hw_init(). > > Besides, the DRM devices are created manually when mtk-mmsys > > is probed and there is no power domain linked to it. > > > > Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC > > MT8173.") > > > > Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com> > > --- > > drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 18 +++--------------- > > 1 file changed, 3 insertions(+), 15 deletions(-) > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > > b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > > index bc4cc75cca18..c7edd80be428 100644 > > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > > @@ -6,7 +6,6 @@ > > #include <linux/clk.h> > > #include <linux/dma-mapping.h> > > #include <linux/mailbox_controller.h> > > -#include <linux/pm_runtime.h> > > #include <linux/soc/mediatek/mtk-cmdq.h> > > #include <linux/soc/mediatek/mtk-mmsys.h> > > #include <linux/soc/mediatek/mtk-mutex.h> > > @@ -362,22 +361,16 @@ static int mtk_crtc_ddp_hw_init(struct > > mtk_drm_crtc *mtk_crtc, struct drm_atomic > > drm_connector_list_iter_end(&conn_iter); > > } > > > > - ret = pm_runtime_resume_and_get(crtc->dev->dev); > > - if (ret < 0) { > > - DRM_ERROR("Failed to enable power domain: %d\n", ret); > > - return ret; > > - } > > - > > Are you really sure that writes to DISP_REG_OVL_xxx and others in > other modules, > called by the .layer_config() callback, can be successfully done on > an unpowered > and/or unclocked module, on all MediaTek SoCs? > This looks a bit odd. Not sure if I get your point correctly. We removed this PM API because: 1. mtk_crtc_ddp_hw_init() is called by mtk_drm_crtc_atomic_enable(), and the new inline function mtk_ddp_comp_power_on() is called before hw init, we can make sure the power is on before configuring the hardware. 2. The device "crtc->dev->dev" here is assigned by the probe function of mtk-mmsys, which will be look like "mediatek-drm.auto.13", and this device is not linked to any power domain. > > > ret = mtk_mutex_prepare(mtk_crtc->mutex); > > if (ret < 0) { > > DRM_ERROR("Failed to enable mutex clock: %d\n", ret); > > - goto err_pm_runtime_put; > > + goto error; > > } > > > > ret = mtk_crtc_ddp_clk_enable(mtk_crtc); > > if (ret < 0) { > > DRM_ERROR("Failed to enable component clocks: %d\n", > > ret); > > - goto err_mutex_unprepare; > > + goto error; > > } > > > > for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) { > > @@ -426,16 +419,13 @@ static int mtk_crtc_ddp_hw_init(struct > > mtk_drm_crtc *mtk_crtc, struct drm_atomic > > > > ...because you could otherwise just call pm_runtime_put() here, > instead of removing > the pm_runtime_resume_and_get() call, which is something I would > advise to do. > > Regards, > Angelo > Thanks, Shawn
Il 19/10/23 11:52, Shawn Sung (宋孝謙) ha scritto: > Hi Angelo, > > On Thu, 2023-10-19 at 11:07 +0200, AngeloGioacchino Del Regno wrote: >> Il 19/10/23 07:56, Hsiao Chien Sung ha scritto: >>> Display modules will be powered on when .atomic_enable(), >>> there is no need to do it again in mtk_crtc_ddp_hw_init(). >>> Besides, the DRM devices are created manually when mtk-mmsys >>> is probed and there is no power domain linked to it. >>> >>> Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC >>> MT8173.") >>> >>> Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com> >>> --- >>> drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 18 +++--------------- >>> 1 file changed, 3 insertions(+), 15 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c >>> b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c >>> index bc4cc75cca18..c7edd80be428 100644 >>> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c >>> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c >>> @@ -6,7 +6,6 @@ >>> #include <linux/clk.h> >>> #include <linux/dma-mapping.h> >>> #include <linux/mailbox_controller.h> >>> -#include <linux/pm_runtime.h> >>> #include <linux/soc/mediatek/mtk-cmdq.h> >>> #include <linux/soc/mediatek/mtk-mmsys.h> >>> #include <linux/soc/mediatek/mtk-mutex.h> >>> @@ -362,22 +361,16 @@ static int mtk_crtc_ddp_hw_init(struct >>> mtk_drm_crtc *mtk_crtc, struct drm_atomic >>> drm_connector_list_iter_end(&conn_iter); >>> } >>> >>> - ret = pm_runtime_resume_and_get(crtc->dev->dev); >>> - if (ret < 0) { >>> - DRM_ERROR("Failed to enable power domain: %d\n", ret); >>> - return ret; >>> - } >>> - >> >> Are you really sure that writes to DISP_REG_OVL_xxx and others in >> other modules, >> called by the .layer_config() callback, can be successfully done on >> an unpowered >> and/or unclocked module, on all MediaTek SoCs? >> This looks a bit odd. > > Not sure if I get your point correctly. We removed this PM API because: > > 1. mtk_crtc_ddp_hw_init() is called by mtk_drm_crtc_atomic_enable(), > and the new inline function mtk_ddp_comp_power_on() is called before hw > init, we can make sure the power is on before configuring the hardware. > > 2. The device "crtc->dev->dev" here is assigned by the probe function > of mtk-mmsys, which will be look like "mediatek-drm.auto.13", and this > device is not linked to any power domain. > Thanks for the clarification. In this case: Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> >> >>> ret = mtk_mutex_prepare(mtk_crtc->mutex); >>> if (ret < 0) { >>> DRM_ERROR("Failed to enable mutex clock: %d\n", ret); >>> - goto err_pm_runtime_put; >>> + goto error; >>> } >>> >>> ret = mtk_crtc_ddp_clk_enable(mtk_crtc); >>> if (ret < 0) { >>> DRM_ERROR("Failed to enable component clocks: %d\n", >>> ret); >>> - goto err_mutex_unprepare; >>> + goto error; >>> } >>> >>> for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) { >>> @@ -426,16 +419,13 @@ static int mtk_crtc_ddp_hw_init(struct >>> mtk_drm_crtc *mtk_crtc, struct drm_atomic >>> >> >> ...because you could otherwise just call pm_runtime_put() here, >> instead of removing >> the pm_runtime_resume_and_get() call, which is something I would >> advise to do. >> >> Regards, >> Angelo >> > > Thanks, > Shawn
Hi, Hsiao-chien: On Thu, 2023-10-19 at 13:56 +0800, Hsiao Chien Sung wrote: > Display modules will be powered on when .atomic_enable(), > there is no need to do it again in mtk_crtc_ddp_hw_init(). > Besides, the DRM devices are created manually when mtk-mmsys > is probed and there is no power domain linked to it. > > Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC > MT8173.") > > Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com> > --- > drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 18 +++--------------- > 1 file changed, 3 insertions(+), 15 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > index bc4cc75cca18..c7edd80be428 100644 > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > @@ -6,7 +6,6 @@ > #include <linux/clk.h> > #include <linux/dma-mapping.h> > #include <linux/mailbox_controller.h> > -#include <linux/pm_runtime.h> > #include <linux/soc/mediatek/mtk-cmdq.h> > #include <linux/soc/mediatek/mtk-mmsys.h> > #include <linux/soc/mediatek/mtk-mutex.h> > @@ -362,22 +361,16 @@ static int mtk_crtc_ddp_hw_init(struct > mtk_drm_crtc *mtk_crtc, struct drm_atomic > drm_connector_list_iter_end(&conn_iter); > } > > - ret = pm_runtime_resume_and_get(crtc->dev->dev); crtc->dev->dev is mmsys device. In mt8173.dtsi, you could find that mmsys has its own power. So I think we should keep this. Regards, CK > - if (ret < 0) { > - DRM_ERROR("Failed to enable power domain: %d\n", ret); > - return ret; > - } > - > ret = mtk_mutex_prepare(mtk_crtc->mutex); > if (ret < 0) { > DRM_ERROR("Failed to enable mutex clock: %d\n", ret); > - goto err_pm_runtime_put; > + goto error; > } > > ret = mtk_crtc_ddp_clk_enable(mtk_crtc); > if (ret < 0) { > DRM_ERROR("Failed to enable component clocks: %d\n", > ret); > - goto err_mutex_unprepare; > + goto error; > } > > for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) { > @@ -426,16 +419,13 @@ static int mtk_crtc_ddp_hw_init(struct > mtk_drm_crtc *mtk_crtc, struct drm_atomic > > return 0; > > -err_mutex_unprepare: > +error: > mtk_mutex_unprepare(mtk_crtc->mutex); > -err_pm_runtime_put: > - pm_runtime_put(crtc->dev->dev); > return ret; > } > > static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc *mtk_crtc) > { > - struct drm_device *drm = mtk_crtc->base.dev; > struct drm_crtc *crtc = &mtk_crtc->base; > int i; > > @@ -465,8 +455,6 @@ static void mtk_crtc_ddp_hw_fini(struct > mtk_drm_crtc *mtk_crtc) > mtk_crtc_ddp_clk_disable(mtk_crtc); > mtk_mutex_unprepare(mtk_crtc->mutex); > > - pm_runtime_put(drm->dev); > - > if (crtc->state->event && !crtc->state->active) { > spin_lock_irq(&crtc->dev->event_lock); > drm_crtc_send_vblank_event(crtc, crtc->state->event);
Hi CK, On Tue, 2023-10-24 at 09:25 +0000, CK Hu (胡俊光) wrote: > Hi, Hsiao-chien: > > On Thu, 2023-10-19 at 13:56 +0800, Hsiao Chien Sung wrote: > > Display modules will be powered on when .atomic_enable(), > > there is no need to do it again in mtk_crtc_ddp_hw_init(). > > Besides, the DRM devices are created manually when mtk-mmsys > > is probed and there is no power domain linked to it. > > > > Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC > > MT8173.") > > > > Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com> > > --- > > drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 18 +++--------------- > > 1 file changed, 3 insertions(+), 15 deletions(-) > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > > b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > > index bc4cc75cca18..c7edd80be428 100644 > > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > > @@ -6,7 +6,6 @@ > > #include <linux/clk.h> > > #include <linux/dma-mapping.h> > > #include <linux/mailbox_controller.h> > > -#include <linux/pm_runtime.h> > > #include <linux/soc/mediatek/mtk-cmdq.h> > > #include <linux/soc/mediatek/mtk-mmsys.h> > > #include <linux/soc/mediatek/mtk-mutex.h> > > @@ -362,22 +361,16 @@ static int mtk_crtc_ddp_hw_init(struct > > mtk_drm_crtc *mtk_crtc, struct drm_atomic > > drm_connector_list_iter_end(&conn_iter); > > } > > > > - ret = pm_runtime_resume_and_get(crtc->dev->dev); > > crtc->dev->dev is mmsys device. In mt8173.dtsi, you could find that > mmsys has its own power. So I think we should keep this. > > Regards, > CK Didn't notice this difference in the dts, thank you for checking. Will remove this patch in the next version. Thanks, Shawn
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index bc4cc75cca18..c7edd80be428 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -6,7 +6,6 @@ #include <linux/clk.h> #include <linux/dma-mapping.h> #include <linux/mailbox_controller.h> -#include <linux/pm_runtime.h> #include <linux/soc/mediatek/mtk-cmdq.h> #include <linux/soc/mediatek/mtk-mmsys.h> #include <linux/soc/mediatek/mtk-mutex.h> @@ -362,22 +361,16 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc, struct drm_atomic drm_connector_list_iter_end(&conn_iter); } - ret = pm_runtime_resume_and_get(crtc->dev->dev); - if (ret < 0) { - DRM_ERROR("Failed to enable power domain: %d\n", ret); - return ret; - } - ret = mtk_mutex_prepare(mtk_crtc->mutex); if (ret < 0) { DRM_ERROR("Failed to enable mutex clock: %d\n", ret); - goto err_pm_runtime_put; + goto error; } ret = mtk_crtc_ddp_clk_enable(mtk_crtc); if (ret < 0) { DRM_ERROR("Failed to enable component clocks: %d\n", ret); - goto err_mutex_unprepare; + goto error; } for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) { @@ -426,16 +419,13 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc, struct drm_atomic return 0; -err_mutex_unprepare: +error: mtk_mutex_unprepare(mtk_crtc->mutex); -err_pm_runtime_put: - pm_runtime_put(crtc->dev->dev); return ret; } static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc *mtk_crtc) { - struct drm_device *drm = mtk_crtc->base.dev; struct drm_crtc *crtc = &mtk_crtc->base; int i; @@ -465,8 +455,6 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc *mtk_crtc) mtk_crtc_ddp_clk_disable(mtk_crtc); mtk_mutex_unprepare(mtk_crtc->mutex); - pm_runtime_put(drm->dev); - if (crtc->state->event && !crtc->state->active) { spin_lock_irq(&crtc->dev->event_lock); drm_crtc_send_vblank_event(crtc, crtc->state->event);