em28xx-cards.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. /*
  2. em28xx-cards.c - driver for Empia EM2800/EM2820/2840 USB video capture devices
  3. Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
  4. Markus Rechberger <mrechberger@gmail.com>
  5. Mauro Carvalho Chehab <mchehab@infradead.org>
  6. Sascha Sommer <saschasommer@freenet.de>
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19. #include <linux/init.h>
  20. #include <linux/module.h>
  21. #include <linux/delay.h>
  22. #include <linux/i2c.h>
  23. #include <linux/usb.h>
  24. #include <media/tuner.h>
  25. #include <media/msp3400.h>
  26. #include <media/saa7115.h>
  27. #include <media/tvp5150.h>
  28. #include <media/tveeprom.h>
  29. #include <media/audiochip.h>
  30. #include <media/v4l2-common.h>
  31. #include "em28xx.h"
  32. #include "tuner-xc2028.h"
  33. static int tuner = -1;
  34. module_param(tuner, int, 0444);
  35. MODULE_PARM_DESC(tuner, "tuner type");
  36. struct em28xx_hash_table {
  37. unsigned long hash;
  38. unsigned int model;
  39. unsigned int tuner;
  40. };
  41. struct em28xx_board em28xx_boards[] = {
  42. [EM2800_BOARD_UNKNOWN] = {
  43. .name = "Unknown EM2800 video grabber",
  44. .is_em2800 = 1,
  45. .vchannels = 2,
  46. .norm = VIDEO_MODE_PAL,
  47. .tda9887_conf = TDA9887_PRESENT,
  48. .has_tuner = 1,
  49. .decoder = EM28XX_SAA7113,
  50. .input = {{
  51. .type = EM28XX_VMUX_COMPOSITE1,
  52. .vmux = SAA7115_COMPOSITE0,
  53. .amux = 1,
  54. },{
  55. .type = EM28XX_VMUX_SVIDEO,
  56. .vmux = SAA7115_SVIDEO3,
  57. .amux = 1,
  58. }},
  59. },
  60. [EM2820_BOARD_UNKNOWN] = {
  61. .name = "Unknown EM2750/28xx video grabber",
  62. .is_em2800 = 0,
  63. },
  64. [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
  65. .name = "Kworld PVR TV 2800 RF",
  66. .is_em2800 = 0,
  67. .vchannels = 2,
  68. .norm = VIDEO_MODE_PAL,
  69. .tda9887_conf = TDA9887_PRESENT,
  70. .has_tuner = 1,
  71. .decoder = EM28XX_SAA7113,
  72. .input = {{
  73. .type = EM28XX_VMUX_COMPOSITE1,
  74. .vmux = SAA7115_COMPOSITE0,
  75. .amux = 1,
  76. },{
  77. .type = EM28XX_VMUX_SVIDEO,
  78. .vmux = SAA7115_SVIDEO3,
  79. .amux = 1,
  80. }},
  81. },
  82. [EM2820_BOARD_TERRATEC_CINERGY_250] = {
  83. .name = "Terratec Cinergy 250 USB",
  84. .vchannels = 3,
  85. .norm = VIDEO_MODE_PAL,
  86. .tuner_type = TUNER_LG_PAL_NEW_TAPC,
  87. .tda9887_conf = TDA9887_PRESENT,
  88. .has_tuner = 1,
  89. .decoder = EM28XX_SAA7113,
  90. .input = {{
  91. .type = EM28XX_VMUX_TELEVISION,
  92. .vmux = SAA7115_COMPOSITE2,
  93. .amux = 1,
  94. },{
  95. .type = EM28XX_VMUX_COMPOSITE1,
  96. .vmux = SAA7115_COMPOSITE0,
  97. .amux = 1,
  98. },{
  99. .type = EM28XX_VMUX_SVIDEO,
  100. .vmux = SAA7115_SVIDEO3,
  101. .amux = 1,
  102. }},
  103. },
  104. [EM2820_BOARD_PINNACLE_USB_2] = {
  105. .name = "Pinnacle PCTV USB 2",
  106. .vchannels = 3,
  107. .norm = VIDEO_MODE_PAL,
  108. .tuner_type = TUNER_LG_PAL_NEW_TAPC,
  109. .tda9887_conf = TDA9887_PRESENT,
  110. .has_tuner = 1,
  111. .decoder = EM28XX_SAA7113,
  112. .input = {{
  113. .type = EM28XX_VMUX_TELEVISION,
  114. .vmux = SAA7115_COMPOSITE2,
  115. .amux = 0,
  116. },{
  117. .type = EM28XX_VMUX_COMPOSITE1,
  118. .vmux = SAA7115_COMPOSITE0,
  119. .amux = 1,
  120. },{
  121. .type = EM28XX_VMUX_SVIDEO,
  122. .vmux = SAA7115_SVIDEO3,
  123. .amux = 1,
  124. }},
  125. },
  126. [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
  127. .name = "Hauppauge WinTV USB 2",
  128. .vchannels = 3,
  129. .norm = VIDEO_MODE_NTSC,
  130. .tuner_type = TUNER_PHILIPS_FM1236_MK3,
  131. .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
  132. .has_tuner = 1,
  133. .decoder = EM28XX_TVP5150,
  134. .has_msp34xx = 1,
  135. /*FIXME: S-Video not tested */
  136. .input = {{
  137. .type = EM28XX_VMUX_TELEVISION,
  138. .vmux = TVP5150_COMPOSITE0,
  139. .amux = MSP_INPUT_DEFAULT,
  140. },{
  141. .type = EM28XX_VMUX_SVIDEO,
  142. .vmux = TVP5150_SVIDEO,
  143. .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
  144. MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
  145. }},
  146. },
  147. [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
  148. .name = "Hauppauge WinTV HVR 900/950",
  149. .vchannels = 3,
  150. .norm = VIDEO_MODE_PAL,
  151. .tda9887_conf = TDA9887_PRESENT,
  152. .tuner_type = TUNER_XC2028,
  153. .has_tuner = 1,
  154. .decoder = EM28XX_TVP5150,
  155. .input = {{
  156. .type = EM28XX_VMUX_TELEVISION,
  157. .vmux = TVP5150_COMPOSITE0,
  158. .amux = 0,
  159. },{
  160. .type = EM28XX_VMUX_COMPOSITE1,
  161. .vmux = TVP5150_COMPOSITE1,
  162. .amux = 1,
  163. },{
  164. .type = EM28XX_VMUX_SVIDEO,
  165. .vmux = TVP5150_SVIDEO,
  166. .amux = 1,
  167. }},
  168. },
  169. [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
  170. .name = "Terratec Hybrid XS",
  171. .vchannels = 3,
  172. .norm = VIDEO_MODE_PAL,
  173. .tda9887_conf = TDA9887_PRESENT,
  174. .has_tuner = 1,
  175. .tuner_type = TUNER_XC2028,
  176. .decoder = EM28XX_TVP5150,
  177. .input = {{
  178. .type = EM28XX_VMUX_TELEVISION,
  179. .vmux = TVP5150_COMPOSITE0,
  180. .amux = 0,
  181. },{
  182. .type = EM28XX_VMUX_COMPOSITE1,
  183. .vmux = TVP5150_COMPOSITE1,
  184. .amux = 1,
  185. },{
  186. .type = EM28XX_VMUX_SVIDEO,
  187. .vmux = TVP5150_SVIDEO,
  188. .amux = 1,
  189. }},
  190. },
  191. /* maybe there's a reason behind it why Terratec sells the Hybrid XS as Prodigy XS with a
  192. * different PID, let's keep it separated for now maybe we'll need it lateron */
  193. [EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
  194. .name = "Terratec Prodigy XS",
  195. .vchannels = 3,
  196. .norm = VIDEO_MODE_PAL,
  197. .tda9887_conf = TDA9887_PRESENT,
  198. .has_tuner = 1,
  199. .tuner_type = TUNER_XC2028,
  200. .decoder = EM28XX_TVP5150,
  201. .input = {{
  202. .type = EM28XX_VMUX_TELEVISION,
  203. .vmux = TVP5150_COMPOSITE0,
  204. .amux = 0,
  205. },{
  206. .type = EM28XX_VMUX_COMPOSITE1,
  207. .vmux = TVP5150_COMPOSITE1,
  208. .amux = 1,
  209. },{
  210. .type = EM28XX_VMUX_SVIDEO,
  211. .vmux = TVP5150_SVIDEO,
  212. .amux = 1,
  213. }},
  214. },
  215. [EM2820_BOARD_MSI_VOX_USB_2] = {
  216. .name = "MSI VOX USB 2.0",
  217. .vchannels = 3,
  218. .norm = VIDEO_MODE_PAL,
  219. .tuner_type = TUNER_LG_PAL_NEW_TAPC,
  220. .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
  221. .has_tuner = 1,
  222. .decoder = EM28XX_SAA7114,
  223. .input = {{
  224. .type = EM28XX_VMUX_TELEVISION,
  225. .vmux = SAA7115_COMPOSITE4,
  226. .amux = 0,
  227. },{
  228. .type = EM28XX_VMUX_COMPOSITE1,
  229. .vmux = SAA7115_COMPOSITE0,
  230. .amux = 1,
  231. },{
  232. .type = EM28XX_VMUX_SVIDEO,
  233. .vmux = SAA7115_SVIDEO3,
  234. .amux = 1,
  235. }},
  236. },
  237. [EM2800_BOARD_TERRATEC_CINERGY_200] = {
  238. .name = "Terratec Cinergy 200 USB",
  239. .is_em2800 = 1,
  240. .vchannels = 3,
  241. .norm = VIDEO_MODE_PAL,
  242. .tuner_type = TUNER_LG_PAL_NEW_TAPC,
  243. .tda9887_conf = TDA9887_PRESENT,
  244. .has_tuner = 1,
  245. .decoder = EM28XX_SAA7113,
  246. .input = {{
  247. .type = EM28XX_VMUX_TELEVISION,
  248. .vmux = SAA7115_COMPOSITE2,
  249. .amux = 0,
  250. },{
  251. .type = EM28XX_VMUX_COMPOSITE1,
  252. .vmux = SAA7115_COMPOSITE0,
  253. .amux = 1,
  254. },{
  255. .type = EM28XX_VMUX_SVIDEO,
  256. .vmux = SAA7115_SVIDEO3,
  257. .amux = 1,
  258. }},
  259. },
  260. [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
  261. .name = "Leadtek Winfast USB II",
  262. .is_em2800 = 1,
  263. .vchannels = 3,
  264. .norm = VIDEO_MODE_PAL,
  265. .tuner_type = TUNER_LG_PAL_NEW_TAPC,
  266. .tda9887_conf = TDA9887_PRESENT,
  267. .has_tuner = 1,
  268. .decoder = EM28XX_SAA7113,
  269. .input = {{
  270. .type = EM28XX_VMUX_TELEVISION,
  271. .vmux = SAA7115_COMPOSITE2,
  272. .amux = 0,
  273. },{
  274. .type = EM28XX_VMUX_COMPOSITE1,
  275. .vmux = SAA7115_COMPOSITE0,
  276. .amux = 1,
  277. },{
  278. .type = EM28XX_VMUX_SVIDEO,
  279. .vmux = SAA7115_SVIDEO3,
  280. .amux = 1,
  281. }},
  282. },
  283. [EM2800_BOARD_KWORLD_USB2800] = {
  284. .name = "Kworld USB2800",
  285. .is_em2800 = 1,
  286. .vchannels = 3,
  287. .norm = VIDEO_MODE_PAL,
  288. .tuner_type = TUNER_PHILIPS_ATSC,
  289. .tda9887_conf = TDA9887_PRESENT,
  290. .has_tuner = 1,
  291. .decoder = EM28XX_SAA7113,
  292. .input = {{
  293. .type = EM28XX_VMUX_TELEVISION,
  294. .vmux = SAA7115_COMPOSITE2,
  295. .amux = 0,
  296. },{
  297. .type = EM28XX_VMUX_COMPOSITE1,
  298. .vmux = SAA7115_COMPOSITE0,
  299. .amux = 1,
  300. },{
  301. .type = EM28XX_VMUX_SVIDEO,
  302. .vmux = SAA7115_SVIDEO3,
  303. .amux = 1,
  304. }},
  305. },
  306. [EM2820_BOARD_PINNACLE_DVC_90] = {
  307. .name = "Pinnacle Dazzle DVC 90",
  308. .vchannels = 3,
  309. .norm = VIDEO_MODE_PAL,
  310. .has_tuner = 0,
  311. .decoder = EM28XX_SAA7113,
  312. .input = {{
  313. .type = EM28XX_VMUX_COMPOSITE1,
  314. .vmux = SAA7115_COMPOSITE0,
  315. .amux = 1,
  316. },{
  317. .type = EM28XX_VMUX_SVIDEO,
  318. .vmux = SAA7115_SVIDEO3,
  319. .amux = 1,
  320. }},
  321. },
  322. [EM2800_BOARD_VGEAR_POCKETTV] = {
  323. .name = "V-Gear PocketTV",
  324. .is_em2800 = 1,
  325. .vchannels = 3,
  326. .norm = VIDEO_MODE_PAL,
  327. .tuner_type = TUNER_LG_PAL_NEW_TAPC,
  328. .tda9887_conf = TDA9887_PRESENT,
  329. .has_tuner = 1,
  330. .decoder = EM28XX_SAA7113,
  331. .input = {{
  332. .type = EM28XX_VMUX_TELEVISION,
  333. .vmux = SAA7115_COMPOSITE2,
  334. .amux = 0,
  335. },{
  336. .type = EM28XX_VMUX_COMPOSITE1,
  337. .vmux = SAA7115_COMPOSITE0,
  338. .amux = 1,
  339. },{
  340. .type = EM28XX_VMUX_SVIDEO,
  341. .vmux = SAA7115_SVIDEO3,
  342. .amux = 1,
  343. }},
  344. },
  345. [EM2820_BOARD_PROLINK_PLAYTV_USB2] = {
  346. .name = "Pixelview Prolink PlayTV USB 2.0",
  347. .vchannels = 3,
  348. .tda9887_conf = TDA9887_PRESENT,
  349. .has_tuner = 1,
  350. .decoder = EM28XX_SAA7113,
  351. .input = {{
  352. .type = EM28XX_VMUX_TELEVISION,
  353. .vmux = SAA7115_COMPOSITE2,
  354. .amux = 1,
  355. },{
  356. .type = EM28XX_VMUX_COMPOSITE1,
  357. .vmux = SAA7115_COMPOSITE0,
  358. .amux = 1,
  359. },{
  360. .type = EM28XX_VMUX_SVIDEO,
  361. .vmux = SAA7115_SVIDEO3,
  362. .amux = 1,
  363. }},
  364. },
  365. };
  366. const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
  367. /* table of devices that work with this driver */
  368. struct usb_device_id em28xx_id_table [] = {
  369. { USB_DEVICE(0xeb1a, 0x2750), .driver_info = EM2820_BOARD_UNKNOWN },
  370. { USB_DEVICE(0xeb1a, 0x2800), .driver_info = EM2800_BOARD_UNKNOWN },
  371. { USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_UNKNOWN },
  372. { USB_DEVICE(0xeb1a, 0x2821), .driver_info = EM2820_BOARD_UNKNOWN },
  373. { USB_DEVICE(0xeb1a, 0x2860), .driver_info = EM2820_BOARD_UNKNOWN },
  374. { USB_DEVICE(0xeb1a, 0x2861), .driver_info = EM2820_BOARD_UNKNOWN },
  375. { USB_DEVICE(0xeb1a, 0x2870), .driver_info = EM2820_BOARD_UNKNOWN },
  376. { USB_DEVICE(0xeb1a, 0x2881), .driver_info = EM2820_BOARD_UNKNOWN },
  377. { USB_DEVICE(0xeb1a, 0x2883), .driver_info = EM2820_BOARD_UNKNOWN },
  378. { USB_DEVICE(0x0ccd, 0x0036), .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
  379. { USB_DEVICE(0x2304, 0x0208), .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
  380. { USB_DEVICE(0x2040, 0x4200), .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
  381. { USB_DEVICE(0x2304, 0x0207), .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
  382. { USB_DEVICE(0x2040, 0x6500), .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
  383. { USB_DEVICE(0x2040, 0x6513), .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
  384. { USB_DEVICE(0x0ccd, 0x0042), .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS },
  385. { USB_DEVICE(0x0ccd, 0x0047), .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
  386. { },
  387. };
  388. MODULE_DEVICE_TABLE (usb, em28xx_id_table);
  389. static struct em28xx_hash_table em28xx_hash [] = {
  390. /* P/N: SA 60002070465 Tuner: TVF7533-MF */
  391. { 0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF },
  392. };
  393. static struct em28xx_hash_table em28xx_i2c_hash[] = {
  394. { 0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC },
  395. { 0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC },
  396. };
  397. /* Since em28xx_pre_card_setup() requires a proper dev->model,
  398. * this won't work for boards with generic PCI IDs
  399. */
  400. void em28xx_pre_card_setup(struct em28xx *dev)
  401. {
  402. /* request some modules */
  403. switch(dev->model){
  404. case EM2880_BOARD_TERRATEC_PRODIGY_XS:
  405. case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
  406. case EM2880_BOARD_TERRATEC_HYBRID_XS:
  407. /* reset through GPIO? */
  408. em28xx_write_regs_req(dev, 0x00, 0x08, "\x7d", 1);
  409. break;
  410. }
  411. }
  412. static int em28xx_tuner_callback(void *ptr, int command, int arg)
  413. {
  414. int rc = 0;
  415. struct em28xx *dev = ptr;
  416. if (dev->tuner_type != TUNER_XC2028)
  417. return 0;
  418. switch (command) {
  419. case XC2028_TUNER_RESET:
  420. /* FIXME: This is device-dependent */
  421. dev->em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1);
  422. dev->em28xx_write_regs_req(dev, 0x00, 0x12, "\x67", 1);
  423. msleep(140);
  424. break;
  425. }
  426. return rc;
  427. }
  428. static void em28xx_config_tuner (struct em28xx *dev)
  429. {
  430. struct v4l2_priv_tun_config xc2028_cfg;
  431. struct xc2028_ctrl ctl;
  432. struct tuner_setup tun_setup;
  433. struct v4l2_frequency f;
  434. if (!dev->has_tuner)
  435. return;
  436. tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
  437. tun_setup.type = dev->tuner_type;
  438. tun_setup.addr = dev->tuner_addr;
  439. tun_setup.tuner_callback = em28xx_tuner_callback;
  440. em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
  441. if (dev->tuner_type == TUNER_XC2028) {
  442. memset (&ctl, 0, sizeof(ctl));
  443. ctl.fname = XC2028_DEFAULT_FIRMWARE;
  444. ctl.max_len = 64;
  445. xc2028_cfg.tuner = TUNER_XC2028;
  446. xc2028_cfg.priv = &ctl;
  447. em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg);
  448. }
  449. /* configure tuner */
  450. f.tuner = 0;
  451. f.type = V4L2_TUNER_ANALOG_TV;
  452. f.frequency = 9076; /* just a magic number */
  453. dev->ctl_freq = f.frequency;
  454. em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f);
  455. }
  456. static int em28xx_hint_board(struct em28xx *dev)
  457. {
  458. int i;
  459. for (i = 0; i < ARRAY_SIZE(em28xx_hash); i++) {
  460. if (dev->hash == em28xx_hash[i].hash) {
  461. dev->model = em28xx_hash[i].model;
  462. dev->tuner_type = em28xx_hash[i].tuner;
  463. em28xx_errdev("Your board has no unique USB ID.\n");
  464. em28xx_errdev("A hint were successfully done, "
  465. "based on eeprom hash.\n");
  466. em28xx_errdev("This method is not 100%% failproof.\n");
  467. em28xx_errdev("If the board were missdetected, "
  468. "please email this log to:\n");
  469. em28xx_errdev("\tV4L Mailing List "
  470. " <video4linux-list@redhat.com>\n");
  471. em28xx_errdev("Board detected as %s\n",
  472. em28xx_boards[dev->model].name);
  473. return 0;
  474. }
  475. }
  476. /* user did not request i2c scanning => do it now */
  477. if (!dev->i2c_hash)
  478. em28xx_do_i2c_scan(dev);
  479. for (i = 0; i < ARRAY_SIZE(em28xx_i2c_hash); i++) {
  480. if (dev->i2c_hash == em28xx_i2c_hash[i].hash) {
  481. dev->model = em28xx_i2c_hash[i].model;
  482. dev->tuner_type = em28xx_i2c_hash[i].tuner;
  483. em28xx_errdev("Your board has no unique USB ID.\n");
  484. em28xx_errdev("A hint were successfully done, "
  485. "based on i2c devicelist hash.\n");
  486. em28xx_errdev("This method is not 100%% failproof.\n");
  487. em28xx_errdev("If the board were missdetected, "
  488. "please email this log to:\n");
  489. em28xx_errdev("\tV4L Mailing List "
  490. " <video4linux-list@redhat.com>\n");
  491. em28xx_errdev("Board detected as %s\n",
  492. em28xx_boards[dev->model].name);
  493. return 0;
  494. }
  495. }
  496. em28xx_errdev("Your board has no unique USB ID and thus need a "
  497. "hint to be detected.\n");
  498. em28xx_errdev("You may try to use card=<n> insmod option to "
  499. "workaround that.\n");
  500. em28xx_errdev("Please send an email with this log to:\n");
  501. em28xx_errdev("\tV4L Mailing List <video4linux-list@redhat.com>\n");
  502. em28xx_errdev("Board eeprom hash is 0x%08lx\n", dev->hash);
  503. em28xx_errdev("Board i2c devicelist hash is 0x%08lx\n", dev->i2c_hash);
  504. em28xx_errdev("Here is a list of valid choices for the card=<n>"
  505. " insmod option:\n");
  506. for (i = 0; i < em28xx_bcount; i++) {
  507. em28xx_errdev(" card=%d -> %s\n",
  508. i, em28xx_boards[i].name);
  509. }
  510. return -1;
  511. }
  512. void em28xx_card_setup(struct em28xx *dev)
  513. {
  514. /* request some modules */
  515. switch (dev->model) {
  516. case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
  517. {
  518. struct tveeprom tv;
  519. #ifdef CONFIG_MODULES
  520. request_module("tveeprom");
  521. request_module("ir-kbd-i2c");
  522. #endif
  523. /* Call first TVeeprom */
  524. dev->i2c_client.addr = 0xa0 >> 1;
  525. tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
  526. dev->tuner_type = tv.tuner_type;
  527. if (tv.audio_processor == AUDIO_CHIP_MSP34XX) {
  528. dev->i2s_speed = 2048000;
  529. dev->has_msp34xx = 1;
  530. }
  531. break;
  532. }
  533. case EM2820_BOARD_KWORLD_PVRTV2800RF:
  534. /* GPIO enables sound on KWORLD PVR TV 2800RF */
  535. em28xx_write_regs_req(dev, 0x00, 0x08, "\xf9", 1);
  536. break;
  537. case EM2820_BOARD_UNKNOWN:
  538. case EM2800_BOARD_UNKNOWN:
  539. em28xx_hint_board(dev);
  540. }
  541. dev->is_em2800 = em28xx_boards[dev->model].is_em2800;
  542. dev->has_tuner = em28xx_boards[dev->model].has_tuner;
  543. dev->has_msp34xx = em28xx_boards[dev->model].has_msp34xx;
  544. dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf;
  545. dev->decoder = em28xx_boards[dev->model].decoder;
  546. dev->video_inputs = em28xx_boards[dev->model].vchannels;
  547. if (tuner >= 0)
  548. dev->tuner_type = tuner;
  549. #ifdef CONFIG_MODULES
  550. /* request some modules */
  551. if (dev->has_msp34xx)
  552. request_module("msp3400");
  553. if (dev->decoder == EM28XX_SAA7113 || dev->decoder == EM28XX_SAA7114)
  554. request_module("saa7115");
  555. if (dev->decoder == EM28XX_TVP5150)
  556. request_module("tvp5150");
  557. if (dev->has_tuner)
  558. request_module("tuner");
  559. #endif
  560. em28xx_config_tuner (dev);
  561. }