pvrusb2-devattr.c 15 KB

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