Commit Graph

87 Commits

Author SHA1 Message Date
Taylor Holberton e9a11799ec Merge pull request #131 from pasqualirb/master
pcm: Allow to wait if capture is not running
2019-07-07 21:15:08 -04:00
Lucas Tanure 25e6dba5ae makefile: Don't overwrite CROSS_COMPILE variable
Signed-off-by: Lucas Tanure <tanure@linux.com>
2019-05-11 09:35:13 +01:00
Ricardo Biehl Pasquali ae803f2905 pcm: Allow to wait if capture is not running
This allows starting capture from another thread.

See the commit 932a81519572 ("ALSA: pcm: Comment why read
blocks when PCM is not running") in Linux kernel.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-04-24 10:57:57 -03:00
Taylor Holberton 82498f8328 Merge pull request #128 from alexonea/master
Easier Version Specification
2019-04-13 23:14:34 -04:00
Ricardo Biehl Pasquali dedf7159f9 pcm: Remove setting unnecessary parameters
SUBFORMAT is always zero.

SAMPLE_BITS and FRAME_BITS are refined by ALSA based on the
already set FORMAT and CHANNELS.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-04-12 14:48:16 -03:00
Daniela-Marinela Bistrean b098275b93 Fix integer division issue in int_to_percent function
Changed order of operations to preserve the precision during the division.
2019-04-12 01:27:52 +03:00
Alexandru N. Onea ad1f0e569c Initial version-bump.sh 2019-04-09 01:23:10 +03:00
Ricardo Biehl Pasquali f98e01afc2 pcm: Check for error after setting appl_ptr
Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 16:48:19 -02:00
Ricardo Biehl Pasquali 85d24bb721 pcm: Cleanup control/status when setup fails
Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 16:48:19 -02:00
Ricardo Biehl Pasquali a51d11460c pcm: Replace 'underruns' with 'xruns'
Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 16:48:19 -02:00
Ricardo Biehl Pasquali a384607242 pcm: Create generic transfer
Group read/write transfer into pcm_rw_transfer().

Create pcm_generic_transfer() for read/write and mmap
transfer modes. This recovers from xrun and suspended.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 16:48:19 -02:00
Ricardo Biehl Pasquali 738c48eb12 pcm: Put transfer functions together
A generic transfer function will be created. Put together
functions related to it.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 16:48:19 -02:00
Ricardo Biehl Pasquali 865dcf79e0 pcm: Remove 'running' variable from pcm structure
It is not needed.

As the pcm structure is opaque to user it can be safely
removed.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 16:48:19 -02:00
Ricardo Biehl Pasquali 25685b5829 pcm: Rewrite pcm_mmap_transfer() for compatibility
Make pcm_mmap_transfer() compatible with read/write IO.

start_threshold check was not valid for capture.

pcm->running checks were removed.

NOIRQ fallback was removed. Clocks of sound devices may
differ from the system, leading to desynchronization.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 16:48:19 -02:00
Ricardo Biehl Pasquali fb1683e0cc pcm: Exit loop when there are no available frames
Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 16:48:19 -02:00
Ricardo Biehl Pasquali 1832b6911b pcm: Put mmap functions together
pcm_mmap_transfer() will be rewritten. Put together
functions related to mmap transfer.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 16:48:19 -02:00
Ricardo Biehl Pasquali 7a1de1965e pcm: Rewrite pcm_get_htimestamp()
Use pcm_avail_update(), check avail for timestamp
coherence.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 16:48:07 -02:00
Ricardo Biehl Pasquali dd8ec69106 pcm: Move pcm_get_htimestamp()
pcm_get_htimestamp() will be rewritten. Place it after
pcm_avail_update(), which will be used in the rewrite.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 13:06:19 -02:00
Ricardo Biehl Pasquali 57efda93e7 pcm: Get values from kernel in avail_update
Instead of sending appl_ptr and avail_min to the kernel,
get them. This is the behavior of alsa-lib.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 13:06:19 -02:00
Ricardo Biehl Pasquali 323d2f5a41 pcm: Call HWSYNC ioctl when status is mmaped
When hardware pointer update is requested and status
structure is mmaped, call HWSYNC ioctl.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 13:06:19 -02:00
Ricardo Biehl Pasquali c8ef079a06 pcm: Remove HWSYNC before available calculation
Hardware pointer should not be updated in available
calculation.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 13:06:19 -02:00
Ricardo Biehl Pasquali 795995b3f1 pcm: Do not set values after control/status mmap
It's not necessary to send appl_ptr or avail_min to the
kernel here.

In prepare action, called later in pcm_open(), appl_ptr
becomes zero.

avail_min is already defined in software parameters.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 13:06:19 -02:00
Ricardo Biehl Pasquali 9b0847fbca pcm: Get appl_ptr and avail_min after prepare
appl_ptr becomes zero in prepare action. avail_min is the
same as when it was set in software parameters.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 13:06:18 -02:00
Ricardo Biehl Pasquali 444290cc9b pcm: Remove 'prepared' variable from pcm structure
It is not needed.

As the pcm structure is opaque to user it can be safely
removed.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 13:06:18 -02:00
Ricardo Biehl Pasquali 1124ab002f pcm: Remove prepare before start
Prepare is done in pcm_open().

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 13:06:18 -02:00
Ricardo Biehl Pasquali c97c854762 pcm: Remove start before read
Start is done by kernel when start_threshold or more frames
are requested.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 13:06:18 -02:00
Ricardo Biehl Pasquali 90683e0e22 pcm: Prepare after overrun
Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 13:06:18 -02:00
Ricardo Biehl Pasquali 447f8ff75f pcm: Remove code assuming start after write
The state cannot be assumed as RUNNING after a write
because start_threshold may not have elapsed.

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 13:06:18 -02:00
Ricardo Biehl Pasquali 30a18cbb52 pcm: Move prepare action to xrun handling
Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 13:06:18 -02:00
Ricardo Biehl Pasquali 5a66a188ee pcm: Do prepare action in pcm_open()
This eliminates the need for prepare in transfer functions
and pcm_start().

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
2019-01-08 13:05:27 -02:00
Taylor Holberton d0b7254a13 Added ifndef around macros 2018-11-28 16:33:24 -05:00
Taylor Holberton 715dc2aaf0 Checking for definition of __bitwise, __force, __user 2018-11-28 14:29:52 -05:00
Miguel Gaio 7d2a054b08 Fixed pcm_start when pcm is linked to other pcm device
When pcm device is linked to other pcm device,
the start call may be triggered by other pcm device.

Handle this condition by checing pcm state before start call.

Signed-off-by: Miguel Gaio <mgaio35@gmail.com>
2018-07-17 13:39:53 +02:00
Miguel Gaio f3a4695ef9 Corrected pcm_sync_ptr() on dma mmap coherent architecture
It is valid to get null sync_ptr on dma mmap coherent architecture.
In this case pcm_sync_ptr() is a nop.

Signed-off-by: Miguel Gaio <mgaio35@gmail.com>
2018-07-17 13:37:41 +02:00
Charles Keepax 7647ae9662 Fixup some minor code formatting issues
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
2018-04-11 15:54:11 +01:00
Miguel GAIO f19e7ed870 Fix pcm_writei return value if pcm is in not running state.
As per comment, on success, pcm_writei returns the number of frames written.
Fix the case of pcm not running.

Signed-off-by: Miguel GAIO <mgaio35@gmail.com>
2018-04-10 06:41:03 +02:00
Taylor Holberton 093b87878b added PCM_NONBLOCK macro 2017-10-12 20:28:30 -04:00
Taylor Holberton df11091086 bumped version 2017-05-23 21:23:57 -07:00
Taylor Holberton 001b25ef86 adding bounds check only when needed 2017-04-10 12:42:06 -07:00
Taylor Holberton 861da7ab05 moved code in pcm_open() to pcm_set_config() 2017-04-10 12:05:51 -07:00
Taylor Holberton 25976dc2f1 removed tab characters 2017-04-10 11:46:40 -07:00
Taylor Holberton 08bb59091c added pcm_get_config() 2017-04-10 11:45:44 -07:00
Taylor Holberton ea06b977fa simplified pcm_read() and pcm_write() 2017-04-06 23:14:19 -07:00
Taylor Holberton 851dd8073e checking limits of frame counts 2017-04-06 23:12:01 -07:00
Taylor Holberton 1137fc70bb removed debug statement 2017-04-06 23:06:36 -07:00
Taylor Holberton d6e7e04edb added limits for frames and channels 2017-04-06 23:04:20 -07:00
Taylor Holberton e123a65654 added doc on pcm_open and null checking pcm_is_ready 2017-01-13 21:39:48 -08:00
Pankaj Bharadiya 95c79d8797 Fix mixer_wait_event function comments
The @return comment description incorrect.
Fix it.

Change-Id: I148a5ebf3e05eb4824beb4c8fa1032a38272d86d
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
2017-01-11 11:29:23 +05:30
Pankaj Bharadiya 010121a131 Tinyalsa: Add support to poll on alsa control
ALSA controls support polling on the kcontrols, this is used in HD-A for
jack notifcation. In tinyalsa we can use this for notfication from sound
card for any events detected by DSP

Change-Id: I4193809bfcdb60f4dc11e1c2ad6a07b29cfa80e9
Signed-off-by: Hardik T Shah <hardik.t.shah@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
2017-01-11 10:38:28 +05:30
Pankaj Bharadiya 3f813e4778 Fix the byte control set/get method
The TLV byte controls expect a TLV header as well. Check for TLV
access and add TLV header size before invoking mixer API.

Change-Id: I12ba129e5bbc0676e80eb920e85b3683decfe0db
Signed-off-by: Pawse, GuruprasadX <guruprasadx.pawse@intel.com>
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
2017-01-10 13:50:53 +05:30