diff options
Diffstat (limited to 'drivers/media/video/cx231xx/cx231xx-audio.c')
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-audio.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-audio.c b/drivers/media/video/cx231xx/cx231xx-audio.c index 3810b0fd2d61..044edbc2d844 100644 --- a/drivers/media/video/cx231xx/cx231xx-audio.c +++ b/drivers/media/video/cx231xx/cx231xx-audio.c | |||
@@ -132,12 +132,16 @@ static void cx231xx_audio_isocirq(struct urb *urb) | |||
132 | snd_pcm_stream_lock(substream); | 132 | snd_pcm_stream_lock(substream); |
133 | 133 | ||
134 | dev->adev.hwptr_done_capture += length; | 134 | dev->adev.hwptr_done_capture += length; |
135 | if (dev->adev.hwptr_done_capture >= runtime->buffer_size) | 135 | if (dev->adev.hwptr_done_capture >= |
136 | dev->adev.hwptr_done_capture -= runtime->buffer_size; | 136 | runtime->buffer_size) |
137 | dev->adev.hwptr_done_capture -= | ||
138 | runtime->buffer_size; | ||
137 | 139 | ||
138 | dev->adev.capture_transfer_done += length; | 140 | dev->adev.capture_transfer_done += length; |
139 | if (dev->adev.capture_transfer_done >= runtime->period_size) { | 141 | if (dev->adev.capture_transfer_done >= |
140 | dev->adev.capture_transfer_done -= runtime->period_size; | 142 | runtime->period_size) { |
143 | dev->adev.capture_transfer_done -= | ||
144 | runtime->period_size; | ||
141 | period_elapsed = 1; | 145 | period_elapsed = 1; |
142 | } | 146 | } |
143 | snd_pcm_stream_unlock(substream); | 147 | snd_pcm_stream_unlock(substream); |
@@ -185,7 +189,8 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) | |||
185 | 189 | ||
186 | urb->dev = dev->udev; | 190 | urb->dev = dev->udev; |
187 | urb->context = dev; | 191 | urb->context = dev; |
188 | urb->pipe = usb_rcvisocpipe(dev->udev, dev->adev.end_point_addr); | 192 | urb->pipe = usb_rcvisocpipe(dev->udev, |
193 | dev->adev.end_point_addr); | ||
189 | urb->transfer_flags = URB_ISO_ASAP; | 194 | urb->transfer_flags = URB_ISO_ASAP; |
190 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; | 195 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; |
191 | urb->interval = 1; | 196 | urb->interval = 1; |
@@ -193,7 +198,8 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) | |||
193 | urb->number_of_packets = CX231XX_NUM_AUDIO_PACKETS; | 198 | urb->number_of_packets = CX231XX_NUM_AUDIO_PACKETS; |
194 | urb->transfer_buffer_length = sb_size; | 199 | urb->transfer_buffer_length = sb_size; |
195 | 200 | ||
196 | for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS; j++, k += dev->adev.max_pkt_size) { | 201 | for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS; |
202 | j++, k += dev->adev.max_pkt_size) { | ||
197 | urb->iso_frame_desc[j].offset = k; | 203 | urb->iso_frame_desc[j].offset = k; |
198 | urb->iso_frame_desc[j].length = dev->adev.max_pkt_size; | 204 | urb->iso_frame_desc[j].length = dev->adev.max_pkt_size; |
199 | } | 205 | } |
@@ -293,7 +299,8 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream) | |||
293 | dev->mute = 0; | 299 | dev->mute = 0; |
294 | 300 | ||
295 | /* set alternate setting for audio interface */ | 301 | /* set alternate setting for audio interface */ |
296 | ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 1); /* 1 - 48000 samples per sec */ | 302 | /* 1 - 48000 samples per sec */ |
303 | ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 1); | ||
297 | if (ret < 0) { | 304 | if (ret < 0) { |
298 | cx231xx_errdev("failed to set alternate setting !\n"); | 305 | cx231xx_errdev("failed to set alternate setting !\n"); |
299 | 306 | ||
@@ -324,7 +331,8 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream) | |||
324 | dprintk("closing device\n"); | 331 | dprintk("closing device\n"); |
325 | 332 | ||
326 | /* set alternate setting for audio interface */ | 333 | /* set alternate setting for audio interface */ |
327 | ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0); /* 1 - 48000 samples per sec */ | 334 | /* 1 - 48000 samples per sec */ |
335 | ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0); | ||
328 | if (ret < 0) { | 336 | if (ret < 0) { |
329 | cx231xx_errdev("failed to set alternate setting !\n"); | 337 | cx231xx_errdev("failed to set alternate setting !\n"); |
330 | 338 | ||