xref: /aosp_15_r20/external/tinyalsa/mixer_io.h (revision d0c94b832dfb3062bf15d9baaf64123fc670b06c)
1*d0c94b83SXin Li /* mixer_io.h
2*d0c94b83SXin Li **
3*d0c94b83SXin Li ** Copyright (c) 2019, The Linux Foundation. All rights reserved.
4*d0c94b83SXin Li **
5*d0c94b83SXin Li ** Redistribution and use in source and binary forms, with or without
6*d0c94b83SXin Li ** modification, are permitted provided that the following conditions are
7*d0c94b83SXin Li ** met:
8*d0c94b83SXin Li **   * Redistributions of source code must retain the above copyright
9*d0c94b83SXin Li **     notice, this list of conditions and the following disclaimer.
10*d0c94b83SXin Li **   * Redistributions in binary form must reproduce the above
11*d0c94b83SXin Li **     copyright notice, this list of conditions and the following
12*d0c94b83SXin Li **     disclaimer in the documentation and/or other materials provided
13*d0c94b83SXin Li **     with the distribution.
14*d0c94b83SXin Li **   * Neither the name of The Linux Foundation nor the names of its
15*d0c94b83SXin Li **     contributors may be used to endorse or promote products derived
16*d0c94b83SXin Li **     from this software without specific prior written permission.
17*d0c94b83SXin Li **
18*d0c94b83SXin Li ** THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
19*d0c94b83SXin Li ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20*d0c94b83SXin Li ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
21*d0c94b83SXin Li ** ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22*d0c94b83SXin Li ** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23*d0c94b83SXin Li ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24*d0c94b83SXin Li ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
25*d0c94b83SXin Li ** BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26*d0c94b83SXin Li ** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27*d0c94b83SXin Li ** OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
28*d0c94b83SXin Li ** IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29*d0c94b83SXin Li **/
30*d0c94b83SXin Li 
31*d0c94b83SXin Li #ifndef __MIXER_H__
32*d0c94b83SXin Li #define __MIXER_H__
33*d0c94b83SXin Li 
34*d0c94b83SXin Li #include <stdio.h>
35*d0c94b83SXin Li #include <stdlib.h>
36*d0c94b83SXin Li #include <sound/asound.h>
37*d0c94b83SXin Li 
38*d0c94b83SXin Li struct mixer_ops;
39*d0c94b83SXin Li 
40*d0c94b83SXin Li int mixer_hw_open(unsigned int card, void **data,
41*d0c94b83SXin Li                   struct mixer_ops **ops);
42*d0c94b83SXin Li int mixer_plugin_open(unsigned int card, void **data,
43*d0c94b83SXin Li                       struct mixer_ops **ops);
44*d0c94b83SXin Li 
45*d0c94b83SXin Li struct mixer_ops {
46*d0c94b83SXin Li     void (*close) (void *data);
47*d0c94b83SXin Li     int (*get_poll_fd) (void *data, struct pollfd *pfd, int count);
48*d0c94b83SXin Li     ssize_t (*read_event) (void *data, struct snd_ctl_event *ev, size_t size);
49*d0c94b83SXin Li     int (*ioctl) (void *data, unsigned int cmd, ...);
50*d0c94b83SXin Li };
51*d0c94b83SXin Li 
52*d0c94b83SXin Li #endif /* end of __MIXER_H__ */
53