summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-topology.c
Commit message (Collapse)AuthorAgeFilesLines
* ASoC: soc-topology: convert not to use asoc_xxx()Kuninori Morimoto2023-09-251-3/+3
| | | | | | | | | 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/87h6o0p8t4.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge tag 'asoc-v6.6' of ↵Takashi Iwai2023-08-281-1/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus ASoC: Updates for v6.6 The rest of the updates for v6.6, some of the highlights include: - A big API cleanup from Morimoto-san, rationalising the places we put functions. - Lots of work on the SOF framework, AMD and Intel drivers, including a lot of cleanup and new device support. - Standardisation of the presentation of jacks from drivers. - Provision of some generic sound card DT properties. - Conversion oof more drivers to the maple tree register cache. - New drivers for AMD Van Gogh, AWInic AW88261, Cirrus Logic cs42l43, various Intel platforms, Mediatek MT7986, RealTek RT1017 and StarFive JH7110.
| * ASoC: soc-topology: merge DAI call back functions into opsKuninori Morimoto2023-08-141-1/+5
| | | | | | | | | | | | | | | | | | ALSA SoC merges DAI call backs into .ops. This patch merge these into one. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87il9p9m5a.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | Merge tag 'asoc-v6.6-early' of ↵Takashi Iwai2023-07-251-3/+7
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next ASoC: Updates for v6.6 Here's an initial batch of updates for ASoC for this release cycle. We've got a bunch of new drivers in here, a bit of core work from Morimoto-san and quite a lot of janitorial work. There's several updates that pull in changes from other subsystems in order to build on them: - An adaptor to allow use of IIO DACs and ADCs in ASoC which pulls in some IIO changes. - Create a library function for intlog10() and use it in the NAU8825 driver. - Include the ASoC tests, including the topology tests, in the default KUnit full test coverage. This also involves enabling UML builds of ALSA since that's the default KUnit test environment which pulls in the addition of some stubs to the driver. - More factoring out from Morimoto-san. - Convert a lot of drivers to use the more modern maple tree register cache. - Support for AMD machines with MAX98388 and NAU8821, Cirrus Logic CS35L36, Intel AVS machines with ES8336 and RT5663 and NXP i.MX93.
| * ASoC: topology: suppress probe deferral errorsJohan Hovold2023-07-061-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppress probe deferral error messages when loading topologies and creating frontend links to avoid spamming the logs when a component has not yet been registered: snd-sc8280xp sound: ASoC: adding FE link failed snd-sc8280xp sound: ASoC: topology: could not load header: -517 Note that dev_err_probe() is not used as the topology component can be probed and removed while the underlying platform device remains bound to its driver. Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://lore.kernel.org/r/20230705123018.30903-8-johan+linaro@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
* | ALSA: control: Take controls_rwsem lock in snd_ctl_remove()Takashi Iwai2023-07-201-3/+0
|/ | | | | | | | | | | | | | | | | | | | So far, snd_ctl_remove() requires its caller to take card->controls_rwsem manually before the call for avoiding possible races. However, many callers don't care and miss the locking. Basically it's cumbersome and error-prone to enforce it to each caller. Moreover, card->controls_rwsem is a field that should be used only by internal or proper helpers, and it's not to be touched at random external places. This patch is an attempt to make those calls more consistent: now snd_ctl_remove() takes the card->controls_rwsem internally, just like other API functions for kctls. Since a few callers already take the controls_rwsem locks, the patch removes those locks at the same time, too. Link: https://lore.kernel.org/r/20230718141304.1032-5-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ASoC: topology: Allow partial matching when finding DAI linkRanjani Sridharan2023-05-301-3/+3
| | | | | | | | | | | | | This allows for setting shorter link names in topology. For example, for the HDA Analog DAI link, just "Analog" would suffice instead of "Analog Playback and Capture" Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230526204149.456068-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Remove redundant logAmadeusz Sławiński2023-05-221-4/+1
| | | | | | | | | | soc_tplg_valid_header() logs all the failures in detail already. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20230519195611.4068853-6-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Remove redundant logAmadeusz Sławiński2023-05-221-3/+0
| | | | | | | | | | soc_tplg_dapm_complete() logs all the failures in detail already. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20230519195611.4068853-5-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Do not split message string on multiple linesAmadeusz Sławiński2023-05-221-4/+2
| | | | | | | | | | | | Kernel coding guidelines recommend to not split string unnecessarily. While at it adapt the other print present in the function to 100 characters line limit. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20230519195611.4068853-4-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Remove redundant logsAmadeusz Sławiński2023-05-221-9/+3
| | | | | | | | | | soc_tplg_add_kcontrol() logs all the failures in detail already. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20230519195611.4068853-3-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Log control load errors in soc_tplg_control_load()Amadeusz Sławiński2023-05-221-24/+13
| | | | | | | | | | | Simplify code by logging any errors in function that does the actual work instead of doing so in its callers. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20230519195611.4068853-2-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: soc-topology.c: add comment for Platform/CodecKuninori Morimoto2023-05-081-11/+11
| | | | | | | | | Not only Platform but Codec also might be overwritten on Topology. This patch adds comment about it not to use asoc_dummy_dlc here. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/87sfcqyphq.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org
* ASoC: soc-topology.c: dai_link->platform againKuninori Morimoto2023-03-291-2/+10
| | | | | | | | | | | | | | | On SOF, many topology is assuming dai_link->platform exists, and is allowed to be overwritten on each link_load(). This patch restore the removed dai_link->platform for SOF, and add the comment. Fixes: e7098ba9b378 ("ASoC: soc-topology.c: remove unnecessary dai_link->platform") Reported-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/87jzz7jczp.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/87v8ikcsr5.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: soc-core.c: add snd_soc_add_pcm_runtimes()Kuninori Morimoto2023-03-281-1/+1
| | | | | | | | | | | Current ASoC supports snd_soc_add_pcm_runtime(), but user need to call it one-by-one if it has multi dai_links. This patch adds snd_soc_add_pcm_runtimes() which supports multi dai_links. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87h6u76nhq.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: soc-topology.c: remove unnecessary dai_link->platformKuninori Morimoto2023-03-241-6/+2
| | | | | | | | | dai_link->platform is no longer needed if CPU and Platform are same Component. This patch removes unnecessary dai_link->platform. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87jzz7jczp.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge tag 'asoc-v6.3' of ↵Takashi Iwai2023-02-161-112/+75
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next ASoC: Updates for v6.3 There's been quite a lot of activity this release, but not really one big feature - lots of new devices, plus a lot of cleanup and modernisation work spread throughout the subsystem: - More factoring out of common operations into helper functions by Morimoto-san. - DT schema conversons and stylistic nits. - Continued work on building out the new SOF IPC4 scheme. - Support for Awinc AT88395, Infineon PEB2466, Iron Device SMA1303, Mediatek MT8188, Realtek RT712, Renesas IDT821034, Samsung/Tesla FSD SoC I2S, and TI TAS5720A-Q1.
| * ASoC: topology: Set correct unload callback for graph typePeter Ujfalusi2023-02-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Using the control_unload for graph type of elem will lead surprises on module unload. The correct callback to use is the dapm_route_unload. Fixes: 31e9273912bf ("ASoC: topology: Use unload() op directly") Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230201112846.27707-3-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: soc-topology.c: use helper functionKuninori Morimoto2023-01-311-2/+2
| | | | | | | | | | | | | | | | | | Current ASoC has many helper function. This patch use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87edrbea20.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: topology: Use unload() op directlyAmadeusz Sławiński2023-01-301-20/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | struct snd_soc_dobj only needs pointer to the unload function, instead however, there is pointer to all topology operations. Change code to use the function pointer instead of pointer to structure containing all operations. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230127231111.937721-12-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: topology: Unify kcontrol removal codeAmadeusz Sławiński2023-01-301-42/+6
| | | | | | | | | | | | | | | | | | | | | | Functions removing bytes, enum and mixer kcontrols are identical. Unify them under one function and use it to free associated kcontrols. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230127231111.937721-11-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: topology: Remove unnecessary check for EOFAmadeusz Sławiński2023-01-301-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Caller already checks if hdr_pos is behind EOF, before calling soc_tplg_valid_header(), so there is no need to recheck it again. This also allows to remove behaviour of return 0 - forcing the caller to break out of while loop. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230127231111.937721-10-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: topology: Return an error on complete() failureAmadeusz Sławiński2023-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | Function soc_tplg_dapm_complete() detects an error and logs it, but doesn't return failure to the caller, fix it by returning the error. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230127231111.937721-9-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: topology: Pass correct pointer instead of castingAmadeusz Sławiński2023-01-301-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of passing address of structure, the containing structure is cast to target structure. While it works - the expected structure is the first field of containing one - it is bad practice, fix this by passing pointer to structure field. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230127231111.937721-8-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: topology: Remove unnecessary forward declarationsAmadeusz Sławiński2023-01-301-3/+0
| | | | | | | | | | | | | | | | | | | | | | There is no need to forward declare functions if their use is after their definition. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230127231111.937721-7-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: topology: Rename remove_ handlersAmadeusz Sławiński2023-01-301-16/+16
| | | | | | | | | | | | | | | | | | | | | | Those are the only functions missing soc_tplg_ prefix, add it for consistency. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230127231111.937721-6-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: topology: Fix function nameAmadeusz Sławiński2023-01-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | Functions other than soc_valid_header have soc_tplg_ prefix. Rename function to follow convention in file. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230127231111.937721-5-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: topology: Fix typo in functions nameAmadeusz Sławiński2023-01-301-16/+16
| | | | | | | | | | | | | | | | | | | | | | Topology is being abbreviated to "tplg", not "tplc", however, few functions have typo in name, fix it. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230127231111.937721-4-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: topology: Remove unused SOC_TPLG_PASS_PINS constantAmadeusz Sławiński2023-01-301-3/+2
| | | | | | | | | | | | | | | | | | | | The constant is unused, so it can be safely removed. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230127231111.937721-3-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: topology: Properly access value coming from topology fileAmadeusz Sławiński2023-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | When accessing values coming from topology, le32_to_cpu should be used. One of recent commits missed that. Fixes: 86e2d14b6d1a ("ASoC: topology: Add header payload_size verification") Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230127231111.937721-2-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: topology: Return -ENOMEM on memory allocation failureAmadeusz Sławiński2023-02-071-2/+6
|/ | | | | | | | | | | | When handling error path, ret needs to be set to correct value. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Fixes: d29d41e28eea ("ASoC: topology: Add support for multiple kcontrol types to a widget") Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230207210428.2076354-1-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: soc-core.c: setup rtd->pmdown_time at soc_new_pcm_runtime()Kuninori Morimoto2022-09-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Almost all default rtd->xxx are setup at soc_new_pcm_runtime() which is sub-function of snd_soc_add_pcm_runtime() (A). But "rtd->pmdown_time" is setup at soc_init_pcm_runtime() (B). It is very random timing setup. This patch setup it at (A), same as other rtd->xxx. static int snd_soc_bind_card(...) { ... for_each_card_prelinks(...) { (A) ret = snd_soc_add_pcm_runtime(...); ... } ... for_each_card_rtds(...) { (B) ret = soc_init_pcm_runtime(...); ... } ... } One note is that current topology/intel are directly calling snd_soc_add_pcm_runtime() (A) without calling soc_init_pcm_runtime() (B). This means, its "rtd->pmdown_time settings" was 0, but will have default value by this patch. "rtd->pmdown_time settings" will be used at snd_soc_runtime_ignore_pmdown_time(). This patch adds "ignore_pmdown_time" to these driver to keep compatibility. bool snd_soc_runtime_ignore_pmdown_time(...) { ... => if (!rtd->pmdown_time || rtd->dai_link->ignore_pmdown_time) return true; ... } Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/875yhxmjjd.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Drop superfluous check of CONFIG_SND_CTL_VALIDATIONTakashi Iwai2022-06-151-1/+1
| | | | | | | | | The compiler must be clever enough to optimize out for the no-op when CONFIG_SND_CTL_VALIDATION is disabled. Let's drop the superfluous check. Link: https://lore.kernel.org/r/20220609120219.3937-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ASoC: Pull in fixesMark Brown2022-04-051-2/+2
|\ | | | | | | | | | | | | cs35l41 is getting some active work and conflicts, plus some of the fixes are needed for my testing. Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: topology: Correct error handling in soc_tplg_dapm_widget_create()Peter Ujfalusi2022-04-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Academic correction of error handling: In case the allocation of kc or kcontrol_type fails the correct label to jump is hdr_err since the template.sname has been also allocated at this point. Fixes: d29d41e28eea6 ("ASoC: topology: Add support for multiple kcontrol types to a widget") Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220331114957.519-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: topology: Rename soc_tplg_init_kcontrol() functionAmadeusz Sławiński2022-04-041-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | Other functions used for callbacks are named after function they call, however function calling control_load seems to be an exception. Rename it to soc_tplg_control_load(). Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20220401120200.4047867-7-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: topology: Correct error messageAmadeusz Sławiński2022-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | Error message refers to mixer, but it is used for various other types of controls, so change it to refer to generic "controls". Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20220401120200.4047867-6-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: topology: Rename SOC_TPLG_PASS_MIXER to _CONTROLAmadeusz Sławiński2022-04-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Name of SOC_TPLG_PASS_MIXER pass is bit confusing, suggesting that it may only apply to mixers. As it is used for all control types, change name to SOC_TPLG_PASS_CONTROL. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20220401120200.4047867-5-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: topology: Return bool instead of intAmadeusz Sławiński2022-04-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | In practice soc_tplg_is_eof() returns boolean value and caller uses the return value in such way, so convert the function to really do it. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20220401120200.4047867-4-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: topology: Remove unnecessary loopingAmadeusz Sławiński2022-04-041-223/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Functions creating kcontrols as written allow for creation of multiple kcontrols at the same time, but in practice they are called for each kcontrol individually. Remove unnecessary loop as code always loops once anyway. This reduces intendation level allowing for some code to be put on one line instead of multiple lines. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20220401120200.4047867-3-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: topology: Use for loop instead of whileAmadeusz Sławiński2022-04-041-8/+3
|/ | | | | | | | | | | | The 'while' loop can be replaced with a 'for' loop, making it more clear about what possible values there are, by having all of it in one place, instead of scattered around. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20220401120200.4047867-2-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Optimize soc_tplg_dapm_graph_elems_load behaviorAmadeusz Sławiński2022-01-241-42/+14
| | | | | | | | | | | | | | | | | | Before commit "ASoC: topology: Change allocations to resource managed" soc_tplg_dapm_graph_elems_load() used to free routes on error. During migration to managed allocations the routes table was left as is, but looking at it again it is unnecessary, so remove routes table and just keep pointer to DAPM route currently being set up. Also remove outdated comments which keep describing old behavior of remove_route() freeing memory. While it still does some cleanup, it leaves freeing memory to framework. Fixes: ff9226224437 ("ASoC: topology: Change allocations to resource managed") Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220112170030.569712-4-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Allow TLV control to be either read or writeAmadeusz Sławiński2022-01-241-1/+2
| | | | | | | | | | | | | | | | | There is no reason to force readwrite access on TLV controls. It can be either read, write or both. This is further evidenced in code where it performs following checks: if ((k->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) && !sbe->get) return -EINVAL; if ((k->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) && !sbe->put) return -EINVAL; Fixes: 1a3232d2f61d ("ASoC: topology: Add support for TLV bytes controls") Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220112170030.569712-3-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Remove superfluous error printsAmadeusz Sławiński2022-01-241-33/+11
| | | | | | | | | | | | | | soc_tplg_check_elem_count(), already prints an error when applicable, so there is no need to print another one. Also clean up alignment of arguments in if, so there is no confusion about what is checked and what is executed if condition is true. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220112170030.569712-2-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Fix typoQinghua Jin2022-01-061-1/+1
| | | | | | | | change 'postion' to 'position' Signed-off-by: Qinghua Jin <qhjin.dev@gmail.com> Link: https://lore.kernel.org/r/20220106092847.357035-1-qhjin.dev@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Add missing rwsem around snd_ctl_remove() callsTakashi Iwai2021-11-161-0/+3
| | | | | | | | | | | snd_ctl_remove() has to be called with card->controls_rwsem held (when called after the card instantiation). This patch add the missing rwsem calls around it. Fixes: 8a9782346dcc ("ASoC: topology: Add topology core") Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20211116071812.18109-1-tiwai@suse.de Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Change topology device to card deviceAmadeusz Sławiński2021-10-291-3/+3
| | | | | | | | | | | | | | | | | | | Topology needs device for prints and resource allocation. So far, component->dev is used. However, this may lead to high memory use in model where card is an independent driver which can be reloaded and topology is loaded from component's probe() method. Every time machine driver is reloaded topology is being loaded anew, each time allocating new memory. Said memory will only be freed when component itself is being freed. Address the problem by tying topology to component->card->dev instead, so memory occupied by the topology is freed whenever related machine device gets removed. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20211015161257.27052-6-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Use correct device for printsAmadeusz Sławiński2021-10-291-1/+1
| | | | | | | | | | soc_tplg_add_dcontrol() passes device as argument which is later used to print messages. Align it with all other prints in file to use tplg->dev. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20211015161257.27052-5-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Check for dapm widget completenessAmadeusz Sławiński2021-10-291-0/+17
| | | | | | | | | | Add sanity checks to make sure the data is read within file boundary. Helps in situations where file is only partially copied or malformed. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20211015161257.27052-4-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: topology: Add header payload_size verificationCezary Rojewski2021-10-291-0/+9
| | | | | | | | | Add sanity check to make sure the data is read within file boundary. Helps in situations where file is only partially copied or malformed. Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20211015161257.27052-3-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>