s->data_block_quadlets = s->pcm_channels + midi_channels;
s->midi_ports = midi_ports;
+ /*
+ * In IEC 61883-6, one data block represents one event. In ALSA, one
+ * event equals to one PCM frame. But Dice has a quirk at higher
+ * sampling rate to transfer two PCM frames in one data block.
+ */
+ if (double_pcm_frames)
+ s->frame_multiplier = 2;
+ else
+ s->frame_multiplier = 1;
+
s->syt_interval = amdtp_syt_intervals[sfc];
/* default buffering in the device */
{
unsigned int ptr;
- /*
- * In IEC 61883-6, one data block represents one event. In ALSA, one
- * event equals to one PCM frame. But Dice has a quirk to transfer
- * two PCM frames in one data block.
- */
- if (s->double_pcm_frames)
- frames *= 2;
-
ptr = s->pcm_buffer_pointer + frames;
if (ptr >= pcm->runtime->buffer_size)
ptr -= pcm->runtime->buffer_size;
return -EIO;
if (pcm)
- update_pcm_pointers(s, pcm, data_blocks);
+ update_pcm_pointers(s, pcm, data_blocks * s->frame_multiplier);
/* No need to return the number of handled data blocks. */
return 0;
return -EIO;
if (pcm)
- update_pcm_pointers(s, pcm, *data_blocks);
+ update_pcm_pointers(s, pcm, *data_blocks * s->frame_multiplier);
return 0;
}
u8 pcm_positions[AMDTP_MAX_CHANNELS_FOR_PCM];
u8 midi_position;
- bool double_pcm_frames;
void (*transfer_samples)(struct amdtp_stream *s,
struct snd_pcm_substream *pcm,
__be32 *buffer, unsigned int frames);
+
+ unsigned int frame_multiplier;
};
int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit,