aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/fireworks/fireworks.h
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-04-25 09:45:01 -0400
committerTakashi Iwai <tiwai@suse.de>2014-05-26 08:24:03 -0400
commitbde8a8f23bbe6db51fa4e81644273af18fef3d7a (patch)
tree92ea0fbb1023bda284156ac561640f4502132409 /sound/firewire/fireworks/fireworks.h
parentb5b04336015e76eb52ffc188e16c9cee01821c7c (diff)
ALSA: fireworks: Add transaction and some commands
Fireworks uses own command and response. This commit adds functionality to transact and adds some commands required for sound card instance and kernel streaming. There are two ways to deliver substance of this transaction: 1.AV/C vendor dependent command for command/response 2.Async transaction to specific addresses for command/response By way 1, I confirm AudioFire12 cannot correctly response to some commands with firmware version 5.0 or later. This is also confirmed by FFADO. So this driver implement way 2. The address for response gives an issue. When this driver allocate own callback function into the address, then no one can allocate its own callback function. This situation is not good for applications in user-land. This issue is solved in later commit. I note there is a command to change the address for response if the device supports. But this driver uses default value. So users should not execute this command as long as hoping this driver works correctly. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/fireworks/fireworks.h')
-rw-r--r--sound/firewire/fireworks/fireworks.h126
1 files changed, 126 insertions, 0 deletions
diff --git a/sound/firewire/fireworks/fireworks.h b/sound/firewire/fireworks/fireworks.h
index 9dfeb8210e71..e999802ab470 100644
--- a/sound/firewire/fireworks/fireworks.h
+++ b/sound/firewire/fireworks/fireworks.h
@@ -20,6 +20,28 @@
20 20
21#include <sound/core.h> 21#include <sound/core.h>
22#include <sound/initval.h> 22#include <sound/initval.h>
23#include <sound/pcm.h>
24
25#include "../cmp.h"
26#include "../lib.h"
27
28#define SND_EFW_MULTIPLIER_MODES 3
29#define HWINFO_NAME_SIZE_BYTES 32
30#define HWINFO_MAX_CAPS_GROUPS 8
31
32/*
33 * This should be greater than maximum bytes for EFW response content.
34 * Currently response against command for isochronous channel mapping is
35 * confirmed to be the maximum one. But for flexibility, use maximum data
36 * payload for asynchronous primary packets at S100 (Cable base rate) in
37 * IEEE Std 1394-1995.
38 */
39#define SND_EFW_RESPONSE_MAXIMUM_BYTES 0x200U
40
41struct snd_efw_phys_grp {
42 u8 type; /* see enum snd_efw_grp_type */
43 u8 count;
44} __packed;
23 45
24struct snd_efw { 46struct snd_efw {
25 struct snd_card *card; 47 struct snd_card *card;
@@ -28,7 +50,111 @@ struct snd_efw {
28 50
29 struct mutex mutex; 51 struct mutex mutex;
30 spinlock_t lock; 52 spinlock_t lock;
53
54 /* for transaction */
55 u32 seqnum;
56 bool resp_addr_changable;
57};
58
59struct snd_efw_transaction {
60 __be32 length;
61 __be32 version;
62 __be32 seqnum;
63 __be32 category;
64 __be32 command;
65 __be32 status;
66 __be32 params[0];
67};
68int snd_efw_transaction_run(struct fw_unit *unit,
69 const void *cmd, unsigned int cmd_size,
70 void *resp, unsigned int resp_size);
71int snd_efw_transaction_register(void);
72void snd_efw_transaction_unregister(void);
73void snd_efw_transaction_bus_reset(struct fw_unit *unit);
74
75struct snd_efw_hwinfo {
76 u32 flags;
77 u32 guid_hi;
78 u32 guid_lo;
79 u32 type;
80 u32 version;
81 char vendor_name[HWINFO_NAME_SIZE_BYTES];
82 char model_name[HWINFO_NAME_SIZE_BYTES];
83 u32 supported_clocks;
84 u32 amdtp_rx_pcm_channels;
85 u32 amdtp_tx_pcm_channels;
86 u32 phys_out;
87 u32 phys_in;
88 u32 phys_out_grp_count;
89 struct snd_efw_phys_grp phys_out_grps[HWINFO_MAX_CAPS_GROUPS];
90 u32 phys_in_grp_count;
91 struct snd_efw_phys_grp phys_in_grps[HWINFO_MAX_CAPS_GROUPS];
92 u32 midi_out_ports;
93 u32 midi_in_ports;
94 u32 max_sample_rate;
95 u32 min_sample_rate;
96 u32 dsp_version;
97 u32 arm_version;
98 u32 mixer_playback_channels;
99 u32 mixer_capture_channels;
100 u32 fpga_version;
101 u32 amdtp_rx_pcm_channels_2x;
102 u32 amdtp_tx_pcm_channels_2x;
103 u32 amdtp_rx_pcm_channels_4x;
104 u32 amdtp_tx_pcm_channels_4x;
105 u32 reserved[16];
106} __packed;
107enum snd_efw_grp_type {
108 SND_EFW_CH_TYPE_ANALOG = 0,
109 SND_EFW_CH_TYPE_SPDIF = 1,
110 SND_EFW_CH_TYPE_ADAT = 2,
111 SND_EFW_CH_TYPE_SPDIF_OR_ADAT = 3,
112 SND_EFW_CH_TYPE_ANALOG_MIRRORING = 4,
113 SND_EFW_CH_TYPE_HEADPHONES = 5,
114 SND_EFW_CH_TYPE_I2S = 6,
115 SND_EFW_CH_TYPE_GUITAR = 7,
116 SND_EFW_CH_TYPE_PIEZO_GUITAR = 8,
117 SND_EFW_CH_TYPE_GUITAR_STRING = 9,
118 SND_EFW_CH_TYPE_VIRTUAL = 0x10000,
119 SND_EFW_CH_TYPE_DUMMY
120};
121struct snd_efw_phys_meters {
122 u32 status; /* guitar state/midi signal/clock input detect */
123 u32 reserved0;
124 u32 reserved1;
125 u32 reserved2;
126 u32 reserved3;
127 u32 out_meters;
128 u32 in_meters;
129 u32 reserved4;
130 u32 reserved5;
131 u32 values[0];
132} __packed;
133enum snd_efw_clock_source {
134 SND_EFW_CLOCK_SOURCE_INTERNAL = 0,
135 SND_EFW_CLOCK_SOURCE_SYTMATCH = 1,
136 SND_EFW_CLOCK_SOURCE_WORDCLOCK = 2,
137 SND_EFW_CLOCK_SOURCE_SPDIF = 3,
138 SND_EFW_CLOCK_SOURCE_ADAT_1 = 4,
139 SND_EFW_CLOCK_SOURCE_ADAT_2 = 5,
140 SND_EFW_CLOCK_SOURCE_CONTINUOUS = 6 /* internal variable clock */
141};
142enum snd_efw_transport_mode {
143 SND_EFW_TRANSPORT_MODE_WINDOWS = 0,
144 SND_EFW_TRANSPORT_MODE_IEC61883 = 1,
31}; 145};
146int snd_efw_command_set_resp_addr(struct snd_efw *efw,
147 u16 addr_high, u32 addr_low);
148int snd_efw_command_set_tx_mode(struct snd_efw *efw, unsigned int mode);
149int snd_efw_command_get_hwinfo(struct snd_efw *efw,
150 struct snd_efw_hwinfo *hwinfo);
151int snd_efw_command_get_phys_meters(struct snd_efw *efw,
152 struct snd_efw_phys_meters *meters,
153 unsigned int len);
154int snd_efw_command_get_clock_source(struct snd_efw *efw,
155 enum snd_efw_clock_source *source);
156int snd_efw_command_get_sampling_rate(struct snd_efw *efw, unsigned int *rate);
157int snd_efw_command_set_sampling_rate(struct snd_efw *efw, unsigned int rate);
32 158
33#define SND_EFW_DEV_ENTRY(vendor, model) \ 159#define SND_EFW_DEV_ENTRY(vendor, model) \
34{ \ 160{ \