aboutsummaryrefslogtreecommitdiff
path: root/mixer.c
AgeCommit message (Collapse)Author
2016-09-16Merge branch 'address-duplicate-control-names' of ↵Taylor Holberton
https://github.com/dawagner/tinyalsa into dawagner-address-duplicate-control-names
2016-09-16Merge pull request #74 from dimkr/masterTaylor Holberton
include time.h, to prevent use of struct timespec before definition
2016-04-22mixer: check for overflow and NULL returnBen Zhang
Signed-off-by: Ben Zhang <benzh@google.com>
2016-03-05include time.h, to prevent use of struct timespec before definitionDima Krasner
In some old (2.6.32.x) kernel headers, asound.h does not include linux time.h when __KERNEL__ is undefined, which may break userspace. The build failures caused by this are similar to those fixed by c8333f8c. Signed-off-by: Dima Krasner <dima@dimakrasner.com>
2016-01-24mixer: fix possible null pointer dereferenceSvyatoslav Mishyn
2015-10-20mixer: remove separate info listRichard Fitzgerald
Each mixer_ctl has an associated snd_ctl_elem_info, which was kept in a separate array with pointers from the mixer_ctl to its corresponding snd_ctl_elem_info. This means double pointer dereferences when looking up the info. It also means extra work to add support for extending the arrays to include dynamically added controls because the pointers from the ctl array to the info array would have to be updated. This patch removes the info list and gives each mixer_ctl struct its own local snd_ctl_elem_info, removing the additional pointer dereferencing. Change-Id: I03f7d411afd9e37f58b984584712fee64d85ef4e Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
2015-09-15Merge pull request #52 from rfvirgil/get_idSimon Wilson
mixer: Add mixer_ctl_get_id
2015-05-04mixer: add support for TLV based byte controlsMythri P K
Add tinyasla support for bytes controls with TLV type Signed-off-by: Mythri P K <mythri.p.k@intel.com> Signed-off-by: Samreen Nilofer <samreen.nilofer@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-09-09mixer: Add mixer_ctl_get_idRichard Fitzgerald
Add a function to get an id of a control that can be passed to mixer_get_ctl(). This can be used to lookup a control by name and store its id for later use rather than have the overhead of name lookup each time it is used. Lookup by id is quick and avoids the disadvantage that storing a pointer to the mixer_ctl object creates a client with a dependency on the address of the internal control array. Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
2014-09-04Merge pull request #50 from charleskeepax/masterSimon Wilson
Revert "mixer: Control input value in mixer_ctl_set_value"
2014-08-18Revert "mixer: Control input value in mixer_ctl_set_value"Charles Keepax
This reverts commit 0e07647e4b9c52bb5f3766f9564ed38b6030e556. This commit disables reporting of an error when somebody requests an out of range value from a control which seems like a bad goal to start with, if something invalid is requested we should return an error not set things to the nearest valid state. Secondly since mixer_ctl_get_range_max returns an error for all control types except TYPE_INTEGER, all controls that are not integers will be set to -EINVAL with this patch included. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
2014-08-12tinyalsa: unable to set BYTE mixerDavid.Coutherut
tinyalsa set mixer function didn't support BYTE element type Add BYTE element type support Change-Id: I95d1d82150805f16cc5103bac9c9c9500210bbbf Signed-off-by: David Coutherut <davidx.coutherut@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-08-12Tinyalsa: standardize error message for wrong input valueBaptiste Robert
Currently, if a user sets a mixer with a percentage value greater than the maximum, tinyalsa does not inform the user about this "error" and silently replaces the user's value by the maximum. However, if a user sets a mixer with an integer value greater than the maximum, tinyalsa informs the user with an error. This patch purpose is to define the same behaviour in both quoted cases: user is informed through an error. Change-Id: I79547758266d1eb08a65d7b1355ec9859f3b27bb Signed-off-by: Baptiste Robert <baptistex.robert@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-05-06Mixer: Check validity of input valueBaptiste Robert
When the user wants to set a mixer with a value greater than the maximum or smaller than the minimum, the mixer is set at an undefined value. This patch set purpose is to return a error if the input value is out of range. Signed-off-by: Baptiste Robert <baptistex.robert@intel.com> Signed-off-by: David Wagner <david.wagner@intel.com> Author-Tracking-BZ: 129089
2014-05-06mixer: Control input value in mixer_ctl_set_valueAndroidict
When user want to set a mixer control with a value out of range, the mixer control will be set at its maximum
2014-04-22Add a function to disambiguate duplicate control namesFrédéric Boisnard
Control names are not unique and can be shared by multiple mixers controls. When this happens, there is no way of accessing the mixer using its control name, because mixer_get_ctl_by_name() always returns the first match. The only way of accessing the mixer is through its control number, i.e. using mixer_get_ctl(). This patch adds the function mixer_get_ctl_by_name_and_index() to offer the possibility to retrieve a control through its name and index. This index corresponds to the nth occurence of the control name in the global supported controls names list. Change-Id: Ie29bf2a949ecf69f106bbe359155cdbfbe98928c Signed-off-by: Frédéric Boisnard <fredericx.boisnard@intel.com> Signed-off-by: David Wagner <david.wagner@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com> Signed-off-by: Jack Ren <jack.ren@intel.com> Author-Tracking-BZ: 139255
2013-06-28mixer: add mixer_get_name() APISimon Wilson
2013-06-28mixer: add mixer_ctl_update() APISimon Wilson
Some sound cards update their controls due to external events, such as HDMI EDID byte data changing when an HDMI cable is connected. This API allows the count of elements to be updated.
2013-05-07mixer: add get/set_array APISimon Wilson
This replaces (and extends) the existing get/set_bytes API, which is no longer required.
2012-10-24mixer: Add mixer_ctl_{set,get}_bytes()Dimitris Papastamos
For binary controls we don't want to go through mixer_ctl_{set,get}_value() as that will trigger many calls to our get()/put() callback in the kernel. Set the entire payload at once and trigger the get()/put() callback once. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
2012-10-22Fix several 'symbol defined but not used' warnings.Gabriel M. Beddingfield
2012-05-04mixer: add missing include for sys/ioctl.hSimon Wilson
2012-03-08mixer: remove redundant IOCTL_ELEM_READsSimon Wilson
2012-03-08mixer: simplify string get APIsSimon Wilson
Just like the pcm_get_error() API, simplify the mixer API functions to return pointers to constant strings instead of making copies of strings.
2011-10-27mixer: show BYTE controlsPierre-Louis Bossart
Use existing routines to read BYTE controls. Somewhat inefficient since an ioctl is done for every byte, some caching in intermediate fields would be beneficial.
2011-06-07mixer: make error handling more consistentSimon Wilson
Remove the use of the errno variable and instead return errors directly where appropriate.
2011-06-07Fix error cases and some spurious whitespaceSimon Wilson
2011-06-06Add integer range getters to mixerSimon Wilson
2011-06-05Implement mixer setting in tinymixSimon Wilson
- re-add function to set enum type by string - implement setting of mixer values in tinymix - fix bug: read current mixer values before writing
2011-06-05Add enum support to mixerSimon Wilson
- simplify interface for setting/getting enum values - implement enum string get function - update tinymix to deal with enums - rename set/get_int functions because of supported types
2011-06-04Improve mixer supportSimon Wilson
- support get/set of multiple values - add parameter checking to functions - add api function to get control type - add tinymix utility to list mixer controls
2011-06-02Support multiple cards and devicesSimon Wilson
2011-05-26mixer: implement mixer_ctl_set/get_int functionsSimon Wilson
2011-05-25Initial contributionSimon Wilson