summaryrefslogtreecommitdiff
path: root/linux/drivers/media/common/saa7146_hlp.c
diff options
context:
space:
mode:
authorMichael Hunold <devnull@localhost>2003-07-01 08:54:40 +0000
committerMichael Hunold <devnull@localhost>2003-07-01 08:54:40 +0000
commit3136b2e443e145266f96a7d6f7a4d45bee9cb445 (patch)
treed65b326e40c37f631656b30e69ac55a039829f2e /linux/drivers/media/common/saa7146_hlp.c
parent77521aea06a577eb5dcad9c975a5801868f478bb (diff)
downloadmediapointer-dvb-s2-3136b2e443e145266f96a7d6f7a4d45bee9cb445.tar.gz
mediapointer-dvb-s2-3136b2e443e145266f96a7d6f7a4d45bee9cb445.tar.bz2
- fix a capture problem (fields got lost accidentaly, fields belonging
to different frames were sometimes mixed) - first try to get alternating field capture running - add/change some debug messages
Diffstat (limited to 'linux/drivers/media/common/saa7146_hlp.c')
-rw-r--r--linux/drivers/media/common/saa7146_hlp.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/linux/drivers/media/common/saa7146_hlp.c b/linux/drivers/media/common/saa7146_hlp.c
index 6f1912855..e0bb62bb3 100644
--- a/linux/drivers/media/common/saa7146_hlp.c
+++ b/linux/drivers/media/common/saa7146_hlp.c
@@ -242,7 +242,9 @@ static int calculate_v_scale_registers(struct saa7146_dev *dev, enum v4l2_field
if( 2*out_y >= in_y) {
lpi = 1;
}
- } else if (field == V4L2_FIELD_TOP || field == V4L2_FIELD_BOTTOM) {
+ } else if (field == V4L2_FIELD_TOP
+ || field == V4L2_FIELD_ALTERNATE
+ || field == V4L2_FIELD_BOTTOM) {
if( 4*out_y >= in_y ) {
lpi = 1;
}
@@ -468,9 +470,7 @@ static void calculate_clipping_registers_rect(struct saa7146_dev *dev, struct sa
*clip_format &= 0xfffffff7;
if (V4L2_FIELD_HAS_BOTH(field)) {
*clip_format |= 0x00000008;
- } else if (field == V4L2_FIELD_TOP) {
- *clip_format |= 0x00000000;
- } else if (field == V4L2_FIELD_BOTTOM) {
+ } else {
*clip_format |= 0x00000000;
}
}
@@ -593,6 +593,10 @@ static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int
}
if (V4L2_FIELD_HAS_BOTH(field)) {
+ } else if (field == V4L2_FIELD_ALTERNATE) {
+ /* fixme */
+ vdma1.base_odd = vdma1.prot_addr;
+ vdma1.pitch /= 2;
} else if (field == V4L2_FIELD_TOP) {
vdma1.base_odd = vdma1.prot_addr;
vdma1.pitch /= 2;
@@ -760,6 +764,10 @@ static int calculate_video_dma_grab_packed(struct saa7146_dev* dev, struct saa71
}
if (V4L2_FIELD_HAS_BOTH(field)) {
+ } else if (field == V4L2_FIELD_ALTERNATE) {
+ /* fixme */
+ vdma1.base_odd = vdma1.prot_addr;
+ vdma1.pitch /= 2;
} else if (field == V4L2_FIELD_TOP) {
vdma1.base_odd = vdma1.prot_addr;
vdma1.pitch /= 2;
@@ -896,6 +904,14 @@ static int calculate_video_dma_grab_planar(struct saa7146_dev* dev, struct saa71
}
if (V4L2_FIELD_HAS_BOTH(field)) {
+ } else if (field == V4L2_FIELD_ALTERNATE) {
+ /* fixme */
+ vdma1.base_odd = vdma1.prot_addr;
+ vdma1.pitch /= 2;
+ vdma2.base_odd = vdma2.prot_addr;
+ vdma2.pitch /= 2;
+ vdma3.base_odd = vdma3.prot_addr;
+ vdma3.pitch /= 2;
} else if (field == V4L2_FIELD_TOP) {
vdma1.base_odd = vdma1.prot_addr;
vdma1.pitch /= 2;
@@ -946,11 +962,11 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar)
o_wait = tmp;
}
- /* wait for o_fid_a/b / e_fid_a/b toggle only if bit 0 is not set*/
+ /* wait for o_fid_a/b / e_fid_a/b toggle only if rps register 0 is not set*/
WRITE_RPS0(CMD_PAUSE | CMD_OAN | CMD_SIG0 | e_wait);
WRITE_RPS0(CMD_PAUSE | CMD_OAN | CMD_SIG0 | o_wait);
- /* set bit 0 */
+ /* set rps register 0 */
WRITE_RPS0(CMD_WR_REG | (1 << 8) | (MC2/4));
WRITE_RPS0(MASK_27 | MASK_11);
@@ -1000,9 +1016,17 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar)
void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next)
{
struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat);
-
+ u32 vdma1_prot_addr;
+
DEB_CAP(("buf:%p, next:%p\n",buf,next));
+ vdma1_prot_addr = saa7146_read(dev, PROT_ADDR1);
+ if( 0 == vdma1_prot_addr ) {
+ /* clear out beginning of streaming bit (rps register 0)*/
+ DEB_CAP(("forcing sync to new frame\n"));
+ saa7146_write(dev, MC2, MASK_27 );
+ }
+
saa7146_set_window(dev, buf->fmt->width, buf->fmt->height, buf->fmt->field);
saa7146_set_output_format(dev, sfmt->trans);
saa7146_disable_clipping(dev);
@@ -1014,7 +1038,7 @@ void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struc
calculate_video_dma_grab_packed(dev, buf);
program_capture_engine(dev,0);
}
-
+
/* write the address of the rps-program */
saa7146_write(dev, RPS_ADDR0, dev->d_rps0.dma_handle);