[PATCH v2 08/11] ASoC: mediatek: mt8196: add platform driver

Darren Ye (叶飞) Darren.Ye at mediatek.com
Sun Apr 13 23:37:03 PDT 2025


On Thu, 2025-04-10 at 01:58 +0530, ALOK TIWARI wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> On 07-04-2025 17:36, Darren.Ye wrote:
> > From: Darren Ye<darren.ye at mediatek.com>
> > 
> > Add mt8196 platform driver.
> > 
> > Signed-off-by: Darren Ye<darren.ye at mediatek.com>
> > ---
> >   sound/soc/mediatek/Kconfig                 |   10 +
> >   sound/soc/mediatek/Makefile                |    1 +
> >   sound/soc/mediatek/mt8196/Makefile         |   14 +
> >   sound/soc/mediatek/mt8196/mt8196-afe-pcm.c | 5070
> > ++++++++++++++++++++
> >   4 files changed, 5095 insertions(+)
> >   create mode 100644 sound/soc/mediatek/mt8196/Makefile
> >   create mode 100644 sound/soc/mediatek/mt8196/mt8196-afe-pcm.c
> > 
> > diff --git a/sound/soc/mediatek/Kconfig
> > b/sound/soc/mediatek/Kconfig
> > index 3033e2d3fe16..606f221e238c 100644
> > --- a/sound/soc/mediatek/Kconfig
> > +++ b/sound/soc/mediatek/Kconfig
> > @@ -204,6 +204,16 @@ config SND_SOC_MT8186_MT6366
> >         Select Y if you have such device.
> >         If unsure select "N".
> > 
> > +config SND_SOC_MT8196
> > +     tristate "ASoC support for Mediatek MT8196 chip"
> > +     depends on ARCH_MEDIATEK
> > +     select SND_SOC_MEDIATEK
> > +     help
> > +       This adds ASoC driver for Mediatek MT8196 boards
> > +       that can be used with other codecs.
> > +       Select Y if you have such device.
> > +       If unsure select "N".
> > +
> 
> is this not depends on COMMON_CLK and select SND_SOC_MT6358/6359 not
> require ?

It is better to add COMMON_CLK because it uses the clk api, which
SND_SOC_MT6358/6359 does not need and this platform does not depend on.

> 
> >   config SND_SOC_MTK_BTCVSD
> >       tristate "ALSA BT SCO CVSD/MSBC Driver"
> >       help
> > diff --git a/sound/soc/mediatek/Makefile
> > b/sound/soc/mediatek/Makefile
> > index 4b55434f2168..11d7c484a5d3 100644
> > --- a/sound/soc/mediatek/Makefile
> > +++ b/sound/soc/mediatek/Makefile
> > @@ -10,3 +10,4 @@ obj-$(CONFIG_SND_SOC_MT8188) += mt8188/
> >   obj-$(CONFIG_SND_SOC_MT8192) += mt8192/
> >   obj-$(CONFIG_SND_SOC_MT8195) += mt8195/
> 
> obj-$(CONFIG_SND_SOC_MT8196) += mt8196/ should be after mt8195.
> 
> >   obj-$(CONFIG_SND_SOC_MT8365) += mt8365/
> > +obj-$(CONFIG_SND_SOC_MT8196) += mt8196/
> > diff --git a/sound/soc/mediatek/mt8196/Makefile
> > b/sound/soc/mediatek/mt8196/Makefile
> > new file mode 100644
> > index 000000000000..9bcc09a9a94d
> > --- /dev/null
> > +++ b/sound/soc/mediatek/mt8196/Makefile
> > @@ -0,0 +1,14 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +
> > +# common include path
> > +subdir-ccflags-y += -I$(srctree)/sound/soc/mediatek/common
> > +
> > +# platform driver
> > +obj-$(CONFIG_SND_SOC_MT8196) += snd-soc-mt8196-afe.o
> > +snd-soc-mt8196-afe-objs += \
> > +     mt8196-afe-pcm.o \
> > +     mt8196-afe-clk.o \
> > +     mt8196-dai-adda.o \
> > +     mt8196-dai-i2s.o \
> > +     mt8196-dai-tdm.o
> > +
> 
> need to follow right sequence like mediatek/mt8195/Makefile
ok
> 
> > diff --git a/sound/soc/mediatek/mt8196/mt8196-afe-pcm.c
> > b/sound/soc/mediatek/mt8196/mt8196-afe-pcm.c
> > new file mode 100644
> > index 000000000000..84ccbc7419c7
> > --- /dev/null
> > +++ b/sound/soc/mediatek/mt8196/mt8196-afe-pcm.c
> > @@ -0,0 +1,5070 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + *  Mediatek ALSA SoC AFE platform driver for 8196
> > + *
> > + *  Copyright (c) 2024 MediaTek Inc.
> > + *  Author: Darren Ye<darren.ye at mediatek.com>
> > + */
> > +
> > +#include <linux/delay.h>
> > +#include <linux/dma-mapping.h>
> > +#include <linux/module.h>
> > +#include <linux/of.h>
> > +#include <linux/of_address.h>
> > +#include <linux/pm_runtime.h>
> > +#include <linux/regmap.h>
> > +#include <linux/of_device.h>
> > +#include <sound/soc.h>
> > +#include <linux/of_reserved_mem.h>
> > +
> > +#include "mt8196-afe-common.h"
> > +#include "mtk-afe-platform-driver.h"
> > +#include "mtk-afe-fe-dai.h"
> > +#include "mt8196-afe-clk.h"
> > +#include "mt8196-interconnection.h"
> > +
> 
> header required to be in a sequence. easy to read!
> #include "mt8196-afe-clk.h"
> #include "mt8196-afe-common.h"
> #include "mtk-afe-fe-dai.h"
> #include "mtk-afe-platform-driver.h"
> #include "mt8196-interconnection.h"
> 
ok

> > +static const struct snd_pcm_hardware mt8196_afe_hardware = {
> > +     .info = (SNDRV_PCM_INFO_MMAP |
> > +              SNDRV_PCM_INFO_NO_PERIOD_WAKEUP |
> > +              SNDRV_PCM_INFO_INTERLEAVED |
> > +              SNDRV_PCM_INFO_MMAP_VALID),
> > +     .formats = (SNDRV_PCM_FMTBIT_S16_LE |
> > +                 SNDRV_PCM_FMTBIT_S24_LE |
> > +                 SNDRV_PCM_FMTBIT_S32_LE),
> > +     .period_bytes_min = 96,
> > +     .period_bytes_max = 4 * 48 * 1024,
> > +     .periods_min = 2,
> > +     .periods_max = 256,
> > +     .buffer_bytes_max = 256 * 1024,
> > +     .fifo_size = 0,
> > +};
> > +
> 
> 
> Thanks,
> Alok


More information about the linux-arm-kernel mailing list