Greg Kroah-Hartman | e2be04c | 2017-11-01 15:09:13 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ |
Takashi Iwai | ef5fa1a | 2007-07-27 16:52:46 +0200 | [diff] [blame] | 2 | #ifndef __SOUND_HDSPM_H |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 3 | #define __SOUND_HDSPM_H |
| 4 | /* |
| 5 | * Copyright (C) 2003 Winfried Ritsch (IEM) |
| 6 | * based on hdsp.h from Thomas Charbonnel (thomas@undata.org) |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 7 | * |
| 8 | * |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 22 | */ |
| 23 | |
Mikko Rapeli | 76a3aea | 2015-02-17 00:05:27 +0100 | [diff] [blame] | 24 | #include <linux/types.h> |
Mikko Rapeli | 76a3aea | 2015-02-17 00:05:27 +0100 | [diff] [blame] | 25 | |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 26 | /* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ |
| 27 | #define HDSPM_MAX_CHANNELS 64 |
| 28 | |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 29 | enum hdspm_io_type { |
| 30 | MADI, |
| 31 | MADIface, |
| 32 | AIO, |
| 33 | AES32, |
| 34 | RayDAT |
| 35 | }; |
| 36 | |
| 37 | enum hdspm_speed { |
| 38 | ss, |
| 39 | ds, |
| 40 | qs |
| 41 | }; |
| 42 | |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 43 | /* -------------------- IOCTL Peak/RMS Meters -------------------- */ |
| 44 | |
Takashi Iwai | 98274f0 | 2005-11-17 14:52:34 +0100 | [diff] [blame] | 45 | struct hdspm_peak_rms { |
Mikko Rapeli | ffc287c | 2015-10-15 07:56:06 +0200 | [diff] [blame] | 46 | __u32 input_peaks[64]; |
| 47 | __u32 playback_peaks[64]; |
| 48 | __u32 output_peaks[64]; |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 49 | |
Mikko Rapeli | ffc287c | 2015-10-15 07:56:06 +0200 | [diff] [blame] | 50 | __u64 input_rms[64]; |
| 51 | __u64 playback_rms[64]; |
| 52 | __u64 output_rms[64]; |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 53 | |
Mikko Rapeli | ffc287c | 2015-10-15 07:56:06 +0200 | [diff] [blame] | 54 | __u8 speed; /* enum {ss, ds, qs} */ |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 55 | int status2; |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 56 | }; |
| 57 | |
Takashi Iwai | ef5fa1a | 2007-07-27 16:52:46 +0200 | [diff] [blame] | 58 | #define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \ |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 59 | _IOR('H', 0x42, struct hdspm_peak_rms) |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 60 | |
| 61 | /* ------------ CONFIG block IOCTL ---------------------- */ |
| 62 | |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 63 | struct hdspm_config { |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 64 | unsigned char pref_sync_ref; |
| 65 | unsigned char wordclock_sync_check; |
| 66 | unsigned char madi_sync_check; |
| 67 | unsigned int system_sample_rate; |
| 68 | unsigned int autosync_sample_rate; |
| 69 | unsigned char system_clock_mode; |
| 70 | unsigned char clock_source; |
| 71 | unsigned char autosync_ref; |
| 72 | unsigned char line_out; |
| 73 | unsigned int passthru; |
| 74 | unsigned int analog_out; |
| 75 | }; |
| 76 | |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 77 | #define SNDRV_HDSPM_IOCTL_GET_CONFIG \ |
| 78 | _IOR('H', 0x41, struct hdspm_config) |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 79 | |
Takashi Iwai | ddcecf6 | 2014-11-10 17:24:26 +0100 | [diff] [blame] | 80 | /* |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 81 | * If there's a TCO (TimeCode Option) board installed, |
| 82 | * there are further options and status data available. |
| 83 | * The hdspm_ltc structure contains the current SMPTE |
| 84 | * timecode and some status information and can be |
| 85 | * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the |
| 86 | * hdspm_status struct. |
Takashi Iwai | ddcecf6 | 2014-11-10 17:24:26 +0100 | [diff] [blame] | 87 | */ |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 88 | |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 89 | enum hdspm_ltc_format { |
| 90 | format_invalid, |
| 91 | fps_24, |
| 92 | fps_25, |
| 93 | fps_2997, |
| 94 | fps_30 |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 95 | }; |
| 96 | |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 97 | enum hdspm_ltc_frame { |
| 98 | frame_invalid, |
| 99 | drop_frame, |
| 100 | full_frame |
| 101 | }; |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 102 | |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 103 | enum hdspm_ltc_input_format { |
| 104 | ntsc, |
| 105 | pal, |
| 106 | no_video |
| 107 | }; |
| 108 | |
| 109 | struct hdspm_ltc { |
| 110 | unsigned int ltc; |
| 111 | |
| 112 | enum hdspm_ltc_format format; |
| 113 | enum hdspm_ltc_frame frame; |
| 114 | enum hdspm_ltc_input_format input_format; |
| 115 | }; |
| 116 | |
Adrian Knoth | b43dd41 | 2013-08-19 17:20:32 +0200 | [diff] [blame] | 117 | #define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc) |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 118 | |
Takashi Iwai | ddcecf6 | 2014-11-10 17:24:26 +0100 | [diff] [blame] | 119 | /* |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 120 | * The status data reflects the device's current state |
| 121 | * as determined by the card's configuration and |
| 122 | * connection status. |
Takashi Iwai | ddcecf6 | 2014-11-10 17:24:26 +0100 | [diff] [blame] | 123 | */ |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 124 | |
| 125 | enum hdspm_sync { |
| 126 | hdspm_sync_no_lock = 0, |
| 127 | hdspm_sync_lock = 1, |
| 128 | hdspm_sync_sync = 2 |
| 129 | }; |
| 130 | |
| 131 | enum hdspm_madi_input { |
| 132 | hdspm_input_optical = 0, |
| 133 | hdspm_input_coax = 1 |
| 134 | }; |
| 135 | |
| 136 | enum hdspm_madi_channel_format { |
| 137 | hdspm_format_ch_64 = 0, |
| 138 | hdspm_format_ch_56 = 1 |
| 139 | }; |
| 140 | |
| 141 | enum hdspm_madi_frame_format { |
| 142 | hdspm_frame_48 = 0, |
| 143 | hdspm_frame_96 = 1 |
| 144 | }; |
| 145 | |
| 146 | enum hdspm_syncsource { |
| 147 | syncsource_wc = 0, |
| 148 | syncsource_madi = 1, |
| 149 | syncsource_tco = 2, |
| 150 | syncsource_sync = 3, |
| 151 | syncsource_none = 4 |
| 152 | }; |
| 153 | |
| 154 | struct hdspm_status { |
Mikko Rapeli | ffc287c | 2015-10-15 07:56:06 +0200 | [diff] [blame] | 155 | __u8 card_type; /* enum hdspm_io_type */ |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 156 | enum hdspm_syncsource autosync_source; |
| 157 | |
Mikko Rapeli | ffc287c | 2015-10-15 07:56:06 +0200 | [diff] [blame] | 158 | __u64 card_clock; |
| 159 | __u32 master_period; |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 160 | |
| 161 | union { |
| 162 | struct { |
Mikko Rapeli | ffc287c | 2015-10-15 07:56:06 +0200 | [diff] [blame] | 163 | __u8 sync_wc; /* enum hdspm_sync */ |
| 164 | __u8 sync_madi; /* enum hdspm_sync */ |
| 165 | __u8 sync_tco; /* enum hdspm_sync */ |
| 166 | __u8 sync_in; /* enum hdspm_sync */ |
| 167 | __u8 madi_input; /* enum hdspm_madi_input */ |
| 168 | __u8 channel_format; /* enum hdspm_madi_channel_format */ |
| 169 | __u8 frame_format; /* enum hdspm_madi_frame_format */ |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 170 | } madi; |
| 171 | } card_specific; |
| 172 | }; |
| 173 | |
| 174 | #define SNDRV_HDSPM_IOCTL_GET_STATUS \ |
| 175 | _IOR('H', 0x47, struct hdspm_status) |
| 176 | |
Takashi Iwai | ddcecf6 | 2014-11-10 17:24:26 +0100 | [diff] [blame] | 177 | /* |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 178 | * Get information about the card and its add-ons. |
Takashi Iwai | ddcecf6 | 2014-11-10 17:24:26 +0100 | [diff] [blame] | 179 | */ |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 180 | |
| 181 | #define HDSPM_ADDON_TCO 1 |
| 182 | |
| 183 | struct hdspm_version { |
Mikko Rapeli | ffc287c | 2015-10-15 07:56:06 +0200 | [diff] [blame] | 184 | __u8 card_type; /* enum hdspm_io_type */ |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 185 | char cardname[20]; |
| 186 | unsigned int serial; |
| 187 | unsigned short firmware_rev; |
| 188 | int addons; |
| 189 | }; |
| 190 | |
| 191 | #define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version) |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 192 | |
| 193 | /* ------------- get Matrix Mixer IOCTL --------------- */ |
| 194 | |
Takashi Iwai | ef5fa1a | 2007-07-27 16:52:46 +0200 | [diff] [blame] | 195 | /* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte = |
| 196 | * 32768 Bytes |
| 197 | */ |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 198 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 199 | /* organisation is 64 channelfader in a continuous memory block */ |
Takashi Iwai | ef5fa1a | 2007-07-27 16:52:46 +0200 | [diff] [blame] | 200 | /* equivalent to hardware definition, maybe for future feature of mmap of |
| 201 | * them |
| 202 | */ |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 203 | /* each of 64 outputs has 64 infader and 64 outfader: |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 204 | Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ |
| 205 | |
| 206 | #define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS |
| 207 | |
Takashi Iwai | 98274f0 | 2005-11-17 14:52:34 +0100 | [diff] [blame] | 208 | struct hdspm_channelfader { |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 209 | unsigned int in[HDSPM_MIXER_CHANNELS]; |
| 210 | unsigned int pb[HDSPM_MIXER_CHANNELS]; |
| 211 | }; |
| 212 | |
Takashi Iwai | 98274f0 | 2005-11-17 14:52:34 +0100 | [diff] [blame] | 213 | struct hdspm_mixer { |
| 214 | struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS]; |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 215 | }; |
| 216 | |
Takashi Iwai | 98274f0 | 2005-11-17 14:52:34 +0100 | [diff] [blame] | 217 | struct hdspm_mixer_ioctl { |
| 218 | struct hdspm_mixer *mixer; |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 219 | }; |
| 220 | |
| 221 | /* use indirect access due to the limit of ioctl bit size */ |
Takashi Iwai | 98274f0 | 2005-11-17 14:52:34 +0100 | [diff] [blame] | 222 | #define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) |
| 223 | |
| 224 | /* typedefs for compatibility to user-space */ |
| 225 | typedef struct hdspm_peak_rms hdspm_peak_rms_t; |
| 226 | typedef struct hdspm_config_info hdspm_config_info_t; |
| 227 | typedef struct hdspm_version hdspm_version_t; |
| 228 | typedef struct hdspm_channelfader snd_hdspm_channelfader_t; |
| 229 | typedef struct hdspm_mixer hdspm_mixer_t; |
Takashi Iwai | 763f356 | 2005-06-03 11:25:34 +0200 | [diff] [blame] | 230 | |
Adrian Knoth | 0dca179 | 2011-01-26 19:32:14 +0100 | [diff] [blame] | 231 | |
| 232 | #endif |