Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 65884
b: refs/heads/master
c: 9f66d4e
h: refs/heads/master
v: v3
  • Loading branch information
Mike Isely authored and Mauro Carvalho Chehab committed Oct 10, 2007
1 parent 6affb69 commit a5c17ac
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1d643a372259749ce2029e386ed5760d5d7f8b89
refs/heads/master: 9f66d4eac6be2428901ab6e0cbb6747d5b6794ef
59 changes: 59 additions & 0 deletions trunk/drivers/media/video/pvrusb2/pvrusb2-hdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1694,6 +1694,44 @@ static int pvr2_hdw_check_firmware(struct pvr2_hdw *hdw)
return result == 0;
}

struct pvr2_std_hack {
v4l2_std_id pat; /* Pattern to match */
v4l2_std_id msk; /* Which bits we care about */
v4l2_std_id std; /* What additional standards or default to set */
};

/* This data structure labels specific combinations of standards from
tveeprom that we'll try to recognize. If we recognize one, then assume
a specified default standard to use. This is here because tveeprom only
tells us about available standards not the intended default standard (if
any) for the device in question. We guess the default based on what has
been reported as available. Note that this is only for guessing a
default - which can always be overridden explicitly - and if the user
has otherwise named a default then that default will always be used in
place of this table. */
const static struct pvr2_std_hack std_eeprom_maps[] = {
{ /* PAL(B/G) */
.pat = V4L2_STD_B|V4L2_STD_GH,
.std = V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_PAL_G,
},
{ /* NTSC(M) */
.pat = V4L2_STD_MN,
.std = V4L2_STD_NTSC_M,
},
{ /* PAL(I) */
.pat = V4L2_STD_PAL_I,
.std = V4L2_STD_PAL_I,
},
{ /* SECAM(L/L') */
.pat = V4L2_STD_SECAM_L|V4L2_STD_SECAM_LC,
.std = V4L2_STD_SECAM_L|V4L2_STD_SECAM_LC,
},
{ /* PAL(D/D1/K) */
.pat = V4L2_STD_DK,
.std = V4L2_STD_PAL_D/V4L2_STD_PAL_D1|V4L2_STD_PAL_K,
},
};

static void pvr2_hdw_setup_std(struct pvr2_hdw *hdw)
{
char buf[40];
Expand Down Expand Up @@ -1732,6 +1770,27 @@ static void pvr2_hdw_setup_std(struct pvr2_hdw *hdw)
return;
}

{
unsigned int idx;
for (idx = 0; idx < ARRAY_SIZE(std_eeprom_maps); idx++) {
if (std_eeprom_maps[idx].msk ?
((std_eeprom_maps[idx].pat ^
hdw->std_mask_eeprom) &
std_eeprom_maps[idx].msk) :
(std_eeprom_maps[idx].pat !=
hdw->std_mask_eeprom)) continue;
bcnt = pvr2_std_id_to_str(buf,sizeof(buf),
std_eeprom_maps[idx].std);
pvr2_trace(PVR2_TRACE_INIT,
"Initial video standard guessed as %.*s",
bcnt,buf);
hdw->std_mask_cur = std_eeprom_maps[idx].std;
hdw->std_dirty = !0;
pvr2_hdw_internal_find_stdenum(hdw);
return;
}
}

if (hdw->std_enum_cnt > 1) {
// Autoselect the first listed standard
hdw->std_enum_cur = 1;
Expand Down

0 comments on commit a5c17ac

Please sign in to comment.