From 3c70253c62743effde4bb207d05f049bc1c2248b Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Thu, 20 Apr 2006 00:28:33 -0500 Subject: Make PAL-N a supported standard if other PAL standards are present in pvrusb2 From: Mike Isely If the pvrusb2 driver detects a PAL-capable device, add PAL-N to the list of supported standards. Signed-off-by: Mike Isely --- linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c | 43 ++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 897f547e5..45cacc865 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -1397,20 +1397,45 @@ 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 to set +}; + +// This is a mapping of additional standards to support if certain +// standards are already present. +const static struct pvr2_std_hack std_hacks[] = { + { + // Devices which are NTSC-M capable are also marked as + // NTSC-Mj capable on the device's sticker. + .pat = V4L2_STD_NTSC_M, + .std = V4L2_STD_NTSC_M_JP, + },{ + // Enable PAL-N for PAL-capable devices. One user in + // Argentina has encountered this. + .pat = V4L2_STD_PAL_BG|V4L2_STD_PAL_DK|V4L2_STD_PAL_I, + .std = V4L2_STD_PAL_N|V4L2_STD_PAL_Nc + } +}; static void pvr2_hdw_setup_std(struct pvr2_hdw *hdw) { char buf[40]; unsigned int bcnt; v4l2_std_id std1,std2; + unsigned int idx; std1 = get_default_standard(hdw); - // Devices which are NTSC-M capable are also marked as NTSC-Mj - // capable on the device's sticker. Reflect that fact here, - // because tveeprom doesn't seem to report it. - if (hdw->std_mask_eeprom & V4L2_STD_NTSC_M) { - hdw->std_mask_eeprom |= V4L2_STD_NTSC_M_JP; + std2 = 0; + for (idx = 0; idx < sizeof(std_hacks)/sizeof(std_hacks[0]); idx++) { + if (std_hacks[idx].msk ? + ((std_hacks[idx].pat ^ hdw->std_mask_eeprom) & + std_hacks[idx].msk) : + (std_hacks[idx].pat & hdw->std_mask_eeprom)) { + std2 |= std_hacks[idx].std; + } } bcnt = pvr2_std_id_to_str(buf,sizeof(buf),hdw->std_mask_eeprom); @@ -1418,6 +1443,14 @@ static void pvr2_hdw_setup_std(struct pvr2_hdw *hdw) "Supported video standard(s) reported by eeprom: %.*s", bcnt,buf); + if (std2) { + bcnt = pvr2_std_id_to_str(buf,sizeof(buf),std2); + pvr2_trace(PVR2_TRACE_INIT, + "Based on eeprom list, also supporting: %.*s", + bcnt,buf); + hdw->std_mask_eeprom |= std2; + } + hdw->std_mask_avail = hdw->std_mask_eeprom; std2 = std1 & ~hdw->std_mask_avail; -- cgit v1.2.3