summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-pcm.c
Commit message (Collapse)AuthorAgeFilesLines
*-. Merge remote-tracking branches 'asoc/topic/davinci', ↵Mark Brown2015-08-301-0/+5
|\ \ | | | | | | | | | 'asoc/topic/davinci-vcif', 'asoc/topic/doc' and 'asoc/topic/dpcm' into asoc-next
| | * ASoC: dpcm: Add checks of playback/capture before dpcm_get_beKoro Chen2015-07-071-0/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In dpcm_get_be(), it looks for a BE rtd that has the DAI widget according to current stream type. Only playback_widgets are searched in the case of playback stream and vice versa. However, the DAI widget itself can be playback or capture. If the DAI widget is capture, but current stream type is playback, dpcm_get_be() will always fail to find a rtd, print error messages, and continue to the next DAI widget in list. We can just skip this DAI widget to further suppress error messages. This happens in a special case when 2 codecs are inter-connected, and the 1st codec's "capture" widget is used to send data to the 2nd codec during "playback": mtk-rt5650-rt5676 sound: ASoC: can't get playback BE for Sub AIF2 Capture rt5650_rt5676 Playback: ASoC: no BE found for Sub AIF2 Capture Add checks to continue to next DAI widget if current DAI widget's direction does not match the stream type. Signed-off-by: Koro Chen <koro.chen@mediatek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* / ASoC: dapm: Simplify list creation in dapm_dai_get_connected_widgets()Lars-Peter Clausen2015-07-291-9/+2Star
|/ | | | | | | | | | | | | | | | | | | | | | | | | When running dapm_dai_get_connected_widgets() currently in is_connected_{input,output}_ep() for each widget that gets added the array is resized and the code also loops over all existing entries to avoid adding a widget multiple times. The former can be avoided by collecting the widgets in a linked list and only once we have all widgets allocate the array. The later can be avoided by changing when the widget is added. Currently it is added when walking the neighbor lists of a widget. Since a widget can be neighbors with multiple other widgets it could get added twice and hence the check is necessary. But the main body of is_connected_{input,output}_ep is guaranteed to be only executed at most once per widget. So adding the widget to the list at the beginning of the function automatically makes sure that each widget gets only added once. The only difference is that using this method the starting point itself will also end up on the list, but it can easily be skipped when creating the array. Overall this reduces the code size and speeds things slightly up. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: soc-pcm: DPCM cares BE formatKuninori Morimoto2015-05-221-5/+42
| | | | | | | | | | | | | | | | | | | | | | Current DPCM is caring only FE format. but it will be no sound if FE/BE was below style, and user selects S24_LE format. FE: S16_LE/S24_LE BE: S16_LE DPCM can rewrite the format, so basically we don't want to constrain with the BE constraints. But sometimes it will be trouble. This patch adds new .dpcm_merged_format on struct snd_soc_dai_link. DPCM will use FE / BE merged format if .struct snd_soc_dai_link has it. We can have other .dpcm_merged_xxx in the future .dpcm_merged_foramt .dpcm_merged_rate .dpcm_merged_chan Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge remote-tracking branch 'asoc/topic/core' into asoc-nextMark Brown2015-04-121-7/+9
|\
| * ASoC: Don't try to register debugfs entries if the parent does not existLars-Peter Clausen2015-04-091-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | If the registration of a debugfs directory fails this is treated as a non-fatal error in ASoC and operation continues as normal. This means we need to be careful and check if the parent debugfs directory exists if we try to register a debugfs file or sub-directory. Otherwise we might end up passing NULL for the parent and the file or directory will be registered in the top-level debugfs directory. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: Make soc_dpcm_debugfs_add() non-fatalLars-Peter Clausen2015-04-091-5/+3Star
| | | | | | | | | | | | | | | | | | Failing to register the debugfs entries is not fatal and will not affect normal operation of the sound card. Don't abort the card registration if soc_dpcm_debugfs_add() fails. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: core: allow pcms to be registered as nonatomicVinod Koul2015-02-231-0/+1
|/ | | | | | | | | | | ALSA core with commit 257f8cce5d40 - "ALSA: pcm: Allow nonatomic trigger operations" allows trigger ops to implemented as nonatomic. For ASoC, we can specify this in dailinks and is updated while snd_pcm is created Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Cc: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge branch 'topic/msbits' into for-nextTakashi Iwai2014-12-311-1/+1
|\
| * ASoC: pcm: Fix unused variable warningTakashi Iwai2014-12-311-1/+1
| | | | | | | | | | | | | | | | sound/soc/soc-pcm.c: In function ‘soc_pcm_set_msb’: sound/soc/soc-pcm.c:307:11: warning: unused variable ‘i’ [-Wunused-variable] Fixes: 0e2a37513a1f ('ASoC: pcm: Use wildcard msbits constraints') Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | Merge branch 'topic/msbits' into for-nextTakashi Iwai2014-12-301-20/+4Star
|\|
| * ASoC: pcm: Use wildcard msbits constraintsLars-Peter Clausen2014-12-301-20/+4Star
| | | | | | | | | | | | | | | | | | Use the new wildcard msbits constraints instead of installing a constraint for each available sample format width. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ASoC: pcm: Fix vague codec and cpu DAI prepare error messagesJarkko Nikula2014-12-241-3/+4
|/ | | | | | | | | Both codec and cpu DAI prepare print the same error message making it a bit more difficult to grep quickly from sources. Fix this by telling it explicitly. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
*-. Merge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/doc', ↵Mark Brown2014-12-081-2/+14
|\ \ | | | | | | | | | 'asoc/topic/dpcm', 'asoc/topic/dwc' and 'asoc/topic/fsi' into asoc-next
| | * ASoC: soc-pcm: skip dpcm path checking with incapable/unready FEQiao Zhou2014-11-211-2/+14
| |/ | | | | | | | | | | | | | | | | | | | | Skip dpcm path checking for playback or capture, if corresponding FE doesn't support playback or capture, or currently is not ready. It can reduce the unnecessary cost to search connected widgets. [Tweaked comments for clarity -- broonie] Signed-off-by: Qiao Zhou <zhouqiao@marvell.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | Merge remote-tracking branch 'asoc/topic/core' into asoc-nextMark Brown2014-12-081-0/+3
|\ \
| * | ASoC: core: Call mute for cpu dais as wellRamesh Babu2014-10-201-0/+3
| |/ | | | | | | | | | | | | | | | | | | We call mute for codec dai only, we should call this for cpu dai as well to allow cpu dais (FEs) in DSPs to be muted/unmuted on shutdown/startup Signed-off-by: Ramesh Babu <ramesh.babu@intel.com> 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>
* | Merge remote-tracking branch 'asoc/fix/pcm' into asoc-linusMark Brown2014-12-081-0/+4
|\ \
| * | ASoC: soc-pcm: do not hw_free BE if it's still usedQiao Zhou2014-12-041-0/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not free BE hw if it's still used by other FE during dpcm runtime shutdown. Otherwise the BE runtime state will be STATE_HW_FREE and won't be updated to STATE_CLOSE when shutdown ends, because BE dai shutdown function won't close pcm when detecting BE is still under use. With STATE_HW_FREE, BE can't be triggered start again. This corner case can easily appear when one BE is used by two FE, without this patch "ASoC: dpcm: Fix race between FE/BE updates and trigger"(ea9d0d771fcd32cd56070819749477d511ec9117). One FE tries to shutdown but it's raced against xrun on another FE. It improves the be dai hw_free logic. Signed-off-by: Qiao Zhou <zhouqiao@marvell.com> Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* / ASoC: dpcm: Fix race between FE/BE updates and triggerTakashi Iwai2014-11-041-16/+56
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DPCM can update the FE/BE connection states totally asynchronously from the FE's PCM state. Most of FE/BE state changes are protected by mutex, so that they won't race, but there are still some actions that are uncovered. For example, suppose to switch a BE while a FE's stream is running. This would call soc_dpcm_runtime_update(), which sets FE's runtime_update flag, then sets up and starts BEs, and clears FE's runtime_update flag again. When a device emits XRUN during this operation, the PCM core triggers snd_pcm_stop(XRUN). Since the trigger action is an atomic ops, this isn't blocked by the mutex, thus it kicks off DPCM's trigger action. It eventually updates and clears FE's runtime_update flag while soc_dpcm_runtime_update() is running concurrently, and it results in confusion. Usually, for avoiding such a race, we take a lock. There is a PCM stream lock for that purpose. However, as already mentioned, the trigger action is atomic, and we can't take the lock for the whole soc_dpcm_runtime_update() or other operations that include the lengthy jobs like hw_params or prepare. This patch provides an alternative solution. This adds a way to defer the conflicting trigger callback to be executed at the end of FE/BE state changes. For doing it, two things are introduced: - Each runtime_update state change of FEs is protected via PCM stream lock. - The FE's trigger callback checks the runtime_update flag. If it's not set, the trigger action is executed there. If set, mark the pending trigger action and returns immediately. - At the exit of runtime_update state change, it checks whether the pending trigger is present. If yes, it executes the trigger action at this point. Reported-and-tested-by: Qiao Zhou <zhouqiao@marvell.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
* Merge remote-tracking branch 'asoc/fix/core' into asoc-linusMark Brown2014-10-081-1/+1
|\
| * ASoC: soc-pcm: fix sig_bits determination in soc_pcm_apply_msb()Daniel Mack2014-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | In the SNDRV_PCM_STREAM_CAPTURE branch in soc_pcm_apply_msb(), look at sig_bits of the capture stream, not the playback one. Spotted by coverity. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
* | ASoC: soc-pcm: fix dpcm_path_get error handlingQiao Zhou2014-09-101-1/+5
|/ | | | | | | | | | dpcm_path_get may return -ENOMEM when allocating memory for list fails. We should not keep processing path or start up dpcm dai in this case. Signed-off-by: Qiao Zhou <zhouqiao@marvell.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge remote-tracking branch 'asoc/topic/component' into asoc-nextMark Brown2014-08-041-180/+400
|\
| * ASoC: pcm: Add soc_dai_hw_params helperBenoit Cousson2014-07-171-19/+24
| | | | | | | | | | | | | | | | | | | | | | 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>
| * ASoC: pcm: Add support for DAI multicodecBenoit Cousson2014-07-171-166/+368
| | | | | | | | | | | | | | | | | | | | | | Add multicodec support in soc-pcm.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>
| * Merge remote-tracking branch 'asoc/topic/component' into asoc-multiMark Brown2014-07-161-2/+2
| |\
| | * ASoC: Move name and id from CODEC/platform to componentLars-Peter Clausen2014-06-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | ASoC: pcm: Refactor soc_pcm_apply_msb for multicodecsBenoit Cousson2014-07-011-11/+24
| |/ | | | | | | | | | | | | | | | | | | | | | | Refactor the function to facilitate the migration to multiple codecs. Fix a trailing space in the header as well. No functional change. Signed-off-by: Benoit Cousson <bcousson@baylibre.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* / ASoC: pcm: fix dpcm_path_put in dpcm runtime updateQiao Zhou2014-06-211-0/+1
|/ | | | | | | | | | we need to release dapm widget list after dpcm_path_get in soc_dpcm_runtime_update. otherwise, there will be potential memory leak. add dpcm_path_put to fix it. Signed-off-by: Qiao Zhou <zhouqiao@marvell.com> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
*-. Merge remote-tracking branches 'asoc/topic/headers', 'asoc/topic/intel', ↵Mark Brown2014-05-221-14/+5Star
|\ \ | | | | | | | | | 'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/mc13783' and 'asoc/topic/multicodec' into asoc-next
| | * ASoC: core: Add one dai_get_widget helper instead of two rtd based onesBenoit Cousson2014-04-241-14/+5Star
| |/ | | | | | | | | | | | | | | | | | | | | Replace rtd_get_codec_widget() and rtd_get_cpu_widget() by a simple dai_get_widget() in preparation for DAI-multicodec support, per Lars suggestion. No functional change. Signed-off-by: Benoit Cousson <bcousson@baylibre.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | Merge remote-tracking branch 'asoc/topic/pcm' into asoc-nextMark Brown2014-05-221-0/+7
|\ \
| * | ASoC: core: Add support for machine specific trigger callbackJarkko Nikula2014-04-291-0/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Machine specific trigger callback allows to do final stream start/stop related operations in a machine driver after setting up the codec, DMA and DAI. One example could be clock management for linked streams case where machine driver can start/stop synchronously the linked streams. Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Signed-off-by: Stefan Roese <sr@denx.de> Signed-off-by: Mark Brown <broonie@linaro.org>
* | Merge remote-tracking branch 'asoc/topic/core' into asoc-nextMark Brown2014-05-221-1/+0Star
|\ \
| * | ASoC: Remove runtime field from DAILars-Peter Clausen2014-05-121-1/+0Star
| |/ | | | | | | | | | | | | | | | | | | This was initially removed in commit 6423c1875 ("ASoC: Remove runtime field from DAI"), but was, presumably by accident, brought back in commit f0fba2ad1 ("ASoC: multi-component - ASoC Multi-Component Support"). But has never been initialized to anything but NULL ever since. This commit removes it again. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
* / ASoC: pcm: Fix incorrect condition check for case SNDRV_PCM_TRIGGER_SUSPENDNicolin Chen2014-05-121-1/+1
|/ | | | | | | | The regular state before we execute SNDRV_PCM_TRIGGER_SUSPEND should be SNDRV_PCM_TRIGGER_START, not SNDRV_PCM_TRIGGER_STOP. Thus fix it. Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* Merge tag 'asoc-v3.15' into asoc-nextMark Brown2014-03-231-24/+85
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. # gpg: Signature made Wed 12 Mar 2014 23:05:45 GMT using RSA key ID 7EA229BD # gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>" # gpg: aka "Mark Brown <broonie@debian.org>" # gpg: aka "Mark Brown <broonie@kernel.org>" # gpg: aka "Mark Brown <broonie@tardis.ed.ac.uk>" # gpg: aka "Mark Brown <broonie@linaro.org>" # gpg: aka "Mark Brown <Mark.Brown@linaro.org>"
| * Merge remote-tracking branch 'asoc/topic/core' into asoc-nextMark Brown2014-03-131-24/+85
| |\
| | * ASoC: Move ignore_pmdown_time from CODEC to componentLars-Peter Clausen2014-03-061-8/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation for componentization move the ignore_pmdown_time field from the snd_soc_codec struct to the snd_soc_component struct. Set it to true for non CODEC components for now. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * ASoC: Move active count from CODEC to componentLars-Peter Clausen2014-03-061-6/+4Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no reason why active count tracking should only be done for CODECs but not for other components. Moving the active count from the snd_soc_codec struct to the snd_soc_component struct reduces the differences between CODECs and other components and will eventually allow component to component DAI links (Which is a prerequisite for converting CODECs to components). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * ASoC: Fix active count tracking for CODEC to CODEC linksLars-Peter Clausen2014-03-061-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | For CODEC to CODEC links we need to make sure to also manage the 'active' field of the cpu_dai CODEC. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * ASoC: Add helper functions for PCM runtime 'active' managementLars-Peter Clausen2014-03-061-22/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | We have the same code that increments and decrements the active field of the various PCM runtime components (all with the same bugs). Factor this out into common helper functions. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * ASoC: Handle ignore_pmdown_time for CODEC to CODEC linksLars-Peter Clausen2014-03-061-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | For CODEC to CODEC links we should only immediately power down if both CODECs are configured to ignore the power down delay. Factor the logic for this into a helper function that can be used for both compressed and normal PCMs. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
* | | ASoC: pcm: Drop incorrect double/extra freesMark Brown2014-03-231-3/+0Star
|/ / | | | | | | | | | | | | | | | | | | | | | | | | The changes in "ASoC: pcm: free path list before exiting from error conditions" actually introduced both double frees (in case where the path list was allocated but empty) and frees of unallocated memory (in cases where the error being handled was -ENOMEM. Drop the commit for now. Fixes: e4ad1accb (ASoC: pcm: free path list before exiting from error conditions) Reported-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
* / ASoC: pcm: free path list before exiting from error conditionsPatrick Lai2014-03-051-0/+3
|/ | | | | | | | | | | dpcm_path_get() allocates dynamic memory to hold path list. Corresponding dpcm_path_put() must be called to free the memory. dpcm_path_put() is not called under several error conditions. This leads to memory leak. Signed-off-by: Patrick Lai <plai@codeaurora.org> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
* Merge remote-tracking branch 'asoc/topic/compress' into asoc-nextMark Brown2014-01-201-17/+12Star
|\
| * ASoC: DPCM: make some DPCM API calls non static for compressed usageLiam Girdwood2014-01-171-17/+12Star
| | | | | | | | | | | | | | | | The ASoC compressed code needs to call the internal DPCM APIs in order to dynamically route compressed data to different DAIs. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | Merge remote-tracking branch 'asoc/topic/pcm' into for-tiwaiMark Brown2014-01-161-12/+11Star
|\ \
| * | ASoC: pcm: Use snd_pcm_rate_mask_intersect() helperLars-Peter Clausen2014-01-141-7/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of open-coding the intersecting of two rate masks (and getting slightly wrong for some of the corner cases) use the new snd_pcm_rate_mask_intersect() helper function. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>