Commit graph

241 commits

Author SHA1 Message Date
Kuninori Morimoto 96241bae08 ASoC: remove snd_soc_platform_trigger()
No one is using snd_soc_platform_trigger().
Let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-10 12:11:21 +00:00
Kuninori Morimoto 10611e1b0b ASoC: remove .bespoke_trigger from snd_soc_platform_driver
No existing platform is using .bespoke_trigger.
Let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-09 19:31:21 +00:00
Kuninori Morimoto fcff45f8e0 ASoC: remove .delay from snd_soc_platform_driver
No existing platform is using .delay.
Let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-09 19:31:21 +00:00
Patrick Lai 9f169b9f52 ASoC: dpcm: Avoid putting stream state to STOP when FE stream is paused
When multiple front-ends are using the same back-end, putting state of a
front-end to STOP state upon receiving pause command will result in backend
stream getting released by DPCM framework unintentionally. In order to
avoid backend to be released when another active front-end stream is
present, put the stream state to PAUSED state instead of STOP state.

Signed-off-by: Patrick Lai <plai@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-06 18:19:10 +00:00
Kuninori Morimoto 99b04f4c40 ASoC: add Component level pcm_new/pcm_free
In current ALSA SoC, Platform only has pcm_new/pcm_free feature,
but it should be supported on Component level. This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-15 16:54:23 +00:00
Lars-Peter Clausen 852801417a ASoC: Make return type of dpcm_state_string() const char *
dpcm_state_string() returns a pointer to a string literal. Modifying a
string literal causes undefined behaviour. So make the return type of the
function const char * to make it explicit that the returned value should
not be modified.

This patch is purely cosmetic, none of the users of dpcm_state_string()
attempt to modify the returned content.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-22 16:45:46 +00:00
彭东林 94d215cc6f ASoC: dpcm: print dai_link name of BE other than FE.
When operating the BE, we should print out the dai_link name of BE other
than FE. This is useful when analyzing the kernel log.

Signed-off-by: Donglin Peng <pengdonglin@smartisan.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-26 09:43:34 -07:00
Jeeja KP f11766143c ASoC: dpcm: Don't apply symmetry for BE with hw param fixup
If be_hw_param_fixup is defined for BE then it will
force the BE to a specific configuration supported
by HW. In this case don't apply symmetry.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-14 16:35:00 +01:00
Piotr Stankiewicz 5fdd022c20 ASoC: dpcm: play nice with CODEC<->CODEC links
Currently in situations where a normal CODEC to CODEC link follows a
DPCM DAI, an error in the following form will be logged:

ASoC: can't get [playback|capture] BE for <widget name>
ASoC: no BE found for <widget name>

This happens because all widgets in a path containing a DPCM DAI will
be passed to dpcm_add_paths, which will try to interpret the CODEC<->CODEC
as if it were a DPCM DAI, in turn causing the error.

This patch aims to resolve the described issue by stopping the DPCM graph
walk, initiated from dpcm_path_get, at the first widget associated with
a DPCM BE.

Signed-off-by: Piotr Stankiewicz <piotrs@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-30 16:15:10 +01:00
Piotr Stankiewicz 6742064aef ASoC: dapm: support user-defined stop condition in dai_get_connected_widgets
Certain situations may warrant examining DAPM paths only to a certain
arbitrary point, as opposed to always following them to the end. For
instance, when establishing a connection between a front-end DAI link
and a back-end DAI link in a DPCM path, it does not make sense to walk
the DAPM graph beyond the first widget associated with a back-end link.

This patch introduces a mechanism which lets a user of
dai_get_connected_widgets supply a function which will be called for
every node during the graph walk. When invoked, this function can
execute arbitrary logic to decide whether the walk, given a DAPM widget
and walk direction, should be terminated at that point or continued
as normal.

Signed-off-by: Piotr Stankiewicz <piotrs@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-30 16:15:10 +01:00
Mark Brown fc122f63d0 Merge remote-tracking branch 'asoc/topic/pcm' into asoc-next 2016-03-13 15:16:30 +07:00
Vinod Koul 5e82d2be6e ASoC: dpcm: fix the BE state on hw_free
While performing hw_free, DPCM checks the BE state but leaves out
the suspend state. The suspend state needs to be checked as well,
as we might be suspended and then usermode closes rather than
resuming the audio stream.

This was found by a stress testing of system with playback in
loop and killed after few seconds running in background and second
script running suspend-resume test in loop

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2016-02-02 19:23:15 +00:00
Kuninori Morimoto b0639bd242 ASoC: soc-pcm: copy dpcm->hw_params and call be_hw_params_fixup every time
Current DPCM doesn't copy dpcm->hw_params and doesn't call be_hw_params
if some FE are connected. But 2nd or later FE might want to know BE hw_params.
This patch solves this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-29 01:20:43 +01:00
Mark Brown 2dd49f8e6f Merge remote-tracking branch 'asoc/topic/pcm' into asoc-next 2016-01-11 13:54:30 +00:00
Sanyog Kale 3f80978397 ASoC: pcm: allow delayed suspending request by users
If a device would like to use delayed suspending then PM
recommendation is to set ‘power.use_autosuspend’ flag. To allow
users to do so we need to change runtime calls in core to use
autosuspend counterparts.

For user who do not wish to use delayed suspend not setting the
device's ‘power.use_autosuspend’ flag will result in non-delayed
suspend even with these APIs which incidentally is also the default
behaviour, so only users will be impacted who opt in for this.

Signed-off-by: Sanyog Kale <sanyog.r.kale@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05 16:27:53 +00:00
Mark Brown 9764350d71 Merge remote-tracking branches 'asoc/topic/dpcm', 'asoc/topic/dwc', 'asoc/topic/fsl', 'asoc/topic/fsl-asrc' and 'asoc/topic/fsl-esai' into asoc-next 2015-12-23 00:23:40 +00:00
PC Liao 906c7d690c ASoC: dpcm: Apply symmetry for DPCM
DPCM does not fully support symmetry attributes. soc_pcm_apply_symmetry()
is skipped in soc_pcm_open() for DPCM, without being applied elsewhere.
So HW parameters cannot be correctly limited, and user space can do
playback/capture at different rates while HW actually does not support it.
soc_pcm_params_symmetry() will return error and the second stream stops.

This patch adds soc_pcm_apply_symmetry() for FE, BE, and codec DAIs
in DPCM path that was skipped in soc_pcm_open().

Signed-off-by: PC Liao <pc.liao@mediatek.com>
Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-12 22:58:32 +00:00
Mengdong Lin 1a497983a5 ASoC: Change the PCM runtime array to a list
Currently the number of DAI links is statically defined by the machine
driver at build time using an array. This makes it difficult to shrink/
grow the number of DAI links at runtime in order to reflect any changes
in topology.

We can change the DAI link array in the core to a list so that PCMs and
FE DAI links can be added and deleted at runtime to reflect changes in
use case and DSP topology. The machine driver can still register DAI links
as an array.

As the 1st step, this patch change the PCM runtime array to a list. A new
PCM runtime is added to the list when a DAI link is bound successfully.

Later patches will further implement the DAI link list.

More:
- define snd_soc_new/free_pcm_runtime() to create/free a runtime.
- define soc_add_pcm_runtime() to add a runtime to the rtd list.
- define soc_remove_pcm_runtimes() to clean up the runtime list.

- traverse the rtd list to probe the link components and dais.

- Add a field "num" to PCM runtime struct, used to specify the device
  number when creating the pcm device, and for a soc card to access
  its dai_props array.

- The following 3rd party machine/platform drivers iterate the rtd list
  to check the runtimes:
  sound/soc/intel/atom/sst-mfld-platform-pcm.c
  sound/soc/intel/boards/cht_bsw_rt5645.c
  sound/soc/intel/boards/cht_bsw_rt5672.c
  sound/soc/intel/boards/cht_bsw_max98090_ti.c

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-18 18:32:24 +00:00
Koro Chen 95f444dc93 ASoC: dpcm: Make BE prepare possible in suspend state
During suspend/resume, there is a flow that if a driver does not support
SNDRV_PCM_INFO_RESUME, it will fail at snd_pcm_resume(), and user space
can then issue SNDRV_PCM_IOCTL_PREPARE to let audio continue to play.

However, in dpcm_be_dai_prepare() it only allows BEs to be prepared
in state SND_SOC_DPCM_STATE_HW_PARAMS or SND_SOC_DPCM_STATE_STOP.
The BE state will then stay in SND_SOC_DPCM_STATE_SUSPEND, consequently
dpcm_be_dai_shutdown() is skipped in the end of playback and
be_substream->runtime is not cleared while this runtime is actually freed
by snd_pcm_detach_substream(). If another suspend comes, a NULL pointer
dereference will happen in snd_pcm_suspend() when accessing
BE substream's runtime.

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-16 10:04:04 +00:00
Takashi Iwai 274035751e Merge branch 'topic/hw-constraint-single' into for-next 2015-10-23 06:57:50 +02:00
Lars-Peter Clausen 4dcdd43b46 ASoC: pcm: Use snd_pcm_hw_constraint_single()
Use the new snd_pcm_hw_constraint_single() helper function instead of
calling snd_pcm_hw_constraint_minmax() with the same value for min and max
to install a constraint that limits the possible configuration values to a
single value. Using snd_pcm_hw_constraint_single() makes the indented
result clearer and is slightly shorter.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-21 14:25:42 +02:00
Ricard Wanderlof cde79035c6 ASoC: Handle multiple codecs with split playback / capture
Add the capability to use multiple codecs on the same DAI linke where
one codec is used for playback and another one is used for capture.

Tested on a setup using an SSM2518 for playback and an ICS43432 I2S MEMS
microphone for capture.

No verification is made that the playback and capture codec setups are
compatible in terms of number of TDM slots (where applicable).

Signed-off-by: Ricard Wanderlof <ricardw@axis.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-19 10:58:04 -07:00
Mark Brown 7c0031360b Merge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/davinci-vcif', 'asoc/topic/doc' and 'asoc/topic/dpcm' into asoc-next 2015-08-30 15:53:39 +01:00
Lars-Peter Clausen 1ce43acff0 ASoC: dapm: Simplify list creation in dapm_dai_get_connected_widgets()
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>
2015-07-29 14:01:38 +01:00
Koro Chen c5b8540dca ASoC: dpcm: Add checks of playback/capture before dpcm_get_be
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>
2015-07-07 14:56:15 +01:00
Kuninori Morimoto b073ed4e21 ASoC: soc-pcm: DPCM cares BE format
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>
2015-05-22 13:38:40 +01:00
Mark Brown d1113af4e8 Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2015-04-12 19:48:30 +01:00
Lars-Peter Clausen 6553bf06a3 ASoC: Don't try to register debugfs entries if the parent does not exist
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>
2015-04-09 12:23:14 +01:00
Lars-Peter Clausen 2e55b90a5e ASoC: Make soc_dpcm_debugfs_add() non-fatal
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>
2015-04-09 11:32:29 +01:00
Vinod Koul 48c7699fb2 ASoC: core: allow pcms to be registered as nonatomic
ALSA core with commit 257f8cce5d - "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>
2015-02-24 00:43:59 +09:00
Takashi Iwai c9a458519d Merge branch 'topic/msbits' into for-next 2014-12-31 17:13:41 +01:00
Takashi Iwai c6068d3a7b ASoC: pcm: Fix unused variable warning
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: 0e2a37513a ('ASoC: pcm: Use wildcard msbits constraints')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-12-31 17:13:29 +01:00
Takashi Iwai 614acf93dc Merge branch 'topic/msbits' into for-next 2014-12-30 16:40:46 +01:00
Lars-Peter Clausen 0e2a37513a ASoC: pcm: Use wildcard msbits constraints
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>
2014-12-30 16:28:08 +01:00
Jarkko Nikula 90cc7f1cbb ASoC: pcm: Fix vague codec and cpu DAI prepare error messages
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>
2014-12-24 11:59:01 +00:00
Mark Brown fed25395ff Merge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/doc', 'asoc/topic/dpcm', 'asoc/topic/dwc' and 'asoc/topic/fsi' into asoc-next 2014-12-08 13:11:56 +00:00
Mark Brown 941725f5fa Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2014-12-08 13:11:44 +00:00
Mark Brown 6980a31735 Merge remote-tracking branch 'asoc/fix/pcm' into asoc-linus 2014-12-08 13:11:39 +00:00
Qiao Zhou 36fba62cce ASoC: soc-pcm: do not hw_free BE if it's still used
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"(ea9d0d771f). 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>
2014-12-04 22:41:58 +00:00
Qiao Zhou 075207d24a ASoC: soc-pcm: skip dpcm path checking with incapable/unready FE
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>
2014-11-21 19:32:07 +00:00
Takashi Iwai ea9d0d771f ASoC: dpcm: Fix race between FE/BE updates and trigger
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
2014-11-04 17:18:32 +00:00
Ramesh Babu ae11601b80 ASoC: core: Call mute for cpu dais as well
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>
2014-10-20 12:19:44 +01:00
Mark Brown b9fb729949 Merge remote-tracking branch 'asoc/fix/core' into asoc-linus 2014-10-08 16:44:49 +01:00
Daniel Mack 5e63dfccf3 ASoC: soc-pcm: fix sig_bits determination in soc_pcm_apply_msb()
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
2014-10-07 19:14:20 +01:00
Qiao Zhou 8f70e515a8 ASoC: soc-pcm: fix dpcm_path_get error handling
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>
2014-09-10 11:40:21 +01:00
Mark Brown a1cb98ac8b Merge remote-tracking branch 'asoc/topic/component' into asoc-next 2014-08-04 16:31:15 +01:00
Benoit Cousson 93e6958a36 ASoC: pcm: Add soc_dai_hw_params helper
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-16 23:06:27 +01:00
Benoit Cousson 2e5894d737 ASoC: pcm: Add support for DAI multicodec
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>
2014-07-16 23:04:52 +01:00
Mark Brown f7acb3694a Merge remote-tracking branch 'asoc/topic/component' into asoc-multi 2014-07-16 22:58:45 +01:00
Benoit Cousson c8dd1fec47 ASoC: pcm: Refactor soc_pcm_apply_msb for multicodecs
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>
2014-07-01 18:20:07 +01:00
Lars-Peter Clausen f4333203ec ASoC: Move name and id from CODEC/platform to component
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-21 21:04:24 +01:00
Qiao Zhou 7ed9de76ff ASoC: pcm: fix dpcm_path_put in dpcm runtime update
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
2014-06-21 11:29:42 +01:00
Mark Brown 6630f30ed5 Merge remote-tracking branches 'asoc/topic/headers', 'asoc/topic/intel', 'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/mc13783' and 'asoc/topic/multicodec' into asoc-next 2014-05-22 00:23:54 +01:00
Mark Brown b79e16cb4a Merge remote-tracking branch 'asoc/topic/pcm' into asoc-next 2014-05-22 00:23:44 +01:00
Mark Brown 1450da3cf6 Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2014-05-22 00:23:41 +01:00
Lars-Peter Clausen 797f283b61 ASoC: Remove runtime field from DAI
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>
2014-05-12 22:08:36 +01:00
Nicolin Chen 868a6ca84e ASoC: pcm: Fix incorrect condition check for case SNDRV_PCM_TRIGGER_SUSPEND
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>
2014-05-12 21:16:06 +01:00
Jarkko Nikula 4792b0dbcf ASoC: core: Add support for machine specific trigger callback
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>
2014-04-29 12:04:32 -07:00
Benoit Cousson 3701861060 ASoC: core: Add one dai_get_widget helper instead of two rtd based ones
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>
2014-04-24 13:25:16 +01:00
Mark Brown d66fa86956 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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJTIOhJAAoJELSic+t+oim90CoP/3CVTm9cWv1qhPSU6jjn6RJG
 /djmhntJfHd/GXo+0TiiwNK9WmZjFrJUr+5ofkDTCqSzFz1Suc90B6oHxY4dFbgF
 IyIpTexGwTLv3H6yDjadYAfmGDSsE9sM2dkID9oXy6aEzjNby/a1VEiBnRgx16X1
 YGvMVK8AGFn/AyC/zOV6EcKJxUjdDogqZ5wkR2XHzwDoYjl9ufxK9BnSIygYABOW
 ABAjyrZf3xx97AH82BB6iqcZMh5GxGNTvI3hQd/vjx0r7RFUDNLqmF2cPZAMTRW/
 bXWxVmtNHie1+lCldyMFm8pV/Pv09zuqDAQKbPY2TeHj2zF8CM548NlkFHqwHlp0
 S9K5E1N+/2wcXMjQa1wBELohUdl6dVh1OFOAz7M8o0TJdSOZyR6PJ9r0NprP8NgS
 67FBU+ZqnWIK159m9rKkFfPhnaDuDzk+rpwyK0fQxQgpdGGjLyv7OK3GhS30oTnA
 Z2GjEyUySM1BcEEWAtfUD5fHbjN28e1Icn53q5q4JK4gvx4DXBy08uY/vumvjXjO
 8oum3q3RjRvqIhzMrJoVgs+c8RHwS/bZQhlu9Q3qNTsDNDyMnaZWHFAnP8RDqHjv
 ojZiMJkJdpqceZ3z1k5ZG8GWJ2JaZBikSbeNk2Ltg17/0nackq2r8ekrIoEUPVk2
 ph4DJNC2s1qCFtx7tzQj
 =C5oo
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v3.15' into asoc-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.

# 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>"
2014-03-23 14:00:41 +00:00
Mark Brown 017d9491ce ASoC: pcm: Drop incorrect double/extra frees
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
2014-03-23 13:59:59 +00:00
Mark Brown da8ab21cfe Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2014-03-12 23:03:58 +00:00
Lars-Peter Clausen 3d59400fe4 ASoC: Move ignore_pmdown_time from CODEC to component
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>
2014-03-06 17:04:56 +08:00
Lars-Peter Clausen cdde4ccb14 ASoC: Move active count from CODEC to component
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>
2014-03-06 17:04:55 +08:00
Lars-Peter Clausen a1a0cc0646 ASoC: Fix active count tracking for CODEC to CODEC links
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>
2014-03-06 17:04:55 +08:00
Lars-Peter Clausen 24894b7646 ASoC: Add helper functions for PCM runtime 'active' management
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>
2014-03-06 17:04:55 +08:00
Lars-Peter Clausen 208a1589db ASoC: Handle ignore_pmdown_time for CODEC to CODEC links
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>
2014-03-06 17:04:55 +08:00
Patrick Lai e4ad1accb2 ASoC: pcm: free path list before exiting from error conditions
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
2014-03-05 11:40:39 +08:00
Mark Brown ac6d7c48e3 Merge remote-tracking branch 'asoc/topic/compress' into asoc-next 2014-01-20 11:50:41 +00:00
Liam Girdwood 2360702530 ASoC: DPCM: make some DPCM API calls non static for compressed usage
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>
2014-01-17 17:56:21 +00:00
Mark Brown 2f43a23ab9 Merge remote-tracking branch 'asoc/topic/pcm' into for-tiwai 2014-01-16 12:42:57 +00:00
Mark Brown a9b68d3b90 Merge remote-tracking branch 'asoc/topic/core' into for-tiwai 2014-01-16 12:42:53 +00:00
Lars-Peter Clausen 55dcdb5051 ASoC: pcm: Use snd_pcm_rate_mask_intersect() helper
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>
2014-01-14 20:42:34 +00:00
Lars-Peter Clausen 817873f4b1 ASoC: pcm: Properly initialize hw->rate_max
If none of the components (CODEC or CPU DAI) sets a maximum sample rate we'll
end up with the rate_max field of the runtime hardware set to 0.  (Note that it
is still possible for the components to constrain the supported sample rates
using other methods, e.g. setting a list constraint) If rate_max is 0 this means
that the sound card doesn't support any rates at all, which is not the desired
result. So initialize rate_max to UINT_MAX. For symmetry reasons also set
rate_min to 0.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-14 20:41:57 +00:00
Mark Brown 64a9aa9cf5 Linux 3.13-rc3
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.15 (GNU/Linux)
 
 iQEcBAABAgAGBQJSogqUAAoJEHm+PkMAQRiGM2MIAJrr5KEXEWuuAR4+JkkWBK7A
 +dVT4n1MM4wP/aCIyriSlq7kgT03Wxk4Q4wKsj2wZvDQkNgEQjrctgIihc75jqi5
 126nmT3YXJLwgDpFA3RHZUWve3j3vfUG53rRuk7K9Xx1sGWU3Ls7BuInvQZ//+QS
 6UB4UuEAalmose5U8ToXQfMqZhjwreZKeb64TEZwFvu2klv4cnka1L/zHbmQGgRg
 2Pfv+aUrjsYE8s9lkEKX8MIQsDn28Q5Lsv7XIEQwo2at4rYbJaxX6usuC1OI0MQ5
 BLUn1GgtvOidq6FzSg6kXiA/MJYH3J0S+p4uULWAprxA+KeJRbWNRroM94W1qAk=
 =1Wcq
 -----END PGP SIGNATURE-----

Merge tag 'v3.13-rc3' into asoc-pcm

Linux 3.13-rc3
2014-01-14 20:41:53 +00:00
Lars-Peter Clausen 16d7ea9167 ASoC: Allow PCMs to restrict the supported formats
Some DMA cores might add additional restrictions on which in memory audio
formats can be supported by the compound sound card. If the PCM component
specifies a set of formats it supports (by setting the formats field to non 0)
take these into account when calculating the format set for the compound sound
card.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-09 14:31:59 +00:00
Liam Girdwood 1e9de42f43 ASoC: dpcm: Explicitly set BE DAI link supported stream directions
Some BE DAIs can be "dummy" (when the DSP is controlling the DAI) and as such
wont have set a minimum number of playback or capture channels required for BE
DAI registration (to establish supported stream directions).

Force machine drivers to explicitly set whether they support playback and capture
stream directions for every BE DAIs.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-07 17:57:48 +00:00
Jean-Francois Moine dcf0fa27a5 ASoC: pcm: Fix lack of platform bespoke_trigger() call
When the platform driver has no ops, the platform function
bespoke_trigger() is no more called.

The problem was introduced by the commit c5914b0aae
	"ASoC: pcm: Check for ops before deferencing them"

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-07 17:11:07 +00:00
Lars-Peter Clausen 002220a90d ASoC: dpcm: Allow PCMs to omit the set of supported formats
Allow PCMs that do not impose any restrictions on the supported formats to set
the formats field to 0, Instead of assuming that this means that the PCM does
not support any formats (which doesn't make much sense), assume that it supports
all formats. This brings the behavior of DPCM closer to that of non-DPCM.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-06 17:42:42 +00:00
Lars-Peter Clausen 08ae9b456d ASoC: dpcm: Add helper function for initializing runtime pcm
We have the same code for initializing the runtime pcm on both the playback and
the capture path. Factor this out into a common helper function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-06 17:36:48 +00:00
Mark Brown 729b47a007 Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2014-01-02 13:01:50 +00:00
Mark Brown 07ac582c85 Merge remote-tracking branch 'asoc/topic/symmetry' into asoc-core
Conflicts (Trivial add/delete):
	sound/soc/soc-pcm.c
2013-12-04 11:54:29 +00:00
Nicolin Chen 7f62b6ee76 ASoC: soc-pcm: Use valid condition for snd_soc_dai_digital_mute() in hw_free()
The snd_soc_dai_digital_mute() here will be never executed because we only
decrease codec->active in snd_soc_close(). Thus correct it.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-04 11:46:40 +00:00
Nicolin Chen 0b4bbae85e ASoC: soc-pcm: Drop the redundant snd_soc_dai_digital_mute() in soc_pcm_close()
This patch removed the redundant snd_soc_dai_digital_mute() in close() since
it's better to mute in hw_free() which's slightly earlier and symmetrical for
the case of reconfiguration: 'aplay 44k1.wav 48k.wav', for example, will be
open()->hw_params()->prepare(unmute)->playi1ng->hw_free(mute)->hw_params()->
parepare(unmute)->playing->hw_free(mute)->close()

Signed-off-by: Nicolin Chen <b42378@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-04 11:45:29 +00:00
Lars-Peter Clausen 62e5f676f6 ASoC: Set SNDRV_PCM_INFO_JOINT_DUPLEX for PCMs with symmetry constraints
If there are symmetry constraints between the playback and the capture channel
set the SNDRV_PCM_INFO_JOINT_DUPLEX flag to let userspace know about this.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-02 11:27:14 +00:00
Lars-Peter Clausen 78e45c99f6 ASoC: pcm: Always honor DAI min and max sample rate constraints
snd_pcm_limit_hw_rates() will initialize the minimum and maximum sample rate for
the PCM stream based on the rates specified in the rates field. Since we call
snd_pcm_limit_hw_rates() after soc_pcm_init_runtime_hw() it will essentially
overwrite the min and max rate set in soc_pcm_init_runtime_hw(). This may cause
the minimum or maximum rate to be set to a value outside the range of one of the
components if one of the components sets either SNDRV_PCM_RATE_CONTINUOUS or
SNDRV_PCM_RATE_KNOT and the other component specified a discrete rate via
SNDRV_PCM_RATE_[0-9]* that is outside of the first component's rate range. To
fix this first calculate the minimum and maximum rates using
snd_pcm_limit_hw_rates() and then on top of that apply the contraints specified
in the snd_soc_pcm_stream structs.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Takashi iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-27 16:43:12 +00:00
Lars-Peter Clausen 17b6c19b34 ASoC: pcm: Fix rate_max calculation
In order to make sure that the sample rate is in the supported range of both
components the maximum rate of the card should be the minimum of the maximum
rate of each components. There is one special case to consider though, if
max_rate is set to 0 this means there is no maximum specified, so use
min_not_zero() macro which will give use the desired result.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Takashi iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-27 16:42:37 +00:00
Nicolin Chen d3383420c9 ASoC: soc-pcm: move DAIs parameters cleaning into hw_free()
We're now applying soc_hw_params_symmetry() to reject unmatched parameters
while we clear parameters in soc_pcm_close(). So here's a use case might be
broken by this mechanism: aplay -Dhw:0 44100.wav 48000.wav 32000.wav

In this case, we call soc_pcm_open()->soc_pcm_hw_params()->soc_pcm_hw_free()
->soc_pcm_hw_params()->soc_pcm_hw_free()->soc_pcm_close() in order. As we
only clear parameters in soc_pcm_close(). The parameters would be remained
in the system even if the playback of 44100.wav is finished.

Thus, this patch is trying to move parameters cleaning into hw_free() so that
the system can continue to serve this kind of use case.

Also, since we set them in hw_params(), it should be better to clear them in
hw_free() for symmetry.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-24 13:32:50 +00:00
Nicolin Chen 3635bf09a8 ASoC: soc-pcm: add symmetry for channels and sample bits
Some SoCs can only work in mono or stereo mode at one time. So if
we let them capture a mono stream while playing a stereo stream,
there might be a problem occur to one of these two streams: double
paced or slowed down.

In soc-pcm.c, we have soc_pcm_apply_symmetry() to apply the rate
symmetry. But we don't have one for channels.

Likewise, we can treat symmetric_rate as a solution for those SoCs
or CODECs which can not handle asymmetrical LRCLK. But it's also
impossible for them to handle asymmetrical BCLK. And accodring to
BCLK = LRCLK * channel number * slot size(fixed or sample bits),
sample bits might also be a problem if they are not using a fixed
slot size.

Thus, this patch applys symmetry for channels and sample bits.

Meanwhile, there might be a race between two substreams if starting
simultaneously. Previously, we only added warning to compalin but
still using conservative way to let it carry on. However, this patch
rejects the second stream with any unmatched parameter to make sure
the first existing stream won't be broken.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-24 13:32:50 +00:00
Nicolin Chen 988e8cc41e ASoC: Add pinctrl PM to components of active DAIs
It's quite popular that more drivers are using pinctrl PM, for example:
(Documentation/devicetree/bindings/arm/primecell.txt). Just like what
runtime PM does, it would deactivate and activate pin group depending
on whether it's being used or not.

And this pinctrl PM might be also beneficial to cpu dai drivers because
they might have actual pinctrl so as to sleep their pins and wake them
up as needed.

To achieve this goal, this patch sets pins to the default state during
resume or startup; While during suspend and shutdown, it would set pins
to the sleep state.

As pinctrl PM would return zero if there is no such pinctrl sleep state
settings, this patch would not break current ASoC subsystem directly.

[ However, there is still an exception that the patch can not handle,
that is, when cpu dai driver does not have pinctrl property but another
device has it. (The AUDMUX <-> SSI on Freescale i.MX6 series for example.
SSI as a cpu dai doesn't contain pinctrl property while AUDMUX, an Audio
Multiplexer, has it). In this case, this kind of cpu dai driver needs to
find a way to obtain the pinctrl property as its own, by moving property
from AUDMUX to SSI, or creating a pins link/dependency between these two
devices, or using a more decent way after we figure it out. ]

Signed-off-by: Nicolin Chen <b42378@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-04 09:08:59 -08:00
Russell King - ARM Linux 2062b4c5d2 ASoC: dpcm: improve robustness
Avoid oopsing if there is no backend stream associated with a front end
stream.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-31 10:57:47 -07:00
Mark Brown c5914b0aae ASoC: pcm: Check for ops before deferencing them
Ensure that we always check that an ops structure is present before we
try to use it, improving the robustness of the system.

Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-31 10:57:47 -07:00
Jarkko Nikula 7cc302d231 ASoC: pcm: Remove extra spaces from dev_ prints
dev_ prints are already prefixed by ": " before format string so there is no
need for extra spaces.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-30 18:06:33 +01:00
Mark Brown 90d561bed9 Merge remote-tracking branch 'asoc/topic/fsl' into tmp 2013-09-01 21:15:52 +01:00
Fabio Estevam d6bead020d ASoC: soc-pcm: Allow to specify unidirectional dai_link
Add 'playback_only' and 'capture_only' fields that can be used for specifying
that a dai_link has a unidirectional capability.

The motivation for this is for the cases of systems, such as Freescale MX28,
that has two unidirectional DAIs.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-01 16:29:27 +01:00
Mark Brown 60529c65ec Merge branch 'topic/core' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-dapm 2013-07-29 18:40:55 +01:00
Lars-Peter Clausen c3f48ae6fd ASoC: dapm: Pass snd_soc_card directly to soc_dpcm_runtime_update()
soc_dpcm_runtime_update() operates on a ASoC card as a whole. Currently it takes
a snd_soc_dapm_widget as its only parameter though. The widget is then used to
look up the card and is otherwise unused. This patch changes the function to
take a pointer to the card directly. This makes it possible to to call
soc_dpcm_runtime_update() for updates which are not related to one specific
widget.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-24 14:56:19 +01:00
Mark Brown d4e1a73acd ASoC: pcm: Use the power efficient workqueue for delayed powerdown
There is no need to use a normal per-CPU workqueue for delayed power downs
as they're not timing or performance critical and waking up a core for them
would defeat some of the point.

Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
2013-07-18 11:58:28 +01:00
Mark Brown 70fe99d8db Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2013-06-17 17:20:16 +01:00
Mark Brown 4616274d33 ASoC: dapm: Treat DAI widgets like AIF widgets for power
Even though they are virtual widgets DAI widgets still get counted for the
DAPM context power management so we can't just use the active state to
check if they should be powered as they may not be part of a complete path.

Instead split them into input and output widgets and do the same power
checks as we perform on AIFs.

Reported-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-07 15:54:50 +01:00
Mark Brown 056790923e ASoC: pcm: Require both CODEC and CPU support when declaring stream caps
When declaring playback and capture capabilities check for both CODEC
side and CPU side support rather than only checking for CODEC side
support.  While it is unusual some CPUs do have unidirectional DAIs.

Reported-by: Fabio Estevam <fabio.estevam@freescale.com>
Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2013-06-03 09:55:00 +01:00
Lars-Peter Clausen bd477c31ca ASoC: core: Add helper function to initialize the runtime pcm
We use the same code to initialize the runtime pcm based on the
snd_soc_pcm_stream struct on both the playback and capture path. Factor this
code into a helper function to make things a bit more tidy.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-05-14 16:52:48 +04:00
Lars-Peter Clausen 90996f43b3 ASoC: core: Move snd_soc_set_runtime_hwparams() to soc-pcm.c
snd_soc_set_runtime_hwparams() is the only PCM related function that lives in
soc-core.c. All other PCM related functions live in soc-pcm.c, so move
snd_soc_set_runtime_hwparams() over as well for a bit more consistency.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-05-14 16:52:43 +04:00
Mark Brown d289323286 Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2013-02-11 11:06:30 +00:00
Mark Brown da18396f94 ASoC: core: Allow digital mute for capture
Help avoid noise from the power up of the capture path propagating through
into the start of the recording (especially noise caused by the ramp of
microphone biases) by keeping the capture muted until after we've finished
powering things up with DAPM in the same manner we do for playback. This
allows us to take advantage of soft mute support in the hardware more
effectively and is more consistent.

The core code using the existing digital mute operation is updated to take
advantage of this. Some additional cases in the soc-pcm code and suspend
will need separate handling but these are less practically relevant than
the main runtime stream start/stop case.

Rather than refactor the digital mute function in every single driver a
new operation is added for drivers taking advantage of this functionality,
the old operation should be phased out over time.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by Vinod Koul <vinod.koul@intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2013-02-08 11:08:44 +00:00
Dan Carpenter fffc0ca29f ASoC: pcm: delete some dead code
I've removed several unreachable returns.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-12 00:05:58 +00:00
Patrick Lai 08b27848da ASoC: pcm: allow backend hardware to be freed in pause state
When front-end PCM session is in paused state, back-end
PCM session will be put in paused state as well if given
front-end PCM session is the only client of given back-end.
Then, application closes front-end PCM session, DPCM
framework will not allow back-end enters HW_FREE state
so back-end will never get shutdown completely.

Signed-off-by: Patrick Lai <plai@codeaurora.org>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2012-12-20 15:59:46 +00:00
Mark Brown 326b06a8a9 Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2012-12-15 23:56:43 +09:00
Misael Lopez Cruz 9bffb1fb7c ASoC: Prevent pop_wait overwrite
pop_wait is used to determine if a deferred playback close
needs to be cancelled when the a PCM is open or if after
the power-down delay expires it needs to run. pop_wait is
associated with the CODEC DAI, so the CODEC DAI must be
unique. This holds true for most CODECs, except for the
dummy CODEC and its DAI.

In DAI links with non-unique dummy CODECs (e.g. front-ends),
pop_wait can be overwritten by another DAI link using also a
dummy CODEC. Failure to cancel a deferred close can cause
mute due to the DAPM STOP event sent in the deferred work.

One scenario where pop_wait is overwritten and causing mute
is below (where hw:0,0 and hw:0,1 are two front-ends with
default pmdown_time = 5 secs):

aplay /dev/urandom -D hw:0,0 -c 2 -r 48000 -f S16_LE -d 1
sleep 1
aplay /dev/urandom -D hw:0,1 -c 2 -r 48000 -f S16_LE -d 3 &
aplay /dev/urandom -D hw:0,0 -c 2 -r 48000 -f S16_LE

Since CODECs may not be unique, pop_wait is moved to the PCM
runtime structure. Creating separate dummy CODECs for each
DAI link can also solve the problem, but at this point it's
only pop_wait variable in the CODEC DAI that has negative
effects by not being unique.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-15 23:45:09 +09:00
Mark Brown b1bc7b3c9c ASoC: pcm: Report error code when we fail to init platform
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-27 19:35:59 +00:00
Liam Girdwood 103d84a3cb ASoC: pcm: Standardise ASoC PCM messages
Currently ASoC has a mixture of message prefixes e.g. "ASoC", "asoc"
or none and message types e.g. pr_debug or dev_dbg.

Make sure all ASoC core messages use the same "ASoC" prefix and
convert any component device specific messages to use dev_dbg
instead of pr_debug.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-21 11:39:58 +09:00
Liam Girdwood 3ac3f5ca91 ASoC: dpcm: Allow FE to be opened without valid BE routes.
Some userspace will open a PCM device and then configure mixers
for routing before triggering. This patch allows userspace to do
this sequence.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-06 19:06:58 +01:00
Liam Girdwood 5cb9b74822 ASoC: pcm: Clean up logging in soc_new_pcm()
Use dev_ style logging throughout soc_new_pcm()

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-06 18:59:15 +01:00
Liam Girdwood 35ea0655a1 ASoC: dpcm: Fix dpcm_get_be() to check that DAI is BE
Make sure that the dpcm_get_be() only returns BE DAI links.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-08 06:56:38 +08:00
Mark Brown 45c0a188ca ASoC: pcm: Staticise non-exported functions
They pollute the global namespace and cause sparse to complain.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-05-10 10:37:19 +01:00
Mark Brown b3bba9a1a8 ASoC: pcm: Fix DPCM for aux_devs
When we instantiate an aux_dev we use a fake rtd as part of the process
which doesn't have a dai_link associated with it. Fix the dpcm startup
code to cope with this.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-05-08 12:29:15 +01:00
Liam Girdwood f57b8488bc ASoC: dpcm: Fixup debugFS for DPCM state.
Remove writable debugFS permission, use simple_open() and
fix indentation.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-27 18:38:47 +01:00
Liam Girdwood be3f3f2ce6 ASoC: pcm: Add pcm operation for pcm ioctl.
Provide an ioctl marshaller for ASoC platform drivers.
This will use the default ALSA handler if no platform
handler exists.

This is also required for DPCM BE PCMs as snd_pcm_info()
will call the ioctl as part of stream startup.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-26 17:48:43 +01:00
Liam Girdwood 07bf84aaf7 ASoC: dpcm: Add bespoke trigger()
Some on SoC DSP HW is very tightly coupled with DMA and DAI drivers. It's
necessary to allow some flexability wrt to PCM operations here so that we
can define a bespoke DPCM trigger() PCM operation for such HW.

A bespoke DPCM trigger() allows exact ordering and timing of component
triggering by allowing a component driver to manage the final enable
and disable configurations without adding extra complexity to other
component drivers. e.g. The McPDM DAI and ABE are tightly coupled on
OMAP4 so we have a bespoke trigger to manage the trigger to improve
performance and reduce complexity when triggering new McPDM BEs.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-26 17:48:42 +01:00
Liam Girdwood 618dae11f8 ASoC: dpcm: Add runtime dynamic route update
This patch allows DPCM to dynamically alter the FE to BE PCM links
at runtime based on mixer setting updates. DAPM is looked up after
every mixer update and we perform a DPCM runtime update if the
mixer has a change of value.

This patchs adds/changes the following :-

 o Adds DPCM runtime update core.
 o Changes soc_dapm_mixer_update_power() and soc_dapm_mux_update_power()
   to return if a change has occured rather than 0. No other users check
   atm.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-26 17:48:19 +01:00
Liam Girdwood f86dcef87b ASoC: dpcm: Add debugFS support for DPCM
Add debugFS files for DPCM link management information.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-26 17:48:19 +01:00
Liam Girdwood 01d7584cd2 ASoC: dpcm: Add Dynamic PCM core operations.
The Dynamic PCM core allows digital audio data to be dynamically
routed between different ALSA PCMs and DAI links on SoC CPUs with
on chip DSP devices. e.g. audio data could be played on pcm:0,0 and
routed to any (or all) SoC DAI links.

Dynamic PCM introduces the concept of Front End (FE) PCMs and Back
End (BE) PCMs. The FE PCMs are normal ALSA PCM devices except that
they can dynamically route digital audio data to any supported BE
PCM. A BE PCM has no ALSA device, but represents a DAI link and it's
substream and audio HW parameters.

e.g. pcm:0,0 routing digital data to 2 external codecs.

FE pcm:0,0  ----> BE (McBSP.0) ----> CODEC 0
             +--> BE (McPDM.0) ----> CODEC 1

e.g. pcm:0,0 and pcm:0,1 routing digital data to 1 external codec.

FE pcm:0,0 ---
             +--> BE (McBSP.0) ----> CODEC
FE pcm:0,1 ---

The digital audio routing is controlled by the usual ALSA method
of mixer kcontrols. Dynamic PCM uses a DAPM graph to work out the
routing based upon the mixer settings and configures the BE PCMs
based on routing and the FE HW params.

DPCM is designed so that most ASoC component drivers will need no
modification at all. It's intended that existing CODEC, DAI and
platform drivers can be used in DPCM based audio devices without
any changes. However, there will be some cases where minor changes
are required (e.g. for very tightly coupled HW) and there are
helpers to support this too.

Somethimes the HW params of a FE and BE do not match or are
incompatible, so in these cases the machine driver can reconfigure
any hw_params and make any DSP perform sample rate / format conversion.

This patch adds the core DPCM code and contains :-

 o The FE and BE PCM operations.
 o FE and BE DAI link support.
 o FE and BE PCM creation.
 o BE support API.
 o BE and FE link management.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-26 17:48:19 +01:00
Liam Girdwood d9b0951b96 ASoC: dapm: Add platform stream event support
Currently stream events are only perfomed on codec stream widgets only.
There is now a need to be able to perform stream events on platform
widgets too.

e.g. we have the ABE platform driver with several DAI links
to dummy codecs. We need to be able to perform stream events on any
of the dummy codec DAI links.

This patch also removes the snd_soc_dai * parameter since it's already
contained within the rtd * parameter.

Finally makle stream event return void since no one checks it anyway.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:28:22 +01:00
Mark Brown 7bd3a6f34c ASoC: dapm: Supply the DAI and substream when calling stream events
In order to allow us to do something smarter than iterate through widgets
doing strcmp() to work out what to power up for stream events change the
interface used to generate them to be based on the combination of a DAI
and a stream direction rather than just a simple string identifying the
stream.

At some point we'll probably want a set of channels too.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-02-17 08:10:01 -08:00
Mark Brown b5d1d036ea ASoC: pcm: If pmdown_time is zero then shut down DAPM immediately
Since we've already got logic to special case immediate teardown of the
stream we may as well use it if the pmdown_time has been set to zero by
the application layer instead of scheduling a work item with zero delay.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-02-09 10:42:55 +00:00
Mark Brown 25bfe662e8 ASoC: pcm: Improve error logging
Use the standard logging macros and use dev_ variants where we can, also
reporting error codes whenever we report an error. These changes (the
error codes in particular) make it noticeably easier to figure out what
went wrong just from the basic dmesg output.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-02-02 14:14:17 +00:00
Peter Ujfalusi 88e339541d ASoC: soc-pcm: msbits constraint: Drop 8 and 16 bit sample sizes
As per discussion we can safely ignore the 8 and 16 bit sample
sizes when applying the msbits constraint.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-25 11:17:16 +00:00
Mark Brown 278047fd65 ASoC: Don't tell applications about msbits unless we're ignoring input
On the off chance that an application both pays attention and gets
confused.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-21 21:15:37 +00:00
Mark Brown 58ba9b2545 ASoC: Allow drivers to specify how many bits are significant on a DAI
Most devices accept data in formats that don't correspond directly to
their internal format. ALSA allows us to set a msbits constraint which
tells userspace about this in case it finds it useful (for example, in
order to avoid wasting effort dithering bits that will be ignored when
raising the sample size of data) so provide a mechanism for drivers to
specify the number of bits that are actually significant on a DAI and
add the appropriate constraints along with all the others.

This is done slightly awkwardly as the constraint is specified per sample
size - we loop over every possible sample size, including ones that the
device doesn't support and including ones that have fewer bits than are
actually used, but this is harmless as the upper layers do the right thing
in these cases.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-01-20 13:58:29 +00:00
Sangsu Park a500231da4 ASoC: soc-pcm: Allocate PCM operations dynamically to support multiple DAIs
The original code does not cover the case that two DAIs(CPU) have different
ASoC core PCM operations(like mmap, pointer...). Currently we have only one
global soc_pcm_ops for ASoC core PCM operation. When two DAIs have different
pointer functions, second DAI's pointer function is set for both first DAI
and second DAI in case of original code.

This patch uses runtime's pcm_ops instead of global pcm_ops for each DAIs. So
each DAIs can have different ASoC core PCM operations. This is needed to
support multiple DAIs.

Signed-off-by: Sangsu Park <sangsu4u.park@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-03 20:28:51 +00:00
Mark Brown d6652ef822 ASoC: Hold runtime PM references to components of active DAIs
Every device that implements runtime power management for DAIs is doing
it in pretty much the same way: in the startup callback they take a
runtime PM reference and then in the shutdown callback they release that
reference, keeping the device active while the DAI is active. Given the
frequency with which this is done and the obviousness of the need to keep
the device active in this period factor the code out into the core, taking
references on the device for each CPU DAI, CODEC DAI and DMA device in the
core.

As runtime PM is reference counted this shouldn't interfere with any
other reference holding by the drivers, and since (in common with the
existing implementations) we don't check for errors on enabling it
shouldn't matter if the device actually has runtime PM enabled or not.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
2011-12-08 09:21:45 +08:00
Mark Brown 5b6247abc9 ASoC: Remove needless unlikely()
There's no point in adding unlikely() annotations outside of hot paths
and on systems using these features the annotation will always be wrong
(as opposed to being something that only comes up once in a while) so
the annotation may even be harmful.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-04 17:19:40 +00:00
ramesh.babu@linux.intel.com e50fad4f02 ASoC: Allow machines to ignore pmdown_time per-link
With this flag, each dai_link in machine driver can choose
to ignore pmdown_time during DAPM shut down sequence.

If the ignore_pmdown_time is set, the DAPM for corresponding DAI
will be executed immediately.

Signed-off-by: Ramesh Babu K V <ramesh.babu@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-27 12:05:50 +02:00
Peter Ujfalusi 1d69c5c5de ASoC: core: Add flag to ignore pmdown_time at pcm_close
With this flag codec drivers can indicate that it is desired
to ignore the pmdown_time for DAPM shutdown sequence when
playback stream is stopped.
The DAPM sequence will be executed without delay in this case.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-14 20:42:21 +01:00
Dong Aisheng 17841020e9 ASoC: soc-core: symmetry checking for each DAIs separately
The orginal code does not cover the case that one DAI such as codec
may be shared between other two DAIs(CPU).
When do symmetry checking, altough the codec DAI requires symmetry,
the two CPU DAIs may still be configured to run on different rates.

We change to check each DAI's state separately instead of only checking
the dai link to prevent this issue.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-09-21 15:59:46 +01:00
Mark Brown 3d3106433e Merge branch 'for-3.1' into for-3.2 2011-08-17 16:34:05 +09:00
Sascha Hauer 25b7679136 ASoC: Fix check for symmetric rate enforcement
The ASoC core tries to not enforce symmetric rates when
two streams open simultaneously. It does so by checking
rtd->rate being zero. This works exactly once after booting
because it is not set to zero again when the streams close.
Fix this by setting rtd->rate when no active stream is left.

[This leads to lots of warnings about not enforcing the symmetry in some
situations as there's a race in the userspace API where we know we've
got two applications but don't know what rates they want to set.
-- broonie ]

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-08-17 16:22:09 +09:00
Axel Lin 6fc562e49c ASoC: soc-pcm: Remove unused global mutex
Since commit b8c0dab9bf
"ASoC: core - PCM mutex per rtd",
the global pcm_mutex is not being used any more.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-08-15 22:52:04 +09:00
Liam Girdwood 91d5e6b4f5 ASoC: pcm - rename snd_codec_close() to snd_pcm_close().
Make sure we follow naming convention for all PCM ops.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-06-09 19:29:35 +01:00
Liam Girdwood b8c0dab9bf ASoC: core - PCM mutex per rtd
In preparation for the new ASoC Dynamic PCM support (AKA DSP support).

The new ASoC Dynamic PCM core allows DAIs to be dynamically re-routed
at runtime between the PCM device end (or Frontend - FE) and the physical DAI
(Backend - BE) using regular kcontrols (just like a hardware CODEC routes
audio in the analog domain). The Dynamic PCM core therefore must be
able to call PCM operations for both the Frontend and Backend(s) DAIs at
the same time.

Currently we have a global pcm_mutex that is used to serialise
the ASoC PCM operations. This patch removes the global mutex
and adds a mutex per RTD allowing the PCM operations to be reentrant and
allow control of more than one DAI at at time. e.g. a frontend PCM hw_params()
could configure multiple backend DAI hw_params() with similar or different
hw parameters at the same time.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-06-09 19:29:29 +01:00
Liam Girdwood ddee627cf6 ASoC: core - Separate out PCM operations into new file.
In preparation for Dynamic PCM support (AKA DSP support).

There will be future patches that add support to allow PCMs to be dynamically
routed to multiple DAIs at startup and also during stream runtime. This patch
moves the ASoC core PCM operaitions into a new file called soc-pcm.c.  This will
in simplify the ASoC core features into distinct files.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-06-09 15:07:27 +01:00