From patchwork Mon Oct 16 10:40:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?U2hhd24gU3VuZyAo5a6L5a2d6KyZKQ==?= X-Patchwork-Id: 153303 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3366972vqb; Mon, 16 Oct 2023 03:41:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEeRNiIO0hPTVBdVdRUl19ZFoKibtisNAAs5WqyTWw6i0NKEfjbU/mx4uh1BYNTfG7kM9Wa X-Received: by 2002:a05:6a21:a5a0:b0:15d:a247:d20c with SMTP id gd32-20020a056a21a5a000b0015da247d20cmr44577543pzc.6.1697452874430; Mon, 16 Oct 2023 03:41:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697452874; cv=none; d=google.com; s=arc-20160816; b=rYb+/YSwnMBK5yxlQDIwqeLGPB/owKj9FNUjC0QtEjbKysWkzZhYiJdw2AOPdl9bLF Fr1LlSpRbmKsfJPPjnMV5cObmkbfjsrDprP7i+9gBThWHZGIv2Q2as9Pz5Ih4dp51pLJ tqfOQ4UI3b1TD78kxjWZyHxSr3N0oNET4Z+CwkITm2SxoeiaxqvcWwYhGsmhGxBy/Lo6 HgQHaas5bh5S7lJm129OtXI3qbUEnMthSSvxp6wHB09ZnyJl1Fi73csUfIQsfkTUezsf 1oOZSWvoZeYeZ/zof2hlmYiwm+7kZ4TbwKop+i2tlmMpiDx2c8P/DKO+dzkgPksaP5n1 gbIw== 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=J73lCwAGxTCTY3jaQt5VIAph0X2ymgcWkmopAQGmoZQ=; fh=73Phm+PvMjlnW3qFw9TmTi5k31/kOAM4jmvPkuXQFpg=; b=ZbooVx6BIj5vqMIpcy87VJOC/BCk54dv/t1QSTlKJnwgoL7qducWcdEesuZ9hxASzM nrN+l9OJHCiD6x6rA9WWhJeCPRVYFLzeouu9aOZUJhbIcA+6+fEbGqfdzoV4NCKk3g/X jHqQJ7xCc1xrxZRYlfJrN4oU8Y4rgrA0oYDlLAbKS7FlnEvRb6rHeThY8zRtIX5I7/AD h3CVE3KGtydGAm74K73H2mAc1+65+vxQL1sBCA5OIaHO9R93KbaIlOiWBNCiMJQU2A5d 7JbTzswEdcBy/Mqqksi1Ak0u2FJtpoc1xVfn6EcEkt3hGaw8YXA+qXFShz4NBeZWjycz 8SOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=YK1MCGP0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id v10-20020a63610a000000b005b64e8336dfsi2859286pgb.604.2023.10.16.03.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 03:41:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=YK1MCGP0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 41634806E5FE; Mon, 16 Oct 2023 03:40:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232778AbjJPKk3 (ORCPT + 18 others); Mon, 16 Oct 2023 06:40:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230017AbjJPKkZ (ORCPT ); Mon, 16 Oct 2023 06:40:25 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5861B83; Mon, 16 Oct 2023 03:40:20 -0700 (PDT) X-UUID: 65289d5e6c1011eea33bb35ae8d461a2-20231016 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=J73lCwAGxTCTY3jaQt5VIAph0X2ymgcWkmopAQGmoZQ=; b=YK1MCGP05wyViZrKQHbR0nrWzGOL8Wvuiwb5wMlTt6ZoyaXoYQwe4HfW77Jao0hdub+28b0QZWlvJRPQfkLsyyjDahO9AuGpXWpaLFrn/LJw/OJq+OlDiBh96A0qrLyvfK34Irv/SMjRNC+xUTWPih9TEUg5lVZC5MVbMaiKlRk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32,REQID:ad24aefa-bc56-4824-add5-65e52f05b2ba,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:17da1615-4929-4845-9571-38c601e9c3c9,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: 65289d5e6c1011eea33bb35ae8d461a2-20231016 Received: from mtkmbs14n1.mediatek.inc [(172.21.101.75)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 404123651; Mon, 16 Oct 2023 18:40:16 +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; Mon, 16 Oct 2023 18:40:15 +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; Mon, 16 Oct 2023 18:40:15 +0800 From: Hsiao Chien Sung To: AngeloGioacchino Del Regno , "CK Hu" , Krzysztof Kozlowski , Matthias Brugger , Rob Herring CC: Chun-Kuang Hu , Philipp Zabel , David Airlie , Daniel Vetter , Fei Shao , Sean Paul , Johnson Wang , "Nancy . Lin" , Moudy Ho , "Jason-JH . Lin" , Nathan Lu , "Hsiao Chien Sung" , Yongqiang Niu , Hans Verkuil , Mauro Carvalho Chehab , , , , , Subject: [PATCH v8 16/23] drm/mediatek: Start/Stop components with function pointers Date: Mon, 16 Oct 2023 18:40:03 +0800 Message-ID: <20231016104010.3270-17-shawn.sung@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231016104010.3270-1-shawn.sung@mediatek.com> References: <20231016104010.3270-1-shawn.sung@mediatek.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--2.055400-8.000000 X-TMASE-MatchedRID: pgavo5B1z8Ab7D0aLEL5Ob2xWbKjBfWPkos2tunL8DQx3z93vsEFGlaP 6AhhdqyDkPk8oBU71SyX+lB2vkxVIen2wHlv5vGuh2VzUlo4HVN51GakW92m5mXczQlokCRZk66 /gtVjZsU/bV+L+3R3poAy6p60ZV62fJ5/bZ6npdiujVRFkkVsmxxi/+fqmSQWNia6+nAE/Nn2ds pT3gSgm5S5uQhxie42JcIl/BdB9kETxc8ImfDAwpcL/p4EeUtR69RxatSZdAIYDR45NApPNI6H7 DI0GsVcMmI24qiENwrMpIbcl3IoA+q1XYAYw09q9Z1yWryVTWo= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.055400-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 514C887DF670E2E570D7584C40C2885EA556CB57D33444CC2B96B7E33A88BB302000: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 howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 16 Oct 2023 03:40:42 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779908345553770770 X-GMAIL-MSGID: 1779908345553770770 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 Signed-off-by: Hsiao Chien Sung Reviewed-by: AngeloGioacchino Del Regno --- .../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 fffef2a4f919..354ba6186166 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c @@ -71,6 +71,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 = { @@ -188,16 +190,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)