[PATCH v2 0/2] ASoC: SOF: add mt8188 audio support
This series adds mt8188 audio support and dbg_dump callback for mt8186 and mt8188.
Changes since v1: - fix typo - adopt reviewer's suggestion
Trevor Wu (2): ASoC: SOF: mediatek: add mt8188 audio support ASoC: SOF: mediatek: add adsp debug dump
sound/soc/sof/mediatek/mt8186/mt8186.c | 83 +++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-)
Add mt8188 dai driver and specify of_machine to support mt8188 audio.
Signed-off-by: Trevor Wu trevor.wu@mediatek.com Reviewed-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Yaochun Hung yc.hung@mediatek.com Reviewed-by: Péter Ujfalusi peter.ujfalusi@linux.intel.com --- sound/soc/sof/mediatek/mt8186/mt8186.c | 61 +++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-)
diff --git a/sound/soc/sof/mediatek/mt8186/mt8186.c b/sound/soc/sof/mediatek/mt8186/mt8186.c index 419913c8474d..cc91c2928fb6 100644 --- a/sound/soc/sof/mediatek/mt8186/mt8186.c +++ b/sound/soc/sof/mediatek/mt8186/mt8186.c @@ -594,7 +594,65 @@ static const struct sof_dev_desc sof_of_mt8186_desc = { .ops = &sof_mt8186_ops, };
+/* + * DL2, DL3, UL4, UL5 are registered as SOF FE, so creating the corresponding + * SOF BE to complete the pipeline. + */ +static struct snd_soc_dai_driver mt8188_dai[] = { +{ + .name = "SOF_DL2", + .playback = { + .channels_min = 1, + .channels_max = 2, + }, +}, +{ + .name = "SOF_DL3", + .playback = { + .channels_min = 1, + .channels_max = 2, + }, +}, +{ + .name = "SOF_UL4", + .capture = { + .channels_min = 1, + .channels_max = 2, + }, +}, +{ + .name = "SOF_UL5", + .capture = { + .channels_min = 1, + .channels_max = 2, + }, +}, +}; + +/* mt8188 ops */ +static struct snd_sof_dsp_ops sof_mt8188_ops; + +static int sof_mt8188_ops_init(struct snd_sof_dev *sdev) +{ + /* common defaults */ + memcpy(&sof_mt8188_ops, &sof_mt8186_ops, sizeof(sof_mt8188_ops)); + + sof_mt8188_ops.drv = mt8188_dai; + sof_mt8188_ops.num_drv = ARRAY_SIZE(mt8188_dai); + + return 0; +} + +static struct snd_sof_of_mach sof_mt8188_machs[] = { + { + .compatible = "mediatek,mt8188", + .sof_tplg_filename = "sof-mt8188.tplg", + }, + {} +}; + static const struct sof_dev_desc sof_of_mt8188_desc = { + .of_machines = sof_mt8188_machs, .ipc_supported_mask = BIT(SOF_IPC), .ipc_default = SOF_IPC, .default_fw_path = { @@ -607,7 +665,8 @@ static const struct sof_dev_desc sof_of_mt8188_desc = { [SOF_IPC] = "sof-mt8188.ri", }, .nocodec_tplg_filename = "sof-mt8188-nocodec.tplg", - .ops = &sof_mt8186_ops, + .ops = &sof_mt8188_ops, + .ops_init = sof_mt8188_ops_init, };
static const struct of_device_id sof_of_mt8186_ids[] = {
Add mt8188 and mt8186 .dbg_dump callback to print some information when DSP panic occurs.
Signed-off-by: Trevor Wu trevor.wu@mediatek.com Reviewed-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Yaochun Hung yc.hung@mediatek.com Reviewed-by: Péter Ujfalusi peter.ujfalusi@linux.intel.com --- sound/soc/sof/mediatek/mt8186/mt8186.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/sound/soc/sof/mediatek/mt8186/mt8186.c b/sound/soc/sof/mediatek/mt8186/mt8186.c index cc91c2928fb6..3e0ea0e109e2 100644 --- a/sound/soc/sof/mediatek/mt8186/mt8186.c +++ b/sound/soc/sof/mediatek/mt8186/mt8186.c @@ -24,6 +24,7 @@ #include "../../sof-of-dev.h" #include "../../sof-audio.h" #include "../adsp_helper.h" +#include "../mtk-adsp-common.h" #include "mt8186.h" #include "mt8186-clk.h"
@@ -473,6 +474,26 @@ static snd_pcm_uframes_t mt8186_pcm_pointer(struct snd_sof_dev *sdev, return pos; }
+static void mt8186_adsp_dump(struct snd_sof_dev *sdev, u32 flags) +{ + u32 dbg_pc, dbg_data, dbg_inst, dbg_ls0stat, dbg_status, faultinfo; + + /* dump debug registers */ + dbg_pc = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGPC); + dbg_data = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGDATA); + dbg_inst = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGINST); + dbg_ls0stat = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGLS0STAT); + dbg_status = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGSTATUS); + faultinfo = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PFAULTINFO); + + dev_info(sdev->dev, "adsp dump : pc %#x, data %#x, dbg_inst %#x,", + dbg_pc, dbg_data, dbg_inst); + dev_info(sdev->dev, "ls0stat %#x, status %#x, faultinfo %#x", + dbg_ls0stat, dbg_status, faultinfo); + + mtk_adsp_dump(sdev, flags); +} + static struct snd_soc_dai_driver mt8186_dai[] = { { .name = "SOF_DL1", @@ -555,6 +576,7 @@ static struct snd_sof_dsp_ops sof_mt8186_ops = { .num_drv = ARRAY_SIZE(mt8186_dai),
/* Debug information */ + .dbg_dump = mt8186_adsp_dump, .debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem,
/* PM */
On Tue, May 23, 2023 at 10:59:33AM +0800, Trevor Wu wrote:
Add mt8188 and mt8186 .dbg_dump callback to print some information when DSP panic occurs.
This breaks an x86_64 allmodconfig build:
/build/stage/linux/sound/soc/sof/mediatek/mt8186/mt8186.c: In function ‘mt8186_adsp_dump’: /build/stage/linux/sound/soc/sof/mediatek/mt8186/mt8186.c:483:56: error: ‘DSP_PDEBUGDATA’ undeclared (first use in this function); did you mean ‘DSP_PDEBUGPC’? 483 | dbg_data = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGDATA); | ^~~~~~~~~~~~~~ | DSP_PDEBUGPC /build/stage/linux/sound/soc/sof/mediatek/mt8186/mt8186.c:483:56: note: each undeclared identifier is reported only once for each function it appears in /build/stage/linux/sound/soc/sof/mediatek/mt8186/mt8186.c:484:56: error: ‘DSP_PDEBUGINST’ undeclared (first use in this function); did you mean ‘DSP_PDEBUGPC’? 484 | dbg_inst = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGINST); | ^~~~~~~~~~~~~~ | DSP_PDEBUGPC /build/stage/linux/sound/soc/sof/mediatek/mt8186/mt8186.c:485:59: error: ‘DSP_PDEBUGLS0STAT’ undeclared (first use in this function) 485 | dbg_ls0stat = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGLS0STAT); | ^~~~~~~~~~~~~~~~~ /build/stage/linux/sound/soc/sof/mediatek/mt8186/mt8186.c:486:58: error: ‘DSP_PDEBUGSTATUS’ undeclared (first use in this function); did you mean ‘DSP_PDEBUGPC’? 486 | dbg_status = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGSTATUS); | ^~~~~~~~~~~~~~~~ | DSP_PDEBUGPC /build/stage/linux/sound/soc/sof/mediatek/mt8186/mt8186.c:487:57: error: ‘DSP_PFAULTINFO’ undeclared (first use in this function) 487 | faultinfo = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PFAULTINFO); | ^~~~~~~~~~~~~~
On Tue, 2023-05-30 at 15:12 +0100, Mark Brown wrote:
On Tue, May 23, 2023 at 10:59:33AM +0800, Trevor Wu wrote:
Add mt8188 and mt8186 .dbg_dump callback to print some information when DSP panic occurs.
This breaks an x86_64 allmodconfig build:
/build/stage/linux/sound/soc/sof/mediatek/mt8186/mt8186.c: In function ‘mt8186_adsp_dump’: /build/stage/linux/sound/soc/sof/mediatek/mt8186/mt8186.c:483:56: error: ‘DSP_PDEBUGDATA’ undeclared (first use in this function); did you mean ‘DSP_PDEBUGPC’? 483 | dbg_data = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGDATA); | ^~~~~~
| DSP_PD EBUGPC /build/stage/linux/sound/soc/sof/mediatek/mt8186/mt8186.c:483:56: note: each undeclared identifier is reported only once for each function it appears in /build/stage/linux/sound/soc/sof/mediatek/mt8186/mt8186.c:484:56: error: ‘DSP_PDEBUGINST’ undeclared (first use in this function); did you mean ‘DSP_PDEBUGPC’? 484 | dbg_inst = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGINST); | ^~~~~~
| DSP_PD
EBUGPC /build/stage/linux/sound/soc/sof/mediatek/mt8186/mt8186.c:485:59: error: ‘DSP_PDEBUGLS0STAT’ undeclared (first use in this function) 485 | dbg_ls0stat = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGLS0STAT); | ^~~
/build/stage/linux/sound/soc/sof/mediatek/mt8186/mt8186.c:486:58: error: ‘DSP_PDEBUGSTATUS’ undeclared (first use in this function); did you mean ‘DSP_PDEBUGPC’? 486 | dbg_status = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGSTATUS); | ^~~~ ~~~~~~~~~~~~ | DSP_ PDEBUGPC /build/stage/linux/sound/soc/sof/mediatek/mt8186/mt8186.c:487:57: error: ‘DSP_PFAULTINFO’ undeclared (first use in this function) 487 | faultinfo = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PFAULTINFO); | ^~~~~ ~~~~~~~~~
Sorry, I didn't notice that I missed the header which possibly caused by the wrong format-patch command. I checked the same patch in v1, and the header was included in the series. I will send v3 to resolve the problem.
Thanks, Trevor
On Tue, 23 May 2023 10:59:31 +0800, Trevor Wu wrote:
This series adds mt8188 audio support and dbg_dump callback for mt8186 and mt8188.
Changes since v1:
- fix typo
- adopt reviewer's suggestion
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: SOF: mediatek: add mt8188 audio support commit: 0f3d5585ad20a23bf70d09deae2e0d84e745055e [2/2] ASoC: SOF: mediatek: add adsp debug dump (no commit info)
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (3)
-
Mark Brown
-
Trevor Wu
-
Trevor Wu (吳文良)