From nobody Thu Nov 14 06:53:49 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE37AC61DA4 for ; Thu, 16 Feb 2023 13:00:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229793AbjBPNAe (ORCPT ); Thu, 16 Feb 2023 08:00:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229636AbjBPNA3 (ORCPT ); Thu, 16 Feb 2023 08:00:29 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B30F43D093 for ; Thu, 16 Feb 2023 05:00:28 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 0F9C466021A7; Thu, 16 Feb 2023 13:00:27 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1676552427; bh=aV8H9evkGIGxgmY7AlHOpoZNvivT9tsnpJVfzGVs75w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bdPuBjf4bPrNG7JbHkJR4OiT3AqdweyqmhRhYHQ7lQiOEsWfOmWcD9duf+J3dwrqQ MifxDGSWB3HSp4XMwNSJjDwuocPYq/KNhK1Lxf5aWChmOSiUjm4TYNe02lo0fxdFN0 6XzukJfWHcHBrJIPtR82ecAMuz4fAcolfWLff3Pt2qUCTIGt3Ff1I3nRaIdBmtz+OH in37bheZb2yMsiPh/wMqjDxWhh3YnHlm2gqEwewthh2Jx3ESC1xLMzgZEk2PrFDpvK XqBKPp8LT9iFcr6YMmTEbjJ2O5zbU/9Ak8up0tGT31ZkBza/T9peOyaf6UPTruhrBZ oaYZbUzM2E2HQ== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno Subject: [PATCH v1 1/9] soc: mediatek: mtk-mmsys: Add .remove() callback Date: Thu, 16 Feb 2023 14:00:13 +0100 Message-Id: <20230216130021.64875-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> References: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add a .remove() callback to correctly unregister the multimedia clocks and DRM drivers. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mmsys.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mm= sys.c index eb4c7e57896c..af22f3490034 100644 --- a/drivers/soc/mediatek/mtk-mmsys.c +++ b/drivers/soc/mediatek/mtk-mmsys.c @@ -121,6 +121,8 @@ static const struct mtk_mmsys_driver_data mt8365_mmsys_= driver_data =3D { struct mtk_mmsys { void __iomem *regs; const struct mtk_mmsys_driver_data *data; + struct platform_device *clks_pdev; + struct platform_device *drm_pdev; spinlock_t lock; /* protects mmsys_sw_rst_b reg */ struct reset_controller_dev rcdev; struct cmdq_client_reg cmdq_base; @@ -342,6 +344,7 @@ static int mtk_mmsys_probe(struct platform_device *pdev) PLATFORM_DEVID_AUTO, NULL, 0); if (IS_ERR(clks)) return PTR_ERR(clks); + mmsys->clks_pdev =3D clks; =20 if (mmsys->data->is_vppsys) goto out_probe_done; @@ -352,11 +355,22 @@ static int mtk_mmsys_probe(struct platform_device *pd= ev) platform_device_unregister(clks); return PTR_ERR(drm); } + mmsys->drm_pdev =3D drm; =20 out_probe_done: return 0; } =20 +static int mtk_mmsys_remove(struct platform_device *pdev) +{ + struct mtk_mmsys *mmsys =3D platform_get_drvdata(pdev); + + platform_device_unregister(mmsys->drm_pdev); + platform_device_unregister(mmsys->clks_pdev); + + return 0; +} + static const struct of_device_id of_match_mtk_mmsys[] =3D { { .compatible =3D "mediatek,mt2701-mmsys", @@ -431,6 +445,7 @@ static struct platform_driver mtk_mmsys_drv =3D { .of_match_table =3D of_match_mtk_mmsys, }, .probe =3D mtk_mmsys_probe, + .remove =3D mtk_mmsys_remove, }; =20 static int __init mtk_mmsys_init(void) --=20 2.39.1 From nobody Thu Nov 14 06:53:49 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6681C61DA4 for ; Thu, 16 Feb 2023 13:00:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229795AbjBPNAh (ORCPT ); Thu, 16 Feb 2023 08:00:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbjBPNAa (ORCPT ); Thu, 16 Feb 2023 08:00:30 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C3443D098 for ; Thu, 16 Feb 2023 05:00:29 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id AF7F166021A8; Thu, 16 Feb 2023 13:00:27 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1676552428; bh=akKsNWR5T+Lv1H5lxALji7s6hzqhOq0hzyQywZA1KxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cWy8JSqxDFC+vrCbBbLvJLBzpjUhLpwI000YFJ/nt88WfbpXed9qQQUGTfxOVquhK 4bvLeXlyB6AUiZJcFJ9s4NyVDeqRa0H1hijpHGnYvqnu8LezJSNiTlpex96224zqI+ MNdn9ak+BA/oBubolhXyc7MJlavl30TkstyMRYj4MNxl1yNUnyjBL8lwm3BAHn21gr HGIrbvlit/obWtnnzQ8kpmXH6FL0SAOjRxFDqc8/QBWVVxlUqaDUjpwy7RmOFMnAWZ lM5FbNih59+3d6iY/ZGVjD7fu0NSFybpgviQeTSdfhclSIV8L8IYIb/ikDf82/eF5d xextHCvrDFBSg== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno Subject: [PATCH v1 2/9] soc: mediatek: mtk-mmsys: Use module_platform_driver() macro Date: Thu, 16 Feb 2023 14:00:14 +0100 Message-Id: <20230216130021.64875-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> References: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Instead of open-coding init/exit calls, switch to using the module_platform_driver() macro instead, doing the exact same. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mmsys.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mm= sys.c index af22f3490034..1a574de9484d 100644 --- a/drivers/soc/mediatek/mtk-mmsys.c +++ b/drivers/soc/mediatek/mtk-mmsys.c @@ -447,19 +447,7 @@ static struct platform_driver mtk_mmsys_drv =3D { .probe =3D mtk_mmsys_probe, .remove =3D mtk_mmsys_remove, }; - -static int __init mtk_mmsys_init(void) -{ - return platform_driver_register(&mtk_mmsys_drv); -} - -static void __exit mtk_mmsys_exit(void) -{ - platform_driver_unregister(&mtk_mmsys_drv); -} - -module_init(mtk_mmsys_init); -module_exit(mtk_mmsys_exit); +module_platform_driver(mtk_mmsys_drv); =20 MODULE_AUTHOR("Yongqiang Niu "); MODULE_DESCRIPTION("MediaTek SoC MMSYS driver"); --=20 2.39.1 From nobody Thu Nov 14 06:53:49 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAB74C636D6 for ; Thu, 16 Feb 2023 13:00:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbjBPNAj (ORCPT ); Thu, 16 Feb 2023 08:00:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbjBPNAa (ORCPT ); Thu, 16 Feb 2023 08:00:30 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F03BA3D089 for ; Thu, 16 Feb 2023 05:00:29 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 553F066021A9; Thu, 16 Feb 2023 13:00:28 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1676552428; bh=97TMHbRWrVSAg8/uwxUMdlr+BulgmbHEjf+Gm3YMplU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CYfA3TLdoKnJtcckFUg3uj0biU48euCWvOZxYndWaQVrKErudu2jTPOVjVl5Ps5dn X/xihR7FuTamwvikiQQZH090CJZD/eqTWLQl767o1dIXn915uvvuq8o0ZROgdNyN6m /Cqq9o9xxy+r5bkwhkxbPIEfbgdVA6ChXEOSqdqV1jnxedUbzzgjkvhr7iCbs4LVm4 lenX0xMYHWgO3EEEbzwm5DeqPnfK2Yjt+cNaRLMpydNCtiKdBrouLsPn2Pp1iniaZI KAxhvmnySxMzGHUmSsTbvTA5o5Kwzy+wx2RFalCGB/yDhb2mbNbjqiRcU1lhTUcgGi orgcX2rretFww== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno Subject: [PATCH v1 3/9] soc: mediatek: mtk-mmsys: Compress of_device_id array entries Date: Thu, 16 Feb 2023 14:00:15 +0100 Message-Id: <20230216130021.64875-4-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> References: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Compress entries of the of_match_mtk_mmsys array to reduce the amount of lines and increase readability; this brings us to a maximum of 90 columns. While at it, also add a sentinel comment to the last entry for the sole purpose of consistency. This commit brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mmsys.c | 83 +++++++------------------------- 1 file changed, 18 insertions(+), 65 deletions(-) diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mm= sys.c index 1a574de9484d..fcf702fda92e 100644 --- a/drivers/soc/mediatek/mtk-mmsys.c +++ b/drivers/soc/mediatek/mtk-mmsys.c @@ -372,71 +372,24 @@ static int mtk_mmsys_remove(struct platform_device *p= dev) } =20 static const struct of_device_id of_match_mtk_mmsys[] =3D { - { - .compatible =3D "mediatek,mt2701-mmsys", - .data =3D &mt2701_mmsys_driver_data, - }, - { - .compatible =3D "mediatek,mt2712-mmsys", - .data =3D &mt2712_mmsys_driver_data, - }, - { - .compatible =3D "mediatek,mt6779-mmsys", - .data =3D &mt6779_mmsys_driver_data, - }, - { - .compatible =3D "mediatek,mt6797-mmsys", - .data =3D &mt6797_mmsys_driver_data, - }, - { - .compatible =3D "mediatek,mt8167-mmsys", - .data =3D &mt8167_mmsys_driver_data, - }, - { - .compatible =3D "mediatek,mt8173-mmsys", - .data =3D &mt8173_mmsys_driver_data, - }, - { - .compatible =3D "mediatek,mt8183-mmsys", - .data =3D &mt8183_mmsys_driver_data, - }, - { - .compatible =3D "mediatek,mt8186-mmsys", - .data =3D &mt8186_mmsys_driver_data, - }, - { - .compatible =3D "mediatek,mt8188-vdosys0", - .data =3D &mt8188_vdosys0_driver_data, - }, - { - .compatible =3D "mediatek,mt8192-mmsys", - .data =3D &mt8192_mmsys_driver_data, - }, - { /* deprecated compatible */ - .compatible =3D "mediatek,mt8195-mmsys", - .data =3D &mt8195_vdosys0_driver_data, - }, - { - .compatible =3D "mediatek,mt8195-vdosys0", - .data =3D &mt8195_vdosys0_driver_data, - }, - { - .compatible =3D "mediatek,mt8195-vdosys1", - .data =3D &mt8195_vdosys1_driver_data, - }, - { - .compatible =3D "mediatek,mt8195-vppsys0", - .data =3D &mt8195_vppsys0_driver_data, - }, - { - .compatible =3D "mediatek,mt8195-vppsys1", - .data =3D &mt8195_vppsys1_driver_data, - }, - { - .compatible =3D "mediatek,mt8365-mmsys", - .data =3D &mt8365_mmsys_driver_data, - }, - { } + { .compatible =3D "mediatek,mt2701-mmsys", .data =3D &mt2701_mmsys_driver= _data }, + { .compatible =3D "mediatek,mt2712-mmsys", .data =3D &mt2712_mmsys_driver= _data }, + { .compatible =3D "mediatek,mt6779-mmsys", .data =3D &mt6779_mmsys_driver= _data }, + { .compatible =3D "mediatek,mt6797-mmsys", .data =3D &mt6797_mmsys_driver= _data }, + { .compatible =3D "mediatek,mt8167-mmsys", .data =3D &mt8167_mmsys_driver= _data }, + { .compatible =3D "mediatek,mt8173-mmsys", .data =3D &mt8173_mmsys_driver= _data }, + { .compatible =3D "mediatek,mt8183-mmsys", .data =3D &mt8183_mmsys_driver= _data }, + { .compatible =3D "mediatek,mt8186-mmsys", .data =3D &mt8186_mmsys_driver= _data }, + { .compatible =3D "mediatek,mt8188-vdosys0", .data =3D &mt8188_vdosys0_dr= iver_data }, + { .compatible =3D "mediatek,mt8192-mmsys", .data =3D &mt8192_mmsys_driver= _data }, + /* "mediatek,mt8195-mmsys" compatible is deprecated */ + { .compatible =3D "mediatek,mt8195-mmsys", .data =3D &mt8195_vdosys0_driv= er_data }, + { .compatible =3D "mediatek,mt8195-vdosys0", .data =3D &mt8195_vdosys0_dr= iver_data }, + { .compatible =3D "mediatek,mt8195-vdosys1", .data =3D &mt8195_vdosys1_dr= iver_data }, + { .compatible =3D "mediatek,mt8195-vppsys0", .data =3D &mt8195_vppsys0_dr= iver_data }, + { .compatible =3D "mediatek,mt8195-vppsys1", .data =3D &mt8195_vppsys1_dr= iver_data }, + { .compatible =3D "mediatek,mt8365-mmsys", .data =3D &mt8365_mmsys_driver= _data }, + { /* sentinel */ } }; =20 static struct platform_driver mtk_mmsys_drv =3D { --=20 2.39.1 From nobody Thu Nov 14 06:53:49 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A28D3C61DA4 for ; Thu, 16 Feb 2023 13:00:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229962AbjBPNAm (ORCPT ); Thu, 16 Feb 2023 08:00:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbjBPNAb (ORCPT ); Thu, 16 Feb 2023 08:00:31 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B86483D093 for ; Thu, 16 Feb 2023 05:00:30 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id F37D566021AA; Thu, 16 Feb 2023 13:00:28 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1676552429; bh=8zBu4kGYwwp9PXGSRlrzgSAywExWb3oFBHKR72jcTw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xr36F/PtZtNxk+3TKAnY6WohFo7esdaFOj+uKoSq4m0fm9cN2bEIWFzNyhL1qpRhB FEEYxUt/sY0ExU9aaXsBhoHuPIkx7mJxRbg+gzTi8S9l56dboeYCOtbOq8ZnFK99l3 KSR1R0CVczWzT6tEttlSPgxt+qUjbFkS9FEIhmkt0tCIA7DFwJY0Q8gAqGYr+Uuuts gLwWiYgjHcMB0srvKpJ9aWitgyxorXcVuASvJQvvpXI0aveDlmTzeh+xD6SljLdr2M tEW5zorsP7kULKmkbPmP0mkZBcM8C6PRvcXWlpnwlznW8h2sQmcCTl0iE7kUCHhvCx uD0U1Igch7K4Q== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno Subject: [PATCH v1 4/9] soc: mediatek: mtk-mmsys: Add MODULE_DEVICE_TABLE() to allow auto-load Date: Thu, 16 Feb 2023 14:00:16 +0100 Message-Id: <20230216130021.64875-5-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> References: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Allow module auto-loading by adding a MODULE_DEVICE_TABLE for of_match_mmsys. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mmsys.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mm= sys.c index fcf702fda92e..0f0fa27e17a5 100644 --- a/drivers/soc/mediatek/mtk-mmsys.c +++ b/drivers/soc/mediatek/mtk-mmsys.c @@ -391,6 +391,7 @@ static const struct of_device_id of_match_mtk_mmsys[] = =3D { { .compatible =3D "mediatek,mt8365-mmsys", .data =3D &mt8365_mmsys_driver= _data }, { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, of_match_mtk_mmsys); =20 static struct platform_driver mtk_mmsys_drv =3D { .driver =3D { --=20 2.39.1 From nobody Thu Nov 14 06:53:49 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4790C61DA4 for ; Thu, 16 Feb 2023 13:00:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229976AbjBPNAq (ORCPT ); Thu, 16 Feb 2023 08:00:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229616AbjBPNAc (ORCPT ); Thu, 16 Feb 2023 08:00:32 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C38C3D089 for ; Thu, 16 Feb 2023 05:00:31 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id A6A4866021AB; Thu, 16 Feb 2023 13:00:29 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1676552430; bh=vBcYbh7VmrpwGTtIIzae2X0tf278NrdV7i8AmOYxaYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MDFOAAaOeLdOc+M5ZjmKyg0SAmLyft6TUc9wsRuD/fRRS61yabypxaPzwPGX4MYBO kIndBGCWmZLzokLVSbwHG+KBvKI2a/U44whlxVAEN9vvk97AeUfvSHpJCNoh2ljVRa UlzM8XSqa1U6PxE2hOg+OD36HSfgrGVJdQYbT/tKgnPXKDtb8uD+KIPdtvxAiV2HAc fZPVmvL2W2vQhpJtfkPCI15zQTLgSoMxHuACsUfS07empo8RRIxQrFjDatDwpvd/Oy 47EQrzWi/DLGGPPxYprlN96RuEoihEdRWchawz9vQJ3noCXuLLvp1h/Noiuc5dN2r1 9ma1iivoP8vEg== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno Subject: [PATCH v1 5/9] soc: mediatek: mtk-mutex: Compress of_device_id array entries Date: Thu, 16 Feb 2023 14:00:17 +0100 Message-Id: <20230216130021.64875-6-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> References: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Compress entries of the of_match_mtk_mmsys array to reduce the amount of lines and increase readability; this brings us to a maximum of 95 columns. While at it, also add a sentinel comment to the last entry for the sole purpose of consistency. This commit brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno --- drivers/soc/mediatek/mtk-mutex.c | 38 +++++++++++--------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mu= tex.c index c5b1b42303ac..5c875139425c 100644 --- a/drivers/soc/mediatek/mtk-mutex.c +++ b/drivers/soc/mediatek/mtk-mutex.c @@ -921,31 +921,19 @@ static int mtk_mutex_probe(struct platform_device *pd= ev) } =20 static const struct of_device_id mutex_driver_dt_match[] =3D { - { .compatible =3D "mediatek,mt2701-disp-mutex", - .data =3D &mt2701_mutex_driver_data}, - { .compatible =3D "mediatek,mt2712-disp-mutex", - .data =3D &mt2712_mutex_driver_data}, - { .compatible =3D "mediatek,mt6795-disp-mutex", - .data =3D &mt6795_mutex_driver_data}, - { .compatible =3D "mediatek,mt8167-disp-mutex", - .data =3D &mt8167_mutex_driver_data}, - { .compatible =3D "mediatek,mt8173-disp-mutex", - .data =3D &mt8173_mutex_driver_data}, - { .compatible =3D "mediatek,mt8183-disp-mutex", - .data =3D &mt8183_mutex_driver_data}, - { .compatible =3D "mediatek,mt8186-disp-mutex", - .data =3D &mt8186_mutex_driver_data}, - { .compatible =3D "mediatek,mt8186-mdp3-mutex", - .data =3D &mt8186_mdp_mutex_driver_data}, - { .compatible =3D "mediatek,mt8188-disp-mutex", - .data =3D &mt8188_mutex_driver_data}, - { .compatible =3D "mediatek,mt8192-disp-mutex", - .data =3D &mt8192_mutex_driver_data}, - { .compatible =3D "mediatek,mt8195-disp-mutex", - .data =3D &mt8195_mutex_driver_data}, - { .compatible =3D "mediatek,mt8365-disp-mutex", - .data =3D &mt8365_mutex_driver_data}, - {}, + { .compatible =3D "mediatek,mt2701-disp-mutex", .data =3D &mt2701_mutex_d= river_data }, + { .compatible =3D "mediatek,mt2712-disp-mutex", .data =3D &mt2712_mutex_d= river_data }, + { .compatible =3D "mediatek,mt6795-disp-mutex", .data =3D &mt6795_mutex_d= river_data }, + { .compatible =3D "mediatek,mt8167-disp-mutex", .data =3D &mt8167_mutex_d= river_data }, + { .compatible =3D "mediatek,mt8173-disp-mutex", .data =3D &mt8173_mutex_d= river_data }, + { .compatible =3D "mediatek,mt8183-disp-mutex", .data =3D &mt8183_mutex_d= river_data }, + { .compatible =3D "mediatek,mt8186-disp-mutex", .data =3D &mt8186_mutex_d= river_data }, + { .compatible =3D "mediatek,mt8186-mdp3-mutex", .data =3D &mt8186_mdp_mut= ex_driver_data }, + { .compatible =3D "mediatek,mt8188-disp-mutex", .data =3D &mt8188_mutex_d= river_data }, + { .compatible =3D "mediatek,mt8192-disp-mutex", .data =3D &mt8192_mutex_d= river_data }, + { .compatible =3D "mediatek,mt8195-disp-mutex", .data =3D &mt8195_mutex_d= river_data }, + { .compatible =3D "mediatek,mt8365-disp-mutex", .data =3D &mt8365_mutex_d= river_data }, + { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, mutex_driver_dt_match); =20 --=20 2.39.1 From nobody Thu Nov 14 06:53:49 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 935C4C636CC for ; Thu, 16 Feb 2023 13:00:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230017AbjBPNAu (ORCPT ); Thu, 16 Feb 2023 08:00:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229767AbjBPNAc (ORCPT ); Thu, 16 Feb 2023 08:00:32 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD6503D093 for ; Thu, 16 Feb 2023 05:00:31 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 51B0166021AD; Thu, 16 Feb 2023 13:00:30 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1676552430; bh=CGTdGgAkIa0N9/8JF5Pc98xYJtzEvXtjERV+RFs8Mn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c0qRVUW1m3Hm+37hwH7b9QiKLsEcAYSmzQ7U8v/BBuloJHMcYTdowiuvNJNKPyD03 I2T+K5gTR0O7ej6LueV0WqxLPdFLs4v1SvqxeMScyl/7Bp7tWBH7qR21D7Sw0g+pEw kjbDu0IvDlTtkbP0mtBlgS2CxL0bc7iYLLusntrRYtXiBo4vb1KXHvQcTCHn5XSIDx a9gbdwe86XgcSerMs8FK2AbfqZ0IMvl7SKAleJ3SWlTA+UYopIBu2RSM+zgQmeXX7l HmwJ84H9TrMfZYo6b5D54j82bdVnmttqjJHHKI0yp3HSICkBE9Gax5GldHbhRupZp8 /H0QQalo9ZvwA== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno Subject: [PATCH v1 6/9] soc: mediatek: mtk-mutex: Replace max handles number with definition Date: Thu, 16 Feb 2023 14:00:18 +0100 Message-Id: <20230216130021.64875-7-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> References: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Replace the magic number "10", defining the maximum number of supported handles with a MTK_MUTEX_MAX_HANDLES definition. While at it, also change the type for `id` from a signed integer to a unsigned 8 bits integer to save some (small) memory footprint, as this number is never higher than 10. This cleanup brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mutex.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mu= tex.c index 5c875139425c..fb6bd0838892 100644 --- a/drivers/soc/mediatek/mtk-mutex.c +++ b/drivers/soc/mediatek/mtk-mutex.c @@ -14,6 +14,8 @@ #include #include =20 +#define MTK_MUTEX_MAX_HANDLES 10 + #define MT2701_MUTEX0_MOD0 0x2c #define MT2701_MUTEX0_SOF0 0x30 #define MT8183_MUTEX0_MOD0 0x30 @@ -234,7 +236,7 @@ #define MT8195_MUTEX_EOF_DPI1 (MT8195_MUTEX_SOF_DPI1 << 7) =20 struct mtk_mutex { - int id; + u8 id; bool claimed; }; =20 @@ -264,7 +266,7 @@ struct mtk_mutex_ctx { struct device *dev; struct clk *clk; void __iomem *regs; - struct mtk_mutex mutex[10]; + struct mtk_mutex mutex[MTK_MUTEX_MAX_HANDLES]; const struct mtk_mutex_data *data; phys_addr_t addr; struct cmdq_client_reg cmdq_reg; @@ -616,7 +618,7 @@ struct mtk_mutex *mtk_mutex_get(struct device *dev) struct mtk_mutex_ctx *mtx =3D dev_get_drvdata(dev); int i; =20 - for (i =3D 0; i < 10; i++) + for (i =3D 0; i < MTK_MUTEX_MAX_HANDLES; i++) if (!mtx->mutex[i].claimed) { mtx->mutex[i].claimed =3D true; return &mtx->mutex[i]; @@ -888,7 +890,7 @@ static int mtk_mutex_probe(struct platform_device *pdev) if (!mtx) return -ENOMEM; =20 - for (i =3D 0; i < 10; i++) + for (i =3D 0; i < MTK_MUTEX_MAX_HANDLES; i++) mtx->mutex[i].id =3D i; =20 mtx->data =3D of_device_get_match_data(dev); --=20 2.39.1 From nobody Thu Nov 14 06:53:49 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70C84C636CC for ; Thu, 16 Feb 2023 13:00:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230140AbjBPNAw (ORCPT ); Thu, 16 Feb 2023 08:00:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229790AbjBPNAd (ORCPT ); Thu, 16 Feb 2023 08:00:33 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8553A3E0AA for ; Thu, 16 Feb 2023 05:00:32 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id EBB7C66021AF; Thu, 16 Feb 2023 13:00:30 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1676552431; bh=yWsDegXzrt0NSHPWIjXZg1Uds3E0S8tY1ojJP+FXBNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XcvILqurET3s+UI5b49eLjsRGssUji2kiyzxl28cwUgZDmtNLneuWp1HMHhZazQyV 9O2ubb1dYrZx+w240KedoGcfdC9lAlMtxvRum3Ev3Ud8Fw/AmSdr1naTxVijASinDn AZycf2BDwQeWG745RLcvbywluJ2V9wuaml45ciP6ecJkXxBn/xSk7x/WY7NYFXjaA4 2h1sJpYUsf1TPIeXQ41Oz7rObI2qVi97sH7qg7qSn2BtkPskuV5+0M4ObErOaT7aH/ Vy9O1Ud5m5gtA9pWfOsyihdqfqtPmXNfTofiI96wgsOJJdftJa3UiYUcjH0oxl1kVZ /510M6G/gBeJQ== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno Subject: [PATCH v1 7/9] soc: mediatek: mtk-mutex: Use module_platform_driver() macro Date: Thu, 16 Feb 2023 14:00:19 +0100 Message-Id: <20230216130021.64875-8-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> References: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Replace open-coded init/exit calls with the module_platform_driver() macro being equivalent. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mutex.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mu= tex.c index fb6bd0838892..07eff509580a 100644 --- a/drivers/soc/mediatek/mtk-mutex.c +++ b/drivers/soc/mediatek/mtk-mutex.c @@ -947,19 +947,7 @@ static struct platform_driver mtk_mutex_driver =3D { .of_match_table =3D mutex_driver_dt_match, }, }; - -static int __init mtk_mutex_init(void) -{ - return platform_driver_register(&mtk_mutex_driver); -} - -static void __exit mtk_mutex_exit(void) -{ - platform_driver_unregister(&mtk_mutex_driver); -} - -module_init(mtk_mutex_init); -module_exit(mtk_mutex_exit); +module_platform_driver(mtk_mutex_driver); =20 MODULE_AUTHOR("Yongqiang Niu "); MODULE_DESCRIPTION("MediaTek SoC MUTEX driver"); --=20 2.39.1 From nobody Thu Nov 14 06:53:49 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80ABAC61DA4 for ; Thu, 16 Feb 2023 13:00:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230171AbjBPNAz (ORCPT ); Thu, 16 Feb 2023 08:00:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229803AbjBPNAe (ORCPT ); Thu, 16 Feb 2023 08:00:34 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36C77460B9 for ; Thu, 16 Feb 2023 05:00:33 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 972F066021B0; Thu, 16 Feb 2023 13:00:31 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1676552432; bh=xTuZaQlAntk6Qk8/c2NRbpSHRNuDsWSTVCBYxnSeJHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ynv7Jtbakt/v+F2cJ9nfEm5iNvpmNj+OocNu2bT5JlxjwFbO2G8jlYzWbr3HGhBim 7d/574+cvtxNQt7IgKuClYtcyGBQs/Qy0lrf6RE49n8Dp3HvT1NDurROGpFhQPpeo9 RMKNgT5acXH2ejf4i77vnJ7ZK8ZKP6Zz3n15QpfU/vXGYzmA0eo+ZVM7njlNYv4MkN Iaz35OUTgBpt3g7IbUBMzLV/l2vV6G9eR9K57GAM8n5AyoEZ9KtpNAyFpDsdGGUKCB z/SY3OHOOWJ90SP9n+6HnkSzUQzHCVQyW6z83aEAtDKTOZFfKlB6jLalDT/l3U0uRd NAsWou8XmM71Q== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno Subject: [PATCH v1 8/9] soc: mediatek: cmdq: Add inline functions for !CONFIG_MTK_CMDQ Date: Thu, 16 Feb 2023 14:00:20 +0100 Message-Id: <20230216130021.64875-9-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> References: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In preparation for a cleanup of ifdef instances of IS_REACHABLE() for the CONFIG_MTK_CMDQ configuration option, add inline functions that will either return a failure or, for void functions, do nothing. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- include/linux/soc/mediatek/mtk-cmdq.h | 114 ++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/medi= atek/mtk-cmdq.h index 2b498f4f3946..649955d2cf5c 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -27,6 +27,8 @@ struct cmdq_client { struct mbox_chan *chan; }; =20 +#if IS_ENABLED(CONFIG_MTK_CMDQ) + /** * cmdq_dev_get_client_reg() - parse cmdq client reg from the device * node of CMDQ client @@ -277,4 +279,116 @@ int cmdq_pkt_finalize(struct cmdq_pkt *pkt); */ int cmdq_pkt_flush_async(struct cmdq_pkt *pkt); =20 +#else /* IS_ENABLED(CONFIG_MTK_CMDQ) */ + +static inline int cmdq_dev_get_client_reg(struct device *dev, + struct cmdq_client_reg *client_reg, int idx) +{ + return -ENODEV; +} + +static inline struct cmdq_client *cmdq_mbox_create(struct device *dev, int= index) +{ + return ERR_PTR(-EINVAL); +} + +static inline void cmdq_mbox_destroy(struct cmdq_client *client) { } + +static inline struct cmdq_pkt *cmdq_pkt_create(struct cmdq_client *client= , size_t size) +{ + return ERR_PTR(-EINVAL); +} + +static inline void cmdq_pkt_destroy(struct cmdq_pkt *pkt) { } + +static inline int cmdq_pkt_write(struct cmdq_pkt *pkt, u8 subsys, u16 offs= et, u32 value) +{ + return -ENOENT; +} + +static inline int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys, + u16 offset, u32 value, u32 mask) +{ + return -ENOENT; +} + +static inline int cmdq_pkt_read_s(struct cmdq_pkt *pkt, u16 high_addr_reg_= idx, + u16 addr_low, u16 reg_idx) +{ + return -ENOENT; +} + +static inline int cmdq_pkt_write_s(struct cmdq_pkt *pkt, u16 high_addr_reg= _idx, + u16 addr_low, u16 src_reg_idx) +{ + return -ENOENT; +} + +static inline int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_add= r_reg_idx, + u16 addr_low, u16 src_reg_idx, u32 mask) +{ + return -ENOENT; +} + +static inline int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_add= r_reg_idx, + u16 addr_low, u32 value) +{ + return -ENOENT; +} + +static inline int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 hig= h_addr_reg_idx, + u16 addr_low, u32 value, u32 mask) +{ + return -ENOENT; +} + +static inline int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_set_event(struct cmdq_pkt *pkt, u16 event) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_poll(struct cmdq_pkt *pkt, u8 subsys, + u16 offset, u32 value) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_poll_mask(struct cmdq_pkt *pkt, u8 subsys, + u16 offset, u32 value, u32 mask) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 v= alue) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_finalize(struct cmdq_pkt *pkt) +{ + return -EINVAL; +} + +static inline int cmdq_pkt_flush_async(struct cmdq_pkt *pkt) +{ + return -EINVAL; +} + +#endif /* IS_ENABLED(CONFIG_MTK_CMDQ) */ + #endif /* __MTK_CMDQ_H__ */ --=20 2.39.1 From nobody Thu Nov 14 06:53:49 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 155A7C61DA4 for ; Thu, 16 Feb 2023 13:00:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230080AbjBPNA6 (ORCPT ); Thu, 16 Feb 2023 08:00:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229805AbjBPNAe (ORCPT ); Thu, 16 Feb 2023 08:00:34 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD8553E60A for ; Thu, 16 Feb 2023 05:00:33 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 417C266021B1; Thu, 16 Feb 2023 13:00:32 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1676552432; bh=RccccoYIg2VDJV5r2fovP6KY9nTyOOMC3E5fFvlWdFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CZwvRMWpjpMt9A3c2h48lxb4llxSXlmhnZvFdgt0z/bAH+AKBliugLhJm1Kpn1zpx Qprb22EehySQH2hh43Bs0e8DkBlWgXT8n2F7C3MOPwocTtb1xOEYSFDIhbmwJC7ML0 dQVP+EkF3DcnAVBPLRPYCExiAe4L7BjBENJVYC4EaSKIb/KSZ7k+Sr9uv1WO3aDtYI 2KmtK0fUzNjNhvYGxvpI11b4immJn4pBHIfAfVEwRnkerh7R7/Ra8zxof/9FUZPdQb YUJ00ZbDuh344LvhqrrZrOEH5cHfWb2dZbDq/+PCTvS2IA98Vgqqhf8FzKBROmBc12 GYvV4w5LTC2Fg== From: AngeloGioacchino Del Regno To: matthias.bgg@gmail.com Cc: jason-jh.lin@mediatek.com, chunkuang.hu@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, AngeloGioacchino Del Regno Subject: [PATCH v1 9/9] soc: mediatek: Cleanup ifdefs for IS_REACHABLE(CONFIG_MTK_CMDQ) Date: Thu, 16 Feb 2023 14:00:21 +0100 Message-Id: <20230216130021.64875-10-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> References: <20230216130021.64875-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Now that the mtk-cmdq.h header contains inline functions for cases in which the driver is not enabled (either module or built-in), we can safely go on with cleaning up ifdefs for CMDQ handling. This also shows in a clearer manner that writing through CMDQ HW is optional and used only for performance purposes when/where wanted, needed and/or required. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/soc/mediatek/mtk-mmsys.c | 22 +++++++++------------- drivers/soc/mediatek/mtk-mutex.c | 15 +++------------ 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mm= sys.c index 0f0fa27e17a5..8da5c8d26ed0 100644 --- a/drivers/soc/mediatek/mtk-mmsys.c +++ b/drivers/soc/mediatek/mtk-mmsys.c @@ -131,21 +131,18 @@ struct mtk_mmsys { static void mtk_mmsys_update_bits(struct mtk_mmsys *mmsys, u32 offset, u32= mask, u32 val, struct cmdq_pkt *cmdq_pkt) { + int ret; u32 tmp; =20 -#if IS_REACHABLE(CONFIG_MTK_CMDQ) - if (cmdq_pkt) { - if (mmsys->cmdq_base.size =3D=3D 0) { - pr_err("mmsys lose gce property, failed to update mmsys bits with cmdq"= ); + if (mmsys->cmdq_base.size && cmdq_pkt) { + ret =3D cmdq_pkt_write_mask(cmdq_pkt, mmsys->cmdq_base.subsys, + mmsys->cmdq_base.offset + offset, val, + mask); + if (ret) + pr_debug("CMDQ unavailable: using CPU write\n"); + else return; - } - cmdq_pkt_write_mask(cmdq_pkt, mmsys->cmdq_base.subsys, - mmsys->cmdq_base.offset + offset, val, - mask); - return; } -#endif - tmp =3D readl_relaxed(mmsys->regs + offset); tmp =3D (tmp & ~mask) | (val & mask); writel_relaxed(tmp, mmsys->regs + offset); @@ -332,11 +329,10 @@ static int mtk_mmsys_probe(struct platform_device *pd= ev) } } =20 -#if IS_REACHABLE(CONFIG_MTK_CMDQ) + /* CMDQ is optional */ ret =3D cmdq_dev_get_client_reg(dev, &mmsys->cmdq_base, 0); if (ret) dev_dbg(dev, "No mediatek,gce-client-reg!\n"); -#endif =20 platform_set_drvdata(pdev, mmsys); =20 diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mu= tex.c index 07eff509580a..78c04cc5457a 100644 --- a/drivers/soc/mediatek/mtk-mutex.c +++ b/drivers/soc/mediatek/mtk-mutex.c @@ -770,23 +770,18 @@ int mtk_mutex_enable_by_cmdq(struct mtk_mutex *mutex,= void *pkt) { struct mtk_mutex_ctx *mtx =3D container_of(mutex, struct mtk_mutex_ctx, mutex[mutex->id]); -#if IS_REACHABLE(CONFIG_MTK_CMDQ) struct cmdq_pkt *cmdq_pkt =3D (struct cmdq_pkt *)pkt; =20 WARN_ON(&mtx->mutex[mutex->id] !=3D mutex); =20 if (!mtx->cmdq_reg.size) { dev_err(mtx->dev, "mediatek,gce-client-reg hasn't been set"); - return -EINVAL; + return -ENODEV; } =20 cmdq_pkt_write(cmdq_pkt, mtx->cmdq_reg.subsys, mtx->addr + DISP_REG_MUTEX_EN(mutex->id), 1); return 0; -#else - dev_err(mtx->dev, "Not support for enable MUTEX by CMDQ"); - return -ENODEV; -#endif } EXPORT_SYMBOL_GPL(mtk_mutex_enable_by_cmdq); =20 @@ -881,10 +876,7 @@ static int mtk_mutex_probe(struct platform_device *pde= v) struct device *dev =3D &pdev->dev; struct mtk_mutex_ctx *mtx; struct resource *regs; - int i; -#if IS_REACHABLE(CONFIG_MTK_CMDQ) - int ret; -#endif + int i, ret; =20 mtx =3D devm_kzalloc(dev, sizeof(*mtx), GFP_KERNEL); if (!mtx) @@ -911,11 +903,10 @@ static int mtk_mutex_probe(struct platform_device *pd= ev) } mtx->addr =3D regs->start; =20 -#if IS_REACHABLE(CONFIG_MTK_CMDQ) + /* CMDQ is optional */ ret =3D cmdq_dev_get_client_reg(dev, &mtx->cmdq_reg, 0); if (ret) dev_dbg(dev, "No mediatek,gce-client-reg!\n"); -#endif =20 platform_set_drvdata(pdev, mtx); =20 --=20 2.39.1