Unverified Commit 32d7e03d authored by YC Hung's avatar YC Hung Committed by Mark Brown
Browse files

ASoC: SOF: mediatek: Add mt8195 hardware support



This patch initialize to support SOF on Mediatek mt8195 platform.
MT8195 has four Cortex A78 cores paired with four Cortex A55 cores.
It also has Cadence HiFi-4 DSP single core. There are shared DRAM and
mailbox interrupt between AP and DSP to use for IPC communication.

Signed-off-by: default avatarYC Hung <yc.hung@mediatek.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: default avatarDaniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: default avatarDaniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20211118100749.54628-2-daniel.baluta@oss.nxp.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent b6a5f4f0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -236,6 +236,7 @@ config SND_SOC_SOF_PROBE_WORK_QUEUE
source "sound/soc/sof/amd/Kconfig"
source "sound/soc/sof/imx/Kconfig"
source "sound/soc/sof/intel/Kconfig"
source "sound/soc/sof/mediatek/Kconfig"
source "sound/soc/sof/xtensa/Kconfig"

endif
+1 −0
Original line number Diff line number Diff line
@@ -24,3 +24,4 @@ obj-$(CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL) += intel/
obj-$(CONFIG_SND_SOC_SOF_IMX_TOPLEVEL) += imx/
obj-$(CONFIG_SND_SOC_SOF_AMD_TOPLEVEL) += amd/
obj-$(CONFIG_SND_SOC_SOF_XTENSA) += xtensa/
obj-$(CONFIG_SND_SOC_SOF_MTK_TOPLEVEL) += mediatek/
+33 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)

config SND_SOC_SOF_MTK_TOPLEVEL
	bool "SOF support for MTK audio DSPs"
	depends on ARM64 || COMPILE_TEST
	depends on SND_SOC_SOF_OF
	help
	  This adds support for Sound Open Firmware for Mediatek platforms.
	  It is top level for all mediatek platforms.
	  Say Y if you have such a device.
	  If unsure select "N".

if SND_SOC_SOF_MTK_TOPLEVEL
config SND_SOC_SOF_MTK_COMMON
	tristate
	select SND_SOC_SOF_OF_DEV
	select SND_SOC_SOF
	select SND_SOC_SOF_XTENSA
	select SND_SOC_SOF_COMPRESS
	help
	  This option is not user-selectable but automagically handled by
	  'select' statements at a higher level

config SND_SOC_SOF_MT8195
	tristate "SOF support for MT8195 audio DSP"
	select SND_SOC_SOF_MTK_COMMON
	help
	  This adds support for Sound Open Firmware for Mediatek platforms
	  using the mt8195 processors.
	  Say Y if you have such a device.
	  If unsure select "N".

endif ## SND_SOC_SOF_MTK_TOPLEVEL
+2 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
obj-$(CONFIG_SND_SOC_SOF_MT8195) += mt8195/
+49 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */

/*
 * Copyright (c) 2021 MediaTek Corporation. All rights reserved.
 */

#ifndef __MTK_ADSP_HELPER_H__
#define __MTK_ADSP_HELPER_H__

/*
 * Global important adsp data structure.
 */
#define DSP_MBOX_NUM	3

struct mtk_adsp_chip_info {
	phys_addr_t pa_sram;
	phys_addr_t pa_dram; /* adsp dram physical base */
	phys_addr_t pa_shared_dram; /* adsp dram physical base */
	phys_addr_t pa_cfgreg;
	phys_addr_t pa_mboxreg[DSP_MBOX_NUM];
	u32 sramsize;
	u32 dramsize;
	u32 cfgregsize;
	void __iomem *va_sram; /* corresponding to pa_sram */
	void __iomem *va_dram; /* corresponding to pa_dram */
	void __iomem *va_cfgreg;
	void __iomem *va_mboxreg[DSP_MBOX_NUM];
	void __iomem *shared_sram; /* part of  va_sram */
	void __iomem *shared_dram; /* part of  va_dram */
	phys_addr_t adsp_bootup_addr;
	int dram_offset; /*dram offset between system and dsp view*/
};

struct adsp_priv {
	struct device *dev;
	struct snd_sof_dev *sdev;

	/* DSP IPC handler */
	struct mbox_controller *adsp_mbox;

	struct mtk_adsp_chip_info *adsp;

	u32 (*ap2adsp_addr)(u32 addr, void *data);
	u32 (*adsp2ap_addr)(u32 addr, void *data);

	void *private_data;
};

#endif
Loading