oxfw-pcm.c (216e256f7bf974ba402309d0ceb24f3500dc65c4) | oxfw-pcm.c (8985f4ac1c42bd25799f294f4e87fa73064673c7) |
---|---|
1/* 2 * oxfw_pcm.c - a part of driver for OXFW970/971 based devices 3 * 4 * Copyright (c) Clemens Ladisch <clemens@ladisch.de> 5 * Licensed under the terms of the GNU General Public License, version 2. 6 */ 7 8#include "oxfw.h" --- 178 unchanged lines hidden (view full) --- 187 return err; 188} 189 190static int pcm_open(struct snd_pcm_substream *substream) 191{ 192 struct snd_oxfw *oxfw = substream->private_data; 193 int err; 194 | 1/* 2 * oxfw_pcm.c - a part of driver for OXFW970/971 based devices 3 * 4 * Copyright (c) Clemens Ladisch <clemens@ladisch.de> 5 * Licensed under the terms of the GNU General Public License, version 2. 6 */ 7 8#include "oxfw.h" --- 178 unchanged lines hidden (view full) --- 187 return err; 188} 189 190static int pcm_open(struct snd_pcm_substream *substream) 191{ 192 struct snd_oxfw *oxfw = substream->private_data; 193 int err; 194 |
195 err = init_hw_params(oxfw, substream); | 195 err = snd_oxfw_stream_lock_try(oxfw); |
196 if (err < 0) 197 goto end; 198 | 196 if (err < 0) 197 goto end; 198 |
199 err = init_hw_params(oxfw, substream); 200 if (err < 0) 201 goto err_locked; 202 |
|
199 /* 200 * When any PCM streams are already running, the available sampling 201 * rate is limited at current value. 202 */ 203 if (amdtp_stream_pcm_running(&oxfw->tx_stream) || 204 amdtp_stream_pcm_running(&oxfw->rx_stream)) { 205 err = limit_to_current_params(substream); 206 if (err < 0) 207 goto end; 208 } 209 210 snd_pcm_set_sync(substream); 211end: 212 return err; | 203 /* 204 * When any PCM streams are already running, the available sampling 205 * rate is limited at current value. 206 */ 207 if (amdtp_stream_pcm_running(&oxfw->tx_stream) || 208 amdtp_stream_pcm_running(&oxfw->rx_stream)) { 209 err = limit_to_current_params(substream); 210 if (err < 0) 211 goto end; 212 } 213 214 snd_pcm_set_sync(substream); 215end: 216 return err; |
217err_locked: 218 snd_oxfw_stream_lock_release(oxfw); 219 return err; |
|
213} 214 215static int pcm_close(struct snd_pcm_substream *substream) 216{ | 220} 221 222static int pcm_close(struct snd_pcm_substream *substream) 223{ |
224 struct snd_oxfw *oxfw = substream->private_data; 225 226 snd_oxfw_stream_lock_release(oxfw); |
|
217 return 0; 218} 219 220static int pcm_capture_hw_params(struct snd_pcm_substream *substream, 221 struct snd_pcm_hw_params *hw_params) 222{ 223 struct snd_oxfw *oxfw = substream->private_data; 224 --- 190 unchanged lines hidden --- | 227 return 0; 228} 229 230static int pcm_capture_hw_params(struct snd_pcm_substream *substream, 231 struct snd_pcm_hw_params *hw_params) 232{ 233 struct snd_oxfw *oxfw = substream->private_data; 234 --- 190 unchanged lines hidden --- |