Add MT8186 ADSP dt-binding
Subsystems (2)
PATCH v2 1/3 dt-bindings: dsp: mediatek: Use meaningful names for mbox
In reply to Tinghan ShenRename mbox according to action instead of 'mbox0' and 'mbox1'.
--- .../devicetree/bindings/dsp/mediatek,mt8195-dsp.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/dsp/mediatek,mt8195-dsp.yaml +3 -3
@@ -55,8 +55,8 @@ properties: mbox-names: items: - - const: mbox0 - - const: mbox1 + - const: rep + - const: req memory-region: items:
@@ -100,6 +100,6 @@ examples: memory-region = <&adsp_dma_mem_reserved>, <&adsp_mem_reserved>; power-domains = <&spm 6>; //MT8195_POWER_DOMAIN_ADSP - mbox-names = "mbox0", "mbox1"; + mbox-names = "rep", "req"; mboxes = <&adsp_mailbox0>, <&adsp_mailbox1>; };
Signature · 1 line
2.18.0
PATCH v2 3/3 dt-bindings: dsp: mediatek: add mt8186 dsp document
In reply to Tinghan ShenThis patch adds mt8186 dsp document. The dsp is used for Sound Open Firmware driver node. It includes registers, clocks, memory regions, and mailbox for dsp.
--- .../bindings/dsp/mediatek,mt8186-dsp.yaml | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 Documentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yaml
Documentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yaml new file +91 -0
@@ -0,0 +1,91 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/dsp/mediatek,mt8186-dsp.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek mt8186 DSP core + +maintainers: + - Tinghan Shen <[email protected]> + +description: | + MediaTek mt8186 SoC contains a DSP core used for + advanced pre- and post- audio processing. + +properties: + compatible: + const: mediatek,mt8186-dsp + + reg: + items: + - description: Address and size of the DSP config registers + - description: Address and size of the DSP SRAM + - description: Address and size of the DSP secure registers + - description: Address and size of the DSP bus registers + + reg-names: + items: + - const: cfg + - const: sram + - const: sec + - const: bus + + clocks: + items: + - description: mux for audio dsp clock + - description: mux for audio dsp local bus + + clock-names: + items: + - const: audiodsp + - const: adsp_bus + + power-domains: + maxItems: 1 + + mboxes: + items: + - description: ipc reply between host and audio DSP. + - description: ipc request between host and audio DSP. + + mbox-names: + items: + - const: rep + - const: req + + memory-region: + items: + - description: dma buffer between host and DSP. + - description: DSP system memory. + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - power-domains + - mbox-names + - mboxes + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/mt8186-clk.h> + dsp@10680000 { + compatible = "mediatek,mt8186-dsp"; + reg = <0x10680000 0x2000>, + <0x10800000 0x100000>, + <0x1068b000 0x100>, + <0x1068f000 0x1000>; + reg-names = "cfg", "sram", "sec", "bus"; + clocks = <&topckgen CLK_TOP_AUDIODSP>, + <&topckgen CLK_TOP_ADSP_BUS>; + clock-names = "audiodsp", + "adsp_bus"; + power-domains = <&spm 6>; + mbox-names = "rep", "req"; + mboxes = <&adsp_mailbox0>, <&adsp_mailbox1>; + };
Signature · 1 line
2.18.0
PATCH v2 2/3 firmware: mediatek: Use meaningful names for mbox
In reply to Tinghan ShenRename mbox according to action instead of 'mbox0' and 'mbox1'
--- drivers/firmware/mtk-adsp-ipc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/firmware/mtk-adsp-ipc.c +5 -1
@@ -83,7 +83,11 @@ static int mtk_adsp_ipc_probe(struct platform_device *pdev)return -ENOMEM ;for (i =0 ; i <MTK_ADSP_MBOX_NUM ; i++) { - chan_name =kasprintf (GFP_KERNEL ,"mbox%d" , i); +if (i <MTK_ADSP_MBOX_NUM /2 ) + chan_name =kasprintf (GFP_KERNEL ,"rep" ); +else + chan_name =kasprintf (GFP_KERNEL ,"req" ); +if (!chan_name) { ret = -ENOMEM ; goto out;
Signature · 1 line
2.18.0
v2 cover Add MT8186 ADSP dt-binding
v1 -> v2:
1. Change mbox-names from mbox0/mbox1 to rep/req for both mt8186 and mt8195.
2. rename clock-names and remove unused headers
Tinghan Shen (3):
dt-bindings: dsp: mediatek: Use meaningful names for mbox
firmware: mediatek: Use meaningful names for mbox
dt-bindings: dsp: mediatek: add mt8186 dsp document
.../bindings/dsp/mediatek,mt8186-dsp.yaml | 91 +++++++++++++++++++ .../bindings/dsp/mediatek,mt8195-dsp.yaml | 6 +- drivers/firmware/mtk-adsp-ipc.c | 6 +- 3 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yaml
Signature · 1 line
2.18.0
AngeloGioacchino Del Regno
maintainerRe: [PATCH v2 2/3] firmware: mediatek: Use meaningful names for mbox
In reply to Tinghan ShenIl 09/06/22 10:31, Tinghan Shen ha scritto:
Quoted 14 lines
Rename mbox according to action instead of 'mbox0' and 'mbox1'
Signed-off-by Tinghan Shen <[email protected]>--- drivers/firmware/mtk-adsp-ipc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/firmware/mtk-adsp-ipc.c +0
-0@@ -83,7 +83,11 @@ static int mtk_adsp_ipc_probe(struct platform_device *pdev)return -ENOMEM ;
drivers/firmware/mtk-adsp-ipc.c static int mtk_adsp_ipc_probe(struct platform_device *pdev) · line 93
Quoted 10 lines
drivers/firmware/mtk-adsp-ipc.c +5
-1for (i =0 ; i <MTK_ADSP_MBOX_NUM ; i++) { - chan_name =kasprintf (GFP_KERNEL ,"mbox%d" , i); +if (i <MTK_ADSP_MBOX_NUM /2 ) + chan_name =kasprintf (GFP_KERNEL ,"rep" ); +else + chan_name =kasprintf (GFP_KERNEL ,"req" ); +if (!chan_name) { ret = -ENOMEM ; goto out;
At this point, just call them "reply" and "request", as that simply provides a perfectly clear explanation.
Besides, I'm sorry but I really don't like this code, it's really too much fragile and will have to be changed entirely if a third mbox is introduced.
I can suggest a cooler way:
static const char * const adsp_mbox_ch_names[MTK_ADSP_MBOX_NUM] = { "rep", "req" };
for (i = 0; i < ARRAY_SIZE(adsp_mbox_ch_names); i++) {
/* we can delete chan_name and also avoid a kfree if we do... */
.... code ....
adsp_chan->ch = mbox_request_channel_byname(cl, adsp_mbox_ch_names[i]);
... etc etc ...
}Cheers,
Angelo
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
AngeloGioacchino Del Regno
maintainerRe: [PATCH v2 1/3] dt-bindings: dsp: mediatek: Use meaningful names for mbox
In reply to Tinghan ShenIl 09/06/22 10:30, Tinghan Shen ha scritto:
Quoted 12 lines
Rename mbox according to action instead of 'mbox0' and 'mbox1'.
Signed-off-by Tinghan Shen <[email protected]>--- .../devicetree/bindings/dsp/mediatek,mt8195-dsp.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)Documentation/devicetree/bindings/dsp/mediatek,mt8195-dsp.yaml +0
-0
Documentation/devicetree/bindings/dsp/mediatek,mt8195-dsp.yaml properties: · line 59
Quoted 7 lines
Documentation/devicetree/bindings/dsp/mediatek,mt8195-dsp.yaml +2
-2@@ -55,8 +55,8 @@ properties: mbox-names: items: - - const: mbox0 - - const: mbox1 + - const: rep + - const: req
"reply", "request" - as said on patch [2/3]....
P.S.: Adding context for anyone else reading this patch, mt8195 devicetrees didn't
get any dsp node yet.
Documentation/devicetree/bindings/dsp/mediatek,mt8195-dsp.yaml examples: · line 105
Quoted 11 lines
Documentation/devicetree/bindings/dsp/mediatek,mt8195-dsp.yaml +1
-1memory-region: items:@@ -100,6 +100,6 @@ examples: memory-region = <&adsp_dma_mem_reserved>, <&adsp_mem_reserved>; power-domains = <&spm 6>; //MT8195_POWER_DOMAIN_ADSP - mbox-names = "mbox0", "mbox1"; + mbox-names = "rep", "req"; mboxes = <&adsp_mailbox0>, <&adsp_mailbox1>; };
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v2 2/3] firmware: mediatek: Use meaningful names for mbox
In reply to AngeloGioacchino Del RegnoHi Angelo,
Quoted 46 lines · AngeloGioacchino Del Regno
Il 09/06/22 10:31, Tinghan Shen ha scritto:
Quoted 14 lines
Rename mbox according to action instead of 'mbox0' and 'mbox1'
Signed-off-by Tinghan Shen <[email protected]>--- drivers/firmware/mtk-adsp-ipc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/firmware/mtk-adsp-ipc.c +0
-0@@ -83,7 +83,11 @@ static int mtk_adsp_ipc_probe(struct platform_device *pdev)return -ENOMEM ;drivers/firmware/mtk-adsp-ipc.c static int mtk_adsp_ipc_probe(struct platform_device *pdev) · line 93
Quoted 10 lines
drivers/firmware/mtk-adsp-ipc.c +5
-1for (i =0 ; i <MTK_ADSP_MBOX_NUM ; i++) { - chan_name =kasprintf (GFP_KERNEL ,"mbox%d" , i); +if (i <MTK_ADSP_MBOX_NUM /2 ) + chan_name =kasprintf (GFP_KERNEL ,"rep" ); +else + chan_name =kasprintf (GFP_KERNEL ,"req" ); +if (!chan_name) { ret = -ENOMEM ; goto out;At this point, just call them "reply" and "request", as that simply provides a perfectly clear explanation.
Besides, I'm sorry but I really don't like this code, it's really too much fragile and will have to be changed entirely if a third mbox is introduced.
I can suggest a cooler way:
static const char * const adsp_mbox_ch_names[MTK_ADSP_MBOX_NUM] = { "rep", "req" };
for (i = 0; i < ARRAY_SIZE(adsp_mbox_ch_names); i++) { /* we can delete chan_name and also avoid a kfree if we do... */ .... code .... adsp_chan->ch = mbox_request_channel_byname(cl, adsp_mbox_ch_names[i]); ... etc etc ... }
Quoted 2 lines
Cheers,
Angelo
Ok, I'll update in the next version.
Thank you!
Best regards,
TingHan
Re: [PATCH v2 1/3] dt-bindings: dsp: mediatek: Use meaningful names for mbox
In reply to Tinghan ShenQuoted 12 lines · Tinghan Shen
Rename mbox according to action instead of 'mbox0' and 'mbox1'.
Signed-off-by Tinghan Shen <[email protected]>--- .../devicetree/bindings/dsp/mediatek,mt8195-dsp.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)Documentation/devicetree/bindings/dsp/mediatek,mt8195-dsp.yaml +0
-0
Documentation/devicetree/bindings/dsp/mediatek,mt8195-dsp.yaml properties: · line 60
Quoted 8 lines
Documentation/devicetree/bindings/dsp/mediatek,mt8195-dsp.yaml +2
-2@@ -55,8 +55,8 @@ properties: mbox-names: items: - - const: mbox0 - - const: mbox1 + - const: rep + - const: req
More common is rx/tx, which I proposed last time.
Best regards,
Krzysztof
Re: [PATCH v2 3/3] dt-bindings: dsp: mediatek: add mt8186 dsp document
In reply to Tinghan ShenQuoted 56 lines · Tinghan Shen
This patch adds mt8186 dsp document. The dsp is used for Sound Open Firmware driver node. It includes registers, clocks, memory regions, and mailbox for dsp.
Signed-off-by Tinghan Shen <[email protected]>--- .../bindings/dsp/mediatek,mt8186-dsp.yaml | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 Documentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yamlDocumentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yaml new file +40
-0@@ -0,0 +1,91 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/dsp/mediatek,mt8186-dsp.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek mt8186 DSP core + +maintainers: + - Tinghan Shen <[email protected]> + +description: | + MediaTek mt8186 SoC contains a DSP core used for + advanced pre- and post- audio processing. + +properties: + compatible: + const: mediatek,mt8186-dsp + + reg: + items: + - description: Address and size of the DSP config registers + - description: Address and size of the DSP SRAM + - description: Address and size of the DSP secure registers + - description: Address and size of the DSP bus registers + + reg-names: + items: + - const: cfg + - const: sram + - const: sec + - const: bus + + clocks: + items: + - description: mux for audio dsp clock + - description: mux for audio dsp local bus + + clock-names: + items:
Documentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yaml line 50
Quoted 10 lines
Documentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yaml new file +10
-0+ - const: audiodsp + - const: adsp_bus + + power-domains: + maxItems: 1 + + mboxes: + items: + - description: ipc reply between host and audio DSP. + - description: ipc request between host and audio DSP.
"IPC request between" does not specify who sends the request. Host or DSP?
See existing bindings for some better examples, e.g.:Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml which clearly states who receives from who.
Documentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yaml line 55
Quoted 5 lines
Documentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yaml new file +5
-0+ + mbox-names: + items: + - const: rep + - const: req
tx/rx
Best regards,
Krzysztof
Re: [PATCH v2 3/3] dt-bindings: dsp: mediatek: add mt8186 dsp document
Hi Krzysztof,
Quoted 85 lines · Krzysztof Kozlowski
Quoted 61 lines · Tinghan Shen
This patch adds mt8186 dsp document. The dsp is used for Sound Open Firmware driver node. It includes registers, clocks, memory regions, and mailbox for dsp.
Signed-off-by Tinghan Shen <[email protected]>--- .../bindings/dsp/mediatek,mt8186-dsp.yaml | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 Documentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yamlDocumentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yaml new file +4
-0@@ -0,0 +1,91 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id:Documentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yaml new file +35
-0+ +title: MediaTek mt8186 DSP core + +maintainers: + - Tinghan Shen <[email protected]> + +description: | + MediaTek mt8186 SoC contains a DSP core used for + advanced pre- and post- audio processing. + +properties: + compatible: + const: mediatek,mt8186-dsp + + reg: + items: + - description: Address and size of the DSP config registers + - description: Address and size of the DSP SRAM + - description: Address and size of the DSP secure registers + - description: Address and size of the DSP bus registers + + reg-names: + items: + - const: cfg + - const: sram + - const: sec + - const: bus + + clocks: + items: + - description: mux for audio dsp clock + - description: mux for audio dsp local bus + + clock-names: + items:Documentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yaml line 50
Quoted 10 lines
Documentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yaml new file +10
-0+ - const: audiodsp + - const: adsp_bus + + power-domains: + maxItems: 1 + + mboxes: + items: + - description: ipc reply between host and audio DSP. + - description: ipc request between host and audio DSP."IPC request between" does not specify who sends the request. Host or DSP?
See existing bindings for some better examples, e.g.:
Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yamlwhich clearly states who receives from who.Documentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yaml line 55
Quoted 5 lines
Documentation/devicetree/bindings/dsp/mediatek,mt8186-dsp.yaml new file +5
-0+ + mbox-names: + items: + - const: rep + - const: req
Quoted 7 lines
tx/rx
Best regards,
Krzysztof
OK. I'll update in the next version.
Thanks,
TingHan