Commit Graph

384 Commits

Author SHA1 Message Date
Taylor Holberton 7cbd38cbdd Merge branch 'develop' 2019-01-13 13:16:52 -05:00
Taylor Holberton 0178c72b88 Added the 'attributes.h' header 2019-01-13 13:10:47 -05: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 08aff7bde2 pcm: Add macro for PREPARED state
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 e6c9e35c11 Fixed some doxygen references. 2018-12-22 10:20:15 -05:00
Taylor Holberton 6a3ff009f8 Installing ninja on travis build. 2018-12-17 14:56:53 +00:00
Taylor Holberton 1573fd70f1 Installing correct version of python-setuptools 2018-12-17 14:51:49 +00:00
Taylor Holberton 067a674671 Installing python setup tools, checking with clang 2018-12-17 14:48:08 +00:00
Taylor Holberton 15e0da3494 Upgrading pip before meson install. 2018-12-17 14:21:54 +00:00
Taylor Holberton dd10bf1a30 Using xenial for Travis build. 2018-12-17 14:17:00 +00:00
Taylor Holberton e74b1942ce Putting version.py in scripts folder 2018-12-17 14:00:34 +00:00
Taylor Holberton a3afcc2020 Testing all build systems in Travis CI 2018-12-17 13:59:34 +00:00
Taylor Holberton e53afc44b7 Merge pull request #121 from tp-m/meson-extract-version-from-header
meson: extract project version from header file and version .so
2018-12-17 08:53:43 -05:00
Tim-Philipp Müller aa0cec3e76 meson: extract project version from header file and version .so
- Extract project version from tinyalsa/version.h for
  easier maintainability

- Version shared lib: tinyalsa.so -> tinyalsa.so.1.1.1
2018-12-16 17:04:44 +00:00
Taylor Holberton efdf3bb9e9 Merge pull request #120 from tp-m/meson
Add support for Meson as build system
2018-12-15 16:22:08 -05:00
Tim-Philipp Müller 230a291494 Add support for Meson as build system
The Meson build system is being adopted by projects
such as GNOME, PulseAudio, GStreamer, VLC, systemd, Mesa,
Wayland, X.org, and many others. Having a meson build
upstream in tinyalsa would allow for easy use of tinyalsa
as a Meson subproject in other projects.

https://mesonbuild.com
2018-12-15 20:16:03 +00:00
Taylor Holberton f0f8de6045 Fixed make build using clang 2018-11-28 16:43:17 -05: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
Taylor Holberton 4c5b155e32 Added -fPIC and -pie flags to utility builds 2018-10-30 12:17:33 -04:00
Taylor Holberton 311902aabf Merge pull request #115 from mgaio/fix/pcm_link
Fix/pcm link
2018-07-20 18:13:30 -07: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
Taylor Holberton 3e0e282ca8 Merge pull request #112 from charleskeepax/master
Minor tweaks to enum controls
2018-05-08 19:44:27 -04:00
Charles Keepax 6e0afd9ac6 Update output format for enumerated controls
The current format of the data printed for enumeration controls is to
list all the control values with no separator between them and to place
a comma before the currently selected value. This format is hard to
parse as a human and very difficult to parse automatically. Change this
to separate individual values with a comma and mark the selected value
with a right angle bracket.

For example, the following output is given for the "AEC Loopback"
control on one of our CODECs:

HPOUT1LHPOUT1R, SPKOUTSPKDATLSPKDATR

After the change this becomes:

HPOUT1L, HPOUT1R, > SPKOUT, SPKDATL, SPKDATR,

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
2018-04-11 15:57:52 +01:00
Charles Keepax 4f9ee772c5 Pull mixer_ctl_get_value out of loop in tinymix_print_enum
It is only required to obtain the value of the control once whilst
processing tinymix_print_enum. This will significantly reduce the amount
of IOCTLs sent for reading an enum control.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
2018-04-11 15:54:58 +01: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
Taylor Holberton 134500534e Merge pull request #111 from mgaio/topic/fix-pcm_readi
Fix pcm_writei return value if pcm is in not running state.
2018-04-10 06:21:41 -04:00