/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */1#ifndef _UAPI_SOUND_FIREWIRE_H_INCLUDED2#define _UAPI_SOUND_FIREWIRE_H_INCLUDED34#include <linux/ioctl.h>5#include <linux/types.h>67/* events can be read() from the hwdep device */89#define SNDRV_FIREWIRE_EVENT_LOCK_STATUS 0x000010cc10#define SNDRV_FIREWIRE_EVENT_DICE_NOTIFICATION 0xd1ce004e11#define SNDRV_FIREWIRE_EVENT_EFW_RESPONSE 0x4e61747512#define SNDRV_FIREWIRE_EVENT_DIGI00X_MESSAGE 0x746e736c13#define SNDRV_FIREWIRE_EVENT_MOTU_NOTIFICATION 0x6477647914#define SNDRV_FIREWIRE_EVENT_TASCAM_CONTROL 0x7473636d15#define SNDRV_FIREWIRE_EVENT_MOTU_REGISTER_DSP_CHANGE 0x4d54524416#define SNDRV_FIREWIRE_EVENT_FF400_MESSAGE 0x4f6c67611718struct snd_firewire_event_common {19unsigned int type; /* SNDRV_FIREWIRE_EVENT_xxx */20};2122struct snd_firewire_event_lock_status {23unsigned int type;24unsigned int status; /* 0/1 = unlocked/locked */25};2627struct snd_firewire_event_dice_notification {28unsigned int type;29unsigned int notification; /* DICE-specific bits */30};3132#define SND_EFW_TRANSACTION_USER_SEQNUM_MAX ((__u32)((__u16)~0) - 1)33/* each field should be in big endian */34struct snd_efw_transaction {35__be32 length;36__be32 version;37__be32 seqnum;38__be32 category;39__be32 command;40__be32 status;41__be32 params[];42};43struct snd_firewire_event_efw_response {44unsigned int type;45__be32 response[]; /* some responses */46};4748struct snd_firewire_event_digi00x_message {49unsigned int type;50__u32 message; /* Digi00x-specific message */51};5253struct snd_firewire_event_motu_notification {54unsigned int type;55__u32 message; /* MOTU-specific bits. */56};5758struct snd_firewire_tascam_change {59unsigned int index;60__be32 before;61__be32 after;62};6364struct snd_firewire_event_tascam_control {65unsigned int type;66struct snd_firewire_tascam_change changes[];67};6869struct snd_firewire_event_motu_register_dsp_change {70unsigned int type;71__u32 count; /* The number of changes. */72__u32 changes[]; /* Encoded event for change of register DSP. */73};7475/**76* struct snd_firewire_event_ff400_message - the container for message from Fireface 400 when77* operating hardware knob.78*79* @type: Fixed to SNDRV_FIREWIRE_EVENT_FF400_MESSAGE.80* @message_count: The number of messages.81* @messages.message: The messages expressing hardware knob operation.82* @messages.tstamp: The isochronous cycle at which the request subaction of asynchronous83* transaction was sent to deliver the message. It has 16 bit unsigned integer84* value. The higher 3 bits of value expresses the lower three bits of second85* field in the format of CYCLE_TIME, up to 7. The rest 13 bits expresses cycle86* field up to 7999.87*88* The structure expresses message transmitted by Fireface 400 when operating hardware knob.89*/90struct snd_firewire_event_ff400_message {91unsigned int type;92unsigned int message_count;93struct {94__u32 message;95__u32 tstamp;96} messages[];97};9899union snd_firewire_event {100struct snd_firewire_event_common common;101struct snd_firewire_event_lock_status lock_status;102struct snd_firewire_event_dice_notification dice_notification;103struct snd_firewire_event_efw_response efw_response;104struct snd_firewire_event_digi00x_message digi00x_message;105struct snd_firewire_event_tascam_control tascam_control;106struct snd_firewire_event_motu_notification motu_notification;107struct snd_firewire_event_motu_register_dsp_change motu_register_dsp_change;108struct snd_firewire_event_ff400_message ff400_message;109};110111112#define SNDRV_FIREWIRE_IOCTL_GET_INFO _IOR('H', 0xf8, struct snd_firewire_get_info)113#define SNDRV_FIREWIRE_IOCTL_LOCK _IO('H', 0xf9)114#define SNDRV_FIREWIRE_IOCTL_UNLOCK _IO('H', 0xfa)115#define SNDRV_FIREWIRE_IOCTL_TASCAM_STATE _IOR('H', 0xfb, struct snd_firewire_tascam_state)116#define SNDRV_FIREWIRE_IOCTL_MOTU_REGISTER_DSP_METER _IOR('H', 0xfc, struct snd_firewire_motu_register_dsp_meter)117#define SNDRV_FIREWIRE_IOCTL_MOTU_COMMAND_DSP_METER _IOR('H', 0xfd, struct snd_firewire_motu_command_dsp_meter)118#define SNDRV_FIREWIRE_IOCTL_MOTU_REGISTER_DSP_PARAMETER _IOR('H', 0xfe, struct snd_firewire_motu_register_dsp_parameter)119120#define SNDRV_FIREWIRE_TYPE_DICE 1121#define SNDRV_FIREWIRE_TYPE_FIREWORKS 2122#define SNDRV_FIREWIRE_TYPE_BEBOB 3123#define SNDRV_FIREWIRE_TYPE_OXFW 4124#define SNDRV_FIREWIRE_TYPE_DIGI00X 5125#define SNDRV_FIREWIRE_TYPE_TASCAM 6126#define SNDRV_FIREWIRE_TYPE_MOTU 7127#define SNDRV_FIREWIRE_TYPE_FIREFACE 8128129struct snd_firewire_get_info {130unsigned int type; /* SNDRV_FIREWIRE_TYPE_xxx */131unsigned int card; /* same as fw_cdev_get_info.card */132unsigned char guid[8];133char device_name[16]; /* device node in /dev */134};135136/*137* SNDRV_FIREWIRE_IOCTL_LOCK prevents the driver from streaming.138* Returns -EBUSY if the driver is already streaming.139*/140141#define SNDRV_FIREWIRE_TASCAM_STATE_COUNT 64142143struct snd_firewire_tascam_state {144__be32 data[SNDRV_FIREWIRE_TASCAM_STATE_COUNT];145};146147/*148* In below MOTU models, software is allowed to control their DSP by accessing to registers.149* - 828mk2150* - 896hd151* - Traveler152* - 8 pre153* - Ultralite154* - 4 pre155* - Audio Express156*157* On the other hand, the status of DSP is split into specific messages included in the sequence of158* isochronous packet. ALSA firewire-motu driver gathers the messages and allow userspace applications159* to read it via ioctl. In 828mk2, 896hd, and Traveler, hardware meter for all of physical inputs160* are put into the message, while one pair of physical outputs is selected. The selection is done by161* LSB one byte in asynchronous write quadlet transaction to 0x'ffff'f000'0b2c.162*163* I note that V3HD/V4HD uses asynchronous transaction for the purpose. The destination address is164* registered to 0x'ffff'f000'0b38 and '0b3c by asynchronous write quadlet request. The size of165* message differs between 23 and 51 quadlets. For the case, the number of mixer bus can be extended166* up to 12.167*/168169#define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_INPUT_COUNT 24170#define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_OUTPUT_COUNT 24171#define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_COUNT \172(SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_INPUT_COUNT + SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_OUTPUT_COUNT)173174/**175* struct snd_firewire_motu_register_dsp_meter - the container for meter information in DSP176* controlled by register access177* @data: Signal level meters. The mapping between position and input/output channel is178* model-dependent.179*180* The structure expresses the part of DSP status for hardware meter. The u8 storage includes linear181* value for audio signal level between 0x00 and 0x7f.182*/183struct snd_firewire_motu_register_dsp_meter {184__u8 data[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_COUNT];185};186187#define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT 4188#define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT 20189#define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_INPUT_COUNT 10190#define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT (SNDRV_FIREWIRE_MOTU_REGISTER_DSP_INPUT_COUNT + 2)191192/**193* snd_firewire_motu_register_dsp_parameter - the container for parameters of DSP controlled194* by register access.195* @mixer.source.gain: The gain of source to mixer.196* @mixer.source.pan: The L/R balance of source to mixer.197* @mixer.source.flag: The flag of source to mixer, including mute, solo.198* @mixer.source.paired_balance: The L/R balance of paired source to mixer, only for 4 pre and199* Audio Express.200* @mixer.source.paired_width: The width of paired source to mixer, only for 4 pre and201* Audio Express.202* @mixer.output.paired_volume: The volume of paired output from mixer.203* @mixer.output.paired_flag: The flag of paired output from mixer.204* @output.main_paired_volume: The volume of paired main output.205* @output.hp_paired_volume: The volume of paired hp output.206* @output.hp_paired_assignment: The source assigned to paired hp output.207* @output.reserved: Padding for 32 bit alignment for future extension.208* @line_input.boost_flag: The flags of boost for line inputs, only for 828mk2 and Traveler.209* @line_input.nominal_level_flag: The flags of nominal level for line inputs, only for 828mk2 and210* Traveler.211* @line_input.reserved: Padding for 32 bit alignment for future extension.212* @input.gain_and_invert: The value including gain and invert for input, only for Ultralite, 4 pre213* and Audio Express.214* @input.flag: The flag of input; e.g. jack detection, phantom power, and pad, only for Ultralite,215* 4 pre and Audio express.216* @reserved: Padding so that the size of structure is kept to 512 byte, but for future extension.217*218* The structure expresses the set of parameters for DSP controlled by register access.219*/220struct snd_firewire_motu_register_dsp_parameter {221struct {222struct {223__u8 gain[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];224__u8 pan[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];225__u8 flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];226__u8 paired_balance[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];227__u8 paired_width[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];228} source[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT];229struct {230__u8 paired_volume[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT];231__u8 paired_flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT];232} output;233} mixer;234struct {235__u8 main_paired_volume;236__u8 hp_paired_volume;237__u8 hp_paired_assignment;238__u8 reserved[5];239} output;240struct {241__u8 boost_flag;242__u8 nominal_level_flag;243__u8 reserved[6];244} line_input;245struct {246__u8 gain_and_invert[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT];247__u8 flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT];248} input;249__u8 reserved[64];250};251252/*253* In below MOTU models, software is allowed to control their DSP by command in frame of254* asynchronous transaction to 0x'ffff'0001'0000:255*256* - 828 mk3 (FireWire only and Hybrid)257* - 896 mk3 (FireWire only and Hybrid)258* - Ultralite mk3 (FireWire only and Hybrid)259* - Traveler mk3260* - Track 16261*262* On the other hand, the states of hardware meter is split into specific messages included in the263* sequence of isochronous packet. ALSA firewire-motu driver gathers the message and allow userspace264* application to read it via ioctl.265*/266267#define SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT 400268269/**270* struct snd_firewire_motu_command_dsp_meter - the container for meter information in DSP271* controlled by command272* @data: Signal level meters. The mapping between position and signal channel is model-dependent.273*274* The structure expresses the part of DSP status for hardware meter. The 32 bit storage is275* estimated to include IEEE 764 32 bit single precision floating point (binary32) value. It is276* expected to be linear value (not logarithm) for audio signal level between 0.0 and +1.0.277*/278struct snd_firewire_motu_command_dsp_meter {279#ifdef __KERNEL__280__u32 data[SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT];281#else282float data[SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT];283#endif284};285286#endif /* _UAPI_SOUND_FIREWIRE_H_INCLUDED */287288289