Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / sound / hdspm.h
1 #ifndef __SOUND_HDSPM_H
2 #define __SOUND_HDSPM_H
3 /*
4 * Copyright (C) 2003 Winfried Ritsch (IEM)
5 * based on hdsp.h from Thomas Charbonnel (thomas@undata.org)
6 *
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 /* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
24 #define HDSPM_MAX_CHANNELS 64
25
26 /* -------------------- IOCTL Peak/RMS Meters -------------------- */
27
28 /* peam rms level structure like we get from hardware
29
30 maybe in future we can memory map it so I just copy it
31 to user on ioctl call now an dont change anything
32 rms are made out of low and high values
33 where (long) ????_rms = (????_rms_l >> 8) + ((????_rms_h & 0xFFFFFF00)<<24)
34 (i asume so from the code)
35 */
36
37 struct hdspm_peak_rms {
38
39 unsigned int level_offset[1024];
40
41 unsigned int input_peak[64];
42 unsigned int playback_peak[64];
43 unsigned int output_peak[64];
44 unsigned int xxx_peak[64]; /* not used */
45
46 unsigned int reserved[256]; /* not used */
47
48 unsigned int input_rms_l[64];
49 unsigned int playback_rms_l[64];
50 unsigned int output_rms_l[64];
51 unsigned int xxx_rms_l[64]; /* not used */
52
53 unsigned int input_rms_h[64];
54 unsigned int playback_rms_h[64];
55 unsigned int output_rms_h[64];
56 unsigned int xxx_rms_h[64]; /* not used */
57 };
58
59 struct hdspm_peak_rms_ioctl {
60 struct hdspm_peak_rms *peak;
61 };
62
63 /* use indirect access due to the limit of ioctl bit size */
64 #define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \
65 _IOR('H', 0x40, struct hdspm_peak_rms_ioctl)
66
67 /* ------------ CONFIG block IOCTL ---------------------- */
68
69 struct hdspm_config_info {
70 unsigned char pref_sync_ref;
71 unsigned char wordclock_sync_check;
72 unsigned char madi_sync_check;
73 unsigned int system_sample_rate;
74 unsigned int autosync_sample_rate;
75 unsigned char system_clock_mode;
76 unsigned char clock_source;
77 unsigned char autosync_ref;
78 unsigned char line_out;
79 unsigned int passthru;
80 unsigned int analog_out;
81 };
82
83 #define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO \
84 _IOR('H', 0x41, struct hdspm_config_info)
85
86
87 /* get Soundcard Version */
88
89 struct hdspm_version {
90 unsigned short firmware_rev;
91 };
92
93 #define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdspm_version)
94
95
96 /* ------------- get Matrix Mixer IOCTL --------------- */
97
98 /* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte =
99 * 32768 Bytes
100 */
101
102 /* organisation is 64 channelfader in a continous memory block */
103 /* equivalent to hardware definition, maybe for future feature of mmap of
104 * them
105 */
106 /* each of 64 outputs has 64 infader and 64 outfader:
107 Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */
108
109 #define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
110
111 struct hdspm_channelfader {
112 unsigned int in[HDSPM_MIXER_CHANNELS];
113 unsigned int pb[HDSPM_MIXER_CHANNELS];
114 };
115
116 struct hdspm_mixer {
117 struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS];
118 };
119
120 struct hdspm_mixer_ioctl {
121 struct hdspm_mixer *mixer;
122 };
123
124 /* use indirect access due to the limit of ioctl bit size */
125 #define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
126
127 /* typedefs for compatibility to user-space */
128 typedef struct hdspm_peak_rms hdspm_peak_rms_t;
129 typedef struct hdspm_config_info hdspm_config_info_t;
130 typedef struct hdspm_version hdspm_version_t;
131 typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
132 typedef struct hdspm_mixer hdspm_mixer_t;
133
134 #endif /* __SOUND_HDSPM_H */