ASoC: dapm: Don't force card bias level to be updated

Commit 412312 (ASoC: dapm: Make sure all dapm contexts are updated) means
that any DAPM context being updated will have the bias level automatically
set, including the card. We can't safely do this as the card callbacks are
called for each device context and so the management of the card bias is
more complex. Several multi-component cards rely on this behaviour.

Skip updates during the asynchronous run entirely. We should really do them
in the synchronous section but it's not 100% clear which values to pick as
the different DAPM contexts may have different bias levels.

Change-Id: I6b5fca251b28b92096485317a8d63553246a81ce
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: dapm: Use card_list during DAPM shutdown

DAPM shutdown incorrectly uses "list" field of codec struct while
iterating over probed components (codec_dev_list). "list" field
refers to codecs registered in the system, "card_list" field is
used for probed components.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
ASoC: core: Return -ENOTSUPP from set_sysclk() if no operation provided

Make it easier for generic code to work with set_sysclk() by distinguishing
between the operation not being supported and an error as is done for
other operations like set_dai_fmt()

Signed-off-by: Mark Brown <broonie@linaro.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
ASoC: dapm - Fix check for codec context in dapm_power_widgets().

Fixes a NULL pointer dereference in dapm_power_widgets() if the dapm context
has no codec.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: dapm: Export mixer|mux_update_power() to public API.

Allow for the operation of custom mixer and mux DAPM widgets that can call
snd_soc_dapm_mixer_update_power() and snd_soc_dapm_mux_update_power() directly
after updating their status. This is useful with complex DAPM Mixer operations
where we need to do additional work in addition to setting a few mixer register
bits.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: dapm: Clean up header information.

Fix some spelling mistakes in the header and remove the todo items. Most
todo items are now available as kcontrol options now anyway.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Fix commit 8b18f884b88dfe3a010f416201b813614abbd83c names

Change-Id: I4e54c35361be7eea80a72eda95448864460a8650
Merge branch 'cm-11.0' into kk_mkt