ASoC: Add common modules support for ACP hw block
Subsystems (3)
v3 cover ASoC: Add common modules support for ACP hw block
changes since v2:
- Fixes Kconfig description and indent.
Ajit Kumar Pandey (8):
ASoC: amd: Add common framework to support I2S on ACP SOC
ASoC: amd: acp: Add I2S support on Renoir platform
ASoC: amd: acp: Add callback for machine driver on ACP
ASoC: amd: acp: Add generic machine driver support for ACP cards
ASoC: amd: acp: Add legacy sound card support for Chrome audio
ASoC: amd: acp: Add SOF audio support on Chrome board
ASoC: amd: acp: Add support for Maxim amplifier codec
ASoC: amd: acp: Add support for RT5682-VS codec
sound/soc/amd/Kconfig | 2 + sound/soc/amd/Makefile | 1 + sound/soc/amd/acp/Kconfig | 51 +++ sound/soc/amd/acp/Makefile | 26 ++ sound/soc/amd/acp/acp-i2s.c | 340 +++++++++++++++ sound/soc/amd/acp/acp-legacy-mach.c | 104 +++++ sound/soc/amd/acp/acp-mach-common.c | 600 +++++++++++++++++++++++++++ sound/soc/amd/acp/acp-mach.h | 57 +++ sound/soc/amd/acp/acp-platform.c | 315 ++++++++++++++ sound/soc/amd/acp/acp-renoir.c | 144 +++++++ sound/soc/amd/acp/acp-sof-mach.c | 131 ++++++ sound/soc/amd/acp/amd.h | 146 +++++++ sound/soc/amd/acp/chip_offset_byte.h | 76 ++++ 13 files changed, 1993 insertions(+) create mode 100644 sound/soc/amd/acp/Kconfig create mode 100644 sound/soc/amd/acp/Makefile create mode 100644 sound/soc/amd/acp/acp-i2s.c create mode 100644 sound/soc/amd/acp/acp-legacy-mach.c create mode 100644 sound/soc/amd/acp/acp-mach-common.c create mode 100644 sound/soc/amd/acp/acp-mach.h create mode 100644 sound/soc/amd/acp/acp-platform.c create mode 100644 sound/soc/amd/acp/acp-renoir.c create mode 100644 sound/soc/amd/acp/acp-sof-mach.c create mode 100644 sound/soc/amd/acp/amd.h create mode 100644 sound/soc/amd/acp/chip_offset_byte.h
Signature · 1 line
2.25.1
PATCH v3 1/8 ASoC: amd: Add common framework to support I2S on ACP SOC
We are using legacy way of exposing dais and DMA configuration that requires separate driver modules for various ACP SOC with almost similar hw configuration. Moreover the legacy approach requires separate I2S and DMA module platform devices registration and need machine specific quirk to control various I2S endpoints. Add generic dai driver and platform driver for I2S controller on ACP hw block. This common framework can be used by various ACP platform devices that shares common specs.
--- sound/soc/amd/Kconfig | 2 + sound/soc/amd/Makefile | 1 + sound/soc/amd/acp/Kconfig | 19 ++ sound/soc/amd/acp/Makefile | 12 + sound/soc/amd/acp/acp-i2s.c | 340 +++++++++++++++++++++++++++ sound/soc/amd/acp/acp-platform.c | 292 +++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 140 +++++++++++ sound/soc/amd/acp/chip_offset_byte.h | 76 ++++++ 8 files changed, 882 insertions(+) create mode 100644 sound/soc/amd/acp/Kconfig create mode 100644 sound/soc/amd/acp/Makefile create mode 100644 sound/soc/amd/acp/acp-i2s.c create mode 100644 sound/soc/amd/acp/acp-platform.c create mode 100644 sound/soc/amd/acp/amd.h create mode 100644 sound/soc/amd/acp/chip_offset_byte.h
sound/soc/amd/Kconfig +2 -0
@@ -61,3 +61,5 @@ config SND_SOC_AMD_ACP5x By enabling this flag build will trigger for ACP PCI driver, ACP DMA driver, CPU DAI driver. + +source "sound/soc/amd/acp/Kconfig"
sound/soc/amd/Makefile +1 -0
@@ -11,3 +11,4 @@ obj-$(CONFIG_SND_SOC_AMD_ACP3x) += raven/ obj-$(CONFIG_SND_SOC_AMD_RV_RT5682_MACH) += snd-soc-acp-rt5682-mach.o obj-$(CONFIG_SND_SOC_AMD_RENOIR) += renoir/ obj-$(CONFIG_SND_SOC_AMD_ACP5x) += vangogh/ +obj-$(CONFIG_SND_SOC_AMD_ACP_COMMON) += acp/
sound/soc/amd/acp/Kconfig new file +19 -0
@@ -0,0 +1,19 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +# This file is provided under a dual BSD/GPLv2 license. When using or +# redistributing this file, you may do so under either license. +# +# Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved. +# + +config SND_SOC_AMD_ACP_COMMON + tristate "AMD Audio ACP Common support" + select SND_AMD_ACP_CONFIG + help + This option enables common modules for Audio-Coprocessor i.e. ACP + IP block on AMD platforms. + +config SND_SOC_AMD_ACP_I2S + tristate + +config SND_SOC_AMD_ACP_PCM + tristate
sound/soc/amd/acp/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +# This file is provided under a dual BSD/GPLv2 license. When using or +# redistributing this file, you may do so under either license. +# +# Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved. + +#common acp driver +snd-acp-pcm-objs := acp-platform.o +snd-acp-i2s-objs := acp-i2s.o + +obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o +obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o
sound/soc/amd/acp/acp-i2s.c new file +340 -0
340 lines not on this page · raw message
sound/soc/amd/acp/acp-platform.c new file +292 -0
292 lines not on this page · raw message
sound/soc/amd/acp/amd.h new file +140 -0
140 lines not on this page · raw message
sound/soc/amd/acp/chip_offset_byte.h new file +76 -0
76 lines not on this page · raw message
Signature · 1 line
2.25.1
Mark Brown
maintainerRe: [PATCH v3 1/8] ASoC: amd: Add common framework to support I2S on ACP SOC
Quoted 6 lines · Ajit Kumar Pandey
We are using legacy way of exposing dais and DMA configuration that requires separate driver modules for various ACP SOC with almost similar hw configuration. Moreover the legacy approach requires separate I2S and DMA module platform devices registration and need machine specific quirk to control various I2S endpoints. Add generic dai driver and platform driver for I2S controller on ACP hw block.
This doesn't apply against current code, please check and resend:
pplying: ASoC: amd: Add common framework to support I2S on ACP SOC Using index info to reconstruct a base tree...
M sound/soc/amd/Kconfig
Falling back to patching base and 3-way merge... Auto-merging sound/soc/amd/Kconfig
CONFLICT (content): Merge conflict in sound/soc/amd/Kconfig
Re: [PATCH v3 1/8] ASoC: amd: Add common framework to support I2S on ACP SOC
I've rebased on top of current code and submitted new patch chain after resolving conflicts. Please try applying now
https://patchwork.kernel.org/project/alsa-devel/list/?series=566025.
Thanks & Regards
Ajit
Quoted 2 lines · Mark Brown
[CAUTION: External Email]
PATCH v3 2/8 ASoC: amd: acp: Add I2S support on Renoir platform
In reply to Ajit Kumar PandeyAdd I2S dai driver for Renoir platform and register with common acp framework to support non dsp I2S use case on Renoir.
--- sound/soc/amd/acp/Kconfig | 8 ++ sound/soc/amd/acp/Makefile | 5 ++ sound/soc/amd/acp/acp-renoir.c | 141 +++++++++++++++++++++++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 sound/soc/amd/acp/acp-renoir.c
sound/soc/amd/acp/Kconfig +8 -0
@@ -17,3 +17,11 @@ config SND_SOC_AMD_ACP_I2S config SND_SOC_AMD_ACP_PCM tristate + +config SND_AMD_ASOC_RENOIR + tristate "AMD ACP ASOC Renoir Support" + select SND_SOC_AMD_ACP_PCM + select SND_SOC_AMD_ACP_I2S + depends on X86 && PCI + help + This option enables Renoir I2S support on AMD platform.
sound/soc/amd/acp/Makefile +5 -0
@@ -8,5 +8,10 @@ snd-acp-pcm-objs := acp-platform.o snd-acp-i2s-objs := acp-i2s.o +#platform specific driver +snd-acp-renoir-objs := acp-renoir.o + obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o + +obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o
sound/soc/amd/acp/acp-renoir.c new file +141 -0
141 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 3/8 ASoC: amd: acp: Add callback for machine driver on ACP
In reply to Ajit Kumar PandeyAdd method to select and register machine driver for acp platform based on ACPI ID.
--- sound/soc/amd/acp/acp-platform.c | 23 +++++++++++++++++++++++ sound/soc/amd/acp/acp-renoir.c | 3 +++ sound/soc/amd/acp/amd.h | 6 ++++++ 3 files changed, 32 insertions(+)
sound/soc/amd/acp/acp-platform.c +23 -0
@@ -67,6 +67,27 @@ static const struct snd_pcm_hardware acp_pcm_hardware_capture = { .periods_max = CAPTURE_MAX_NUM_PERIODS, }; +int acp_machine_select (struct acp_dev_data *adata) +{ +struct snd_soc_acpi_mach *mach; +int size; + + size =sizeof (*adata->machines); + mach =snd_soc_acpi_find_machine (adata->machines); +if (!mach) { +dev_err (adata->dev,"warning: No matching ASoC machine driver found\n" ); +return -EINVAL ; + } + + adata->mach_dev =platform_device_register_data (adata->dev, mach->drv_name, +PLATFORM_DEVID_NONE , mach, size); +if (!adata->mach_dev) +dev_warn (adata->dev,"Unable to register Machine device\n" ); + +return 0 ; +} +EXPORT_SYMBOL_NS_GPL (acp_machine_select,SND_SOC_ACP_COMMON ); +static irqreturn_t i2s_irq_handler (int irq,void *data) {struct acp_dev_data *adata = data;
@@ -283,6 +304,8 @@ int acp_platform_unregister(struct device *dev) {struct acp_dev_data *adata =dev_get_drvdata (dev); +if (adata->mach_dev) +platform_device_unregister (adata->mach_dev);return 0 ; }EXPORT_SYMBOL_NS_GPL (acp_platform_unregister,SND_SOC_ACP_COMMON );
sound/soc/amd/acp/acp-renoir.c +3 -0
@@ -111,6 +111,9 @@ static int renoir_audio_probe(struct platform_device *pdev) adata->dai_driver = acp_renoir_dai; adata->num_dai =ARRAY_SIZE (acp_renoir_dai); + adata->machines = snd_soc_acpi_amd_acp_machines; +acp_machine_select (adata); +dev_set_drvdata (dev, adata);acp_platform_register (dev);
sound/soc/amd/acp/amd.h +6 -0
@@ -90,6 +90,9 @@ struct acp_dev_data {int num_dai;struct acp_stream *stream[ACP_MAX_STREAM ]; + +struct snd_soc_acpi_mach *machines; +struct platform_device *mach_dev; };extern const struct snd_soc_dai_ops asoc_acp_cpu_dai_ops;
@@ -98,6 +101,9 @@ int asoc_acp_i2s_probe(struct snd_soc_dai *dai);int acp_platform_register (struct device *dev);int acp_platform_unregister (struct device *dev); +int acp_machine_select (struct acp_dev_data *adata); +extern struct snd_soc_acpi_mach snd_soc_acpi_amd_acp_machines[]; +static inline u64 acp_get_byte_count (struct acp_dev_data *adata,int dai_id,int direction) {u64 byte_count, low =0 , high =0 ;
Signature · 1 line
2.25.1
PATCH v3 4/8 ASoC: amd: acp: Add generic machine driver support for ACP cards
In reply to Ajit Kumar PandeyWe have machines with different audio endpoints configurations across various distributions. We need to support multiple sound cards for different combinations of I2S instance and codecs hw. Now we also need to support SOF-DSP endpoints based sound cards. All such card combinations slightly differs in terms of machine ops callback. This patch adds ACP generic machine driver module that exposes method to create ACP cards dai links and define new ops for audio endpoints configurations. Initially we have added dailink support for RT5682 and RT1019 codec connection with ACP I2S_SP instance. We will add newer codecs in this module to use this for all AMD's ACP block sound cards supports in future.
--- sound/soc/amd/acp/Kconfig | 10 + sound/soc/amd/acp/Makefile | 5 + sound/soc/amd/acp/acp-mach-common.c | 467 ++++++++++++++++++++++++++++ sound/soc/amd/acp/acp-mach.h | 55 ++++ 4 files changed, 537 insertions(+) create mode 100644 sound/soc/amd/acp/acp-mach-common.c create mode 100644 sound/soc/amd/acp/acp-mach.h
sound/soc/amd/acp/Kconfig +10 -0
@@ -25,3 +25,13 @@ config SND_AMD_ASOC_RENOIR depends on X86 && PCI help This option enables Renoir I2S support on AMD platform. + +config SND_SOC_AMD_MACH_COMMON + tristate + select CLK_FIXED_FCH + select SND_SOC_RT5682_I2C + select SND_SOC_DMIC + select SND_SOC_RT1019 + depends on X86 && PCI && I2C + help + This option enables common Machine driver module for ACP.
sound/soc/amd/acp/Makefile +5 -0
@@ -11,7 +11,12 @@ snd-acp-i2s-objs := acp-i2s.o #platform specific driver snd-acp-renoir-objs := acp-renoir.o +#machine specific driver +snd-acp-mach-objs := acp-mach-common.o + obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o + +obj-$(CONFIG_SND_SOC_AMD_MACH_COMMON) += snd-acp-mach.o
sound/soc/amd/acp/acp-mach-common.c new file +467 -0
467 lines not on this page · raw message
sound/soc/amd/acp/acp-mach.h new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 5/8 ASoC: amd: acp: Add legacy sound card support for Chrome audio
In reply to Ajit Kumar PandeyRenoir based Chrome board has RT5682 as primary headset codec and RT1019 amp device connected to I2SSP ACP i2s controller. Add driver to register legacy sound card devices on Chrome board.
--- sound/soc/amd/acp/Kconfig | 6 ++ sound/soc/amd/acp/Makefile | 2 + sound/soc/amd/acp/acp-legacy-mach.c | 104 ++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 sound/soc/amd/acp/acp-legacy-mach.c
sound/soc/amd/acp/Kconfig +6 -0
@@ -35,3 +35,9 @@ config SND_SOC_AMD_MACH_COMMON depends on X86 && PCI && I2C help This option enables common Machine driver module for ACP. + +config SND_SOC_AMD_LEGACY_MACH + tristate "AMD Legacy Machine Driver Support" + select SND_SOC_AMD_MACH_COMMON + help + This option enables legacy sound card support for ACP audio.
sound/soc/amd/acp/Makefile +2 -0
@@ -13,6 +13,7 @@ snd-acp-renoir-objs := acp-renoir.o #machine specific driver snd-acp-mach-objs := acp-mach-common.o +snd-acp-legacy-mach-objs := acp-legacy-mach.o obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o
@@ -20,3 +21,4 @@ obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o obj-$(CONFIG_SND_SOC_AMD_MACH_COMMON) += snd-acp-mach.o +obj-$(CONFIG_SND_SOC_AMD_LEGACY_MACH) += snd-acp-legacy-mach.o
sound/soc/amd/acp/acp-legacy-mach.c new file +104 -0
104 lines not on this page · raw message
Signature · 1 line
2.25.1
kernel test robot
build botRe: [PATCH v3 5/8] ASoC: amd: acp: Add legacy sound card support for Chrome audio
Thank you for the patch! Perhaps something to improve:
Hi Ajit,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on v5.15-rc5 next-20211013]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Ajit-Kumar-Pandey/ASoC-Add-common-modules-support-for-ACP-hw-block/20211012-152408 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: x86_64-randconfig-m031-20211013 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
New smatch warnings:sound/soc/amd/acp/acp-mach-common.c:153 acp_card_hs_startup() warn: unsigned 'ret' is never less than zero.
Old smatch warnings:sound/soc/amd/acp/acp-mach-common.c:165 acp_card_hs_startup() warn: unsigned 'ret' is never less than zero.
vim +/ret +153 sound/soc/amd/acp/acp-mach-common.c
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 141
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 142 static int acp_card_hs_startup(struct snd_pcm_substream *substream)
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 143 {
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 144 struct snd_pcm_runtime *runtime = substream->runtime;
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 145 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 146 struct snd_soc_card *card = rtd->card;
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 147 struct acp_card_drvdata *drvdata = card->drvdata;
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 148 struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 149 unsigned int ret = 0;
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 150
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 151 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 152 | SND_SOC_DAIFMT_CBP_CFP);
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 @153 if (ret < 0) {
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 154 dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret);
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 155 return ret;
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 156 }
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 157
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 158 runtime->hw.channels_max = DUAL_CHANNEL;
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 159 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 160 &constraints_channels);
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 161 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 162 &constraints_rates);
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 163
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 164 ret = acp_clk_enable(drvdata);
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 165 if (ret < 0)
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 166 dev_err(rtd->card->dev, "Failed to enable HS clk: %d\n", ret);
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 167
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 168 return ret;
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 169 }
f6032c9a69e5df Ajit Kumar Pandey 2021-10-12 170 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH v3 5/8] ASoC: amd: acp: Add legacy sound card support for Chrome audio
In reply to Ajit Kumar PandeyThank you for the patch! Perhaps something to improve:
Hi Ajit,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on v5.15-rc5 next-20211013]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Ajit-Kumar-Pandey/ASoC-Add-common-modules-support-for-ACP-hw-block/20211012-152408 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: x86_64-randconfig-m031-20211013 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
New smatch warnings:sound/soc/amd/acp/acp-mach-common.c:153 acp_card_hs_startup() warn: unsigned 'ret' is never less than zero.
Old smatch warnings:sound/soc/amd/acp/acp-mach-common.c:165 acp_card_hs_startup() warn: unsigned 'ret' is never less than zero.
vim +/ret +153 sound/soc/amd/acp/acp-mach-common.c
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 141
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 142 static int acp_card_hs_startup(struct snd_pcm_substream *substream)
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 143 {
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 144 struct snd_pcm_runtime *runtime = substream->runtime;
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 145 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 146 struct snd_soc_card *card = rtd->card;
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 147 struct acp_card_drvdata *drvdata = card->drvdata;
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 148 struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 149 unsigned int ret = 0;
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 150
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 151 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 152 | SND_SOC_DAIFMT_CBP_CFP);
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 @153 if (ret < 0) {
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 154 dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret);
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 155 return ret;
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 156 }
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 157
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 158 runtime->hw.channels_max = DUAL_CHANNEL;
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 159 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 160 &constraints_channels);
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 161 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 162 &constraints_rates);
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 163
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 164 ret = acp_clk_enable(drvdata);
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 165 if (ret < 0)
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 166 dev_err(rtd->card->dev, "Failed to enable HS clk: %d\n", ret);
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 167
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 168 return ret;
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 169 }
f6032c9a69e5dfb Ajit Kumar Pandey 2021-10-12 170 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH v3 6/8 ASoC: amd: acp: Add SOF audio support on Chrome board
In reply to Ajit Kumar PandeyChrome board has RT5682 codec and RT1019 amp connected to I2S SP controller on ACP hw. Also it support DMIC capture endpoints with inbuilt pdm controller on ACP hw block. Add driver module to create backend dai links for sof dsp core. We pass driver data with audio end points configuration to register sound cards and create device nodes for all audio endpoints.
--- sound/soc/amd/acp/Kconfig | 6 ++ sound/soc/amd/acp/Makefile | 2 + sound/soc/amd/acp/acp-sof-mach.c | 103 +++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 sound/soc/amd/acp/acp-sof-mach.c
sound/soc/amd/acp/Kconfig +6 -0
@@ -41,3 +41,9 @@ config SND_SOC_AMD_LEGACY_MACH select SND_SOC_AMD_MACH_COMMON help This option enables legacy sound card support for ACP audio. + +config SND_SOC_AMD_SOF_MACH + tristate "AMD SOF Machine Driver Support" + select SND_SOC_AMD_MACH_COMMON + help + This option enables SOF sound card support for ACP audio.
sound/soc/amd/acp/Makefile +2 -0
@@ -14,6 +14,7 @@ snd-acp-renoir-objs := acp-renoir.o #machine specific driver snd-acp-mach-objs := acp-mach-common.o snd-acp-legacy-mach-objs := acp-legacy-mach.o +snd-acp-sof-mach-objs := acp-sof-mach.o obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o
@@ -22,3 +23,4 @@ obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o obj-$(CONFIG_SND_SOC_AMD_MACH_COMMON) += snd-acp-mach.o obj-$(CONFIG_SND_SOC_AMD_LEGACY_MACH) += snd-acp-legacy-mach.o +obj-$(CONFIG_SND_SOC_AMD_SOF_MACH) += snd-acp-sof-mach.o
sound/soc/amd/acp/acp-sof-mach.c new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 7/8 ASoC: amd: acp: Add support for Maxim amplifier codec
In reply to Ajit Kumar PandeyIn newer chrome boards we have max98360a as an amplifier codec. Add support for max98360a in generic machine driver and configure driver data to enable SOF sound card support on newer boards .
--- sound/soc/amd/acp/Kconfig | 1 + sound/soc/amd/acp/acp-mach-common.c | 37 +++++++++++++++++++++++++++++ sound/soc/amd/acp/acp-mach.h | 1 + sound/soc/amd/acp/acp-sof-mach.c | 14 +++++++++++ 4 files changed, 53 insertions(+)
sound/soc/amd/acp/Kconfig +1 -0
@@ -32,6 +32,7 @@ config SND_SOC_AMD_MACH_COMMON select SND_SOC_RT5682_I2C select SND_SOC_DMIC select SND_SOC_RT1019 + select SND_SOC_MAX98357A depends on X86 && PCI && I2C help This option enables common Machine driver module for ACP.
sound/soc/amd/acp/acp-mach-common.c +37 -0
@@ -274,6 +274,31 @@ static const struct snd_soc_ops acp_card_rt1019_ops = { .hw_params = acp_card_rt1019_hw_params, }; +/* Declare Maxim codec components */ +SND_SOC_DAILINK_DEF (max98360a, +DAILINK_COMP_ARRAY (COMP_CODEC ("MX98360A:00" ,"HiFi" ))); + +static const struct snd_soc_dapm_route max98360a_map[] = { + {"Spk" ,NULL ,"Speaker" }, +}; + +static int acp_card_maxim_init (struct snd_soc_pcm_runtime *rtd) +{ +struct snd_soc_card *card = rtd->card; +struct acp_card_drvdata *drvdata = card->drvdata; + +if (drvdata->amp_codec_id !=MAX98360A ) +return -EINVAL ; + +return snd_soc_dapm_add_routes (&rtd->card->dapm, max98360a_map, +ARRAY_SIZE (max98360a_map)); +} + +static const struct snd_soc_ops acp_card_maxim_ops = { + .startup = acp_card_amp_startup, + .shutdown = acp_card_shutdown, +}; +/* Declare DMIC codec components */ SND_SOC_DAILINK_DEF (dmic_codec,DAILINK_COMP_ARRAY (COMP_CODEC ("dmic-codec" ,"dmic-hifi" )));
@@ -371,6 +396,12 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card) card->codec_conf = rt1019_conf; card->num_configs =ARRAY_SIZE (rt1019_conf); } +if (drv_data->amp_codec_id ==MAX98360A ) { + links[i].codecs = max98360a; + links[i].num_codecs =ARRAY_SIZE (max98360a); + links[i].ops = &acp_card_maxim_ops; + links[i].init = acp_card_maxim_init; + } i++; }
@@ -455,6 +486,12 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card) card->codec_conf = rt1019_conf; card->num_configs =ARRAY_SIZE (rt1019_conf); } +if (drv_data->amp_codec_id ==MAX98360A ) { + links[i].codecs = max98360a; + links[i].num_codecs =ARRAY_SIZE (max98360a); + links[i].ops = &acp_card_maxim_ops; + links[i].init = acp_card_maxim_init; + } } card->dai_link = links;
sound/soc/amd/acp/acp-mach.h +1 -0
@@ -35,6 +35,7 @@ enum codec_endpoints {DUMMY =0 ,RT5682 ,RT1019 , + MAX98360A, }; struct acp_card_drvdata {
sound/soc/amd/acp/acp-sof-mach.c +14 -0
@@ -29,6 +29,15 @@ static struct acp_card_drvdata sof_rt5682_rt1019_data = { .dmic_codec_id = DMIC, }; +static struct acp_card_drvdata sof_rt5682_max_data = { + .hs_cpu_id =I2S_SP , + .amp_cpu_id =I2S_SP , + .dmic_cpu_id =DMIC , + .hs_codec_id =RT5682 , + .amp_codec_id =MAX98360A , + .dmic_codec_id =DMIC , +}; +static const struct snd_kcontrol_new acp_controls[] = {SOC_DAPM_PIN_SWITCH ("Headphone Jack" ),SOC_DAPM_PIN_SWITCH ("Headset Mic" ),
@@ -85,6 +94,10 @@ static const struct platform_device_id board_ids[] = { .name = "rt5682-rt1019", .driver_data = (kernel_ulong_t)&sof_rt5682_rt1019_data }, + { + .name = "rt5682-max", + .driver_data = (kernel_ulong_t)&sof_rt5682_max_data + }, { } };static struct platform_driver acp_asoc_audio = {
@@ -100,4 +113,5 @@ module_platform_driver(acp_asoc_audio);MODULE_IMPORT_NS (SND_SOC_AMD_MACH );MODULE_DESCRIPTION ("ACP chrome SOF audio support" );MODULE_ALIAS ("platform:rt5682-rt1019" ); +MODULE_ALIAS ("platform:rt5682-max" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.25.1
PATCH v3 8/8 ASoC: amd: acp: Add support for RT5682-VS codec
In reply to Ajit Kumar PandeyIn newer variants primary codec is rt5682vs. Add support for newer codec variants in generic machine driver module and define driver data to register SOF sound card.
--- sound/soc/amd/acp/Kconfig | 1 + sound/soc/amd/acp/acp-mach-common.c | 96 +++++++++++++++++++++++++++++ sound/soc/amd/acp/acp-mach.h | 1 + sound/soc/amd/acp/acp-sof-mach.c | 14 +++++ 4 files changed, 112 insertions(+)
sound/soc/amd/acp/Kconfig +1 -0
@@ -33,6 +33,7 @@ config SND_SOC_AMD_MACH_COMMON select SND_SOC_DMIC select SND_SOC_RT1019 select SND_SOC_MAX98357A + select SND_SOC_RT5682S depends on X86 && PCI && I2C help This option enables common Machine driver module for ACP.
sound/soc/amd/acp/acp-mach-common.c +96 -0
120 lines not on this page · raw message
sound/soc/amd/acp/acp-mach.h +1 -0
@@ -36,6 +36,7 @@ enum codec_endpoints {RT5682 ,RT1019 ,MAX98360A , + RT5682S, }; struct acp_card_drvdata {
sound/soc/amd/acp/acp-sof-mach.c +14 -0
@@ -38,6 +38,15 @@ static struct acp_card_drvdata sof_rt5682_max_data = { .dmic_codec_id = DMIC, }; +static struct acp_card_drvdata sof_rt5682s_max_data = { + .hs_cpu_id =I2S_SP , + .amp_cpu_id =I2S_SP , + .dmic_cpu_id =DMIC , + .hs_codec_id =RT5682S , + .amp_codec_id =MAX98360A , + .dmic_codec_id =DMIC , +}; +static const struct snd_kcontrol_new acp_controls[] = {SOC_DAPM_PIN_SWITCH ("Headphone Jack" ),SOC_DAPM_PIN_SWITCH ("Headset Mic" ),
@@ -98,6 +107,10 @@ static const struct platform_device_id board_ids[] = { .name = "rt5682-max", .driver_data = (kernel_ulong_t)&sof_rt5682_max_data }, + { + .name = "rt5682s-max", + .driver_data = (kernel_ulong_t)&sof_rt5682s_max_data + }, { } };static struct platform_driver acp_asoc_audio = {
@@ -114,4 +127,5 @@ MODULE_IMPORT_NS(SND_SOC_AMD_MACH);MODULE_DESCRIPTION ("ACP chrome SOF audio support" );MODULE_ALIAS ("platform:rt5682-rt1019" );MODULE_ALIAS ("platform:rt5682-max" ); +MODULE_ALIAS ("platform:rt5682s-max" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.25.1
Mark Brown
maintainerQuoted 13 lines · Ajit Kumar Pandey
changes since v2:
- FixesKconfigdescription and indent.Ajit Kumar Pandey (8):
ASoC: amd: Add common framework to support I2S on ACP SOC
ASoC: amd: acp: Add I2S support on Renoir platform
ASoC: amd: acp: Add callback for machine driver on ACP
ASoC: amd: acp: Add generic machine driver support for ACP cards
ASoC: amd: acp: Add legacy sound card support for Chrome audio
ASoC: amd: acp: Add SOF audio support on Chrome board
ASoC: amd: acp: Add support for Maxim amplifier codec
ASoC: amd: acp: Add support for RT5682-VS codec
Quoted 1 line
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/8] ASoC: amd: Add common framework to support I2S on ACP SOC
commit: 623621a9f9e1a2f4bf1c69d066b7de3de2b12df6
[2/8] ASoC: amd: acp: Add I2S support on Renoir platform
commit: 58c8c8438db45fb22b8d855645e2d4d15ca9ee72
[3/8] ASoC: amd: acp: Add callback for machine driver on ACP
commit: e646b51f5dd5e92bcb159cb932aa540451ac803f
[4/8] ASoC: amd: acp: Add generic machine driver support for ACP cards
commit: d4c750f2c7d44b5b39e197308bc3f510205bba4b
[5/8] ASoC: amd: acp: Add legacy sound card support for Chrome audio
commit: 9d8a7be88b3365e4df6bf983b9af5399f9c81491
[6/8] ASoC: amd: acp: Add SOF audio support on Chrome board
commit: 9f84940f5004e1d29f28b85294d4c3b683ff3ff4
[7/8] ASoC: amd: acp: Add support for Maxim amplifier codec
commit: cabc3acec02a3fb63efaba8ac892b54e823cd111
[8/8] ASoC: amd: acp: Add support for RT5682-VS codec
commit: 8b72562668481894239e145afd2f651a7f83a728All 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