aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bttv-risc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/bttv-risc.c')
-rw-r--r--drivers/media/video/bttv-risc.c110
1 files changed, 55 insertions, 55 deletions
diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bttv-risc.c
index a5ed99b89445..b40e9734bf08 100644
--- a/drivers/media/video/bttv-risc.c
+++ b/drivers/media/video/bttv-risc.c
@@ -74,27 +74,27 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
74 } 74 }
75 if (bpl <= sg_dma_len(sg)-offset) { 75 if (bpl <= sg_dma_len(sg)-offset) {
76 /* fits into current chunk */ 76 /* fits into current chunk */
77 *(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_SOL| 77 *(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_SOL|
78 BT848_RISC_EOL|bpl); 78 BT848_RISC_EOL|bpl);
79 *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); 79 *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset);
80 offset+=bpl; 80 offset+=bpl;
81 } else { 81 } else {
82 /* scanline needs to be splitted */ 82 /* scanline needs to be splitted */
83 todo = bpl; 83 todo = bpl;
84 *(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_SOL| 84 *(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_SOL|
85 (sg_dma_len(sg)-offset)); 85 (sg_dma_len(sg)-offset));
86 *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); 86 *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset);
87 todo -= (sg_dma_len(sg)-offset); 87 todo -= (sg_dma_len(sg)-offset);
88 offset = 0; 88 offset = 0;
89 sg++; 89 sg++;
90 while (todo > sg_dma_len(sg)) { 90 while (todo > sg_dma_len(sg)) {
91 *(rp++)=cpu_to_le32(BT848_RISC_WRITE| 91 *(rp++)=cpu_to_le32(BT848_RISC_WRITE|
92 sg_dma_len(sg)); 92 sg_dma_len(sg));
93 *(rp++)=cpu_to_le32(sg_dma_address(sg)); 93 *(rp++)=cpu_to_le32(sg_dma_address(sg));
94 todo -= sg_dma_len(sg); 94 todo -= sg_dma_len(sg);
95 sg++; 95 sg++;
96 } 96 }
97 *(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_EOL| 97 *(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_EOL|
98 todo); 98 todo);
99 *(rp++)=cpu_to_le32(sg_dma_address(sg)); 99 *(rp++)=cpu_to_le32(sg_dma_address(sg));
100 offset += todo; 100 offset += todo;
@@ -201,8 +201,8 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
201 ri |= BT848_RISC_EOL; 201 ri |= BT848_RISC_EOL;
202 202
203 /* write risc instruction */ 203 /* write risc instruction */
204 *(rp++)=cpu_to_le32(ri | ylen); 204 *(rp++)=cpu_to_le32(ri | ylen);
205 *(rp++)=cpu_to_le32(((ylen >> hshift) << 16) | 205 *(rp++)=cpu_to_le32(((ylen >> hshift) << 16) |
206 (ylen >> hshift)); 206 (ylen >> hshift));
207 *(rp++)=cpu_to_le32(sg_dma_address(ysg)+yoffset); 207 *(rp++)=cpu_to_le32(sg_dma_address(ysg)+yoffset);
208 yoffset += ylen; 208 yoffset += ylen;
@@ -319,7 +319,7 @@ bttv_calc_geo(struct bttv *btv, struct bttv_geometry *geo,
319 int width, int height, int interleaved, int norm) 319 int width, int height, int interleaved, int norm)
320{ 320{
321 const struct bttv_tvnorm *tvnorm = &bttv_tvnorms[norm]; 321 const struct bttv_tvnorm *tvnorm = &bttv_tvnorms[norm];
322 u32 xsf, sr; 322 u32 xsf, sr;
323 int vdelay; 323 int vdelay;
324 324
325 int swidth = tvnorm->swidth; 325 int swidth = tvnorm->swidth;
@@ -334,52 +334,52 @@ bttv_calc_geo(struct bttv *btv, struct bttv_geometry *geo,
334 334
335 vdelay = tvnorm->vdelay; 335 vdelay = tvnorm->vdelay;
336 336
337 xsf = (width*scaledtwidth)/swidth; 337 xsf = (width*scaledtwidth)/swidth;
338 geo->hscale = ((totalwidth*4096UL)/xsf-4096); 338 geo->hscale = ((totalwidth*4096UL)/xsf-4096);
339 geo->hdelay = tvnorm->hdelayx1; 339 geo->hdelay = tvnorm->hdelayx1;
340 geo->hdelay = (geo->hdelay*width)/swidth; 340 geo->hdelay = (geo->hdelay*width)/swidth;
341 geo->hdelay &= 0x3fe; 341 geo->hdelay &= 0x3fe;
342 sr = ((tvnorm->sheight >> (interleaved?0:1))*512)/height - 512; 342 sr = ((tvnorm->sheight >> (interleaved?0:1))*512)/height - 512;
343 geo->vscale = (0x10000UL-sr) & 0x1fff; 343 geo->vscale = (0x10000UL-sr) & 0x1fff;
344 geo->crop = ((width>>8)&0x03) | ((geo->hdelay>>6)&0x0c) | 344 geo->crop = ((width>>8)&0x03) | ((geo->hdelay>>6)&0x0c) |
345 ((tvnorm->sheight>>4)&0x30) | ((vdelay>>2)&0xc0); 345 ((tvnorm->sheight>>4)&0x30) | ((vdelay>>2)&0xc0);
346 geo->vscale |= interleaved ? (BT848_VSCALE_INT<<8) : 0; 346 geo->vscale |= interleaved ? (BT848_VSCALE_INT<<8) : 0;
347 geo->vdelay = vdelay; 347 geo->vdelay = vdelay;
348 geo->width = width; 348 geo->width = width;
349 geo->sheight = tvnorm->sheight; 349 geo->sheight = tvnorm->sheight;
350 geo->vtotal = tvnorm->vtotal; 350 geo->vtotal = tvnorm->vtotal;
351 351
352 if (btv->opt_combfilter) { 352 if (btv->opt_combfilter) {
353 geo->vtc = (width < 193) ? 2 : ((width < 385) ? 1 : 0); 353 geo->vtc = (width < 193) ? 2 : ((width < 385) ? 1 : 0);
354 geo->comb = (width < 769) ? 1 : 0; 354 geo->comb = (width < 769) ? 1 : 0;
355 } else { 355 } else {
356 geo->vtc = 0; 356 geo->vtc = 0;
357 geo->comb = 0; 357 geo->comb = 0;
358 } 358 }
359} 359}
360 360
361static void 361static void
362bttv_apply_geo(struct bttv *btv, struct bttv_geometry *geo, int odd) 362bttv_apply_geo(struct bttv *btv, struct bttv_geometry *geo, int odd)
363{ 363{
364 int off = odd ? 0x80 : 0x00; 364 int off = odd ? 0x80 : 0x00;
365 365
366 if (geo->comb) 366 if (geo->comb)
367 btor(BT848_VSCALE_COMB, BT848_E_VSCALE_HI+off); 367 btor(BT848_VSCALE_COMB, BT848_E_VSCALE_HI+off);
368 else 368 else
369 btand(~BT848_VSCALE_COMB, BT848_E_VSCALE_HI+off); 369 btand(~BT848_VSCALE_COMB, BT848_E_VSCALE_HI+off);
370 370
371 btwrite(geo->vtc, BT848_E_VTC+off); 371 btwrite(geo->vtc, BT848_E_VTC+off);
372 btwrite(geo->hscale >> 8, BT848_E_HSCALE_HI+off); 372 btwrite(geo->hscale >> 8, BT848_E_HSCALE_HI+off);
373 btwrite(geo->hscale & 0xff, BT848_E_HSCALE_LO+off); 373 btwrite(geo->hscale & 0xff, BT848_E_HSCALE_LO+off);
374 btaor((geo->vscale>>8), 0xe0, BT848_E_VSCALE_HI+off); 374 btaor((geo->vscale>>8), 0xe0, BT848_E_VSCALE_HI+off);
375 btwrite(geo->vscale & 0xff, BT848_E_VSCALE_LO+off); 375 btwrite(geo->vscale & 0xff, BT848_E_VSCALE_LO+off);
376 btwrite(geo->width & 0xff, BT848_E_HACTIVE_LO+off); 376 btwrite(geo->width & 0xff, BT848_E_HACTIVE_LO+off);
377 btwrite(geo->hdelay & 0xff, BT848_E_HDELAY_LO+off); 377 btwrite(geo->hdelay & 0xff, BT848_E_HDELAY_LO+off);
378 btwrite(geo->sheight & 0xff, BT848_E_VACTIVE_LO+off); 378 btwrite(geo->sheight & 0xff, BT848_E_VACTIVE_LO+off);
379 btwrite(geo->vdelay & 0xff, BT848_E_VDELAY_LO+off); 379 btwrite(geo->vdelay & 0xff, BT848_E_VDELAY_LO+off);
380 btwrite(geo->crop, BT848_E_CROP+off); 380 btwrite(geo->crop, BT848_E_CROP+off);
381 btwrite(geo->vtotal>>8, BT848_VTOTAL_HI); 381 btwrite(geo->vtotal>>8, BT848_VTOTAL_HI);
382 btwrite(geo->vtotal & 0xff, BT848_VTOTAL_LO); 382 btwrite(geo->vtotal & 0xff, BT848_VTOTAL_LO);
383} 383}
384 384
385/* ---------------------------------------------------------- */ 385/* ---------------------------------------------------------- */
@@ -420,7 +420,7 @@ bttv_set_dma(struct bttv *btv, int override)
420 } else { 420 } else {
421 del_timer(&btv->timeout); 421 del_timer(&btv->timeout);
422 } 422 }
423 btv->main.cpu[RISC_SLOT_LOOP] = cpu_to_le32(cmd); 423 btv->main.cpu[RISC_SLOT_LOOP] = cpu_to_le32(cmd);
424 424
425 btaor(capctl, ~0x0f, BT848_CAP_CTL); 425 btaor(capctl, ~0x0f, BT848_CAP_CTL);
426 if (capctl) { 426 if (capctl) {
@@ -432,7 +432,7 @@ bttv_set_dma(struct bttv *btv, int override)
432 } else { 432 } else {
433 if (!btv->dma_on) 433 if (!btv->dma_on)
434 return; 434 return;
435 btand(~3, BT848_GPIO_DMA_CTL); 435 btand(~3, BT848_GPIO_DMA_CTL);
436 btv->dma_on = 0; 436 btv->dma_on = 0;
437 } 437 }
438 return; 438 return;
@@ -460,19 +460,19 @@ bttv_risc_init_main(struct bttv *btv)
460 btv->main.cpu[6] = cpu_to_le32(BT848_RISC_JUMP); 460 btv->main.cpu[6] = cpu_to_le32(BT848_RISC_JUMP);
461 btv->main.cpu[7] = cpu_to_le32(btv->main.dma + (8<<2)); 461 btv->main.cpu[7] = cpu_to_le32(btv->main.dma + (8<<2));
462 462
463 btv->main.cpu[8] = cpu_to_le32(BT848_RISC_SYNC | BT848_RISC_RESYNC | 463 btv->main.cpu[8] = cpu_to_le32(BT848_RISC_SYNC | BT848_RISC_RESYNC |
464 BT848_FIFO_STATUS_VRO); 464 BT848_FIFO_STATUS_VRO);
465 btv->main.cpu[9] = cpu_to_le32(0); 465 btv->main.cpu[9] = cpu_to_le32(0);
466 466
467 /* bottom field */ 467 /* bottom field */
468 btv->main.cpu[10] = cpu_to_le32(BT848_RISC_JUMP); 468 btv->main.cpu[10] = cpu_to_le32(BT848_RISC_JUMP);
469 btv->main.cpu[11] = cpu_to_le32(btv->main.dma + (12<<2)); 469 btv->main.cpu[11] = cpu_to_le32(btv->main.dma + (12<<2));
470 btv->main.cpu[12] = cpu_to_le32(BT848_RISC_JUMP); 470 btv->main.cpu[12] = cpu_to_le32(BT848_RISC_JUMP);
471 btv->main.cpu[13] = cpu_to_le32(btv->main.dma + (14<<2)); 471 btv->main.cpu[13] = cpu_to_le32(btv->main.dma + (14<<2));
472 472
473 /* jump back to top field */ 473 /* jump back to top field */
474 btv->main.cpu[14] = cpu_to_le32(BT848_RISC_JUMP); 474 btv->main.cpu[14] = cpu_to_le32(BT848_RISC_JUMP);
475 btv->main.cpu[15] = cpu_to_le32(btv->main.dma + (0<<2)); 475 btv->main.cpu[15] = cpu_to_le32(btv->main.dma + (0<<2));
476 476
477 return 0; 477 return 0;
478} 478}