summaryrefslogtreecommitdiffstats
path: root/sound/firewire/oxfw/oxfw-pcm.c
diff options
context:
space:
mode:
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 0c0be98..ea2b439 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;
}
OpenPOWER on IntegriCloud