ASoC: airoha: Add initial driver AN7581
Subsystems (3)
cover ASoC: airoha: Add initial driver AN7581
This is an initial series to add the Sound system for Airoha AN7581.
It's based mainly on the Mediatek AFE system with some bigger changes for additional Codec (that will be submitted later)
A small cleanup to make it possible to use the Mediatek AFE header and API without having to use complex redirection to reach the local header.
Posting as RFC to make sure these rework changes are happly accepted.
Christian Marangi (2):
ASoC: mediatek: move some header to global include
ASoC: airoha: Add AFE driver for Airoha AN7581
.../sound/mediatek}/mtk-afe-fe-dai.h | 0
.../sound/mediatek}/mtk-afe-platform-driver.h | 0
sound/soc/Makefile | 1 +
sound/soc/airoha/Kconfig | 10 +
sound/soc/airoha/Makefile | 2 +
sound/soc/airoha/an7581/Makefile | 7 +
sound/soc/airoha/an7581/an7581-afe-common.h | 35 ++
sound/soc/airoha/an7581/an7581-afe-pcm.c | 455 ++++++++++++++++++
sound/soc/airoha/an7581/an7581-reg.h | 29 ++
sound/soc/mediatek/common/mtk-afe-fe-dai.c | 4 +-
.../mediatek/common/mtk-afe-platform-driver.c | 2 +-
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 4 +-
sound/soc/mediatek/mt6797/mt6797-afe-pcm.c | 4 +-
sound/soc/mediatek/mt7986/mt7986-afe-pcm.c | 4 +-
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 4 +-
sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 4 +-
.../mediatek/mt8183/mt8183-da7219-max98357.c | 2 +-
.../mt8183/mt8183-mt6358-ts3a227-max98357.c | 2 +-
sound/soc/mediatek/mt8186/mt8186-afe-pcm.c | 4 +-
.../soc/mediatek/mt8186/mt8186-misc-control.c | 4 +-
.../mediatek/mt8186/mt8186-mt6366-common.c | 2 +-
sound/soc/mediatek/mt8186/mt8186-mt6366.c | 2 +-
sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 4 +-
sound/soc/mediatek/mt8188/mt8188-mt6359.c | 2 +-
sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 4 +-
.../mt8192/mt8192-mt6359-rt1015-rt5682.c | 2 +-
sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 4 +-
sound/soc/mediatek/mt8195/mt8195-mt6359.c | 2 +-
sound/soc/mediatek/mt8365/mt8365-afe-pcm.c | 4 +-
29 files changed, 571 insertions(+), 32 deletions(-)
rename {sound/soc/mediatek/common => include/sound/mediatek}/mtk-afe-fe-dai.h (100%)
rename {sound/soc/mediatek/common => include/sound/mediatek}/mtk-afe-platform-driver.h (100%)
create mode 100644 sound/soc/airoha/Kconfig
create mode 100644 sound/soc/airoha/Makefile
create mode 100644 sound/soc/airoha/an7581/Makefile
create mode 100644 sound/soc/airoha/an7581/an7581-afe-common.h
create mode 100644 sound/soc/airoha/an7581/an7581-afe-pcm.c
create mode 100644 sound/soc/airoha/an7581/an7581-reg.hSignature · 1 line
2.50.0
RFC PATCH 1/2 ASoC: mediatek: move some header to global include
In preparation for support of Airoha SoC sound system based on Mediatek AFE, move some header to global include to prevent having to use complex redirection for inclusion.
---
.../common => include/sound/mediatek}/mtk-afe-fe-dai.h | 0
.../sound/mediatek}/mtk-afe-platform-driver.h | 0
sound/soc/mediatek/common/mtk-afe-fe-dai.c | 4 ++--
sound/soc/mediatek/common/mtk-afe-platform-driver.c | 2 +-
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 4 ++--
sound/soc/mediatek/mt6797/mt6797-afe-pcm.c | 4 ++--
sound/soc/mediatek/mt7986/mt7986-afe-pcm.c | 4 ++--
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 4 ++--
sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 4 ++--
sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c | 2 +-
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c | 2 +-
sound/soc/mediatek/mt8186/mt8186-afe-pcm.c | 4 ++--
sound/soc/mediatek/mt8186/mt8186-misc-control.c | 4 ++--
sound/soc/mediatek/mt8186/mt8186-mt6366-common.c | 2 +-
sound/soc/mediatek/mt8186/mt8186-mt6366.c | 2 +-
sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 4 ++--
sound/soc/mediatek/mt8188/mt8188-mt6359.c | 2 +-
sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 4 ++--
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c | 2 +-
sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 4 ++--
sound/soc/mediatek/mt8195/mt8195-mt6359.c | 2 +-
sound/soc/mediatek/mt8365/mt8365-afe-pcm.c | 4 ++--
22 files changed, 32 insertions(+), 32 deletions(-)
rename {sound/soc/mediatek/common => include/sound/mediatek}/mtk-afe-fe-dai.h (100%)
rename {sound/soc/mediatek/common => include/sound/mediatek}/mtk-afe-platform-driver.h (100%)include/sound/mediatek/mtk-afe-fe-dai.h renamed from sound/soc/mediatek/common/mtk-afe-fe-dai.h +0 -0
include/sound/mediatek/mtk-afe-platform-driver.h renamed from sound/soc/mediatek/common/mtk-afe-platform-driver.h +0 -0
sound/soc/mediatek/common/mtk-afe-fe-dai.c +2 -2
@@ -11,9 +11,9 @@#include <linux/pm_runtime.h> #include <linux/regmap.h> #include <sound/soc.h> -#include "mtk-afe-platform-driver.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> #include <sound/pcm_params.h> -#include "mtk-afe-fe-dai.h" +#include <sound/mediatek/mtk-afe-fe-dai.h> #include "mtk-base-afe.h" #define AFE_BASE_END_OFFSET 8
sound/soc/mediatek/common/mtk-afe-platform-driver.c +1 -1
@@ -10,7 +10,7 @@#include <linux/dma-mapping.h> #include <sound/soc.h> -#include "mtk-afe-platform-driver.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> #include "mtk-base-afe.h" int mtk_afe_combine_sub_dai (struct mtk_base_afe *afe)
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c +2 -2
@@ -16,8 +16,8 @@#include "mt2701-afe-common.h" #include "mt2701-afe-clock-ctrl.h" -#include "../common/mtk-afe-platform-driver.h" -#include "../common/mtk-afe-fe-dai.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> +#include <sound/mediatek/mtk-afe-fe-dai.h> static const struct snd_pcm_hardware mt2701_afe_hardware = { .info =SNDRV_PCM_INFO_MMAP |SNDRV_PCM_INFO_INTERLEAVED
sound/soc/mediatek/mt6797/mt6797-afe-pcm.c +2 -2
@@ -16,8 +16,8 @@#include "mt6797-afe-clk.h" #include "mt6797-interconnection.h" #include "mt6797-reg.h" -#include "../common/mtk-afe-platform-driver.h" -#include "../common/mtk-afe-fe-dai.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> +#include <sound/mediatek/mtk-afe-fe-dai.h> enum {MTK_AFE_RATE_8K =0 ,
sound/soc/mediatek/mt7986/mt7986-afe-pcm.c +2 -2
@@ -16,8 +16,8 @@#include "mt7986-afe-common.h" #include "mt7986-reg.h" -#include "../common/mtk-afe-platform-driver.h" -#include "../common/mtk-afe-fe-dai.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> +#include <sound/mediatek/mtk-afe-fe-dai.h> enum {MTK_AFE_RATE_8K =0 ,
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c +2 -2
@@ -18,8 +18,8 @@#include <sound/soc.h> #include "mt8173-afe-common.h" #include "../common/mtk-base-afe.h" -#include "../common/mtk-afe-platform-driver.h" -#include "../common/mtk-afe-fe-dai.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> +#include <sound/mediatek/mtk-afe-fe-dai.h> /***************************************************************************** * R E G I S T E R D E F I N I T I O N
sound/soc/mediatek/mt8183/mt8183-afe-pcm.c +2 -2
@@ -17,8 +17,8 @@#include "mt8183-afe-clk.h" #include "mt8183-interconnection.h" #include "mt8183-reg.h" -#include "../common/mtk-afe-platform-driver.h" -#include "../common/mtk-afe-fe-dai.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> +#include <sound/mediatek/mtk-afe-fe-dai.h> enum {MTK_AFE_RATE_8K =0 ,
sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +1 -1
@@ -16,7 +16,7 @@#include "../../codecs/da7219.h" #include "../../codecs/rt1015.h" -#include "../common/mtk-afe-platform-driver.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> #include "mt8183-afe-common.h" #define DA7219_CODEC_DAI "da7219-hifi"
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +1 -1
@@ -15,7 +15,7 @@#include "../../codecs/rt1015.h" #include "../../codecs/ts3a227e.h" -#include "../common/mtk-afe-platform-driver.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> #include "mt8183-afe-common.h" #define RT1015_CODEC_DAI "rt1015-aif"
sound/soc/mediatek/mt8186/mt8186-afe-pcm.c +2 -2
@@ -14,8 +14,8 @@#include <linux/reset.h> #include <sound/soc.h> -#include "../common/mtk-afe-platform-driver.h" -#include "../common/mtk-afe-fe-dai.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> +#include <sound/mediatek/mtk-afe-fe-dai.h> #include "mt8186-afe-common.h" #include "mt8186-afe-clk.h"
sound/soc/mediatek/mt8186/mt8186-misc-control.c +2 -2
@@ -11,8 +11,8 @@#include <linux/regmap.h> #include <sound/soc.h> -#include "../common/mtk-afe-fe-dai.h" -#include "../common/mtk-afe-platform-driver.h" +#include <sound/mediatek/mtk-afe-fe-dai.h> +#include <sound/mediatek/mtk-afe-platform-driver.h> #include "mt8186-afe-common.h" static const char *const mt8186_sgen_mode_str[] = {
sound/soc/mediatek/mt8186/mt8186-mt6366-common.c +1 -1
@@ -9,7 +9,7 @@#include <sound/soc.h> #include "../../codecs/mt6358.h" -#include "../common/mtk-afe-platform-driver.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> #include "mt8186-afe-common.h" #include "mt8186-mt6366-common.h"
sound/soc/mediatek/mt8186/mt8186-mt6366.c +1 -1
@@ -22,7 +22,7 @@#include "../../codecs/da7219.h" #include "../../codecs/mt6358.h" #include "../../codecs/rt5682.h" -#include "../common/mtk-afe-platform-driver.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> #include "../common/mtk-dsp-sof-common.h" #include "../common/mtk-soc-card.h" #include "../common/mtk-soundcard-driver.h"
sound/soc/mediatek/mt8188/mt8188-afe-pcm.c +2 -2
@@ -24,8 +24,8 @@#include "mt8188-afe-common.h" #include "mt8188-afe-clk.h" #include "mt8188-reg.h" -#include "../common/mtk-afe-platform-driver.h" -#include "../common/mtk-afe-fe-dai.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> +#include <sound/mediatek/mtk-afe-fe-dai.h> #define MT8188_MEMIF_BUFFER_BYTES_ALIGN (0x40)#define MT8188_MEMIF_DL7_MAX_PERIOD_SIZE (0x3fff)
sound/soc/mediatek/mt8188/mt8188-mt6359.c +1 -1
@@ -19,7 +19,7 @@#include "../../codecs/mt6359.h" #include "../../codecs/mt6359-accdet.h" #include "../../codecs/rt5682.h" -#include "../common/mtk-afe-platform-driver.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> #include "../common/mtk-soundcard-driver.h" #include "../common/mtk-dsp-sof-common.h" #include "../common/mtk-soc-card.h"
sound/soc/mediatek/mt8192/mt8192-afe-pcm.c +2 -2
@@ -16,8 +16,8 @@#include <linux/reset.h> #include <sound/soc.h> -#include "../common/mtk-afe-fe-dai.h" -#include "../common/mtk-afe-platform-driver.h" +#include <sound/mediatek/mtk-afe-fe-dai.h> +#include <sound/mediatek/mtk-afe-platform-driver.h> #include "mt8192-afe-common.h" #include "mt8192-afe-clk.h"
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +1 -1
@@ -19,7 +19,7 @@#include "../../codecs/mt6359.h" #include "../../codecs/rt1015.h" #include "../../codecs/rt5682.h" -#include "../common/mtk-afe-platform-driver.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> #include "../common/mtk-soc-card.h" #include "../common/mtk-soundcard-driver.h" #include "mt8192-afe-common.h"
sound/soc/mediatek/mt8195/mt8195-afe-pcm.c +2 -2
@@ -20,8 +20,8 @@#include "mt8195-afe-common.h" #include "mt8195-afe-clk.h" #include "mt8195-reg.h" -#include "../common/mtk-afe-platform-driver.h" -#include "../common/mtk-afe-fe-dai.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> +#include <sound/mediatek/mtk-afe-fe-dai.h> #define MT8195_MEMIF_BUFFER_BYTES_ALIGN (0x40)#define MT8195_MEMIF_DL7_MAX_PERIOD_SIZE (0x3fff)
sound/soc/mediatek/mt8195/mt8195-mt6359.c +1 -1
@@ -19,7 +19,7 @@#include "../../codecs/mt6359.h" #include "../../codecs/rt1011.h" #include "../../codecs/rt5682.h" -#include "../common/mtk-afe-platform-driver.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> #include "../common/mtk-dsp-sof-common.h" #include "../common/mtk-soc-card.h" #include "../common/mtk-soundcard-driver.h"
sound/soc/mediatek/mt8365/mt8365-afe-pcm.c +2 -2
@@ -19,8 +19,8 @@#include "mt8365-afe-clk.h" #include "mt8365-reg.h" #include "../common/mtk-base-afe.h" -#include "../common/mtk-afe-platform-driver.h" -#include "../common/mtk-afe-fe-dai.h" +#include <sound/mediatek/mtk-afe-platform-driver.h> +#include <sound/mediatek/mtk-afe-fe-dai.h> #define AFE_BASE_END_OFFSET 8
Signature · 1 line
2.50.0
RFC PATCH 2/2 ASoC: airoha: Add AFE driver for Airoha AN7581
In reply to Christian MarangiAdd support for the Sound system present on Airoha AN7581 SoC. This is based on the mediatek AFE drivers.
--- sound/soc/Makefile | 1 + sound/soc/airoha/Kconfig | 10 + sound/soc/airoha/Makefile | 2 + sound/soc/airoha/an7581/Makefile | 7 + sound/soc/airoha/an7581/an7581-afe-common.h | 35 ++ sound/soc/airoha/an7581/an7581-afe-pcm.c | 455 ++++++++++++++++++++ sound/soc/airoha/an7581/an7581-reg.h | 29 ++ 7 files changed, 539 insertions(+) create mode 100644 sound/soc/airoha/Kconfig create mode 100644 sound/soc/airoha/Makefile create mode 100644 sound/soc/airoha/an7581/Makefile create mode 100644 sound/soc/airoha/an7581/an7581-afe-common.h create mode 100644 sound/soc/airoha/an7581/an7581-afe-pcm.c create mode 100644 sound/soc/airoha/an7581/an7581-reg.h
sound/soc/Makefile +1 -0
@@ -46,6 +46,7 @@ obj-$(CONFIG_SND_SOC) += codecs/ obj-$(CONFIG_SND_SOC) += generic/ obj-$(CONFIG_SND_SOC) += apple/ obj-$(CONFIG_SND_SOC) += adi/ +obj-$(CONFIG_SND_SOC) += airoha/ obj-$(CONFIG_SND_SOC) += amd/ obj-$(CONFIG_SND_SOC) += atmel/ obj-$(CONFIG_SND_SOC) += au1x/
sound/soc/airoha/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-only +config SND_SOC_AN7581 + tristate "ASoC support for Airoha AN7581 chip" + depends on ARCH_AIROHA + select SND_SOC_MEDIATEK + help + This adds ASoC driver for Airoha AN7581 boards + that can be used with other codecs. + Select Y if you have such device. + If unsure select "N".
sound/soc/airoha/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_SND_SOC_AN7581) += an7581/
sound/soc/airoha/an7581/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 + +# platform driver +snd-soc-an7581-afe-y := \ + an7581-afe-pcm.o + +obj-$(CONFIG_SND_SOC_AN7581) += snd-soc-an7581-afe.o
sound/soc/airoha/an7581/an7581-afe-common.h new file +35 -0
@@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* an7581-afe-common.h -- Airoha AN7581 audio driver definitions +*/ + +#ifndef _AN_7581_AFE_COMMON_H_ +#define _AN_7581_AFE_COMMON_H_ + +#include <sound/soc.h> +#include <linux/list.h> +#include <linux/regmap.h> +#include "../common/mtk-base-afe.h" + +enum { +AN7581_MEMIF_DL1 , +AN7581_MEMIF_UL1 , +AN7581_MEMIF_NUM , +AN7581_DAI_NUM =AN7581_MEMIF_NUM , +}; + +enum { +AN7581_IRQ_0 , +AN7581_IRQ_1 , +AN7581_IRQ_NUM , +}; + +struct an7581_afe_private { +/* dai */ +void *dai_priv[AN7581_DAI_NUM ]; +}; + +unsigned int an7581_afe_rate_transform (struct device *dev, +unsigned int rate); + +#endif
sound/soc/airoha/an7581/an7581-afe-pcm.c new file +455 -0
455 lines not on this page · raw message
sound/soc/airoha/an7581/an7581-reg.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* an7581-reg.h -- Airoha AN7581 audio driver reg definition +*/ + +#ifndef _AN7581_REG_H_ +#define _AN7581_REG_H_ + +#define AFE_DAC_CON0 0x0 + +#define AFE_DL1_BASE 0xa8 +#define AFE_DL1_END 0xac +#define AFE_DL1_CUR 0xb0 + +#define AFE_UL1_BASE 0xc4 +#define AFE_UL1_END 0xc8 +#define AFE_UL1_CUR 0xcc + +#define AFE_IRQ0_CON0 0xe4 + +#define AFE_IRQ_STS 0xf8 +#define AFE_IRQ_STS_PLAY BIT(1) +#define AFE_IRQ_STS_RECORD BIT(0) + +#define AFE_IRQ1_CON0 0x100 + +#define AFE_MAX_REGISTER AFE_IRQ1_CON0 + +#endif
Signature · 1 line
2.50.0
Mark Brown
maintainerRe: [RFC RESEND PATCH 2/2] ASoC: airoha: Add AFE driver for Airoha AN7581
Quoted 4 lines · Christian Marangi
Add support for the Sound system present on Airoha AN7581 SoC. This is based on the mediatek AFE drivers.
Signed-off-by Christian Marangi <[email protected]>
Quoted 8 lines
--- sound/soc/Makefile | 1 + sound/soc/airoha/Kconfig | 10 + sound/soc/airoha/Makefile | 2 + sound/soc/airoha/an7581/Makefile | 7 + sound/soc/airoha/an7581/an7581-afe-common.h | 35 ++ sound/soc/airoha/an7581/an7581-afe-pcm.c | 455 ++++++++++++++++++++ sound/soc/airoha/an7581/an7581-reg.h | 29 ++
Commercially this might be a separate company (well, subsidiary) but this really does look like in technical terms it's in the same family as Mediatek so it's not clear why it's a separate directory.