Commit 13d272d5 authored by Mark Brown's avatar Mark Brown

Add MT8186 ADSP dt-binding

Merge series from Tinghan Shen <tinghan.shen@mediatek.com>:

Some updates to the DT bindings to make things less surprising for
users.
parents c3b5fd7f acaeb8c6
# 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 <tinghan.shen@mediatek.com>
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: mailbox for receiving audio DSP requests.
- description: mailbox for transmitting requests to audio DSP.
mbox-names:
items:
- const: rx
- const: tx
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 = "rx", "tx";
mboxes = <&adsp_mailbox0>, <&adsp_mailbox1>;
};
...@@ -50,13 +50,13 @@ properties: ...@@ -50,13 +50,13 @@ properties:
mboxes: mboxes:
items: items:
- description: ipc reply between host and audio DSP. - description: mailbox for receiving audio DSP requests.
- description: ipc request between host and audio DSP. - description: mailbox for transmitting requests to audio DSP.
mbox-names: mbox-names:
items: items:
- const: mbox0 - const: rx
- const: mbox1 - const: tx
memory-region: memory-region:
items: items:
...@@ -100,6 +100,6 @@ examples: ...@@ -100,6 +100,6 @@ examples:
memory-region = <&adsp_dma_mem_reserved>, memory-region = <&adsp_dma_mem_reserved>,
<&adsp_mem_reserved>; <&adsp_mem_reserved>;
power-domains = <&spm 6>; //MT8195_POWER_DOMAIN_ADSP power-domains = <&spm 6>; //MT8195_POWER_DOMAIN_ADSP
mbox-names = "mbox0", "mbox1"; mbox-names = "rx", "tx";
mboxes = <&adsp_mailbox0>, <&adsp_mailbox1>; mboxes = <&adsp_mailbox0>, <&adsp_mailbox1>;
}; };
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
static const char * const adsp_mbox_ch_names[MTK_ADSP_MBOX_NUM] = { "rx", "tx" };
/* /*
* mtk_adsp_ipc_send - send ipc cmd to MTK ADSP * mtk_adsp_ipc_send - send ipc cmd to MTK ADSP
* *
...@@ -72,7 +74,6 @@ static int mtk_adsp_ipc_probe(struct platform_device *pdev) ...@@ -72,7 +74,6 @@ static int mtk_adsp_ipc_probe(struct platform_device *pdev)
struct mtk_adsp_ipc *adsp_ipc; struct mtk_adsp_ipc *adsp_ipc;
struct mtk_adsp_chan *adsp_chan; struct mtk_adsp_chan *adsp_chan;
struct mbox_client *cl; struct mbox_client *cl;
char *chan_name;
int ret; int ret;
int i, j; int i, j;
...@@ -83,12 +84,6 @@ static int mtk_adsp_ipc_probe(struct platform_device *pdev) ...@@ -83,12 +84,6 @@ static int mtk_adsp_ipc_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < MTK_ADSP_MBOX_NUM; i++) { for (i = 0; i < MTK_ADSP_MBOX_NUM; i++) {
chan_name = kasprintf(GFP_KERNEL, "mbox%d", i);
if (!chan_name) {
ret = -ENOMEM;
goto out;
}
adsp_chan = &adsp_ipc->chans[i]; adsp_chan = &adsp_ipc->chans[i];
cl = &adsp_chan->cl; cl = &adsp_chan->cl;
cl->dev = dev->parent; cl->dev = dev->parent;
...@@ -99,17 +94,20 @@ static int mtk_adsp_ipc_probe(struct platform_device *pdev) ...@@ -99,17 +94,20 @@ static int mtk_adsp_ipc_probe(struct platform_device *pdev)
adsp_chan->ipc = adsp_ipc; adsp_chan->ipc = adsp_ipc;
adsp_chan->idx = i; adsp_chan->idx = i;
adsp_chan->ch = mbox_request_channel_byname(cl, chan_name); adsp_chan->ch = mbox_request_channel_byname(cl, adsp_mbox_ch_names[i]);
if (IS_ERR(adsp_chan->ch)) { if (IS_ERR(adsp_chan->ch)) {
ret = PTR_ERR(adsp_chan->ch); ret = PTR_ERR(adsp_chan->ch);
if (ret != -EPROBE_DEFER) if (ret != -EPROBE_DEFER)
dev_err(dev, "Failed to request mbox chan %d ret %d\n", dev_err(dev, "Failed to request mbox chan %s ret %d\n",
i, ret); adsp_mbox_ch_names[i], ret);
goto out_free;
for (j = 0; j < i; j++) {
adsp_chan = &adsp_ipc->chans[j];
mbox_free_channel(adsp_chan->ch);
} }
dev_dbg(dev, "request mbox chan %s\n", chan_name); return ret;
kfree(chan_name); }
} }
adsp_ipc->dev = dev; adsp_ipc->dev = dev;
...@@ -117,16 +115,6 @@ static int mtk_adsp_ipc_probe(struct platform_device *pdev) ...@@ -117,16 +115,6 @@ static int mtk_adsp_ipc_probe(struct platform_device *pdev)
dev_dbg(dev, "MTK ADSP IPC initialized\n"); dev_dbg(dev, "MTK ADSP IPC initialized\n");
return 0; return 0;
out_free:
kfree(chan_name);
out:
for (j = 0; j < i; j++) {
adsp_chan = &adsp_ipc->chans[j];
mbox_free_channel(adsp_chan->ch);
}
return ret;
} }
static int mtk_adsp_ipc_remove(struct platform_device *pdev) static int mtk_adsp_ipc_remove(struct platform_device *pdev)
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
#include "mt8186-clk.h" #include "mt8186-clk.h"
static const char *adsp_clks[ADSP_CLK_MAX] = { static const char *adsp_clks[ADSP_CLK_MAX] = {
[CLK_TOP_AUDIODSP] = "audiodsp_sel", [CLK_TOP_AUDIODSP] = "audiodsp",
[CLK_TOP_ADSP_BUS] = "adsp_bus_sel", [CLK_TOP_ADSP_BUS] = "adsp_bus",
}; };
int mt8186_adsp_init_clock(struct snd_sof_dev *sdev) int mt8186_adsp_init_clock(struct snd_sof_dev *sdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment