summaryrefslogtreecommitdiffstats
path: root/sound/core/compress_offload.c
Commit message (Collapse)AuthorAgeFilesLines
* ALSA: compress: fix the states to check for allowing readVinod Koul2013-04-291-2/+10
| | | | | | | | | | | for reading compressed data, we need to allow when we are paused, draining or stopped. Signed-off-by: Vinod Koul <vinod.koul@intel.com> Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Cc: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: compress: Use kzalloc() for ioctls writing back dataTakashi Iwai2013-04-221-2/+2
| | | | | | | | | 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>
* ALSA: compress: info leak in snd_compr_get_caps()Dan Carpenter2013-04-221-0/+1
| | | | | | | | | If the ->get_caps() function doesn't clear the buffer then there would stack information leaked to userspace. For example, soc_compr_get_caps() can return success without clearing the buffer. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: compress_core: Rework writes to use cumulative valuesCharles Keepax2013-04-211-7/+11
| | | | | | | | | | | | This patch reworks the writes to use cumulative values thus making the app_pointer unecessary and removing it. Only tested as far as build. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: compress_core: Remove unused hw_pointerCharles Keepax2013-04-211-2/+0Star
| | | | | | | | | Only tested as far as build. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: compress_core: Add support for capture streamsCharles Keepax2013-04-211-2/+41
| | | | | | | Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: compress_core: Deconstify copy callback bufferCharles Keepax2013-04-211-3/+5
| | | | | | | | | | The buffer passed to the copy callback should not be const because the copy callback can be used for capture and playback. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: compress_core: Calculate avail correctly for capture streamsCharles Keepax2013-04-211-11/+18
| | | | | | | Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: compress_core: Update calc_avail to use cumulative valuesCharles Keepax2013-04-211-18/+5Star
| | | | | | | | | | | | | | | | | The app_pointer is managed locally by the compress core for memory mapped DSPs but for DSPs that are not memory mapped this would have to be manually updated from within the DSP driver itself, which is hardly very idiomatic. This patch switches to using the cumulative values to calculate the available buffer space because these are already gracefully passed out of the DSP driver to the compress core and otherwise should be functionally equivalent. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: compress: add support for gapless playbackJeeja KP2013-02-141-0/+96
| | | | | | | | | | | | | this add new API for sound compress to support gapless playback. As noted in Documentation change, we add API to send metadata of encoder and padding delay to DSP. Also add API for indicating EOF and switching to subsequent track Also bump the compress API version Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: core: don't return uninitialized snd_compr_tstampRichard Fitzgerald2013-02-111-6/+12
| | | | | | | | | | | | | | | | | | | | | 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: Add a reference counter to card instanceTakashi Iwai2012-10-301-2/+7
| | | | | | | | | | | | | 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. Reported-by: Matthieu CASTET <matthieu.castet@parrot.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: Compress - add codec parameter checksVinod Koul2012-09-171-0/+10
| | | | | Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: compress - move the buffer checkVinod Koul2012-09-171-4/+16
| | | | | | | | | | 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_core: integer overflow in snd_compr_allocate_buffer()Dan Carpenter2012-09-141-0/+4
| | | | | | | | | 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_core: fix open flags test in snd_compr_open()Dan Carpenter2012-09-111-5/+3Star
| | | | | | | | | | | | 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: cleanup pointers on stopVinod Koul2012-06-121-0/+4
| | | | | | | | 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: don't wake up on pauseVinod Koul2012-06-121-3/+1Star
| | | | | | | | | 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: Fix memory leak on error in snd_compr_set_params()Jesper Juhl2012-01-241-5/+8
| | | | | | | | | | | | 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. 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: core: add support for compress_offloadVinod Koul2011-12-231-0/+765
This patch adds core.c, the file which implements the ioctls and registers the devices 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>