linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/9] soc/mediatek: Cleanup mmsys, mutex, cmdq header
@ 2023-02-16 13:00 AngeloGioacchino Del Regno
  2023-02-16 13:00 ` [PATCH v1 1/9] soc: mediatek: mtk-mmsys: Add .remove() callback AngeloGioacchino Del Regno
                   ` (8 more replies)
  0 siblings, 9 replies; 19+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-16 13:00 UTC (permalink / raw)
  To: matthias.bgg
  Cc: jason-jh.lin, chunkuang.hu, linux-kernel, linux-arm-kernel,
	linux-mediatek, AngeloGioacchino Del Regno

This series adds a proper remove callback for mtk-mmsys, adds light
cleanups on mtk-mutex and, more importantly, adds a cleanup for the
CMDQ helpers.

Special mention goes to the latter: this is just in preparation for
a larger cleanup that I plan to do as soon as possible on other cmdq
helpers users, being mediatek-drm and mtk-mdp3; that's not performed
right now because, in the case of drm/mdp3, the cleanup is not entirely
trivial.

AngeloGioacchino Del Regno (9):
  soc: mediatek: mtk-mmsys: Add .remove() callback
  soc: mediatek: mtk-mmsys: Use module_platform_driver() macro
  soc: mediatek: mtk-mmsys: Compress of_device_id array entries
  soc: mediatek: mtk-mmsys: Add MODULE_DEVICE_TABLE() to allow auto-load
  soc: mediatek: mtk-mutex: Compress of_device_id array entries
  soc: mediatek: mtk-mutex: Replace max handles number with definition
  soc: mediatek: mtk-mutex: Use module_platform_driver() macro
  soc: mediatek: cmdq: Add inline functions for !CONFIG_MTK_CMDQ
  soc: mediatek: Cleanup ifdefs for IS_REACHABLE(CONFIG_MTK_CMDQ)

 drivers/soc/mediatek/mtk-mmsys.c      | 135 +++++++++-----------------
 drivers/soc/mediatek/mtk-mutex.c      |  77 +++++----------
 include/linux/soc/mediatek/mtk-cmdq.h | 114 ++++++++++++++++++++++
 3 files changed, 181 insertions(+), 145 deletions(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v1 1/9] soc: mediatek: mtk-mmsys: Add .remove() callback
  2023-02-16 13:00 [PATCH v1 0/9] soc/mediatek: Cleanup mmsys, mutex, cmdq header AngeloGioacchino Del Regno
@ 2023-02-16 13:00 ` AngeloGioacchino Del Regno
  2023-02-21  7:04   ` Chen-Yu Tsai
  2023-02-16 13:00 ` [PATCH v1 2/9] soc: mediatek: mtk-mmsys: Use module_platform_driver() macro AngeloGioacchino Del Regno
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-16 13:00 UTC (permalink / raw)
  To: matthias.bgg
  Cc: jason-jh.lin, chunkuang.hu, linux-kernel, linux-arm-kernel,
	linux-mediatek, AngeloGioacchino Del Regno

Add a .remove() callback to correctly unregister the multimedia clocks
and DRM drivers.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 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-mmsys.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 = {
 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 = clks;
 
 	if (mmsys->data->is_vppsys)
 		goto out_probe_done;
@@ -352,11 +355,22 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
 		platform_device_unregister(clks);
 		return PTR_ERR(drm);
 	}
+	mmsys->drm_pdev = drm;
 
 out_probe_done:
 	return 0;
 }
 
+static int mtk_mmsys_remove(struct platform_device *pdev)
+{
+	struct mtk_mmsys *mmsys = 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[] = {
 	{
 		.compatible = "mediatek,mt2701-mmsys",
@@ -431,6 +445,7 @@ static struct platform_driver mtk_mmsys_drv = {
 		.of_match_table = of_match_mtk_mmsys,
 	},
 	.probe = mtk_mmsys_probe,
+	.remove = mtk_mmsys_remove,
 };
 
 static int __init mtk_mmsys_init(void)
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v1 2/9] soc: mediatek: mtk-mmsys: Use module_platform_driver() macro
  2023-02-16 13:00 [PATCH v1 0/9] soc/mediatek: Cleanup mmsys, mutex, cmdq header AngeloGioacchino Del Regno
  2023-02-16 13:00 ` [PATCH v1 1/9] soc: mediatek: mtk-mmsys: Add .remove() callback AngeloGioacchino Del Regno
@ 2023-02-16 13:00 ` AngeloGioacchino Del Regno
  2023-02-21  7:00   ` Chen-Yu Tsai
  2023-02-16 13:00 ` [PATCH v1 3/9] soc: mediatek: mtk-mmsys: Compress of_device_id array entries AngeloGioacchino Del Regno
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-16 13:00 UTC (permalink / raw)
  To: matthias.bgg
  Cc: jason-jh.lin, chunkuang.hu, linux-kernel, linux-arm-kernel,
	linux-mediatek, AngeloGioacchino Del Regno

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 <angelogioacchino.delregno@collabora.com>
---
 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-mmsys.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 = {
 	.probe = mtk_mmsys_probe,
 	.remove = 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);
 
 MODULE_AUTHOR("Yongqiang Niu <yongqiang.niu@mediatek.com>");
 MODULE_DESCRIPTION("MediaTek SoC MMSYS driver");
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v1 3/9] soc: mediatek: mtk-mmsys: Compress of_device_id array entries
  2023-02-16 13:00 [PATCH v1 0/9] soc/mediatek: Cleanup mmsys, mutex, cmdq header AngeloGioacchino Del Regno
  2023-02-16 13:00 ` [PATCH v1 1/9] soc: mediatek: mtk-mmsys: Add .remove() callback AngeloGioacchino Del Regno
  2023-02-16 13:00 ` [PATCH v1 2/9] soc: mediatek: mtk-mmsys: Use module_platform_driver() macro AngeloGioacchino Del Regno
@ 2023-02-16 13:00 ` AngeloGioacchino Del Regno
  2023-02-21  7:05   ` Chen-Yu Tsai
  2023-02-16 13:00 ` [PATCH v1 4/9] soc: mediatek: mtk-mmsys: Add MODULE_DEVICE_TABLE() to allow auto-load AngeloGioacchino Del Regno
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-16 13:00 UTC (permalink / raw)
  To: matthias.bgg
  Cc: jason-jh.lin, chunkuang.hu, linux-kernel, linux-arm-kernel,
	linux-mediatek, AngeloGioacchino Del Regno

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 <angelogioacchino.delregno@collabora.com>
---
 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-mmsys.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 *pdev)
 }
 
 static const struct of_device_id of_match_mtk_mmsys[] = {
-	{
-		.compatible = "mediatek,mt2701-mmsys",
-		.data = &mt2701_mmsys_driver_data,
-	},
-	{
-		.compatible = "mediatek,mt2712-mmsys",
-		.data = &mt2712_mmsys_driver_data,
-	},
-	{
-		.compatible = "mediatek,mt6779-mmsys",
-		.data = &mt6779_mmsys_driver_data,
-	},
-	{
-		.compatible = "mediatek,mt6797-mmsys",
-		.data = &mt6797_mmsys_driver_data,
-	},
-	{
-		.compatible = "mediatek,mt8167-mmsys",
-		.data = &mt8167_mmsys_driver_data,
-	},
-	{
-		.compatible = "mediatek,mt8173-mmsys",
-		.data = &mt8173_mmsys_driver_data,
-	},
-	{
-		.compatible = "mediatek,mt8183-mmsys",
-		.data = &mt8183_mmsys_driver_data,
-	},
-	{
-		.compatible = "mediatek,mt8186-mmsys",
-		.data = &mt8186_mmsys_driver_data,
-	},
-	{
-		.compatible = "mediatek,mt8188-vdosys0",
-		.data = &mt8188_vdosys0_driver_data,
-	},
-	{
-		.compatible = "mediatek,mt8192-mmsys",
-		.data = &mt8192_mmsys_driver_data,
-	},
-	{	/* deprecated compatible */
-		.compatible = "mediatek,mt8195-mmsys",
-		.data = &mt8195_vdosys0_driver_data,
-	},
-	{
-		.compatible = "mediatek,mt8195-vdosys0",
-		.data = &mt8195_vdosys0_driver_data,
-	},
-	{
-		.compatible = "mediatek,mt8195-vdosys1",
-		.data = &mt8195_vdosys1_driver_data,
-	},
-	{
-		.compatible = "mediatek,mt8195-vppsys0",
-		.data = &mt8195_vppsys0_driver_data,
-	},
-	{
-		.compatible = "mediatek,mt8195-vppsys1",
-		.data = &mt8195_vppsys1_driver_data,
-	},
-	{
-		.compatible = "mediatek,mt8365-mmsys",
-		.data = &mt8365_mmsys_driver_data,
-	},
-	{ }
+	{ .compatible = "mediatek,mt2701-mmsys", .data = &mt2701_mmsys_driver_data },
+	{ .compatible = "mediatek,mt2712-mmsys", .data = &mt2712_mmsys_driver_data },
+	{ .compatible = "mediatek,mt6779-mmsys", .data = &mt6779_mmsys_driver_data },
+	{ .compatible = "mediatek,mt6797-mmsys", .data = &mt6797_mmsys_driver_data },
+	{ .compatible = "mediatek,mt8167-mmsys", .data = &mt8167_mmsys_driver_data },
+	{ .compatible = "mediatek,mt8173-mmsys", .data = &mt8173_mmsys_driver_data },
+	{ .compatible = "mediatek,mt8183-mmsys", .data = &mt8183_mmsys_driver_data },
+	{ .compatible = "mediatek,mt8186-mmsys", .data = &mt8186_mmsys_driver_data },
+	{ .compatible = "mediatek,mt8188-vdosys0", .data = &mt8188_vdosys0_driver_data },
+	{ .compatible = "mediatek,mt8192-mmsys", .data = &mt8192_mmsys_driver_data },
+	/* "mediatek,mt8195-mmsys" compatible is deprecated */
+	{ .compatible = "mediatek,mt8195-mmsys", .data = &mt8195_vdosys0_driver_data },
+	{ .compatible = "mediatek,mt8195-vdosys0", .data = &mt8195_vdosys0_driver_data },
+	{ .compatible = "mediatek,mt8195-vdosys1", .data = &mt8195_vdosys1_driver_data },
+	{ .compatible = "mediatek,mt8195-vppsys0", .data = &mt8195_vppsys0_driver_data },
+	{ .compatible = "mediatek,mt8195-vppsys1", .data = &mt8195_vppsys1_driver_data },
+	{ .compatible = "mediatek,mt8365-mmsys", .data = &mt8365_mmsys_driver_data },
+	{ /* sentinel */ }
 };
 
 static struct platform_driver mtk_mmsys_drv = {
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v1 4/9] soc: mediatek: mtk-mmsys: Add MODULE_DEVICE_TABLE() to allow auto-load
  2023-02-16 13:00 [PATCH v1 0/9] soc/mediatek: Cleanup mmsys, mutex, cmdq header AngeloGioacchino Del Regno
                   ` (2 preceding siblings ...)
  2023-02-16 13:00 ` [PATCH v1 3/9] soc: mediatek: mtk-mmsys: Compress of_device_id array entries AngeloGioacchino Del Regno
@ 2023-02-16 13:00 ` AngeloGioacchino Del Regno
  2023-02-21  7:05   ` Chen-Yu Tsai
  2023-02-16 13:00 ` [PATCH v1 5/9] soc: mediatek: mtk-mutex: Compress of_device_id array entries AngeloGioacchino Del Regno
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-16 13:00 UTC (permalink / raw)
  To: matthias.bgg
  Cc: jason-jh.lin, chunkuang.hu, linux-kernel, linux-arm-kernel,
	linux-mediatek, AngeloGioacchino Del Regno

Allow module auto-loading by adding a MODULE_DEVICE_TABLE for
of_match_mmsys.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 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-mmsys.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[] = {
 	{ .compatible = "mediatek,mt8365-mmsys", .data = &mt8365_mmsys_driver_data },
 	{ /* sentinel */ }
 };
+MODULE_DEVICE_TABLE(of, of_match_mtk_mmsys);
 
 static struct platform_driver mtk_mmsys_drv = {
 	.driver = {
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v1 5/9] soc: mediatek: mtk-mutex: Compress of_device_id array entries
  2023-02-16 13:00 [PATCH v1 0/9] soc/mediatek: Cleanup mmsys, mutex, cmdq header AngeloGioacchino Del Regno
                   ` (3 preceding siblings ...)
  2023-02-16 13:00 ` [PATCH v1 4/9] soc: mediatek: mtk-mmsys: Add MODULE_DEVICE_TABLE() to allow auto-load AngeloGioacchino Del Regno
@ 2023-02-16 13:00 ` AngeloGioacchino Del Regno
  2023-02-21  7:11   ` Chen-Yu Tsai
  2023-02-16 13:00 ` [PATCH v1 6/9] soc: mediatek: mtk-mutex: Replace max handles number with definition AngeloGioacchino Del Regno
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-16 13:00 UTC (permalink / raw)
  To: matthias.bgg
  Cc: jason-jh.lin, chunkuang.hu, linux-kernel, linux-arm-kernel,
	linux-mediatek, AngeloGioacchino Del Regno

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 <angelogioacchino.delregno@collabora.com>
---
 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-mutex.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 *pdev)
 }
 
 static const struct of_device_id mutex_driver_dt_match[] = {
-	{ .compatible = "mediatek,mt2701-disp-mutex",
-	  .data = &mt2701_mutex_driver_data},
-	{ .compatible = "mediatek,mt2712-disp-mutex",
-	  .data = &mt2712_mutex_driver_data},
-	{ .compatible = "mediatek,mt6795-disp-mutex",
-	  .data = &mt6795_mutex_driver_data},
-	{ .compatible = "mediatek,mt8167-disp-mutex",
-	  .data = &mt8167_mutex_driver_data},
-	{ .compatible = "mediatek,mt8173-disp-mutex",
-	  .data = &mt8173_mutex_driver_data},
-	{ .compatible = "mediatek,mt8183-disp-mutex",
-	  .data = &mt8183_mutex_driver_data},
-	{ .compatible = "mediatek,mt8186-disp-mutex",
-	  .data = &mt8186_mutex_driver_data},
-	{ .compatible = "mediatek,mt8186-mdp3-mutex",
-	  .data = &mt8186_mdp_mutex_driver_data},
-	{ .compatible = "mediatek,mt8188-disp-mutex",
-	  .data = &mt8188_mutex_driver_data},
-	{ .compatible = "mediatek,mt8192-disp-mutex",
-	  .data = &mt8192_mutex_driver_data},
-	{ .compatible = "mediatek,mt8195-disp-mutex",
-	  .data = &mt8195_mutex_driver_data},
-	{ .compatible = "mediatek,mt8365-disp-mutex",
-	  .data = &mt8365_mutex_driver_data},
-	{},
+	{ .compatible = "mediatek,mt2701-disp-mutex", .data = &mt2701_mutex_driver_data },
+	{ .compatible = "mediatek,mt2712-disp-mutex", .data = &mt2712_mutex_driver_data },
+	{ .compatible = "mediatek,mt6795-disp-mutex", .data = &mt6795_mutex_driver_data },
+	{ .compatible = "mediatek,mt8167-disp-mutex", .data = &mt8167_mutex_driver_data },
+	{ .compatible = "mediatek,mt8173-disp-mutex", .data = &mt8173_mutex_driver_data },
+	{ .compatible = "mediatek,mt8183-disp-mutex", .data = &mt8183_mutex_driver_data },
+	{ .compatible = "mediatek,mt8186-disp-mutex", .data = &mt8186_mutex_driver_data },
+	{ .compatible = "mediatek,mt8186-mdp3-mutex", .data = &mt8186_mdp_mutex_driver_data },
+	{ .compatible = "mediatek,mt8188-disp-mutex", .data = &mt8188_mutex_driver_data },
+	{ .compatible = "mediatek,mt8192-disp-mutex", .data = &mt8192_mutex_driver_data },
+	{ .compatible = "mediatek,mt8195-disp-mutex", .data = &mt8195_mutex_driver_data },
+	{ .compatible = "mediatek,mt8365-disp-mutex", .data = &mt8365_mutex_driver_data },
+	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, mutex_driver_dt_match);
 
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v1 6/9] soc: mediatek: mtk-mutex: Replace max handles number with definition
  2023-02-16 13:00 [PATCH v1 0/9] soc/mediatek: Cleanup mmsys, mutex, cmdq header AngeloGioacchino Del Regno
                   ` (4 preceding siblings ...)
  2023-02-16 13:00 ` [PATCH v1 5/9] soc: mediatek: mtk-mutex: Compress of_device_id array entries AngeloGioacchino Del Regno
@ 2023-02-16 13:00 ` AngeloGioacchino Del Regno
  2023-02-21  7:12   ` Chen-Yu Tsai
  2023-02-16 13:00 ` [PATCH v1 7/9] soc: mediatek: mtk-mutex: Use module_platform_driver() macro AngeloGioacchino Del Regno
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-16 13:00 UTC (permalink / raw)
  To: matthias.bgg
  Cc: jason-jh.lin, chunkuang.hu, linux-kernel, linux-arm-kernel,
	linux-mediatek, AngeloGioacchino Del Regno

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 <angelogioacchino.delregno@collabora.com>
---
 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-mutex.c
index 5c875139425c..fb6bd0838892 100644
--- a/drivers/soc/mediatek/mtk-mutex.c
+++ b/drivers/soc/mediatek/mtk-mutex.c
@@ -14,6 +14,8 @@
 #include <linux/soc/mediatek/mtk-mutex.h>
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
+#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)
 
 struct mtk_mutex {
-	int id;
+	u8 id;
 	bool claimed;
 };
 
@@ -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 = dev_get_drvdata(dev);
 	int i;
 
-	for (i = 0; i < 10; i++)
+	for (i = 0; i < MTK_MUTEX_MAX_HANDLES; i++)
 		if (!mtx->mutex[i].claimed) {
 			mtx->mutex[i].claimed = true;
 			return &mtx->mutex[i];
@@ -888,7 +890,7 @@ static int mtk_mutex_probe(struct platform_device *pdev)
 	if (!mtx)
 		return -ENOMEM;
 
-	for (i = 0; i < 10; i++)
+	for (i = 0; i < MTK_MUTEX_MAX_HANDLES; i++)
 		mtx->mutex[i].id = i;
 
 	mtx->data = of_device_get_match_data(dev);
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v1 7/9] soc: mediatek: mtk-mutex: Use module_platform_driver() macro
  2023-02-16 13:00 [PATCH v1 0/9] soc/mediatek: Cleanup mmsys, mutex, cmdq header AngeloGioacchino Del Regno
                   ` (5 preceding siblings ...)
  2023-02-16 13:00 ` [PATCH v1 6/9] soc: mediatek: mtk-mutex: Replace max handles number with definition AngeloGioacchino Del Regno
@ 2023-02-16 13:00 ` AngeloGioacchino Del Regno
  2023-02-21  7:12   ` Chen-Yu Tsai
  2023-02-16 13:00 ` [PATCH v1 8/9] soc: mediatek: cmdq: Add inline functions for !CONFIG_MTK_CMDQ AngeloGioacchino Del Regno
  2023-02-16 13:00 ` [PATCH v1 9/9] soc: mediatek: Cleanup ifdefs for IS_REACHABLE(CONFIG_MTK_CMDQ) AngeloGioacchino Del Regno
  8 siblings, 1 reply; 19+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-16 13:00 UTC (permalink / raw)
  To: matthias.bgg
  Cc: jason-jh.lin, chunkuang.hu, linux-kernel, linux-arm-kernel,
	linux-mediatek, AngeloGioacchino Del Regno

Replace open-coded init/exit calls with the module_platform_driver()
macro being equivalent.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 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-mutex.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 = {
 		.of_match_table = 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);
 
 MODULE_AUTHOR("Yongqiang Niu <yongqiang.niu@mediatek.com>");
 MODULE_DESCRIPTION("MediaTek SoC MUTEX driver");
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v1 8/9] soc: mediatek: cmdq: Add inline functions for !CONFIG_MTK_CMDQ
  2023-02-16 13:00 [PATCH v1 0/9] soc/mediatek: Cleanup mmsys, mutex, cmdq header AngeloGioacchino Del Regno
                   ` (6 preceding siblings ...)
  2023-02-16 13:00 ` [PATCH v1 7/9] soc: mediatek: mtk-mutex: Use module_platform_driver() macro AngeloGioacchino Del Regno
@ 2023-02-16 13:00 ` AngeloGioacchino Del Regno
  2023-02-21  7:14   ` Chen-Yu Tsai
  2023-02-16 13:00 ` [PATCH v1 9/9] soc: mediatek: Cleanup ifdefs for IS_REACHABLE(CONFIG_MTK_CMDQ) AngeloGioacchino Del Regno
  8 siblings, 1 reply; 19+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-16 13:00 UTC (permalink / raw)
  To: matthias.bgg
  Cc: jason-jh.lin, chunkuang.hu, linux-kernel, linux-arm-kernel,
	linux-mediatek, AngeloGioacchino Del Regno

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 <angelogioacchino.delregno@collabora.com>
---
 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/mediatek/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;
 };
 
+#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);
 
+#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 offset, 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_addr_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_addr_reg_idx,
+					 u16 addr_low, u32 value)
+{
+	return -ENOENT;
+}
+
+static inline int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_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 value)
+{
+	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__ */
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v1 9/9] soc: mediatek: Cleanup ifdefs for IS_REACHABLE(CONFIG_MTK_CMDQ)
  2023-02-16 13:00 [PATCH v1 0/9] soc/mediatek: Cleanup mmsys, mutex, cmdq header AngeloGioacchino Del Regno
                   ` (7 preceding siblings ...)
  2023-02-16 13:00 ` [PATCH v1 8/9] soc: mediatek: cmdq: Add inline functions for !CONFIG_MTK_CMDQ AngeloGioacchino Del Regno
@ 2023-02-16 13:00 ` AngeloGioacchino Del Regno
  2023-02-21  7:15   ` Chen-Yu Tsai
  8 siblings, 1 reply; 19+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-16 13:00 UTC (permalink / raw)
  To: matthias.bgg
  Cc: jason-jh.lin, chunkuang.hu, linux-kernel, linux-arm-kernel,
	linux-mediatek, AngeloGioacchino Del Regno

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 <angelogioacchino.delregno@collabora.com>
---
 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-mmsys.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;
 
-#if IS_REACHABLE(CONFIG_MTK_CMDQ)
-	if (cmdq_pkt) {
-		if (mmsys->cmdq_base.size == 0) {
-			pr_err("mmsys lose gce property, failed to update mmsys bits with cmdq");
+	if (mmsys->cmdq_base.size && cmdq_pkt) {
+		ret = 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 = readl_relaxed(mmsys->regs + offset);
 	tmp = (tmp & ~mask) | (val & mask);
 	writel_relaxed(tmp, mmsys->regs + offset);
@@ -332,11 +329,10 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
 		}
 	}
 
-#if IS_REACHABLE(CONFIG_MTK_CMDQ)
+	/* CMDQ is optional */
 	ret = cmdq_dev_get_client_reg(dev, &mmsys->cmdq_base, 0);
 	if (ret)
 		dev_dbg(dev, "No mediatek,gce-client-reg!\n");
-#endif
 
 	platform_set_drvdata(pdev, mmsys);
 
diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mutex.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 = container_of(mutex, struct mtk_mutex_ctx,
 						 mutex[mutex->id]);
-#if IS_REACHABLE(CONFIG_MTK_CMDQ)
 	struct cmdq_pkt *cmdq_pkt = (struct cmdq_pkt *)pkt;
 
 	WARN_ON(&mtx->mutex[mutex->id] != mutex);
 
 	if (!mtx->cmdq_reg.size) {
 		dev_err(mtx->dev, "mediatek,gce-client-reg hasn't been set");
-		return -EINVAL;
+		return -ENODEV;
 	}
 
 	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);
 
@@ -881,10 +876,7 @@ static int mtk_mutex_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct mtk_mutex_ctx *mtx;
 	struct resource *regs;
-	int i;
-#if IS_REACHABLE(CONFIG_MTK_CMDQ)
-	int ret;
-#endif
+	int i, ret;
 
 	mtx = devm_kzalloc(dev, sizeof(*mtx), GFP_KERNEL);
 	if (!mtx)
@@ -911,11 +903,10 @@ static int mtk_mutex_probe(struct platform_device *pdev)
 	}
 	mtx->addr = regs->start;
 
-#if IS_REACHABLE(CONFIG_MTK_CMDQ)
+	/* CMDQ is optional */
 	ret = cmdq_dev_get_client_reg(dev, &mtx->cmdq_reg, 0);
 	if (ret)
 		dev_dbg(dev, "No mediatek,gce-client-reg!\n");
-#endif
 
 	platform_set_drvdata(pdev, mtx);
 
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v1 2/9] soc: mediatek: mtk-mmsys: Use module_platform_driver() macro
  2023-02-16 13:00 ` [PATCH v1 2/9] soc: mediatek: mtk-mmsys: Use module_platform_driver() macro AngeloGioacchino Del Regno
@ 2023-02-21  7:00   ` Chen-Yu Tsai
  0 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2023-02-21  7:00 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: matthias.bgg, jason-jh.lin, chunkuang.hu, linux-kernel,
	linux-arm-kernel, linux-mediatek

On Thu, Feb 16, 2023 at 9:00 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> 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 <angelogioacchino.delregno@collabora.com>

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v1 1/9] soc: mediatek: mtk-mmsys: Add .remove() callback
  2023-02-16 13:00 ` [PATCH v1 1/9] soc: mediatek: mtk-mmsys: Add .remove() callback AngeloGioacchino Del Regno
@ 2023-02-21  7:04   ` Chen-Yu Tsai
  0 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2023-02-21  7:04 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: matthias.bgg, jason-jh.lin, chunkuang.hu, linux-kernel,
	linux-arm-kernel, linux-mediatek

On Thu, Feb 16, 2023 at 9:01 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Add a .remove() callback to correctly unregister the multimedia clocks
> and DRM drivers.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v1 3/9] soc: mediatek: mtk-mmsys: Compress of_device_id array entries
  2023-02-16 13:00 ` [PATCH v1 3/9] soc: mediatek: mtk-mmsys: Compress of_device_id array entries AngeloGioacchino Del Regno
@ 2023-02-21  7:05   ` Chen-Yu Tsai
  0 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2023-02-21  7:05 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: matthias.bgg, jason-jh.lin, chunkuang.hu, linux-kernel,
	linux-arm-kernel, linux-mediatek

On Thu, Feb 16, 2023 at 9:01 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> 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 <angelogioacchino.delregno@collabora.com>

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v1 4/9] soc: mediatek: mtk-mmsys: Add MODULE_DEVICE_TABLE() to allow auto-load
  2023-02-16 13:00 ` [PATCH v1 4/9] soc: mediatek: mtk-mmsys: Add MODULE_DEVICE_TABLE() to allow auto-load AngeloGioacchino Del Regno
@ 2023-02-21  7:05   ` Chen-Yu Tsai
  0 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2023-02-21  7:05 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: matthias.bgg, jason-jh.lin, chunkuang.hu, linux-kernel,
	linux-arm-kernel, linux-mediatek

On Thu, Feb 16, 2023 at 9:01 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Allow module auto-loading by adding a MODULE_DEVICE_TABLE for
> of_match_mmsys.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v1 5/9] soc: mediatek: mtk-mutex: Compress of_device_id array entries
  2023-02-16 13:00 ` [PATCH v1 5/9] soc: mediatek: mtk-mutex: Compress of_device_id array entries AngeloGioacchino Del Regno
@ 2023-02-21  7:11   ` Chen-Yu Tsai
  0 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2023-02-21  7:11 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: matthias.bgg, jason-jh.lin, chunkuang.hu, linux-kernel,
	linux-arm-kernel, linux-mediatek

On Thu, Feb 16, 2023 at 9:02 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> 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 <angelogioacchino.delregno@collabora.com>
> ---
>  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-mutex.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 *pdev)
>  }
>
>  static const struct of_device_id mutex_driver_dt_match[] = {
> -       { .compatible = "mediatek,mt2701-disp-mutex",
> -         .data = &mt2701_mutex_driver_data},
> -       { .compatible = "mediatek,mt2712-disp-mutex",
> -         .data = &mt2712_mutex_driver_data},
> -       { .compatible = "mediatek,mt6795-disp-mutex",
> -         .data = &mt6795_mutex_driver_data},
> -       { .compatible = "mediatek,mt8167-disp-mutex",
> -         .data = &mt8167_mutex_driver_data},
> -       { .compatible = "mediatek,mt8173-disp-mutex",
> -         .data = &mt8173_mutex_driver_data},
> -       { .compatible = "mediatek,mt8183-disp-mutex",
> -         .data = &mt8183_mutex_driver_data},
> -       { .compatible = "mediatek,mt8186-disp-mutex",
> -         .data = &mt8186_mutex_driver_data},
> -       { .compatible = "mediatek,mt8186-mdp3-mutex",
> -         .data = &mt8186_mdp_mutex_driver_data},
> -       { .compatible = "mediatek,mt8188-disp-mutex",
> -         .data = &mt8188_mutex_driver_data},
> -       { .compatible = "mediatek,mt8192-disp-mutex",
> -         .data = &mt8192_mutex_driver_data},
> -       { .compatible = "mediatek,mt8195-disp-mutex",
> -         .data = &mt8195_mutex_driver_data},

This conflicts with the MT8195 VPP mutex patch already in Matthias's
temporary branch: http://git.kernel.org/matthias.bgg/h/v6.3-tmp/soc

ChenYu

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v1 6/9] soc: mediatek: mtk-mutex: Replace max handles number with definition
  2023-02-16 13:00 ` [PATCH v1 6/9] soc: mediatek: mtk-mutex: Replace max handles number with definition AngeloGioacchino Del Regno
@ 2023-02-21  7:12   ` Chen-Yu Tsai
  0 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2023-02-21  7:12 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: matthias.bgg, jason-jh.lin, chunkuang.hu, linux-kernel,
	linux-arm-kernel, linux-mediatek

On Thu, Feb 16, 2023 at 9:02 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> 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.

Depending on alignment of bool, we might not get that saving.

> This cleanup brings no functional changes.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v1 7/9] soc: mediatek: mtk-mutex: Use module_platform_driver() macro
  2023-02-16 13:00 ` [PATCH v1 7/9] soc: mediatek: mtk-mutex: Use module_platform_driver() macro AngeloGioacchino Del Regno
@ 2023-02-21  7:12   ` Chen-Yu Tsai
  0 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2023-02-21  7:12 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: matthias.bgg, jason-jh.lin, chunkuang.hu, linux-kernel,
	linux-arm-kernel, linux-mediatek

On Thu, Feb 16, 2023 at 9:02 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Replace open-coded init/exit calls with the module_platform_driver()
> macro being equivalent.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v1 8/9] soc: mediatek: cmdq: Add inline functions for !CONFIG_MTK_CMDQ
  2023-02-16 13:00 ` [PATCH v1 8/9] soc: mediatek: cmdq: Add inline functions for !CONFIG_MTK_CMDQ AngeloGioacchino Del Regno
@ 2023-02-21  7:14   ` Chen-Yu Tsai
  0 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2023-02-21  7:14 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: matthias.bgg, jason-jh.lin, chunkuang.hu, linux-kernel,
	linux-arm-kernel, linux-mediatek

On Thu, Feb 16, 2023 at 9:03 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> 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 <angelogioacchino.delregno@collabora.com>

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v1 9/9] soc: mediatek: Cleanup ifdefs for IS_REACHABLE(CONFIG_MTK_CMDQ)
  2023-02-16 13:00 ` [PATCH v1 9/9] soc: mediatek: Cleanup ifdefs for IS_REACHABLE(CONFIG_MTK_CMDQ) AngeloGioacchino Del Regno
@ 2023-02-21  7:15   ` Chen-Yu Tsai
  0 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2023-02-21  7:15 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: matthias.bgg, jason-jh.lin, chunkuang.hu, linux-kernel,
	linux-arm-kernel, linux-mediatek

On Thu, Feb 16, 2023 at 9:03 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> 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 <angelogioacchino.delregno@collabora.com>

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-02-21  7:16 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-16 13:00 [PATCH v1 0/9] soc/mediatek: Cleanup mmsys, mutex, cmdq header AngeloGioacchino Del Regno
2023-02-16 13:00 ` [PATCH v1 1/9] soc: mediatek: mtk-mmsys: Add .remove() callback AngeloGioacchino Del Regno
2023-02-21  7:04   ` Chen-Yu Tsai
2023-02-16 13:00 ` [PATCH v1 2/9] soc: mediatek: mtk-mmsys: Use module_platform_driver() macro AngeloGioacchino Del Regno
2023-02-21  7:00   ` Chen-Yu Tsai
2023-02-16 13:00 ` [PATCH v1 3/9] soc: mediatek: mtk-mmsys: Compress of_device_id array entries AngeloGioacchino Del Regno
2023-02-21  7:05   ` Chen-Yu Tsai
2023-02-16 13:00 ` [PATCH v1 4/9] soc: mediatek: mtk-mmsys: Add MODULE_DEVICE_TABLE() to allow auto-load AngeloGioacchino Del Regno
2023-02-21  7:05   ` Chen-Yu Tsai
2023-02-16 13:00 ` [PATCH v1 5/9] soc: mediatek: mtk-mutex: Compress of_device_id array entries AngeloGioacchino Del Regno
2023-02-21  7:11   ` Chen-Yu Tsai
2023-02-16 13:00 ` [PATCH v1 6/9] soc: mediatek: mtk-mutex: Replace max handles number with definition AngeloGioacchino Del Regno
2023-02-21  7:12   ` Chen-Yu Tsai
2023-02-16 13:00 ` [PATCH v1 7/9] soc: mediatek: mtk-mutex: Use module_platform_driver() macro AngeloGioacchino Del Regno
2023-02-21  7:12   ` Chen-Yu Tsai
2023-02-16 13:00 ` [PATCH v1 8/9] soc: mediatek: cmdq: Add inline functions for !CONFIG_MTK_CMDQ AngeloGioacchino Del Regno
2023-02-21  7:14   ` Chen-Yu Tsai
2023-02-16 13:00 ` [PATCH v1 9/9] soc: mediatek: Cleanup ifdefs for IS_REACHABLE(CONFIG_MTK_CMDQ) AngeloGioacchino Del Regno
2023-02-21  7:15   ` Chen-Yu Tsai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).