diff options
Diffstat (limited to 'sound/firewire/tascam/amdtp-tascam.c')
-rw-r--r-- | sound/firewire/tascam/amdtp-tascam.c | 62 |
1 files changed, 2 insertions, 60 deletions
diff --git a/sound/firewire/tascam/amdtp-tascam.c b/sound/firewire/tascam/amdtp-tascam.c index 9dd0fccd5ccc..6aff1fc1c72d 100644 --- a/sound/firewire/tascam/amdtp-tascam.c +++ b/sound/firewire/tascam/amdtp-tascam.c @@ -14,10 +14,6 @@ struct amdtp_tscm { unsigned int pcm_channels; - - void (*transfer_samples)(struct amdtp_stream *s, - struct snd_pcm_substream *pcm, - __be32 *buffer, unsigned int frames); }; int amdtp_tscm_set_parameters(struct amdtp_stream *s, unsigned int rate) @@ -62,31 +58,6 @@ static void write_pcm_s32(struct amdtp_stream *s, } } -static void write_pcm_s16(struct amdtp_stream *s, - struct snd_pcm_substream *pcm, - __be32 *buffer, unsigned int frames) -{ - struct amdtp_tscm *p = s->protocol; - struct snd_pcm_runtime *runtime = pcm->runtime; - unsigned int channels, remaining_frames, i, c; - const u16 *src; - - channels = p->pcm_channels; - src = (void *)runtime->dma_area + - frames_to_bytes(runtime, s->pcm_buffer_pointer); - remaining_frames = runtime->buffer_size - s->pcm_buffer_pointer; - - for (i = 0; i < frames; ++i) { - for (c = 0; c < channels; ++c) { - buffer[c] = cpu_to_be32(*src << 16); - src++; - } - buffer += s->data_block_quadlets; - if (--remaining_frames == 0) - src = (void *)runtime->dma_area; - } -} - static void read_pcm_s32(struct amdtp_stream *s, struct snd_pcm_substream *pcm, __be32 *buffer, unsigned int frames) @@ -146,44 +117,16 @@ int amdtp_tscm_add_pcm_hw_constraints(struct amdtp_stream *s, return amdtp_stream_add_pcm_hw_constraints(s, runtime); } -void amdtp_tscm_set_pcm_format(struct amdtp_stream *s, snd_pcm_format_t format) -{ - struct amdtp_tscm *p = s->protocol; - - if (WARN_ON(amdtp_stream_pcm_running(s))) - return; - - switch (format) { - default: - WARN_ON(1); - /* fall through */ - case SNDRV_PCM_FORMAT_S16: - if (s->direction == AMDTP_OUT_STREAM) { - p->transfer_samples = write_pcm_s16; - break; - } - WARN_ON(1); - /* fall through */ - case SNDRV_PCM_FORMAT_S32: - if (s->direction == AMDTP_OUT_STREAM) - p->transfer_samples = write_pcm_s32; - else - p->transfer_samples = read_pcm_s32; - break; - } -} - static unsigned int process_tx_data_blocks(struct amdtp_stream *s, __be32 *buffer, unsigned int data_blocks, unsigned int *syt) { - struct amdtp_tscm *p = (struct amdtp_tscm *)s->protocol; struct snd_pcm_substream *pcm; pcm = ACCESS_ONCE(s->pcm); if (data_blocks > 0 && pcm) - p->transfer_samples(s, pcm, buffer, data_blocks); + read_pcm_s32(s, pcm, buffer, data_blocks); /* A place holder for control messages. */ @@ -195,7 +138,6 @@ static unsigned int process_rx_data_blocks(struct amdtp_stream *s, unsigned int data_blocks, unsigned int *syt) { - struct amdtp_tscm *p = (struct amdtp_tscm *)s->protocol; struct snd_pcm_substream *pcm; /* This field is not used. */ @@ -203,7 +145,7 @@ static unsigned int process_rx_data_blocks(struct amdtp_stream *s, pcm = ACCESS_ONCE(s->pcm); if (pcm) - p->transfer_samples(s, pcm, buffer, data_blocks); + write_pcm_s32(s, pcm, buffer, data_blocks); else write_pcm_silence(s, buffer, data_blocks); |