summaryrefslogtreecommitdiff
path: root/sound/firewire/oxfw/oxfw-pcm.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-12-09 00:10:44 +0900
committerTakashi Iwai <tiwai@suse.de>2014-12-10 10:48:12 +0100
commitf3699e2c77455a6cccc977b391c553f2c816f639 (patch)
tree3363d52b0c8eeb22f80c164bc30e25a52ac1f532 /sound/firewire/oxfw/oxfw-pcm.c
parent3c96101f190020e91d413c5835f7a722fc007923 (diff)
ALSA: oxfw: Change the way to start stream
In past commit, this driver can keep stream formations for each sampling rate. So its stream functionality can decide stream formations with given some parameters. This commit moves related codes from PCM functionality to stream functionality. Furthermore, to set stream format correctly, this commit uses AV/C Stream Format Information command instead of AV/C Input/Output Plug Signal Format command. 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/oxfw/oxfw-pcm.c')
-rw-r--r--sound/firewire/oxfw/oxfw-pcm.c44
1 files changed, 7 insertions, 37 deletions
diff --git a/sound/firewire/oxfw/oxfw-pcm.c b/sound/firewire/oxfw/oxfw-pcm.c
index 0c0be984edce..ea2b439253cf 100644
--- a/sound/firewire/oxfw/oxfw-pcm.c
+++ b/sound/firewire/oxfw/oxfw-pcm.c
@@ -166,39 +166,10 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
struct snd_oxfw *oxfw = substream->private_data;
- int err;
-
- mutex_lock(&oxfw->mutex);
-
- snd_oxfw_stream_stop_simplex(oxfw);
-
- err = snd_pcm_lib_alloc_vmalloc_buffer(substream,
- params_buffer_bytes(hw_params));
- if (err < 0)
- goto error;
-
- amdtp_stream_set_parameters(&oxfw->rx_stream,
- params_rate(hw_params),
- params_channels(hw_params),
- 0);
-
- amdtp_stream_set_pcm_format(&oxfw->rx_stream,
- params_format(hw_params));
-
- err = avc_general_set_sig_fmt(oxfw->unit, params_rate(hw_params),
- AVC_GENERAL_PLUG_DIR_IN, 0);
- if (err < 0) {
- dev_err(&oxfw->unit->device, "failed to set sample rate\n");
- goto err_buffer;
- }
- return 0;
-
-err_buffer:
- snd_pcm_lib_free_vmalloc_buffer(substream);
-error:
- mutex_unlock(&oxfw->mutex);
- return err;
+ amdtp_stream_set_pcm_format(&oxfw->rx_stream, params_format(hw_params));
+ return snd_pcm_lib_alloc_vmalloc_buffer(substream,
+ params_buffer_bytes(hw_params));
}
static int pcm_hw_free(struct snd_pcm_substream *substream)
@@ -215,19 +186,18 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)
static int pcm_prepare(struct snd_pcm_substream *substream)
{
struct snd_oxfw *oxfw = substream->private_data;
+ struct snd_pcm_runtime *runtime = substream->runtime;
int err;
mutex_lock(&oxfw->mutex);
-
- snd_oxfw_stream_stop_simplex(oxfw);
-
- err = snd_oxfw_stream_start_simplex(oxfw);
+ err = snd_oxfw_stream_start_simplex(oxfw, runtime->rate,
+ runtime->channels);
+ mutex_unlock(&oxfw->mutex);
if (err < 0)
goto end;
amdtp_stream_pcm_prepare(&oxfw->rx_stream);
end:
- mutex_unlock(&oxfw->mutex);
return err;
}