diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2015-09-19 11:21:51 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-09-29 12:35:46 +0200 |
commit | 6a4e89ff0f4e46c1a9d0c28e786952e70516a5f4 (patch) | |
tree | 1b2c205a0d3e081f4ec2fbd44b03c1501f3ba8e3 /sound/firewire/amdtp.c | |
parent | 27ec83b5c6ac08599240ec9a95286e79d6ea9e51 (diff) | |
download | linux-6a4e89ff0f4e46c1a9d0c28e786952e70516a5f4.tar.bz2 |
ALSA: firewire-lib: add a member of frame_multiplier instead of double_pcm_frames
In future commit, interface between data block processing layer and packet
stream processing layer is defined. These two layers communicate the
number of data blocks and the number of PCM frames.
The data block processing layer has a responsibility for calculating the
number of PCM frames. Therefore, 'dual wire' of Dice quirk should be
handled in data block processing layer.
This commit adds a member of 'frame_multiplier'. This member represents
the ratio of the number of PCM frames against the number of data blocks.
Usually, the value of this member is 1, while it's 2 in Dice's 'dual wire'.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/amdtp.c')
-rw-r--r-- | sound/firewire/amdtp.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c index 094982f7c0fd..0bb5e14b6627 100644 --- a/sound/firewire/amdtp.c +++ b/sound/firewire/amdtp.c @@ -225,6 +225,16 @@ int amdtp_stream_set_parameters(struct amdtp_stream *s, 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 */ @@ -584,14 +594,6 @@ static void update_pcm_pointers(struct amdtp_stream *s, { 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; @@ -685,7 +687,7 @@ static int handle_out_packet(struct amdtp_stream *s, unsigned int data_blocks, 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; @@ -788,7 +790,7 @@ end: return -EIO; if (pcm) - update_pcm_pointers(s, pcm, *data_blocks); + update_pcm_pointers(s, pcm, *data_blocks * s->frame_multiplier); return 0; } |