summaryrefslogtreecommitdiff
path: root/sound/soc/soc-topology.c
AgeCommit message (Collapse)AuthorFilesLines
2023-02-16Merge tag 'asoc-v6.3' of ↵Takashi Iwai1-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.
2023-02-07ASoC: topology: Return -ENOMEM on memory allocation failureAmadeusz Sławiński1-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>
2023-02-02ASoC: topology: Set correct unload callback for graph typePeter Ujfalusi1-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>
2023-01-31ASoC: soc-topology.c: use helper functionKuninori Morimoto1-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>
2023-01-30ASoC: topology: Use unload() op directlyAmadeusz Sławiński1-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>
2023-01-30ASoC: topology: Unify kcontrol removal codeAmadeusz Sławiński1-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>
2023-01-30ASoC: topology: Remove unnecessary check for EOFAmadeusz Sławiński1-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>
2023-01-30ASoC: topology: Return an error on complete() failureAmadeusz Sławiński1-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>
2023-01-30ASoC: topology: Pass correct pointer instead of castingAmadeusz Sławiński1-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>
2023-01-30ASoC: topology: Remove unnecessary forward declarationsAmadeusz Sławiński1-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>
2023-01-30ASoC: topology: Rename remove_ handlersAmadeusz Sławiński1-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>
2023-01-30ASoC: topology: Fix function nameAmadeusz Sławiński1-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>
2023-01-30ASoC: topology: Fix typo in functions nameAmadeusz Sławiński1-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>
2023-01-30ASoC: topology: Remove unused SOC_TPLG_PASS_PINS constantAmadeusz Sławiński1-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>
2023-01-30ASoC: topology: Properly access value coming from topology fileAmadeusz Sławiński1-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>
2022-09-19ASoC: soc-core.c: setup rtd->pmdown_time at soc_new_pcm_runtime()Kuninori Morimoto1-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>
2022-06-15ASoC: topology: Drop superfluous check of CONFIG_SND_CTL_VALIDATIONTakashi Iwai1-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>
2022-04-05ASoC: Pull in fixesMark Brown1-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>
2022-04-04ASoC: topology: Correct error handling in soc_tplg_dapm_widget_create()Peter Ujfalusi1-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>
2022-04-04ASoC: topology: Rename soc_tplg_init_kcontrol() functionAmadeusz Sławiński1-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>
2022-04-04ASoC: topology: Correct error messageAmadeusz Sławiński1-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>
2022-04-04ASoC: topology: Rename SOC_TPLG_PASS_MIXER to _CONTROLAmadeusz Sławiński1-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>
2022-04-04ASoC: topology: Return bool instead of intAmadeusz Sławiński1-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>
2022-04-04ASoC: topology: Remove unnecessary loopingAmadeusz Sławiński1-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>
2022-04-04ASoC: topology: Use for loop instead of whileAmadeusz Sławiński1-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>
2022-01-24ASoC: topology: Optimize soc_tplg_dapm_graph_elems_load behaviorAmadeusz Sławiński1-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>
2022-01-24ASoC: topology: Allow TLV control to be either read or writeAmadeusz Sławiński1-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>
2022-01-24ASoC: topology: Remove superfluous error printsAmadeusz Sławiński1-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>
2022-01-06ASoC: topology: Fix typoQinghua Jin1-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>
2021-11-16ASoC: topology: Add missing rwsem around snd_ctl_remove() callsTakashi Iwai1-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>
2021-10-29ASoC: topology: Change topology device to card deviceAmadeusz Sławiński1-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>
2021-10-29ASoC: topology: Use correct device for printsAmadeusz Sławiński1-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>
2021-10-29ASoC: topology: Check for dapm widget completenessAmadeusz Sławiński1-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>
2021-10-29ASoC: topology: Add header payload_size verificationCezary Rojewski1-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>
2021-10-27ASoC: topology: handle endianness warningPierre-Louis Bossart1-1/+1
Sparse reports the following warning: sound/soc/soc-topology.c:1488:26: error: restricted __le32 degrades to integer Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20211025185933.144327-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-01ASoC: topology: change the complete op in snd_soc_tplg_ops to return intRanjani Sridharan1-4/+6
In the SOF driver, the operations performed in the complete callback can fail and therefore topology loading should return an error in such cases. So, change the signature of the complete op in struct snd_soc_tplg_ops to return an int to return the error. Also, amend the complete callback functions in the SOF driver and the SKL driver to conform with the new signature. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20210927120517.20505-2-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-13ASoC: soc-topology: Move template info print soc_tplg_dapm_widget_create()Peter Ujfalusi1-4/+2
A DAPM widget now can have different types of controls, it is no longer correct to print the type as it is just the type of the first control. Move it after the loop where we create the controls and print the number of the control types. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Link: https://lore.kernel.org/r/20210902112301.22657-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-02ASoC: soc-topology: cleanup cppcheck warning at snd_soc_find_dai_link()Kuninori Morimoto1-2/+1
This patch cleanups below cppcheck warning. sound/soc/soc-topology.c:2129:27: style: The scope of the variable 'link' can be reduced. [variableScope] struct snd_soc_dai_link *link; ^ Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87mtq0wfkn.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-02ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_kcontrol_elems_load()Kuninori Morimoto1-3/+1
This patch cleanups below cppcheck warning. sound/soc/soc-topology.c:1038:31: style: The scope of the variable 'control_hdr' can be reduced. [variableScope] struct snd_soc_tplg_ctl_hdr *control_hdr; ^ Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87o8agwfkv.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-02ASoC: soc-topology: cleanup cppcheck warning at ↵Kuninori Morimoto1-3/+4
soc_tplg_dapm_widget_elems_load() This patch cleanups below cppcheck warning. sound/soc/soc-topology.c:1599:35: style: The scope of the variable 'widget' can be reduced. [variableScope] struct snd_soc_tplg_dapm_widget *widget; ^ sound/soc/soc-topology.c:1600:6: style: The scope of the variable 'ret' can be reduced. [variableScope] int ret, count, i; ^ Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87pmuwwfl7.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-02ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_dai_elems_load()Kuninori Morimoto1-3/+4
This patch cleanups below cppcheck warning. sound/soc/soc-topology.c:2350:27: style: The scope of the variable 'dai' can be reduced. [variableScope] struct snd_soc_tplg_dai *dai; ^ sound/soc/soc-topology.c:2352:9: style: The scope of the variable 'ret' can be reduced. [variableScope] int i, ret; ^ Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87r1fcwflh.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-02ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_process_headers()Kuninori Morimoto1-1/+1
This patch cleanups below cppcheck warning. sound/soc/soc-topology.c:2576:27: style: The scope of the variable 'hdr' can be reduced. [variableScope] struct snd_soc_tplg_hdr *hdr; ^ Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87sfzswflw.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-23Merge series "ASoC: tlv320aic32x4: Add support for TAS2505" from Claudius ↵Mark Brown1-3/+3
Heine <ch@denx.de>: Hi, this is v2 from my patchset that add support for the TAS2505 to the tlv320aic32x4 driver. kind regards, Claudius Changes from v1: - clarified commit message of first patch, which add the type value to the struct - removed unnecessary code to put and get speaker volume - removed 'Gain' from 'HP Driver Playback Volume' control - fixed rebase issues Claudius Heine (3): ASoC: tlv320aic32x4: add type to device private data struct ASoC: tlv320aic32x4: add support for TAS2505 ASoC: tlv320aic32x4: dt-bindings: add TAS2505 to compatible .../bindings/sound/tlv320aic32x4.txt | 1 + sound/soc/codecs/tlv320aic32x4-i2c.c | 22 ++- sound/soc/codecs/tlv320aic32x4-spi.c | 23 ++- sound/soc/codecs/tlv320aic32x4.c | 139 +++++++++++++++++- sound/soc/codecs/tlv320aic32x4.h | 10 ++ 5 files changed, 186 insertions(+), 9 deletions(-) base-commit: 70585216fe7730d9fb5453d3e2804e149d0fe201 -- 2.32.0
2021-06-01ASoC: topology: Fix spelling mistake "vesion" -> "version"Colin Ian King1-3/+3
There are spelling mistakes in comments. Fix them. Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20210601103506.9477-1-colin.king@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-20ASoC: topology: Fix using uninitialized pointerJaska Uimonen1-1/+1
The original patch changed kcontrol_type to a pointer. In some goto cases the pointer is assigned into a struct member as uninitialized and this will cause a runtime error with UBSan even if it isn't a real bug. So initialize the pointer to NULL. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes: d29d41e28eea ("ASoC: topology: Add support for multiple kcontrol types to a widget") Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20210519100713.879958-1-jaska.uimonen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-14ASoC: topology: Add support for multiple kcontrol types to a widgetJaska Uimonen1-243/+223
Current dapm widget has a single variable to describe its kcontrol's type. As there can be many kcontrols in one widget it is inherently presumed that the types are the same. Lately there has been use cases where different types of kcontrols would be needed for a single widget. Thus add pointer to dapm widget to hold an array for different kcontrol types and modify the kcontrol creation to operate in a loop based on individual kcontrol type. Change control creation and deletion to use individual kcontrol types in SOF driver. This is done in the same patch for not breaking bisect. SOF driver is also currently the only one using the dapm widget kcontrol_type. Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20210507070246.404446-1-jaska.uimonen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: soc-topology: clarify expressionPierre-Louis Bossart1-8/+8
cppcheck warning: sound/soc/soc-topology.c:1676:52: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation] flags & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES ? 1 : 0; ^ sound/soc/soc-topology.c:1680:55: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation] flags & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS ? ^ sound/soc/soc-topology.c:1685:57: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation] flags & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS ? ^ sound/soc/soc-topology.c:1768:52: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation] flags & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES ? 1 : 0; ^ sound/soc/soc-topology.c:1772:55: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation] flags & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS ? ^ sound/soc/soc-topology.c:1777:57: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation] flags & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS ? ^ sound/soc/soc-topology.c:1782:48: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation] flags & SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP ? ^ Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20210218221921.88991-6-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-05Merge branch 'asoc-5.11' into asoc-5.12Mark Brown1-5/+6
2021-01-21Merge series "Add sanity checks for topology API calls" from Amadeusz ↵Mark Brown1-7/+15
Sławiński<amadeuszx.slawinski@linux.intel.com>: Topology API exposes just 2 function calls, to load and unload topology. This adds sanity checks to make sure that it behaves well when some of parameters are set incoorectly or not needed. This makes developer live easier by failing early instead of proceeding on and then failing in unexpected ways. As loading and unloading topology usually happens one the overhead of additional checks should be negligible. Amadeusz Sławiński (2): ASoC: topology: Ensure that needed parameters are set ASoC: topology: Check if ops is set before dereference sound/soc/soc-topology.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) -- 2.25.1
2021-01-21ASoC: sync parameter naming : rate / sample_bitsKuninori Morimoto1-4/+4
snd_pcm_runtime / snd_soc_dai / snd_soc_dai_driver / snd_soc_dai_link have related parameter which is similar but not same naming. struct snd_pcm_runtime { ... (A) unsigned int rate; ... (B) unsigned int sample_bits; ... }; struct snd_soc_dai { ... (A) unsigned int rate; (B) unsigned int sample_bits; ... }; struct snd_soc_dai_driver { ... (A) unsigned int symmetric_rates:1; (B) unsigned int symmetric_samplebits:1; ... }; struct snd_soc_dai_link { ... (A) unsigned int symmetric_rates:1; (B) unsigned int symmetric_samplebits:1; ... }; Because it is similar but not same naming rule, code can be verbose / can't share macro. This patch sync naming rule for framework. - xxx_rates; + xxx_rate; - xxx_samplebits; + xxx_sample_bits; old name will be removed if all drivers were switched to new naming rule. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87wnweolj6.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>