aboutsummaryrefslogtreecommitdiff
path: root/src/mixer.c
AgeCommit message (Collapse)Author
2023-09-04mixer: add support for pcm device specific mixer controlsRohit kumar
Mixer control such as "Playback channel map" can be registered by multiple pcm device nodes and is distinguished by device in snd_ctl_elem_id. Add support to get the control handle associated with mixer ctl name and device number. Also, introduce API to get the device number associated with specific mixer_ctl handle.
2022-01-11include time.h before asound.hFabrice Fontaine
Include time.h before asound.h to avoid the following build failure on musl that was already fixed a long time with https://github.com/tinyalsa/tinyalsa/commit/c8333f8c7a4e4b9549abeef7530b2cd20a18e537 but reappeared on version 2.0.0: In file included from ../src/pcm_hw.c:42: /home/peko/autobuild/instance-1/output-1/host/i586-buildroot-linux-musl/sysroot/usr/include/sound/asound.h:444:18: error: field 'trigger_tstamp' has incomplete type 444 | struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ | ^~~~~~~~~~~~~~ Fixes: - http://autobuild.buildroot.org/results/a75e23dc585bd071f4d65face5489ed6ac22edbe Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2021-12-15add ioctl to read IEC958 datadvdli
2021-11-02mixer: fix index underflow when index=0Caleb Connolly
In mixer_get_ctl_by_name_and_index(), the post-fix decrement means that the index will be decremented after the comparison, but before the return, leading to an unsigned integer underflow. This causes a crash on platforms with -fsanitize=integer enabled. Fix this by avoiding decrementing index until after the return. Change-Id: I25a17ced4185bdebd500285bd30b342b16b4ac12
2021-05-19remove range checking in mixer_ctl_set_valuedvdli
There are some drivers assigning wrong ranges of mixer control's values. Let ALSA drivers to check whether values are in ranges.
2021-05-19refine null parameters checking and add a unit test casedvdli
2020-12-02fix build breakageDavid Li
1. Add a missing field and a function 2. Disable the deprecated attribute in Android temporarily to allow us to use "pcm_read/write" which are deprecated upstream 3. Remove an unused define and an include in mixer.h 4. Add mixer_ctl_event and copy the snd_ctl_event to mixer_ctl_event 5. Add pcm_ioctl function and mark as deprecated function
2020-10-28AOSP CL "tinyalsa: channel status set as per IEC958"dvdli
https://android.googlesource.com/platform/external/tinyalsa/+/49a61374fc18a0f39da0d9c11cc9ccc3e9c1ec3f commit 49a61374fc18a0f39da0d9c11cc9ccc3e9c1ec3f author Yogesh Agrawal <yagrawal@nvidia.com> tinyalsa: channel status set as per IEC958 Add support for modifying the IEC958 structure in a mixer_ctl. Bug: 9428304 Bug: 22576112 Change-Id: I8982340da9403a8a9e36b389fc97e9c635a9f681
2020-09-04mixer: Fix invalid size check in mixer_ctl_set/get_arrayRohit kumar
For TLV based mixer controls, mixer_ctl_set/get_array adds TLV headers in the API itself. Size check for count need not include tlv header size addition. Remove it to fix size check.
2020-06-03Fix memory leakTaylor Holberton
2020-06-02mixer: Fix memory leak and other issues in mixer eventRohit kumar
Fix memory leak in mixer_wait_event(). Also, poll should be unblocked after increasing event_cnt in mixer_plugin, otherwise event_cnt can become negative during read_event. Fix the same.
2020-06-02mixer: Add plugin support for mixer_consume/read_eventRohit kumar
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-02tinyalsa: add mixer_consume_eventAndrew Chant
mixer_consume_event consumes subscribed events from the mixer in order to allow monitoring of mixer control value changed.
2020-02-07tinyalsa: add support for mixer pluginsBhalchandra Gajare
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>
2019-04-12Fix integer division issue in int_to_percent functionDaniela-Marinela Bistrean
Changed order of operations to preserve the precision during the division.
2018-11-28Checking for definition of __bitwise, __force, __userTaylor Holberton
2018-04-11Fixup some minor code formatting issuesCharles Keepax
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
2017-01-11Fix mixer_wait_event function commentsPankaj Bharadiya
The @return comment description incorrect. Fix it. Change-Id: I148a5ebf3e05eb4824beb4c8fa1032a38272d86d Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
2017-01-11Tinyalsa: Add support to poll on alsa controlPankaj Bharadiya
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-10Fix the byte control set/get methodPankaj Bharadiya
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-10mixer: Add support for TLV RW access check apiPankaj Bharadiya
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>
2016-12-02mixer: add ability to update control list with new controlsRichard Fitzgerald
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-01Added function, mixer_get_num_ctls_by_nameTaylor Holberton
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-01Added mixer_get_ctl_constTaylor Holberton
This function was added to make available a mixer control accessor in a function that does not modify its value.
2016-12-01Added const specifier for several mixer functionsTaylor Holberton
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-11-23added mixer ctl member documentationTaylor Holberton
2016-11-23finished mixer API documentationTaylor Holberton
2016-11-19added some documentationTaylor Holberton
2016-11-19renamed doxygen group, tinyalsa-mixer to libtinyalsa-mixerTaylor Holberton
2016-10-05included only necessary headersRicardo Biehl Pasquali
If users want to use only pcm.c or mixer.c they can. It's not necessary to include tinyalsa/asoundlib.h because mixer.c doesn't use pcm.h and pcm.c doesn't use mixer.h.
2016-10-03Merge branch 'defer-enum-inspection' of https://github.com/dawagner/tinyalsa ↵Taylor Holberton
into dawagner-defer-enum-inspection
2016-10-01added some documentation to mixer interfaceTaylor Holberton
2016-10-01put source files into src dirTaylor Holberton