summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
AgeCommit message (Collapse)Author
2014-06-21ASoC: Add component level stream_event() and seq_notifier() supportLars-Peter Clausen
This patch adds stream_event() and seq_notifier() callbacks similar to those found in the snd_soc_codec_driver and snd_soc_platform driver struct to the snd_soc_component_driver struct. This is meant to unify the handling of these callbacks across different types of components and will eventually allow their removal from the CODEC and platfrom driver structs. The new callbacks are slightly different from the old ones in that they take a snd_soc_component as a parameter rather than a snd_soc_dapm_context. This was done since otherwise casting from the DAPM context to the component would typically be the first thing to do in the callback. And the interface becomes slightly cleaner by passing a snd_soc_component to all callbacks in the snd_soc_component_driver struct. The patch also already removes the stream_event() callback from the snd_soc_codec_driver and snd_soc_platform_driver structs as it is currently unused. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21ASoC: Use component DAPM context for platformsLars-Peter Clausen
The snd_soc_platform dapm field is not accessed outside of the ASoC core. Switch it over to using the snd_soc_component DAPM context. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21ASoC: Add DAPM support at the component levelLars-Peter Clausen
This patch adds full DAPM support at the component level. Previously there was only full DAPM support for CODECs and partial DAPM support (e.g. no Mixers nor MUXs) for platforms. Having DAPM support at the component level will allow all types of components to use DAPM and also help in consolidating the DAPM support between CODECs and platforms. Since the DAPM context is directly embedded into the snd_soc_codec and snd_soc_platform struct and the 'dapm' field is directly referenced in a lot of drivers moving the field just right now is not possible without causing code churn. The approach this patch takes is to add two new fields to the component struct. One field which is the pointer to the actual DAPM context used by the component and one DAPM context that will be used as the default if no other context was specified. For CODECs and platforms the pointer is initialized to point to the CODEC or platform DAPM context. All generic code when referencing a component's DAPM struct will go via the pointer. This will make it possible to eventually seamlessly move the DAPM context from snd_soc_codec and snd_soc_platform struct over once all direct references have been eliminated. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21ASoC: Add a set_bias_level() callback to the DAPM context structLars-Peter Clausen
Currently the DAPM code directly looks at the CODEC driver struct to get a handle to the set_bias_level() callback. This patch adds a new set_bias_level() callback to the DAPM context struct. The DAPM code will use this new callback instead of the CODEC callback. For CODECs the new callback is set up to call the CODEC specific set_bias_level callback(). Not looking directly at the CODEC driver struct will allow non CODEC DAPM contexts to implement a set_bias_level() callback. This is also similar to how the seq_notifier() and stream_event() callbacks are currently handled. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21ASoC: Auto disconnect pins from all DAPM contextsLars-Peter Clausen
Currently only pins in CODEC DAPM contexts are automatically marked as non-connected if the card has the fully_routed flag set. This makes sense since widgets which qualify for auto-disconnection are only found in CODEC DAPM contexts. But with componentisation this is going to change, so consider all widgets for auto-disconnection. Also it is probably faster to walk the widgets list only once rather than once for each CODEC. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21ASoC: Split component registration into two stepsLars-Peter Clausen
Split snd_soc_component_register() into snd_soc_component_initialize() and snd_soc_component_add(). Using a 2-stage registration approach has the advantage that it is possible to modify the component after it has been initialized, but before it is made visible to the system. This e.g. allows CODECs or platforms to overwrite some of the default settings made in snd_soc_component_initialize(). Similar snd_soc_component_unregister() is split into two steps as well, snd_soc_component_delete(), which removes the component from the system, and snd_soc_component_cleanup(), which frees all the resources allocated by the component. Furthermore this patch makes sure that if a component is visible on two list (e.g. the component list and the CODEC list) it is added or removed to both lists atomically. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21ASoC: Move name and id from CODEC/platform to componentLars-Peter Clausen
The component struct already has a name and id field which are initialized to the same values as the same fields in the CODEC and platform structs. So remove them from the CODEC and platform structs and used the ones from the component struct instead. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21ASoC: Move name_prefix from CODEC to componentLars-Peter Clausen
Move the name_prefix from the CODEC struct to the component struct. This will eventually allow to specify prefixes for all types of components. It is also necessary to make the DAPM code component type independent (i.e. a DAPM context does not need to know whether it belongs to a CODEC or a platform or something else). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-22Merge remote-tracking branches 'asoc/topic/rt5651', 'asoc/topic/samsung', ↵Mark Brown
'asoc/topic/sgtl5000', 'asoc/topic/sh', 'asoc/topic/simple', 'asoc/topic/sirf', 'asoc/topic/sta350' and 'asoc/topic/tlv320dac33' into asoc-next
2014-05-22Merge remote-tracking branches 'asoc/topic/headers', 'asoc/topic/intel', ↵Mark Brown
'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/mc13783' and 'asoc/topic/multicodec' into asoc-next
2014-05-22Merge remote-tracking branch 'asoc/topic/dt' into asoc-nextMark Brown
2014-05-07ASoC: Remove unused num_dai field from CODECLars-Peter Clausen
Commit d191bd8de8 ("ASoC: snd_soc_codec includes snd_soc_component") removed the last user of the num_dai field. Also remove the field itself. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-07ASoC: Remove unused 'list' field form cardLars-Peter Clausen
The global card list was removed in commit b19e6e7b7 ("ASoC: core: Use driver core probe deferral"). The 'list' field of the snd_soc_card struct has been unused since then. This patch removes the field. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-07ASoC: Remove card's DAI listLars-Peter Clausen
Commit f0fba2ad1 ("ASoC: multi-component - ASoC Multi-Component Support") added a per card list that keeps track of all the DAIs that have been registered with the card, but the list has never been used. This patch removes it again. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-07Merge branch 'topic/component' of ↵Mark Brown
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-core
2014-05-05ASoC: Make soc_find_matching_codec() staticLars-Peter Clausen
The function is only used locally, make it static. Fixes the following warning from sparse: sound/soc/soc-core.c:1644:22: warning: symbol 'soc_find_matching_codec' was not declared. Should it be static? Fixes: 3ca041ed ("ASoC: dt: Allow Aux Codecs to be specified using DT") Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-By: Sebastian Reichel <sre@kernel.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-02ASoC: add SND_SOC_BYTES_EXTVinod Koul
we need _EXT version for SND_SOC_BYTES so that DSPs can use this to pass data for DSP modules Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-01ASoC: dt: Allow Aux Codecs to be specified using DTSebastian Reichel
This patch adds support for specifying auxiliary codecs and codec configuration via device tree phandles. This change adds new fields to snd_soc_aux_dev and snd_soc_codec_conf and adds support for the changes to SoC core methods. Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-29ASoC: core: Fix component_list corruption when unloading modulesJarkko Nikula
This fixes module unload regressions introduced by commits 98e639fb8a3e ("ASoC: Track which components have been registered with snd_soc_register_component()") and b37f1d123c69 ("ASoC: Let snd_soc_platform subclass snd_soc_component"). First commit causes component_list to be corrupted when removing codec and second when removing platform. Reason for both is that components associated with platform or codec are never removed from the list because for them registered_as_component field in struct snd_soc_component is always false. Now list becomes corrupted when snd_soc_unregister_platform() or snd_soc_unregister_codec() frees the platform or codec structure and where the associated struct snd_soc_component is embedded. Fix these by moving component unregistration and cleanup to a new local function __snd_soc_unregister_component() that takes component as its argument. Since component is known for platforms and codecs the __snd_soc_unregister_component() can be called directly and snd_soc_unregister_component() takes care to find and unregister only components that were registered using snd_soc_register_component(). Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-26ASoC: Remove name_prefix unset during DAI link init hack againLars-Peter Clausen
This was initially removed in commit 6479f15ad ("ASoC: Remove name_prefix unset during DAI link init hack"), but was brought back in commit 503ae5e0 ("ASoC: core: Add helpers for dai link and aux dev init") by accident. This patch removes it again. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-24ASoC: core: Add helpers for dai link and aux dev initMisael Lopez Cruz
Separate DAI link and aux dev initialization in preparation for DAI multicodec support. Since aux dev will remain using single codecs but DAI links will be able to support multiple codecs. No functional change. Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com> [fparent@baylibre.com: Adapt to 3.14+] Signed-off-by: Fabien Parent <fparent@baylibre.com> Signed-off-by: Benoit Cousson <bcousson@baylibre.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-23ASoC: core: Don't break component searching if both id and num_dai are 0Nicolin Chen
The commit e41975ed (ASoC: core: Fix the DAI name getting) added a break within the "if (id < 0 || id >= pos->num_dai)" while the original design of the search didn't break the loop if that condition contented but only mark the ret error and let it go on to search the next component. In a case like dmaengine which's not a dai but as a component sharing an identical name with a dai, both the id and pos->num_dai here could be 0. If we break the search, we may never find the dai we want as it might be placed behind its dmaengine in the component list. So this patch fixes the issue above by following the original design to let the search carry on. Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-23ASoC: core: Update snd_soc_of_parse_daifmt() interfaceJyri Sarha
Adds struct device_node **bitclkmaster and struct device_node **framemaster function parameters. With the new syntax bitclock-master and frame-master properties can explicitly indicate the dai-link bit-clock and frame masters with a phandle. This patch also makes the minimal changes to simple-card for it to work with the updated snd_soc_of_parse_daifmt(). Simple-card appears to be the only user of snd_soc_of_parse_daifmt() for now. Signed-off-by: Jyri Sarha <jsarha@ti.com> Acked-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-22ASoC: Move standard kcontrol helpers to the component levelLars-Peter Clausen
After moving the IO layer inside ASoC to the component level we can now easily move the standard control helpers also to the component level. This allows to reuse the same standard helper control implementations for other components. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-22Merge branch 'topic/multicodec' of ↵Mark Brown
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-component
2014-04-22ASoC: Move IO abstraction to the component levelLars-Peter Clausen
We currently have two very similar IO abstractions in ASoC, one for CODECs, the other for platforms. Moving this to the component level will allow us to unify those two. It will also enable us to move the standard kcontrol helpers as well as DAPM support to the component level. The new component level abstraction layer is primarily build around regmap. There is a per component pointer for the regmap instance for the underlying device. There are four new function snd_soc_component_read(), snd_soc_component_write(), snd_soc_component_update_bits() and snd_soc_component_update_bits_async(). They have the same signature as their regmap counter-part and will internally forward the call one-to-one to regmap. If the component it not using regmap it will fallback to using the custom IO callbacks. This is done to be able to support drivers that haven't been converted to regmap yet, but it is expected that this will eventually be removed in the future once all component drivers have been converted to regmap. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-22Merge branches 'topic/sta350', 'topic/core', 'topic/dapm' and 'topic/cache' ↵Mark Brown
of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-component
2014-04-18ASoC: core: use PTR_ERR instead of PTR_RETChristoph Jaeger
PTR_RET is deprecated. PTR_ERR_OR_ZERO should be used instead. However, we already know that IS_ERR is true, and thus PTR_ERR_OR_ZERO would never yield zero, so we can use PTR_ERR here. Signed-off-by: Christoph Jaeger <christophjaeger@linux.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14ASoC: core: Add function for ac97 codec registrationMisael Lopez Cruz
Add codec registration specific function in preparation for DAI-multicodec support. No functional change. Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com> [fparent@baylibre.com: Adapt to 3.14+] Signed-off-by: Fabien Parent <fparent@baylibre.com> Signed-off-by: Benoit Cousson <bcousson@baylibre.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14ASoC: core: Add helper for DAI widgets linkingMisael Lopez Cruz
Add a helper for DAI widgets linking in preparation for DAI-multicodec support. No functional change. Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com> [fparent@baylibre.com: Adapt to 3.14+] Signed-off-by: Fabien Parent <fparent@baylibre.com> Signed-off-by: Benoit Cousson <bcousson@baylibre.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14ASoC: core: Add helpers for codec DAI probe & removeMisael Lopez Cruz
Add helper functions for codec DAI probe and remove in preparation for DAI-multicodec support. No functional change. Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com> [fparent@baylibre.com: Adapt to 3.14+] Signed-off-by: Fabien Parent <fparent@baylibre.com> Signed-off-by: Benoit Cousson <bcousson@baylibre.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14ASoC: core: Add helpers for codec and codec_dai searchMisael Lopez Cruz
Add dedicated helpers for codec and codec_dai search in preparation for DAI-multicodec. It will help reducing the extra indentation that will be introduced by the iteration over multiple codecs. Previous implementation unnecessarily kept searching for a matching codec in the remaining register codecs even if it was already found. Fix that by returning in case of matching. Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com> [fparent@baylibre.com: Adapt to 3.14+] Signed-off-by: Fabien Parent <fparent@baylibre.com> Signed-off-by: Benoit Cousson <bcousson@baylibre.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14Merge branch 'topic/component' of ↵Mark Brown
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-core Conflicts: sound/soc/soc-core.c
2014-04-14ASoC: core: Allow snd_soc_update_bits use 32 bits registerBard Liao
Change reg's type from unsigned short to unsigned int. So that we can use 32 bits reg value in snd_soc_update_bits. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14ASoC: core: Fail codec probe if we fail to add controlsNariman Poushin
Signed-off-by: Nariman Poushin <nariman@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14ASoC: core: Fail probe if we fail to add dai widgetsNariman Poushin
Signed-off-by: Nariman Poushin <nariman@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14ASoC: Let snd_soc_platform subclass snd_soc_componentLars-Peter Clausen
There is an increasing amount of code that is very similar between platforms, CODECS and other components. Making platforms a component will allow us to share this code. For now the patch just adds component and component_driver fields to the platform and platform_driver structs and registers the platform as a component. Followup patches will be used to consolidate code between the different types of components. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14ASoC: Track which components have been registered with ↵Lars-Peter Clausen
snd_soc_register_component() snd_soc_unregister_component() takes the parent device of the component as a parameter and then looks up the component based on this. This is a problem if multiple components are registered for the same parent device. Currently drivers do not do this, but some drivers register a CPU DAI component and a platform for the same parent device. This will become a problem once platforms are also made components. To make sure that snd_soc_unregister_component() will not accidentally unregister the platform in such a case only consider components that were registered with snd_soc_register_component(). This is only meant as short term stopgap solution to be able to continue componentisation. Long term we'll need something different. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14ASoC: Remove IO register modifier callbacksLars-Peter Clausen
There are no ASoC drivers left that use them and new drivers are supposed to use regmap for this. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14ASoC: Move IO functions to soc-io.cLars-Peter Clausen
soc-core.c is getting quite crowded. Move all IO related functions that are still in soc-core.c to soc-io.c Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14ASoC: Prepare SOC_SINGLE_XR_SX controls for regmapLars-Peter Clausen
SOC_SINGLE_XR_SX controls currently only work with CODECs that set the 'reg_word_size' field in their snd_soc_codec_driver struct. Going forward support for ASoC level IO will eventually be removed and all drivers will be converted to regmap. Preparing for the transition this patch adds support for CODECs using regmap for IO to the SOC_SINGLE_XR_SX control. We already have the val_bytes field in the CODEC struct which holds the number of bytes per word, but it is only initialized when regmap is used. Also initialize it for drivers still using legacy IO and update the SOC_SINGLE_XR_SX handlers to use it. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14ASoC: core: Move the default regmap I/O setting to snd_soc_register_codec()Xiubo Li
Add the default regmap I/O setting to snd_soc_register_codec() while the CODEC is initialising, which will be called by CODEC driver device probe(), and then we can make XXX_set_cache_io() go away entirely from each CODEC ASoC probe. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-31Merge tag 'asoc-v3.15-4' of ↵Takashi Iwai
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus ASoC: Final updates for v3.15 merge window A few more updates from last week - use of the tdm_slot mapping from Xiubo plus a few smaller fixes and cleanups.
2014-03-25Merge remote-tracking branches 'asoc/topic/tdm' and 'asoc/topic/tegra' into ↵Mark Brown
asoc-next
2014-03-25ASoC: core: remove the 'of_' prefix of of_xlate_tdm_slot_mask.Xiubo Li
The 'of_' is not appropriate here for there hasn't any DT parsing. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-25ASoC: Remove name_prefix unset during DAI link init hackLars-Peter Clausen
Before we had card level support for DAPM and controls machine drivers would register their controls and DAPM elements with the CODEC. This required us to temporarily unset the name_prefix of a CODEC during the rtd init callback to avoid the machine level controls getting the CODEC's prefix. Now that all machine drivers properly register their machine level controls and DAPM elements with the card rather than with the CODEC we can drop the hack that sets the CODEC's name_prefix to NULL while calling the DAI link or AUX dev init callback. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-13Merge tag 'asoc-v3.15-2' of ↵Takashi Iwai
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next ASoC: Updates for v3.15 This is mostly a few additional fixes from Lars-Peter, a new driver and cleaning up a git failure with merging the Intel branch (combined with an xargs failure to pay attention to error codes). The history lists a bunch of additional commits for the branch but the content of those commits is actually present already but not recorded in history due to git failing. Unfortunately xargs is used in the merge script and it doesn't do a good job of noticing errors from the commands it invokes.
2014-03-13Merge remote-tracking branch 'asoc/topic/io' into asoc-nextMark Brown
2014-03-13Merge tag 'asoc-v3.15' of ↵Takashi Iwai
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next ASoC: Updates for v3.15 Quite a busy release for ASoC this time, more on janitorial work than exciting new features but welcome nontheless: - Lots of cleanups from Takashi for enumerations; the original API for these was error prone so he's refactored lots of code to use more modern APIs which avoid issues. - Elimination of the ASoC level wrappers for I2C and SPI moving us closer to converting to regmap completely and avoiding some randconfig hassle. - Provide both manually and transparently locked DAPM APIs rather than a mix of the two fixing some concurrency issues. - Start converting CODEC drivers to use separate bus interface drivers rather than having them all in one file helping avoid dependency issues. - DPCM support for Intel Haswell and Bay Trail platforms. - Lots of work on improvements for simple-card, DaVinci and the Renesas rcar drivers. - New drivers for Analog Devices ADAU1977, TI PCM512x and parts of the CSR SiRF SoC.
2014-03-12Merge remote-tracking branches 'asoc/topic/ml26124', 'asoc/topic/of', ↵Mark Brown
'asoc/topic/omap', 'asoc/topic/pxa' and 'asoc/topic/rcar' into asoc-next