summaryrefslogtreecommitdiff
path: root/linux/drivers/media/common
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/common')
-rw-r--r--linux/drivers/media/common/saa7146_hlp.c227
-rw-r--r--linux/drivers/media/common/saa7146_i2c.c50
-rw-r--r--linux/drivers/media/common/saa7146_vbi.c68
-rw-r--r--linux/drivers/media/common/saa7146_video.c156
4 files changed, 250 insertions, 251 deletions
diff --git a/linux/drivers/media/common/saa7146_hlp.c b/linux/drivers/media/common/saa7146_hlp.c
index 9c93c3fe1..ec52dff8c 100644
--- a/linux/drivers/media/common/saa7146_hlp.c
+++ b/linux/drivers/media/common/saa7146_hlp.c
@@ -4,7 +4,7 @@
static void calculate_output_format_register(struct saa7146_dev* saa, u32 palette, u32* clip_format)
{
/* clear out the necessary bits */
- *clip_format &= 0x0000ffff;
+ *clip_format &= 0x0000ffff;
/* set these bits new */
*clip_format |= (( ((palette&0xf00)>>8) << 30) | ((palette&0x00f) << 24) | (((palette&0x0f0)>>4) << 16));
}
@@ -21,7 +21,7 @@ static void calculate_hxo_and_hyo(struct saa7146_vv *vv, u32* hps_h_scale, u32*
hyo = vv->standard->v_offset;
hxo = vv->standard->h_offset;
-
+
*hps_h_scale &= ~(MASK_B0 | 0xf00);
*hps_h_scale |= (hxo << 0);
@@ -40,7 +40,7 @@ static void calculate_hxo_and_hyo(struct saa7146_vv *vv, u32* hps_h_scale, u32*
static struct {
u16 hps_coeff;
u16 weight_sum;
-} hps_h_coeff_tab [] = {
+} hps_h_coeff_tab [] = {
{0x00, 2}, {0x02, 4}, {0x00, 4}, {0x06, 8}, {0x02, 8},
{0x08, 8}, {0x00, 8}, {0x1E, 16}, {0x0E, 8}, {0x26, 8},
{0x06, 8}, {0x42, 8}, {0x02, 8}, {0x80, 8}, {0x00, 8},
@@ -65,11 +65,11 @@ static int calculate_h_scale_registers(struct saa7146_dev *dev,
u32* hps_ctrl, u32* hps_v_gain, u32* hps_h_prescale, u32* hps_h_scale)
{
/* horizontal prescaler */
- u32 dcgx = 0, xpsc = 0, xacm = 0, cxy = 0, cxuv = 0;
+ u32 dcgx = 0, xpsc = 0, xacm = 0, cxy = 0, cxuv = 0;
/* horizontal scaler */
- u32 xim = 0, xp = 0, xsci =0;
+ u32 xim = 0, xp = 0, xsci =0;
/* vertical scale & gain */
- u32 pfuv = 0;
+ u32 pfuv = 0;
/* helper variables */
u32 h_atten = 0, i = 0;
@@ -77,29 +77,29 @@ static int calculate_h_scale_registers(struct saa7146_dev *dev,
if ( 0 == out_x ) {
return -EINVAL;
}
-
+
/* mask out vanity-bit */
*hps_ctrl &= ~MASK_29;
-
+
/* calculate prescale-(xspc)-value: [n .. 1/2) : 1
- [1/2 .. 1/3) : 2
- [1/3 .. 1/4) : 3
- ... */
+ [1/2 .. 1/3) : 2
+ [1/3 .. 1/4) : 3
+ ... */
if (in_x > out_x) {
xpsc = in_x / out_x;
}
else {
/* zooming */
- xpsc = 1;
+ xpsc = 1;
}
-
+
/* if flip_lr-bit is set, number of pixels after
horizontal prescaling must be < 384 */
if ( 0 != flip_lr ) {
-
+
/* set vanity bit */
*hps_ctrl |= MASK_29;
-
+
while (in_x / xpsc >= 384 )
xpsc++;
}
@@ -109,35 +109,35 @@ static int calculate_h_scale_registers(struct saa7146_dev *dev,
while ( in_x / xpsc >= 768 )
xpsc++;
}
-
+
/* maximum prescale is 64 (p.69) */
if ( xpsc > 64 )
xpsc = 64;
/* keep xacm clear*/
xacm = 0;
-
+
/* set horizontal filter parameters (CXY = CXUV) */
cxy = hps_h_coeff_tab[( (xpsc - 1) < 63 ? (xpsc - 1) : 63 )].hps_coeff;
cxuv = cxy;
-
+
/* calculate and set horizontal fine scale (xsci) */
-
+
/* bypass the horizontal scaler ? */
if ( (in_x == out_x) && ( 1 == xpsc ) )
xsci = 0x400;
- else
+ else
xsci = ( (1024 * in_x) / (out_x * xpsc) ) + xpsc;
- /* set start phase for horizontal fine scale (xp) to 0 */
+ /* set start phase for horizontal fine scale (xp) to 0 */
xp = 0;
-
+
/* set xim, if we bypass the horizontal scaler */
if ( 0x400 == xsci )
xim = 1;
else
xim = 0;
-
+
/* if the prescaler is bypassed, enable horizontal
accumulation mode (xacm) and clear dcgx */
if( 1 == xpsc ) {
@@ -148,12 +148,12 @@ static int calculate_h_scale_registers(struct saa7146_dev *dev,
/* get best match in the table of attenuations
for horizontal scaling */
h_atten = hps_h_coeff_tab[( (xpsc - 1) < 63 ? (xpsc - 1) : 63 )].weight_sum;
-
+
for (i = 0; h_attenuation[i] != 0; i++) {
if (h_attenuation[i] >= h_atten)
break;
}
-
+
dcgx = i;
}
@@ -171,11 +171,11 @@ static int calculate_h_scale_registers(struct saa7146_dev *dev,
else
pfuv = 0x33;
-
+
*hps_v_gain &= MASK_W0|MASK_B2;
- *hps_v_gain |= (pfuv << 24);
+ *hps_v_gain |= (pfuv << 24);
- *hps_h_scale &= ~(MASK_W1 | 0xf000);
+ *hps_h_scale &= ~(MASK_W1 | 0xf000);
*hps_h_scale |= (xim << 31) | (xp << 24) | (xsci << 12);
*hps_h_prescale |= (dcgx << 27) | ((xpsc-1) << 18) | (xacm << 17) | (cxy << 8) | (cxuv << 0);
@@ -186,7 +186,7 @@ static int calculate_h_scale_registers(struct saa7146_dev *dev,
static struct {
u16 hps_coeff;
u16 weight_sum;
-} hps_v_coeff_tab [] = {
+} hps_v_coeff_tab [] = {
{0x0100, 2}, {0x0102, 4}, {0x0300, 4}, {0x0106, 8}, {0x0502, 8},
{0x0708, 8}, {0x0F00, 8}, {0x011E, 16}, {0x110E, 16}, {0x1926, 16},
{0x3906, 16}, {0x3D42, 16}, {0x7D02, 16}, {0x7F80, 16}, {0xFF00, 16},
@@ -210,14 +210,14 @@ static int calculate_v_scale_registers(struct saa7146_dev *dev, enum v4l2_field
int in_y, int out_y, u32* hps_v_scale, u32* hps_v_gain)
{
int lpi = 0;
-
+
/* vertical scaling */
u32 yacm = 0, ysci = 0, yacl = 0, ypo = 0, ype = 0;
/* vertical scale & gain */
u32 dcgy = 0, cya_cyb = 0;
-
+
/* helper variables */
- u32 v_atten = 0, i = 0;
+ u32 v_atten = 0, i = 0;
/* error, if vertical zooming */
if ( in_y < out_y ) {
@@ -245,7 +245,7 @@ static int calculate_v_scale_registers(struct saa7146_dev *dev, enum v4l2_field
yacm = 0;
yacl = 0;
cya_cyb = 0x00ff;
-
+
/* calculate scaling increment */
if ( in_y > out_y )
ysci = ((1024 * in_y) / (out_y + 1)) - 1024;
@@ -257,9 +257,9 @@ static int calculate_v_scale_registers(struct saa7146_dev *dev, enum v4l2_field
/* calculate ype and ypo */
ype = ysci / 16;
ypo = ype + (ysci / 64);
-
+
} else {
- yacm = 1;
+ yacm = 1;
/* calculate scaling increment */
ysci = (((10 * 1024 * (in_y - out_y - 1)) / in_y) + 9) / 10;
@@ -269,7 +269,7 @@ static int calculate_v_scale_registers(struct saa7146_dev *dev, enum v4l2_field
/* the sequence length interval (yacl) has to be set according
to the prescale value, e.g. [n .. 1/2) : 0
- [1/2 .. 1/3) : 1
+ [1/2 .. 1/3) : 1
[1/3 .. 1/4) : 2
... */
if ( ysci < 512) {
@@ -278,7 +278,7 @@ static int calculate_v_scale_registers(struct saa7146_dev *dev, enum v4l2_field
yacl = ( ysci / (1024 - ysci) );
}
- /* get filter coefficients for cya, cyb from table hps_v_coeff_tab */
+ /* get filter coefficients for cya, cyb from table hps_v_coeff_tab */
cya_cyb = hps_v_coeff_tab[ (yacl < 63 ? yacl : 63 ) ].hps_coeff;
/* get best match in the table of attenuations for vertical scaling */
@@ -288,7 +288,7 @@ static int calculate_v_scale_registers(struct saa7146_dev *dev, enum v4l2_field
if (v_attenuation[i] >= v_atten)
break;
}
-
+
dcgy = i;
}
@@ -306,12 +306,12 @@ static int sort_and_eliminate(u32* values, int* count)
{
int low = 0, high = 0, top = 0, temp = 0;
int cur = 0, next = 0;
-
+
/* sanity checks */
if( (0 > *count) || (NULL == values) ) {
return -EINVAL;
}
-
+
/* bubble sort the first ´count´ items of the array ´values´ */
for( top = *count; top > 0; top--) {
for( low = 0, high = 1; high < top; low++, high++) {
@@ -328,9 +328,9 @@ static int sort_and_eliminate(u32* values, int* count)
if( values[cur] != values[next])
values[++cur] = values[next];
}
-
+
*count = cur + 1;
-
+
return 0;
}
@@ -343,8 +343,8 @@ static void calculate_clipping_registers_rect(struct saa7146_dev *dev, struct sa
int width = fh->ov.win.w.width;
int height = fh->ov.win.w.height;
int clipcount = fh->ov.nclips;
-
- u32 line_list[32];
+
+ u32 line_list[32];
u32 pixel_list[32];
int numdwords = 0;
@@ -361,12 +361,12 @@ static void calculate_clipping_registers_rect(struct saa7146_dev *dev, struct sa
/* fill the line and pixel-lists */
for(i = 0; i < clipcount; i++) {
int l = 0, r = 0, t = 0, b = 0;
-
+
x[i] = fh->ov.clips[i].c.left;
y[i] = fh->ov.clips[i].c.top;
w[i] = fh->ov.clips[i].c.width;
h[i] = fh->ov.clips[i].c.height;
-
+
if( w[i] < 0) {
x[i] += w[i]; w[i] = -w[i];
}
@@ -378,7 +378,7 @@ static void calculate_clipping_registers_rect(struct saa7146_dev *dev, struct sa
}
if( y[i] < 0) {
h[i] += y[i]; y[i] = 0;
- }
+ }
if( 0 != vv->vflip ) {
y[i] = height - y[i] - h[i];
}
@@ -387,7 +387,7 @@ static void calculate_clipping_registers_rect(struct saa7146_dev *dev, struct sa
r = x[i]+w[i];
t = y[i];
b = y[i]+h[i];
-
+
/* insert left/right coordinates */
pixel_list[ 2*i ] = min_t(int, l, width);
pixel_list[(2*i)+1] = min_t(int, r, width);
@@ -423,9 +423,9 @@ static void calculate_clipping_registers_rect(struct saa7146_dev *dev, struct sa
x[j] = 0;
if( pixel_list[i] < (x[j] + w[j])) {
-
+
if ( pixel_list[i] >= x[j] ) {
- clipping[2*i] |= cpu_to_le32(1 << j);
+ clipping[2*i] |= cpu_to_le32(1 << j);
}
}
}
@@ -437,7 +437,7 @@ static void calculate_clipping_registers_rect(struct saa7146_dev *dev, struct sa
if( line_list[i] < (y[j] + h[j]) ) {
if( line_list[i] >= y[j] ) {
- clipping[(2*i)+1] |= cpu_to_le32(1 << j);
+ clipping[(2*i)+1] |= cpu_to_le32(1 << j);
}
}
}
@@ -445,8 +445,8 @@ static void calculate_clipping_registers_rect(struct saa7146_dev *dev, struct sa
/* adjust arbitration control register */
*arbtr_ctrl &= 0xffff00ff;
- *arbtr_ctrl |= 0x00001c00;
-
+ *arbtr_ctrl |= 0x00001c00;
+
vdma2->base_even = vv->d_clipping.dma_handle;
vdma2->base_odd = vv->d_clipping.dma_handle;
vdma2->prot_addr = vv->d_clipping.dma_handle+((sizeof(u32))*(numdwords));
@@ -473,9 +473,9 @@ static void saa7146_disable_clipping(struct saa7146_dev *dev)
/* upload clipping-registers*/
saa7146_write(dev, CLIP_FORMAT_CTRL,clip_format);
- saa7146_write(dev, MC2, (MASK_05 | MASK_21));
-
- /* disable video dma2 */
+ saa7146_write(dev, MC2, (MASK_05 | MASK_21));
+
+ /* disable video dma2 */
saa7146_write(dev, MC1, MASK_21);
}
@@ -486,10 +486,10 @@ static void saa7146_set_clipping_rect(struct saa7146_fh *fh)
struct saa7146_video_dma vdma2;
u32 clip_format;
u32 arbtr_ctrl;
-
+
/* check clipcount, disable clipping if clipcount == 0*/
if( fh->ov.nclips == 0 ) {
- saa7146_disable_clipping(dev);
+ saa7146_disable_clipping(dev);
return;
}
@@ -509,10 +509,10 @@ static void saa7146_set_clipping_rect(struct saa7146_fh *fh)
saa7146_write(dev, BASE_PAGE2, vdma2.base_page);
saa7146_write(dev, PITCH2, vdma2.pitch);
saa7146_write(dev, NUM_LINE_BYTE2, vdma2.num_line_byte);
-
+
/* prepare the rest */
saa7146_write(dev, CLIP_FORMAT_CTRL,clip_format);
- saa7146_write(dev, PCI_BT_V1, arbtr_ctrl);
+ saa7146_write(dev, PCI_BT_V1, arbtr_ctrl);
/* upload clip_control-register, clipping-registers, enable video dma2 */
saa7146_write(dev, MC2, (MASK_05 | MASK_21 | MASK_03 | MASK_19));
@@ -530,11 +530,11 @@ static void saa7146_set_window(struct saa7146_dev *dev, int width, int height, e
/* set vertical scale */
hps_v_scale = 0; /* all bits get set by the function-call */
- hps_v_gain = 0; /* fixme: saa7146_read(dev, HPS_V_GAIN);*/
+ hps_v_gain = 0; /* fixme: saa7146_read(dev, HPS_V_GAIN);*/
calculate_v_scale_registers(dev, field, vv->standard->v_field*2, height, &hps_v_scale, &hps_v_gain);
/* set horizontal scale */
- hps_ctrl = 0;
+ hps_ctrl = 0;
hps_h_prescale = 0; /* all bits get set in the function */
hps_h_scale = 0;
calculate_h_scale_registers(dev, vv->standard->h_pixels, width, vv->hflip, &hps_ctrl, &hps_v_gain, &hps_h_prescale, &hps_h_scale);
@@ -542,43 +542,43 @@ static void saa7146_set_window(struct saa7146_dev *dev, int width, int height, e
/* set hyo and hxo */
calculate_hxo_and_hyo(vv, &hps_h_scale, &hps_ctrl);
calculate_hps_source_and_sync(dev, source, sync, &hps_ctrl);
-
+
/* write out new register contents */
saa7146_write(dev, HPS_V_SCALE, hps_v_scale);
saa7146_write(dev, HPS_V_GAIN, hps_v_gain);
saa7146_write(dev, HPS_CTRL, hps_ctrl);
saa7146_write(dev, HPS_H_PRESCALE,hps_h_prescale);
saa7146_write(dev, HPS_H_SCALE, hps_h_scale);
-
+
/* upload shadow-ram registers */
- saa7146_write(dev, MC2, (MASK_05 | MASK_06 | MASK_21 | MASK_22) );
+ saa7146_write(dev, MC2, (MASK_05 | MASK_06 | MASK_21 | MASK_22) );
}
/* calculate the new memory offsets for a desired position */
static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_height, enum v4l2_field field, u32 pixelformat)
-{
+{
struct saa7146_vv *vv = dev->vv_data;
struct saa7146_format *sfmt = format_by_fourcc(dev, pixelformat);
int b_depth = vv->ov_fmt->depth;
int b_bpl = vv->ov_fb.fmt.bytesperline;
u32 base = (u32)vv->ov_fb.base;
-
+
struct saa7146_video_dma vdma1;
/* calculate memory offsets for picture, look if we shall top-down-flip */
vdma1.pitch = 2*b_bpl;
if ( 0 == vv->vflip ) {
- vdma1.base_even = (u32)base + (w_y * (vdma1.pitch/2)) + (w_x * (b_depth / 8));
+ vdma1.base_even = (u32)base + (w_y * (vdma1.pitch/2)) + (w_x * (b_depth / 8));
vdma1.base_odd = vdma1.base_even + (vdma1.pitch / 2);
vdma1.prot_addr = vdma1.base_even + (w_height * (vdma1.pitch / 2));
}
else {
- vdma1.base_even = (u32)base + ((w_y+w_height) * (vdma1.pitch/2)) + (w_x * (b_depth / 8));
+ vdma1.base_even = (u32)base + ((w_y+w_height) * (vdma1.pitch/2)) + (w_x * (b_depth / 8));
vdma1.base_odd = vdma1.base_even - (vdma1.pitch / 2);
vdma1.prot_addr = vdma1.base_odd - (w_height * (vdma1.pitch / 2));
}
-
+
if (V4L2_FIELD_HAS_BOTH(field)) {
} else if (field == V4L2_FIELD_ALTERNATE) {
/* fixme */
@@ -596,7 +596,7 @@ static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int
if ( 0 != vv->vflip ) {
vdma1.pitch *= -1;
}
-
+
vdma1.base_page = sfmt->swap;
vdma1.num_line_byte = (vv->standard->v_field<<16)+vv->standard->h_pixels;
@@ -606,13 +606,13 @@ static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int
static void saa7146_set_output_format(struct saa7146_dev *dev, unsigned long palette)
{
u32 clip_format = saa7146_read(dev, CLIP_FORMAT_CTRL);
-
+
/* call helper function */
calculate_output_format_register(dev,palette,&clip_format);
/* update the hps registers */
saa7146_write(dev, CLIP_FORMAT_CTRL, clip_format);
- saa7146_write(dev, MC2, (MASK_05 | MASK_21));
+ saa7146_write(dev, MC2, (MASK_05 | MASK_21));
}
/* select input-source */
@@ -630,10 +630,10 @@ void saa7146_set_hps_source_and_sync(struct saa7146_dev *dev, int source, int sy
/* write back & upload register */
saa7146_write(dev, HPS_CTRL, hps_ctrl);
saa7146_write(dev, MC2, (MASK_05 | MASK_21));
-
+
vv->current_hps_source = source;
vv->current_hps_sync = sync;
-}
+}
int saa7146_enable_overlay(struct saa7146_fh *fh)
{
@@ -648,38 +648,38 @@ int saa7146_enable_overlay(struct saa7146_fh *fh)
/* enable video dma1 */
saa7146_write(dev, MC1, (MASK_06 | MASK_22));
return 0;
-}
+}
void saa7146_disable_overlay(struct saa7146_fh *fh)
{
struct saa7146_dev *dev = fh->dev;
/* disable clipping + video dma1 */
- saa7146_disable_clipping(dev);
+ saa7146_disable_clipping(dev);
saa7146_write(dev, MC1, MASK_22);
-}
+}
-void saa7146_write_out_dma(struct saa7146_dev* dev, int which, struct saa7146_video_dma* vdma)
+void saa7146_write_out_dma(struct saa7146_dev* dev, int which, struct saa7146_video_dma* vdma)
{
int where = 0;
-
+
if( which < 1 || which > 3) {
return;
}
-
+
/* calculate starting address */
where = (which-1)*0x18;
- saa7146_write(dev, where, vdma->base_odd);
- saa7146_write(dev, where+0x04, vdma->base_even);
- saa7146_write(dev, where+0x08, vdma->prot_addr);
- saa7146_write(dev, where+0x0c, vdma->pitch);
- saa7146_write(dev, where+0x10, vdma->base_page);
+ saa7146_write(dev, where, vdma->base_odd);
+ saa7146_write(dev, where+0x04, vdma->base_even);
+ saa7146_write(dev, where+0x08, vdma->prot_addr);
+ saa7146_write(dev, where+0x0c, vdma->pitch);
+ saa7146_write(dev, where+0x10, vdma->base_page);
saa7146_write(dev, where+0x14, vdma->num_line_byte);
-
+
/* upload */
- saa7146_write(dev, MC2, (MASK_02<<(which-1))|(MASK_18<<(which-1)));
-/*
+ saa7146_write(dev, MC2, (MASK_02<<(which-1))|(MASK_18<<(which-1)));
+/*
printk("vdma%d.base_even: 0x%08x\n", which,vdma->base_even);
printk("vdma%d.base_odd: 0x%08x\n", which,vdma->base_odd);
printk("vdma%d.prot_addr: 0x%08x\n", which,vdma->prot_addr);
@@ -713,7 +713,7 @@ static int calculate_video_dma_grab_packed(struct saa7146_dev* dev, struct saa71
}
vdma1.num_line_byte = ((vv->standard->v_field<<16) + vv->standard->h_pixels);
vdma1.base_page = buf->pt[0].dma | ME1 | sfmt->swap;
-
+
if( 0 != vv->vflip ) {
vdma1.prot_addr = buf->pt[0].offset;
vdma1.base_even = buf->pt[0].offset+(vdma1.pitch/2)*height;
@@ -746,7 +746,7 @@ static int calculate_video_dma_grab_packed(struct saa7146_dev* dev, struct saa71
if( 0 != vv->vflip ) {
vdma1.pitch *= -1;
- }
+ }
saa7146_write_out_dma(dev, 1, &vdma1);
return 0;
@@ -774,7 +774,7 @@ static int calc_planar_422(struct saa7146_vv *vv, struct saa7146_buf *buf, struc
vdma3->base_even = buf->pt[2].offset;
vdma3->base_odd = vdma3->base_even + (vdma3->pitch/2);
vdma3->prot_addr = (vdma3->pitch/2)*height+buf->pt[2].offset;
-
+
vdma2->base_even = buf->pt[1].offset;
vdma2->base_odd = vdma2->base_even + (vdma2->pitch/2);
vdma2->prot_addr = (vdma2->pitch/2)*height+buf->pt[1].offset;
@@ -904,7 +904,7 @@ static int calculate_video_dma_grab_planar(struct saa7146_dev* dev, struct saa71
vdma1.pitch *= -1;
vdma2.pitch *= -1;
vdma3.pitch *= -1;
- }
+ }
saa7146_write_out_dma(dev, 1, &vdma1);
if( (sfmt->flags & FORMAT_BYTE_SWAP) != 0 ) {
@@ -921,7 +921,7 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar)
{
struct saa7146_vv *vv = dev->vv_data;
int count = 0;
-
+
unsigned long e_wait = vv->current_hps_sync == SAA7146_HPS_SYNC_PORT_A ? CMD_E_FID_A : CMD_E_FID_B;
unsigned long o_wait = vv->current_hps_sync == SAA7146_HPS_SYNC_PORT_A ? CMD_O_FID_A : CMD_O_FID_B;
@@ -930,25 +930,25 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar)
WRITE_RPS0(CMD_PAUSE | CMD_OAN | CMD_SIG0 | e_wait);
/* set rps register 0 */
- WRITE_RPS0(CMD_WR_REG | (1 << 8) | (MC2/4));
+ WRITE_RPS0(CMD_WR_REG | (1 << 8) | (MC2/4));
WRITE_RPS0(MASK_27 | MASK_11);
-
+
/* turn on video-dma1 */
- WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4));
- WRITE_RPS0(MASK_06 | MASK_22); /* => mask */
+ WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4));
+ WRITE_RPS0(MASK_06 | MASK_22); /* => mask */
WRITE_RPS0(MASK_06 | MASK_22); /* => values */
if( 0 != planar ) {
/* turn on video-dma2 */
- WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4));
- WRITE_RPS0(MASK_05 | MASK_21); /* => mask */
+ WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4));
+ WRITE_RPS0(MASK_05 | MASK_21); /* => mask */
WRITE_RPS0(MASK_05 | MASK_21); /* => values */
/* turn on video-dma3 */
- WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4));
- WRITE_RPS0(MASK_04 | MASK_20); /* => mask */
+ WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4));
+ WRITE_RPS0(MASK_04 | MASK_20); /* => mask */
WRITE_RPS0(MASK_04 | MASK_20); /* => values */
}
-
+
/* wait for o_fid_a/b / e_fid_a/b toggle */
if ( vv->last_field == V4L2_FIELD_INTERLACED ) {
WRITE_RPS0(CMD_PAUSE | o_wait);
@@ -963,25 +963,25 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar)
/* turn off video-dma1 */
WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4));
- WRITE_RPS0(MASK_22 | MASK_06); /* => mask */
+ WRITE_RPS0(MASK_22 | MASK_06); /* => mask */
WRITE_RPS0(MASK_22); /* => values */
if( 0 != planar ) {
/* turn off video-dma2 */
- WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4));
- WRITE_RPS0(MASK_05 | MASK_21); /* => mask */
+ WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4));
+ WRITE_RPS0(MASK_05 | MASK_21); /* => mask */
WRITE_RPS0(MASK_21); /* => values */
/* turn off video-dma3 */
- WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4));
- WRITE_RPS0(MASK_04 | MASK_20); /* => mask */
+ WRITE_RPS0(CMD_WR_REG_MASK | (MC1/4));
+ WRITE_RPS0(MASK_04 | MASK_20); /* => mask */
WRITE_RPS0(MASK_20); /* => values */
}
/* generate interrupt */
- WRITE_RPS0(CMD_INTERRUPT);
+ WRITE_RPS0(CMD_INTERRUPT);
/* stop */
- WRITE_RPS0(CMD_STOP);
+ WRITE_RPS0(CMD_STOP);
}
void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next)
@@ -989,7 +989,7 @@ void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struc
struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat);
struct saa7146_vv *vv = dev->vv_data;
u32 vdma1_prot_addr;
-
+
DEB_CAP(("buf:%p, next:%p\n",buf,next));
vdma1_prot_addr = saa7146_read(dev, PROT_ADDR1);
@@ -1017,7 +1017,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);
}
-
+
/*
printk("vdma%d.base_even: 0x%08x\n", 1,saa7146_read(dev,BASE_EVEN1));
printk("vdma%d.base_odd: 0x%08x\n", 1,saa7146_read(dev,BASE_ODD1));
@@ -1032,6 +1032,5 @@ void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struc
saa7146_write(dev, RPS_ADDR0, dev->d_rps0.dma_handle);
/* turn on rps */
- saa7146_write(dev, MC1, (MASK_12 | MASK_28));
+ saa7146_write(dev, MC1, (MASK_12 | MASK_28));
}
-
diff --git a/linux/drivers/media/common/saa7146_i2c.c b/linux/drivers/media/common/saa7146_i2c.c
index 1a83c0148..3e4cfd892 100644
--- a/linux/drivers/media/common/saa7146_i2c.c
+++ b/linux/drivers/media/common/saa7146_i2c.c
@@ -12,7 +12,7 @@ static u32 saa7146_i2c_func(struct i2c_adapter *adapter)
}
/* this function returns the status-register of our i2c-device */
-static inline u32 saa7146_i2c_status(struct saa7146_dev *dev)
+static inline u32 saa7146_i2c_status(struct saa7146_dev *dev)
{
u32 iicsta = saa7146_read(dev, I2C_STATUS);
/*
@@ -22,7 +22,7 @@ static inline u32 saa7146_i2c_status(struct saa7146_dev *dev)
}
/* this function runs through the i2c-messages and prepares the data to be
- sent through the saa7146. have a look at the specifications p. 122 ff
+ sent through the saa7146. have a look at the specifications p. 122 ff
to understand this. it returns the number of u32s to send, or -1
in case of an error. */
static int saa7146_i2c_msg_prepare(const struct i2c_msg m[], int num, u32 *op)
@@ -56,7 +56,7 @@ static int saa7146_i2c_msg_prepare(const struct i2c_msg m[], int num, u32 *op)
/* insert the address of the i2c-slave.
note: we get 7 bit i2c-addresses,
so we have to perform a translation */
- addr = (m[i].addr*2) + ( (0 != (m[i].flags & I2C_M_RD)) ? 1 : 0);
+ addr = (m[i].addr*2) + ( (0 != (m[i].flags & I2C_M_RD)) ? 1 : 0);
h1 = op_count/3; h2 = op_count%3;
op[h1] |= ( (u8)addr << ((3-h2)*8));
op[h1] |= (SAA7146_I2C_START << ((3-h2)*2));
@@ -70,8 +70,8 @@ static int saa7146_i2c_msg_prepare(const struct i2c_msg m[], int num, u32 *op)
op[h1] |= ( SAA7146_I2C_CONT << ((3-h2)*2));
op_count++;
}
-
- }
+
+ }
/* have a look at the last byte inserted:
if it was: ...CONT change it to ...STOP */
@@ -81,7 +81,7 @@ static int saa7146_i2c_msg_prepare(const struct i2c_msg m[], int num, u32 *op)
op[h1] |= (SAA7146_I2C_STOP << ((3-h2)*2));
}
- /* return the number of u32s to send */
+ /* return the number of u32s to send */
return mem;
}
@@ -106,16 +106,16 @@ static int saa7146_i2c_msg_cleanup(const struct i2c_msg m[], int num, u32 *op)
op_count++;
}
}
-
+
return 0;
}
/* this functions resets the i2c-device and returns 0 if everything was fine, otherwise -1 */
-static int saa7146_i2c_reset(struct saa7146_dev *dev)
+static int saa7146_i2c_reset(struct saa7146_dev *dev)
{
/* get current status */
u32 status = saa7146_i2c_status(dev);
-
+
/* clear registers for sure */
saa7146_write(dev, I2C_STATUS, dev->i2c_bitrate);
saa7146_write(dev, I2C_TRANSFER, 0);
@@ -135,7 +135,7 @@ static int saa7146_i2c_reset(struct saa7146_dev *dev)
saa7146_write(dev, I2C_STATUS, dev->i2c_bitrate);
saa7146_write(dev, MC2, (MASK_00 | MASK_16));
msleep(SAA7146_I2C_DELAY);
- }
+ }
/* check if any error is (still) present. (this can be necessary because p.123, note 1) */
status = saa7146_i2c_status(dev);
@@ -160,7 +160,7 @@ static int saa7146_i2c_reset(struct saa7146_dev *dev)
saa7146_write(dev, I2C_STATUS, dev->i2c_bitrate);
saa7146_write(dev, MC2, (MASK_00 | MASK_16));
msleep(SAA7146_I2C_DELAY);
- }
+ }
/* if any error is still present, a fatal error has occured ... */
status = saa7146_i2c_status(dev);
@@ -279,14 +279,14 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg msgs[], i
int err = 0;
int address_err = 0;
int short_delay = 0;
-
+
if (down_interruptible (&dev->i2c_lock))
return -ERESTARTSYS;
for(i=0;i<num;i++) {
DEB_I2C(("msg:%d/%d\n",i+1,num));
}
-
+
/* prepare the message(s), get number of u32s to transfer */
count = saa7146_i2c_msg_prepare(msgs, num, buffer);
if ( 0 > count ) {
@@ -303,7 +303,7 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg msgs[], i
if ( 0 > err ) {
DEB_I2C(("could not reset i2c-device.\n"));
goto out;
- }
+ }
/* write out the u32s one after another */
for(i = 0; i < count; i++) {
@@ -314,10 +314,10 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg msgs[], i
thinks that an address error occured. in that case, the
transaction should be retrying, even if an address error
occured. analog saa7146 based cards extensively rely on
- i2c address probing, however, and address errors indicate that a
+ i2c address probing, however, and address errors indicate that a
device is really *not* there. retrying in that case
increases the time the device needs to probe greatly, so
- it should be avoided. because of the fact, that only
+ it should be avoided. because of the fact, that only
analog based cards use irq based i2c transactions (for dvb
cards, this screwes up other interrupt sources), we bail out
completely for analog cards after an address error and trust
@@ -336,17 +336,17 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg msgs[], i
err = num;
break;
}
-
+
/* delay a bit before retrying */
msleep(10);
-
+
} while (err != num && retries--);
/* if every retry had an address error, exit right away */
if (address_err == retries) {
goto out;
}
-
+
/* if any things had to be read, get the results */
if ( 0 != saa7146_i2c_msg_cleanup(msgs, num, buffer)) {
DEB_I2C(("could not cleanup i2c-message.\n"));
@@ -358,7 +358,7 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg msgs[], i
DEB_I2C(("transmission successful. (msg:%d).\n",err));
out:
/* another bug in revision 0: the i2c-registers get uploaded randomly by other
- uploads, so we better clear them out before continueing */
+ uploads, so we better clear them out before continueing */
if( 0 == dev->revision ) {
u32 zero = 0;
saa7146_i2c_reset(dev);
@@ -368,7 +368,7 @@ out:
}
up(&dev->i2c_lock);
- return err;
+ return err;
}
/* utility functions */
@@ -396,7 +396,7 @@ static struct i2c_algorithm saa7146_algo = {
int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate)
{
DEB_EE(("bitrate: 0x%08x\n",bitrate));
-
+
/* enable i2c-port pins */
saa7146_write(dev, MC1, (MASK_08 | MASK_24));
@@ -405,17 +405,17 @@ int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c
if( NULL != i2c_adapter ) {
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- i2c_adapter->data = dev;
+ i2c_adapter->data = dev;
#else
BUG_ON(!i2c_adapter->class);
i2c_set_adapdata(i2c_adapter,dev);
#endif
i2c_adapter->algo = &saa7146_algo;
i2c_adapter->algo_data = NULL;
- i2c_adapter->id = I2C_ALGO_SAA7146;
+ i2c_adapter->id = I2C_ALGO_SAA7146;
i2c_adapter->timeout = SAA7146_I2C_TIMEOUT;
i2c_adapter->retries = SAA7146_I2C_RETRIES;
}
-
+
return 0;
}
diff --git a/linux/drivers/media/common/saa7146_vbi.c b/linux/drivers/media/common/saa7146_vbi.c
index 1b8661f4a..3766cf533 100644
--- a/linux/drivers/media/common/saa7146_vbi.c
+++ b/linux/drivers/media/common/saa7146_vbi.c
@@ -8,14 +8,14 @@ static int vbi_workaround(struct saa7146_dev *dev)
u32 *cpu;
dma_addr_t dma_addr;
-
+
int count = 0;
int i;
DECLARE_WAITQUEUE(wait, current);
-
+
DEB_VBI(("dev:%p\n",dev));
-
+
/* once again, a bug in the saa7146: the brs acquisition
is buggy and especially the BXO-counter does not work
as specified. there is this workaround, but please
@@ -29,7 +29,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
saa7146_write(dev, BASE_EVEN3, dma_addr);
saa7146_write(dev, BASE_ODD3, dma_addr+vbi_pixel_to_capture);
saa7146_write(dev, PROT_ADDR3, dma_addr+4096);
- saa7146_write(dev, PITCH3, vbi_pixel_to_capture);
+ saa7146_write(dev, PITCH3, vbi_pixel_to_capture);
saa7146_write(dev, BASE_PAGE3, 0x0);
saa7146_write(dev, NUM_LINE_BYTE3, (2<<16)|((vbi_pixel_to_capture)<<0));
saa7146_write(dev, MC2, MASK_04|MASK_20);
@@ -37,7 +37,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
/* load brs-control register */
WRITE_RPS1(CMD_WR_REG | (1 << 8) | (BRS_CTRL/4));
/* BXO = 1h, BRS to outbound */
- WRITE_RPS1(0xc000008c);
+ WRITE_RPS1(0xc000008c);
/* wait for vbi_a or vbi_b*/
if ( 0 != (SAA7146_USE_PORT_B_FOR_VBI & dev->ext_vv_data->flags)) {
DEB_D(("...using port b\n"));
@@ -67,7 +67,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
/* load brs-control register */
WRITE_RPS1(CMD_WR_REG | (1 << 8) | (BRS_CTRL/4));
/* Set BRS right: note: this is an experimental value for BXO (=> PAL!) */
- WRITE_RPS1((540 << 7) | (5 << 19)); // 5 == vbi_start
+ WRITE_RPS1((540 << 7) | (5 << 19)); // 5 == vbi_start
/* wait for brs_done */
WRITE_RPS1(CMD_PAUSE | MASK_08);
/* upload brs and video-dma3*/
@@ -79,7 +79,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
WRITE_RPS1(CMD_INTERRUPT);
/* stop rps1 */
WRITE_RPS1(CMD_STOP);
-
+
/* we have to do the workaround twice to be sure that
everything is ok */
for(i = 0; i < 2; i++) {
@@ -89,7 +89,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
saa7146_write(dev, NUM_LINE_BYTE3, (1<<16)|(2<<0));
saa7146_write(dev, MC2, MASK_04|MASK_20);
-
+
/* enable rps1 irqs */
SAA7146_IER_ENABLE(dev,MASK_28);
@@ -99,12 +99,12 @@ static int vbi_workaround(struct saa7146_dev *dev)
/* start rps1 to enable workaround */
saa7146_write(dev, RPS_ADDR1, dev->d_rps1.dma_handle);
- saa7146_write(dev, MC1, (MASK_13 | MASK_29));
-
+ saa7146_write(dev, MC1, (MASK_13 | MASK_29));
+
schedule();
DEB_VBI(("brs bug workaround %d/1.\n",i));
-
+
remove_wait_queue(&vv->vbi_wq, &wait);
current->state = TASK_RUNNING;
@@ -115,7 +115,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
saa7146_write(dev, MC1, MASK_20);
if(signal_pending(current)) {
-
+
DEB_VBI(("aborted (rps:0x%08x).\n",saa7146_read(dev,RPS_ADDR1)));
/* stop rps1 for sure */
@@ -166,29 +166,29 @@ static void saa7146_set_vbi_capture(struct saa7146_dev *dev, struct saa7146_buf
capture and might cause that the first buffer is only half filled (with only
one field). but since this is some sort of streaming data, this is not that negative.
but by doing this, we can use the whole engine from video-buf.c... */
-
+
/*
WRITE_RPS1(CMD_PAUSE | CMD_OAN | CMD_SIG1 | e_wait);
WRITE_RPS1(CMD_PAUSE | CMD_OAN | CMD_SIG1 | o_wait);
*/
/* set bit 1 */
- WRITE_RPS1(CMD_WR_REG | (1 << 8) | (MC2/4));
+ WRITE_RPS1(CMD_WR_REG | (1 << 8) | (MC2/4));
WRITE_RPS1(MASK_28 | MASK_12);
-
+
/* turn on video-dma3 */
- WRITE_RPS1(CMD_WR_REG_MASK | (MC1/4));
- WRITE_RPS1(MASK_04 | MASK_20); /* => mask */
+ WRITE_RPS1(CMD_WR_REG_MASK | (MC1/4));
+ WRITE_RPS1(MASK_04 | MASK_20); /* => mask */
WRITE_RPS1(MASK_04 | MASK_20); /* => values */
-
+
/* wait for o_fid_a/b / e_fid_a/b toggle */
WRITE_RPS1(CMD_PAUSE | o_wait);
WRITE_RPS1(CMD_PAUSE | e_wait);
/* generate interrupt */
- WRITE_RPS1(CMD_INTERRUPT);
+ WRITE_RPS1(CMD_INTERRUPT);
/* stop */
- WRITE_RPS1(CMD_STOP);
+ WRITE_RPS1(CMD_STOP);
/* enable rps1 irqs */
SAA7146_IER_ENABLE(dev, MASK_28);
@@ -197,7 +197,7 @@ static void saa7146_set_vbi_capture(struct saa7146_dev *dev, struct saa7146_buf
saa7146_write(dev, RPS_ADDR1, dev->d_rps1.dma_handle);
/* turn on rps */
- saa7146_write(dev, MC1, (MASK_13 | MASK_29));
+ saa7146_write(dev, MC1, (MASK_13 | MASK_29));
}
static int buffer_activate(struct saa7146_dev *dev,
@@ -234,12 +234,12 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e
size = lines * llength;
DEB_VBI(("vb:%p\n",vb));
-
+
if (0 != buf->vb.baddr && buf->vb.bsize < size) {
DEB_VBI(("size mismatch.\n"));
return -EINVAL;
}
-
+
if (buf->vb.size != size)
saa7146_dma_free(dev,buf);
@@ -278,7 +278,7 @@ static int buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned
#endif
{
int llength,lines;
-
+
lines = 16 * 2 ; /* 2 fields */
llength = vbi_pixel_to_capture;
@@ -302,7 +302,7 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
struct saa7146_dev *dev = fh->dev;
struct saa7146_vv *vv = dev->vv_data;
struct saa7146_buf *buf = (struct saa7146_buf *)vb;
-
+
DEB_VBI(("vb:%p\n",vb));
saa7146_buffer_queue(dev,&vv->vbi_q,buf);
}
@@ -318,7 +318,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev;
struct saa7146_buf *buf = (struct saa7146_buf *)vb;
-
+
DEB_VBI(("vb:%p\n",vb));
saa7146_dma_free(dev,buf);
}
@@ -373,7 +373,7 @@ static void vbi_read_timeout(unsigned long data)
struct file *file = (struct file*)data;
struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev;
-
+
DEB_VBI(("dev:%p, fh:%p\n",dev, fh));
vbi_stop(fh, file);
@@ -396,10 +396,10 @@ static void vbi_init(struct saa7146_dev *dev, struct saa7146_vv *vv)
static int vbi_open(struct saa7146_dev *dev, struct file *file)
{
struct saa7146_fh *fh = (struct saa7146_fh *)file->private_data;
-
+
u32 arbtr_ctrl = saa7146_read(dev, PCI_BT_V1);
int ret = 0;
-
+
DEB_VBI(("dev:%p, fh:%p\n",dev,fh));
ret = saa7146_res_get(fh, RESOURCE_DMA3_BRS);
@@ -412,12 +412,12 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
arbtr_ctrl &= ~0x1f0000;
arbtr_ctrl |= 0x1d0000;
saa7146_write(dev, PCI_BT_V1, arbtr_ctrl);
- saa7146_write(dev, MC2, (MASK_04|MASK_20));
-
+ saa7146_write(dev, MC2, (MASK_04|MASK_20));
+
memset(&fh->vbi_fmt,0,sizeof(fh->vbi_fmt));
fh->vbi_fmt.sampling_rate = 27000000;
- fh->vbi_fmt.offset = 248; /* todo */
+ fh->vbi_fmt.offset = 248; /* todo */
fh->vbi_fmt.samples_per_line = vbi_pixel_to_capture;
fh->vbi_fmt.sample_format = V4L2_PIX_FMT_GREY;
@@ -456,7 +456,7 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
/* upload brs register */
saa7146_write(dev, MC2, (MASK_08|MASK_24));
- return 0;
+ return 0;
}
static void vbi_close(struct saa7146_dev *dev, struct file *file)
@@ -498,7 +498,7 @@ static ssize_t vbi_read(struct file *file, char __user *data, size_t count, loff
ssize_t ret = 0;
DEB_VBI(("dev:%p, fh:%p\n",dev,fh));
-
+
if( NULL == vv->vbi_streaming ) {
// fixme: check if dma3 is available
// fixme: activate vbi engine here if necessary. (really?)
diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c
index 5b37c8f4f..397b01d1c 100644
--- a/linux/drivers/media/common/saa7146_video.c
+++ b/linux/drivers/media/common/saa7146_video.c
@@ -14,64 +14,64 @@ MODULE_PARM_DESC(max_memory, "maximum memory usage for capture buffers (default:
/* format descriptions for capture and preview */
static struct saa7146_format formats[] = {
{
- .name = "RGB-8 (3-3-2)",
+ .name = "RGB-8 (3-3-2)",
.pixelformat = V4L2_PIX_FMT_RGB332,
- .trans = RGB08_COMPOSED,
+ .trans = RGB08_COMPOSED,
.depth = 8,
.flags = 0,
}, {
- .name = "RGB-16 (5/B-6/G-5/R)",
+ .name = "RGB-16 (5/B-6/G-5/R)",
.pixelformat = V4L2_PIX_FMT_RGB565,
- .trans = RGB16_COMPOSED,
+ .trans = RGB16_COMPOSED,
.depth = 16,
.flags = 0,
}, {
- .name = "RGB-24 (B-G-R)",
+ .name = "RGB-24 (B-G-R)",
.pixelformat = V4L2_PIX_FMT_BGR24,
- .trans = RGB24_COMPOSED,
+ .trans = RGB24_COMPOSED,
.depth = 24,
.flags = 0,
}, {
- .name = "RGB-32 (B-G-R)",
+ .name = "RGB-32 (B-G-R)",
.pixelformat = V4L2_PIX_FMT_BGR32,
- .trans = RGB32_COMPOSED,
+ .trans = RGB32_COMPOSED,
.depth = 32,
.flags = 0,
}, {
- .name = "RGB-32 (R-G-B)",
+ .name = "RGB-32 (R-G-B)",
.pixelformat = V4L2_PIX_FMT_RGB32,
- .trans = RGB32_COMPOSED,
+ .trans = RGB32_COMPOSED,
.depth = 32,
.flags = 0,
.swap = 0x2,
}, {
- .name = "Greyscale-8",
+ .name = "Greyscale-8",
.pixelformat = V4L2_PIX_FMT_GREY,
- .trans = Y8,
+ .trans = Y8,
.depth = 8,
.flags = 0,
}, {
- .name = "YUV 4:2:2 planar (Y-Cb-Cr)",
+ .name = "YUV 4:2:2 planar (Y-Cb-Cr)",
.pixelformat = V4L2_PIX_FMT_YUV422P,
- .trans = YUV422_DECOMPOSED,
+ .trans = YUV422_DECOMPOSED,
.depth = 16,
.flags = FORMAT_BYTE_SWAP|FORMAT_IS_PLANAR,
}, {
- .name = "YVU 4:2:0 planar (Y-Cb-Cr)",
+ .name = "YVU 4:2:0 planar (Y-Cb-Cr)",
.pixelformat = V4L2_PIX_FMT_YVU420,
- .trans = YUV420_DECOMPOSED,
+ .trans = YUV420_DECOMPOSED,
.depth = 12,
.flags = FORMAT_BYTE_SWAP|FORMAT_IS_PLANAR,
}, {
- .name = "YUV 4:2:0 planar (Y-Cb-Cr)",
+ .name = "YUV 4:2:0 planar (Y-Cb-Cr)",
.pixelformat = V4L2_PIX_FMT_YUV420,
- .trans = YUV420_DECOMPOSED,
+ .trans = YUV420_DECOMPOSED,
.depth = 12,
.flags = FORMAT_IS_PLANAR,
}, {
- .name = "YUV 4:2:2 (U-Y-V-Y)",
+ .name = "YUV 4:2:2 (U-Y-V-Y)",
.pixelformat = V4L2_PIX_FMT_UYVY,
- .trans = YUV422_COMPOSED,
+ .trans = YUV422_COMPOSED,
.depth = 16,
.flags = 0,
}
@@ -80,19 +80,19 @@ static struct saa7146_format formats[] = {
/* unfortunately, the saa7146 contains a bug which prevents it from doing on-the-fly byte swaps.
due to this, it's impossible to provide additional *packed* formats, which are simply byte swapped
(like V4L2_PIX_FMT_YUYV) ... 8-( */
-
+
static int NUM_FORMATS = sizeof(formats)/sizeof(struct saa7146_format);
struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc)
{
int i, j = NUM_FORMATS;
-
+
for (i = 0; i < j; i++) {
if (formats[i].pixelformat == fourcc) {
return formats+i;
}
}
-
+
DEB_D(("unknown pixelformat:'%4.4s'\n",(char *)&fourcc));
return NULL;
}
@@ -182,7 +182,7 @@ static int try_fmt(struct saa7146_fh *fh, struct v4l2_format *f)
struct saa7146_dev *dev = fh->dev;
struct saa7146_vv *vv = dev->vv_data;
int err;
-
+
switch (f->type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
{
@@ -190,7 +190,7 @@ static int try_fmt(struct saa7146_fh *fh, struct v4l2_format *f)
enum v4l2_field field;
int maxw, maxh;
int calc_bpl;
-
+
DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n",dev,fh));
fmt = format_by_fourcc(dev,f->fmt.pix.pixelformat);
@@ -201,7 +201,7 @@ static int try_fmt(struct saa7146_fh *fh, struct v4l2_format *f)
field = f->fmt.pix.field;
maxw = vv->standard->h_max_out;
maxh = vv->standard->v_max_out;
-
+
if (V4L2_FIELD_ANY == field) {
field = (f->fmt.pix.height > maxh/2)
? V4L2_FIELD_INTERLACED
@@ -237,10 +237,10 @@ static int try_fmt(struct saa7146_fh *fh, struct v4l2_format *f)
if (f->fmt.pix.bytesperline < calc_bpl)
f->fmt.pix.bytesperline = calc_bpl;
-
+
if (f->fmt.pix.bytesperline > (2*PAGE_SIZE * fmt->depth)/8) /* arbitrary constraint */
f->fmt.pix.bytesperline = calc_bpl;
-
+
f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * f->fmt.pix.height;
DEB_D(("w:%d, h:%d, bytesperline:%d, sizeimage:%d\n",f->fmt.pix.width,f->fmt.pix.height,f->fmt.pix.bytesperline,f->fmt.pix.sizeimage));
@@ -280,7 +280,7 @@ int saa7146_start_preview(struct saa7146_fh *fh)
}
/* check if overlay is running */
- if (IS_OVERLAY_ACTIVE(fh) != 0) {
+ if (IS_OVERLAY_ACTIVE(fh) != 0) {
if (vv->video_fh == fh) {
DEB_D(("overlay is already active.\n"));
return 0;
@@ -299,14 +299,14 @@ int saa7146_start_preview(struct saa7146_fh *fh)
saa7146_res_free(vv->video_fh, RESOURCE_DMA1_HPS|RESOURCE_DMA2_CLP);
return -EBUSY;
}
-
+
vv->ov_data = &fh->ov;
DEB_D(("%dx%d+%d+%d %s field=%s\n",
fh->ov.win.w.width,fh->ov.win.w.height,
fh->ov.win.w.left,fh->ov.win.w.top,
vv->ov_fmt->name,v4l2_field_names[fh->ov.win.field]));
-
+
if (0 != (ret = saa7146_enable_overlay(fh))) {
DEB_D(("enabling overlay failed: %d\n",ret));
saa7146_res_free(vv->video_fh, RESOURCE_DMA1_HPS|RESOURCE_DMA2_CLP);
@@ -331,9 +331,9 @@ int saa7146_stop_preview(struct saa7146_fh *fh)
DEB_D(("streaming capture is active.\n"));
return -EBUSY;
}
-
+
/* check if overlay is running at all */
- if ((vv->video_status & STATUS_OVERLAY) == 0) {
+ if ((vv->video_status & STATUS_OVERLAY) == 0) {
DEB_D(("no active overlay.\n"));
return 0;
}
@@ -359,7 +359,7 @@ static int s_fmt(struct saa7146_fh *fh, struct v4l2_format *f)
struct saa7146_vv *vv = dev->vv_data;
int err;
-
+
switch (f->type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n",dev,fh));
@@ -387,7 +387,7 @@ static int s_fmt(struct saa7146_fh *fh, struct v4l2_format *f)
up(&dev->lock);
return -EFAULT;
}
-
+
/* fh->ov.fh is used to indicate that we have valid overlay informations, too */
fh->ov.fh = fh;
@@ -454,7 +454,7 @@ static int NUM_CONTROLS = sizeof(controls)/sizeof(struct v4l2_queryctrl);
static struct v4l2_queryctrl* ctrl_by_id(int id)
{
int i;
-
+
for (i = 0; i < NUM_CONTROLS; i++)
if (controls[i].id == id)
return controls+i;
@@ -515,7 +515,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
DEB_D(("unknown control %d\n",c->id));
return -EINVAL;
}
-
+
down(&dev->lock);
switch (ctrl->type) {
@@ -578,7 +578,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
}
}
up(&dev->lock);
-
+
if (IS_OVERLAY_ACTIVE(fh) != 0) {
saa7146_stop_preview(fh);
saa7146_start_preview(fh);
@@ -633,7 +633,7 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu
return -1;
}
}
-
+
ptr1 = pt1->cpu;
ptr2 = pt2->cpu;
ptr3 = pt3->cpu;
@@ -649,14 +649,14 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu
for(j=0;j<40;j++) {
printk("ptr1 %d: 0x%08x\n",j,ptr1[j]);
}
-*/
+*/
/* if we have a user buffer, the first page may not be
aligned to a page boundary. */
pt1->offset = buf->vb.dma.sglist->offset;
pt2->offset = pt1->offset+o1;
pt3->offset = pt1->offset+o2;
-
+
/* create video-dma2 page table */
ptr1 = pt1->cpu;
for(i = m1; i <= m2 ; i++, ptr2++) {
@@ -675,7 +675,7 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu
for(;i<1024;i++,ptr3++) {
*ptr3 = fill;
}
- /* finally: finish up video-dma1 page table */
+ /* finally: finish up video-dma1 page table */
ptr1 = pt1->cpu+m1;
fill = pt1->cpu[m1];
for(i=m1;i<1024;i++,ptr1++) {
@@ -694,7 +694,7 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu
for(j=0;j<40;j++) {
printk("ptr3 %d: 0x%08x\n",j,ptr3[j]);
}
-*/
+*/
} else {
struct saa7146_pgtable *pt = &buf->pt[0];
return saa7146_pgtable_build_single(pci, pt, list, length);
@@ -725,7 +725,7 @@ static int video_begin(struct saa7146_fh *fh)
DEB_S(("already capturing in another open.\n"));
return -EBUSY;
}
-
+
if ((vv->video_status & STATUS_OVERLAY) != 0) {
DEB_S(("warning: suspending overlay video for streaming capture.\n"));
vv->ov_suspend = vv->video_fh;
@@ -735,7 +735,7 @@ static int video_begin(struct saa7146_fh *fh)
return err;
}
}
-
+
fmt = format_by_fourcc(dev,fh->video_fmt.pixelformat);
/* we need to have a valid format set here */
BUG_ON(NULL == fmt);
@@ -755,7 +755,7 @@ static int video_begin(struct saa7146_fh *fh)
}
return -EBUSY;
}
-
+
/* clear out beginning of streaming bit (rps register 0)*/
saa7146_write(dev, MC2, MASK_27 );
@@ -821,7 +821,7 @@ static int video_end(struct saa7146_fh *fh, struct file *file)
saa7146_start_preview(vv->ov_suspend);
vv->ov_suspend = NULL;
}
-
+
return 0;
}
@@ -847,7 +847,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
if( cmd == dev->ext_vv_data->ioctls[ee].cmd )
break;
}
-
+
if( 0 != (dev->ext_vv_data->ioctls[ee].flags & SAA7146_EXCLUSIVE) ) {
DEB_D(("extension handles ioctl exclusive.\n"));
result = dev->ext_vv_data->ioctl(fh, cmd, arg);
@@ -860,7 +860,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
return result;
}
}
-
+
/* fixme: add handle "after" case (is it still needed?) */
switch (fh->type) {
@@ -880,13 +880,13 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
}
switch (cmd) {
- case VIDIOC_QUERYCAP:
+ case VIDIOC_QUERYCAP:
{
struct v4l2_capability *cap = arg;
memset(cap,0,sizeof(*cap));
DEB_EE(("VIDIOC_QUERYCAP\n"));
-
+
strcpy(cap->driver, "saa7146 v4l2");
strlcpy(cap->card, dev->ext->name, sizeof(cap->card));
sprintf(cap->bus_info,"PCI:%s",dev->pci->slot_name);
@@ -894,7 +894,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
cap->capabilities =
V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_VIDEO_OVERLAY |
- V4L2_CAP_READWRITE |
+ V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING;
cap->capabilities |= dev->ext_vv_data->capabilities;
return 0;
@@ -915,7 +915,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
struct saa7146_format *fmt;
DEB_EE(("VIDIOC_S_FBUF\n"));
-
+
if(!capable(CAP_SYS_ADMIN) &&
!capable(CAP_SYS_RAWIO))
return -EPERM;
@@ -925,14 +925,14 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
if (NULL == fmt) {
return -EINVAL;
}
-
+
/* planar formats are not allowed for overlay video, clipping and video dma would clash */
if (0 != (fmt->flags & FORMAT_IS_PLANAR)) {
DEB_S(("planar pixelformat '%4.4s' not allowed for overlay\n",(char *)&fmt->pixelformat));
}
/* check if overlay is running */
- if (IS_OVERLAY_ACTIVE(fh) != 0) {
+ if (IS_OVERLAY_ACTIVE(fh) != 0) {
if (vv->video_fh != fh) {
DEB_D(("refusing to change framebuffer informations while overlay is active in another open.\n"));
return -EBUSY;
@@ -971,7 +971,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
break;
}
default:
- return -EINVAL;
+ return -EINVAL;
}
DEB_EE(("VIDIOC_ENUM_FMT: type:%d, index:%d\n",f->type,f->index));
@@ -987,12 +987,12 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
(c->id < V4L2_CID_PRIVATE_BASE ||
c->id >= V4L2_CID_PRIVATE_LASTP1))
return -EINVAL;
-
+
ctrl = ctrl_by_id(c->id);
if( NULL == ctrl ) {
return -EINVAL;
/*
- c->flags = V4L2_CTRL_FLAG_DISABLED;
+ c->flags = V4L2_CTRL_FLAG_DISABLED;
return 0;
*/
}
@@ -1073,7 +1073,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
v4l2_std_id *id = arg;
int found = 0;
int i, err;
-
+
DEB_EE(("VIDIOC_S_STD\n"));
if ((vv->video_status & STATUS_CAPTURE) == STATUS_CAPTURE) {
@@ -1091,7 +1091,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
}
down(&dev->lock);
-
+
for(i = 0; i < dev->ext_vv_data->num_stds; i++)
if (*id & dev->ext_vv_data->stds[i].id)
break;
@@ -1173,7 +1173,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
case VIDIOC_STREAMON: {
int *type = arg;
DEB_D(("VIDIOC_STREAMON, type:%d\n",*type));
-
+
err = video_begin(fh);
if( 0 != err) {
return err;
@@ -1223,9 +1223,9 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
int i;
/* fixme: number of capture buffers and sizes for v4l apps */
- int gbuffers = 2;
+ int gbuffers = 2;
int gbufsize = 768*576*4;
-
+
DEB_D(("VIDIOCGMBUF \n"));
q = &fh->video_q;
@@ -1236,7 +1236,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
#else
err = videobuf_mmap_setup(q,gbuffers,gbufsize,
V4L2_MEMORY_MMAP);
-#endif
+#endif
if (err < 0) {
up(&q->lock);
return err;
@@ -1267,7 +1267,7 @@ static int buffer_activate (struct saa7146_dev *dev,
buf->vb.state = STATE_ACTIVE;
saa7146_set_capture(dev,buf,next);
-
+
mod_timer(&vv->video_q.timeout, jiffies+BUFFER_TIMEOUT);
return 0;
}
@@ -1302,7 +1302,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e
DEB_D(("size mismatch.\n"));
return -EINVAL;
}
-
+
DEB_CAP(("buffer_prepare [size=%dx%d,bytes=%d,fields=%s]\n",
fh->video_fmt.width,fh->video_fmt.height,size,v4l2_field_names[fh->video_fmt.field]));
if (buf->vb.width != fh->video_fmt.width ||
@@ -1317,7 +1317,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e
if (STATE_NEEDS_INIT == buf->vb.state) {
struct saa7146_format *sfmt;
-
+
buf->vb.bytesperline = fh->video_fmt.bytesperline;
buf->vb.width = fh->video_fmt.width;
buf->vb.height = fh->video_fmt.height;
@@ -1325,9 +1325,9 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e
buf->vb.field = field;
buf->fmt = &fh->video_fmt;
buf->vb.field = fh->video_fmt.field;
-
+
sfmt = format_by_fourcc(dev,buf->fmt->pixelformat);
-
+
if( 0 != IS_PLANAR(sfmt->trans)) {
saa7146_pgtable_free(dev->pci, &buf->pt[0]);
saa7146_pgtable_free(dev->pci, &buf->pt[1]);
@@ -1340,7 +1340,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e
saa7146_pgtable_free(dev->pci, &buf->pt[0]);
saa7146_pgtable_alloc(dev->pci, &buf->pt[0]);
}
-
+
err = videobuf_iolock(dev->pci,&buf->vb, &vv->ov_fb);
if (err)
goto oops;
@@ -1379,7 +1379,7 @@ static int buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned
if( (*count * *size) > (max_memory*1048576) ) {
*count = (max_memory*1048576) / *size;
}
-
+
DEB_CAP(("%d buffers, %d bytes each.\n",*count,*size));
return 0;
@@ -1397,7 +1397,7 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
struct saa7146_dev *dev = fh->dev;
struct saa7146_vv *vv = dev->vv_data;
struct saa7146_buf *buf = (struct saa7146_buf *)vb;
-
+
DEB_CAP(("vbuf:%p\n",vb));
saa7146_buffer_queue(fh->dev,&vv->video_q,buf);
}
@@ -1413,7 +1413,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev;
struct saa7146_buf *buf = (struct saa7146_buf *)vb;
-
+
DEB_CAP(("vbuf:%p\n",vb));
saa7146_dma_free(dev,buf);
}
@@ -1480,13 +1480,13 @@ static void video_close(struct saa7146_dev *dev, struct file *file)
struct saa7146_fh *fh = (struct saa7146_fh *)file->private_data;
struct saa7146_vv *vv = dev->vv_data;
int err;
-
+
if (IS_CAPTURE_ACTIVE(fh) != 0) {
- err = video_end(fh, file);
+ err = video_end(fh, file);
} else if (IS_OVERLAY_ACTIVE(fh) != 0) {
err = saa7146_stop_preview(fh);
}
-
+
/* hmm, why is this function declared void? */
/* return err */
}
@@ -1496,7 +1496,7 @@ static void video_irq_done(struct saa7146_dev *dev, unsigned long st)
{
struct saa7146_vv *vv = dev->vv_data;
struct saa7146_dmaqueue *q = &vv->video_q;
-
+
spin_lock(&dev->slock);
DEB_CAP(("called.\n"));
@@ -1515,7 +1515,7 @@ static ssize_t video_read(struct file *file, char __user *data, size_t count, lo
struct saa7146_dev *dev = fh->dev;
struct saa7146_vv *vv = dev->vv_data;
ssize_t ret = 0;
-
+
DEB_EE(("called.\n"));
if ((vv->video_status & STATUS_CAPTURE) != 0) {