Commit Graph

96 Commits

Author SHA1 Message Date
dvdli 89063d25a8 AOSP CL "tinyalsa: fix typos in tinyplay and asoundlib.h"
commit	f451f433520fc154de6e371747f21d2f746da83b
author	Glenn Kasten <gkasten@google.com>

tinyalsa: fix typos in tinyplay and asoundlib.h

Test: run tinyplay and look for typos in the output
Change-Id: Ieedcc1b7610700aa3d5ff913d5c01105db2c1601
2020-10-29 15:32:35 +08:00
dvdli 0b906733f3 AOSP CL "pcm: add API for MMAP NO IRQ mode"
https://android.googlesource.com/platform/external/tinyalsa/+/5b15b4cbd9e779a4ecd87e0f757fb0f8f6b9bcb8

commit	5b15b4cbd9e779a4ecd87e0f757fb0f8f6b9bcb8
author	Eric Laurent <elaurent@google.com>

pcm: add API for MMAP NO IRQ mode

Bug: 33398120
Test: build
Change-Id: Iecb47f76337d98ceb01044ca488a04e1f350c6bc
2020-10-28 22:56:53 +08:00
dvdli 5fcee0c184 AOSP CL "Add pcm_get_poll_fd"
https://android.googlesource.com/platform/external/tinyalsa/+/b42510d55bafc96805a44bd6ac40faac28ebd219

commit	b42510d55bafc96805a44bd6ac40faac28ebd219
author	Dylan Reid <dgreid@chromium.org>

Add pcm_get_poll_fd

Similar to ALSA snd_pcm_get_poll_fd, this will allow a user to wait for
a sound device to have data in a poll(2) call.  The hotword thread will
use this to wait for a message on its socket or for audio data to become
ready.

Change-Id: I61375a73d7a842b00362fc707c12f99aa18e0bdf
Signed-off-by: Dylan Reid <dgreid@chromium.org>
2020-10-28 22:22:27 +08:00
dvdli 295e2fc9fd AOSP CL "Export pcm_mmap_avail"
https://android.googlesource.com/platform/external/tinyalsa/+/9074cfc4127cb841f0633b35895141f90da3f0d6

commit	9074cfc4127cb841f0633b35895141f90da3f0d6
author	Dylan Reid <dgreid@chromium.org>

Export pcm_mmap_avail

This is useful for timer based wakeups and for checking how much data
has been captured by a hotwording device.

Change-Id: I409201a5c9ce73abc807a9dd767beb3a32810f06
Signed-off-by: Dylan Reid <dgreid@chromium.org>
2020-10-28 22:18:40 +08:00
dvdli 8810a5d953 AOSP CL "pcm: add support to set silence_size"
https://android.googlesource.com/platform/external/tinyalsa/+/e25fe0b50ea717a9f347dcb927d396e8772e6362

commit	e25fe0b50ea717a9f347dcb927d396e8772e6362
author	Maneet Singh <mmaneetsingh@nvidia.com>

pcm: add support to set silence_size

Tinyalsa always set silence_size to zero. Add support to set this
pcm software parameter as required.

Bug: 20226809
Bug: 20300203
Change-Id: I25de43623dc04bf5a3ad4c6573bc2b8dad1eec5e
2020-10-28 17:37:19 +08:00
dvdli a6195345aa AOSP CL "Add pcm_params string conversion and format checking"
https://android.googlesource.com/platform/external/tinyalsa/+/70530a69767a9a383c5bf546e6e803aac08a5a1e%5E!/

title: Add pcm_params string conversion and format checking
commit	70530a69767a9a383c5bf546e6e803aac08a5a1e
author	Andy Hung <hunga@google.com>
2020-10-28 16:05:19 +08:00
Taylor Holberton 3cdc08926a Using struct for TLV size 2020-09-03 22:49:53 -05:00
Rohit kumar cebab3bf93 tinyalsa: add plugin support for mmap/poll ops 2020-09-03 11:29:44 +05:30
Rohit kumar eea9f9676e include: tinyalsa: Add PCM state macros
Add PCM_STATE_OPEN and PCM_STATE_SETUP macros so that
it can be utilized by plugin to update sync_ptr state.
2020-08-25 11:39:41 +05:30
Taylor Holberton a94cc40d34 Bump version to 2.0.0 TinyALSA 2020-08-05 08:06:50 -05:00
Taylor Holberton 67f1430fd0 Reordered enums to be compatible with Google's TinyALSA 2020-08-05 08:04:36 -05:00
Ethan Sommer a6fc680aeb include/tinyalsa/plugin.h: include time.h
Older versions of linux's API header sound/asound.h accidentally rely on
indirect declaration of struct timespec, which isn't reliable, so
include time.h before it to support older versions of sound/asound.h
properly
2020-06-05 17:18:44 -04:00
Rohit kumar 6b17eede02 mixer: Add plugin support for mixer_consume/read_event
snd_ctl_event is needed by client to get details of event received.
Introduce mixer_read_event() with plugin support to support this.
2020-06-02 12:31:17 +05:30
Andrew Chant eb89b17af8 tinyalsa: add mixer_consume_event
mixer_consume_event consumes subscribed events from the mixer
in order to allow monitoring of mixer control value changed.
2020-06-02 12:30:39 +05:30
Minecrell de025cac62 tinyalsa: include <sys/types.h> for ssize_t
ssize_t is defined in <sys/types.h>, see
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html

Add an include for it to avoid a compile error when building with musl:

../include/tinyalsa/plugin.h:184:5: error: expected specifier-qualifier-list before 'ssize_t'
  184 |     ssize_t (*read_event) (struct mixer_plugin *plugin,
      |     ^~~~~~~
2020-04-23 14:53:46 +02:00
Bhalchandra Gajare 26850f5435 tinyalsa: add support for mixer plugins
Update the mixer framework to support plugins. Add ability for physical
card to have either kernel registered mixer controls or plugin
registered mixer control or both. Split mixer controls into two groups,
one for kernel registered (hw_grp) and the other for plugin registered
(virtual_grp).

Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
2020-02-07 12:53:00 +05:30
Bhalchandra Gajare dcea636de0 tinyalsa: add support for PCM plugins
Update the pcm framework to support plugins. Resolve the pcm device node
to be either kernel device or virtual device and setup function pointers
accordingly. Implement framework functionality for pcm_plugin.c for ease
of plugin development. Plugin itself is compiled as shared object (.so)
and dynamically linked from pcm_plugin.c.

Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
2020-02-07 12:16:27 +05:30
Alexandru N. Onea 5879db0e35 Generate final version string and number based on major, minor and patch 2019-04-08 12:20:28 +03:00
Taylor Holberton 0178c72b88 Added the 'attributes.h' header 2019-01-13 13:10:47 -05: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
Taylor Holberton e6c9e35c11 Fixed some doxygen references. 2018-12-22 10:20:15 -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 093b87878b added PCM_NONBLOCK macro 2017-10-12 20:28:30 -04:00
Taylor Holberton 1770a22cf1 corrected tab usage 2017-10-12 20:17:29 -04:00
Baruch Siach 685e530d8a interval.h: add missing header
The ssize_t type requires the unistd.h header. This fixes build with musl
libc:

In file included from ../include/tinyalsa/limits.h:32:0,
                 from limits.c:1:
../include/tinyalsa/interval.h:38:2: error: unknown type name 'ssize_t'
  ssize_t max;
  ^

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
2017-06-02 12:24:35 +03:00
Taylor Holberton df11091086 bumped version 2017-05-23 21:23:57 -07:00
Taylor Holberton 04b47b0831 corrected set_config function 2017-04-10 12:36:15 -07:00
Taylor Holberton cad23d2482 added prototypes for _get_config() and _set_config() 2017-04-10 11:47:32 -07:00
Taylor Holberton d6e7e04edb added limits for frames and channels 2017-04-06 23:04:20 -07:00
Taylor Holberton f1080d3337 added interval structures 2017-04-06 23:04:06 -07:00
Taylor Holberton 5f9d22f568 removed stray tab 2017-04-06 22:21:46 -07:00
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
Pankaj Bharadiya 9698d03a63 mixer: Add support for TLV RW access check api
Tinyalsa doesn't expose an api to check TLV RW access

Add mixer_ctl_is_access_tlv_rw().

This api will get used by tinymix and audio HALs for checking TLV RW
access before managing the byte related mixer controls.

Change-Id: Ib5707fabf479de638e1c7abd4cd149e7637ff9c2
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
2017-01-10 13:50:39 +05:30
Ricardo Biehl Pasquali c848ea519f corrected (over/under)run definition in pcm.h
overrun is in capture and underrun is in playback.
Look:

'+' has data / '-' hasn't data

overrun (capture):

 You should have
 read until here
                v
        |+++++++|++     <- buffer over(run/flow)

underrun (playback):

 You should have
 written until here
                   v
           |+++++++|--  <- buffer under(run/flow)
2016-12-28 14:42:18 -02:00
Taylor Holberton c6f908ee87 Added pcm_open_by_name()
This function parses a PCM name similar to the ALSA library.
This is done so that the differences between alsa-lib and tinyalsa
are a little more transparent to the user.
2016-12-24 20:33:33 -08:00
Taylor Holberton 558e594ba2 Added pcm_link and pcm_unlink functions
The link function is necessary for time sychronization between multiple PCMs.
2016-12-04 13:42:28 -08:00
Richard Fitzgerald fd3290357e mixer: add ability to update control list with new controls
New controls could appear during runtime, for example if a
new firmware is downloaded to a DSP. Since ALSA drivers are
not supposed to delete or renumber existing controls we can
assume that any new controls will be after any controls we
already know about. We can use this to enable extending our
current list of controls, which is more efficient than
closing the mixer session and recreating it.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
2016-12-02 16:39:38 +00:00
Taylor Holberton ead42d87ff bumped minor version 2016-12-01 21:20:06 -08:00
Taylor Holberton d7b140a5d9 Using frame counts in pcm_readi and pcm_writei
pcm_readi and pcm_writei now use a frame count to specify the
buffer length instead of using a byte count.
2016-12-01 20:43:28 -08:00
Taylor Holberton f9834eef24 Added pcm_readi and pcm_writei functions
Added these functions to replace pcm_read and pcm_write, which don't return the number of frames actually transferred.

On GCC-like compilers, pcm_read and pcm_write have been marked as deprecated

On doxygen documentation, they have been marked as deprecated as well.
2016-12-01 20:25:41 -08:00
Taylor Holberton 77979a8855 Added format related getters for PCM
Added functions:
 - pcm_get_channels
 - pcm_get_rate
 - pcm_get_format

These were added since they're required for iterating samples and frames.
2016-12-01 20:04:04 -08:00
Taylor Holberton 94c7c83c01 Added function, mixer_get_num_ctls_by_name
This function is used to get the number of mixer controls by a given name.
It was added for use with mixer_get_ctl_by_name_and_index so that client code
can expect the last valid index to pass.
2016-12-01 18:35:24 -08:00
Taylor Holberton a94295b6cf Added mixer_get_ctl_const
This function was added to make available a mixer control accessor
in a function that does not modify its value.
2016-12-01 18:23:16 -08:00
Taylor Holberton cac43a208d Added const specifier for several mixer functions
Functions changed are:
 - mixer_get_name
 - mixer_get_num_ctls
 - mixer_ctl_get_id
 - mixer_ctl_get_name
 - mixer_ctl_get_type
 - mixer_ctl_get_type_string
 - mixer_ctl_get_num_values
 - mixer_ctl_get_num_enums
 - mixer_ctl_get_enum_string
 - mixer_ctl_get_percent
 - mixer_ctl_get_value
 - mixer_ctl_get_array
 - mixer_ctl_get_range_min
 - mixer_ctl_get_range_max
2016-12-01 18:11:24 -08:00
Taylor Holberton 147d7adec6 Added const specifier in several functions
pcm_get_file_descriptor
pcm_get_error
pcm_get_buffer_size
pcm_frames_to_bytes
pcm_bytes_to_frames
pcm_get_subdevice
2016-12-01 17:50:31 -08:00
Taylor Holberton 15d58481e7 added const specifier in function, pcm_is_ready 2016-12-01 17:46:29 -08:00
Taylor Holberton ba285cfbf4 Added const specifier in pcm_open
The const specifier was added to the struct pcm_config argument.
2016-12-01 16:06:29 -08:00
Taylor Holberton 5b9db5b888 Added const specifier to params functions
Funtions changed are:
 - pcm_params_get_mask
 - pcm_params_get_min
 - pcm_params_get_max
2016-12-01 15:57:09 -08:00
Taylor Holberton da1bc31c9c fixed function reference in doc 2016-11-23 13:18:34 -08:00