pvrusb2-devattr.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  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. /*------------------------------------------------------------------------*/
  129. /* OnAir Creator */
  130. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  131. static struct lgdt330x_config pvr2_lgdt3303_config = {
  132. .demod_address = 0x0e,
  133. .demod_chip = LGDT3303,
  134. .clock_polarity_flip = 1,
  135. };
  136. static int pvr2_lgdt3303_attach(struct pvr2_dvb_adapter *adap)
  137. {
  138. adap->fe = dvb_attach(lgdt330x_attach, &pvr2_lgdt3303_config,
  139. &adap->channel.hdw->i2c_adap);
  140. if (adap->fe)
  141. return 0;
  142. return -EIO;
  143. }
  144. static int pvr2_lgh06xf_attach(struct pvr2_dvb_adapter *adap)
  145. {
  146. dvb_attach(simple_tuner_attach, adap->fe,
  147. &adap->channel.hdw->i2c_adap, 0x61,
  148. TUNER_LG_TDVS_H06XF);
  149. return 0;
  150. }
  151. static struct pvr2_dvb_props pvr2_onair_creator_fe_props = {
  152. .frontend_attach = pvr2_lgdt3303_attach,
  153. .tuner_attach = pvr2_lgh06xf_attach,
  154. };
  155. #endif
  156. static const char *pvr2_client_onair_creator[] = {
  157. "saa7115",
  158. "tuner",
  159. "cs53l32a",
  160. };
  161. static const struct pvr2_device_desc pvr2_device_onair_creator = {
  162. .description = "OnAir Creator Hybrid USB tuner",
  163. .shortname = "oac",
  164. .client_modules.lst = pvr2_client_onair_creator,
  165. .client_modules.cnt = ARRAY_SIZE(pvr2_client_onair_creator),
  166. .default_tuner_type = TUNER_LG_TDVS_H06XF,
  167. .flag_has_analogtuner = !0,
  168. .flag_has_composite = !0,
  169. .flag_has_svideo = !0,
  170. .flag_digital_requires_cx23416 = !0,
  171. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  172. .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR,
  173. .default_std_mask = V4L2_STD_NTSC_M,
  174. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  175. .dvb_props = &pvr2_onair_creator_fe_props,
  176. #endif
  177. };
  178. /*------------------------------------------------------------------------*/
  179. /* OnAir USB 2.0 */
  180. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  181. static struct lgdt330x_config pvr2_lgdt3302_config = {
  182. .demod_address = 0x0e,
  183. .demod_chip = LGDT3302,
  184. };
  185. static int pvr2_lgdt3302_attach(struct pvr2_dvb_adapter *adap)
  186. {
  187. adap->fe = dvb_attach(lgdt330x_attach, &pvr2_lgdt3302_config,
  188. &adap->channel.hdw->i2c_adap);
  189. if (adap->fe)
  190. return 0;
  191. return -EIO;
  192. }
  193. static int pvr2_fcv1236d_attach(struct pvr2_dvb_adapter *adap)
  194. {
  195. dvb_attach(simple_tuner_attach, adap->fe,
  196. &adap->channel.hdw->i2c_adap, 0x61,
  197. TUNER_PHILIPS_FCV1236D);
  198. return 0;
  199. }
  200. static struct pvr2_dvb_props pvr2_onair_usb2_fe_props = {
  201. .frontend_attach = pvr2_lgdt3302_attach,
  202. .tuner_attach = pvr2_fcv1236d_attach,
  203. };
  204. #endif
  205. static const char *pvr2_client_onair_usb2[] = {
  206. "saa7115",
  207. "tuner",
  208. "cs53l32a",
  209. };
  210. static const struct pvr2_device_desc pvr2_device_onair_usb2 = {
  211. .description = "OnAir USB2 Hybrid USB tuner",
  212. .shortname = "oa2",
  213. .client_modules.lst = pvr2_client_onair_usb2,
  214. .client_modules.cnt = ARRAY_SIZE(pvr2_client_onair_usb2),
  215. .default_tuner_type = TUNER_PHILIPS_FCV1236D,
  216. .flag_has_analogtuner = !0,
  217. .flag_has_composite = !0,
  218. .flag_has_svideo = !0,
  219. .flag_digital_requires_cx23416 = !0,
  220. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  221. .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR,
  222. .default_std_mask = V4L2_STD_NTSC_M,
  223. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  224. .dvb_props = &pvr2_onair_usb2_fe_props,
  225. #endif
  226. };
  227. /*------------------------------------------------------------------------*/
  228. /* Hauppauge PVR-USB2 Model 73xxx */
  229. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  230. static struct tda10048_config hauppauge_tda10048_config = {
  231. .demod_address = 0x10 >> 1,
  232. .output_mode = TDA10048_PARALLEL_OUTPUT,
  233. .fwbulkwritelen = TDA10048_BULKWRITE_50,
  234. .inversion = TDA10048_INVERSION_ON,
  235. };
  236. static struct tda829x_config tda829x_no_probe = {
  237. .probe_tuner = TDA829X_DONT_PROBE,
  238. };
  239. static struct tda18271_config hauppauge_tda18271_dvb_config = {
  240. .gate = TDA18271_GATE_ANALOG,
  241. };
  242. static int pvr2_tda10048_attach(struct pvr2_dvb_adapter *adap)
  243. {
  244. adap->fe = dvb_attach(tda10048_attach, &hauppauge_tda10048_config,
  245. &adap->channel.hdw->i2c_adap);
  246. if (adap->fe)
  247. return 0;
  248. return -EIO;
  249. }
  250. static int pvr2_73xxx_tda18271_8295_attach(struct pvr2_dvb_adapter *adap)
  251. {
  252. dvb_attach(tda829x_attach, adap->fe,
  253. &adap->channel.hdw->i2c_adap, 0x42,
  254. &tda829x_no_probe);
  255. dvb_attach(tda18271_attach, adap->fe, 0x60,
  256. &adap->channel.hdw->i2c_adap,
  257. &hauppauge_tda18271_dvb_config);
  258. return 0;
  259. }
  260. static struct pvr2_dvb_props pvr2_73xxx_dvb_props = {
  261. .frontend_attach = pvr2_tda10048_attach,
  262. .tuner_attach = pvr2_73xxx_tda18271_8295_attach,
  263. };
  264. #endif
  265. static const char *pvr2_client_73xxx[] = {
  266. "cx25840",
  267. "tuner",
  268. };
  269. static const char *pvr2_fw1_names_73xxx[] = {
  270. "v4l-pvrusb2-73xxx-01.fw",
  271. };
  272. static const struct pvr2_device_desc pvr2_device_73xxx = {
  273. .description = "WinTV PVR USB2 Model Category 73xxx",
  274. .shortname = "73xxx",
  275. .client_modules.lst = pvr2_client_73xxx,
  276. .client_modules.cnt = ARRAY_SIZE(pvr2_client_73xxx),
  277. .fx2_firmware.lst = pvr2_fw1_names_73xxx,
  278. .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_73xxx),
  279. .flag_has_cx25840 = !0,
  280. .flag_has_hauppauge_rom = !0,
  281. .flag_has_analogtuner = !0,
  282. .flag_has_composite = !0,
  283. .flag_has_svideo = !0,
  284. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  285. .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
  286. .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
  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 PVR USB2 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. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  379. .dvb_props = &pvr2_750xx_dvb_props,
  380. #endif
  381. };
  382. static const struct pvr2_device_desc pvr2_device_751xx = {
  383. .description = "WinTV PVR USB2 Model Category 751xx",
  384. .shortname = "751xx",
  385. .client_modules.lst = pvr2_client_75xxx,
  386. .client_modules.cnt = ARRAY_SIZE(pvr2_client_75xxx),
  387. .fx2_firmware.lst = pvr2_fw1_names_75xxx,
  388. .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_75xxx),
  389. .flag_has_cx25840 = !0,
  390. .flag_has_hauppauge_rom = !0,
  391. .flag_has_analogtuner = !0,
  392. .flag_has_composite = !0,
  393. .flag_has_svideo = !0,
  394. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  395. .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
  396. .default_std_mask = V4L2_STD_NTSC_M,
  397. .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
  398. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  399. .dvb_props = &pvr2_751xx_dvb_props,
  400. #endif
  401. };
  402. /*------------------------------------------------------------------------*/
  403. struct usb_device_id pvr2_device_table[] = {
  404. { USB_DEVICE(0x2040, 0x2900),
  405. .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
  406. { USB_DEVICE(0x2040, 0x2400),
  407. .driver_info = (kernel_ulong_t)&pvr2_device_24xxx},
  408. { USB_DEVICE(0x1164, 0x0622),
  409. .driver_info = (kernel_ulong_t)&pvr2_device_gotview_2},
  410. { USB_DEVICE(0x1164, 0x0602),
  411. .driver_info = (kernel_ulong_t)&pvr2_device_gotview_2d},
  412. { USB_DEVICE(0x11ba, 0x1003),
  413. .driver_info = (kernel_ulong_t)&pvr2_device_onair_creator},
  414. { USB_DEVICE(0x11ba, 0x1001),
  415. .driver_info = (kernel_ulong_t)&pvr2_device_onair_usb2},
  416. { USB_DEVICE(0x2040, 0x7300),
  417. .driver_info = (kernel_ulong_t)&pvr2_device_73xxx},
  418. { USB_DEVICE(0x2040, 0x7500),
  419. .driver_info = (kernel_ulong_t)&pvr2_device_750xx},
  420. { USB_DEVICE(0x2040, 0x7501),
  421. .driver_info = (kernel_ulong_t)&pvr2_device_751xx},
  422. { }
  423. };
  424. MODULE_DEVICE_TABLE(usb, pvr2_device_table);
  425. /*
  426. Stuff for Emacs to see, in order to encourage consistent editing style:
  427. *** Local Variables: ***
  428. *** mode: c ***
  429. *** fill-column: 75 ***
  430. *** tab-width: 8 ***
  431. *** c-basic-offset: 8 ***
  432. *** End: ***
  433. */