1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2674e95caSDavid Howells #ifndef __SOUND_HDSPM_H 3674e95caSDavid Howells #define __SOUND_HDSPM_H 4674e95caSDavid Howells /* 5674e95caSDavid Howells * Copyright (C) 2003 Winfried Ritsch (IEM) 6674e95caSDavid Howells * based on hdsp.h from Thomas Charbonnel (thomas@undata.org) 7674e95caSDavid Howells * 8674e95caSDavid Howells * 9674e95caSDavid Howells * This program is free software; you can redistribute it and/or modify 10674e95caSDavid Howells * it under the terms of the GNU General Public License as published by 11674e95caSDavid Howells * the Free Software Foundation; either version 2 of the License, or 12674e95caSDavid Howells * (at your option) any later version. 13674e95caSDavid Howells * 14674e95caSDavid Howells * This program is distributed in the hope that it will be useful, 15674e95caSDavid Howells * but WITHOUT ANY WARRANTY; without even the implied warranty of 16674e95caSDavid Howells * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17674e95caSDavid Howells * GNU General Public License for more details. 18674e95caSDavid Howells * 19674e95caSDavid Howells * You should have received a copy of the GNU General Public License 20674e95caSDavid Howells * along with this program; if not, write to the Free Software 21674e95caSDavid Howells * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22674e95caSDavid Howells */ 23674e95caSDavid Howells 2476a3aeacSMikko Rapeli #include <linux/types.h> 2576a3aeacSMikko Rapeli 26674e95caSDavid Howells /* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ 27674e95caSDavid Howells #define HDSPM_MAX_CHANNELS 64 28674e95caSDavid Howells 29674e95caSDavid Howells enum hdspm_io_type { 30674e95caSDavid Howells MADI, 31674e95caSDavid Howells MADIface, 32674e95caSDavid Howells AIO, 33674e95caSDavid Howells AES32, 34674e95caSDavid Howells RayDAT 35674e95caSDavid Howells }; 36674e95caSDavid Howells 37674e95caSDavid Howells enum hdspm_speed { 38674e95caSDavid Howells ss, 39674e95caSDavid Howells ds, 40674e95caSDavid Howells qs 41674e95caSDavid Howells }; 42674e95caSDavid Howells 43674e95caSDavid Howells /* -------------------- IOCTL Peak/RMS Meters -------------------- */ 44674e95caSDavid Howells 45674e95caSDavid Howells struct hdspm_peak_rms { 46ffc287c8SMikko Rapeli __u32 input_peaks[64]; 47ffc287c8SMikko Rapeli __u32 playback_peaks[64]; 48ffc287c8SMikko Rapeli __u32 output_peaks[64]; 49674e95caSDavid Howells 50ffc287c8SMikko Rapeli __u64 input_rms[64]; 51ffc287c8SMikko Rapeli __u64 playback_rms[64]; 52ffc287c8SMikko Rapeli __u64 output_rms[64]; 53674e95caSDavid Howells 54ffc287c8SMikko Rapeli __u8 speed; /* enum {ss, ds, qs} */ 55674e95caSDavid Howells int status2; 56674e95caSDavid Howells }; 57674e95caSDavid Howells 58674e95caSDavid Howells #define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \ 59674e95caSDavid Howells _IOR('H', 0x42, struct hdspm_peak_rms) 60674e95caSDavid Howells 61674e95caSDavid Howells /* ------------ CONFIG block IOCTL ---------------------- */ 62674e95caSDavid Howells 63674e95caSDavid Howells struct hdspm_config { 64674e95caSDavid Howells unsigned char pref_sync_ref; 65674e95caSDavid Howells unsigned char wordclock_sync_check; 66674e95caSDavid Howells unsigned char madi_sync_check; 67674e95caSDavid Howells unsigned int system_sample_rate; 68674e95caSDavid Howells unsigned int autosync_sample_rate; 69674e95caSDavid Howells unsigned char system_clock_mode; 70674e95caSDavid Howells unsigned char clock_source; 71674e95caSDavid Howells unsigned char autosync_ref; 72674e95caSDavid Howells unsigned char line_out; 73674e95caSDavid Howells unsigned int passthru; 74674e95caSDavid Howells unsigned int analog_out; 75674e95caSDavid Howells }; 76674e95caSDavid Howells 77674e95caSDavid Howells #define SNDRV_HDSPM_IOCTL_GET_CONFIG \ 78674e95caSDavid Howells _IOR('H', 0x41, struct hdspm_config) 79674e95caSDavid Howells 80ddcecf6bSTakashi Iwai /* 81674e95caSDavid Howells * If there's a TCO (TimeCode Option) board installed, 82674e95caSDavid Howells * there are further options and status data available. 83674e95caSDavid Howells * The hdspm_ltc structure contains the current SMPTE 84674e95caSDavid Howells * timecode and some status information and can be 85674e95caSDavid Howells * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the 86674e95caSDavid Howells * hdspm_status struct. 87ddcecf6bSTakashi Iwai */ 88674e95caSDavid Howells 89674e95caSDavid Howells enum hdspm_ltc_format { 90674e95caSDavid Howells format_invalid, 91674e95caSDavid Howells fps_24, 92674e95caSDavid Howells fps_25, 93674e95caSDavid Howells fps_2997, 94674e95caSDavid Howells fps_30 95674e95caSDavid Howells }; 96674e95caSDavid Howells 97674e95caSDavid Howells enum hdspm_ltc_frame { 98674e95caSDavid Howells frame_invalid, 99674e95caSDavid Howells drop_frame, 100674e95caSDavid Howells full_frame 101674e95caSDavid Howells }; 102674e95caSDavid Howells 103674e95caSDavid Howells enum hdspm_ltc_input_format { 104674e95caSDavid Howells ntsc, 105674e95caSDavid Howells pal, 106674e95caSDavid Howells no_video 107674e95caSDavid Howells }; 108674e95caSDavid Howells 109674e95caSDavid Howells struct hdspm_ltc { 110674e95caSDavid Howells unsigned int ltc; 111674e95caSDavid Howells 112674e95caSDavid Howells enum hdspm_ltc_format format; 113674e95caSDavid Howells enum hdspm_ltc_frame frame; 114674e95caSDavid Howells enum hdspm_ltc_input_format input_format; 115674e95caSDavid Howells }; 116674e95caSDavid Howells 117b43dd416SAdrian Knoth #define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc) 118674e95caSDavid Howells 119ddcecf6bSTakashi Iwai /* 120674e95caSDavid Howells * The status data reflects the device's current state 121674e95caSDavid Howells * as determined by the card's configuration and 122674e95caSDavid Howells * connection status. 123ddcecf6bSTakashi Iwai */ 124674e95caSDavid Howells 125674e95caSDavid Howells enum hdspm_sync { 126674e95caSDavid Howells hdspm_sync_no_lock = 0, 127674e95caSDavid Howells hdspm_sync_lock = 1, 128674e95caSDavid Howells hdspm_sync_sync = 2 129674e95caSDavid Howells }; 130674e95caSDavid Howells 131674e95caSDavid Howells enum hdspm_madi_input { 132674e95caSDavid Howells hdspm_input_optical = 0, 133674e95caSDavid Howells hdspm_input_coax = 1 134674e95caSDavid Howells }; 135674e95caSDavid Howells 136674e95caSDavid Howells enum hdspm_madi_channel_format { 137674e95caSDavid Howells hdspm_format_ch_64 = 0, 138674e95caSDavid Howells hdspm_format_ch_56 = 1 139674e95caSDavid Howells }; 140674e95caSDavid Howells 141674e95caSDavid Howells enum hdspm_madi_frame_format { 142674e95caSDavid Howells hdspm_frame_48 = 0, 143674e95caSDavid Howells hdspm_frame_96 = 1 144674e95caSDavid Howells }; 145674e95caSDavid Howells 146674e95caSDavid Howells enum hdspm_syncsource { 147674e95caSDavid Howells syncsource_wc = 0, 148674e95caSDavid Howells syncsource_madi = 1, 149674e95caSDavid Howells syncsource_tco = 2, 150674e95caSDavid Howells syncsource_sync = 3, 151674e95caSDavid Howells syncsource_none = 4 152674e95caSDavid Howells }; 153674e95caSDavid Howells 154674e95caSDavid Howells struct hdspm_status { 155ffc287c8SMikko Rapeli __u8 card_type; /* enum hdspm_io_type */ 156674e95caSDavid Howells enum hdspm_syncsource autosync_source; 157674e95caSDavid Howells 158ffc287c8SMikko Rapeli __u64 card_clock; 159ffc287c8SMikko Rapeli __u32 master_period; 160674e95caSDavid Howells 161674e95caSDavid Howells union { 162674e95caSDavid Howells struct { 163ffc287c8SMikko Rapeli __u8 sync_wc; /* enum hdspm_sync */ 164ffc287c8SMikko Rapeli __u8 sync_madi; /* enum hdspm_sync */ 165ffc287c8SMikko Rapeli __u8 sync_tco; /* enum hdspm_sync */ 166ffc287c8SMikko Rapeli __u8 sync_in; /* enum hdspm_sync */ 167ffc287c8SMikko Rapeli __u8 madi_input; /* enum hdspm_madi_input */ 168ffc287c8SMikko Rapeli __u8 channel_format; /* enum hdspm_madi_channel_format */ 169ffc287c8SMikko Rapeli __u8 frame_format; /* enum hdspm_madi_frame_format */ 170674e95caSDavid Howells } madi; 171674e95caSDavid Howells } card_specific; 172674e95caSDavid Howells }; 173674e95caSDavid Howells 174674e95caSDavid Howells #define SNDRV_HDSPM_IOCTL_GET_STATUS \ 175674e95caSDavid Howells _IOR('H', 0x47, struct hdspm_status) 176674e95caSDavid Howells 177ddcecf6bSTakashi Iwai /* 178674e95caSDavid Howells * Get information about the card and its add-ons. 179ddcecf6bSTakashi Iwai */ 180674e95caSDavid Howells 181674e95caSDavid Howells #define HDSPM_ADDON_TCO 1 182674e95caSDavid Howells 183674e95caSDavid Howells struct hdspm_version { 184ffc287c8SMikko Rapeli __u8 card_type; /* enum hdspm_io_type */ 185674e95caSDavid Howells char cardname[20]; 186674e95caSDavid Howells unsigned int serial; 187674e95caSDavid Howells unsigned short firmware_rev; 188674e95caSDavid Howells int addons; 189674e95caSDavid Howells }; 190674e95caSDavid Howells 191674e95caSDavid Howells #define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version) 192674e95caSDavid Howells 193674e95caSDavid Howells /* ------------- get Matrix Mixer IOCTL --------------- */ 194674e95caSDavid Howells 195674e95caSDavid Howells /* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte = 196674e95caSDavid Howells * 32768 Bytes 197674e95caSDavid Howells */ 198674e95caSDavid Howells 199674e95caSDavid Howells /* organisation is 64 channelfader in a continuous memory block */ 200674e95caSDavid Howells /* equivalent to hardware definition, maybe for future feature of mmap of 201674e95caSDavid Howells * them 202674e95caSDavid Howells */ 203674e95caSDavid Howells /* each of 64 outputs has 64 infader and 64 outfader: 204674e95caSDavid Howells Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ 205674e95caSDavid Howells 206674e95caSDavid Howells #define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS 207674e95caSDavid Howells 208674e95caSDavid Howells struct hdspm_channelfader { 209674e95caSDavid Howells unsigned int in[HDSPM_MIXER_CHANNELS]; 210674e95caSDavid Howells unsigned int pb[HDSPM_MIXER_CHANNELS]; 211674e95caSDavid Howells }; 212674e95caSDavid Howells 213674e95caSDavid Howells struct hdspm_mixer { 214674e95caSDavid Howells struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS]; 215674e95caSDavid Howells }; 216674e95caSDavid Howells 217674e95caSDavid Howells struct hdspm_mixer_ioctl { 218674e95caSDavid Howells struct hdspm_mixer *mixer; 219674e95caSDavid Howells }; 220674e95caSDavid Howells 221674e95caSDavid Howells /* use indirect access due to the limit of ioctl bit size */ 222674e95caSDavid Howells #define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) 223674e95caSDavid Howells 224674e95caSDavid Howells /* typedefs for compatibility to user-space */ 225674e95caSDavid Howells typedef struct hdspm_peak_rms hdspm_peak_rms_t; 226674e95caSDavid Howells typedef struct hdspm_config_info hdspm_config_info_t; 227674e95caSDavid Howells typedef struct hdspm_version hdspm_version_t; 228674e95caSDavid Howells typedef struct hdspm_channelfader snd_hdspm_channelfader_t; 229674e95caSDavid Howells typedef struct hdspm_mixer hdspm_mixer_t; 230674e95caSDavid Howells 231674e95caSDavid Howells 232674e95caSDavid Howells #endif 233