summaryrefslogtreecommitdiff
path: root/sound/soc/amd/acp/acp-mach-common.c
AgeCommit message (Collapse)AuthorFilesLines
2024-01-22ASoC: Merge up fixesMark Brown1-2/+14
To facilitate testing get our current fixes into the branch.
2024-01-22ASoC: amd: acp: Add check for cpu dai link initializationVenkata Prasad Potturu1-2/+7
Add condition check for cpu dai link initialization for amplifier codec path, as same pcm id uses for both headset and speaker path for RENOIR platforms. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://msgid.link/r/20240118143023.1903984-3-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-22ASoC: amd: acp: Enable rt5682s clocks in acp slave modeVenkata Prasad Potturu1-0/+7
Set and enable rt5682s codec bclk and lrclk rates when acp is in slave mode. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://msgid.link/r/20240118143023.1903984-1-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-22ASoC: amd: acp: Make use of existing *_CODEC_DAI macrosCristian Ciocaltea1-3/+3
The generic ACP machine driver provides macros for NAU88221 and MAX98388 codec DAI names, but in places it is still using directly the related strings. For consistency, replace all strings with the equivalent macros. Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Link: https://msgid.link/r/20231219030728.2431640-3-cristian.ciocaltea@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-18ASoC: amd: acp: Add missing MODULE_DESCRIPTION in mach-commonCristian Ciocaltea1-0/+1
Add a MODULE_DESCRIPTION() in the generic ACP machine driver to avoid the following warning when building with W=1: WARNING: modpost: missing MODULE_DESCRIPTION() in sound/soc/amd/acp/snd-acp-mach.o Fixes: d4c750f2c7d4 ("ASoC: amd: acp: Add generic machine driver support for ACP cards") Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Link: https://msgid.link/r/20231209203229.878730-6-cristian.ciocaltea@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-07ASoC: amd: acp: Set bclk as source to set pll for rt5682s codecVenkata Prasad Potturu1-0/+16
Some platforms doesn't have reference mclk pin to codec, so set bclk as a clk source for rt5682s codec pll in tdm mode. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://lore.kernel.org/r/20231206110620.1695591-7-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-06ASoC: amd: acp: Set bclk as source to set pll for rt5682s codecVenkata Prasad Potturu1-0/+16
Some platforms doesn't have reference mclk pin to codec, so set bclk as a clk source for rt5682s codec pll in tdm mode. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://lore.kernel.org/r/20231206110620.1695591-7-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-06ASoC: amd: acp: Enable dpcm_capture for MAX98388 codecVenkata Prasad Potturu1-0/+1
Enable dpcm_capture for amplifier codec MAX98388 for reference stream capture in smart amplifier case. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://lore.kernel.org/r/20231206110620.1695591-6-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-06ASoC: amd: acp: Add new cpu dai and dailink creation for I2S BT instanceVenkata Prasad Potturu1-1/+24
Add sof_bt cpu id and create dailink for i2s bt instance in acp common machine driver. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://lore.kernel.org/r/20231206110620.1695591-4-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-25ASoC: amd: acp: add machine driver support for acp7.0Syed Saba Kareem1-0/+9
add machine driver support for ACP7.0 on legacy stack. Signed-off-by: Syed Saba Kareem <Syed.SabaKareem@amd.com> Link: https://lore.kernel.org/r/20231021145110.478744-13-Syed.SabaKareem@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-25ASoC: amd: acp: add machine driver support for acp6.3 platformSyed Saba Kareem1-0/+15
add legacy machine driver support for acp6.3 based platform. Signed-off-by: Syed Saba Kareem <Syed.SabaKareem@amd.com> Link: https://lore.kernel.org/r/20231021145110.478744-4-Syed.SabaKareem@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-25ASoC: amd: convert not to use asoc_xxx()Kuninori Morimoto1-27/+27
ASoC is now unified asoc_xxx() into snd_soc_xxx(). This patch convert asoc_xxx() to snd_soc_xxx(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/878r9cs25b.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11ASoC: amd: acp: Add machine driver that enables sound for systems with a ↵Marian Postevca1-0/+8
ES8336 codec This commit enables sound for a line of Huawei laptops that use the ES8336 codec which is connected to the ACP3X module. Signed-off-by: Marian Postevca <posteuca@mutex.one> Link: https://lore.kernel.org/r/20230829220116.1159-6-posteuca@mutex.one Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-18ASoC: amd: acp: Add kcontrols and widgets per-codec in common codeAlper Nebi Yasak1-3/+65
Commit 7ac3404c2e21 ("ASoC: amd: acp: Map missing jack kcontrols") adds card kcontrols and DAPM widgets corresponding to jacks for Headphone and Headset Mic. But these were already being added in acp-legacy-mach.c and acp-sof-mach.c, so this causes a probe error: sof_mach rt5682s-hs-rt1019: control 2:0:0:Headphone Jack Switch:0 is already present sof_mach rt5682s-hs-rt1019: ASoC: Failed to add Headphone Jack Switch: -16 sof_mach rt5682s-hs-rt1019: devm_snd_soc_register_card(sof-rt5682s-hs-rt1019) failed: -16 sof_mach: probe of rt5682s-hs-rt1019 failed with error -16 Removing the new duplicates from the common code might be enough to fix the issue. But some of the codecs use different kcontrols and widgets. NAU8821 alone has an "Int Mic". MAX98360A has a single "Spk", while RT1019 has "Left Spk" and "Right Spk" (and two codec instances with name prefixes). Since there are per-codec differences, add the kcontrols and widgets in the common code as each dai-link is being initialized, instead of in the two machine drivers' probe(). Also, MAX98388 has Left and Right instances, but uses a single "SPK" widget. That seems weird, so normalize it to use two widgets (one per each instance like RT1019) while we're adding controls. Fixes: 7ac3404c2e21 ("ASoC: amd: acp: Map missing jack kcontrols") Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Link: https://lore.kernel.org/r/20230818080314.32991-1-alpernebiyasak@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-07ASoC: amd: acp: Map missing jack kcontrolsAlper Nebi Yasak1-44/+182
This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The RT5682, RT5682s, NAU8825 and NAU8821 codecs used here can detect Headphone and Headset Mic connections. Expose both to userspace as kcontrols and add the necessary widgets. Split the jack and pin structs per-codec to accommodate for per-codec differences. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Link: https://lore.kernel.org/r/20230802175737.263412-4-alpernebiyasak@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-10ASoC: amd: acp: Add machine driver support for max98388 codecVenkata Prasad Potturu1-0/+100
In newer platforms max98388 codec as amplifier codec. Add support for maxim codec in generic machine driver. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://lore.kernel.org/r/20230707120730.1948445-3-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-10ASoC: amd: acp: Add machine driver support for nau8821 codecVenkata Prasad Potturu1-0/+167
In newer variants nau8821 as primary codec. Add support for nau8821 codec in generic machine driver. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://lore.kernel.org/r/20230707120730.1948445-2-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-05-08ASoC: amd: use asoc_dummy_dlcKuninori Morimoto1-25/+18
Now we can share asoc_dummy_dlc. This patch use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/875y9m0zwz.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org
2023-01-30ASoC: amd: acp: Refactor bit width calculationVenkata Prasad Potturu1-4/+4
Refactor bit width calculation using params_physical_width() instead hard-code values. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://lore.kernel.org/r/20230130100104.4076640-1-venkataprasad.potturu@amd.com Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-11ASoC: amd: acp: Enable i2s tdm support for skyrim platformsVenkata Prasad Potturu1-0/+14
Enable i2s tdm support for skyrim platform using dmi quirks. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://lore.kernel.org/r/20230109132104.1259479-6-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-11ASoC: amd: acp: Add i2s tdm support in machine driverVenkata Prasad Potturu1-14/+148
Add i2s tdm support for amd platforms. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://lore.kernel.org/r/20230109132104.1259479-5-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-11ASoC: amd: acp: Refactor i2s clocks programming sequenceVenkata Prasad Potturu1-75/+94
Refactor i2s clock values based on hw_params and use srate and bclk_ratio variables in clock enable API instead hard-code values. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://lore.kernel.org/r/20230109132104.1259479-4-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-11ASoC: amd: acp: Refactor dai format implementationVenkata Prasad Potturu1-30/+122
Refactor dai format implementation in dai_link specific snd_soc_ops. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://lore.kernel.org/r/20230109132104.1259479-3-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-11ASoC: amd: acp: Add new cpu dai's in machine driverVenkata Prasad Potturu1-4/+8
when using same cpu dai for 2 different dai links below error is reported. error: can't find BE for DAI ACPHS_VIRTUAL1.OUT To avoid this error add new cpu dai. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://lore.kernel.org/r/20230109132104.1259479-2-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-19ASoC: amd: acp: Add setbias level for rt5682s codec in machine driverVenkata Prasad Potturu1-6/+56
Add set_bais_level function for rt5682s codec to enable bclk and lrclk before codec widgets power on and disable bclk and lrclk after widgets power down, to avoid pop noise Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://lore.kernel.org/r/20220921090750.3833256-1-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-19ASoC: amd: acp: use function devm_kcalloc() instead of devm_kzalloc()ye xingchen1-2/+2
Use 2-factor multiplication argument form devm_kcalloc() instead of devm_kzalloc(). Reported-by: Zeal Robot <zealci@zte.com.cn> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> Link: https://lore.kernel.org/r/20220916062027.152815-1-ye.xingchen@zte.com.cn Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-08ASoC: amd: acp: Add legacy audio driver support for Rembrandt platformV sujith kumar Reddy1-2/+84
Add i2s and dmic support for Rembrandt platform, Add machine support for nau8825, max98360 and rt5682s,rt1019 codec in legacy driver for rembrandt platform. Here codec is in a slave mode. Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com> Link: https://lore.kernel.org/r/20220707161142.491034-4-Vsujithkumar.Reddy@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-08ASoC: amd: acp: Remove rt1019_1 codec conf from machine driverV sujith kumar Reddy1-18/+0
Remove rt1019_1 codec configuration which has i2c-10EC1019:01 and i2c-10EC1019:02 codec components, Now Using default i2c-10EC1019:00 and i2c-10EC1019:01 codec components. Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com> Link: https://lore.kernel.org/r/20220707161142.491034-2-Vsujithkumar.Reddy@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06ASoC: amd: acp: Add support for rt5682s and rt1019 card with hs instanceV sujith kumar Reddy1-10/+57
We have new platform with rt5682s as a primary codec and rt1019 as an amp codec. Add machine struct to register sof audio based sound card on such Chrome machine. Here we are configuring as a soc mclk master and codec slave. Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com> Link: https://lore.kernel.org/r/20220531120813.47116-3-Vsujithkumar.Reddy@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06ASoC: amd: acp: Add support for nau8825 and max98360 cardV sujith kumar Reddy1-6/+160
We have new platform with nau8825 as a primary codec and max98360 as an amp codec. Add machine struct to register sof audio based sound card on such Chrome machine. Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com> Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com> Link: https://lore.kernel.org/r/20220531120813.47116-2-Vsujithkumar.Reddy@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19ASoC: amd: acp: Set Speaker enable/disable pin through rt1019 codec driver.V sujith kumar Reddy1-25/+0
RT1019 codec has two ways of controlling the en_spkr. one way is controlling through gpio pin method the another way is through codec register update through driver. Now Speaker enable/disable is controlled through codec register updated by codec driver. This patch reverts gpio logic. This reverts commit 5c5f08f7fc0bee9a1bc3fbdcb7a21cfd0648ab14 ("ASoC: amd: acp: Power on/off the speaker enable gpio pin based on DAPM callback.") Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com> Link: https://lore.kernel.org/r/20220516160619.17832-2-Vsujithkumar.Reddy@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-14ASoC: soc-card: Create jack kcontrol without pinsAkihiko Odaki1-2/+2
snd_soc_card_jack_new() allowed to create jack kcontrol without pins, but did not create kcontrols. The jack would not have kcontrols if pins were not going to be added. This renames the old snd_soc_card_jack_new() to snd_soc_card_jack_new_pins() for use when pins are provided or will be added later. The new snd_soc_card_jack_new() appropriately creates a jack for use without pins and adds a kcontrol. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Link: https://lore.kernel.org/r/20220408041114.6024-1-akihiko.odaki@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-21Merge tag 'asoc-v5.18' of ↵Takashi Iwai1-0/+50
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus ASoC: Updates for v5.18 Quite a quiet release for ASoC, lots of work on drivers and platforms but nothing too groundbreaking but not much on the core itself: - Start of moving SoF to support multiple IPC mechanisms. - Use of NHLT ACPI table to reduce the amount of quirking required for Intel systems. - Some building blocks for use in forthcoming Intel AVS driver for legacy Intel DSP firmwares. - Support for AMD PDM, Atmel PDMC, Awinic AW8738, i.MX cards with TLV320AIC31xx, Intel machines with CS35L41 and ESSX8336, Mediatek MT8181 wideband bluetooth, nVidia Tegra234, Qualcomm SC7280, Renesas RZ/V2L, Texas Instruments TAS585M
2022-02-25ASoC: acp: check the return value of devm_kzalloc() in ↵Jia-Ju Bai1-0/+2
acp_legacy_dai_links_create() The function devm_kzalloc() in acp_legacy_dai_links_create() can fail, so its return value should be checked. Fixes: d4c750f2c7d4 ("ASoC: amd: acp: Add generic machine driver support for ACP cards") Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Link: https://lore.kernel.org/r/20220225131645.27556-1-baijiaju1990@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-24ASoC: amd: acp: Add DMIC machine driver opsAjit Kumar Pandey1-0/+27
Add dmic ops and startup callback to add snd_pcm_hw_constraint for pdm related device node. Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com> Link: https://lore.kernel.org/r/20220222124213.721224-4-AjitKumar.Pandey@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-28ASoC: amd: acp: acp-legacy: Add DMIC dai link support for RenoirAjit Kumar Pandey1-0/+21
Add DMIC related dai link for pdm-dmic dai on Renoir platform with generic dmic codec dai. Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com> Link: https://lore.kernel.org/r/20220117115854.455995-6-AjitKumar.Pandey@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-21ASoC: amd: acp-mach: Fix Left and Right rt1019 amp devicesAjit Kumar Pandey1-2/+2
We're setting wrong card codec conf for rt1019 amp devices in our machine driver. Due to this left and right amp channels data are reversed in our machines as wrong device prefix results in wrong value for "Mono LR Select" rt1019 mixer control. Reverse dev ids in codec conf with Left and Right name_prefix to fix such issue. Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com> Link: https://lore.kernel.org/r/20220120133605.476138-1-AjitKumar.Pandey@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-06ASoC: amd: acp: acp-mach: Change default RT1019 amp dev idAjit Kumar Pandey1-4/+4
RT1019 components was initially registered with i2c1 and i2c2 but now changed to i2c0 and i2c1 in most of our AMD platforms. Change default rt1019 components to 10EC1019:00 and 10EC1019:01 which is aligned with most of AMD machines. Any exception to rt1019 device ids in near future board design can be handled using dmi based quirk for that machine. Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com> Link: https://lore.kernel.org/r/20220106150525.396170-1-AjitKumar.Pandey@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24ASoC: amd: acp: Power on/off the speaker enable gpio pin based on DAPM callback.V sujith kumar Reddy1-0/+25
Configure the speaker gpio pin based on power sequence of the DAPM speaker events. Enable speaker after widget power up and Disable before widget powerdown. Signed-off-by: V sujith kumar Reddy <vsujithkumar.reddy@amd.com> Link: https://lore.kernel.org/r/20211224150058.2444776-1-vsujithkumar.reddy@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-20ASoC: amd: acp: Add support for RT5682-VS codecAjit Kumar Pandey1-0/+96
In 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. Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com> Link: https://lore.kernel.org/r/20211019070938.5076-9-AjitKumar.Pandey@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-20ASoC: amd: acp: Add support for Maxim amplifier codecAjit Kumar Pandey1-0/+37
In 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 . Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com> Link: https://lore.kernel.org/r/20211019070938.5076-8-AjitKumar.Pandey@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-20ASoC: amd: acp: Add generic machine driver support for ACP cardsAjit Kumar Pandey1-0/+467
We 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. Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com> Link: https://lore.kernel.org/r/20211019070938.5076-5-AjitKumar.Pandey@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>