em28xx-cards.c (0d4a42f6bd298e826620585e766a154ab460617a) em28xx-cards.c (4159d01bea38ee82f6e49383b7e73e328c118755)
1/*
2 em28xx-cards.c - driver for Empia EM2800/EM2820/2840 USB
3 video capture devices
4
5 Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
6 Markus Rechberger <mrechberger@gmail.com>
7 Mauro Carvalho Chehab <mchehab@infradead.org>
8 Sascha Sommer <saschasommer@freenet.de>

--- 331 unchanged lines hidden (view full) ---

340 {EM2874_R80_GPIO, 0x01, 0xff, 50},
341 {0x0d, 0xff, 0xff, 50},
342 {EM2874_R80_GPIO, 0x41, 0xff, 50}, /* GPIO_6=1 */
343 {0x0d, 0x42, 0xff, 50},
344 {EM2874_R80_GPIO, 0x61, 0xff, 50}, /* GPIO_5=1 */
345 { -1, -1, -1, -1},
346};
347
1/*
2 em28xx-cards.c - driver for Empia EM2800/EM2820/2840 USB
3 video capture devices
4
5 Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
6 Markus Rechberger <mrechberger@gmail.com>
7 Mauro Carvalho Chehab <mchehab@infradead.org>
8 Sascha Sommer <saschasommer@freenet.de>

--- 331 unchanged lines hidden (view full) ---

340 {EM2874_R80_GPIO, 0x01, 0xff, 50},
341 {0x0d, 0xff, 0xff, 50},
342 {EM2874_R80_GPIO, 0x41, 0xff, 50}, /* GPIO_6=1 */
343 {0x0d, 0x42, 0xff, 50},
344 {EM2874_R80_GPIO, 0x61, 0xff, 50}, /* GPIO_5=1 */
345 { -1, -1, -1, -1},
346};
347
348static struct em28xx_reg_seq c3tech_digital_duo_digital[] = {
349 {EM2874_R80_GPIO, 0xff, 0xff, 10},
350 {EM2874_R80_GPIO, 0xfd, 0xff, 10}, /* xc5000 reset */
351 {EM2874_R80_GPIO, 0xf9, 0xff, 35},
352 {EM2874_R80_GPIO, 0xfd, 0xff, 10},
353 {EM2874_R80_GPIO, 0xff, 0xff, 10},
354 {EM2874_R80_GPIO, 0xfe, 0xff, 10},
355 {EM2874_R80_GPIO, 0xbe, 0xff, 10},
356 {EM2874_R80_GPIO, 0xfe, 0xff, 20},
357 { -1, -1, -1, -1},
358};
359
348#if 0
349static struct em28xx_reg_seq hauppauge_930c_gpio[] = {
350 {EM2874_R80_GPIO, 0x6f, 0xff, 10},
351 {EM2874_R80_GPIO, 0x4f, 0xff, 10}, /* xc5000 reset */
352 {EM2874_R80_GPIO, 0x6f, 0xff, 10},
353 {EM2874_R80_GPIO, 0x4f, 0xff, 10},
354 { -1, -1, -1, -1},
355};

--- 597 unchanged lines hidden (view full) ---

953#if 0
954 .tuner_type = TUNER_PHILIPS_TDA8290,
955 .tuner_addr = 0x41,
956 .dvb_gpio = terratec_h5_digital, /* FIXME: probably wrong */
957 .tuner_gpio = terratec_h5_gpio,
958#else
959 .tuner_type = TUNER_ABSENT,
960#endif
360#if 0
361static struct em28xx_reg_seq hauppauge_930c_gpio[] = {
362 {EM2874_R80_GPIO, 0x6f, 0xff, 10},
363 {EM2874_R80_GPIO, 0x4f, 0xff, 10}, /* xc5000 reset */
364 {EM2874_R80_GPIO, 0x6f, 0xff, 10},
365 {EM2874_R80_GPIO, 0x4f, 0xff, 10},
366 { -1, -1, -1, -1},
367};

--- 597 unchanged lines hidden (view full) ---

965#if 0
966 .tuner_type = TUNER_PHILIPS_TDA8290,
967 .tuner_addr = 0x41,
968 .dvb_gpio = terratec_h5_digital, /* FIXME: probably wrong */
969 .tuner_gpio = terratec_h5_gpio,
970#else
971 .tuner_type = TUNER_ABSENT,
972#endif
961 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
962 EM28XX_I2C_CLK_WAIT_ENABLE |
973 .def_i2c_bus = 1,
974 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
963 EM28XX_I2C_FREQ_400_KHZ,
964 },
965 [EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C] = {
966 .name = "Hauppauge WinTV HVR 930C",
967 .has_dvb = 1,
968#if 0 /* FIXME: Add analog support */
969 .tuner_type = TUNER_XC5000,
970 .tuner_addr = 0x41,
971 .dvb_gpio = hauppauge_930c_digital,
972 .tuner_gpio = hauppauge_930c_gpio,
973#else
974 .tuner_type = TUNER_ABSENT,
975#endif
976 .ir_codes = RC_MAP_HAUPPAUGE,
975 EM28XX_I2C_FREQ_400_KHZ,
976 },
977 [EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C] = {
978 .name = "Hauppauge WinTV HVR 930C",
979 .has_dvb = 1,
980#if 0 /* FIXME: Add analog support */
981 .tuner_type = TUNER_XC5000,
982 .tuner_addr = 0x41,
983 .dvb_gpio = hauppauge_930c_digital,
984 .tuner_gpio = hauppauge_930c_gpio,
985#else
986 .tuner_type = TUNER_ABSENT,
987#endif
988 .ir_codes = RC_MAP_HAUPPAUGE,
977 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
978 EM28XX_I2C_CLK_WAIT_ENABLE |
989 .def_i2c_bus = 1,
990 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
979 EM28XX_I2C_FREQ_400_KHZ,
980 },
991 EM28XX_I2C_FREQ_400_KHZ,
992 },
993 [EM2884_BOARD_C3TECH_DIGITAL_DUO] = {
994 .name = "C3 Tech Digital Duo HDTV/SDTV USB",
995 .has_dvb = 1,
996 /* FIXME: Add analog support - need a saa7136 driver */
997 .tuner_type = TUNER_ABSENT, /* Digital-only TDA18271HD */
998 .ir_codes = RC_MAP_EMPTY,
999 .def_i2c_bus = 1,
1000 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE,
1001 .dvb_gpio = c3tech_digital_duo_digital,
1002 },
981 [EM2884_BOARD_CINERGY_HTC_STICK] = {
982 .name = "Terratec Cinergy HTC Stick",
983 .has_dvb = 1,
984 .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
985 .tuner_type = TUNER_ABSENT,
1003 [EM2884_BOARD_CINERGY_HTC_STICK] = {
1004 .name = "Terratec Cinergy HTC Stick",
1005 .has_dvb = 1,
1006 .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
1007 .tuner_type = TUNER_ABSENT,
986 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
987 EM28XX_I2C_CLK_WAIT_ENABLE |
1008 .def_i2c_bus = 1,
1009 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
988 EM28XX_I2C_FREQ_400_KHZ,
989 },
990 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
991 .name = "Hauppauge WinTV HVR 900",
992 .tda9887_conf = TDA9887_PRESENT,
993 .tuner_type = TUNER_XC2028,
994 .tuner_gpio = default_tuner_gpio,
995 .mts_firmware = 1,

--- 403 unchanged lines hidden (view full) ---

1399 .vmux = SAA7115_SVIDEO3,
1400 }, {
1401 .type = EM28XX_VMUX_COMPOSITE1,
1402 .vmux = SAA7115_COMPOSITE0,
1403 } },
1404 },
1405
1406 [EM2874_BOARD_LEADERSHIP_ISDBT] = {
1010 EM28XX_I2C_FREQ_400_KHZ,
1011 },
1012 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
1013 .name = "Hauppauge WinTV HVR 900",
1014 .tda9887_conf = TDA9887_PRESENT,
1015 .tuner_type = TUNER_XC2028,
1016 .tuner_gpio = default_tuner_gpio,
1017 .mts_firmware = 1,

--- 403 unchanged lines hidden (view full) ---

1421 .vmux = SAA7115_SVIDEO3,
1422 }, {
1423 .type = EM28XX_VMUX_COMPOSITE1,
1424 .vmux = SAA7115_COMPOSITE0,
1425 } },
1426 },
1427
1428 [EM2874_BOARD_LEADERSHIP_ISDBT] = {
1407 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
1408 EM28XX_I2C_CLK_WAIT_ENABLE |
1429 .def_i2c_bus = 1,
1430 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1409 EM28XX_I2C_FREQ_100_KHZ,
1410 .xclk = EM28XX_XCLK_FREQUENCY_10MHZ,
1411 .name = "EM2874 Leadership ISDBT",
1412 .tuner_type = TUNER_ABSENT,
1413 .tuner_gpio = leadership_reset,
1414 .dvb_gpio = leadership_digital,
1415 .has_dvb = 1,
1416 },

--- 495 unchanged lines hidden (view full) ---

1912 .has_dvb = 1,
1913 .dvb_gpio = kworld_a340_digital,
1914 .tuner_gpio = default_tuner_gpio,
1915 },
1916 /* 2013:024f PCTV nanoStick T2 290e.
1917 * Empia EM28174, Sony CXD2820R and NXP TDA18271HD/C2 */
1918 [EM28174_BOARD_PCTV_290E] = {
1919 .name = "PCTV nanoStick T2 290e",
1431 EM28XX_I2C_FREQ_100_KHZ,
1432 .xclk = EM28XX_XCLK_FREQUENCY_10MHZ,
1433 .name = "EM2874 Leadership ISDBT",
1434 .tuner_type = TUNER_ABSENT,
1435 .tuner_gpio = leadership_reset,
1436 .dvb_gpio = leadership_digital,
1437 .has_dvb = 1,
1438 },

--- 495 unchanged lines hidden (view full) ---

1934 .has_dvb = 1,
1935 .dvb_gpio = kworld_a340_digital,
1936 .tuner_gpio = default_tuner_gpio,
1937 },
1938 /* 2013:024f PCTV nanoStick T2 290e.
1939 * Empia EM28174, Sony CXD2820R and NXP TDA18271HD/C2 */
1940 [EM28174_BOARD_PCTV_290E] = {
1941 .name = "PCTV nanoStick T2 290e",
1920 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
1921 EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_100_KHZ,
1942 .def_i2c_bus = 1,
1943 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_100_KHZ,
1922 .tuner_type = TUNER_ABSENT,
1923 .tuner_gpio = pctv_290e,
1924 .has_dvb = 1,
1925 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1926 },
1927 /* 2013:024f PCTV DVB-S2 Stick 460e
1928 * Empia EM28174, NXP TDA10071, Conexant CX24118A and Allegro A8293 */
1929 [EM28174_BOARD_PCTV_460E] = {
1944 .tuner_type = TUNER_ABSENT,
1945 .tuner_gpio = pctv_290e,
1946 .has_dvb = 1,
1947 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1948 },
1949 /* 2013:024f PCTV DVB-S2 Stick 460e
1950 * Empia EM28174, NXP TDA10071, Conexant CX24118A and Allegro A8293 */
1951 [EM28174_BOARD_PCTV_460E] = {
1930 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
1931 EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_400_KHZ,
1952 .def_i2c_bus = 1,
1953 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_400_KHZ,
1932 .name = "PCTV DVB-S2 Stick (460e)",
1933 .tuner_type = TUNER_ABSENT,
1934 .tuner_gpio = pctv_460e,
1935 .has_dvb = 1,
1936 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1937 },
1938 /* eb1a:5006 Honestech VIDBOX NW03
1939 * Empia EM2860, Philips SAA7113, Empia EMP202, No Tuner */

--- 13 unchanged lines hidden (view full) ---

1953 },
1954 /* 1b80:e425 MaxMedia UB425-TC
1955 * Empia EM2874B + Micronas DRX 3913KA2 + NXP TDA18271HDC2 */
1956 [EM2874_BOARD_MAXMEDIA_UB425_TC] = {
1957 .name = "MaxMedia UB425-TC",
1958 .tuner_type = TUNER_ABSENT,
1959 .tuner_gpio = maxmedia_ub425_tc,
1960 .has_dvb = 1,
1954 .name = "PCTV DVB-S2 Stick (460e)",
1955 .tuner_type = TUNER_ABSENT,
1956 .tuner_gpio = pctv_460e,
1957 .has_dvb = 1,
1958 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1959 },
1960 /* eb1a:5006 Honestech VIDBOX NW03
1961 * Empia EM2860, Philips SAA7113, Empia EMP202, No Tuner */

--- 13 unchanged lines hidden (view full) ---

1975 },
1976 /* 1b80:e425 MaxMedia UB425-TC
1977 * Empia EM2874B + Micronas DRX 3913KA2 + NXP TDA18271HDC2 */
1978 [EM2874_BOARD_MAXMEDIA_UB425_TC] = {
1979 .name = "MaxMedia UB425-TC",
1980 .tuner_type = TUNER_ABSENT,
1981 .tuner_gpio = maxmedia_ub425_tc,
1982 .has_dvb = 1,
1961 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
1962 EM28XX_I2C_CLK_WAIT_ENABLE |
1983 .def_i2c_bus = 1,
1984 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1963 EM28XX_I2C_FREQ_400_KHZ,
1964 },
1965 /* 2304:0242 PCTV QuatroStick (510e)
1966 * Empia EM2884 + Micronas DRX 3926K + NXP TDA18271HDC2 */
1967 [EM2884_BOARD_PCTV_510E] = {
1968 .name = "PCTV QuatroStick (510e)",
1969 .tuner_type = TUNER_ABSENT,
1970 .tuner_gpio = pctv_510e,
1971 .has_dvb = 1,
1972 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1985 EM28XX_I2C_FREQ_400_KHZ,
1986 },
1987 /* 2304:0242 PCTV QuatroStick (510e)
1988 * Empia EM2884 + Micronas DRX 3926K + NXP TDA18271HDC2 */
1989 [EM2884_BOARD_PCTV_510E] = {
1990 .name = "PCTV QuatroStick (510e)",
1991 .tuner_type = TUNER_ABSENT,
1992 .tuner_gpio = pctv_510e,
1993 .has_dvb = 1,
1994 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1973 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
1974 EM28XX_I2C_CLK_WAIT_ENABLE |
1995 .def_i2c_bus = 1,
1996 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1975 EM28XX_I2C_FREQ_400_KHZ,
1976 },
1977 /* 2013:0251 PCTV QuatroStick nano (520e)
1978 * Empia EM2884 + Micronas DRX 3926K + NXP TDA18271HDC2 */
1979 [EM2884_BOARD_PCTV_520E] = {
1980 .name = "PCTV QuatroStick nano (520e)",
1981 .tuner_type = TUNER_ABSENT,
1982 .tuner_gpio = pctv_520e,
1983 .has_dvb = 1,
1984 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1997 EM28XX_I2C_FREQ_400_KHZ,
1998 },
1999 /* 2013:0251 PCTV QuatroStick nano (520e)
2000 * Empia EM2884 + Micronas DRX 3926K + NXP TDA18271HDC2 */
2001 [EM2884_BOARD_PCTV_520E] = {
2002 .name = "PCTV QuatroStick nano (520e)",
2003 .tuner_type = TUNER_ABSENT,
2004 .tuner_gpio = pctv_520e,
2005 .has_dvb = 1,
2006 .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1985 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
1986 EM28XX_I2C_CLK_WAIT_ENABLE |
2007 .def_i2c_bus = 1,
2008 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1987 EM28XX_I2C_FREQ_400_KHZ,
1988 },
1989 [EM2884_BOARD_TERRATEC_HTC_USB_XS] = {
1990 .name = "Terratec Cinergy HTC USB XS",
1991 .has_dvb = 1,
1992 .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
1993 .tuner_type = TUNER_ABSENT,
2009 EM28XX_I2C_FREQ_400_KHZ,
2010 },
2011 [EM2884_BOARD_TERRATEC_HTC_USB_XS] = {
2012 .name = "Terratec Cinergy HTC USB XS",
2013 .has_dvb = 1,
2014 .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
2015 .tuner_type = TUNER_ABSENT,
1994 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
1995 EM28XX_I2C_CLK_WAIT_ENABLE |
2016 .def_i2c_bus = 1,
2017 .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1996 EM28XX_I2C_FREQ_400_KHZ,
1997 },
1998};
1999const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
2000
2001/* table of devices that work with this driver */
2002struct usb_device_id em28xx_id_table[] = {
2003 { USB_DEVICE(0xeb1a, 0x2750),

--- 135 unchanged lines hidden (view full) ---

2139 { USB_DEVICE(0x1b80, 0xa340),
2140 .driver_info = EM2870_BOARD_KWORLD_A340 },
2141 { USB_DEVICE(0x2013, 0x024f),
2142 .driver_info = EM28174_BOARD_PCTV_290E },
2143 { USB_DEVICE(0x2013, 0x024c),
2144 .driver_info = EM28174_BOARD_PCTV_460E },
2145 { USB_DEVICE(0x2040, 0x1605),
2146 .driver_info = EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C },
2018 EM28XX_I2C_FREQ_400_KHZ,
2019 },
2020};
2021const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
2022
2023/* table of devices that work with this driver */
2024struct usb_device_id em28xx_id_table[] = {
2025 { USB_DEVICE(0xeb1a, 0x2750),

--- 135 unchanged lines hidden (view full) ---

2161 { USB_DEVICE(0x1b80, 0xa340),
2162 .driver_info = EM2870_BOARD_KWORLD_A340 },
2163 { USB_DEVICE(0x2013, 0x024f),
2164 .driver_info = EM28174_BOARD_PCTV_290E },
2165 { USB_DEVICE(0x2013, 0x024c),
2166 .driver_info = EM28174_BOARD_PCTV_460E },
2167 { USB_DEVICE(0x2040, 0x1605),
2168 .driver_info = EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C },
2169 { USB_DEVICE(0x1b80, 0xe755),
2170 .driver_info = EM2884_BOARD_C3TECH_DIGITAL_DUO },
2147 { USB_DEVICE(0xeb1a, 0x5006),
2148 .driver_info = EM2860_BOARD_HT_VIDBOX_NW03 },
2149 { USB_DEVICE(0x1b80, 0xe309), /* Sveon STV40 */
2150 .driver_info = EM2860_BOARD_EASYCAP },
2151 { USB_DEVICE(0x1b80, 0xe425),
2152 .driver_info = EM2874_BOARD_MAXMEDIA_UB425_TC },
2153 { USB_DEVICE(0x2304, 0x0242),
2154 .driver_info = EM2884_BOARD_PCTV_510E },

--- 23 unchanged lines hidden (view full) ---

2178 {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC},
2179 {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC},
2180 {0x1ba50080, EM2860_BOARD_SAA711X_REFERENCE_DESIGN, TUNER_ABSENT},
2181 {0x77800080, EM2860_BOARD_TVP5150_REFERENCE_DESIGN, TUNER_ABSENT},
2182 {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC},
2183 {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF},
2184 {0x6b800080, EM2874_BOARD_LEADERSHIP_ISDBT, TUNER_ABSENT},
2185};
2171 { USB_DEVICE(0xeb1a, 0x5006),
2172 .driver_info = EM2860_BOARD_HT_VIDBOX_NW03 },
2173 { USB_DEVICE(0x1b80, 0xe309), /* Sveon STV40 */
2174 .driver_info = EM2860_BOARD_EASYCAP },
2175 { USB_DEVICE(0x1b80, 0xe425),
2176 .driver_info = EM2874_BOARD_MAXMEDIA_UB425_TC },
2177 { USB_DEVICE(0x2304, 0x0242),
2178 .driver_info = EM2884_BOARD_PCTV_510E },

--- 23 unchanged lines hidden (view full) ---

2202 {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC},
2203 {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC},
2204 {0x1ba50080, EM2860_BOARD_SAA711X_REFERENCE_DESIGN, TUNER_ABSENT},
2205 {0x77800080, EM2860_BOARD_TVP5150_REFERENCE_DESIGN, TUNER_ABSENT},
2206 {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC},
2207 {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF},
2208 {0x6b800080, EM2874_BOARD_LEADERSHIP_ISDBT, TUNER_ABSENT},
2209};
2210/* NOTE: introduce a separate hash table for devices with 16 bit eeproms */
2186
2187/* I2C possible address to saa7115, tvp5150, msp3400, tvaudio */
2188static unsigned short saa711x_addrs[] = {
2189 0x4a >> 1, 0x48 >> 1, /* SAA7111, SAA7111A and SAA7113 */
2190 0x42 >> 1, 0x40 >> 1, /* SAA7114, SAA7115 and SAA7118 */
2191 I2C_CLIENT_END };
2192
2193static unsigned short tvp5150_addrs[] = {

--- 34 unchanged lines hidden (view full) ---

2228 */
2229 if (!dev->board.xclk)
2230 dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE |
2231 EM28XX_XCLK_FREQUENCY_12MHZ;
2232
2233 if (!dev->board.i2c_speed)
2234 dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2235 EM28XX_I2C_FREQ_100_KHZ;
2211
2212/* I2C possible address to saa7115, tvp5150, msp3400, tvaudio */
2213static unsigned short saa711x_addrs[] = {
2214 0x4a >> 1, 0x48 >> 1, /* SAA7111, SAA7111A and SAA7113 */
2215 0x42 >> 1, 0x40 >> 1, /* SAA7114, SAA7115 and SAA7118 */
2216 I2C_CLIENT_END };
2217
2218static unsigned short tvp5150_addrs[] = {

--- 34 unchanged lines hidden (view full) ---

2253 */
2254 if (!dev->board.xclk)
2255 dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE |
2256 EM28XX_XCLK_FREQUENCY_12MHZ;
2257
2258 if (!dev->board.i2c_speed)
2259 dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2260 EM28XX_I2C_FREQ_100_KHZ;
2261
2262 /* Should be initialized early, for I2C to work */
2263 dev->def_i2c_bus = dev->board.def_i2c_bus;
2236}
2237
2238
2239/* FIXME: Should be replaced by a proper mt9m111 driver */
2240static int em28xx_initialize_mt9m111(struct em28xx *dev)
2241{
2242 int i;
2243 unsigned char regs[][3] = {
2244 { 0x0d, 0x00, 0x01, }, /* reset and use defaults */
2245 { 0x0d, 0x00, 0x00, },
2246 { 0x0a, 0x00, 0x21, },
2247 { 0x21, 0x04, 0x00, }, /* full readout speed, no row/col skipping */
2248 };
2249
2250 for (i = 0; i < ARRAY_SIZE(regs); i++)
2264}
2265
2266
2267/* FIXME: Should be replaced by a proper mt9m111 driver */
2268static int em28xx_initialize_mt9m111(struct em28xx *dev)
2269{
2270 int i;
2271 unsigned char regs[][3] = {
2272 { 0x0d, 0x00, 0x01, }, /* reset and use defaults */
2273 { 0x0d, 0x00, 0x00, },
2274 { 0x0a, 0x00, 0x21, },
2275 { 0x21, 0x04, 0x00, }, /* full readout speed, no row/col skipping */
2276 };
2277
2278 for (i = 0; i < ARRAY_SIZE(regs); i++)
2251 i2c_master_send(&dev->i2c_client, &regs[i][0], 3);
2279 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], &regs[i][0], 3);
2252
2253 return 0;
2254}
2255
2256
2257/* FIXME: Should be replaced by a proper mt9m001 driver */
2258static int em28xx_initialize_mt9m001(struct em28xx *dev)
2259{

--- 10 unchanged lines hidden (view full) ---

2270 { 0x35, 0x00, 0x24, },
2271 { 0x2d, 0x00, 0x20, },
2272 { 0x2c, 0x00, 0x20, },
2273 { 0x09, 0x0a, 0xd4, },
2274 { 0x35, 0x00, 0x57, },
2275 };
2276
2277 for (i = 0; i < ARRAY_SIZE(regs); i++)
2280
2281 return 0;
2282}
2283
2284
2285/* FIXME: Should be replaced by a proper mt9m001 driver */
2286static int em28xx_initialize_mt9m001(struct em28xx *dev)
2287{

--- 10 unchanged lines hidden (view full) ---

2298 { 0x35, 0x00, 0x24, },
2299 { 0x2d, 0x00, 0x20, },
2300 { 0x2c, 0x00, 0x20, },
2301 { 0x09, 0x0a, 0xd4, },
2302 { 0x35, 0x00, 0x57, },
2303 };
2304
2305 for (i = 0; i < ARRAY_SIZE(regs); i++)
2278 i2c_master_send(&dev->i2c_client, &regs[i][0], 3);
2306 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], &regs[i][0], 3);
2279
2280 return 0;
2281}
2282
2283/* HINT method: webcam I2C chips
2284 *
2285 * This method works for webcams with Micron sensors
2286 */
2287static int em28xx_hint_sensor(struct em28xx *dev)
2288{
2289 int rc;
2290 char *sensor_name;
2291 unsigned char cmd;
2292 __be16 version_be;
2293 u16 version;
2294
2295 /* Micron sensor detection */
2307
2308 return 0;
2309}
2310
2311/* HINT method: webcam I2C chips
2312 *
2313 * This method works for webcams with Micron sensors
2314 */
2315static int em28xx_hint_sensor(struct em28xx *dev)
2316{
2317 int rc;
2318 char *sensor_name;
2319 unsigned char cmd;
2320 __be16 version_be;
2321 u16 version;
2322
2323 /* Micron sensor detection */
2296 dev->i2c_client.addr = 0xba >> 1;
2324 dev->i2c_client[dev->def_i2c_bus].addr = 0xba >> 1;
2297 cmd = 0;
2325 cmd = 0;
2298 i2c_master_send(&dev->i2c_client, &cmd, 1);
2299 rc = i2c_master_recv(&dev->i2c_client, (char *)&version_be, 2);
2326 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], &cmd, 1);
2327 rc = i2c_master_recv(&dev->i2c_client[dev->def_i2c_bus], (char *)&version_be, 2);
2300 if (rc != 2)
2301 return -EINVAL;
2302
2303 version = be16_to_cpu(version_be);
2304 switch (version) {
2305 case 0x8232: /* mt9v011 640x480 1.3 Mpix sensor */
2306 case 0x8243: /* mt9v011 rev B 640x480 1.3 Mpix sensor */
2307 dev->model = EM2820_BOARD_SILVERCREST_WEBCAM;

--- 325 unchanged lines hidden (view full) ---

2633 * Uses a hash of i2c scanned devices.
2634 * Devices with the same i2c attached chips will
2635 * be considered equal.
2636 * This method is less precise than the eeprom one.
2637 */
2638
2639 /* user did not request i2c scanning => do it now */
2640 if (!dev->i2c_hash)
2328 if (rc != 2)
2329 return -EINVAL;
2330
2331 version = be16_to_cpu(version_be);
2332 switch (version) {
2333 case 0x8232: /* mt9v011 640x480 1.3 Mpix sensor */
2334 case 0x8243: /* mt9v011 rev B 640x480 1.3 Mpix sensor */
2335 dev->model = EM2820_BOARD_SILVERCREST_WEBCAM;

--- 325 unchanged lines hidden (view full) ---

2661 * Uses a hash of i2c scanned devices.
2662 * Devices with the same i2c attached chips will
2663 * be considered equal.
2664 * This method is less precise than the eeprom one.
2665 */
2666
2667 /* user did not request i2c scanning => do it now */
2668 if (!dev->i2c_hash)
2641 em28xx_do_i2c_scan(dev);
2669 em28xx_do_i2c_scan(dev, dev->def_i2c_bus);
2642
2643 for (i = 0; i < ARRAY_SIZE(em28xx_i2c_hash); i++) {
2644 if (dev->i2c_hash == em28xx_i2c_hash[i].hash) {
2645 dev->model = em28xx_i2c_hash[i].model;
2646 dev->tuner_type = em28xx_i2c_hash[i].tuner;
2647 em28xx_errdev("Your board has no unique USB ID.\n");
2648 em28xx_errdev("A hint were successfully done, "
2649 "based on i2c devicelist hash.\n");

--- 81 unchanged lines hidden (view full) ---

2731
2732 /* request some modules */
2733 switch (dev->model) {
2734 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
2735 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
2736 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
2737 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
2738 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
2670
2671 for (i = 0; i < ARRAY_SIZE(em28xx_i2c_hash); i++) {
2672 if (dev->i2c_hash == em28xx_i2c_hash[i].hash) {
2673 dev->model = em28xx_i2c_hash[i].model;
2674 dev->tuner_type = em28xx_i2c_hash[i].tuner;
2675 em28xx_errdev("Your board has no unique USB ID.\n");
2676 em28xx_errdev("A hint were successfully done, "
2677 "based on i2c devicelist hash.\n");

--- 81 unchanged lines hidden (view full) ---

2759
2760 /* request some modules */
2761 switch (dev->model) {
2762 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
2763 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
2764 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
2765 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
2766 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
2767 case EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C:
2739 {
2740 struct tveeprom tv;
2768 {
2769 struct tveeprom tv;
2770
2771 if (dev->eedata == NULL)
2772 break;
2741#if defined(CONFIG_MODULES) && defined(MODULE)
2742 request_module("tveeprom");
2743#endif
2744 /* Call first TVeeprom */
2745
2773#if defined(CONFIG_MODULES) && defined(MODULE)
2774 request_module("tveeprom");
2775#endif
2776 /* Call first TVeeprom */
2777
2746 dev->i2c_client.addr = 0xa0 >> 1;
2747 tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
2778 dev->i2c_client[dev->def_i2c_bus].addr = 0xa0 >> 1;
2779 tveeprom_hauppauge_analog(&dev->i2c_client[dev->def_i2c_bus], &tv, dev->eedata);
2748
2749 dev->tuner_type = tv.tuner_type;
2750
2751 if (tv.audio_processor == V4L2_IDENT_MSPX4XX) {
2752 dev->i2s_speed = 2048000;
2753 dev->board.has_msp34xx = 1;
2754 }
2755 break;

--- 30 unchanged lines hidden (view full) ---

2786 /* In cases where we had to use a board hint, the call to
2787 em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
2788 so make the call now so the analog GPIOs are set properly
2789 before probing the i2c bus. */
2790 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2791 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2792 break;
2793
2780
2781 dev->tuner_type = tv.tuner_type;
2782
2783 if (tv.audio_processor == V4L2_IDENT_MSPX4XX) {
2784 dev->i2s_speed = 2048000;
2785 dev->board.has_msp34xx = 1;
2786 }
2787 break;

--- 30 unchanged lines hidden (view full) ---

2818 /* In cases where we had to use a board hint, the call to
2819 em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
2820 so make the call now so the analog GPIOs are set properly
2821 before probing the i2c bus. */
2822 em28xx_gpio_set(dev, dev->board.tuner_gpio);
2823 em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2824 break;
2825
2794/*
2826 /*
2795 * The Dikom DK300 is detected as an Kworld VS-DVB-T 323UR.
2796 *
2797 * This occurs because they share identical USB vendor and
2798 * product IDs.
2799 *
2800 * What we do here is look up the EEPROM hash of the Dikom
2801 * and if it is found then we decide that we do not have
2802 * a Kworld and reset the device to the Dikom instead.

--- 18 unchanged lines hidden (view full) ---

2821 em28xx_errdev("\n\n");
2822 em28xx_errdev("The support for this board weren't "
2823 "valid yet.\n");
2824 em28xx_errdev("Please send a report of having this working\n");
2825 em28xx_errdev("not to V4L mailing list (and/or to other "
2826 "addresses)\n\n");
2827 }
2828
2827 * The Dikom DK300 is detected as an Kworld VS-DVB-T 323UR.
2828 *
2829 * This occurs because they share identical USB vendor and
2830 * product IDs.
2831 *
2832 * What we do here is look up the EEPROM hash of the Dikom
2833 * and if it is found then we decide that we do not have
2834 * a Kworld and reset the device to the Dikom instead.

--- 18 unchanged lines hidden (view full) ---

2853 em28xx_errdev("\n\n");
2854 em28xx_errdev("The support for this board weren't "
2855 "valid yet.\n");
2856 em28xx_errdev("Please send a report of having this working\n");
2857 em28xx_errdev("not to V4L mailing list (and/or to other "
2858 "addresses)\n\n");
2859 }
2860
2861 /* Free eeprom data memory */
2862 kfree(dev->eedata);
2863 dev->eedata = NULL;
2864
2829 /* Allow override tuner type by a module parameter */
2830 if (tuner >= 0)
2831 dev->tuner_type = tuner;
2832
2833 /* request some modules */
2834 if (dev->board.has_msp34xx)
2865 /* Allow override tuner type by a module parameter */
2866 if (tuner >= 0)
2867 dev->tuner_type = tuner;
2868
2869 /* request some modules */
2870 if (dev->board.has_msp34xx)
2835 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2871 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus],
2836 "msp3400", 0, msp3400_addrs);
2837
2838 if (dev->board.decoder == EM28XX_SAA711X)
2872 "msp3400", 0, msp3400_addrs);
2873
2874 if (dev->board.decoder == EM28XX_SAA711X)
2839 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2875 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus],
2840 "saa7115_auto", 0, saa711x_addrs);
2841
2842 if (dev->board.decoder == EM28XX_TVP5150)
2876 "saa7115_auto", 0, saa711x_addrs);
2877
2878 if (dev->board.decoder == EM28XX_TVP5150)
2843 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2879 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus],
2844 "tvp5150", 0, tvp5150_addrs);
2845
2846 if (dev->em28xx_sensor == EM28XX_MT9V011) {
2847 struct mt9v011_platform_data pdata;
2848 struct i2c_board_info mt9v011_info = {
2849 .type = "mt9v011",
2850 .addr = 0xba >> 1,
2851 .platform_data = &pdata,
2852 };
2853
2854 pdata.xtal = dev->sensor_xtal;
2880 "tvp5150", 0, tvp5150_addrs);
2881
2882 if (dev->em28xx_sensor == EM28XX_MT9V011) {
2883 struct mt9v011_platform_data pdata;
2884 struct i2c_board_info mt9v011_info = {
2885 .type = "mt9v011",
2886 .addr = 0xba >> 1,
2887 .platform_data = &pdata,
2888 };
2889
2890 pdata.xtal = dev->sensor_xtal;
2855 v4l2_i2c_new_subdev_board(&dev->v4l2_dev, &dev->i2c_adap,
2891 v4l2_i2c_new_subdev_board(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus],
2856 &mt9v011_info, NULL);
2857 }
2858
2859
2860 if (dev->board.adecoder == EM28XX_TVAUDIO)
2892 &mt9v011_info, NULL);
2893 }
2894
2895
2896 if (dev->board.adecoder == EM28XX_TVAUDIO)
2861 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2897 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus],
2862 "tvaudio", dev->board.tvaudio_addr, NULL);
2863
2864 if (dev->board.tuner_type != TUNER_ABSENT) {
2865 int has_demod = (dev->tda9887_conf & TDA9887_PRESENT);
2866
2867 if (dev->board.radio.type)
2898 "tvaudio", dev->board.tvaudio_addr, NULL);
2899
2900 if (dev->board.tuner_type != TUNER_ABSENT) {
2901 int has_demod = (dev->tda9887_conf & TDA9887_PRESENT);
2902
2903 if (dev->board.radio.type)
2868 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2904 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus],
2869 "tuner", dev->board.radio_addr, NULL);
2870
2871 if (has_demod)
2872 v4l2_i2c_new_subdev(&dev->v4l2_dev,
2905 "tuner", dev->board.radio_addr, NULL);
2906
2907 if (has_demod)
2908 v4l2_i2c_new_subdev(&dev->v4l2_dev,
2873 &dev->i2c_adap, "tuner",
2909 &dev->i2c_adap[dev->def_i2c_bus], "tuner",
2874 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
2875 if (dev->tuner_addr == 0) {
2876 enum v4l2_i2c_tuner_type type =
2877 has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV;
2878 struct v4l2_subdev *sd;
2879
2880 sd = v4l2_i2c_new_subdev(&dev->v4l2_dev,
2910 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
2911 if (dev->tuner_addr == 0) {
2912 enum v4l2_i2c_tuner_type type =
2913 has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV;
2914 struct v4l2_subdev *sd;
2915
2916 sd = v4l2_i2c_new_subdev(&dev->v4l2_dev,
2881 &dev->i2c_adap, "tuner",
2917 &dev->i2c_adap[dev->def_i2c_bus], "tuner",
2882 0, v4l2_i2c_tuner_addrs(type));
2883
2884 if (sd)
2885 dev->tuner_addr = v4l2_i2c_subdev_addr(sd);
2886 } else {
2918 0, v4l2_i2c_tuner_addrs(type));
2919
2920 if (sd)
2921 dev->tuner_addr = v4l2_i2c_subdev_addr(sd);
2922 } else {
2887 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
2923 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus],
2888 "tuner", dev->tuner_addr, NULL);
2889 }
2890 }
2891
2892 em28xx_tuner_setup(dev);
2893}
2894
2895

--- 40 unchanged lines hidden (view full) ---

2936 * called when the device gets disconnected or at module unload
2937*/
2938void em28xx_release_resources(struct em28xx *dev)
2939{
2940 /*FIXME: I2C IR should be disconnected */
2941
2942 em28xx_release_analog_resources(dev);
2943
2924 "tuner", dev->tuner_addr, NULL);
2925 }
2926 }
2927
2928 em28xx_tuner_setup(dev);
2929}
2930
2931

--- 40 unchanged lines hidden (view full) ---

2972 * called when the device gets disconnected or at module unload
2973*/
2974void em28xx_release_resources(struct em28xx *dev)
2975{
2976 /*FIXME: I2C IR should be disconnected */
2977
2978 em28xx_release_analog_resources(dev);
2979
2944 em28xx_i2c_unregister(dev);
2980 if (dev->def_i2c_bus)
2981 em28xx_i2c_unregister(dev, 1);
2982 em28xx_i2c_unregister(dev, 0);
2945
2946 v4l2_ctrl_handler_free(&dev->ctrl_handler);
2947
2948 v4l2_device_unregister(&dev->v4l2_dev);
2949
2950 usb_put_dev(dev->udev);
2951
2952 /* Mark device as unused */

--- 61 unchanged lines hidden (view full) ---

3014 case CHIP_ID_EM2870:
3015 chip_name = "em2870";
3016 dev->wait_after_write = 0;
3017 break;
3018 case CHIP_ID_EM2874:
3019 chip_name = "em2874";
3020 dev->reg_gpio_num = EM2874_R80_GPIO;
3021 dev->wait_after_write = 0;
2983
2984 v4l2_ctrl_handler_free(&dev->ctrl_handler);
2985
2986 v4l2_device_unregister(&dev->v4l2_dev);
2987
2988 usb_put_dev(dev->udev);
2989
2990 /* Mark device as unused */

--- 61 unchanged lines hidden (view full) ---

3052 case CHIP_ID_EM2870:
3053 chip_name = "em2870";
3054 dev->wait_after_write = 0;
3055 break;
3056 case CHIP_ID_EM2874:
3057 chip_name = "em2874";
3058 dev->reg_gpio_num = EM2874_R80_GPIO;
3059 dev->wait_after_write = 0;
3060 dev->eeprom_addrwidth_16bit = 1;
3022 break;
3023 case CHIP_ID_EM28174:
3024 chip_name = "em28174";
3025 dev->reg_gpio_num = EM2874_R80_GPIO;
3026 dev->wait_after_write = 0;
3061 break;
3062 case CHIP_ID_EM28174:
3063 chip_name = "em28174";
3064 dev->reg_gpio_num = EM2874_R80_GPIO;
3065 dev->wait_after_write = 0;
3066 dev->eeprom_addrwidth_16bit = 1;
3027 break;
3028 case CHIP_ID_EM2883:
3029 chip_name = "em2882/3";
3030 dev->wait_after_write = 0;
3031 break;
3032 case CHIP_ID_EM2884:
3033 chip_name = "em2884";
3034 dev->reg_gpio_num = EM2874_R80_GPIO;
3035 dev->wait_after_write = 0;
3067 break;
3068 case CHIP_ID_EM2883:
3069 chip_name = "em2882/3";
3070 dev->wait_after_write = 0;
3071 break;
3072 case CHIP_ID_EM2884:
3073 chip_name = "em2884";
3074 dev->reg_gpio_num = EM2874_R80_GPIO;
3075 dev->wait_after_write = 0;
3076 dev->eeprom_addrwidth_16bit = 1;
3036 break;
3037 default:
3038 printk(KERN_INFO DRIVER_NAME
3039 ": unknown em28xx chip ID (%d)\n", dev->chip_id);
3040 }
3041 }
3042
3043 if (chip_name != default_chip_name)

--- 42 unchanged lines hidden (view full) ---

3086 }
3087
3088 retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
3089 if (retval < 0) {
3090 em28xx_errdev("Call to v4l2_device_register() failed!\n");
3091 return retval;
3092 }
3093
3077 break;
3078 default:
3079 printk(KERN_INFO DRIVER_NAME
3080 ": unknown em28xx chip ID (%d)\n", dev->chip_id);
3081 }
3082 }
3083
3084 if (chip_name != default_chip_name)

--- 42 unchanged lines hidden (view full) ---

3127 }
3128
3129 retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
3130 if (retval < 0) {
3131 em28xx_errdev("Call to v4l2_device_register() failed!\n");
3132 return retval;
3133 }
3134
3094 v4l2_ctrl_handler_init(hdl, 4);
3135 v4l2_ctrl_handler_init(hdl, 8);
3095 dev->v4l2_dev.ctrl_handler = hdl;
3096
3136 dev->v4l2_dev.ctrl_handler = hdl;
3137
3097 /* register i2c bus */
3098 retval = em28xx_i2c_register(dev);
3138 rt_mutex_init(&dev->i2c_bus_lock);
3139
3140 /* register i2c bus 0 */
3141 retval = em28xx_i2c_register(dev, 0);
3099 if (retval < 0) {
3142 if (retval < 0) {
3100 em28xx_errdev("%s: em28xx_i2c_register - error [%d]!\n",
3143 em28xx_errdev("%s: em28xx_i2c_register bus 0 - error [%d]!\n",
3101 __func__, retval);
3102 goto unregister_dev;
3103 }
3104
3144 __func__, retval);
3145 goto unregister_dev;
3146 }
3147
3148 if (dev->def_i2c_bus) {
3149 retval = em28xx_i2c_register(dev, 1);
3150 if (retval < 0) {
3151 em28xx_errdev("%s: em28xx_i2c_register bus 1 - error [%d]!\n",
3152 __func__, retval);
3153 goto unregister_dev;
3154 }
3155 }
3156
3105 /*
3106 * Default format, used for tvp5150 or saa711x output formats
3107 */
3108 dev->vinmode = 0x10;
3109 dev->vinctl = EM28XX_VINCTRL_INTERLACED |
3110 EM28XX_VINCTRL_CCIR656_ENABLE;
3111
3112 /* Do board specific init and eeprom reading */

--- 42 unchanged lines hidden (view full) ---

3155 em28xx_errdev("%s: em28xx_write_reg - "
3156 "msp34xx(2) failed! error [%d]\n",
3157 __func__, retval);
3158 goto fail;
3159 }
3160 msleep(3);
3161 }
3162
3157 /*
3158 * Default format, used for tvp5150 or saa711x output formats
3159 */
3160 dev->vinmode = 0x10;
3161 dev->vinctl = EM28XX_VINCTRL_INTERLACED |
3162 EM28XX_VINCTRL_CCIR656_ENABLE;
3163
3164 /* Do board specific init and eeprom reading */

--- 42 unchanged lines hidden (view full) ---

3207 em28xx_errdev("%s: em28xx_write_reg - "
3208 "msp34xx(2) failed! error [%d]\n",
3209 __func__, retval);
3210 goto fail;
3211 }
3212 msleep(3);
3213 }
3214
3163 v4l2_ctrl_handler_setup(&dev->ctrl_handler);
3164 retval = dev->ctrl_handler.error;
3165 if (retval)
3166 goto fail;
3167
3168 retval = em28xx_register_analog_devices(dev);
3169 if (retval < 0) {
3170 goto fail;
3171 }
3172
3173 /* Save some power by putting tuner to sleep */
3174 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
3175
3176 return 0;
3177
3178fail:
3215 retval = em28xx_register_analog_devices(dev);
3216 if (retval < 0) {
3217 goto fail;
3218 }
3219
3220 /* Save some power by putting tuner to sleep */
3221 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
3222
3223 return 0;
3224
3225fail:
3179 em28xx_i2c_unregister(dev);
3226 if (dev->def_i2c_bus)
3227 em28xx_i2c_unregister(dev, 1);
3228 em28xx_i2c_unregister(dev, 0);
3180 v4l2_ctrl_handler_free(&dev->ctrl_handler);
3181
3182unregister_dev:
3183 v4l2_device_unregister(&dev->v4l2_dev);
3184
3185 return retval;
3186}
3187

--- 371 unchanged lines hidden ---
3229 v4l2_ctrl_handler_free(&dev->ctrl_handler);
3230
3231unregister_dev:
3232 v4l2_device_unregister(&dev->v4l2_dev);
3233
3234 return retval;
3235}
3236

--- 371 unchanged lines hidden ---