ASoC: msm: change default Dolby endpoint to EXT speakers

Android endpoint device is mapped to Dolby endpoint device and sent
to DAP post proc module in dsp. Dolby suggests the default device
should be external speakers when we can't find the mapping like in
case of combo devices in use.

Change-Id: Id6ff82f9430538a9e1f75a09a2be7e51cce9977d
Signed-off-by: Jitendra Singh Naruka <jnaruk@codeaurora.org>
ASoC: wcd9xxx: Fix incorrect sleep time

The settle time for NCP was wrongly using msleep, causing more than
required sleep. Fix this by changing to usleep_range

CRs-fixed: 497619
Change-Id: I7f86f663a51d2b4191b007034155885d37c2b9fd
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: msm: Add error returns to ACDB driver

Change the ACDB kernel driver to return error codes
for any failures.

Change-Id: Ib2ffab8c9e5e9a044bbaaf83bd879d6b17c3918d
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
ASoC: msm: Add routing mixer controls for MultiMedia9

Add new Frontend MultiMedia9 and corresponding
routing mixer controls in msm-pcm-routing.
MultiMedia9 is to be used for incall music delivery.

Change-Id: Ibb0d3ca9daea14280868e93e73c6ef6318a33221
Signed-off-by: Vicky Sehrawat <vickys@codeaurora.org>

Conflicts:

	sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c

Signed-off-by: Patrick Tjin <pattjin@google.com>
ASoC: msm: qdsp6v2: increase time-out value for WB call start

It takes more time for call start command on WB network.
Sometimes timeout happens in the WB call and then it may cause volume
control issue during the call due to the voice state machine is in the
bad state.  So increase the timeout to avoid this issue.

Change-Id: Icc5267a61cb53053e0f5c388d7f84815d292d9f4
Signed-off-by: hyunsub.na <hyunsub.na@lge.com>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
ASoC: pcm: Protect FE dai list during dai open/close

When dai open/close, the FE dai list must be protected.
If this list is accessed at the same time, list can
be broken. Then the kernel panic may be generated.
So, the mutex lock is changed to the dai open/close funtions.

Change-Id: Ic75a8d5b9d13eaa38d9edca46b0154cecad29a8e
Signed-off-by: sangwoo <sangwoo2.park@lge.com>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
ASoC: msm: Avoid multiple release of ocmem memory

Add check to avoid multiple release of same OCMEM buffer,
by checking if the buffer is already freed before. This
is to avoid any system crash due to multiple release of
same buffer.

Change-Id: I527b1e9d502538818d2a15a614b693611c3a6cd9
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
soc: return value of get soc version ioctl

Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
ALSA: compress: Use kzalloc() for ioctls writing back data

Like the previous patch by Dan, we should clear the data to be
returned from certain compress ioctls, namely,
snd_compr_get_codec_caps() and snd_compr_get_params().
This time, we can simply replace kmalloc() with kzalloc().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Eric Laurent <elaurent@google.com>
ALSA: compress_core: fix open flags test in snd_compr_open()

O_RDONLY is zero so the original test (f->f_flags & O_RDONLY) is always
false and it will never do compress capture.  The test for O_WRONLY is
also slightly off.  The original test would consider "->flags =
(O_WRONLY | O_RDWR)" as write only instead of rejecting it as invalid.

I've also removed the pr_err() because that could flood dmesg.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: compress_core: don't wake up on pause

during pause the core should maintain the status-quo on the device and pointers
and not wake up. If app needs it should call DROP explcitly.

Signed-off-by: Namarta Kohli <namartax.kohli@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: compress_core: cleanup pointers on stop

as the start can be called after stop again, we need to reset state

Signed-off-by: Namarta Kohli <namartax.kohli@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: compress_core: integer overflow in snd_compr_allocate_buffer()

These are 32 bit values that come from the user, we need to check for
integer overflows or we could end up allocating a smaller buffer than
expected.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: compress - move the buffer check

Commit ALSA: compress_core: integer overflow in snd_compr_allocate_buffer()
added a new error check for input params.
this add new routine for input checks and moves buffer overflow check to this
new routine. This allows the error value to be propogated to user space

Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: Compress - add codec parameter checks

Conflicts:
	include/sound/compress_params.h

Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: core: don't return uninitialized snd_compr_tstamp

The snd_compr_update_tstamp() can only fill in the snd_compr_tstamp
if the codec implements the pointer() function. If that happened
the code was previously returning uninitialized garbage in the
tstamp because it wasn't initialized anywhere.

This change zero-fills the tstamp in the two places it is used
before calling snd_compr_update_tstamp(), and also has
snd_compr_update_tstamp() return an error indication if it
can't provide a tstamp. For the case of snd_compr_calc_avail()
it ignores this error because we still need to return info on
the available buffer space even if we can't provide tstamp
info - when the tstamp is not valid all fields are now
guaranteed to be zero.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: compress: fix compilation error

Fix compilation error after merging commit 1245b700
from master: SIZE_MAX is not defined.

Signed-off-by: Eric Laurent <elaurent@google.com>
ALSA: compress: Add snd_compress_free()

We are not currently freeing the compressed devices at module
unload time. This could be used to help, but more investigation
needs to be done to resolve this issue.

This patch is WIP.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
ALSA: compress: Make sure we trigger STOP before closing the stream.

Currently we assume that userspace will shut down the compressed stream
correctly. However, if userspcae dies (e.g. cplay & ctrl-C) we dont
stop the stream before freeing it.

This now checks that the stream is stopped before freeing.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
ALSA: Compress - dont use lock for all ioctls

Some simple ioctls like timsetamp query, capabities query can be done anytime
and should not be under the stream lock. Move these to
snd_compress_simple_iotcls() which is invoked without lock held.

While at it, improve readblity a bit by sprinkling some empty lines.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Eric Laurent <elaurent@google.com>