Add mutex support for MDP
Subsystems (6)
v13 cover Add mutex support for MDP
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/[email protected]/
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%)Signature · 1 line
2.18.0
PATCH v13 1/6 soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
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.
--- drivers/soc/mediatek/mtk-mutex.c | 122 +++++++++++++++++++++++++ include/linux/soc/mediatek/mtk-mutex.h | 33 +++++++ 2 files changed, 155 insertions(+)
drivers/soc/mediatek/mtk-mutex.c +122 -0
@@ -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,
include/linux/soc/mediatek/mtk-mutex.h +33 -0
@@ -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);
Signature · 1 line
2.18.0
Re: [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
Il 15/03/22 07:10, Moudy Ho ha scritto:
Quoted 21 lines
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 <[email protected]>--- drivers/soc/mediatek/mtk-mutex.c | 122 +++++++++++++++++++++++++ include/linux/soc/mediatek/mtk-mutex.h | 33 +++++++ 2 files changed, 155 insertions(+)drivers/soc/mediatek/mtk-mutex.c +0
-0
drivers/soc/mediatek/mtk-mutex.c struct mtk_mutex_data { · line 159
Quoted 4 lines
drivers/soc/mediatek/mtk-mutex.c +1
-0@@ -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,
Re: [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
Quoted 17 lines · AngeloGioacchino Del Regno
Il 15/03/22 07:10, Moudy Ho ha scritto:
Quoted 16 lines
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 <[email protected]>--- drivers/soc/mediatek/mtk-mutex.c | 122 +++++++++++++++++++++++++ include/linux/soc/mediatek/mtk-mutex.h | 33 +++++++ 2 files changed, 155 insertions(+)
Quoted 11 lines
drivers/soc/mediatek/mtk-mutex.c struct mtk_mutex_data { · line 159
Quoted 9 lines
drivers/soc/mediatek/mtk-mutex.c +1
-0@@ -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
Re: [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
Hi Rob,
Quoted 24 lines · Rob Landley
Quoted 13 lines · AngeloGioacchino Del Regno
Il 15/03/22 07:10, Moudy Ho ha scritto:
Quoted 11 lines
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 <[email protected]>Quoted 9 lines
drivers/soc/mediatek/mtk-mutex.c struct mtk_mutex_data { · line 159
Quoted 7 lines
drivers/soc/mediatek/mtk-mutex.c +1
-0@@ -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?
Quoted 1 line
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 -- [email protected]
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
AngeloGioacchino Del Regno
maintainerRe: [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
Il 15/03/22 15:50, Geert Uytterhoeven ha scritto:
Quoted 27 lines
Hi Rob,
Quoted 24 lines · Rob Landley
Quoted 22 lines · AngeloGioacchino Del Regno
Il 15/03/22 07:10, Moudy Ho ha scritto:
Quoted 15 lines
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 <[email protected]>drivers/soc/mediatek/mtk-mutex.c struct mtk_mutex_data { · line 159
Quoted 4 lines
drivers/soc/mediatek/mtk-mutex.c +1
-0@@ -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?
Quoted 8 lines
Quoted 1 line
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
Quoted 10 lines
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]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
Re: [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
Quoted 45 lines · AngeloGioacchino Del Regno
Il 15/03/22 15:50, Geert Uytterhoeven ha scritto:
Quoted 35 lines
Hi Rob,
Quoted 29 lines · Rob Landley
Quoted 17 lines · AngeloGioacchino Del Regno
Il 15/03/22 07:10, Moudy Ho ha scritto:
Quoted 16 lines
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.Quoted 10 lines
drivers/soc/mediatek/mtk-mutex.c struct mtk_mutex_data { · line 159
Quoted 8 lines
Signed-off-by Moudy Ho <[email protected]>drivers/soc/mediatek/mtk-mutex.c +1
-0@@ -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?
Quoted 1 line
Linux is still LP64, correct?
Quoted 8 lines
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?
Quoted 24 lines
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,
AngeloQuoted 13 lines
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]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-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
In reply to Moudy HoHi, Moudy:
Quoted 21 lines · Moudy Ho
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 <[email protected]>--- drivers/soc/mediatek/mtk-mutex.c | 122 +++++++++++++++++++++++++ include/linux/soc/mediatek/mtk-mutex.h | 33 +++++++ 2 files changed, 155 insertions(+)
[snip]
include/linux/soc/mediatek/mtk-mutex.h struct regmap; · line 14
Quoted 12 lines
include/linux/soc/mediatek/mtk-mutex.h +2
-0@@ -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.
Quoted 10 lines
include/linux/soc/mediatek/mtk-mutex.h +10
-0+ +/* 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,
include/linux/soc/mediatek/mtk-mutex.h struct regmap; · line 34
Quoted 10 lines
include/linux/soc/mediatek/mtk-mutex.h +10
-0+ +/* 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
Quoted 22 lines
include/linux/soc/mediatek/mtk-mutex.h +11
-0+ +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);
Re: [PATCH v13 1/6] soc: mediatek: mutex: add common interface to accommodate multiple modules operationg MUTEX
Quoted 68 lines · CK Hu
Hi, Moudy:
Quoted 22 lines · Moudy Ho
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 <[email protected]>--- drivers/soc/mediatek/mtk-mutex.c | 122 +++++++++++++++++++++++++ include/linux/soc/mediatek/mtk-mutex.h | 33 +++++++ 2 files changed, 155 insertions(+)[snip]
include/linux/soc/mediatek/mtk-mutex.h struct regmap; · line 14
Quoted 12 lines
include/linux/soc/mediatek/mtk-mutex.h +2
-0@@ -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.
Quoted 10 lines
include/linux/soc/mediatek/mtk-mutex.h +10
-0+ +/* 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,include/linux/soc/mediatek/mtk-mutex.h struct regmap; · line 34
Quoted 10 lines
include/linux/soc/mediatek/mtk-mutex.h +10
-0+ +/* 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.
Quoted 3 lines
Regards,
CK
Hi CK,
Thanks for your review. I will remove those redundant settings.
Thanks,
Moudy
Quoted 14 lines
Quoted 14 lines
include/linux/soc/mediatek/mtk-mutex.h +8
-0+ + 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);
Quoted 10 lines
include/linux/soc/mediatek/mtk-mutex.h struct regmap; · line 56
Quoted 8 lines
include/linux/soc/mediatek/mtk-mutex.h +3
-0void 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-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v13 2/6 soc: mediatek: mutex: add 8183 MUTEX MOD settings for MDP
In reply to Moudy HoFor 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.
--- drivers/soc/mediatek/mtk-mutex.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/soc/mediatek/mtk-mutex.c +21 -0
@@ -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, };
Signature · 1 line
2.18.0
Re: [PATCH v13 2/6] soc: mediatek: mutex: add 8183 MUTEX MOD settings for MDP
Il 15/03/22 07:10, Moudy Ho ha scritto:
Quoted 5 lines
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 <[email protected]>
Re: [PATCH v13 2/6] soc: mediatek: mutex: add 8183 MUTEX MOD settings for MDP
In reply to Moudy HoHi, Moudy:
Quoted 16 lines · Moudy Ho
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 <[email protected]>--- drivers/soc/mediatek/mtk-mutex.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)drivers/soc/mediatek/mtk-mutex.c +0
-0
drivers/soc/mediatek/mtk-mutex.c line 83
Quoted 4 lines
drivers/soc/mediatek/mtk-mutex.c +1
-0@@ -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
Quoted 17 lines
drivers/soc/mediatek/mtk-mutex.c +8
-0+#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, };
Re: [PATCH v13 2/6] soc: mediatek: mutex: add 8183 MUTEX MOD settings for MDP
Quoted 22 lines · CK Hu
Hi, Moudy:
Quoted 19 lines · Moudy Ho
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 <[email protected]>--- drivers/soc/mediatek/mtk-mutex.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)drivers/soc/mediatek/mtk-mutex.c +0
-0@@ -80,6 +80,15 @@#define MT8183_MUTEX_MOD_DISP_GAMMA0 16#define MT8183_MUTEX_MOD_DISP_DITHER0 17
Quoted 7 lines
drivers/soc/mediatek/mtk-mutex.c line 83
Quoted 1 line
drivers/soc/mediatek/mtk-mutex.c +1
-0+#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/[email protected]/
), 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
Quoted 9 lines
Quoted 9 lines
drivers/soc/mediatek/mtk-mutex.c +8
-0+#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
Quoted 10 lines
drivers/soc/mediatek/mtk-mutex.c static const unsigned int · line 257
Quoted 8 lines
drivers/soc/mediatek/mtk-mutex.c +0
-0#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-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v13 3/6 dt-bindings: soc: mediatek: move out common module from display folder
In reply to Moudy HoIn order to share the same hardware information with MDP3, change the MUTEX dt-binding to the path "soc/mediatek".
---
.../{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%)Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml renamed from Documentation/devicetree/bindings/display/mediatek/mediatek,mutex.yaml +3 -7
@@ -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 <[email protected]> - Philipp Zabel <[email protected]> + - Matthias Brugger <[email protected]> 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:
Signature · 7 lines
2.18.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v13 3/6] dt-bindings: soc: mediatek: move out common module from display folder
Il 15/03/22 07:10, Moudy Ho ha scritto:
Quoted 4 lines
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 <[email protected]>
Re: [PATCH v13 3/6] dt-bindings: soc: mediatek: move out common module from display folder
In reply to Moudy HoHi, Moudy:
Quoted 55 lines · Moudy Ho
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 <[email protected]>--- .../{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.yamlsimilarity index 84%
rename fromDocumentation/devicetree/bindings/display/mediatek/mediatek,mutex.yaml
rename toDocumentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yamlindex6eca525eced0..4adc67cafd29100644
---
a/Documentation/devicetree/bindings/display/mediatek/mediatek,mutex.y aml
+++b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yamlDocumentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml renamed from Documentation/devicetree/bindings/display/mediatek/mediatek,mutex.yaml +0
-1@@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2 --- -$id:title: Mediatek mutex
Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml renamed from Documentation/devicetree/bindings/display/mediatek/mediatek,mutex.yaml +1
-0@@ -9,17 +9,13 @@ title: Mediatek mutex maintainers: - Chun-Kuang Hu <[email protected]> - Philipp Zabel <[email protected]> + - Matthias Brugger <[email protected]> description: | Mediatek mutex, namely MUTEX, is used to send the triggers signalscalled
- Start Of Frame (SOF) / End Of Frame (EOF) to each sub-modules on the display(quoted diff) +1
-1- data path or MDP data path. + Start Of Frame(SOF) / End Of Frame(EOF) to each sub-modules on the
Quoted 1 line
data path.
If this is not related to 'move out', separate this to another patch.
Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml title: Mediatek mutex · line 22
Quoted 8 lines
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 centralMMSYS_CONFIGnode.Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml renamed from Documentation/devicetree/bindings/display/mediatek/mediatek,mutex.yaml +0
-3- 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
Quoted 3 lines
properties:
compatible:
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v13 4/6 dt-bindings: soc: mediatek: add gce-client-reg for MUTEX
In reply to Moudy HoIn order to allow modules with latency requirements such as MDP3 to set registers through CMDQ, add the relevant GCE property.
--- .../devicetree/bindings/soc/mediatek/mediatek,mutex.yaml | 8 ++++++++ 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml +8 -0
@@ -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
Signature · 1 line
2.18.0
Re: [PATCH v13 4/6] dt-bindings: soc: mediatek: add gce-client-reg for MUTEX
Il 15/03/22 07:10, Moudy Ho ha scritto:
Quoted 4 lines
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 <[email protected]>
Re: [PATCH v13 4/6] dt-bindings: soc: mediatek: add gce-client-reg for MUTEX
In reply to Moudy HoHi, Moudy:
Quoted 2 lines · Moudy Ho
In order to allow modules with latency requirements such as MDP3 to set registers through CMDQ, add the relevant GCE property.
Quoted 33 lines
Signed-off-by Moudy Ho <[email protected]>--- .../devicetree/bindings/soc/mediatek/mediatek,mutex.yaml | 8 ++++++++ 1 file changed, 8 insertions(+)diff --git
a/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yamlb/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yamlindex4adc67cafd29..06106779d129100644
---a/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml
+++b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yamlDocumentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml +2
-0@@ -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 bygce 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
clientDocumentation/devicetree/bindings/soc/mediatek/mediatek,mutex.yaml +4
-0+ defined in the header include/dt-bindings/gce/<chip>-gce.h. + $ref: /schemas/types.yaml#/definitions/phandle-array + maxItems: 1 + required: - compatible - reg
PATCH v13 5/6 dts: arm64: mt8183: add GCE client property for Mediatek MUTEX
In reply to Moudy HoIn order to allow modules with latency requirements such as MDP3 to set registers through CMDQ, add the relevant dts property.
--- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/mediatek/mt8183.dtsi +1 -0
@@ -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 {
Signature · 1 line
2.18.0
Re: [PATCH v13 5/6] dts: arm64: mt8183: add GCE client property for Mediatek MUTEX
Il 15/03/22 07:10, Moudy Ho ha scritto:
Quoted 4 lines
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 <[email protected]>
Quoted 16 lines
--- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 1 + 1 file changed, 1 insertion(+)arch/arm64/boot/dts/mediatek/mt8183.dtsi +1
-0@@ -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 {
PATCH v13 6/6 soc: mediatek: mutex: add functions that operate registers by CMDQ
In reply to Moudy HoDue 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.
--- drivers/soc/mediatek/mtk-mutex.c | 42 +++++++++++++++++++++++++- include/linux/soc/mediatek/mtk-mutex.h | 2 ++ 2 files changed, 43 insertions(+), 1 deletion(-)
drivers/soc/mediatek/mtk-mutex.c +41 -1
@@ -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)) {
include/linux/soc/mediatek/mtk-mutex.h +2 -0
@@ -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);
Signature · 1 line
2.18.0
Re: [PATCH v13 6/6] soc: mediatek: mutex: add functions that operate registers by CMDQ
Il 15/03/22 07:10, Moudy Ho ha scritto:
Quoted 8 lines
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 <[email protected]>
Re: [PATCH v13 6/6] soc: mediatek: mutex: add functions that operate registers by CMDQ
In reply to Moudy HoHi, Moudy:
Quoted 22 lines · Moudy Ho
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 <[email protected]>--- drivers/soc/mediatek/mtk-mutex.c | 42 +++++++++++++++++++++++++- include/linux/soc/mediatek/mtk-mutex.h | 2 ++ 2 files changed, 43 insertions(+), 1 deletion(-)drivers/soc/mediatek/mtk-mutex.c +0
-0@@ -7,10 +7,16 @@#include <linux/iopoll.h>
drivers/soc/mediatek/mtk-mutex.c line 17
Quoted 10 lines
drivers/soc/mediatek/mtk-mutex.c +4
-0#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.
drivers/soc/mediatek/mtk-mutex.c line 18
Quoted 1 line
drivers/soc/mediatek/mtk-mutex.c +1
-0+#define MTK_MUTEX_MOD_MASK 0x07FFFFFF
Useless, remove.
drivers/soc/mediatek/mtk-mutex.c line 19
Quoted 1 line
drivers/soc/mediatek/mtk-mutex.c +1
-0+#define MTK_MUTEX_SOF_MASK 0x00000007
Ditto.
Quoted 36 lines
drivers/soc/mediatek/mtk-mutex.c +4
-0#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_datamt8186_mutex_driver_data= {drivers/soc/mediatek/mtk-mutex.c +3
-0@@ -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) +{
drivers/soc/mediatek/mtk-mutex.c void mtk_mutex_enable(struct mtk_mutex *mutex) · line 664
Quoted 10 lines
drivers/soc/mediatek/mtk-mutex.c +9
-0+#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 */
Quoted 20 lines
drivers/soc/mediatek/mtk-mutex.c +4
-0+#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, structmtk_mutex_ctx,drivers/soc/mediatek/mtk-mutex.c +1
-1@@ -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;drivers/soc/mediatek/mtk-mutex.c +0
-0mtx =devm_kzalloc (dev,sizeof (*mtx),GFP_KERNEL );@@ -698,6 +724,20 @@ static int mtk_mutex_probe(struct platform_device *pdev)
drivers/soc/mediatek/mtk-mutex.c static int mtk_mutex_probe(struct · line 734
Quoted 10 lines
drivers/soc/mediatek/mtk-mutex.c +7
-0} } +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.
Regards,
CK
Quoted 16 lines
drivers/soc/mediatek/mtk-mutex.c +7
-0+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);drivers/soc/mediatek/mtk-mutex.c +0
-0if (IS_ERR (mtx->regs)) {include/linux/soc/mediatek/mtk-mutex.h +0
-0
include/linux/soc/mediatek/mtk-mutex.h void mtk_mutex_set_mod(struct mtk_mutex *mutex, · line 52
Quoted 8 lines
include/linux/soc/mediatek/mtk-mutex.h +2
-0@@ -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-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek