1/* include/linux/msm_audio.h
2 *
3 * Copyright (C) 2008 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef __LINUX_MSM_AUDIO_H
17#define __LINUX_MSM_AUDIO_H
18
19#include <linux/types.h>
20#include <linux/ioctl.h>
21#include <asm/sizes.h>
22
23/* PCM Audio */
24
25#define AUDIO_IOCTL_MAGIC 'a'
26
27#define AUDIO_START        _IOW(AUDIO_IOCTL_MAGIC, 0, unsigned)
28#define AUDIO_STOP         _IOW(AUDIO_IOCTL_MAGIC, 1, unsigned)
29#define AUDIO_FLUSH        _IOW(AUDIO_IOCTL_MAGIC, 2, unsigned)
30#define AUDIO_GET_CONFIG   _IOR(AUDIO_IOCTL_MAGIC, 3, unsigned)
31#define AUDIO_SET_CONFIG   _IOW(AUDIO_IOCTL_MAGIC, 4, unsigned)
32#define AUDIO_GET_STATS    _IOR(AUDIO_IOCTL_MAGIC, 5, unsigned)
33#define AUDIO_ENABLE_AUDPP _IOW(AUDIO_IOCTL_MAGIC, 6, unsigned)
34#define AUDIO_SET_ADRC     _IOW(AUDIO_IOCTL_MAGIC, 7, unsigned)
35#define AUDIO_SET_EQ       _IOW(AUDIO_IOCTL_MAGIC, 8, unsigned)
36#define AUDIO_SET_RX_IIR   _IOW(AUDIO_IOCTL_MAGIC, 9, unsigned)
37#define AUDIO_SET_VOLUME   _IOW(AUDIO_IOCTL_MAGIC, 10, unsigned)
38#define AUDIO_ENABLE_AUDPRE  _IOW(AUDIO_IOCTL_MAGIC, 11, unsigned)
39#define AUDIO_SET_AGC        _IOW(AUDIO_IOCTL_MAGIC, 12, unsigned)
40#define AUDIO_SET_NS         _IOW(AUDIO_IOCTL_MAGIC, 13, unsigned)
41#define AUDIO_SET_TX_IIR     _IOW(AUDIO_IOCTL_MAGIC, 14, unsigned)
42
43struct msm_audio_config {
44	uint32_t buffer_size;
45	uint32_t buffer_count;
46	uint32_t channel_count;
47	uint32_t sample_rate;
48	uint32_t type;
49	uint32_t unused[3];
50};
51
52struct msm_audio_stats {
53	uint32_t byte_count;
54	uint32_t sample_count;
55	uint32_t unused[2];
56};
57
58/* Audio routing */
59
60#define SND_IOCTL_MAGIC 's'
61
62#define SND_MUTE_UNMUTED 0
63#define SND_MUTE_MUTED   1
64
65struct msm_snd_device_config {
66	uint32_t device;
67	uint32_t ear_mute;
68	uint32_t mic_mute;
69};
70
71#define SND_SET_DEVICE _IOW(SND_IOCTL_MAGIC, 2, struct msm_device_config *)
72
73#define SND_METHOD_VOICE 0
74
75struct msm_snd_volume_config {
76	uint32_t device;
77	uint32_t method;
78	uint32_t volume;
79};
80
81#define SND_SET_VOLUME _IOW(SND_IOCTL_MAGIC, 3, struct msm_snd_volume_config *)
82
83/* Returns the number of SND endpoints supported. */
84
85#define SND_GET_NUM_ENDPOINTS _IOR(SND_IOCTL_MAGIC, 4, unsigned *)
86
87struct msm_snd_endpoint {
88	int id; /* input and output */
89	char name[64]; /* output only */
90};
91
92/* Takes an index between 0 and one less than the number returned by
93 * SND_GET_NUM_ENDPOINTS, and returns the SND index and name of a
94 * SND endpoint.  On input, the .id field contains the number of the
95 * endpoint, and on exit it contains the SND index, while .name contains
96 * the description of the endpoint.
97 */
98
99#define SND_GET_ENDPOINT _IOWR(SND_IOCTL_MAGIC, 5, struct msm_snd_endpoint *)
100
101#endif /* __LINUX_MSM_AUDIO_H */
102