diff options
-rw-r--r-- | drivers/staging/tm6000/tm6000-alsa.c | 56 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000-core.c | 1 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000-stds.c | 5 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000-video.c | 8 |
4 files changed, 54 insertions, 16 deletions
diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c index 087137d9164d..a99101fef1a3 100644 --- a/drivers/staging/tm6000/tm6000-alsa.c +++ b/drivers/staging/tm6000/tm6000-alsa.c | |||
@@ -160,15 +160,15 @@ static struct snd_pcm_hardware snd_tm6000_digital_hw = { | |||
160 | SNDRV_PCM_INFO_MMAP_VALID, | 160 | SNDRV_PCM_INFO_MMAP_VALID, |
161 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 161 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
162 | 162 | ||
163 | .rates = SNDRV_PCM_RATE_48000, | 163 | .rates = SNDRV_PCM_RATE_CONTINUOUS, |
164 | .rate_min = 48000, | 164 | .rate_min = 48000, |
165 | .rate_max = 48000, | 165 | .rate_max = 48000, |
166 | .channels_min = 2, | 166 | .channels_min = 2, |
167 | .channels_max = 2, | 167 | .channels_max = 2, |
168 | .period_bytes_min = 62720, | 168 | .period_bytes_min = 64, |
169 | .period_bytes_max = 62720, | 169 | .period_bytes_max = 12544, |
170 | .periods_min = 1, | 170 | .periods_min = 1, |
171 | .periods_max = 1024, | 171 | .periods_max = 98, |
172 | .buffer_bytes_max = 62720 * 8, | 172 | .buffer_bytes_max = 62720 * 8, |
173 | }; | 173 | }; |
174 | 174 | ||
@@ -211,38 +211,64 @@ static int tm6000_fillbuf(struct tm6000_core *core, char *buf, int size) | |||
211 | struct snd_pcm_runtime *runtime; | 211 | struct snd_pcm_runtime *runtime; |
212 | int period_elapsed = 0; | 212 | int period_elapsed = 0; |
213 | unsigned int stride, buf_pos; | 213 | unsigned int stride, buf_pos; |
214 | int length; | ||
214 | 215 | ||
215 | if (!size || !substream) | 216 | if (!size || !substream) { |
217 | dprintk(1, "substream was NULL\n"); | ||
216 | return -EINVAL; | 218 | return -EINVAL; |
219 | } | ||
217 | 220 | ||
218 | runtime = substream->runtime; | 221 | runtime = substream->runtime; |
219 | if (!runtime || !runtime->dma_area) | 222 | if (!runtime || !runtime->dma_area) { |
223 | dprintk(1, "runtime was NULL\n"); | ||
220 | return -EINVAL; | 224 | return -EINVAL; |
225 | } | ||
221 | 226 | ||
222 | buf_pos = chip->buf_pos; | 227 | buf_pos = chip->buf_pos; |
223 | stride = runtime->frame_bits >> 3; | 228 | stride = runtime->frame_bits >> 3; |
224 | 229 | ||
230 | if (stride == 0) { | ||
231 | dprintk(1, "stride is zero\n"); | ||
232 | return -EINVAL; | ||
233 | } | ||
234 | |||
235 | length = size / stride; | ||
236 | if (length == 0) { | ||
237 | dprintk(1, "%s: length was zero\n", __func__); | ||
238 | return -EINVAL; | ||
239 | } | ||
240 | |||
225 | dprintk(1, "Copying %d bytes at %p[%d] - buf size=%d x %d\n", size, | 241 | dprintk(1, "Copying %d bytes at %p[%d] - buf size=%d x %d\n", size, |
226 | runtime->dma_area, buf_pos, | 242 | runtime->dma_area, buf_pos, |
227 | (unsigned int)runtime->buffer_size, stride); | 243 | (unsigned int)runtime->buffer_size, stride); |
228 | 244 | ||
229 | if (buf_pos + size >= runtime->buffer_size * stride) { | 245 | if (buf_pos + length >= runtime->buffer_size) { |
230 | unsigned int cnt = runtime->buffer_size * stride - buf_pos; | 246 | unsigned int cnt = runtime->buffer_size - buf_pos; |
231 | memcpy(runtime->dma_area + buf_pos, buf, cnt); | 247 | memcpy(runtime->dma_area + buf_pos * stride, buf, cnt * stride); |
232 | memcpy(runtime->dma_area, buf + cnt, size - cnt); | 248 | memcpy(runtime->dma_area, buf + cnt * stride, |
249 | length * stride - cnt * stride); | ||
233 | } else | 250 | } else |
234 | memcpy(runtime->dma_area + buf_pos, buf, size); | 251 | memcpy(runtime->dma_area + buf_pos * stride, buf, |
252 | length * stride); | ||
235 | 253 | ||
236 | chip->buf_pos += size; | 254 | #ifndef NO_PCM_LOCK |
237 | if (chip->buf_pos >= runtime->buffer_size * stride) | 255 | snd_pcm_stream_lock(substream); |
238 | chip->buf_pos -= runtime->buffer_size * stride; | 256 | #endif |
239 | 257 | ||
240 | chip->period_pos += size; | 258 | chip->buf_pos += length; |
259 | if (chip->buf_pos >= runtime->buffer_size) | ||
260 | chip->buf_pos -= runtime->buffer_size; | ||
261 | |||
262 | chip->period_pos += length; | ||
241 | if (chip->period_pos >= runtime->period_size) { | 263 | if (chip->period_pos >= runtime->period_size) { |
242 | chip->period_pos -= runtime->period_size; | 264 | chip->period_pos -= runtime->period_size; |
243 | period_elapsed = 1; | 265 | period_elapsed = 1; |
244 | } | 266 | } |
245 | 267 | ||
268 | #ifndef NO_PCM_LOCK | ||
269 | snd_pcm_stream_unlock(substream); | ||
270 | #endif | ||
271 | |||
246 | if (period_elapsed) | 272 | if (period_elapsed) |
247 | snd_pcm_period_elapsed(substream); | 273 | snd_pcm_period_elapsed(substream); |
248 | 274 | ||
diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index cded411d8bba..57cb69e1fce9 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c | |||
@@ -256,7 +256,6 @@ int tm6000_init_analog_mode(struct tm6000_core *dev) | |||
256 | tm6000_set_reg(dev, TM6010_REQ08_R02_A_FIX_GAIN_CTRL, 0x04); | 256 | tm6000_set_reg(dev, TM6010_REQ08_R02_A_FIX_GAIN_CTRL, 0x04); |
257 | tm6000_set_reg(dev, TM6010_REQ08_R03_A_AUTO_GAIN_CTRL, 0x00); | 257 | tm6000_set_reg(dev, TM6010_REQ08_R03_A_AUTO_GAIN_CTRL, 0x00); |
258 | tm6000_set_reg(dev, TM6010_REQ08_R04_A_SIF_AMP_CTRL, 0xa0); | 258 | tm6000_set_reg(dev, TM6010_REQ08_R04_A_SIF_AMP_CTRL, 0xa0); |
259 | tm6000_set_reg(dev, TM6010_REQ08_R05_A_STANDARD_MOD, 0x05); | ||
260 | tm6000_set_reg(dev, TM6010_REQ08_R06_A_SOUND_MOD, 0x06); | 259 | tm6000_set_reg(dev, TM6010_REQ08_R06_A_SOUND_MOD, 0x06); |
261 | tm6000_set_reg(dev, TM6010_REQ08_R07_A_LEFT_VOL, 0x00); | 260 | tm6000_set_reg(dev, TM6010_REQ08_R07_A_LEFT_VOL, 0x00); |
262 | tm6000_set_reg(dev, TM6010_REQ08_R08_A_RIGHT_VOL, 0x00); | 261 | tm6000_set_reg(dev, TM6010_REQ08_R08_A_RIGHT_VOL, 0x00); |
diff --git a/drivers/staging/tm6000/tm6000-stds.c b/drivers/staging/tm6000/tm6000-stds.c index 6bf4a73b320d..f6aa75334d0d 100644 --- a/drivers/staging/tm6000/tm6000-stds.c +++ b/drivers/staging/tm6000/tm6000-stds.c | |||
@@ -96,6 +96,7 @@ static struct tm6000_std_tv_settings tv_stds[] = { | |||
96 | 96 | ||
97 | {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, | 97 | {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, |
98 | {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, | 98 | {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, |
99 | {TM6010_REQ08_R05_A_STANDARD_MOD, 0x21}, /* FIXME */ | ||
99 | {TM6010_REQ07_R3F_RESET, 0x00}, | 100 | {TM6010_REQ07_R3F_RESET, 0x00}, |
100 | {0, 0, 0}, | 101 | {0, 0, 0}, |
101 | }, | 102 | }, |
@@ -154,6 +155,7 @@ static struct tm6000_std_tv_settings tv_stds[] = { | |||
154 | 155 | ||
155 | {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, | 156 | {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, |
156 | {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, | 157 | {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, |
158 | {TM6010_REQ08_R05_A_STANDARD_MOD, 0x21}, /* FIXME */ | ||
157 | {TM6010_REQ07_R3F_RESET, 0x00}, | 159 | {TM6010_REQ07_R3F_RESET, 0x00}, |
158 | {0, 0, 0}, | 160 | {0, 0, 0}, |
159 | }, | 161 | }, |
@@ -212,6 +214,7 @@ static struct tm6000_std_tv_settings tv_stds[] = { | |||
212 | 214 | ||
213 | {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, | 215 | {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, |
214 | {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, | 216 | {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, |
217 | {TM6010_REQ08_R05_A_STANDARD_MOD, 0x76}, /* FIXME */ | ||
215 | {TM6010_REQ07_R3F_RESET, 0x00}, | 218 | {TM6010_REQ07_R3F_RESET, 0x00}, |
216 | {0, 0, 0}, | 219 | {0, 0, 0}, |
217 | }, | 220 | }, |
@@ -269,6 +272,7 @@ static struct tm6000_std_tv_settings tv_stds[] = { | |||
269 | {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0xFF}, | 272 | {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0xFF}, |
270 | 273 | ||
271 | {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, | 274 | {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, |
275 | {TM6010_REQ08_R05_A_STANDARD_MOD, 0x79}, | ||
272 | {TM6010_REQ07_R3F_RESET, 0x00}, | 276 | {TM6010_REQ07_R3F_RESET, 0x00}, |
273 | {0, 0, 0}, | 277 | {0, 0, 0}, |
274 | }, | 278 | }, |
@@ -327,6 +331,7 @@ static struct tm6000_std_tv_settings tv_stds[] = { | |||
327 | 331 | ||
328 | {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdd}, | 332 | {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdd}, |
329 | {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, | 333 | {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, |
334 | {TM6010_REQ08_R05_A_STANDARD_MOD, 0x22}, /* FIXME */ | ||
330 | {TM6010_REQ07_R3F_RESET, 0x00}, | 335 | {TM6010_REQ07_R3F_RESET, 0x00}, |
331 | {0, 0, 0}, | 336 | {0, 0, 0}, |
332 | }, | 337 | }, |
diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 4c22c6584940..a45b012c340e 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c | |||
@@ -304,6 +304,14 @@ static int copy_streams(u8 *data, unsigned long len, | |||
304 | memcpy (&voutp[pos], ptr, cpysize); | 304 | memcpy (&voutp[pos], ptr, cpysize); |
305 | break; | 305 | break; |
306 | case TM6000_URB_MSG_AUDIO: | 306 | case TM6000_URB_MSG_AUDIO: |
307 | /* Need some code to copy audio buffer */ | ||
308 | if (dev->fourcc == V4L2_PIX_FMT_YUYV) { | ||
309 | /* Swap word bytes */ | ||
310 | int i; | ||
311 | |||
312 | for (i = 0; i < cpysize; i += 2) | ||
313 | swab16s((u16 *)(ptr + i)); | ||
314 | } | ||
307 | tm6000_call_fillbuf(dev, TM6000_AUDIO, ptr, cpysize); | 315 | tm6000_call_fillbuf(dev, TM6000_AUDIO, ptr, cpysize); |
308 | break; | 316 | break; |
309 | case TM6000_URB_MSG_VBI: | 317 | case TM6000_URB_MSG_VBI: |