From patchwork Thu Dec 14 05:58:39 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: 178471 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8342824dys; Wed, 13 Dec 2023 22:01:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3Qt3mDzvhkvQ1vfUixYdyRYgGVj33Td+ZchhBvtylRsClNyjENrlHQp3SN+47t972O8iS X-Received: by 2002:a9d:7b55:0:b0:6d9:d399:740b with SMTP id f21-20020a9d7b55000000b006d9d399740bmr10037035oto.16.1702533681854; Wed, 13 Dec 2023 22:01:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702533681; cv=none; d=google.com; s=arc-20160816; b=vzmvyJC7yEFBZ2CPf5mo9j6lAKSMjD2EssfpUaXJIElf1Aicge7auzF2/DPqmEbU0g y8+iPacOEReNYwz8SA7uAObSuYD2mtrDuqWy4UN6BW3HYir4o7Cg8I8DnUsCAJoopiD5 16IeO2dPOQLV6sY/jiLh3hn/Lzq/TCb6rOBxG/AyPrA4Sxv6c0ydolSCOYRsjmi4GrEO 1pOX7GHPCev3c6Y11AkhBGK9wU7ppHC3+DNuQMLFm/XPqF0HVZOCjHwxzG5fSSdE9Jqq MJrMfLvnnbCiv8BiJtbZHV7M9m/4Nkh0H/dIbvOoqTxqzg7llQaMvb5urw1cI365Ihog KJ8A== 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=aW/XsAA8hGCSog7BqSGudf9VoMOqK1HzMz+l6/m7oNo=; fh=gPle4XY6mkbeQh/I972n0JxGSTe7nm5XtQ1KEj99KWA=; b=M9PDAY5zHcaDeqx+HqHyDsHt69O276sqdu6RqtgY/fBdbJCjCqqhJa2ltp784KU7Ti gIhf5+5rrs62AvcOe/wrF+nh67GkRY0bDgxtermzcBzkx2LICzPZoV0LVawRF7KfBX2R x9bkisr2pldQHdGcL8YlDJ1TojU505vOpaMWjHjoJvOIU4zwVDc1Yc5pHRB7mqzhe4ks E/vwbQ7QmpMRQgnxBPJSvdKejz6hwPZtVknwxzk7VgwvWyXwQRVJ3cJP1LRiZzFQUisx PPVqNDPHjPNcWG6O8+L5uKk7agK0alFv+H2MEZYBYkM+UUCr46hbjw4XruoY0ZfAZBOT CUOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=nlQ7zJL8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b20-20020a6567d4000000b005c685a2d34esi10717218pgs.321.2023.12.13.22.01.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 22:01:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=nlQ7zJL8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 973A9802A6E2; Wed, 13 Dec 2023 22:01:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443306AbjLNGA7 (ORCPT + 99 others); Thu, 14 Dec 2023 01:00:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235525AbjLNF7s (ORCPT ); Thu, 14 Dec 2023 00:59:48 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B6D21BEA; Wed, 13 Dec 2023 21:59:00 -0800 (PST) X-UUID: dbacb9709a4511eeba30773df0976c77-20231214 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=aW/XsAA8hGCSog7BqSGudf9VoMOqK1HzMz+l6/m7oNo=; b=nlQ7zJL8wj9ExI+iDWe0o+9iB8oiY6IK3ROadp2BrBNAhTw33CVn+Qv7E1+dmolKaUwDnnJiABLQki+97opgTdB1cRCI2DvNJOchuCOncYdeuTAxGOZngyzMtGYFzF+MvYEVsDT2jNxMsAEXxsbK/yRQfF/wBmOHWCvU8/2YuMo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:9f0bebda-7cef-4e25-b369-1c8f493cbfd2,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:5d391d7,CLOUDID:c4fc2e61-c89d-4129-91cb-8ebfae4653fc,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: dbacb9709a4511eeba30773df0976c77-20231214 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1054811641; Thu, 14 Dec 2023 13:58:52 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by MTKMBS14N1.mediatek.inc (172.21.101.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 14 Dec 2023 13:58:50 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 14 Dec 2023 13:58:50 +0800 From: Hsiao Chien Sung To: AngeloGioacchino Del Regno , "CK Hu" CC: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chun-Kuang Hu , Philipp Zabel , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Matthias Brugger , Moudy Ho , Hsiao Chien Sung , Nathan Lu , "Nancy . Lin" , "Roy-CW . Yeh" , "Jason-JH . Lin" , xinlei lee , , , , , Subject: [PATCH v12 15/23] drm/mediatek: Start/Stop components with function pointers Date: Thu, 14 Dec 2023 13:58:39 +0800 Message-ID: <20231214055847.4936-16-shawn.sung@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231214055847.4936-1-shawn.sung@mediatek.com> References: <20231214055847.4936-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--1.542100-8.000000 X-TMASE-MatchedRID: aEd/qsqbLK4b7D0aLEL5Ob2xWbKjBfWPkos2tunL8DT/evmlVf9xZkN+ V6ZFLcNdXQfL6gqs5OQd5e75RGwObaK176S49UNHkDpLRKO9xhSZ2scyRQcer19eTSR8I6dudjd NwycGaR/v5TZdm2T2Kr1Odlcux5HWHxPMjOKY7A8LbigRnpKlKZvjAepGmdoOsRunbcic21kj5J 4TaJJuPa2i+dnS6f5T20mnMsmkbaLJzkAlfa4X5MFCRr0IKekVKIYKIq6+TbixUcgMLkVKCwwI0 +X/rE7HSZrfNhP3sgUBh9AgBSEFrJm+YJspVvj2xkvrHlT8euJ0YHKn7N1oOA== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.542100-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 39A1D386ECE4448F1E4203CDECE5BBB47864444C603CE240FAD4FB491F2338602000:8 X-MTK: N X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RDNS_NONE,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 22:01:20 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785235957906960897 X-GMAIL-MSGID: 1785235957906960897 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 Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Hsiao Chien Sung --- .../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 e00d8a395ca0..65c5153bdcd8 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 = { @@ -191,16 +193,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]); + } } /**