Message ID | 20231006073831.10402-17-shawn.sung@mediatek.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp149564vqo; Fri, 6 Oct 2023 00:40:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH3fZY56wxkEn2jYvalWULOVDpfaZoFe6kewCLAvr3KLX7BSfX0qI1o0gchUrQLgbR6s/tJ X-Received: by 2002:a05:6a20:96c7:b0:15d:2bff:77b with SMTP id hq7-20020a056a2096c700b0015d2bff077bmr6279354pzc.34.1696578041470; Fri, 06 Oct 2023 00:40:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696578041; cv=none; d=google.com; s=arc-20160816; b=puTQp6bleB+tXzOJ9dUguORXCTJiO7BByFdlTfh/Q/LcX+xXokSQn0ebf+m4AL8TEM A4AmM9QBcND6EGOVxE1BdOwbsATk4q63VhU5zE74jnR6UMpOYynl2xCHwSKMvdLmzOXs J2SeaoIhVal8sbNt3Wv9CYYpGpiJKB68uWANKXOf0bY8ETLA0fUSoHxF0TRs+EgnlERX NkIVMq9AXAge9rJYW25ZHsmaa0bwqBi/xYqNg3T3DaOlTHqZwFjp5CxgWuHt/vhOLGNL 7Tg0crrTfZ/o06EbQ0rfDQ9b+CYP3rCQrxtt8Ql44q6FIqinUvPLLp5TotWOGSOjHNRi uDEQ== 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=csULzFllOM4TetJVur8dMwONuhpyRUT3dkDgVktGYR0=; fh=kY3/KDC2qEzU7tuRfKV0Ke/m2LpBFtrYwW4wOL/Oepc=; b=EOlA2YqsK5GwtfCviBlUKYjRda+dOIN+WTc+saL4UQzdc18JdpGPoM3P4YW8zb1yOr gZiB+M6nerAl83kuScTaT24r8aArVLn4RY1CX3x4hlfmvw5K0uZK1HEIvZJUON/nHz4D voXQgTCFPOrBaVxSmELIGRRMPi3zcwsM6XBo2K57jcoO1dPUT52U91eqI5r1aug7Dad/ U6aPL8golBtFwZVbJaL9mepy0vCs3nNxagwsHPhyniU+horW6o3ga61w2RCojz/8pCjE 4259wAls4pMNbNrCuQGj2cvzehkkR+Pvx4ECDcO3octU7mGc16zt9jP4unomeEkS3WRN umrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="L/pKKU+N"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id k63-20020a638442000000b005702c84e4c2si3143544pgd.508.2023.10.06.00.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 00:40:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="L/pKKU+N"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id D783B801CCE9; Fri, 6 Oct 2023 00:40:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231223AbjJFHjv (ORCPT <rfc822;ezelljr.billy@gmail.com> + 18 others); Fri, 6 Oct 2023 03:39:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230428AbjJFHi6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 6 Oct 2023 03:38:58 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF76CE9; Fri, 6 Oct 2023 00:38:46 -0700 (PDT) X-UUID: 5eb92b2a641b11ee8051498923ad61e6-20231006 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=csULzFllOM4TetJVur8dMwONuhpyRUT3dkDgVktGYR0=; b=L/pKKU+NqCX6kIJeVS0M2bdZNaRvS/brEOLlOFttX7UvgkO5Occhw/yTGLxiCIOAUsFC70OdwcBHBlMHv3jBIf8zHRBAsSsAmi1NDgiHfDHMTN8M9zpUlQVNLnmix21S1kqQNDZ8zE+jxDvwLUJHWMYnrWS2m1UrWwNV6rw4dh4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32,REQID:7d8fe89c-ead2-49d3-9a86-351b8b89394f,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:d2adc014-4929-4845-9571-38c601e9c3c9,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,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 X-UUID: 5eb92b2a641b11ee8051498923ad61e6-20231006 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw02.mediatek.com (envelope-from <shawn.sung@mediatek.com>) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1235336626; Fri, 06 Oct 2023 15:38:41 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 6 Oct 2023 15:38:39 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 6 Oct 2023 15:38:39 +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: Conor Dooley <conor+dt@kernel.org>, Philipp Zabel <p.zabel@pengutronix.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Chun-Kuang Hu <chunkuang.hu@kernel.org>, "Mauro Carvalho Chehab" <mchehab@kernel.org>, <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>, Singo Chang <singo.chang@mediatek.com>, "Nancy . Lin" <nancy.lin@mediatek.com>, "Jason-JH . Lin" <jason-jh.lin@mediatek.com>, "Hsiao Chien Sung" <shawn.sung@mediatek.com> Subject: [PATCH v7 16/23] drm/mediatek: Start/Stop components with function pointers Date: Fri, 6 Oct 2023 15:38:24 +0800 Message-ID: <20231006073831.10402-17-shawn.sung@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231006073831.10402-1-shawn.sung@mediatek.com> References: <20231006073831.10402-1-shawn.sung@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--2.509900-8.000000 X-TMASE-MatchedRID: Fx2QhdRtN3gb7D0aLEL5Ob2xWbKjBfWPeL05i8GXPoAIgSDinsA6bPDR cRAxsuj7tVKtZME67h5q7k1NHAqvKwTsy5Ctk/ajDko+EYiDQxG5+1figft3LiS30GKAkBxWWP6 BnnaU6Kji8zVgXoAltsIJ+4gwXrEtWBd6ltyXuvvKw7XAQdv9BdKzeQAXIybU6E0yODFYJFy4bZ xtB062qtgeYH8o1G69vf6/7twa2RV8jBBK0biDbsGfImu98AUW6afx0vH21weAhOcaQrQ0U1GyR coeF18qmKP0zzpTAeGwod8xOMKmvMCBO+zxAW5pftwZ3X11IV0= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.509900-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: DC877514C351E19A7940FACFA601F280EF15F2FA89800BFEC41F9C543200F95E2000:8 X-MTK: N X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Fri, 06 Oct 2023 00:40:37 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778991016436499520 X-GMAIL-MSGID: 1778991016436499520 |
Series |
Add display driver for MT8188 VDOSYS1
|
|
Commit Message
Shawn Sung (宋孝謙)
Oct. 6, 2023, 7:38 a.m. UTC
By registering component related functions to the pointers,
we can easily manage them within a for-loop and simplify the
logic of component start/stop process.
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
.../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 20 +++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
Comments
Hi, Hsiao-chien: On Fri, 2023-10-06 at 15:38 +0800, Hsiao Chien Sung wrote: > By registering component related functions to the pointers, > we can easily manage them within a for-loop and simplify the > logic of component start/stop process. Reviewed-by: CK Hu <ck.hu@mediatek.com> > > Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com> > --- > .../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 20 > +++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c > b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c > index 84133303a6ec..812a1df9732f 100644 > --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c > +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c > @@ -72,6 +72,8 @@ static const char * const > private_comp_stem[OVL_ADAPTOR_TYPE_NUM] = { > static const struct mtk_ddp_comp_funcs _ethdr = { > .clk_enable = mtk_ethdr_clk_enable, > .clk_disable = mtk_ethdr_clk_disable, > + .start = mtk_ethdr_start, > + .stop = mtk_ethdr_stop, > }; > > static const struct mtk_ddp_comp_funcs _merge = { > @@ -189,16 +191,30 @@ void mtk_ovl_adaptor_config(struct device *dev, > unsigned int w, > > void mtk_ovl_adaptor_start(struct device *dev) > { > + int i; > struct mtk_disp_ovl_adaptor *ovl_adaptor = > dev_get_drvdata(dev); > > - mtk_ethdr_start(ovl_adaptor- > >ovl_adaptor_comp[OVL_ADAPTOR_ETHDR0]); > + for (i = 0; i < OVL_ADAPTOR_ID_MAX; i++) { > + if (!ovl_adaptor->ovl_adaptor_comp[i] || > + !comp_matches[i].funcs->start) > + continue; > + > + comp_matches[i].funcs->start(ovl_adaptor- > >ovl_adaptor_comp[i]); > + } > } > > void mtk_ovl_adaptor_stop(struct device *dev) > { > + int i; > struct mtk_disp_ovl_adaptor *ovl_adaptor = > dev_get_drvdata(dev); > > - mtk_ethdr_stop(ovl_adaptor- > >ovl_adaptor_comp[OVL_ADAPTOR_ETHDR0]); > + for (i = 0; i < OVL_ADAPTOR_ID_MAX; i++) { > + if (!ovl_adaptor->ovl_adaptor_comp[i] || > + !comp_matches[i].funcs->stop) > + continue; > + > + comp_matches[i].funcs->stop(ovl_adaptor- > >ovl_adaptor_comp[i]); > + } > } > > int mtk_ovl_adaptor_clk_enable(struct device *dev)
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c index 84133303a6ec..812a1df9732f 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c @@ -72,6 +72,8 @@ static const char * const private_comp_stem[OVL_ADAPTOR_TYPE_NUM] = { static const struct mtk_ddp_comp_funcs _ethdr = { .clk_enable = mtk_ethdr_clk_enable, .clk_disable = mtk_ethdr_clk_disable, + .start = mtk_ethdr_start, + .stop = mtk_ethdr_stop, }; static const struct mtk_ddp_comp_funcs _merge = { @@ -189,16 +191,30 @@ void mtk_ovl_adaptor_config(struct device *dev, unsigned int w, void mtk_ovl_adaptor_start(struct device *dev) { + int i; struct mtk_disp_ovl_adaptor *ovl_adaptor = dev_get_drvdata(dev); - mtk_ethdr_start(ovl_adaptor->ovl_adaptor_comp[OVL_ADAPTOR_ETHDR0]); + for (i = 0; i < OVL_ADAPTOR_ID_MAX; i++) { + if (!ovl_adaptor->ovl_adaptor_comp[i] || + !comp_matches[i].funcs->start) + continue; + + comp_matches[i].funcs->start(ovl_adaptor->ovl_adaptor_comp[i]); + } } void mtk_ovl_adaptor_stop(struct device *dev) { + int i; struct mtk_disp_ovl_adaptor *ovl_adaptor = dev_get_drvdata(dev); - mtk_ethdr_stop(ovl_adaptor->ovl_adaptor_comp[OVL_ADAPTOR_ETHDR0]); + for (i = 0; i < OVL_ADAPTOR_ID_MAX; i++) { + if (!ovl_adaptor->ovl_adaptor_comp[i] || + !comp_matches[i].funcs->stop) + continue; + + comp_matches[i].funcs->stop(ovl_adaptor->ovl_adaptor_comp[i]); + } } int mtk_ovl_adaptor_clk_enable(struct device *dev)