summaryrefslogtreecommitdiff
path: root/sound/soc/amd/vangogh/acp5x-mach.c
AgeCommit message (Collapse)AuthorFilesLines
2023-12-18ASoC: amd: vangogh: Drop conflicting ACPI-based probingCristian Ciocaltea1-22/+13
The Vangogh machine driver variant based on the MAX98388 amplifier, as found on Valve's Steam Deck OLED, relies on probing via an ACPI match table. This worked fine until commit 197b1f7f0df1 ("ASoC: amd: Add new dmi entries to config entry") enabled SOF support for the target machine (i.e. Galileo product), causing the sound card to enter the deferred probe state indefinitely: $ cat /sys/kernel/debug/devices_deferred AMDI8821:00 acp5x_mach: Register card (acp5x-max98388) failed The issue is related to commit e89f45edb747 ("ASoC: amd: vangogh: Add check for acp config flags in vangogh platform"), which tries to mitigate potential conflicts between SOF and generic ACP Vangogh drivers, due to sharing the PCI device IDs. However, the solution is effective only if the machine driver is directly probed by pci-acp5x through platform_device_register_full(). Hence, remove the conflicting ACPI based probing and rely exclusively on DMI quirks for sound card setup. Fixes: dba22efd0d17 ("ASoC: amd: vangogh: Add support for NAU8821/MAX98388 variant") Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Link: https://msgid.link/r/20231209203229.878730-2-cristian.ciocaltea@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-25ASoC: amd: convert not to use asoc_xxx()Kuninori Morimoto1-6/+6
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-08-01ASoC: amd: acp5x-mach:add checks to avoid static analysis warningsPierre-Louis Bossart1-0/+3
snd_soc_card_get_codec_dai() can return NULL, but that value is not checked for, leading to static analysis warnings. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Yaochun Hung <yc.hung@mediatek.com> Link: https://lore.kernel.org/r/20230731213748.440285-9-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-10ASoC: amd: vangogh: Add support for NAU8821/MAX98388 variantCristian Ciocaltea1-8/+129
Extend the Vangogh machine driver to support a variant based on the Nuvoton NAU88L21 Codec and the Analog Devices MAX98388 Speaker Amplifier. Additionally, enable probing via ACPI match table for this and future hardware revisions. Co-developed-by: Lucas Tanure <lucas.tanure@collabora.com> Signed-off-by: Lucas Tanure <lucas.tanure@collabora.com> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Link: https://lore.kernel.org/r/20230705214800.193244-4-cristian.ciocaltea@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-10ASoC: amd: vangogh: Use dmi_first_match() for DMI quirk handlingCristian Ciocaltea1-21/+7
In preparation for supporting ACPI probing, move DMI quirk handling logic at the probe's top, to be able to return as quickly as possible in case there is no DMI matching. Additionally, simplify the code by replacing dmi_check_system() and related callback with dmi_first_match(). While at it, also drop a few unnecessary empty lines. Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Link: https://lore.kernel.org/r/20230705214800.193244-3-cristian.ciocaltea@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-10ASoC: amd: vangogh: Make use of DRV_NAMECristian Ciocaltea1-1/+1
The "acp5x_mach" string is provided for both driver name and MODULE_ALIAS. Since they need to match, ensure DRV_NAME macro is used in both locations. Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Link: https://lore.kernel.org/r/20230705214800.193244-2-cristian.ciocaltea@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06ASoC: amd: vangogh: Add components prefix in structs and function namesLucas Tanure1-14/+14
Add prefixes 8821/35l41 in structs and function names so future platforms can be added and reference the correct sound card. Also include acp5x prefix to cs35l41_conf. Signed-off-by: Lucas Tanure <lucas.tanure@collabora.com> Link: https://lore.kernel.org/r/20230217110850.1045250-10-lucas.tanure@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06ASoC: amd: vangogh: Centralize strings definitionLucas Tanure1-12/+19
Replace occurrences of strings by their definition, avoiding bugs where the string changed, but not all places have been modified. While at it rename defines to use NAU8821 codec name instead of NUVOTON and align with the other defines. Signed-off-by: Lucas Tanure <lucas.tanure@collabora.com> Link: https://lore.kernel.org/r/20230217110850.1045250-9-lucas.tanure@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06ASoC: amd: vangogh: Move nau8821 and CPU side code up for future platformLucas Tanure1-47/+50
Move nau8821 and CPU side code up in the source so future platforms can be added. Signed-off-by: Lucas Tanure <lucas.tanure@collabora.com> Link: https://lore.kernel.org/r/20230217110850.1045250-8-lucas.tanure@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06ASoC: amd: vangogh: Check Bit Clock rate before snd_soc_dai_set_pllLucas Tanure1-3/+9
Check bit clock is valid before setting it with snd_soc_dai_set_pll Signed-off-by: Lucas Tanure <lucas.tanure@collabora.com> Link: https://lore.kernel.org/r/20230217110850.1045250-7-lucas.tanure@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06ASoC: amd: vangogh: use for_each_rtd_components instead of forLucas Tanure1-20/+22
To iterate over components use for_each_rtd_components And compare to component name, so asoc_rtd_to_codec and the dai code can be removed Signed-off-by: Lucas Tanure <lucas.tanure@collabora.com> Link: https://lore.kernel.org/r/20230217110850.1045250-6-lucas.tanure@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06ASoC: amd: vangogh: remove unnecessarily included headersLucas Tanure1-6/+2
Remove unused includes and replace <linux/input.h> by <linux/input-event-codes.h> Signed-off-by: Lucas Tanure <lucas.tanure@collabora.com> Link: https://lore.kernel.org/r/20230217110850.1045250-5-lucas.tanure@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06ASoC: amd: vangogh: use sizeof of variable instead of struct typeLucas Tanure1-1/+1
Use sizeof(*machine) instead of sizeof(struct acp5x_platform_info) There is a possibility of bug when variable type has changed but corresponding struct passed to the sizeof has not. Signed-off-by: Lucas Tanure <lucas.tanure@collabora.com> Link: https://lore.kernel.org/r/20230217110850.1045250-4-lucas.tanure@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06ASoC: amd: vangogh: Small code refactorLucas Tanure1-81/+64
Small refactor of the code: - sort includes in alphabetical order - sort variables declarations by line length - remove unnecessary "struct snd_soc_card *card" lines - insert blank lines before return - break/unbreak some lines for better read - align defines Signed-off-by: Lucas Tanure <lucas.tanure@collabora.com> Link: https://lore.kernel.org/r/20230217110850.1045250-3-lucas.tanure@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-06ASoC: amd: vangogh: Remove unnecessary init functionLucas Tanure1-6/+0
Remove empty acp5x_cs35l41_init function Signed-off-by: Lucas Tanure <lucas.tanure@collabora.com> Link: https://lore.kernel.org/r/20230217110850.1045250-2-lucas.tanure@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-20ASoC: soc.h: remove num_cpus/codecsKuninori Morimoto1-1/+1
Current rtd has both dai_link pointer (A) and num_cpus/codecs (B). (A) rtd->dai_link = dai_link; (B) rtd->num_cpus = dai_link->num_cpus; (B) rtd->num_codecs = dai_link->num_codecs; But, we can get num_cpus/codecs (B) via dai_link (A). This means we don't need to keep num_cpus/codecs on rtd. This patch removes these. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87sfkmv9n3.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-22ASoC: amd: vangogh: Use non-legacy DAI naming for cs35l41Cristian Ciocaltea1-2/+1
Unlike most CODEC drivers, the CS35L41 driver did not have the non_legacy_dai_naming set, meaning the corresponding DAI has been traditionally registered using the legacy naming: spi-VLV1776:0x The recent migration to the new legacy DAI naming style has implicitly corrected that behavior and DAI gets now registered via the non-legacy naming, i.e. cs35l41-pcm. The problem is the acp5x platform driver is now broken as it continues to refer to the above mentioned codec using the legacy DAI naming in function acp5x_cs35l41_hw_params() and, therefore, the related setup is not being executed anymore. Let's fix that by replacing the obsolete DAI name with the correct one. Fixes: 129f055a2144 ("ASoC: core: Switch core to new DAI naming flag") Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220722092700.8269-1-cristian.ciocaltea@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-16ASoC: amd: vangogh: Remove duplicate include filesYueHaibing1-2/+0
Remove duplicated includes. Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20220514023806.34768-1-yuehaibing@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-14ASoC: soc-card: Create jack kcontrol without pinsAkihiko Odaki1-4/+4
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-7/+7
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-03-02ASoC: amd: use asoc_substream_to_rtd()Zhen Ni1-4/+4
Uses asoc_substream_to_rtd() helper. Signed-off-by: Zhen Ni <nizhen@uniontech.com> Link: https://lore.kernel.org/r/20220302081502.25367-1-nizhen@uniontech.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-28ASoC: amd: vangogh: fix uninitialized symbol warning in machine driverVijendar Mukunda1-0/+1
Fixed below smatch static checker warning. sound/soc/amd/vangogh/acp5x-mach.c:190 acp5x_cs35l41_hw_params() error: uninitialized symbol 'ret'. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://lore.kernel.org/r/20220225193054.24916-4-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-28ASoC: amd: vg: remove warnings and errors pointed out by checkpatch plVijendar Mukunda1-2/+1
Fix checkpatch pl errors and warnings in vangogh machine driver. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://lore.kernel.org/r/20220225193054.24916-3-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-28ASoC: amd: vg: update DAI link nameVijendar Mukunda1-1/+1
Update DAI link name as "acp5x-8821-play". Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://lore.kernel.org/r/20220225193054.24916-2-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-24ASoC: amd: vg: apply sample bits pcm constraintVijendar Mukunda1-0/+10
ACP I2S controller has limitation to program different BCLK for TX and RX paths. Headset path uses I2S SP controller instance. As per requirement, Restricted 32 bits as sample bits by applying pcm constraint in startup calabck for Headset path. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://lore.kernel.org/r/20220223071959.13539-5-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-24ASoC: amd: vg: update platform clock control sequenceVijendar Mukunda1-1/+12
Add pre power on widget event. Based on this event update platform clock control sequence. This will fix Codec clock and pll restoration issue during system level resume. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://lore.kernel.org/r/20220223071959.13539-4-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15ASoC: amd: add vangogh machine driverVijendar Mukunda1-0/+386
Add Vangogh machine driver using NAU8821 & CS35L41 Codecs. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://lore.kernel.org/r/20211014071714.836410-2-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>