aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-10-07ASoC: soc-dapm: fix use after freeDaniel Mack1-11/+14
Coverity spotted the following possible use-after-free condition in dapm_create_or_share_mixmux_kcontrol(): If kcontrol is NULL, and (wname_in_long_name && kcname_in_long_name) validates to true, 'name' will be set to an allocated string, and be freed a few lines later via the 'long_name' alias. 'name', however, is used by dev_err() in case snd_ctl_add() fails. Fix this by adding a jump label that frees 'long_name' at the end of the function. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2014-10-06Merge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/dmic', 'asoc/topic/drivers', 'asoc/topic/es8328' and 'asoc/topic/fsl' into asoc-nextMark Brown1-2/+18
2014-10-06Merge remote-tracking branch 'asoc/topic/dapm' into asoc-nextMark Brown1-1/+2
2014-10-06Merge remote-tracking branch 'asoc/topic/component' into asoc-nextMark Brown1-1/+2
2014-10-03ASoC: dapm: Fix NULL pointer dereference when registering card with widgetsJarkko Nikula1-1/+2
Commit 0bd2ac3dae74 ("ASoC: Remove CODEC pointer from snd_soc_dapm_context") introduced regression to snd_soc_dapm_new_controls() when registering a card with card->dapm_widgets set. Call chain is: snd_soc_register_card() -> snd_soc_instantiate_card() -> snd_soc_dapm_new_controls() -> snd_soc_dapm_new_control() Null pointer dereference occurs since card->dapm context doesn't have associated component. Fix this by setting widget codec pointer conditionally. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-02ASoC: Export dapm_kcontrol_get_valueSubhransu S. Prusty1-1/+2
The DSP driver needs to know widget control value in its event handler for widgets like mixers. This is required in the subsequent patches Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-29ASoC: Remove CODEC pointer from snd_soc_dapm_contextLars-Peter Clausen1-1/+1
The only remaining user of the CODEC pointer in the DAPM struct is to initialize the CODEC pointer in the widget struct. The later is scheduled for removal, but has still a few users left. For now use dapm->component->codec to initialize it. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-04ASoC: Add support for automatically going to BIAS_OFF on suspendLars-Peter Clausen1-2/+18
There is a substantial amount of drivers that in go to SND_SOC_BIAS_OFF on suspend and go back to SND_SOC_BIAS_SUSPEND on resume (Often this is even the only thing done in the suspend and resume handlers). This patch introduces a new suspend_bias_off flag, which when set by a driver will let the ASoC core automatically put the device's DAPM context at the SND_SOC_BIAS_OFF level during suspend. Once the device is resumed the DAPM context will go back to SND_SOC_BIAS_STANDBY (if the context is idle, otherwise to SND_SOC_BIAS_ON). This will allow us to remove a fair bit of duplicated code from the drivers. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-08-11ASoC: dapm: Fix uninitialized variable in snd_soc_dapm_get_enum_double()Geert Uytterhoeven1-5/+7
If soc_dapm_read() fails, reg_val will be uninitialized, and bogus values will be written later: sound/soc/soc-dapm.c: In function 'snd_soc_dapm_get_enum_double': sound/soc/soc-dapm.c:2862:15: warning: 'reg_val' may be used uninitialized in this function [-Wmaybe-uninitialized] unsigned int reg_val, val; ^ Return early on error to fix this. Introduced by commit ce0fc93ae56e2ba50ff8c220d69e4e860e889320 ("ASoC: Add DAPM support at the component level"). Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2014-07-22ASoC: Move card field form platform/codec to componentLars-Peter Clausen1-1/+1
Both the snd_soc_codec and snd_soc_platform struct do have a pointer to the parent card and both handle this pointer in mostly the same way. This patch moves the card field to the component level which will allow further code consolidation between platforms and CODECS. Since there are only a handful of users of the snd_soc_codec struct's card field (and none of the snd_soc_platform's) these are update in this patch as well, which allows it to be removed from the snd_soc_codec struct. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-17ASoC: Remove unused 'r' variable from dapm_connect_dai_link_widgets()Lars-Peter Clausen1-3/+0
It was accidentally added in commit 44ba2641 ("ASoC: dapm: Add support for DAI multicodec"). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-16ASoC: pcm: Add soc_dai_hw_params helperBenoit Cousson1-20/+8
Add a function helper to factorize the hw_params code. Suggested by Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Benoit Cousson <bcousson@baylibre.com> Tested-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-16ASoC: dapm: Add support for DAI multicodecBenoit Cousson1-20/+47
Add multicodec support in soc-dapm.c Signed-off-by: Benoit Cousson <bcousson@baylibre.com> Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com> Signed-off-by: Fabien Parent <fparent@baylibre.com> Tested-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21ASoC: dapm: Remove platform field from widget and dapm context structLars-Peter Clausen1-1/+0
The platform field in the snd_soc_dapm_widget and snd_soc_dapm_context structs is now unused can be removed. New code that wants to get the platform for a widget or dapm context should use snd_soc_dapm_to_platform(w->dapm) or snd_soc_dapm_to_platform(dapm). 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 Clausen1-36/+64
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 Clausen1-8/+3
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-21Merge remote-tracking branch 'asoc/fix/core' into asoc-componentMark Brown1-13/+16
2014-06-21ASoC: Auto disconnect pins from all DAPM contextsLars-Peter Clausen1-16/+11
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: Move name and id from CODEC/platform to componentLars-Peter Clausen1-4/+4
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 Clausen1-14/+22
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-06-09ASoC: dapm: Make sure register value is in sync with DAPM kcontrol stateJarkko Nikula1-13/+16
Commit c9e065c27fe9 ("ASoC: dapm: Make sure to always update the DAPM graph in _put_volsw()") stopped updating register values in those cases where initial after boot state of kcontrol appears to not change but where register value still needs update because it is not in sync with the kcontrol state. Fix this by doing snd_soc_test_bits() unconditionally as it was before but by using separate flags for kcontrol and register state changes. This allow both DAPM graph to be updated when disabling auto-muted control and update register if it is out-of-sync in respect of kcontrol state. 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-05-22Merge remote-tracking branch 'asoc/topic/dapm' into asoc-nextMark Brown1-114/+56
2014-05-22Merge remote-tracking branch 'asoc/topic/component' into asoc-nextMark Brown1-77/+14
2014-05-12ASoC: dapm: Fix SUSPEND -> OFF bias sequenceLars-Peter Clausen1-2/+5
Currently when the DAPM context bias level is SUSPEND and the target bias level is OFF dapm_pre_sequence_async() will first transition to PREPARE and dapm_post_sequence_async() will then transition back from PREPARE to STANDBY and then to OFF. This patch makes sure that dapm_pre_sequence_async() only transitions to PREPARE when either going to ON or away from ON. This avoids the extra unnecessary transitions. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-12ASoC: dapm: Handle SND_SOC_DAPM_REG() genericallyLars-Peter Clausen1-20/+0
Commit commit de9ba98b6d ("ASoC: dapm: Make widget power register settings more flexible") added generic support for on_val/off_val in the DAPM core. With this in place there is no need anymore for having a special event callback for SND_SOC_DAPM_REG() widgets. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-12ASoC: dapm: Simplify snd_soc_dapm_link_dai_widgets()Lars-Peter Clausen1-18/+9
If we find a widget who's stream name matches the name of a DAI widget then thats the one it should be connected to. Based on the widget id we can say in which direction the path should be. No need to go back to the DAI and check the stream names. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-12ASoC: dapm: Use snd_soc_dapm_add_path() in snd_soc_dapm_new_pcm()Lars-Peter Clausen1-10/+5
We already know the widgets we want to connect, so use snd_soc_dapm_add_path() instead of snd_soc_dapm_add_route() in snd_soc_dapm_new_pcm(). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-12ASoC: dapm: Use snd_soc_dapm_add_path() in connect_dai_link_widgets()Lars-Peter Clausen1-14/+13
We already know which two widgets should be connected, so use snd_soc_dapm_add_path() instead of snd_soc_dapm_add_route() in snd_soc_dapm_connect_dai_link_widgets(). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-12ASoC: dapm: Revert "ASoC: dapm: Fix double prefix addition"Lars-Peter Clausen1-6/+5
This reverts commit bd23c5b661858446267f4d6b2fb4edd8eb710dda. The patch claims that the patch is necessary to avoid double prefix addition when calling snd_soc_dapm_add_route() from snd_soc_dapm_connect_dai_link_widgets(). But snd_soc_dapm_add_route() is called with the card's DAPM context, which does not have a prefix, which means there is no prefix that could be added a second time. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-12ASoC: dapm: Skip CODEC<->CODEC links in connect_dai_link_widgets()Lars-Peter Clausen1-2/+5
For CODEC to CODEC DAI links the paths are created in snd_soc_dapm_new_pcm(). Also for CODEC to CODEC links the widgets are connected cross-over via a DAI link widget, meaning that the capture widget of one CODEC will be connected to the playback widget of the other and vice versa. Whereas snd_soc_dapm_connect_dai_link_widgets() directly connects the playback widget of the CPU DAI to the playback widget of the CODEC DAI and the capture widget of the CPU DAI to the capture widget of the CODEC DAI. So not skipping CODEC<->CODEC links in snd_soc_dapm_connect_dai_link_widgets() will create incorrect connections between the two CODECs which will cause DAPM to detect active paths where there are none and unnecessarily power up widgets. Fixes: b893ea5 ("ASoC: sapm: Automatically connect DAI link widgets in DAPM graph.") Cc: <stable@vger.kernel.org> (for 3.14+) Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-05ASoC: dapm: Make sure to always update the DAPM graph in _put_volsw()Lars-Peter Clausen1-13/+10
When using auto-muted controls it may happen that the register value will not change when changing a control from enabled to disabled (since the control might be physically disabled due to the auto-muting). We have to make sure to still update the DAPM graph and disconnect the mixer input. Fixes: commit 5729507 ("ASoC: dapm: Implement mixer input auto-disable") Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-29Merge branch 'topic/component' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-dapmMark Brown1-77/+14
2014-04-29ASoC: dapm: Factor out duplicated code in soc_dapm_stream_event()Lars-Peter Clausen1-35/+16
In soc_dapm_stream_event() we have the same code twice, once for the codec_dai and once for the cpu_dai. This patch factors the duplicated code out into a separate function. This will make it easier to modify the implementation (since there is only one place that needs to be updated) and also easier to add support for more than two DAIs per DAI link. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-22ASoC: dapm: Rename soc_widget_update_bits_locked() to soc_widget_update_bits()Lars-Peter Clausen1-5/+4
There is no unlocked version of soc_widget_update_bits_locked() and there is no plan to introduce it in the near future, so drop the _locked suffix. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-22ASoC: Move IO abstraction to the component levelLars-Peter Clausen1-73/+11
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-21ASoC: dapm: Fix widget double free with auto-disable DAPM kcontrolJarkko Nikula1-1/+0
Commit 9e1fda4ae158 ("ASoC: dapm: Implement mixer input auto-disable") is trying to free the widget it allocated by snd_soc_dapm_new_control() call in dapm_kcontrol_data_alloc() by adding kfree(data->widget) to dapm_kcontrol_free(). This is causing a widget double free with auto-disabled DAPM kcontrols in sound card unregistration because widgets are already freed before dapm_kcontrol_free() is called. Reason for that is all widgets are added into dapm->card->widgets list in snd_soc_dapm_new_control() and freed in dapm_free_widgets() during execution of snd_soc_dapm_free(). Now snd_soc_dapm_free() calls for different DAPM contexts happens before snd_card_free() call from where the call chain to dapm_kcontrol_free() begins: soc_cleanup_card_resources() soc_remove_dai_links() soc_remove_link_dais() snd_soc_dapm_free(&cpu_dai->dapm) soc_remove_link_components() soc_remove_platform() snd_soc_dapm_free(&platform->dapm) soc_remove_codec() snd_soc_dapm_free(&codec->dapm) snd_soc_dapm_free(&card->dapm) snd_card_free() snd_card_do_free() snd_device_free_all() snd_device_free() snd_ctl_dev_free() snd_ctl_remove() snd_ctl_free_one() dapm_kcontrol_free() This wasn't making harm with ordinary DAPM kcontrols since data->widget is NULL for them. Fixes: 9e1fda4ae158 (ASoC: dapm: Implement mixer input auto-disable) 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> Cc: stable@vger.kernel.org
2014-04-18ASoC: dapm: Allow update_bits use 32 bits regBard Liao1-1/+1
This patch change reg's type from unsigned short to int. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-12Merge remote-tracking branch 'asoc/topic/enum' into asoc-nextMark Brown1-294/+77
2014-03-10ASoC: dapm: Sprinkle lockdep asserts through the codeMark Brown1-0/+18
Try to spot locking issues by asserting that the DAPM mutex is held when it should be. There's a bit of fun due to us not requiring the lock to be held prior to the card being instantiated which mean we need to wrap the assert in some paths and this isn't methodical by any stretch of the imagination. Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-10ASoC: dapm: Staticise dapm_mark_dirty()Mark Brown1-2/+1
The function is not called outside soc-dapm.c so there is no need for it to be exported. Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-03ASoC: dapm: Reorder the bias update sequenceXiang Xiao1-11/+26
The new sequence ensure that dapm_pre_sequence_async work on the card before all codecs and dapm_post_sequence_async work on the card after all codecs. So the machine driver could utilize the determinate sequence to do the gloabl setup and teardown in the right place. Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-03ASoC: dapm: Power off all widgets in the snd_soc_dapm_shutdownXiang Xiao1-6/+6
The widgets generated by the machine driver need to power off too. Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-01ASoC: dapm: Break dapm_set_path_status() appartLars-Peter Clausen1-89/+44
There are three different completely independent code paths in dapm_set_path_status(). One of them is never used at all and the other two (one for mixers, one for MUXs) have their distincive callsites that always go onto the same path. Breaking the function into two parts allows us to reduce the code size and in the MUX case also do some optimizations to avoid having to calcualte the selected item for each item again. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-01ASoC: dapm: Consolidate MUXs and virtual MUXsLars-Peter Clausen1-83/+30
MUXs and virtual MUXs are almost identical, the only difference is that for virtual MUX there is no hardware backing register in which setting is stored. This patch adds code, which is similar to what we already do for DAPM mixer controls to support virtual mixer controls, to DAPM enum controls. The new code will check if the enum does a hardware backing register and skip over reading and writing to the register if it has not. This allows us to use the same code path for both MUXs and virtual MUXs and a lot of nearly identical code can be removed. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-01ASoC: dapm: Consolidate MUXs and value MUXsLars-Peter Clausen1-138/+19
MUXs and value MUXs are almost identical, the only difference is that a value MUX uses a look-up table to map from the selected control item to a register value, while MUXs use a direct mapping. This patch uses snd_soc_enum_item_to_val() and snd_soc_enum_val_to_item(), which where earlier introduced during the consolidation of enum and value enum controls, to hide this difference. This allows us to use the same code path for both MUXs and value MUXs and a lot of nearly duplicated code can be removed. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-01Merge branches 'topic/dapm', 'topic/sign', 'topic/adau1373', 'topic/max98090', 'topic/mc13783', 'fix/wm8994' and 'topic/wm8995' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-enumMark Brown1-22/+153
2014-02-20ASoC: dapm: Add unlocked version of snd_soc_dapm_syncCharles Keepax1-5/+22
We will often call sync after several functions that require the DAPM mutex to be held. Rather than release and immediately relock the mutex provide an unlocked function for this situation. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-20Merge branch 'fix/dapm' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-dapmMark Brown1-13/+126
2014-02-20ASoC: dapm: Add locking to snd_soc_dapm_xxxx_pin functionsCharles Keepax1-10/+123
The snd_soc_dapm_xxxx_pin all require the dapm_mutex to be held when they are called as they edit the dirty list, however very few of the callers do so. This patch adds unlocked versions of all the functions replacing the existing implementations with one that holds the lock internally. We also fix up the places where the lock was actually held on the caller side. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
2014-02-20ASoC: Rename soc_enum.max field with itemsTakashi Iwai1-11/+11
The name "max" in struct soc_enum is rather confusing since it actually takes the number of items. With "max", one might try to assign (nitems - 1) value. Rename the field to a more appropriate one, "items", which is also used in struct snd_ctl_elem_info, too. This patch also rewrites some code like "if (x > e->nitems - 1)" with "if (x >= e->nitems)". Not only the latter improves the readability, it also fixes a potential bug when e->items is zero. Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>