From nobody Thu Nov 14 06:54:43 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 A7950C61DA4 for ; Wed, 22 Feb 2023 09:52:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231195AbjBVJwS (ORCPT ); Wed, 22 Feb 2023 04:52:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232305AbjBVJvz (ORCPT ); Wed, 22 Feb 2023 04:51:55 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4CC33756A for ; Wed, 22 Feb 2023 01:50:09 -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 ECD2B66021B6; Wed, 22 Feb 2023 09:42:59 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058980; bh=ZVUGUSkQPIkJqJdXlquYlMTH70M4rX6hh28fX2ZpB5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=icQqmQC1NwhnkaUQUa+HJKbglRLmbx/Cj2SKtRtzcRiAcaZ6bhD1Me/eThlsET4+i ujYA1sNyAbC9oPZFJYpa9XFob5Sx/YjCt4ShTyTalCwsz2Er43whYGhep8a2lvMUUH RyGA+0aIlYplbyCeYhJGCZ15xq/YKNHkZvkZNmAwwiDj5hAtK6901UscTnn1KpS865 S9bZSHyzPYmPHneLMLyiUwBFEEO2/IJPz4qE7tZTzZHGDdA944Hwwowg+WftffoDX6 nft5SV61zPfGuvYbc23A5utu3uh/YnAq0yL3fSR7UgphZZV1u2sJ93YcCnYJF9oBpi 5G644Bm21xEWw== 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 , Chen-Yu Tsai Subject: [PATCH v2 1/9] soc: mediatek: mtk-mmsys: Add .remove() callback Date: Wed, 22 Feb 2023 10:42:45 +0100 Message-Id: <20230222094253.23678-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-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.2 From nobody Thu Nov 14 06:54:43 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 5CFBEC61DA4 for ; Wed, 22 Feb 2023 09:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229669AbjBVJuh (ORCPT ); Wed, 22 Feb 2023 04:50:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231464AbjBVJuL (ORCPT ); Wed, 22 Feb 2023 04:50:11 -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 B580F3608D for ; Wed, 22 Feb 2023 01:48:03 -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 9D6D966021B8; Wed, 22 Feb 2023 09:43:00 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058981; bh=rAHk+6D4DP7ZKavkjU3OoAIsoPs/edVh3yg1JAxrz8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g4g6Jf22hidJPXb/h9Wa8OCLtlftHXym9YpMsWyHjgCb/rbi6ZzmyzhoatYtDv+M/ ihQFLLNEDnRriFk+ZSh0F7EwjqEwx9LXoFmd9Yxyy5gUPeYst0TAO0dkLwPT5eeLJT NfHzhiOR8BGZshr6QZkR6kRtEax+109UdlzzCbW1pkLCi0G4qxTghDNLoTotkBcspL aQ2WGmrWRozR4mXpxGchvduT7502ivAoW6+7JqSDwESi/EUJTxvjhKoeLKh6Qh7qbs BqClANiOO9XNowtXBLIiBHUenXd6W3zpbdP9YvuJMZuOGAYOkSdBUNG5UEzVHGiPsP ESxOlbKporAZQ== 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 , Chen-Yu Tsai Subject: [PATCH v2 2/9] soc: mediatek: mtk-mmsys: Use module_platform_driver() macro Date: Wed, 22 Feb 2023 10:42:46 +0100 Message-Id: <20230222094253.23678-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-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.2 From nobody Thu Nov 14 06:54:43 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 ADAF2C61DA4 for ; Wed, 22 Feb 2023 09:46:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229596AbjBVJqX (ORCPT ); Wed, 22 Feb 2023 04:46:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231324AbjBVJqF (ORCPT ); Wed, 22 Feb 2023 04:46:05 -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 CF3273B870 for ; Wed, 22 Feb 2023 01:43:58 -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 4EB4666021BA; Wed, 22 Feb 2023 09:43:01 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058981; bh=D2Wg1MCaTWqKvlTyCHCMNbxkOo7Gmf+eDXCX8QbUlHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HPlsRs8ew86CCn01Gcuu9S1HtWNy6942rbS5Jbv4zMYqrVjhcsHaBalT9RmEZkw48 Nyi6tw/H76/HYemFUPNzRJELwqS1zt7qTbSAp0IWcYbD03PlCpIKVzSFYpiSu39zxt laa++YqNavcWmihqf+ry9qsMssFZ9sGmxnK8+gDtWmCuucC76lZYlgHb1UMFBiunya B57NyVWHoVP67dD5j28Z2vGQaJzMCyv6nPHYfdDcKC3uPyp2wo4jUUzCE+NwT8NjQK OcOWjO/obaYQuJYD2+N64AQ8kbkDKcRgfrnCIvGwnGGHk8WNKwV9R74yAOX98gmQmI eR8yqip69z9fw== 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 , Chen-Yu Tsai Subject: [PATCH v2 3/9] soc: mediatek: mtk-mmsys: Compress of_device_id array entries Date: Wed, 22 Feb 2023 10:42:47 +0100 Message-Id: <20230222094253.23678-4-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-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.2 From nobody Thu Nov 14 06:54:43 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 7AD2CC61DA4 for ; Wed, 22 Feb 2023 09:50:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232168AbjBVJuo (ORCPT ); Wed, 22 Feb 2023 04:50:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232263AbjBVJuW (ORCPT ); Wed, 22 Feb 2023 04:50:22 -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 73041B76C for ; Wed, 22 Feb 2023 01:48:13 -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 00AB766021BC; Wed, 22 Feb 2023 09:43:01 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058982; bh=HdA9LzRyfYNiXvz7Hffi4ApU2JZCzXJht1XHORTPc54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aj2IRggvt5KoR/paEff124zVV1bz7iA05sKUjbBbqW53DSgsrF8Ac/HSDp9MWgTPS HCEO/WtQLd3yHAz+y093jCIDbYYvNkG4FSh3yTRWXVMKQ+o3m164hFc9o3K2RA3OLO DlWsdQcMy7Y+l8cQoLZMs/jiS10fdbjVz6XMmRDk6zQFPyIiXNywAbaDYA5/ZBlmJZ IiqjB8+S4VW5TWxrsSsFtb+B6Cj+O9Z+K+o/8pO/bg/YVMWnqSp9oxyQW/ayp5tbjB DcAzhUnKvKoO4Vr6zuprIgzbgbLnuziDblLf2e+xnq84MjeDErNiD61Ibm35tP4Fg6 zI4jnG1pL1B5A== 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 , Chen-Yu Tsai Subject: [PATCH v2 4/9] soc: mediatek: mtk-mmsys: Add MODULE_DEVICE_TABLE() to allow auto-load Date: Wed, 22 Feb 2023 10:42:48 +0100 Message-Id: <20230222094253.23678-5-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-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.2 From nobody Thu Nov 14 06:54:43 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 7CFFEC6379F for ; Wed, 22 Feb 2023 09:47:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232259AbjBVJrU (ORCPT ); Wed, 22 Feb 2023 04:47:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230291AbjBVJq6 (ORCPT ); Wed, 22 Feb 2023 04:46:58 -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 F305B38678 for ; Wed, 22 Feb 2023 01:45:01 -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 B047766021C8; Wed, 22 Feb 2023 09:43:02 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058983; bh=spGpqKbSxXn7OPXf28QXu2nWmpVE56wv353pvm/OWK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KiQGObEP5jZxRUVhDOL6ay7oS1WI1Kiipid2I0XbAIUpfOi/IggijilljCw/MzTpN xeML0gjTJUeebPP5T7/jMXmWJutlyVE+AKql56wtHX1INL8H/ytEqE4R6tF3i8ZGCz VgMSxhf241mWeIiIqKXHX5C3zkNqPCu62e//DtTFWdmSquxQuLuJgHLkXVIisjKb+0 XLJkQQuKFtpXUiFIYIS3x1XKVmynltqQ4SYUOZYXmpoqT690P0EqL2+W6RbWY9/g1x JKEhzqUyxhrqGPljZWEfXomO9Pwn7rXF4O1wj9ju2c/A/TptJ6FsMcb92bLYOVASJE 1TIBKLMm1vlEA== 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 v2 5/9] soc: mediatek: mtk-mutex: Compress of_device_id array entries Date: Wed, 22 Feb 2023 10:42:49 +0100 Message-Id: <20230222094253.23678-6-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-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 | 41 +++++++++++--------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mu= tex.c index 7751527fc30d..a59fde2bdcba 100644 --- a/drivers/soc/mediatek/mtk-mutex.c +++ b/drivers/soc/mediatek/mtk-mutex.c @@ -1040,33 +1040,20 @@ static int mtk_mutex_probe(struct platform_device *= pdev) } =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,mt8195-vpp-mutex", - .data =3D &mt8195_vpp_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,mt8195-vpp-mutex", .data =3D &mt8195_vpp_mut= ex_driver_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.2 From nobody Thu Nov 14 06:54:43 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 60841C6379F for ; Wed, 22 Feb 2023 09:51:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232343AbjBVJvg (ORCPT ); Wed, 22 Feb 2023 04:51:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231495AbjBVJvO (ORCPT ); Wed, 22 Feb 2023 04:51:14 -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 DAFC13B650 for ; Wed, 22 Feb 2023 01:49:20 -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 57B2E66021CF; Wed, 22 Feb 2023 09:43:03 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058983; bh=e3IoV4WZMMZpp/4i2Ywjd+HRfKbXhy2Fwpb6MBe7E9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TW49Kut03chnB17gy+oOlEdsRglJEPbtp6qrJAlIi8l9dX/aAXscA8EVrCy9h5pod vmlmwn+lOeZGv4cNWr3zwCKFU6sjKUUdpXRoregGMJEZS2ToV0jetU4KDvkFgkDNaU W7g2RJb0B6OWT8seVbkS8WSjlNLUWvr1/dZk0og0s2zISZ6AzFuu/J6egY6vuG+6au GOw8/CCLUd+vh3VmweL7umYnQJIej/9xZwoENc4GXIDMz0/VvJcIeA7ih1wepdM+4i GR39oKu2mPiAWnXXlcvz0CVVMU+XfsA9ZkWaD/9UrB7oSMH3yd8rZPa3h9ExIzoe74 kO087S6EsxWBw== 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 , Chen-Yu Tsai Subject: [PATCH v2 6/9] soc: mediatek: mtk-mutex: Replace max handles number with definition Date: Wed, 22 Feb 2023 10:42:50 +0100 Message-Id: <20230222094253.23678-7-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-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 a59fde2bdcba..b68bb87bc365 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 @@ -282,7 +284,7 @@ #define MT8195_MUTEX_EOF_DPI1 (MT8195_MUTEX_SOF_DPI1 << 7) =20 struct mtk_mutex { - int id; + u8 id; bool claimed; }; =20 @@ -312,7 +314,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; @@ -717,7 +719,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]; @@ -1007,7 +1009,7 @@ static int mtk_mutex_probe(struct platform_device *pd= ev) 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.2 From nobody Thu Nov 14 06:54:43 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 BC950C6379F for ; Wed, 22 Feb 2023 09:47:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232265AbjBVJrW (ORCPT ); Wed, 22 Feb 2023 04:47:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231308AbjBVJrA (ORCPT ); Wed, 22 Feb 2023 04:47:00 -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 666413CE0C for ; Wed, 22 Feb 2023 01:45:04 -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 0A8DF66021D0; Wed, 22 Feb 2023 09:43:03 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058984; bh=W3yq5QP4VSIp5kuNHWkTn9ITtbb/6KY6TaV3sJDTiN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Npvg6e4prXO4gcc0DXYI5ohzflUH1du/8pA8tgxw0rxzh7TEUPb/Ae2kzyj/FnwB0 pI7Gf0c9ob4sKINxhGmpGLNp5kjZ37BUhg5DJotm8UQSdCS0ii31AqADnNYjF9Q5Ct 4xvi9SLp6B6TsdEqUekc2lahepdB7W0MoyU1pD9wctvu0fRan/aCzstzGMay6L4vy+ VSCHyosMm5d8LV2Ysa5PzmftGBdrftP3nU6Yfr6QzD6g6PUCKJMot4Ydaxf5ZFU2em 6ivphDJBKG9cOir6/GMi8xtTdBB5d4aetKVZnITmc6M6Cyicq+vaBvbVQaNa+ZD+IA V0erBJYFq04Ug== 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 , Chen-Yu Tsai Subject: [PATCH v2 7/9] soc: mediatek: mtk-mutex: Use module_platform_driver() macro Date: Wed, 22 Feb 2023 10:42:51 +0100 Message-Id: <20230222094253.23678-8-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-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 b68bb87bc365..b106f3d23e0d 100644 --- a/drivers/soc/mediatek/mtk-mutex.c +++ b/drivers/soc/mediatek/mtk-mutex.c @@ -1067,19 +1067,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.2 From nobody Thu Nov 14 06:54:43 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 78AF6C61DA4 for ; Wed, 22 Feb 2023 09:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231300AbjBVJsV (ORCPT ); Wed, 22 Feb 2023 04:48:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232018AbjBVJr7 (ORCPT ); Wed, 22 Feb 2023 04:47:59 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D8203A86F for ; Wed, 22 Feb 2023 01:46:07 -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 B0B4866021D4; Wed, 22 Feb 2023 09:43:04 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058985; bh=QLUE6gweejlnVZKkySch/QDsSqbrZL8wTCZxRZLCRkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Az6tc/ddE8y2KAl2HzuVlrtJbg8p6y/QCMj+LY17E+uey84JRNm4RVFIoZInorF/8 8P06AalpXwNGCvZwN2beagEfIoBEJengdPxXi8M4KTcGMs+pqnrMn3YTtRQh5QXbpy t7KnGth9jk9pw9XF9pVr0tsCB3A90pAj8CJ5+d6Iox2XfTluMl1PpdeELngEaK5GYG 10+7PsORVre2ca4geI2lapOhIoFMSUVkUcQTjBGEAzMsK/LpbrmdWY8TzukUu4FlLM 6HDMs+UNts96Sn2BVBlrarM439J7aJO00j+tAD92TV10isK9HWbKyueRoZW3eYg9bI I0uVTCubJK0WA== 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 , Chen-Yu Tsai Subject: [PATCH v2 8/9] soc: mediatek: cmdq: Add inline functions for !CONFIG_MTK_CMDQ Date: Wed, 22 Feb 2023 10:42:52 +0100 Message-Id: <20230222094253.23678-9-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-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.2 From nobody Thu Nov 14 06:54:43 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 0FEE8C6379F for ; Wed, 22 Feb 2023 09:48:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232273AbjBVJsZ (ORCPT ); Wed, 22 Feb 2023 04:48:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232110AbjBVJsA (ORCPT ); Wed, 22 Feb 2023 04:48:00 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66F933866E for ; Wed, 22 Feb 2023 01:46:11 -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 627B866021D5; Wed, 22 Feb 2023 09:43:05 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677058985; bh=t0WQRQY93wT7Ed+artLK4huBmFp5RCO/YHHv1kqN5ow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ihCuNPi0WgxnIHJEEL+kMrFdWXEi9a4xwIiBOZoekKc0R1UMCAscg4QF16nCCkfw5 bEwK2qBpTo/xZzWahGFe2Xt2JHnkzsnbqyD/NTM5Q8N92XPpPxcilEv95/gLSuoE1G l19rMU234gvbymd2bprEeJBPS8kIETCZds1t72eG/hFBT6D/6m8ko9BByk7IKTUKrM ZWcZRuOm8BPL1g5+JgHVh8C2aAW3tXGpXc+nW7xkRWTRsVMwF1CDkQzc2wBmR7KmaT Ov8Tc888vKvh7sS3KQBmOWpZkn2pjn8LQETcdxJtj/40vzb3FoCWGlXjOD04banzzD iYLlSU5XpaEnA== 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 , Chen-Yu Tsai Subject: [PATCH v2 9/9] soc: mediatek: Cleanup ifdefs for IS_REACHABLE(CONFIG_MTK_CMDQ) Date: Wed, 22 Feb 2023 10:42:53 +0100 Message-Id: <20230222094253.23678-10-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230222094253.23678-1-angelogioacchino.delregno@collabora.com> References: <20230222094253.23678-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 b106f3d23e0d..b92cffec7be7 100644 --- a/drivers/soc/mediatek/mtk-mutex.c +++ b/drivers/soc/mediatek/mtk-mutex.c @@ -871,23 +871,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 @@ -1000,10 +995,7 @@ static int mtk_mutex_probe(struct platform_device *pd= ev) 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) @@ -1030,11 +1022,10 @@ static int mtk_mutex_probe(struct platform_device *= pdev) } 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.2