diff options
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index c8ee379159e2..20dc573bc150 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -1694,6 +1694,44 @@ static int pvr2_hdw_check_firmware(struct pvr2_hdw *hdw) | |||
1694 | return result == 0; | 1694 | return result == 0; |
1695 | } | 1695 | } |
1696 | 1696 | ||
1697 | struct pvr2_std_hack { | ||
1698 | v4l2_std_id pat; /* Pattern to match */ | ||
1699 | v4l2_std_id msk; /* Which bits we care about */ | ||
1700 | v4l2_std_id std; /* What additional standards or default to set */ | ||
1701 | }; | ||
1702 | |||
1703 | /* This data structure labels specific combinations of standards from | ||
1704 | tveeprom that we'll try to recognize. If we recognize one, then assume | ||
1705 | a specified default standard to use. This is here because tveeprom only | ||
1706 | tells us about available standards not the intended default standard (if | ||
1707 | any) for the device in question. We guess the default based on what has | ||
1708 | been reported as available. Note that this is only for guessing a | ||
1709 | default - which can always be overridden explicitly - and if the user | ||
1710 | has otherwise named a default then that default will always be used in | ||
1711 | place of this table. */ | ||
1712 | const static struct pvr2_std_hack std_eeprom_maps[] = { | ||
1713 | { /* PAL(B/G) */ | ||
1714 | .pat = V4L2_STD_B|V4L2_STD_GH, | ||
1715 | .std = V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_PAL_G, | ||
1716 | }, | ||
1717 | { /* NTSC(M) */ | ||
1718 | .pat = V4L2_STD_MN, | ||
1719 | .std = V4L2_STD_NTSC_M, | ||
1720 | }, | ||
1721 | { /* PAL(I) */ | ||
1722 | .pat = V4L2_STD_PAL_I, | ||
1723 | .std = V4L2_STD_PAL_I, | ||
1724 | }, | ||
1725 | { /* SECAM(L/L') */ | ||
1726 | .pat = V4L2_STD_SECAM_L|V4L2_STD_SECAM_LC, | ||
1727 | .std = V4L2_STD_SECAM_L|V4L2_STD_SECAM_LC, | ||
1728 | }, | ||
1729 | { /* PAL(D/D1/K) */ | ||
1730 | .pat = V4L2_STD_DK, | ||
1731 | .std = V4L2_STD_PAL_D/V4L2_STD_PAL_D1|V4L2_STD_PAL_K, | ||
1732 | }, | ||
1733 | }; | ||
1734 | |||
1697 | static void pvr2_hdw_setup_std(struct pvr2_hdw *hdw) | 1735 | static void pvr2_hdw_setup_std(struct pvr2_hdw *hdw) |
1698 | { | 1736 | { |
1699 | char buf[40]; | 1737 | char buf[40]; |
@@ -1732,6 +1770,27 @@ static void pvr2_hdw_setup_std(struct pvr2_hdw *hdw) | |||
1732 | return; | 1770 | return; |
1733 | } | 1771 | } |
1734 | 1772 | ||
1773 | { | ||
1774 | unsigned int idx; | ||
1775 | for (idx = 0; idx < ARRAY_SIZE(std_eeprom_maps); idx++) { | ||
1776 | if (std_eeprom_maps[idx].msk ? | ||
1777 | ((std_eeprom_maps[idx].pat ^ | ||
1778 | hdw->std_mask_eeprom) & | ||
1779 | std_eeprom_maps[idx].msk) : | ||
1780 | (std_eeprom_maps[idx].pat != | ||
1781 | hdw->std_mask_eeprom)) continue; | ||
1782 | bcnt = pvr2_std_id_to_str(buf,sizeof(buf), | ||
1783 | std_eeprom_maps[idx].std); | ||
1784 | pvr2_trace(PVR2_TRACE_INIT, | ||
1785 | "Initial video standard guessed as %.*s", | ||
1786 | bcnt,buf); | ||
1787 | hdw->std_mask_cur = std_eeprom_maps[idx].std; | ||
1788 | hdw->std_dirty = !0; | ||
1789 | pvr2_hdw_internal_find_stdenum(hdw); | ||
1790 | return; | ||
1791 | } | ||
1792 | } | ||
1793 | |||
1735 | if (hdw->std_enum_cnt > 1) { | 1794 | if (hdw->std_enum_cnt > 1) { |
1736 | // Autoselect the first listed standard | 1795 | // Autoselect the first listed standard |
1737 | hdw->std_enum_cur = 1; | 1796 | hdw->std_enum_cur = 1; |