asoc: tegra: fix coverity issue

Fix negative array index error.

Bug 1046331

Change-Id: I19f0e8714f07211f0b9a3539515fdf562df4c195
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/134082
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
asoc: tegra: Add 8,24,32 bit support

Adding 8, 24 and 32 bit support to Tegra Drivers
All the above formats are supported by Tegra hardware
Playback/record also depends on support in platform codec

Signed-off-by: Rahul Mittal <rmittal@nvidia.com>
Reviewed-on: http://git-master/r/143750
(cherry picked from commit 9ffc1769fae6b03aef56e89b36dcb8e471ac13a6)

Change-Id: I06259d345f9d7886fe949809e358544ed506268e
Signed-off-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-on: http://git-master/r/146968
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
Fixing commit omision
See:
https://github.com/P880-dev/mainline_tegra/commit/b45bc03ac62787292a7a7ed81b04a248b7a8ccc5

Change-Id: I982eeafa7ce0dc9fb81f0036d6560e8ff9bdc46c
asoc: tegra: Fix Kernel panic during recording

Add boundary check for DAM ifc and channel id
if all functions where these are used.
During camcoder recording DAM functions are called with
negative ifc, causing kernel panic.

Change-Id: Idd4df5eae579f9a89222361d594a79ddcdfc1fe5
Signed-off-by: Vijay Mali <vmali@nvidia.com>
Reviewed-on: http://git-master/r/219692
GVS: Gerrit_Virtual_Submit
Reviewed-by: Scott Peterson <speterson@nvidia.com>
asoc: tegra: fix hang while accessing DAM registers

Accessing DAM registers in debugfs (tegra30_dam_show) without
enabling AHUB clock hangs the system. This patch enables AHUB
APBIF clock along with DAM clock before accessing DAM regsiters.

Bug 1334025

Change-Id: Ibf2bc4c699027b8fc28f3e861e5b306f8ffd9564
Signed-off-by: Shreshtha Sahu <ssahu@nvidia.com>
Reviewed-on: http://git-master/r/256715
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
 ASoC: Tegra: Fix for negative dam ifc during voice call

Check return value of configure_dam function.
Add error message and graceful exit path in
make_voice_call function when DAM controller
allocation fails.

Bug 1274653

Change-Id: I9924c256113c73fb3208c1e0e7225cb485022ca4
Signed-off-by: Vijay Mali <vmali@nvidia.com>
Reviewed-on: http://git-master/r/237664
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Scott Peterson <speterson@nvidia.com>
Adjusted to p880 kernel by Demetris
ALSA: pcm - add support for hostless audio

Allow some PCM devices to be hostless, i.e. there is no PCM data transferred
to or from the host CPU. This can be used to minimise power on systems since
the CPU can idle/sleep during the PCM device operation (e.g. a phone call
where the DAI is between a MODEM and DSP)

TODO: cleanup, look at adding a read/write blocker.

Change-Id: I36f521a77f4426d38713739e4313b99c6f506089
Singed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
ALSA: pcm - reject calls to open backend PCMs (temporary)

This stops userspace opening backlemd PCMs.

TODO: rework for upstream.

Change-Id: I579dcbf608cb30561dbb9fe7cb709190d3068111
Signed-off-by: Liam Girdwood <lrg@ti.com>
ALSA: pcm - Export snd_pcm_lib_default_mmap() helper

Export the default mmap function, snd_pcm_lib_default_mmap().
The upcoming non-snooping support in HD-audio driver will use this
to override the mmap method.

Change-Id: I9e93bb240dfc3302f26c86e0b072abf38186d913
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: pcm - remove the dead code from snd_pcm_open_file()

The rpcm_file parameter is never used in current ALSA code, so remove
it to make it cleaner.

Change-Id: Iae08c17a22b865d38fb8a24803ad2e48de0bf457
Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound: Add module.h to the previously silent sound users

Lots of sound drivers were getting module.h via the implicit presence
of it in <linux/device.h> but we are going to clean that up.  So
fix up those users now.

Change-Id: I5cc8cd4356f6217a91155c2dec2df575747ba623
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
ALSA: core: Add support to handle compressed audio IOCTLs

This is needed to support the compressed audio till the
compressed core is done with development.

Change-Id: Ida1dff0d6952241809ea23b6b9de6e07c71305bb
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
ALSA: pcm - Avoid GFP_ATOMIC in snd_pcm_link()

GFP_ATOMIC is used in snd_pcm_link() just because the kmalloc is
called inside a lock.  Since this function isn't too critical for
speed and is rarely called in practice, better to allocate the chunk
at first before spinlock and free it in error paths, so that
GFP_KERNEL can be used.

Change-Id: I3d9d27db884150fe612c860aec0fb54892a443d7
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: core: Add support to handle compressed audio IOCTLs for capture

This is needed to support the compressed audio capture so that the
IOCTL commands for capture can pass to the ALSA SOC audio driver

Change-Id: I78c796275946e6e02f61aeab6579f3e9362f208b
Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>
ALSA: PCM: Fix some races at disconnection

commit 9b0573c07f278e9888c352aa9724035c75784ea0 upstream.

Fix races at PCM disconnection:
- while a PCM device is being opened or closed
- while the PCM state is being changed without lock in prepare,
  hw_params, hw_free ops

Change-Id: Ie2d8ffeeb507b15e4214385eafd2a945ee393cd8
Reported-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ALSA: core: add support for compress_offload

This patch adds core.c, the file which implements the ioctls and
registers the devices

Change-Id: I7c31f7bc9b56ef117f01ef50661d7d0ac5988ada
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: Fix memory leak on error in snd_compr_set_params()

If copy_from_user() does not return 0 we'll leak the memory we
allocated for 'params' when that variable goes out of scope.

Also a small CodingStyle cleanup: Use braces on both branches of
if/else when one branch needs it.

Change-Id: If27c4802cd2a8f7aa456ea9df42966846abaf96a
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Vinod Koul <vinod.koul@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: Add a reference counter to card instance

commit a0830dbd4e42b38aefdf3fb61ba5019a1a99ea85 upstream.

For more strict protection for wild disconnections, a refcount is
introduced to the card instance, and let it up/down when an object is
referred via snd_lookup_*() in the open ops.

The free-after-last-close check is also changed to check this refcount
instead of the empty list, too.

Change-Id: I07c1145df28f0e7b51491c4c2e2d881ea5872707
Reported-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ALSA: Avoid endless sleep after disconnect

commit 0914f7961babbf28aaa2f19b453951fb4841c03f upstream.

When disconnect callback is called, each component should wake up
sleepers and check card->shutdown flag for avoiding the endless sleep
blocking the proper resource release.

Change-Id: I69a42da9e46e9b3659558e0b90d0aec9ce7904c9
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ALSA: Fix card refcount unbalance

commit 8bb4d9ce08b0a92ca174e41d92c180328f86173f upstream.

There are uncovered cases whether the card refcount introduced by the
commit a0830dbd isn't properly increased or decreased:
- OSS PCM and mixer success paths
- When lookup function gets NULL

This patch fixes these places.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50251

Change-Id: I2ad443e03838bb572064a5dc9fdf39e7fb8b2dd0
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>