diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2017-05-22 22:22:21 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-05-22 16:24:08 +0200 |
commit | a02cb8f8def634159b60c3a4d6ba16e471b46e0c (patch) | |
tree | d7d6cc26b7747ce434433d9723d1afcc9b7cfc2b /sound/firewire/digi00x | |
parent | 665170f73101e2e52c15495d606df5d1da478697 (diff) | |
download | linux-a02cb8f8def634159b60c3a4d6ba16e471b46e0c.tar.gz linux-a02cb8f8def634159b60c3a4d6ba16e471b46e0c.tar.bz2 linux-a02cb8f8def634159b60c3a4d6ba16e471b46e0c.zip |
ALSA: firewire: remove support for 16 bit PCM samples in playback substream
In IEC 61883-6, AM824 is described as format of data block. In this
format, one data block consists of several data channels, which is aligned
to 32 bit. One data channel has 8 bit label field and 24 bit data field.
PCM frames are transferred in Multi Bit Linear Audio (MBLA) data channel.
This channel can include 16/20/24 bit PCM sample.
As long as I know, models which support IEC 61883-1/6 doesn't allow to
switch bit length of PCM sample in MBLA data channel. They always
transmit/receive PCM frames of 24 bit length. This can be seen for the
other models which support protocols similar to IEC 61883-1/6.
On the other hand, current drivers for these protocols supports 16 bit
length PCM sample in playback substream. In this case, PCM sample is put
into the MBLA data channel with 8 bit padding in LSB side. Although 16
bit PCM sample is major because it's in CD format, this doesn't represent
device capability as is.
This commit removes support for 16 bit PCM samples in playback substream.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/digi00x')
-rw-r--r-- | sound/firewire/digi00x/amdtp-dot.c | 63 | ||||
-rw-r--r-- | sound/firewire/digi00x/digi00x-pcm.c | 7 | ||||
-rw-r--r-- | sound/firewire/digi00x/digi00x.h | 1 |
3 files changed, 3 insertions, 68 deletions
diff --git a/sound/firewire/digi00x/amdtp-dot.c b/sound/firewire/digi00x/amdtp-dot.c index a4688545339c..1453c34ce99f 100644 --- a/sound/firewire/digi00x/amdtp-dot.c +++ b/sound/firewire/digi00x/amdtp-dot.c @@ -48,10 +48,6 @@ struct amdtp_dot { struct snd_rawmidi_substream *midi[MAX_MIDI_PORTS]; int midi_fifo_used[MAX_MIDI_PORTS]; int midi_fifo_limit; - - void (*transfer_samples)(struct amdtp_stream *s, - struct snd_pcm_substream *pcm, - __be32 *buffer, unsigned int frames); }; /* @@ -173,32 +169,6 @@ static void write_pcm_s32(struct amdtp_stream *s, struct snd_pcm_substream *pcm, } } -static void write_pcm_s16(struct amdtp_stream *s, struct snd_pcm_substream *pcm, - __be32 *buffer, unsigned int frames) -{ - struct amdtp_dot *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; - - buffer++; - for (i = 0; i < frames; ++i) { - for (c = 0; c < channels; ++c) { - buffer[c] = cpu_to_be32((*src << 8) | 0x40000000); - dot_encode_step(&p->state, &buffer[c]); - 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) { @@ -351,33 +321,6 @@ int amdtp_dot_add_pcm_hw_constraints(struct amdtp_stream *s, return amdtp_stream_add_pcm_hw_constraints(s, runtime); } -void amdtp_dot_set_pcm_format(struct amdtp_stream *s, snd_pcm_format_t format) -{ - struct amdtp_dot *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; - } -} - void amdtp_dot_midi_trigger(struct amdtp_stream *s, unsigned int port, struct snd_rawmidi_substream *midi) { @@ -392,13 +335,12 @@ static unsigned int process_tx_data_blocks(struct amdtp_stream *s, unsigned int data_blocks, unsigned int *syt) { - struct amdtp_dot *p = (struct amdtp_dot *)s->protocol; struct snd_pcm_substream *pcm; unsigned int pcm_frames; pcm = ACCESS_ONCE(s->pcm); if (pcm) { - p->transfer_samples(s, pcm, buffer, data_blocks); + read_pcm_s32(s, pcm, buffer, data_blocks); pcm_frames = data_blocks; } else { pcm_frames = 0; @@ -414,13 +356,12 @@ static unsigned int process_rx_data_blocks(struct amdtp_stream *s, unsigned int data_blocks, unsigned int *syt) { - struct amdtp_dot *p = (struct amdtp_dot *)s->protocol; struct snd_pcm_substream *pcm; unsigned int pcm_frames; pcm = ACCESS_ONCE(s->pcm); if (pcm) { - p->transfer_samples(s, pcm, buffer, data_blocks); + write_pcm_s32(s, pcm, buffer, data_blocks); pcm_frames = data_blocks; } else { write_pcm_silence(s, buffer, data_blocks); diff --git a/sound/firewire/digi00x/digi00x-pcm.c b/sound/firewire/digi00x/digi00x-pcm.c index 68d1c52db051..6379f67416d7 100644 --- a/sound/firewire/digi00x/digi00x-pcm.c +++ b/sound/firewire/digi00x/digi00x-pcm.c @@ -88,8 +88,7 @@ static int pcm_init_hw_params(struct snd_dg00x *dg00x, substream->runtime->hw.formats = SNDRV_PCM_FMTBIT_S32; s = &dg00x->tx_stream; } else { - substream->runtime->hw.formats = SNDRV_PCM_FMTBIT_S16 | - SNDRV_PCM_FMTBIT_S32; + substream->runtime->hw.formats = SNDRV_PCM_FMTBIT_S32; s = &dg00x->rx_stream; } @@ -184,8 +183,6 @@ static int pcm_capture_hw_params(struct snd_pcm_substream *substream, mutex_unlock(&dg00x->mutex); } - amdtp_dot_set_pcm_format(&dg00x->tx_stream, params_format(hw_params)); - return 0; } @@ -206,8 +203,6 @@ static int pcm_playback_hw_params(struct snd_pcm_substream *substream, mutex_unlock(&dg00x->mutex); } - amdtp_dot_set_pcm_format(&dg00x->rx_stream, params_format(hw_params)); - return 0; } diff --git a/sound/firewire/digi00x/digi00x.h b/sound/firewire/digi00x/digi00x.h index 1275a50956c0..4dd1bbf2ed3c 100644 --- a/sound/firewire/digi00x/digi00x.h +++ b/sound/firewire/digi00x/digi00x.h @@ -121,7 +121,6 @@ int amdtp_dot_set_parameters(struct amdtp_stream *s, unsigned int rate, void amdtp_dot_reset(struct amdtp_stream *s); int amdtp_dot_add_pcm_hw_constraints(struct amdtp_stream *s, struct snd_pcm_runtime *runtime); -void amdtp_dot_set_pcm_format(struct amdtp_stream *s, snd_pcm_format_t format); void amdtp_dot_midi_trigger(struct amdtp_stream *s, unsigned int port, struct snd_rawmidi_substream *midi); |