linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v13 0/6] Add mutex support for MDP
@ 2022-03-15  6:10 Moudy Ho
  2022-03-15  6:10 ` [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX Moudy Ho
                   ` (5 more replies)
  0 siblings, 6 replies; 24+ messages in thread
From: Moudy Ho @ 2022-03-15  6:10 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	AngeloGioacchino Del Regno, Maoguang Meng, daoyuan huang,
	Ping-Hsun Wu, menghui.lin, sj.huang, allen-kh.cheng, randy.wu,
	moudy.ho, jason-jh.lin, roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Change since V12:
- Rebase on linux-next
- Remove ISP related settings in MMSYS
- Removed CMDQ operations previously used by MDP in MMSYS
- Move mediatek MUTEX dt-binding path
- Add additional property in MUTEX for CMDQ operations

Change since V11:
- Rebase on v5.17-rc6.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/commit/?h=v5.17-next/soc&id=5f9b5b757e44de47ebdc116c14b90e3cc8bc7acb
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/commit/?h=v5.17-next/soc&id=831785f0e5b919c29e1bc5f9a74e9ebd38289e24
[3]: https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/commit/?h=v5.17-next/soc&id=15f1768365aed810826a61fef4a744437aa5b426

Change since v10:
- For some ISP application scenarios, such as preview and recording
  at the same time.
  The routing table needs to be discarded, and the calculation result
  on the SCP side is used to write a suitable mux setting for
  1 input and 2 output.
- Adjust the GCE client register parsing method to avoid redundant warning logs.

Change since v9:
- Add API for MDP getting mutex mod.

Hi,

This patch splits mmsys and mutex settings from Media Data Path 3 (MDP3),
and original mailling list list below:
https://patchwork.kernel.org/project/linux-mediatek/cover/20211201095031.31606-1-moudy.ho@mediatek.com/
Corresponding settings and interfaces are added for MDP operation in the
mutex drivers, which increases the independence of the modules

Moudy Ho (6):
  soc: mediatek: mutex: add common interface to accommodate multiple
    modules operationg MUTEX
  soc: mediatek: mutex: add 8183 MUTEX MOD settings for MDP
  dt-bindings: soc: mediatek: move out common module from display folder
  dt-bindings: soc: mediatek: add gce-client-reg for MUTEX
  dts: arm64: mt8183: add GCE client property for Mediatek MUTEX
  soc: mediatek: mutex: add functions that operate registers by CMDQ

 .../mediatek/mediatek,mutex.yaml              |  18 +-
 arch/arm64/boot/dts/mediatek/mt8183.dtsi      |   1 +
 drivers/soc/mediatek/mtk-mutex.c              | 185 +++++++++++++++++-
 include/linux/soc/mediatek/mtk-mutex.h        |  35 ++++
 4 files changed, 231 insertions(+), 8 deletions(-)
 rename Documentation/devicetree/bindings/{display => soc}/mediatek/mediatek,mutex.yaml (77%)

-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
  2022-03-15  6:10 [PATCH v13 0/6] Add mutex support for MDP Moudy Ho
@ 2022-03-15  6:10 ` Moudy Ho
  2022-03-15  9:10   ` AngeloGioacchino Del Regno
  2022-03-16  2:25   ` CK Hu
  2022-03-15  6:10 ` [PATCH v13 2/6] soc: mediatek: mutex: add 8183 MUTEX MOD settings for MDP Moudy Ho
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 24+ messages in thread
From: Moudy Ho @ 2022-03-15  6:10 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	AngeloGioacchino Del Regno, Maoguang Meng, daoyuan huang,
	Ping-Hsun Wu, menghui.lin, sj.huang, allen-kh.cheng, randy.wu,
	moudy.ho, jason-jh.lin, roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

In order to allow multiple modules to operate MUTEX hardware through
a common interfrace, a flexible index "mtk_mutex_table_index" needs to
be added to replace original component ID so that like DDP and MDP
can add their own MUTEX table settings independently.

In addition, 4 generic interface "mtk_mutex_set_mod", "mtk_mutex_set_sof",
"mtk_mutex_clear_mod" and "mtk_mutex_clear_sof" have been added, which is
expected to replace the "mtk_mutex_add_comp" and "mtk_mutex_remove_comp"
pair originally dedicated to DDP in the future.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
---
 drivers/soc/mediatek/mtk-mutex.c       | 122 +++++++++++++++++++++++++
 include/linux/soc/mediatek/mtk-mutex.h |  33 +++++++
 2 files changed, 155 insertions(+)

diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mutex.c
index aaf8fc1abb43..778b01ce9e8f 100644
--- a/drivers/soc/mediatek/mtk-mutex.c
+++ b/drivers/soc/mediatek/mtk-mutex.c
@@ -156,6 +156,7 @@ struct mtk_mutex_data {
 	const unsigned int *mutex_sof;
 	const unsigned int mutex_mod_reg;
 	const unsigned int mutex_sof_reg;
+	const unsigned long long *mutex_table_mod;
 	const bool no_clk;
 };
 
@@ -445,6 +446,84 @@ void mtk_mutex_add_comp(struct mtk_mutex *mutex,
 }
 EXPORT_SYMBOL_GPL(mtk_mutex_add_comp);
 
+void mtk_mutex_set_mod(struct mtk_mutex *mutex,
+		       enum mtk_mutex_table_index idx)
+{
+	struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx,
+						 mutex[mutex->id]);
+	unsigned int reg;
+	unsigned int offset;
+
+	WARN_ON(&mtx->mutex[mutex->id] != mutex);
+
+	if (idx == MUTEX_TABLE_IDX_NONE ||
+	    idx >= MUTEX_TABLE_IDX_MAX)
+		return;
+
+	if (mtx->data->mutex_table_mod[idx] <= BIT(31)) {
+		offset = DISP_REG_MUTEX_MOD(mtx->data->mutex_mod_reg,
+					    mutex->id);
+		reg = readl_relaxed(mtx->regs + offset);
+		reg |= mtx->data->mutex_table_mod[idx];
+		writel_relaxed(reg, mtx->regs + offset);
+	} else {
+		offset = DISP_REG_MUTEX_MOD2(mutex->id);
+		reg = readl_relaxed(mtx->regs + offset);
+		reg |= (mtx->data->mutex_table_mod[idx] >> 32);
+		writel_relaxed(reg, mtx->regs + offset);
+	}
+}
+EXPORT_SYMBOL_GPL(mtk_mutex_set_mod);
+
+void mtk_mutex_set_sof(struct mtk_mutex *mutex,
+		       enum mtk_mutex_table_index idx)
+{
+	struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx,
+						 mutex[mutex->id]);
+	unsigned int sof_id;
+
+	WARN_ON(&mtx->mutex[mutex->id] != mutex);
+
+	if (idx == MUTEX_TABLE_IDX_NONE ||
+	    idx >= MUTEX_TABLE_IDX_MAX)
+		return;
+
+	switch (idx) {
+	case MUTEX_TABLE_IDX_DDP_DSI0:
+		sof_id = MUTEX_SOF_DSI0;
+		break;
+	case MUTEX_TABLE_IDX_DDP_DSI1:
+		sof_id = MUTEX_SOF_DSI0;
+		break;
+	case MUTEX_TABLE_IDX_DDP_DSI2:
+		sof_id = MUTEX_SOF_DSI2;
+		break;
+	case MUTEX_TABLE_IDX_DDP_DSI3:
+		sof_id = MUTEX_SOF_DSI3;
+		break;
+	case MUTEX_TABLE_IDX_DDP_DPI0:
+		sof_id = MUTEX_SOF_DPI0;
+		break;
+	case MUTEX_TABLE_IDX_DDP_DPI1:
+		sof_id = MUTEX_SOF_DPI1;
+		break;
+	case MUTEX_TABLE_IDX_DDP_DP_INTF0:
+		sof_id = MUTEX_SOF_DP_INTF0;
+		break;
+	case MUTEX_TABLE_IDX_DDP_DP_INTF1:
+		sof_id = MUTEX_SOF_DP_INTF1;
+		break;
+	default:
+		sof_id = MUTEX_SOF_SINGLE_MODE;
+		break;
+	}
+
+	writel_relaxed(mtx->data->mutex_sof[sof_id],
+		       mtx->regs +
+		       DISP_REG_MUTEX_SOF(mtx->data->mutex_sof_reg, mutex->id));
+}
+EXPORT_SYMBOL_GPL(mtk_mutex_set_sof);
+
 void mtk_mutex_remove_comp(struct mtk_mutex *mutex,
 			   enum mtk_ddp_comp_id id)
 {
@@ -485,6 +564,49 @@ void mtk_mutex_remove_comp(struct mtk_mutex *mutex,
 }
 EXPORT_SYMBOL_GPL(mtk_mutex_remove_comp);
 
+void mtk_mutex_clear_mod(struct mtk_mutex *mutex,
+			 enum mtk_mutex_table_index idx)
+{
+	struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx,
+						 mutex[mutex->id]);
+	unsigned int reg;
+	unsigned int offset;
+
+	WARN_ON(&mtx->mutex[mutex->id] != mutex);
+
+	if (idx == MUTEX_TABLE_IDX_NONE ||
+	    idx >= MUTEX_TABLE_IDX_MAX)
+		return;
+
+	if (mtx->data->mutex_table_mod[idx] <= BIT(31)) {
+		offset = DISP_REG_MUTEX_MOD(mtx->data->mutex_mod_reg,
+					    mutex->id);
+		reg = readl_relaxed(mtx->regs + offset);
+		reg &= ~(mtx->data->mutex_table_mod[idx]);
+		writel_relaxed(reg, mtx->regs + offset);
+	} else {
+		offset = DISP_REG_MUTEX_MOD2(mutex->id);
+		reg = readl_relaxed(mtx->regs + offset);
+		reg &= ~(mtx->data->mutex_table_mod[idx] >> 32);
+		writel_relaxed(reg, mtx->regs + offset);
+	}
+}
+EXPORT_SYMBOL_GPL(mtk_mutex_clear_mod);
+
+void mtk_mutex_clear_sof(struct mtk_mutex *mutex)
+{
+	struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx,
+						 mutex[mutex->id]);
+
+	WARN_ON(&mtx->mutex[mutex->id] != mutex);
+
+	writel_relaxed(MUTEX_SOF_SINGLE_MODE,
+		       mtx->regs +
+		       DISP_REG_MUTEX_SOF(mtx->data->mutex_sof_reg,
+					  mutex->id));
+}
+EXPORT_SYMBOL_GPL(mtk_mutex_clear_sof);
+
 void mtk_mutex_enable(struct mtk_mutex *mutex)
 {
 	struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx,
diff --git a/include/linux/soc/mediatek/mtk-mutex.h b/include/linux/soc/mediatek/mtk-mutex.h
index 6fe4ffbde290..c8355bb0e6d6 100644
--- a/include/linux/soc/mediatek/mtk-mutex.h
+++ b/include/linux/soc/mediatek/mtk-mutex.h
@@ -10,14 +10,47 @@ struct regmap;
 struct device;
 struct mtk_mutex;
 
+enum mtk_mutex_table_index {
+	MUTEX_TABLE_IDX_NONE = 0,	/* Invalid engine */
+
+	/* MDP table index */
+	MUTEX_TABLE_IDX_MDP_RDMA0,
+	MUTEX_TABLE_IDX_MDP_RSZ0,
+	MUTEX_TABLE_IDX_MDP_RSZ1,
+	MUTEX_TABLE_IDX_MDP_TDSHP0,
+	MUTEX_TABLE_IDX_MDP_WROT0,
+	MUTEX_TABLE_IDX_MDP_WDMA,
+	MUTEX_TABLE_IDX_MDP_AAL0,
+	MUTEX_TABLE_IDX_MDP_CCORR0,
+
+	/* DDP table index */
+	MUTEX_TABLE_IDX_DDP_DSI0,
+	MUTEX_TABLE_IDX_DDP_DSI1,
+	MUTEX_TABLE_IDX_DDP_DSI2,
+	MUTEX_TABLE_IDX_DDP_DSI3,
+	MUTEX_TABLE_IDX_DDP_DPI0,
+	MUTEX_TABLE_IDX_DDP_DPI1,
+	MUTEX_TABLE_IDX_DDP_DP_INTF0,
+	MUTEX_TABLE_IDX_DDP_DP_INTF1,
+
+	MUTEX_TABLE_IDX_MAX		/* ALWAYS keep at the end */
+};
+
 struct mtk_mutex *mtk_mutex_get(struct device *dev);
 int mtk_mutex_prepare(struct mtk_mutex *mutex);
 void mtk_mutex_add_comp(struct mtk_mutex *mutex,
 			enum mtk_ddp_comp_id id);
+void mtk_mutex_set_mod(struct mtk_mutex *mutex,
+		       enum mtk_mutex_table_index idx);
+void mtk_mutex_set_sof(struct mtk_mutex *mutex,
+		       enum mtk_mutex_table_index idx);
 void mtk_mutex_enable(struct mtk_mutex *mutex);
 void mtk_mutex_disable(struct mtk_mutex *mutex);
 void mtk_mutex_remove_comp(struct mtk_mutex *mutex,
 			   enum mtk_ddp_comp_id id);
+void mtk_mutex_clear_mod(struct mtk_mutex *mutex,
+			 enum mtk_mutex_table_index idx);
+void mtk_mutex_clear_sof(struct mtk_mutex *mutex);
 void mtk_mutex_unprepare(struct mtk_mutex *mutex);
 void mtk_mutex_put(struct mtk_mutex *mutex);
 void mtk_mutex_acquire(struct mtk_mutex *mutex);
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v13 2/6] soc: mediatek: mutex: add 8183 MUTEX MOD settings for MDP
  2022-03-15  6:10 [PATCH v13 0/6] Add mutex support for MDP Moudy Ho
  2022-03-15  6:10 ` [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX Moudy Ho
@ 2022-03-15  6:10 ` Moudy Ho
  2022-03-15  9:11   ` AngeloGioacchino Del Regno
  2022-03-16  3:31   ` CK Hu
  2022-03-15  6:10 ` [PATCH v13 3/6] dt-bindings: soc: mediatek: move out common module from display folder Moudy Ho
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 24+ messages in thread
From: Moudy Ho @ 2022-03-15  6:10 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	AngeloGioacchino Del Regno, Maoguang Meng, daoyuan huang,
	Ping-Hsun Wu, menghui.lin, sj.huang, allen-kh.cheng, randy.wu,
	moudy.ho, jason-jh.lin, roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

For the purpose of module independence, related settings should be moved
from MDP to the corresponding driver.
This patch adds 8183 MUTEX MOD settings for MDP.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
---
 drivers/soc/mediatek/mtk-mutex.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mutex.c
index 778b01ce9e8f..88fb4fc8f216 100644
--- a/drivers/soc/mediatek/mtk-mutex.c
+++ b/drivers/soc/mediatek/mtk-mutex.c
@@ -80,6 +80,15 @@
 #define MT8183_MUTEX_MOD_DISP_GAMMA0		16
 #define MT8183_MUTEX_MOD_DISP_DITHER0		17
 
+#define MT8183_MUTEX_MOD_MDP_RDMA0		BIT(2)
+#define MT8183_MUTEX_MOD_MDP_RSZ0		BIT(4)
+#define MT8183_MUTEX_MOD_MDP_RSZ1		BIT(5)
+#define MT8183_MUTEX_MOD_MDP_TDSHP0		BIT(6)
+#define MT8183_MUTEX_MOD_MDP_WROT0		BIT(7)
+#define MT8183_MUTEX_MOD_MDP_WDMA		BIT(8)
+#define MT8183_MUTEX_MOD_MDP_AAL0		BIT(23)
+#define MT8183_MUTEX_MOD_MDP_CCORR0		BIT(24)
+
 #define MT8173_MUTEX_MOD_DISP_OVL0		11
 #define MT8173_MUTEX_MOD_DISP_OVL1		12
 #define MT8173_MUTEX_MOD_DISP_RDMA0		13
@@ -244,6 +253,17 @@ static const unsigned int mt8183_mutex_mod[DDP_COMPONENT_ID_MAX] = {
 	[DDP_COMPONENT_WDMA0] = MT8183_MUTEX_MOD_DISP_WDMA0,
 };
 
+static const unsigned long long mt8183_mutex_table_mod[MUTEX_TABLE_IDX_MAX] = {
+	[MUTEX_TABLE_IDX_MDP_RDMA0] = MT8183_MUTEX_MOD_MDP_RDMA0,
+	[MUTEX_TABLE_IDX_MDP_RSZ0] = MT8183_MUTEX_MOD_MDP_RSZ0,
+	[MUTEX_TABLE_IDX_MDP_RSZ1] = MT8183_MUTEX_MOD_MDP_RSZ1,
+	[MUTEX_TABLE_IDX_MDP_TDSHP0] = MT8183_MUTEX_MOD_MDP_TDSHP0,
+	[MUTEX_TABLE_IDX_MDP_WROT0] = MT8183_MUTEX_MOD_MDP_WROT0,
+	[MUTEX_TABLE_IDX_MDP_WDMA] = MT8183_MUTEX_MOD_MDP_WDMA,
+	[MUTEX_TABLE_IDX_MDP_AAL0] = MT8183_MUTEX_MOD_MDP_AAL0,
+	[MUTEX_TABLE_IDX_MDP_CCORR0] = MT8183_MUTEX_MOD_MDP_CCORR0,
+};
+
 static const unsigned int mt8186_mutex_mod[DDP_COMPONENT_ID_MAX] = {
 	[DDP_COMPONENT_AAL0] = MT8186_MUTEX_MOD_DISP_AAL0,
 	[DDP_COMPONENT_CCORR] = MT8186_MUTEX_MOD_DISP_CCORR0,
@@ -335,6 +355,7 @@ static const struct mtk_mutex_data mt8183_mutex_driver_data = {
 	.mutex_sof = mt8183_mutex_sof,
 	.mutex_mod_reg = MT8183_MUTEX0_MOD0,
 	.mutex_sof_reg = MT8183_MUTEX0_SOF0,
+	.mutex_table_mod = mt8183_mutex_table_mod,
 	.no_clk = true,
 };
 
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v13 3/6] dt-bindings: soc: mediatek: move out common module from display folder
  2022-03-15  6:10 [PATCH v13 0/6] Add mutex support for MDP Moudy Ho
  2022-03-15  6:10 ` [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX Moudy Ho
  2022-03-15  6:10 ` [PATCH v13 2/6] soc: mediatek: mutex: add 8183 MUTEX MOD settings for MDP Moudy Ho
@ 2022-03-15  6:10 ` Moudy Ho
  2022-03-15  9:11   ` AngeloGioacchino Del Regno
  2022-03-16  3:36   ` CK Hu
  2022-03-15  6:10 ` [PATCH v13 4/6] dt-bindings: soc: mediatek: add gce-client-reg for MUTEX Moudy Ho
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 24+ messages in thread
From: Moudy Ho @ 2022-03-15  6:10 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	AngeloGioacchino Del Regno, Maoguang Meng, daoyuan huang,
	Ping-Hsun Wu, menghui.lin, sj.huang, allen-kh.cheng, randy.wu,
	moudy.ho, jason-jh.lin, roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

In order to share the same hardware information with MDP3,
change the MUTEX dt-binding to the path "soc/mediatek".

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
---
 .../{display => soc}/mediatek/mediatek,mutex.yaml      | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
 rename Documentation/devicetree/bindings/{display => soc}/mediatek/mediatek,mutex.yaml (84%)

diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,mutex.yaml b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml
similarity index 84%
rename from Documentation/devicetree/bindings/display/mediatek/mediatek,mutex.yaml
rename to Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml
index 6eca525eced0..4adc67cafd29 100644
--- a/Documentation/devicetree/bindings/display/mediatek/mediatek,mutex.yaml
+++ b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
 %YAML 1.2
 ---
-$id: http://devicetree.org/schemas/display/mediatek/mediatek,mutex.yaml#
+$id: http://devicetree.org/schemas/soc/mediatek/mediatek,mutex.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: Mediatek mutex
@@ -9,17 +9,13 @@ title: Mediatek mutex
 maintainers:
   - Chun-Kuang Hu <chunkuang.hu@kernel.org>
   - Philipp Zabel <p.zabel@pengutronix.de>
+  - Matthias Brugger <matthias.bgg@gmail.com>
 
 description: |
   Mediatek mutex, namely MUTEX, is used to send the triggers signals called
-  Start Of Frame (SOF) / End Of Frame (EOF) to each sub-modules on the display
-  data path or MDP data path.
+  Start Of Frame(SOF) / End Of Frame(EOF) to each sub-modules on the data path.
   In some SoC, such as mt2701, MUTEX could be a hardware mutex which protects
   the shadow register.
-  MUTEX device node must be siblings to the central MMSYS_CONFIG node.
-  For a description of the MMSYS_CONFIG binding, see
-  Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
-  for details.
 
 properties:
   compatible:
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v13 4/6] dt-bindings: soc: mediatek: add gce-client-reg for MUTEX
  2022-03-15  6:10 [PATCH v13 0/6] Add mutex support for MDP Moudy Ho
                   ` (2 preceding siblings ...)
  2022-03-15  6:10 ` [PATCH v13 3/6] dt-bindings: soc: mediatek: move out common module from display folder Moudy Ho
@ 2022-03-15  6:10 ` Moudy Ho
  2022-03-15  9:12   ` AngeloGioacchino Del Regno
  2022-03-16  3:50   ` CK Hu
  2022-03-15  6:10 ` [PATCH v13 5/6] dts: arm64: mt8183: add GCE client property for Mediatek MUTEX Moudy Ho
  2022-03-15  6:10 ` [PATCH v13 6/6] soc: mediatek: mutex: add functions that operate registers by CMDQ Moudy Ho
  5 siblings, 2 replies; 24+ messages in thread
From: Moudy Ho @ 2022-03-15  6:10 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	AngeloGioacchino Del Regno, Maoguang Meng, daoyuan huang,
	Ping-Hsun Wu, menghui.lin, sj.huang, allen-kh.cheng, randy.wu,
	moudy.ho, jason-jh.lin, roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

In order to allow modules with latency requirements such as MDP3
to set registers through CMDQ, add the relevant GCE property.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
---
 .../devicetree/bindings/soc/mediatek/mediatek,mutex.yaml  | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml
index 4adc67cafd29..06106779d129 100644
--- a/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml
+++ b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml
@@ -56,6 +56,14 @@ properties:
       include/dt-bindings/gce/<chip>-gce.h of each chips.
     $ref: /schemas/types.yaml#/definitions/phandle-array
 
+  mediatek,gce-client-reg:
+    description: The register of client driver can be configured by gce with
+      4 arguments defined in this property, such as phandle of gce, subsys id,
+      register offset and size. Each GCE subsys id is mapping to a client
+      defined in the header include/dt-bindings/gce/<chip>-gce.h.
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    maxItems: 1
+
 required:
   - compatible
   - reg
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v13 5/6] dts: arm64: mt8183: add GCE client property for Mediatek MUTEX
  2022-03-15  6:10 [PATCH v13 0/6] Add mutex support for MDP Moudy Ho
                   ` (3 preceding siblings ...)
  2022-03-15  6:10 ` [PATCH v13 4/6] dt-bindings: soc: mediatek: add gce-client-reg for MUTEX Moudy Ho
@ 2022-03-15  6:10 ` Moudy Ho
  2022-03-15  9:12   ` AngeloGioacchino Del Regno
  2022-03-15  6:10 ` [PATCH v13 6/6] soc: mediatek: mutex: add functions that operate registers by CMDQ Moudy Ho
  5 siblings, 1 reply; 24+ messages in thread
From: Moudy Ho @ 2022-03-15  6:10 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	AngeloGioacchino Del Regno, Maoguang Meng, daoyuan huang,
	Ping-Hsun Wu, menghui.lin, sj.huang, allen-kh.cheng, randy.wu,
	moudy.ho, jason-jh.lin, roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

In order to allow modules with latency requirements such as MDP3
to set registers through CMDQ, add the relevant dts property.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
---
 arch/arm64/boot/dts/mediatek/mt8183.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
index 4b08691ed39e..fc6ac2a46324 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
@@ -1514,6 +1514,7 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			mediatek,gce-events = <CMDQ_EVENT_MUTEX_STREAM_DONE0>,
 					      <CMDQ_EVENT_MUTEX_STREAM_DONE1>;
+			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x6000 0x1000>;
 		};
 
 		larb0: larb@14017000 {
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v13 6/6] soc: mediatek: mutex: add functions that operate registers by CMDQ
  2022-03-15  6:10 [PATCH v13 0/6] Add mutex support for MDP Moudy Ho
                   ` (4 preceding siblings ...)
  2022-03-15  6:10 ` [PATCH v13 5/6] dts: arm64: mt8183: add GCE client property for Mediatek MUTEX Moudy Ho
@ 2022-03-15  6:10 ` Moudy Ho
  2022-03-15  9:13   ` AngeloGioacchino Del Regno
  2022-03-17  3:39   ` CK Hu
  5 siblings, 2 replies; 24+ messages in thread
From: Moudy Ho @ 2022-03-15  6:10 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	AngeloGioacchino Del Regno, Maoguang Meng, daoyuan huang,
	Ping-Hsun Wu, menghui.lin, sj.huang, allen-kh.cheng, randy.wu,
	moudy.ho, jason-jh.lin, roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Due to hardware limitations, MDP3 is necessary to enable MUTEX in
each frame for SOF triggering and cooperate with CMDQ control to
reduce the amount of interrupts generated(also, reduce frame latency).

In response to the above situation, a new interface
"mtk_mutex_enable_by_cmdq" has been added to achieve the purpose.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
---
 drivers/soc/mediatek/mtk-mutex.c       | 42 +++++++++++++++++++++++++-
 include/linux/soc/mediatek/mtk-mutex.h |  2 ++
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mutex.c
index 88fb4fc8f216..0d85111cfbe2 100644
--- a/drivers/soc/mediatek/mtk-mutex.c
+++ b/drivers/soc/mediatek/mtk-mutex.c
@@ -7,10 +7,16 @@
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
+#include <linux/of_address.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/soc/mediatek/mtk-mmsys.h>
 #include <linux/soc/mediatek/mtk-mutex.h>
+#include <linux/soc/mediatek/mtk-cmdq.h>
+
+#define MTK_MUTEX_ENABLE			BIT(0)
+#define MTK_MUTEX_MOD_MASK			0x07FFFFFF
+#define MTK_MUTEX_SOF_MASK			0x00000007
 
 #define MT2701_MUTEX0_MOD0			0x2c
 #define MT2701_MUTEX0_SOF0			0x30
@@ -167,6 +173,7 @@ struct mtk_mutex_data {
 	const unsigned int mutex_sof_reg;
 	const unsigned long long *mutex_table_mod;
 	const bool no_clk;
+	const bool has_gce_client_reg;
 };
 
 struct mtk_mutex_ctx {
@@ -175,6 +182,8 @@ struct mtk_mutex_ctx {
 	void __iomem			*regs;
 	struct mtk_mutex		mutex[10];
 	const struct mtk_mutex_data	*data;
+	phys_addr_t			addr;
+	struct cmdq_client_reg		cmdq_reg;
 };
 
 static const unsigned int mt2701_mutex_mod[DDP_COMPONENT_ID_MAX] = {
@@ -357,6 +366,7 @@ static const struct mtk_mutex_data mt8183_mutex_driver_data = {
 	.mutex_sof_reg = MT8183_MUTEX0_SOF0,
 	.mutex_table_mod = mt8183_mutex_table_mod,
 	.no_clk = true,
+	.has_gce_client_reg = true,
 };
 
 static const struct mtk_mutex_data mt8186_mutex_driver_data = {
@@ -639,6 +649,22 @@ void mtk_mutex_enable(struct mtk_mutex *mutex)
 }
 EXPORT_SYMBOL_GPL(mtk_mutex_enable);
 
+void mtk_mutex_enable_by_cmdq(struct mtk_mutex *mutex,
+			      struct cmdq_pkt *pkt)
+{
+#if IS_REACHABLE(CONFIG_MTK_CMDQ)
+	struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx,
+						 mutex[mutex->id]);
+
+	WARN_ON(&mtx->mutex[mutex->id] != mutex);
+
+	cmdq_pkt_write_mask(pkt, mtx->cmdq_reg.subsys,
+			    mtx->aaddr + DISP_REG_MUTEX_EN(mutex->id),
+			    MTK_MUTEX_ENABLE, MTK_MUTEX_ENABLE);
+#endif
+}
+EXPORT_SYMBOL_GPL(mtk_mutex_enable_by_cmdq);
+
 void mtk_mutex_disable(struct mtk_mutex *mutex)
 {
 	struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx,
@@ -677,7 +703,7 @@ static int mtk_mutex_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct mtk_mutex_ctx *mtx;
-	struct resource *regs;
+	struct resource *regs, addr;
 	int i;
 
 	mtx = devm_kzalloc(dev, sizeof(*mtx), GFP_KERNEL);
@@ -698,6 +724,20 @@ static int mtk_mutex_probe(struct platform_device *pdev)
 		}
 	}
 
+	if (of_address_to_resource(dev->of_node, 0, &addr) < 0)
+		mtx->addr = 0L;
+	else
+		mtx->addr = addr.start;
+
+#if IS_REACHABLE(CONFIG_MTK_CMDQ)
+	if (mtx->data->has_gce_client_reg) {
+		if (cmdq_dev_get_client_reg(dev, &mtx->cmdq_reg, 0)) {
+			dev_err(dev, "No mediatek,gce-client-reg!\n");
+			return ret;
+		}
+	}
+#endif
+
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	mtx->regs = devm_ioremap_resource(dev, regs);
 	if (IS_ERR(mtx->regs)) {
diff --git a/include/linux/soc/mediatek/mtk-mutex.h b/include/linux/soc/mediatek/mtk-mutex.h
index c8355bb0e6d6..18a4b1dc3773 100644
--- a/include/linux/soc/mediatek/mtk-mutex.h
+++ b/include/linux/soc/mediatek/mtk-mutex.h
@@ -45,6 +45,8 @@ void mtk_mutex_set_mod(struct mtk_mutex *mutex,
 void mtk_mutex_set_sof(struct mtk_mutex *mutex,
 		       enum mtk_mutex_table_index idx);
 void mtk_mutex_enable(struct mtk_mutex *mutex);
+void mtk_mutex_enable_by_cmdq(struct mtk_mutex *mutex,
+			      struct cmdq_pkt *pkt);
 void mtk_mutex_disable(struct mtk_mutex *mutex);
 void mtk_mutex_remove_comp(struct mtk_mutex *mutex,
 			   enum mtk_ddp_comp_id id);
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
  2022-03-15  6:10 ` [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX Moudy Ho
@ 2022-03-15  9:10   ` AngeloGioacchino Del Regno
  2022-03-15 14:41     ` Rob Landley
  2022-03-16  2:25   ` CK Hu
  1 sibling, 1 reply; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-03-15  9:10 UTC (permalink / raw)
  To: Moudy Ho, Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	Maoguang Meng, daoyuan huang, Ping-Hsun Wu, menghui.lin,
	sj.huang, allen-kh.cheng, randy.wu, jason-jh.lin, roy-cw.yeh,
	river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Il 15/03/22 07:10, Moudy Ho ha scritto:
> In order to allow multiple modules to operate MUTEX hardware through
> a common interfrace, a flexible index "mtk_mutex_table_index" needs to
> be added to replace original component ID so that like DDP and MDP
> can add their own MUTEX table settings independently.
> 
> In addition, 4 generic interface "mtk_mutex_set_mod", "mtk_mutex_set_sof",
> "mtk_mutex_clear_mod" and "mtk_mutex_clear_sof" have been added, which is
> expected to replace the "mtk_mutex_add_comp" and "mtk_mutex_remove_comp"
> pair originally dedicated to DDP in the future.
> 
> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
> ---
>   drivers/soc/mediatek/mtk-mutex.c       | 122 +++++++++++++++++++++++++
>   include/linux/soc/mediatek/mtk-mutex.h |  33 +++++++
>   2 files changed, 155 insertions(+)
> 
> diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mutex.c
> index aaf8fc1abb43..778b01ce9e8f 100644
> --- a/drivers/soc/mediatek/mtk-mutex.c
> +++ b/drivers/soc/mediatek/mtk-mutex.c
> @@ -156,6 +156,7 @@ struct mtk_mutex_data {
>   	const unsigned int *mutex_sof;
>   	const unsigned int mutex_mod_reg;
>   	const unsigned int mutex_sof_reg;
> +	const unsigned long long *mutex_table_mod;

Can we change this to u64 instead?

With that done,

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 2/6] soc: mediatek: mutex: add 8183 MUTEX MOD settings for MDP
  2022-03-15  6:10 ` [PATCH v13 2/6] soc: mediatek: mutex: add 8183 MUTEX MOD settings for MDP Moudy Ho
@ 2022-03-15  9:11   ` AngeloGioacchino Del Regno
  2022-03-16  3:31   ` CK Hu
  1 sibling, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-03-15  9:11 UTC (permalink / raw)
  To: Moudy Ho, Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	Maoguang Meng, daoyuan huang, Ping-Hsun Wu, menghui.lin,
	sj.huang, allen-kh.cheng, randy.wu, jason-jh.lin, roy-cw.yeh,
	river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Il 15/03/22 07:10, Moudy Ho ha scritto:
> For the purpose of module independence, related settings should be moved
> from MDP to the corresponding driver.
> This patch adds 8183 MUTEX MOD settings for MDP.
> 
> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 3/6] dt-bindings: soc: mediatek: move out common module from display folder
  2022-03-15  6:10 ` [PATCH v13 3/6] dt-bindings: soc: mediatek: move out common module from display folder Moudy Ho
@ 2022-03-15  9:11   ` AngeloGioacchino Del Regno
  2022-03-16  3:36   ` CK Hu
  1 sibling, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-03-15  9:11 UTC (permalink / raw)
  To: Moudy Ho, Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	Maoguang Meng, daoyuan huang, Ping-Hsun Wu, menghui.lin,
	sj.huang, allen-kh.cheng, randy.wu, jason-jh.lin, roy-cw.yeh,
	river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Il 15/03/22 07:10, Moudy Ho ha scritto:
> In order to share the same hardware information with MDP3,
> change the MUTEX dt-binding to the path "soc/mediatek".
> 
> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 4/6] dt-bindings: soc: mediatek: add gce-client-reg for MUTEX
  2022-03-15  6:10 ` [PATCH v13 4/6] dt-bindings: soc: mediatek: add gce-client-reg for MUTEX Moudy Ho
@ 2022-03-15  9:12   ` AngeloGioacchino Del Regno
  2022-03-16  3:50   ` CK Hu
  1 sibling, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-03-15  9:12 UTC (permalink / raw)
  To: Moudy Ho, Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	Maoguang Meng, daoyuan huang, Ping-Hsun Wu, menghui.lin,
	sj.huang, allen-kh.cheng, randy.wu, jason-jh.lin, roy-cw.yeh,
	river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Il 15/03/22 07:10, Moudy Ho ha scritto:
> In order to allow modules with latency requirements such as MDP3
> to set registers through CMDQ, add the relevant GCE property.
> 
> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 5/6] dts: arm64: mt8183: add GCE client property for Mediatek MUTEX
  2022-03-15  6:10 ` [PATCH v13 5/6] dts: arm64: mt8183: add GCE client property for Mediatek MUTEX Moudy Ho
@ 2022-03-15  9:12   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-03-15  9:12 UTC (permalink / raw)
  To: Moudy Ho, Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	Maoguang Meng, daoyuan huang, Ping-Hsun Wu, menghui.lin,
	sj.huang, allen-kh.cheng, randy.wu, jason-jh.lin, roy-cw.yeh,
	river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Il 15/03/22 07:10, Moudy Ho ha scritto:
> In order to allow modules with latency requirements such as MDP3
> to set registers through CMDQ, add the relevant dts property.
> 
> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

> ---
>   arch/arm64/boot/dts/mediatek/mt8183.dtsi | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> index 4b08691ed39e..fc6ac2a46324 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> @@ -1514,6 +1514,7 @@
>   			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
>   			mediatek,gce-events = <CMDQ_EVENT_MUTEX_STREAM_DONE0>,
>   					      <CMDQ_EVENT_MUTEX_STREAM_DONE1>;
> +			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x6000 0x1000>;
>   		};
>   
>   		larb0: larb@14017000 {



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 6/6] soc: mediatek: mutex: add functions that operate registers by CMDQ
  2022-03-15  6:10 ` [PATCH v13 6/6] soc: mediatek: mutex: add functions that operate registers by CMDQ Moudy Ho
@ 2022-03-15  9:13   ` AngeloGioacchino Del Regno
  2022-03-17  3:39   ` CK Hu
  1 sibling, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-03-15  9:13 UTC (permalink / raw)
  To: Moudy Ho, Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	Maoguang Meng, daoyuan huang, Ping-Hsun Wu, menghui.lin,
	sj.huang, allen-kh.cheng, randy.wu, jason-jh.lin, roy-cw.yeh,
	river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Il 15/03/22 07:10, Moudy Ho ha scritto:
> Due to hardware limitations, MDP3 is necessary to enable MUTEX in
> each frame for SOF triggering and cooperate with CMDQ control to
> reduce the amount of interrupts generated(also, reduce frame latency).
> 
> In response to the above situation, a new interface
> "mtk_mutex_enable_by_cmdq" has been added to achieve the purpose.
> 
> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
  2022-03-15  9:10   ` AngeloGioacchino Del Regno
@ 2022-03-15 14:41     ` Rob Landley
  2022-03-15 14:50       ` Geert Uytterhoeven
  0 siblings, 1 reply; 24+ messages in thread
From: Rob Landley @ 2022-03-15 14:41 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, Moudy Ho, Mauro Carvalho Chehab,
	Rob Herring, Matthias Brugger, Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Laurent Pinchart, linux-media,
	devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
	Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	Maoguang Meng, daoyuan huang, Ping-Hsun Wu, menghui.lin,
	sj.huang, allen-kh.cheng, randy.wu, jason-jh.lin, roy-cw.yeh,
	river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group



On 3/15/22 4:10 AM, AngeloGioacchino Del Regno wrote:
> Il 15/03/22 07:10, Moudy Ho ha scritto:
>> In order to allow multiple modules to operate MUTEX hardware through
>> a common interfrace, a flexible index "mtk_mutex_table_index" needs to
>> be added to replace original component ID so that like DDP and MDP
>> can add their own MUTEX table settings independently.
>> 
>> In addition, 4 generic interface "mtk_mutex_set_mod", "mtk_mutex_set_sof",
>> "mtk_mutex_clear_mod" and "mtk_mutex_clear_sof" have been added, which is
>> expected to replace the "mtk_mutex_add_comp" and "mtk_mutex_remove_comp"
>> pair originally dedicated to DDP in the future.
>> 
>> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
>> ---
>>   drivers/soc/mediatek/mtk-mutex.c       | 122 +++++++++++++++++++++++++
>>   include/linux/soc/mediatek/mtk-mutex.h |  33 +++++++
>>   2 files changed, 155 insertions(+)
>> 
>> diff --git a/drivers/soc/mediatek/mtk-mutex.c b/drivers/soc/mediatek/mtk-mutex.c
>> index aaf8fc1abb43..778b01ce9e8f 100644
>> --- a/drivers/soc/mediatek/mtk-mutex.c
>> +++ b/drivers/soc/mediatek/mtk-mutex.c
>> @@ -156,6 +156,7 @@ struct mtk_mutex_data {
>>   	const unsigned int *mutex_sof;
>>   	const unsigned int mutex_mod_reg;
>>   	const unsigned int mutex_sof_reg;
>> +	const unsigned long long *mutex_table_mod;
> 
> Can we change this to u64 instead?

Linux is still LP64, correct?

Rob

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
  2022-03-15 14:41     ` Rob Landley
@ 2022-03-15 14:50       ` Geert Uytterhoeven
  2022-03-15 14:58         ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 24+ messages in thread
From: Geert Uytterhoeven @ 2022-03-15 14:50 UTC (permalink / raw)
  To: Rob Landley
  Cc: AngeloGioacchino Del Regno, Moudy Ho, Mauro Carvalho Chehab,
	Rob Herring, Matthias Brugger, Hans Verkuil, Jernej Skrabec,
	Chun-Kuang Hu, Geert Uytterhoeven, Laurent Pinchart,
	Linux Media Mailing List,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux ARM, linux-mediatek, Linux Kernel Mailing List,
	Alexandre Courbot, Tomasz Figa, drinkcat, Pi-Hsun Shih,
	Hsin-Yi Wang, Maoguang Meng, daoyuan huang, Ping-Hsun Wu,
	menghui.lin, sj.huang, allen-kh.cheng, randy.wu, jason-jh.lin,
	roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Hi Rob,

On Tue, Mar 15, 2022 at 3:37 PM Rob Landley <rob@landley.net> wrote:
> On 3/15/22 4:10 AM, AngeloGioacchino Del Regno wrote:
> > Il 15/03/22 07:10, Moudy Ho ha scritto:
> >> In order to allow multiple modules to operate MUTEX hardware through
> >> a common interfrace, a flexible index "mtk_mutex_table_index" needs to
> >> be added to replace original component ID so that like DDP and MDP
> >> can add their own MUTEX table settings independently.
> >>
> >> In addition, 4 generic interface "mtk_mutex_set_mod", "mtk_mutex_set_sof",
> >> "mtk_mutex_clear_mod" and "mtk_mutex_clear_sof" have been added, which is
> >> expected to replace the "mtk_mutex_add_comp" and "mtk_mutex_remove_comp"
> >> pair originally dedicated to DDP in the future.
> >>
> >> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>

> >> --- a/drivers/soc/mediatek/mtk-mutex.c
> >> +++ b/drivers/soc/mediatek/mtk-mutex.c
> >> @@ -156,6 +156,7 @@ struct mtk_mutex_data {
> >>      const unsigned int *mutex_sof;
> >>      const unsigned int mutex_mod_reg;
> >>      const unsigned int mutex_sof_reg;
> >> +    const unsigned long long *mutex_table_mod;
> >
> > Can we change this to u64 instead?
>
> Linux is still LP64, correct?

On 64-bit platforms, yes.

Note that this is about "long long", which is 64-bit on all Linux platforms.
But as the table seems to be used to store 2 32-bit values, it doesn't hurt
to be explicit and use "u64"? Or a struct with 2 "u32" values?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
  2022-03-15 14:50       ` Geert Uytterhoeven
@ 2022-03-15 14:58         ` AngeloGioacchino Del Regno
  2022-03-17 12:43           ` moudy.ho
  0 siblings, 1 reply; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-03-15 14:58 UTC (permalink / raw)
  To: Geert Uytterhoeven, Rob Landley
  Cc: Moudy Ho, Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec, Chun-Kuang Hu, Geert Uytterhoeven,
	Laurent Pinchart, Linux Media Mailing List,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux ARM, linux-mediatek, Linux Kernel Mailing List,
	Alexandre Courbot, Tomasz Figa, drinkcat, Pi-Hsun Shih,
	Hsin-Yi Wang, Maoguang Meng, daoyuan huang, Ping-Hsun Wu,
	menghui.lin, sj.huang, allen-kh.cheng, randy.wu, jason-jh.lin,
	roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Il 15/03/22 15:50, Geert Uytterhoeven ha scritto:
> Hi Rob,
> 
> On Tue, Mar 15, 2022 at 3:37 PM Rob Landley <rob@landley.net> wrote:
>> On 3/15/22 4:10 AM, AngeloGioacchino Del Regno wrote:
>>> Il 15/03/22 07:10, Moudy Ho ha scritto:
>>>> In order to allow multiple modules to operate MUTEX hardware through
>>>> a common interfrace, a flexible index "mtk_mutex_table_index" needs to
>>>> be added to replace original component ID so that like DDP and MDP
>>>> can add their own MUTEX table settings independently.
>>>>
>>>> In addition, 4 generic interface "mtk_mutex_set_mod", "mtk_mutex_set_sof",
>>>> "mtk_mutex_clear_mod" and "mtk_mutex_clear_sof" have been added, which is
>>>> expected to replace the "mtk_mutex_add_comp" and "mtk_mutex_remove_comp"
>>>> pair originally dedicated to DDP in the future.
>>>>
>>>> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
> 
>>>> --- a/drivers/soc/mediatek/mtk-mutex.c
>>>> +++ b/drivers/soc/mediatek/mtk-mutex.c
>>>> @@ -156,6 +156,7 @@ struct mtk_mutex_data {
>>>>       const unsigned int *mutex_sof;
>>>>       const unsigned int mutex_mod_reg;
>>>>       const unsigned int mutex_sof_reg;
>>>> +    const unsigned long long *mutex_table_mod;
>>>
>>> Can we change this to u64 instead?
>>
>> Linux is still LP64, correct?
> 
> On 64-bit platforms, yes.
> 
> Note that this is about "long long", which is 64-bit on all Linux platforms.
> But as the table seems to be used to store 2 32-bit values, it doesn't hurt
> to be explicit and use "u64"? Or a struct with 2 "u32" values?
> 

Exactly. I wanted this to be a hint of what's happening in the background,
without using unions to describe this.

Geert, thanks for immediately understanding my intention.

Cheers,
Angelo

> Gr{oetje,eeting}s,
> 
>                          Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                  -- Linus Torvalds


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
  2022-03-15  6:10 ` [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX Moudy Ho
  2022-03-15  9:10   ` AngeloGioacchino Del Regno
@ 2022-03-16  2:25   ` CK Hu
  2022-03-17 12:45     ` moudy.ho
  1 sibling, 1 reply; 24+ messages in thread
From: CK Hu @ 2022-03-16  2:25 UTC (permalink / raw)
  To: Moudy Ho, Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	AngeloGioacchino Del Regno, Maoguang Meng, daoyuan huang,
	Ping-Hsun Wu, menghui.lin, sj.huang, allen-kh.cheng, randy.wu,
	jason-jh.lin, roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Hi, Moudy:

On Tue, 2022-03-15 at 14:10 +0800, Moudy Ho wrote:
> In order to allow multiple modules to operate MUTEX hardware through
> a common interfrace, a flexible index "mtk_mutex_table_index" needs
> to
> be added to replace original component ID so that like DDP and MDP
> can add their own MUTEX table settings independently.
> 
> In addition, 4 generic interface "mtk_mutex_set_mod",
> "mtk_mutex_set_sof",
> "mtk_mutex_clear_mod" and "mtk_mutex_clear_sof" have been added,
> which is
> expected to replace the "mtk_mutex_add_comp" and
> "mtk_mutex_remove_comp"
> pair originally dedicated to DDP in the future.
> 
> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
> ---
>  drivers/soc/mediatek/mtk-mutex.c       | 122
> +++++++++++++++++++++++++
>  include/linux/soc/mediatek/mtk-mutex.h |  33 +++++++
>  2 files changed, 155 insertions(+)
> 

[snip]

> 
> diff --git a/include/linux/soc/mediatek/mtk-mutex.h
> b/include/linux/soc/mediatek/mtk-mutex.h
> index 6fe4ffbde290..c8355bb0e6d6 100644
> --- a/include/linux/soc/mediatek/mtk-mutex.h
> +++ b/include/linux/soc/mediatek/mtk-mutex.h
> @@ -10,14 +10,47 @@ struct regmap;
>  struct device;
>  struct mtk_mutex;
>  
> +enum mtk_mutex_table_index {
> +	MUTEX_TABLE_IDX_NONE = 0,	/* Invalid engine */

Useless, so remove this.

> +
> +	/* MDP table index */
> +	MUTEX_TABLE_IDX_MDP_RDMA0,
> +	MUTEX_TABLE_IDX_MDP_RSZ0,
> +	MUTEX_TABLE_IDX_MDP_RSZ1,
> +	MUTEX_TABLE_IDX_MDP_TDSHP0,
> +	MUTEX_TABLE_IDX_MDP_WROT0,
> +	MUTEX_TABLE_IDX_MDP_WDMA,
> +	MUTEX_TABLE_IDX_MDP_AAL0,
> +	MUTEX_TABLE_IDX_MDP_CCORR0,
> +
> +	/* DDP table index */
> +	MUTEX_TABLE_IDX_DDP_DSI0,
> +	MUTEX_TABLE_IDX_DDP_DSI1,
> +	MUTEX_TABLE_IDX_DDP_DSI2,
> +	MUTEX_TABLE_IDX_DDP_DSI3,
> +	MUTEX_TABLE_IDX_DDP_DPI0,
> +	MUTEX_TABLE_IDX_DDP_DPI1,
> +	MUTEX_TABLE_IDX_DDP_DP_INTF0,
> +	MUTEX_TABLE_IDX_DDP_DP_INTF1,

If this patch would support DDP, add all DDP index. If this patch does
not support DDP, remove these.

Regards,
CK

> +
> +	MUTEX_TABLE_IDX_MAX		/* ALWAYS keep at the end */
> +};
> +
>  struct mtk_mutex *mtk_mutex_get(struct device *dev);
>  int mtk_mutex_prepare(struct mtk_mutex *mutex);
>  void mtk_mutex_add_comp(struct mtk_mutex *mutex,
>  			enum mtk_ddp_comp_id id);
> +void mtk_mutex_set_mod(struct mtk_mutex *mutex,
> +		       enum mtk_mutex_table_index idx);
> +void mtk_mutex_set_sof(struct mtk_mutex *mutex,
> +		       enum mtk_mutex_table_index idx);
>  void mtk_mutex_enable(struct mtk_mutex *mutex);
>  void mtk_mutex_disable(struct mtk_mutex *mutex);
>  void mtk_mutex_remove_comp(struct mtk_mutex *mutex,
>  			   enum mtk_ddp_comp_id id);
> +void mtk_mutex_clear_mod(struct mtk_mutex *mutex,
> +			 enum mtk_mutex_table_index idx);
> +void mtk_mutex_clear_sof(struct mtk_mutex *mutex);
>  void mtk_mutex_unprepare(struct mtk_mutex *mutex);
>  void mtk_mutex_put(struct mtk_mutex *mutex);
>  void mtk_mutex_acquire(struct mtk_mutex *mutex);


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 2/6] soc: mediatek: mutex: add 8183 MUTEX MOD settings for MDP
  2022-03-15  6:10 ` [PATCH v13 2/6] soc: mediatek: mutex: add 8183 MUTEX MOD settings for MDP Moudy Ho
  2022-03-15  9:11   ` AngeloGioacchino Del Regno
@ 2022-03-16  3:31   ` CK Hu
  2022-03-17 10:11     ` moudy.ho
  1 sibling, 1 reply; 24+ messages in thread
From: CK Hu @ 2022-03-16  3:31 UTC (permalink / raw)
  To: Moudy Ho, Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	AngeloGioacchino Del Regno, Maoguang Meng, daoyuan huang,
	Ping-Hsun Wu, menghui.lin, sj.huang, allen-kh.cheng, randy.wu,
	jason-jh.lin, roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Hi, Moudy:

On Tue, 2022-03-15 at 14:10 +0800, Moudy Ho wrote:
> For the purpose of module independence, related settings should be
> moved
> from MDP to the corresponding driver.
> This patch adds 8183 MUTEX MOD settings for MDP.
> 
> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
> ---
>  drivers/soc/mediatek/mtk-mutex.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/soc/mediatek/mtk-mutex.c
> b/drivers/soc/mediatek/mtk-mutex.c
> index 778b01ce9e8f..88fb4fc8f216 100644
> --- a/drivers/soc/mediatek/mtk-mutex.c
> +++ b/drivers/soc/mediatek/mtk-mutex.c
> @@ -80,6 +80,15 @@
>  #define MT8183_MUTEX_MOD_DISP_GAMMA0		16
>  #define MT8183_MUTEX_MOD_DISP_DITHER0		17
>  
> +#define MT8183_MUTEX_MOD_MDP_RDMA0		BIT(2)

Display definition is a number, why MDP is bit definition?

Regards,
CK

> +#define MT8183_MUTEX_MOD_MDP_RSZ0		BIT(4)
> +#define MT8183_MUTEX_MOD_MDP_RSZ1		BIT(5)
> +#define MT8183_MUTEX_MOD_MDP_TDSHP0		BIT(6)
> +#define MT8183_MUTEX_MOD_MDP_WROT0		BIT(7)
> +#define MT8183_MUTEX_MOD_MDP_WDMA		BIT(8)
> +#define MT8183_MUTEX_MOD_MDP_AAL0		BIT(23)
> +#define MT8183_MUTEX_MOD_MDP_CCORR0		BIT(24)
> +
>  #define MT8173_MUTEX_MOD_DISP_OVL0		11
>  #define MT8173_MUTEX_MOD_DISP_OVL1		12
>  #define MT8173_MUTEX_MOD_DISP_RDMA0		13
> @@ -244,6 +253,17 @@ static const unsigned int
> mt8183_mutex_mod[DDP_COMPONENT_ID_MAX] = {
>  	[DDP_COMPONENT_WDMA0] = MT8183_MUTEX_MOD_DISP_WDMA0,
>  };
>  
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 3/6] dt-bindings: soc: mediatek: move out common module from display folder
  2022-03-15  6:10 ` [PATCH v13 3/6] dt-bindings: soc: mediatek: move out common module from display folder Moudy Ho
  2022-03-15  9:11   ` AngeloGioacchino Del Regno
@ 2022-03-16  3:36   ` CK Hu
  1 sibling, 0 replies; 24+ messages in thread
From: CK Hu @ 2022-03-16  3:36 UTC (permalink / raw)
  To: Moudy Ho, Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	AngeloGioacchino Del Regno, Maoguang Meng, daoyuan huang,
	Ping-Hsun Wu, menghui.lin, sj.huang, allen-kh.cheng, randy.wu,
	jason-jh.lin, roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Hi, Moudy:

On Tue, 2022-03-15 at 14:10 +0800, Moudy Ho wrote:
> In order to share the same hardware information with MDP3,
> change the MUTEX dt-binding to the path "soc/mediatek".
> 
> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
> ---
>  .../{display => soc}/mediatek/mediatek,mutex.yaml      | 10 +++-----
> --
>  1 file changed, 3 insertions(+), 7 deletions(-)
>  rename Documentation/devicetree/bindings/{display =>
> soc}/mediatek/mediatek,mutex.yaml (84%)
> 
> diff --git
> a/Documentation/devicetree/bindings/display/mediatek/mediatek,mutex.y
> aml
> b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml
> similarity index 84%
> rename from
> Documentation/devicetree/bindings/display/mediatek/mediatek,mutex.yam
> l
> rename to
> Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml
> index 6eca525eced0..4adc67cafd29 100644
> ---
> a/Documentation/devicetree/bindings/display/mediatek/mediatek,mutex.y
> aml
> +++
> b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml
> @@ -1,7 +1,7 @@
>  # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>  %YAML 1.2
>  ---
> -$id: 
> https://urldefense.com/v3/__http://devicetree.org/schemas/display/mediatek/mediatek,mutex.yaml*__;Iw!!CTRNKA9wMg0ARbw!wGUhdDCs1gqW3Mb5paZPaF-qpdK0BBiR6-zMnprFhfu_YiYLf4vEbi1fE1ktpA$
>  
> +$id: 
> https://urldefense.com/v3/__http://devicetree.org/schemas/soc/mediatek/mediatek,mutex.yaml*__;Iw!!CTRNKA9wMg0ARbw!wGUhdDCs1gqW3Mb5paZPaF-qpdK0BBiR6-zMnprFhfu_YiYLf4vEbi0c8j0j1A$
>  
>  $schema: 
> https://urldefense.com/v3/__http://devicetree.org/meta-schemas/core.yaml*__;Iw!!CTRNKA9wMg0ARbw!wGUhdDCs1gqW3Mb5paZPaF-qpdK0BBiR6-zMnprFhfu_YiYLf4vEbi2jwnYkJA$
>  
>  
>  title: Mediatek mutex
> @@ -9,17 +9,13 @@ title: Mediatek mutex
>  maintainers:
>    - Chun-Kuang Hu <chunkuang.hu@kernel.org>
>    - Philipp Zabel <p.zabel@pengutronix.de>
> +  - Matthias Brugger <matthias.bgg@gmail.com>
>  
>  description: |
>    Mediatek mutex, namely MUTEX, is used to send the triggers signals
> called
> -  Start Of Frame (SOF) / End Of Frame (EOF) to each sub-modules on
> the display
> -  data path or MDP data path.
> +  Start Of Frame(SOF) / End Of Frame(EOF) to each sub-modules on the
> data path.

If this is not related to 'move out', separate this to another patch.

>    In some SoC, such as mt2701, MUTEX could be a hardware mutex which
> protects
>    the shadow register.
> -  MUTEX device node must be siblings to the central MMSYS_CONFIG
> node.
> -  For a description of the MMSYS_CONFIG binding, see
> -  Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml
> -  for details.

If this is not related to 'move out', separate this to another patch.

Regards,
CK

>  
>  properties:
>    compatible:


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 4/6] dt-bindings: soc: mediatek: add gce-client-reg for MUTEX
  2022-03-15  6:10 ` [PATCH v13 4/6] dt-bindings: soc: mediatek: add gce-client-reg for MUTEX Moudy Ho
  2022-03-15  9:12   ` AngeloGioacchino Del Regno
@ 2022-03-16  3:50   ` CK Hu
  1 sibling, 0 replies; 24+ messages in thread
From: CK Hu @ 2022-03-16  3:50 UTC (permalink / raw)
  To: Moudy Ho, Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	AngeloGioacchino Del Regno, Maoguang Meng, daoyuan huang,
	Ping-Hsun Wu, menghui.lin, sj.huang, allen-kh.cheng, randy.wu,
	jason-jh.lin, roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Hi, Moudy:

On Tue, 2022-03-15 at 14:10 +0800, Moudy Ho wrote:
> In order to allow modules with latency requirements such as MDP3
> to set registers through CMDQ, add the relevant GCE property.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
> ---
>  .../devicetree/bindings/soc/mediatek/mediatek,mutex.yaml  | 8
> ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git
> a/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml
> b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml
> index 4adc67cafd29..06106779d129 100644
> ---
> a/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml
> +++
> b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml
> @@ -56,6 +56,14 @@ properties:
>        include/dt-bindings/gce/<chip>-gce.h of each chips.
>      $ref: /schemas/types.yaml#/definitions/phandle-array
>  
> +  mediatek,gce-client-reg:
> +    description: The register of client driver can be configured by
> gce with
> +      4 arguments defined in this property, such as phandle of gce,
> subsys id,
> +      register offset and size. Each GCE subsys id is mapping to a
> client
> +      defined in the header include/dt-bindings/gce/<chip>-gce.h.
> +    $ref: /schemas/types.yaml#/definitions/phandle-array
> +    maxItems: 1
> +
>  required:
>    - compatible
>    - reg


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 6/6] soc: mediatek: mutex: add functions that operate registers by CMDQ
  2022-03-15  6:10 ` [PATCH v13 6/6] soc: mediatek: mutex: add functions that operate registers by CMDQ Moudy Ho
  2022-03-15  9:13   ` AngeloGioacchino Del Regno
@ 2022-03-17  3:39   ` CK Hu
  1 sibling, 0 replies; 24+ messages in thread
From: CK Hu @ 2022-03-17  3:39 UTC (permalink / raw)
  To: Moudy Ho, Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	AngeloGioacchino Del Regno, Maoguang Meng, daoyuan huang,
	Ping-Hsun Wu, menghui.lin, sj.huang, allen-kh.cheng, randy.wu,
	jason-jh.lin, roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

Hi, Moudy:

On Tue, 2022-03-15 at 14:10 +0800, Moudy Ho wrote:
> Due to hardware limitations, MDP3 is necessary to enable MUTEX in
> each frame for SOF triggering and cooperate with CMDQ control to
> reduce the amount of interrupts generated(also, reduce frame
> latency).
> 
> In response to the above situation, a new interface
> "mtk_mutex_enable_by_cmdq" has been added to achieve the purpose.
> 
> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
> ---
>  drivers/soc/mediatek/mtk-mutex.c       | 42
> +++++++++++++++++++++++++-
>  include/linux/soc/mediatek/mtk-mutex.h |  2 ++
>  2 files changed, 43 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/mediatek/mtk-mutex.c
> b/drivers/soc/mediatek/mtk-mutex.c
> index 88fb4fc8f216..0d85111cfbe2 100644
> --- a/drivers/soc/mediatek/mtk-mutex.c
> +++ b/drivers/soc/mediatek/mtk-mutex.c
> @@ -7,10 +7,16 @@
>  #include <linux/iopoll.h>
>  #include <linux/module.h>
>  #include <linux/of_device.h>
> +#include <linux/of_address.h>
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
>  #include <linux/soc/mediatek/mtk-mmsys.h>
>  #include <linux/soc/mediatek/mtk-mutex.h>
> +#include <linux/soc/mediatek/mtk-cmdq.h>
> +
> +#define MTK_MUTEX_ENABLE			BIT(0)

This is not related to cmdq. Separate this to another patch and apply
to mtk_mutex_enable() also.

> +#define MTK_MUTEX_MOD_MASK			0x07FFFFFF

Useless, remove.

> +#define MTK_MUTEX_SOF_MASK			0x00000007

Ditto.

>  
>  #define MT2701_MUTEX0_MOD0			0x2c
>  #define MT2701_MUTEX0_SOF0			0x30
> @@ -167,6 +173,7 @@ struct mtk_mutex_data {
>  	const unsigned int mutex_sof_reg;
>  	const unsigned long long *mutex_table_mod;
>  	const bool no_clk;
> +	const bool has_gce_client_reg;
>  };
>  
>  struct mtk_mutex_ctx {
> @@ -175,6 +182,8 @@ struct mtk_mutex_ctx {
>  	void __iomem			*regs;
>  	struct mtk_mutex		mutex[10];
>  	const struct mtk_mutex_data	*data;
> +	phys_addr_t			addr;
> +	struct cmdq_client_reg		cmdq_reg;
>  };
>  
>  static const unsigned int mt2701_mutex_mod[DDP_COMPONENT_ID_MAX] = {
> @@ -357,6 +366,7 @@ static const struct mtk_mutex_data
> mt8183_mutex_driver_data = {
>  	.mutex_sof_reg = MT8183_MUTEX0_SOF0,
>  	.mutex_table_mod = mt8183_mutex_table_mod,
>  	.no_clk = true,
> +	.has_gce_client_reg = true,
>  };
>  
>  static const struct mtk_mutex_data mt8186_mutex_driver_data = {
> @@ -639,6 +649,22 @@ void mtk_mutex_enable(struct mtk_mutex *mutex)
>  }
>  EXPORT_SYMBOL_GPL(mtk_mutex_enable);
>  
> +void mtk_mutex_enable_by_cmdq(struct mtk_mutex *mutex,
> +			      struct cmdq_pkt *pkt)
> +{
> +#if IS_REACHABLE(CONFIG_MTK_CMDQ)
> +	struct mtk_mutex_ctx *mtx = container_of(mutex, struct
> mtk_mutex_ctx,
> +						 mutex[mutex->id]);
> +
> +	WARN_ON(&mtx->mutex[mutex->id] != mutex);
> +
> +	cmdq_pkt_write_mask(pkt, mtx->cmdq_reg.subsys,
> +			    mtx->aaddr + DISP_REG_MUTEX_EN(mutex->id),
> +			    MTK_MUTEX_ENABLE, MTK_MUTEX_ENABLE);

#else
/* show some error message here */


> +#endif
> +}
> +EXPORT_SYMBOL_GPL(mtk_mutex_enable_by_cmdq);
> +
>  void mtk_mutex_disable(struct mtk_mutex *mutex)
>  {
>  	struct mtk_mutex_ctx *mtx = container_of(mutex, struct
> mtk_mutex_ctx,
> @@ -677,7 +703,7 @@ static int mtk_mutex_probe(struct platform_device
> *pdev)
>  {
>  	struct device *dev = &pdev->dev;
>  	struct mtk_mutex_ctx *mtx;
> -	struct resource *regs;
> +	struct resource *regs, addr;
>  	int i;
>  
>  	mtx = devm_kzalloc(dev, sizeof(*mtx), GFP_KERNEL);
> @@ -698,6 +724,20 @@ static int mtk_mutex_probe(struct
> platform_device *pdev)
>  		}
>  	}
>  
> +	if (of_address_to_resource(dev->of_node, 0, &addr) < 0)
> +		mtx->addr = 0L;
> +	else
> +		mtx->addr = addr.start;
> +
> +#if IS_REACHABLE(CONFIG_MTK_CMDQ)
> +	if (mtx->data->has_gce_client_reg) {

In current upstreamed mt8183.dtsi [1], mutex device node has no
mediatek,gce-client-reg property and display maybe work (?). So I think
this should be backward-compatible.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/mediatek/mt8183.dtsi?h=v5.17-rc8#n1510

Regards,
CK

> +		if (cmdq_dev_get_client_reg(dev, &mtx->cmdq_reg, 0)) {
> +			dev_err(dev, "No mediatek,gce-client-reg!\n");
> +			return ret;
> +		}
> +	}
> +#endif
> +
>  	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	mtx->regs = devm_ioremap_resource(dev, regs);
>  	if (IS_ERR(mtx->regs)) {
> diff --git a/include/linux/soc/mediatek/mtk-mutex.h
> b/include/linux/soc/mediatek/mtk-mutex.h
> index c8355bb0e6d6..18a4b1dc3773 100644
> --- a/include/linux/soc/mediatek/mtk-mutex.h
> +++ b/include/linux/soc/mediatek/mtk-mutex.h
> @@ -45,6 +45,8 @@ void mtk_mutex_set_mod(struct mtk_mutex *mutex,
>  void mtk_mutex_set_sof(struct mtk_mutex *mutex,
>  		       enum mtk_mutex_table_index idx);
>  void mtk_mutex_enable(struct mtk_mutex *mutex);
> +void mtk_mutex_enable_by_cmdq(struct mtk_mutex *mutex,
> +			      struct cmdq_pkt *pkt);
>  void mtk_mutex_disable(struct mtk_mutex *mutex);
>  void mtk_mutex_remove_comp(struct mtk_mutex *mutex,
>  			   enum mtk_ddp_comp_id id);


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 2/6] soc: mediatek: mutex: add 8183 MUTEX MOD settings for MDP
  2022-03-16  3:31   ` CK Hu
@ 2022-03-17 10:11     ` moudy.ho
  0 siblings, 0 replies; 24+ messages in thread
From: moudy.ho @ 2022-03-17 10:11 UTC (permalink / raw)
  To: CK Hu, Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	AngeloGioacchino Del Regno, Maoguang Meng, daoyuan huang,
	Ping-Hsun Wu, menghui.lin, sj.huang, allen-kh.cheng, randy.wu,
	jason-jh.lin, roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

On Wed, 2022-03-16 at 11:31 +0800, CK Hu wrote:
> Hi, Moudy:
> 
> On Tue, 2022-03-15 at 14:10 +0800, Moudy Ho wrote:
> > For the purpose of module independence, related settings should be
> > moved
> > from MDP to the corresponding driver.
> > This patch adds 8183 MUTEX MOD settings for MDP.
> > 
> > Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
> > ---
> >  drivers/soc/mediatek/mtk-mutex.c | 21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> > 
> > diff --git a/drivers/soc/mediatek/mtk-mutex.c
> > b/drivers/soc/mediatek/mtk-mutex.c
> > index 778b01ce9e8f..88fb4fc8f216 100644
> > --- a/drivers/soc/mediatek/mtk-mutex.c
> > +++ b/drivers/soc/mediatek/mtk-mutex.c
> > @@ -80,6 +80,15 @@
> >  #define MT8183_MUTEX_MOD_DISP_GAMMA0		16
> >  #define MT8183_MUTEX_MOD_DISP_DITHER0		17
> >  
> > +#define MT8183_MUTEX_MOD_MDP_RDMA0		BIT(2)
> 
> Display definition is a number, why MDP is bit definition?
> 
> Regards,
> CK
> 
Hi CK,

Thanks for the reminder.
 * It was intended to apply the new declaration style (ref: 
   https://patchwork.kernel.org/project/linux-mediatek/patch/20220311015506.11232-9-nancy.lin@mediatek.com/
   ), but it seems redundant. I should add the new settings in the
   original way first, then keep the definition changes in the
   subsequence patch.

Thanks,
Moudy
> > +#define MT8183_MUTEX_MOD_MDP_RSZ0		BIT(4)
> > +#define MT8183_MUTEX_MOD_MDP_RSZ1		BIT(5)
> > +#define MT8183_MUTEX_MOD_MDP_TDSHP0		BIT(6)
> > +#define MT8183_MUTEX_MOD_MDP_WROT0		BIT(7)
> > +#define MT8183_MUTEX_MOD_MDP_WDMA		BIT(8)
> > +#define MT8183_MUTEX_MOD_MDP_AAL0		BIT(23)
> > +#define MT8183_MUTEX_MOD_MDP_CCORR0		BIT(24)
> > +
> >  #define MT8173_MUTEX_MOD_DISP_OVL0		11
> >  #define MT8173_MUTEX_MOD_DISP_OVL1		12
> >  #define MT8173_MUTEX_MOD_DISP_RDMA0		13
> > @@ -244,6 +253,17 @@ static const unsigned int
> > mt8183_mutex_mod[DDP_COMPONENT_ID_MAX] = {
> >  	[DDP_COMPONENT_WDMA0] = MT8183_MUTEX_MOD_DISP_WDMA0,
> >  };
> >  
> > 
> 
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
  2022-03-15 14:58         ` AngeloGioacchino Del Regno
@ 2022-03-17 12:43           ` moudy.ho
  0 siblings, 0 replies; 24+ messages in thread
From: moudy.ho @ 2022-03-17 12:43 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, Geert Uytterhoeven, Rob Landley
  Cc: Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec, Chun-Kuang Hu, Geert Uytterhoeven,
	Laurent Pinchart, Linux Media Mailing List,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux ARM, linux-mediatek, Linux Kernel Mailing List,
	Alexandre Courbot, Tomasz Figa, drinkcat, Pi-Hsun Shih,
	Hsin-Yi Wang, Maoguang Meng, daoyuan huang, Ping-Hsun Wu,
	menghui.lin, sj.huang, allen-kh.cheng, randy.wu, jason-jh.lin,
	roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

On Tue, 2022-03-15 at 15:58 +0100, AngeloGioacchino Del Regno wrote:
> Il 15/03/22 15:50, Geert Uytterhoeven ha scritto:
> > Hi Rob,
> > 
> > On Tue, Mar 15, 2022 at 3:37 PM Rob Landley <rob@landley.net>
> > wrote:
> > > On 3/15/22 4:10 AM, AngeloGioacchino Del Regno wrote:
> > > > Il 15/03/22 07:10, Moudy Ho ha scritto:
> > > > > In order to allow multiple modules to operate MUTEX hardware
> > > > > through
> > > > > a common interfrace, a flexible index "mtk_mutex_table_index"
> > > > > needs to
> > > > > be added to replace original component ID so that like DDP
> > > > > and MDP
> > > > > can add their own MUTEX table settings independently.
> > > > > 
> > > > > In addition, 4 generic interface "mtk_mutex_set_mod",
> > > > > "mtk_mutex_set_sof",
> > > > > "mtk_mutex_clear_mod" and "mtk_mutex_clear_sof" have been
> > > > > added, which is
> > > > > expected to replace the "mtk_mutex_add_comp" and
> > > > > "mtk_mutex_remove_comp"
> > > > > pair originally dedicated to DDP in the future.
> > > > > 
> > > > > Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
> > > > > --- a/drivers/soc/mediatek/mtk-mutex.c
> > > > > +++ b/drivers/soc/mediatek/mtk-mutex.c
> > > > > @@ -156,6 +156,7 @@ struct mtk_mutex_data {
> > > > >       const unsigned int *mutex_sof;
> > > > >       const unsigned int mutex_mod_reg;
> > > > >       const unsigned int mutex_sof_reg;
> > > > > +    const unsigned long long *mutex_table_mod;
> > > > 
> > > > Can we change this to u64 instead?
> > > 
> > > Linux is still LP64, correct?
> > 
> > On 64-bit platforms, yes.
> > 
> > Note that this is about "long long", which is 64-bit on all Linux
> > platforms.
> > But as the table seems to be used to store 2 32-bit values, it
> > doesn't hurt
> > to be explicit and use "u64"? Or a struct with 2 "u32" values?
> > 
> 
> Exactly. I wanted this to be a hint of what's happening in the
> background,
> without using unions to describe this.
> 
> Geert, thanks for immediately understanding my intention.
> 
> Cheers,
> Angelo
> 
> > Gr{oetje,eeting}s,
> > 
> >                          Geert
> > 
> > --
> > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> > geert@linux-m68k.org
> > 
> > In personal conversations with technical people, I call myself a
> > hacker. But
> > when I'm talking to journalists I just say "programmer" or
> > something like that.
> >                                  -- Linus Torvalds
> 
> 
Hi,

Thanks for all suggestions, I will adjust this confusing settings, and
change to a more efficient space-using way to achieve same purpose.

Thanks,
Moudy


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
  2022-03-16  2:25   ` CK Hu
@ 2022-03-17 12:45     ` moudy.ho
  0 siblings, 0 replies; 24+ messages in thread
From: moudy.ho @ 2022-03-17 12:45 UTC (permalink / raw)
  To: CK Hu, Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Hans Verkuil, Jernej Skrabec
  Cc: Chun-Kuang Hu, Geert Uytterhoeven, Rob Landley, Laurent Pinchart,
	linux-media, devicetree, linux-arm-kernel, linux-mediatek,
	linux-kernel, Alexandre Courbot, tfiga, drinkcat, pihsun, hsinyi,
	AngeloGioacchino Del Regno, Maoguang Meng, daoyuan huang,
	Ping-Hsun Wu, menghui.lin, sj.huang, allen-kh.cheng, randy.wu,
	jason-jh.lin, roy-cw.yeh, river.cheng, srv_heupstream,
	Project_Global_Chrome_Upstream_Group

On Wed, 2022-03-16 at 10:25 +0800, CK Hu wrote:
> Hi, Moudy:
> 
> On Tue, 2022-03-15 at 14:10 +0800, Moudy Ho wrote:
> > In order to allow multiple modules to operate MUTEX hardware
> > through
> > a common interfrace, a flexible index "mtk_mutex_table_index" needs
> > to
> > be added to replace original component ID so that like DDP and MDP
> > can add their own MUTEX table settings independently.
> > 
> > In addition, 4 generic interface "mtk_mutex_set_mod",
> > "mtk_mutex_set_sof",
> > "mtk_mutex_clear_mod" and "mtk_mutex_clear_sof" have been added,
> > which is
> > expected to replace the "mtk_mutex_add_comp" and
> > "mtk_mutex_remove_comp"
> > pair originally dedicated to DDP in the future.
> > 
> > Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
> > ---
> >  drivers/soc/mediatek/mtk-mutex.c       | 122
> > +++++++++++++++++++++++++
> >  include/linux/soc/mediatek/mtk-mutex.h |  33 +++++++
> >  2 files changed, 155 insertions(+)
> > 
> 
> [snip]
> 
> > 
> > diff --git a/include/linux/soc/mediatek/mtk-mutex.h
> > b/include/linux/soc/mediatek/mtk-mutex.h
> > index 6fe4ffbde290..c8355bb0e6d6 100644
> > --- a/include/linux/soc/mediatek/mtk-mutex.h
> > +++ b/include/linux/soc/mediatek/mtk-mutex.h
> > @@ -10,14 +10,47 @@ struct regmap;
> >  struct device;
> >  struct mtk_mutex;
> >  
> > +enum mtk_mutex_table_index {
> > +	MUTEX_TABLE_IDX_NONE = 0,	/* Invalid engine */
> 
> Useless, so remove this.
> 
> > +
> > +	/* MDP table index */
> > +	MUTEX_TABLE_IDX_MDP_RDMA0,
> > +	MUTEX_TABLE_IDX_MDP_RSZ0,
> > +	MUTEX_TABLE_IDX_MDP_RSZ1,
> > +	MUTEX_TABLE_IDX_MDP_TDSHP0,
> > +	MUTEX_TABLE_IDX_MDP_WROT0,
> > +	MUTEX_TABLE_IDX_MDP_WDMA,
> > +	MUTEX_TABLE_IDX_MDP_AAL0,
> > +	MUTEX_TABLE_IDX_MDP_CCORR0,
> > +
> > +	/* DDP table index */
> > +	MUTEX_TABLE_IDX_DDP_DSI0,
> > +	MUTEX_TABLE_IDX_DDP_DSI1,
> > +	MUTEX_TABLE_IDX_DDP_DSI2,
> > +	MUTEX_TABLE_IDX_DDP_DSI3,
> > +	MUTEX_TABLE_IDX_DDP_DPI0,
> > +	MUTEX_TABLE_IDX_DDP_DPI1,
> > +	MUTEX_TABLE_IDX_DDP_DP_INTF0,
> > +	MUTEX_TABLE_IDX_DDP_DP_INTF1,
> 
> If this patch would support DDP, add all DDP index. If this patch
> does
> not support DDP, remove these.
> 
> Regards,
> CK
> 

Hi CK,

Thanks for your review. I will remove those redundant settings.

Thanks,
Moudy
> > +
> > +	MUTEX_TABLE_IDX_MAX		/* ALWAYS keep at the end */
> > +};
> > +
> >  struct mtk_mutex *mtk_mutex_get(struct device *dev);
> >  int mtk_mutex_prepare(struct mtk_mutex *mutex);
> >  void mtk_mutex_add_comp(struct mtk_mutex *mutex,
> >  			enum mtk_ddp_comp_id id);
> > +void mtk_mutex_set_mod(struct mtk_mutex *mutex,
> > +		       enum mtk_mutex_table_index idx);
> > +void mtk_mutex_set_sof(struct mtk_mutex *mutex,
> > +		       enum mtk_mutex_table_index idx);
> >  void mtk_mutex_enable(struct mtk_mutex *mutex);
> >  void mtk_mutex_disable(struct mtk_mutex *mutex);
> >  void mtk_mutex_remove_comp(struct mtk_mutex *mutex,
> >  			   enum mtk_ddp_comp_id id);
> > +void mtk_mutex_clear_mod(struct mtk_mutex *mutex,
> > +			 enum mtk_mutex_table_index idx);
> > +void mtk_mutex_clear_sof(struct mtk_mutex *mutex);
> >  void mtk_mutex_unprepare(struct mtk_mutex *mutex);
> >  void mtk_mutex_put(struct mtk_mutex *mutex);
> >  void mtk_mutex_acquire(struct mtk_mutex *mutex);
> 
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-03-17 12:56 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-15  6:10 [PATCH v13 0/6] Add mutex support for MDP Moudy Ho
2022-03-15  6:10 ` [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX Moudy Ho
2022-03-15  9:10   ` AngeloGioacchino Del Regno
2022-03-15 14:41     ` Rob Landley
2022-03-15 14:50       ` Geert Uytterhoeven
2022-03-15 14:58         ` AngeloGioacchino Del Regno
2022-03-17 12:43           ` moudy.ho
2022-03-16  2:25   ` CK Hu
2022-03-17 12:45     ` moudy.ho
2022-03-15  6:10 ` [PATCH v13 2/6] soc: mediatek: mutex: add 8183 MUTEX MOD settings for MDP Moudy Ho
2022-03-15  9:11   ` AngeloGioacchino Del Regno
2022-03-16  3:31   ` CK Hu
2022-03-17 10:11     ` moudy.ho
2022-03-15  6:10 ` [PATCH v13 3/6] dt-bindings: soc: mediatek: move out common module from display folder Moudy Ho
2022-03-15  9:11   ` AngeloGioacchino Del Regno
2022-03-16  3:36   ` CK Hu
2022-03-15  6:10 ` [PATCH v13 4/6] dt-bindings: soc: mediatek: add gce-client-reg for MUTEX Moudy Ho
2022-03-15  9:12   ` AngeloGioacchino Del Regno
2022-03-16  3:50   ` CK Hu
2022-03-15  6:10 ` [PATCH v13 5/6] dts: arm64: mt8183: add GCE client property for Mediatek MUTEX Moudy Ho
2022-03-15  9:12   ` AngeloGioacchino Del Regno
2022-03-15  6:10 ` [PATCH v13 6/6] soc: mediatek: mutex: add functions that operate registers by CMDQ Moudy Ho
2022-03-15  9:13   ` AngeloGioacchino Del Regno
2022-03-17  3:39   ` CK Hu

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).