Skip to content

Commit 9f079c1

Browse files
takaswietiwai
authored andcommitted
ALSA: dice: disable double_pcm_frames mode for M-Audio Profire 610, 2626 and Avid M-Box 3 Pro
ALSA dice driver detects jumbo payload at high sampling transfer frequency for below models: * Avid M-Box 3 Pro * M-Audio Profire 610 * M-Audio Profire 2626 Although many DICE-based devices have a quirk at high sampling transfer frequency to multiplex double number of PCM frames into data block than the number in IEC 61883-1/6, the above devices are just compliant to IEC 61883-1/6. This commit disables the mode of double_pcm_frames for the models. Signed-off-by: Takashi Sakamoto <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent c1f0616 commit 9f079c1

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

sound/firewire/dice/dice-pcm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static int pcm_open(struct snd_pcm_substream *substream)
218218

219219
if (frames_per_period > 0) {
220220
// For double_pcm_frame quirk.
221-
if (rate > 96000) {
221+
if (rate > 96000 && !dice->disable_double_pcm_frames) {
222222
frames_per_period *= 2;
223223
frames_per_buffer *= 2;
224224
}
@@ -273,7 +273,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,
273273

274274
mutex_lock(&dice->mutex);
275275
// For double_pcm_frame quirk.
276-
if (rate > 96000) {
276+
if (rate > 96000 && !dice->disable_double_pcm_frames) {
277277
events_per_period /= 2;
278278
events_per_buffer /= 2;
279279
}

sound/firewire/dice/dice-stream.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static int keep_resources(struct snd_dice *dice, struct amdtp_stream *stream,
181181
// as 'Dual Wire'.
182182
// For this quirk, blocking mode is required and PCM buffer size should
183183
// be aligned to SYT_INTERVAL.
184-
double_pcm_frames = rate > 96000;
184+
double_pcm_frames = (rate > 96000 && !dice->disable_double_pcm_frames);
185185
if (double_pcm_frames) {
186186
rate /= 2;
187187
pcm_chs *= 2;

sound/firewire/dice/dice.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ MODULE_LICENSE("GPL v2");
2121
#define OUI_SSL 0x0050c2 // Actually ID reserved by IEEE.
2222
#define OUI_PRESONUS 0x000a92
2323
#define OUI_HARMAN 0x000fd7
24+
#define OUI_AVID 0x00a07e
2425

2526
#define DICE_CATEGORY_ID 0x04
2627
#define WEISS_CATEGORY_ID 0x00
@@ -222,6 +223,14 @@ static int dice_probe(struct fw_unit *unit,
222223
(snd_dice_detect_formats_t)entry->driver_data;
223224
}
224225

226+
// Below models are compliant to IEC 61883-1/6 and have no quirk at high sampling transfer
227+
// frequency.
228+
// * Avid M-Box 3 Pro
229+
// * M-Audio Profire 610
230+
// * M-Audio Profire 2626
231+
if (entry->vendor_id == OUI_MAUDIO || entry->vendor_id == OUI_AVID)
232+
dice->disable_double_pcm_frames = true;
233+
225234
spin_lock_init(&dice->lock);
226235
mutex_init(&dice->mutex);
227236
init_completion(&dice->clock_accepted);
@@ -278,7 +287,22 @@ static void dice_bus_reset(struct fw_unit *unit)
278287

279288
#define DICE_INTERFACE 0x000001
280289

290+
#define DICE_DEV_ENTRY_TYPICAL(vendor, model, data) \
291+
{ \
292+
.match_flags = IEEE1394_MATCH_VENDOR_ID | \
293+
IEEE1394_MATCH_MODEL_ID | \
294+
IEEE1394_MATCH_SPECIFIER_ID | \
295+
IEEE1394_MATCH_VERSION, \
296+
.vendor_id = (vendor), \
297+
.model_id = (model), \
298+
.specifier_id = (vendor), \
299+
.version = DICE_INTERFACE, \
300+
.driver_data = (kernel_ulong_t)(data), \
301+
}
302+
281303
static const struct ieee1394_device_id dice_id_table[] = {
304+
// Avid M-Box 3 Pro. To match in probe function.
305+
DICE_DEV_ENTRY_TYPICAL(OUI_AVID, 0x000004, snd_dice_detect_extension_formats),
282306
/* M-Audio Profire 2626 has a different value in version field. */
283307
{
284308
.match_flags = IEEE1394_MATCH_VENDOR_ID |

sound/firewire/dice/dice.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ struct snd_dice {
109109
struct fw_iso_resources rx_resources[MAX_STREAMS];
110110
struct amdtp_stream tx_stream[MAX_STREAMS];
111111
struct amdtp_stream rx_stream[MAX_STREAMS];
112-
bool global_enabled;
112+
bool global_enabled:1;
113+
bool disable_double_pcm_frames:1;
113114
struct completion clock_accepted;
114115
unsigned int substreams_counter;
115116

0 commit comments

Comments
 (0)