pvrusb2-devattr.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. /*
  2. *
  3. * $Id$
  4. *
  5. * Copyright (C) 2007 Mike Isely <isely@pobox.com>
  6. *
  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
  10. *
  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. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. */
  21. /*
  22. This source file should encompass ALL per-device type information for the
  23. driver. To define a new device, add elements to the pvr2_device_table and
  24. pvr2_device_desc structures.
  25. */
  26. #include "pvrusb2-devattr.h"
  27. #include <linux/usb.h>
  28. /* This is needed in order to pull in tuner type ids... */
  29. #include <linux/i2c.h>
  30. #include <media/tuner.h>
  31. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  32. #include "pvrusb2-hdw-internal.h"
  33. #include "lgdt330x.h"
  34. #include "s5h1409.h"
  35. #include "s5h1411.h"
  36. #include "tda10048.h"
  37. #include "tda18271.h"
  38. #include "tda8290.h"
  39. #include "tuner-simple.h"
  40. #endif
  41. /*------------------------------------------------------------------------*/
  42. /* Hauppauge PVR-USB2 Model 29xxx */
  43. static const char *pvr2_client_29xxx[] = {
  44. "msp3400",
  45. "saa7115",
  46. "tuner",
  47. };
  48. static const char *pvr2_fw1_names_29xxx[] = {
  49. "v4l-pvrusb2-29xxx-01.fw",
  50. };
  51. static const struct pvr2_device_desc pvr2_device_29xxx = {
  52. .description = "WinTV PVR USB2 Model Category 29xxx",
  53. .shortname = "29xxx",
  54. .client_modules.lst = pvr2_client_29xxx,
  55. .client_modules.cnt = ARRAY_SIZE(pvr2_client_29xxx),
  56. .fx2_firmware.lst = pvr2_fw1_names_29xxx,
  57. .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_29xxx),
  58. .flag_has_hauppauge_rom = !0,
  59. .flag_has_analogtuner = !0,
  60. .flag_has_fmradio = !0,
  61. .flag_has_composite = !0,
  62. .flag_has_svideo = !0,
  63. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  64. .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
  65. };
  66. /*------------------------------------------------------------------------*/
  67. /* Hauppauge PVR-USB2 Model 24xxx */
  68. static const char *pvr2_client_24xxx[] = {
  69. "cx25840",
  70. "tuner",
  71. "wm8775",
  72. };
  73. static const char *pvr2_fw1_names_24xxx[] = {
  74. "v4l-pvrusb2-24xxx-01.fw",
  75. };
  76. static const struct pvr2_device_desc pvr2_device_24xxx = {
  77. .description = "WinTV PVR USB2 Model Category 24xxx",
  78. .shortname = "24xxx",
  79. .client_modules.lst = pvr2_client_24xxx,
  80. .client_modules.cnt = ARRAY_SIZE(pvr2_client_24xxx),
  81. .fx2_firmware.lst = pvr2_fw1_names_24xxx,
  82. .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_24xxx),
  83. .flag_has_cx25840 = !0,
  84. .flag_has_wm8775 = !0,
  85. .flag_has_hauppauge_rom = !0,
  86. .flag_has_hauppauge_custom_ir = !0,
  87. .flag_has_analogtuner = !0,
  88. .flag_has_fmradio = !0,
  89. .flag_has_composite = !0,
  90. .flag_has_svideo = !0,
  91. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  92. .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
  93. };
  94. /*------------------------------------------------------------------------*/
  95. /* GOTVIEW USB2.0 DVD2 */
  96. static const char *pvr2_client_gotview_2[] = {
  97. "cx25840",
  98. "tuner",
  99. };
  100. static const struct pvr2_device_desc pvr2_device_gotview_2 = {
  101. .description = "Gotview USB 2.0 DVD 2",
  102. .shortname = "gv2",
  103. .client_modules.lst = pvr2_client_gotview_2,
  104. .client_modules.cnt = ARRAY_SIZE(pvr2_client_gotview_2),
  105. .flag_has_cx25840 = !0,
  106. .default_tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
  107. .flag_has_analogtuner = !0,
  108. .flag_has_fmradio = !0,
  109. .flag_has_composite = !0,
  110. .flag_has_svideo = !0,
  111. .signal_routing_scheme = PVR2_ROUTING_SCHEME_GOTVIEW,
  112. };
  113. /*------------------------------------------------------------------------*/
  114. /* GOTVIEW USB2.0 DVD Deluxe */
  115. /* (same module list as gotview_2) */
  116. static const struct pvr2_device_desc pvr2_device_gotview_2d = {
  117. .description = "Gotview USB 2.0 DVD Deluxe",
  118. .shortname = "gv2d",
  119. .client_modules.lst = pvr2_client_gotview_2,
  120. .client_modules.cnt = ARRAY_SIZE(pvr2_client_gotview_2),
  121. .flag_has_cx25840 = !0,
  122. .default_tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
  123. .flag_has_analogtuner = !0,
  124. .flag_has_composite = !0,
  125. .flag_has_svideo = !0,
  126. .signal_routing_scheme = PVR2_ROUTING_SCHEME_GOTVIEW,
  127. };
  128. #ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_CREATOR
  129. /*------------------------------------------------------------------------*/
  130. /* OnAir Creator */
  131. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  132. static struct lgdt330x_config pvr2_lgdt3303_config = {
  133. .demod_address = 0x0e,
  134. .demod_chip = LGDT3303,
  135. .clock_polarity_flip = 1,
  136. };
  137. static int pvr2_lgdt3303_attach(struct pvr2_dvb_adapter *adap)
  138. {
  139. adap->fe = dvb_attach(lgdt330x_attach, &pvr2_lgdt3303_config,
  140. &adap->channel.hdw->i2c_adap);
  141. if (adap->fe)
  142. return 0;
  143. return -EIO;
  144. }
  145. static int pvr2_lgh06xf_attach(struct pvr2_dvb_adapter *adap)
  146. {
  147. dvb_attach(simple_tuner_attach, adap->fe,
  148. &adap->channel.hdw->i2c_adap, 0x61,
  149. TUNER_LG_TDVS_H06XF);
  150. return 0;
  151. }
  152. struct pvr2_dvb_props pvr2_onair_creator_fe_props = {
  153. .frontend_attach = pvr2_lgdt3303_attach,
  154. .tuner_attach = pvr2_lgh06xf_attach,
  155. };
  156. #endif
  157. static const char *pvr2_client_onair_creator[] = {
  158. "saa7115",
  159. "tuner",
  160. "cs53l32a",
  161. };
  162. static const struct pvr2_device_desc pvr2_device_onair_creator = {
  163. .description = "OnAir Creator Hybrid USB tuner",
  164. .shortname = "oac",
  165. .client_modules.lst = pvr2_client_onair_creator,
  166. .client_modules.cnt = ARRAY_SIZE(pvr2_client_onair_creator),
  167. .default_tuner_type = TUNER_LG_TDVS_H06XF,
  168. .flag_has_analogtuner = !0,
  169. .flag_has_composite = !0,
  170. .flag_has_svideo = !0,
  171. .flag_digital_requires_cx23416 = !0,
  172. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  173. .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR,
  174. .default_std_mask = V4L2_STD_NTSC_M,
  175. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  176. .dvb_props = &pvr2_onair_creator_fe_props,
  177. #endif
  178. };
  179. #endif
  180. #ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_USB2
  181. /*------------------------------------------------------------------------*/
  182. /* OnAir USB 2.0 */
  183. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  184. static struct lgdt330x_config pvr2_lgdt3302_config = {
  185. .demod_address = 0x0e,
  186. .demod_chip = LGDT3302,
  187. };
  188. static int pvr2_lgdt3302_attach(struct pvr2_dvb_adapter *adap)
  189. {
  190. adap->fe = dvb_attach(lgdt330x_attach, &pvr2_lgdt3302_config,
  191. &adap->channel.hdw->i2c_adap);
  192. if (adap->fe)
  193. return 0;
  194. return -EIO;
  195. }
  196. static int pvr2_fcv1236d_attach(struct pvr2_dvb_adapter *adap)
  197. {
  198. dvb_attach(simple_tuner_attach, adap->fe,
  199. &adap->channel.hdw->i2c_adap, 0x61,
  200. TUNER_PHILIPS_FCV1236D);
  201. return 0;
  202. }
  203. struct pvr2_dvb_props pvr2_onair_usb2_fe_props = {
  204. .frontend_attach = pvr2_lgdt3302_attach,
  205. .tuner_attach = pvr2_fcv1236d_attach,
  206. };
  207. #endif
  208. static const char *pvr2_client_onair_usb2[] = {
  209. "saa7115",
  210. "tuner",
  211. "cs53l32a",
  212. };
  213. static const struct pvr2_device_desc pvr2_device_onair_usb2 = {
  214. .description = "OnAir USB2 Hybrid USB tuner",
  215. .shortname = "oa2",
  216. .client_modules.lst = pvr2_client_onair_usb2,
  217. .client_modules.cnt = ARRAY_SIZE(pvr2_client_onair_usb2),
  218. .default_tuner_type = TUNER_PHILIPS_FCV1236D,
  219. .flag_has_analogtuner = !0,
  220. .flag_has_composite = !0,
  221. .flag_has_svideo = !0,
  222. .flag_digital_requires_cx23416 = !0,
  223. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  224. .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR,
  225. .default_std_mask = V4L2_STD_NTSC_M,
  226. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  227. .dvb_props = &pvr2_onair_usb2_fe_props,
  228. #endif
  229. };
  230. #endif
  231. /*------------------------------------------------------------------------*/
  232. /* Hauppauge PVR-USB2 Model 73xxx */
  233. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  234. static struct tda10048_config hauppauge_tda10048_config = {
  235. .demod_address = 0x10 >> 1,
  236. .output_mode = TDA10048_PARALLEL_OUTPUT,
  237. .fwbulkwritelen = TDA10048_BULKWRITE_50,
  238. .inversion = TDA10048_INVERSION_ON,
  239. };
  240. static struct tda829x_config tda829x_no_probe = {
  241. .probe_tuner = TDA829X_DONT_PROBE,
  242. };
  243. static struct tda18271_config hauppauge_tda18271_dvb_config = {
  244. .gate = TDA18271_GATE_ANALOG,
  245. };
  246. static int pvr2_tda10048_attach(struct pvr2_dvb_adapter *adap)
  247. {
  248. adap->fe = dvb_attach(tda10048_attach, &hauppauge_tda10048_config,
  249. &adap->channel.hdw->i2c_adap);
  250. if (adap->fe)
  251. return 0;
  252. return -EIO;
  253. }
  254. static int pvr2_73xxx_tda18271_8295_attach(struct pvr2_dvb_adapter *adap)
  255. {
  256. dvb_attach(tda829x_attach, adap->fe,
  257. &adap->channel.hdw->i2c_adap, 0x42,
  258. &tda829x_no_probe);
  259. dvb_attach(tda18271_attach, adap->fe, 0x60,
  260. &adap->channel.hdw->i2c_adap,
  261. &hauppauge_tda18271_dvb_config);
  262. return 0;
  263. }
  264. struct pvr2_dvb_props pvr2_73xxx_dvb_props = {
  265. .frontend_attach = pvr2_tda10048_attach,
  266. .tuner_attach = pvr2_73xxx_tda18271_8295_attach,
  267. };
  268. #endif
  269. static const char *pvr2_client_73xxx[] = {
  270. "cx25840",
  271. "tuner",
  272. };
  273. static const char *pvr2_fw1_names_73xxx[] = {
  274. "v4l-pvrusb2-73xxx-01.fw",
  275. };
  276. static const struct pvr2_device_desc pvr2_device_73xxx = {
  277. .description = "WinTV PVR USB2 Model Category 73xxx",
  278. .shortname = "73xxx",
  279. .client_modules.lst = pvr2_client_73xxx,
  280. .client_modules.cnt = ARRAY_SIZE(pvr2_client_73xxx),
  281. .fx2_firmware.lst = pvr2_fw1_names_73xxx,
  282. .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_73xxx),
  283. .flag_has_cx25840 = !0,
  284. .flag_has_hauppauge_rom = !0,
  285. .flag_has_analogtuner = !0,
  286. .flag_has_composite = !0,
  287. .flag_has_svideo = !0,
  288. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  289. .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
  290. .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
  291. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  292. .dvb_props = &pvr2_73xxx_dvb_props,
  293. #endif
  294. };
  295. /*------------------------------------------------------------------------*/
  296. /* Hauppauge PVR-USB2 Model 75xxx */
  297. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  298. static struct s5h1409_config pvr2_s5h1409_config = {
  299. .demod_address = 0x32 >> 1,
  300. .output_mode = S5H1409_PARALLEL_OUTPUT,
  301. .gpio = S5H1409_GPIO_OFF,
  302. .qam_if = 4000,
  303. .inversion = S5H1409_INVERSION_ON,
  304. .status_mode = S5H1409_DEMODLOCKING,
  305. };
  306. static struct s5h1411_config pvr2_s5h1411_config = {
  307. .output_mode = S5H1411_PARALLEL_OUTPUT,
  308. .gpio = S5H1411_GPIO_OFF,
  309. .vsb_if = S5H1411_IF_44000,
  310. .qam_if = S5H1411_IF_4000,
  311. .inversion = S5H1411_INVERSION_ON,
  312. .status_mode = S5H1411_DEMODLOCKING,
  313. };
  314. static struct tda18271_std_map hauppauge_tda18271_std_map = {
  315. .atsc_6 = { .if_freq = 5380, .agc_mode = 3, .std = 3,
  316. .if_lvl = 6, .rfagc_top = 0x37, },
  317. .qam_6 = { .if_freq = 4000, .agc_mode = 3, .std = 0,
  318. .if_lvl = 6, .rfagc_top = 0x37, },
  319. };
  320. static struct tda18271_config hauppauge_tda18271_config = {
  321. .std_map = &hauppauge_tda18271_std_map,
  322. .gate = TDA18271_GATE_ANALOG,
  323. };
  324. static int pvr2_s5h1409_attach(struct pvr2_dvb_adapter *adap)
  325. {
  326. adap->fe = dvb_attach(s5h1409_attach, &pvr2_s5h1409_config,
  327. &adap->channel.hdw->i2c_adap);
  328. if (adap->fe)
  329. return 0;
  330. return -EIO;
  331. }
  332. static int pvr2_s5h1411_attach(struct pvr2_dvb_adapter *adap)
  333. {
  334. adap->fe = dvb_attach(s5h1411_attach, &pvr2_s5h1411_config,
  335. &adap->channel.hdw->i2c_adap);
  336. if (adap->fe)
  337. return 0;
  338. return -EIO;
  339. }
  340. static int pvr2_tda18271_8295_attach(struct pvr2_dvb_adapter *adap)
  341. {
  342. dvb_attach(tda829x_attach, adap->fe,
  343. &adap->channel.hdw->i2c_adap, 0x42,
  344. &tda829x_no_probe);
  345. dvb_attach(tda18271_attach, adap->fe, 0x60,
  346. &adap->channel.hdw->i2c_adap,
  347. &hauppauge_tda18271_config);
  348. return 0;
  349. }
  350. struct pvr2_dvb_props pvr2_750xx_dvb_props = {
  351. .frontend_attach = pvr2_s5h1409_attach,
  352. .tuner_attach = pvr2_tda18271_8295_attach,
  353. };
  354. struct pvr2_dvb_props pvr2_751xx_dvb_props = {
  355. .frontend_attach = pvr2_s5h1411_attach,
  356. .tuner_attach = pvr2_tda18271_8295_attach,
  357. };
  358. #endif
  359. static const char *pvr2_client_75xxx[] = {
  360. "cx25840",
  361. "tuner",
  362. };
  363. static const char *pvr2_fw1_names_75xxx[] = {
  364. "v4l-pvrusb2-73xxx-01.fw",
  365. };
  366. static const struct pvr2_device_desc pvr2_device_750xx = {
  367. .description = "WinTV PVR USB2 Model Category 750xx",
  368. .shortname = "750xx",
  369. .client_modules.lst = pvr2_client_75xxx,
  370. .client_modules.cnt = ARRAY_SIZE(pvr2_client_75xxx),
  371. .fx2_firmware.lst = pvr2_fw1_names_75xxx,
  372. .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_75xxx),
  373. .flag_has_cx25840 = !0,
  374. .flag_has_hauppauge_rom = !0,
  375. .flag_has_analogtuner = !0,
  376. .flag_has_composite = !0,
  377. .flag_has_svideo = !0,
  378. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  379. .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
  380. .default_std_mask = V4L2_STD_NTSC_M,
  381. .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
  382. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  383. .dvb_props = &pvr2_750xx_dvb_props,
  384. #endif
  385. };
  386. static const struct pvr2_device_desc pvr2_device_751xx = {
  387. .description = "WinTV PVR USB2 Model Category 751xx",
  388. .shortname = "751xx",
  389. .client_modules.lst = pvr2_client_75xxx,
  390. .client_modules.cnt = ARRAY_SIZE(pvr2_client_75xxx),
  391. .fx2_firmware.lst = pvr2_fw1_names_75xxx,
  392. .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_75xxx),
  393. .flag_has_cx25840 = !0,
  394. .flag_has_hauppauge_rom = !0,
  395. .flag_has_analogtuner = !0,
  396. .flag_has_composite = !0,
  397. .flag_has_svideo = !0,
  398. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  399. .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
  400. .default_std_mask = V4L2_STD_NTSC_M,
  401. .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
  402. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  403. .dvb_props = &pvr2_751xx_dvb_props,
  404. #endif
  405. };
  406. /*------------------------------------------------------------------------*/
  407. struct usb_device_id pvr2_device_table[] = {
  408. { USB_DEVICE(0x2040, 0x2900),
  409. .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
  410. { USB_DEVICE(0x2040, 0x2400),
  411. .driver_info = (kernel_ulong_t)&pvr2_device_24xxx},
  412. { USB_DEVICE(0x1164, 0x0622),
  413. .driver_info = (kernel_ulong_t)&pvr2_device_gotview_2},
  414. { USB_DEVICE(0x1164, 0x0602),
  415. .driver_info = (kernel_ulong_t)&pvr2_device_gotview_2d},
  416. #ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_CREATOR
  417. { USB_DEVICE(0x11ba, 0x1003),
  418. .driver_info = (kernel_ulong_t)&pvr2_device_onair_creator},
  419. #endif
  420. #ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_USB2
  421. { USB_DEVICE(0x11ba, 0x1001),
  422. .driver_info = (kernel_ulong_t)&pvr2_device_onair_usb2},
  423. #endif
  424. { USB_DEVICE(0x2040, 0x7300),
  425. .driver_info = (kernel_ulong_t)&pvr2_device_73xxx},
  426. { USB_DEVICE(0x2040, 0x7500),
  427. .driver_info = (kernel_ulong_t)&pvr2_device_750xx},
  428. { USB_DEVICE(0x2040, 0x7501),
  429. .driver_info = (kernel_ulong_t)&pvr2_device_751xx},
  430. { }
  431. };
  432. MODULE_DEVICE_TABLE(usb, pvr2_device_table);
  433. /*
  434. Stuff for Emacs to see, in order to encourage consistent editing style:
  435. *** Local Variables: ***
  436. *** mode: c ***
  437. *** fill-column: 75 ***
  438. *** tab-width: 8 ***
  439. *** c-basic-offset: 8 ***
  440. *** End: ***
  441. */