}
};
-const struct bttv_tvnorm bttv_tvnorms[] = {
+const struct bttv_tvnorm bttv_tvnorms_analogue[] = {
/* PAL-BDGHI */
/* max. active video is actually 922, but 924 is divisible by 4 and 3! */
/* actually, max active PAL with HSCALE=0 is 948, NTSC is 768 - nil */
.vbistart = { 10, 273 },
}
};
-static const unsigned int BTTV_TVNORMS = ARRAY_SIZE(bttv_tvnorms);
+
+const struct bttv_tvnorm bttv_tvnorms_digital[] = {
+ /* PAL-BDGHI */
+ /* max. active video is actually 922, but 924 is divisible by 4 and 3! */
+ /* actually, max active PAL with HSCALE=0 is 948, NTSC is 768 - nil */
+ {
+ .v4l2_id = V4L2_STD_PAL,
+ .name = "PAL",
+ .Fsc = 35468950,
+ .swidth = 720,
+ .sheight = 576,
+ .totalwidth = 720,
+ .adelay = 0x7f,
+ .bdelay = 0x72,
+ .iform = (BT848_IFORM_PAL_BDGHI|BT848_IFORM_XT1),
+ .scaledtwidth = 720,
+ .hdelayx1 = 128,
+ .hactivex1 = 720,
+ .vdelay = 0x14,
+ .vbipack = 255,
+ .sram = 0,
+ /* ITU-R frame line number of the first VBI line
+ we can capture, of the first and second field. */
+ .vbistart = { 7,320 },
+ },{
+ .v4l2_id = V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR,
+ .name = "NTSC",
+ .Fsc = 28636363,
+ .swidth = 720,
+ .sheight = 480,
+ .totalwidth = 720,
+ .adelay = 0x68,
+ .bdelay = 0x5d,
+ .iform = (BT848_IFORM_NTSC|BT848_IFORM_XT0),
+ .scaledtwidth = 720,
+ .hdelayx1 = 128,
+ .hactivex1 = 720,
+ .vdelay = 0x1a,
+ .vbipack = 144,
+ .sram = 1,
+ .vbistart = { 10, 273 },
+ }
+};
/* ----------------------------------------------------------------------- */
/* bttv format list
static void bt848A_set_timing(struct bttv *btv)
{
int i, len;
- int table_idx = bttv_tvnorms[btv->tvnorm].sram;
- int fsc = bttv_tvnorms[btv->tvnorm].Fsc;
+ int table_idx = btv->tvnorms[btv->tvnorm].sram;
+ int fsc = btv->tvnorms[btv->tvnorm].Fsc;
if (UNSET == bttv_tvcards[btv->c.type].muxsel[btv->input]) {
dprintk("bttv%d: load digital timing table (table_idx=%d)\n",
static void
i2c_vidiocschan(struct bttv *btv)
{
- v4l2_std_id std = bttv_tvnorms[btv->tvnorm].v4l2_id;
+ v4l2_std_id std = btv->tvnorms[btv->tvnorm].v4l2_id;
bttv_call_i2c_clients(btv, VIDIOC_S_STD, &std);
if (btv->c.type == BTTV_BOARD_VOODOOTV_FM)
{
const struct bttv_tvnorm *tvnorm;
- if (norm < 0 || norm >= BTTV_TVNORMS)
+ if (norm < 0 || norm >= btv->nr_tvnorms)
return -EINVAL;
btv->tvnorm = norm;
- tvnorm = &bttv_tvnorms[norm];
+ tvnorm = &btv->tvnorms[norm];
btwrite(tvnorm->adelay, BT848_ADELAY);
btwrite(tvnorm->bdelay, BT848_BDELAY);
} else {
if (width < 48 ||
height < 32 ||
- width > bttv_tvnorms[btv->tvnorm].swidth ||
- height > bttv_tvnorms[btv->tvnorm].sheight)
+ width > btv->tvnorms[btv->tvnorm].swidth ||
+ height > btv->tvnorms[btv->tvnorm].sheight)
return -EINVAL;
buf->vb.size = (width * height * fmt->depth) >> 3;
if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size)
if (v->tuner) /* Only tuner 0 */
return -EINVAL;
- if (v->mode >= BTTV_TVNORMS)
+ if (v->mode >= btv->nr_tvnorms)
return -EINVAL;
mutex_lock(&btv->lock);
if (channel >= bttv_tvcards[btv->c.type].video_inputs)
return -EINVAL;
- if (v->norm >= BTTV_TVNORMS)
+ if (v->norm >= btv->nr_tvnorms)
return -EINVAL;
mutex_lock(&btv->lock);
struct v4l2_standard *e = arg;
unsigned int index = e->index;
- if (index >= BTTV_TVNORMS)
+ if (index >= btv->nr_tvnorms)
return -EINVAL;
- v4l2_video_std_construct(e, bttv_tvnorms[e->index].v4l2_id,
- bttv_tvnorms[e->index].name);
+ v4l2_video_std_construct(e, btv->tvnorms[e->index].v4l2_id,
+ btv->tvnorms[e->index].name);
e->index = index;
return 0;
}
case VIDIOC_G_STD:
{
v4l2_std_id *id = arg;
- *id = bttv_tvnorms[btv->tvnorm].v4l2_id;
+ *id = btv->tvnorms[btv->tvnorm].v4l2_id;
return 0;
}
case VIDIOC_S_STD:
v4l2_std_id *id = arg;
unsigned int i;
- for (i = 0; i < BTTV_TVNORMS; i++)
- if (*id & bttv_tvnorms[i].v4l2_id)
+ for (i = 0; i < btv->nr_tvnorms; i++)
+ if (*id & btv->tvnorms[i].v4l2_id)
break;
- if (i == BTTV_TVNORMS)
+ if (i == btv->nr_tvnorms)
return -EINVAL;
mutex_lock(&btv->lock);
if (0 == (dstatus & BT848_DSTATUS_HLOC))
i->status |= V4L2_IN_ST_NO_H_LOCK;
}
- for (n = 0; n < BTTV_TVNORMS; n++)
- i->std |= bttv_tvnorms[n].v4l2_id;
+ for (n = 0; n < btv->nr_tvnorms; n++)
+ i->std |= btv->tvnorms[n].v4l2_id;
return 0;
}
case VIDIOC_G_INPUT:
return -EINVAL;
if (!(fh->ovfmt->flags & FORMAT_FLAGS_PACKED))
return -EINVAL;
- retval = verify_window(&bttv_tvnorms[btv->tvnorm],win,fixup);
+ retval = verify_window(&btv->tvnorms[btv->tvnorm],win,fixup);
if (0 != retval)
return retval;
return -EINVAL;
/* fixup format */
- maxw = bttv_tvnorms[btv->tvnorm].swidth;
- maxh = bttv_tvnorms[btv->tvnorm].sheight;
+ maxw = btv->tvnorms[btv->tvnorm].swidth;
+ maxh = btv->tvnorms[btv->tvnorm].sheight;
field = f->fmt.pix.field;
if (V4L2_FIELD_ANY == field)
field = (f->fmt.pix.height > maxh/2)
return 0;
}
case V4L2_BUF_TYPE_VIDEO_OVERLAY:
- return verify_window(&bttv_tvnorms[btv->tvnorm],
+ return verify_window(&btv->tvnorms[btv->tvnorm],
&f->fmt.win, 1);
case V4L2_BUF_TYPE_VBI_CAPTURE:
bttv_vbi_try_fmt(fh,f);
if (no_overlay <= 0)
cap->type |= VID_TYPE_OVERLAY;
- cap->maxwidth = bttv_tvnorms[btv->tvnorm].swidth;
- cap->maxheight = bttv_tvnorms[btv->tvnorm].sheight;
+ cap->maxwidth = btv->tvnorms[btv->tvnorm].swidth;
+ cap->maxheight = btv->tvnorms[btv->tvnorm].sheight;
cap->minwidth = 48;
cap->minheight = 32;
}
buf->vb.state == STATE_ACTIVE)
goto fh_unlock_and_return;
- field = (vm->height > bttv_tvnorms[btv->tvnorm].sheight/2)
+ field = (vm->height > btv->tvnorms[btv->tvnorm].sheight/2)
? V4L2_FIELD_INTERLACED
: V4L2_FIELD_BOTTOM;
retval = bttv_prepare_buffer(&fh->cap,btv,buf,
mutex_lock(&fh->cap.lock);
retval = -EINVAL;
if (fb->flags & V4L2_FBUF_FLAG_OVERLAY) {
- if (fb->fmt.width > bttv_tvnorms[btv->tvnorm].swidth)
+ if (fb->fmt.width > btv->tvnorms[btv->tvnorm].swidth)
goto fh_unlock_and_return;
- if (fb->fmt.height > bttv_tvnorms[btv->tvnorm].sheight)
+ if (fb->fmt.height > btv->tvnorms[btv->tvnorm].sheight)
goto fh_unlock_and_return;
}
if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
memset(parm,0,sizeof(*parm));
- v4l2_video_std_construct(&s, bttv_tvnorms[btv->tvnorm].v4l2_id,
- bttv_tvnorms[btv->tvnorm].name);
+ v4l2_video_std_construct(&s, btv->tvnorms[btv->tvnorm].v4l2_id,
+ btv->tvnorms[btv->tvnorm].name);
parm->parm.capture.timeperframe = s.frameperiod;
return 0;
}
btv->new_input = UNSET;
btv->has_radio=radio[btv->c.nr];
+ if (!btv->tvnorms) {
+ if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_VIDEO) {
+ btv->tvnorms = bttv_tvnorms_digital;
+ btv->nr_tvnorms = ARRAY_SIZE(bttv_tvnorms_digital);
+ } else {
+ btv->tvnorms = bttv_tvnorms_analogue;
+ btv->nr_tvnorms = ARRAY_SIZE(bttv_tvnorms_analogue);
+ }
+ }
+
/* pci stuff (init, get irq/mmio, ... */
btv->c.pci = dev;
btv->id = dev->device;