pvrusb2-devattr.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  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 "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_hauppauge_custom_ir = !0,
  86. .flag_has_analogtuner = !0,
  87. .flag_has_fmradio = !0,
  88. .flag_has_composite = !0,
  89. .flag_has_svideo = !0,
  90. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  91. .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
  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. #ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_CREATOR
  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. 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. #endif
  179. #ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_USB2
  180. /*------------------------------------------------------------------------*/
  181. /* OnAir USB 2.0 */
  182. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  183. static struct lgdt330x_config pvr2_lgdt3302_config = {
  184. .demod_address = 0x0e,
  185. .demod_chip = LGDT3302,
  186. };
  187. static int pvr2_lgdt3302_attach(struct pvr2_dvb_adapter *adap)
  188. {
  189. adap->fe = dvb_attach(lgdt330x_attach, &pvr2_lgdt3302_config,
  190. &adap->channel.hdw->i2c_adap);
  191. if (adap->fe)
  192. return 0;
  193. return -EIO;
  194. }
  195. static int pvr2_fcv1236d_attach(struct pvr2_dvb_adapter *adap)
  196. {
  197. dvb_attach(simple_tuner_attach, adap->fe,
  198. &adap->channel.hdw->i2c_adap, 0x61,
  199. TUNER_PHILIPS_FCV1236D);
  200. return 0;
  201. }
  202. struct pvr2_dvb_props pvr2_onair_usb2_fe_props = {
  203. .frontend_attach = pvr2_lgdt3302_attach,
  204. .tuner_attach = pvr2_fcv1236d_attach,
  205. };
  206. #endif
  207. static const char *pvr2_client_onair_usb2[] = {
  208. "saa7115",
  209. "tuner",
  210. "cs53l32a",
  211. };
  212. static const struct pvr2_device_desc pvr2_device_onair_usb2 = {
  213. .description = "OnAir USB2 Hybrid USB tuner",
  214. .shortname = "oa2",
  215. .client_modules.lst = pvr2_client_onair_usb2,
  216. .client_modules.cnt = ARRAY_SIZE(pvr2_client_onair_usb2),
  217. .default_tuner_type = TUNER_PHILIPS_FCV1236D,
  218. .flag_has_analogtuner = !0,
  219. .flag_has_composite = !0,
  220. .flag_has_svideo = !0,
  221. .flag_digital_requires_cx23416 = !0,
  222. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  223. .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR,
  224. .default_std_mask = V4L2_STD_NTSC_M,
  225. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  226. .dvb_props = &pvr2_onair_usb2_fe_props,
  227. #endif
  228. };
  229. #endif
  230. /*------------------------------------------------------------------------*/
  231. /* Hauppauge PVR-USB2 Model 73xxx */
  232. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  233. static struct tda10048_config hauppauge_tda10048_config = {
  234. .demod_address = 0x10 >> 1,
  235. .output_mode = TDA10048_PARALLEL_OUTPUT,
  236. .fwbulkwritelen = TDA10048_BULKWRITE_50,
  237. .inversion = TDA10048_INVERSION_ON,
  238. };
  239. static struct tda829x_config tda829x_no_probe = {
  240. .probe_tuner = TDA829X_DONT_PROBE,
  241. };
  242. static struct tda18271_config hauppauge_tda18271_dvb_config = {
  243. .gate = TDA18271_GATE_ANALOG,
  244. };
  245. static int pvr2_tda10048_attach(struct pvr2_dvb_adapter *adap)
  246. {
  247. adap->fe = dvb_attach(tda10048_attach, &hauppauge_tda10048_config,
  248. &adap->channel.hdw->i2c_adap);
  249. if (adap->fe)
  250. return 0;
  251. return -EIO;
  252. }
  253. static int pvr2_73xxx_tda18271_8295_attach(struct pvr2_dvb_adapter *adap)
  254. {
  255. dvb_attach(tda829x_attach, adap->fe,
  256. &adap->channel.hdw->i2c_adap, 0x42,
  257. &tda829x_no_probe);
  258. dvb_attach(tda18271_attach, adap->fe, 0x60,
  259. &adap->channel.hdw->i2c_adap,
  260. &hauppauge_tda18271_dvb_config);
  261. return 0;
  262. }
  263. struct pvr2_dvb_props pvr2_73xxx_dvb_props = {
  264. .frontend_attach = pvr2_tda10048_attach,
  265. .tuner_attach = pvr2_73xxx_tda18271_8295_attach,
  266. };
  267. #endif
  268. static const char *pvr2_client_73xxx[] = {
  269. "cx25840",
  270. "tuner",
  271. };
  272. static const char *pvr2_fw1_names_73xxx[] = {
  273. "v4l-pvrusb2-73xxx-01.fw",
  274. };
  275. static const struct pvr2_device_desc pvr2_device_73xxx = {
  276. .description = "WinTV PVR USB2 Model Category 73xxx",
  277. .shortname = "73xxx",
  278. .client_modules.lst = pvr2_client_73xxx,
  279. .client_modules.cnt = ARRAY_SIZE(pvr2_client_73xxx),
  280. .fx2_firmware.lst = pvr2_fw1_names_73xxx,
  281. .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_73xxx),
  282. .flag_has_cx25840 = !0,
  283. .flag_has_hauppauge_rom = !0,
  284. .flag_has_analogtuner = !0,
  285. .flag_has_composite = !0,
  286. .flag_has_svideo = !0,
  287. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  288. .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
  289. .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
  290. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  291. .dvb_props = &pvr2_73xxx_dvb_props,
  292. #endif
  293. };
  294. /*------------------------------------------------------------------------*/
  295. /* Hauppauge PVR-USB2 Model 75xxx */
  296. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  297. static struct s5h1409_config pvr2_s5h1409_config = {
  298. .demod_address = 0x32 >> 1,
  299. .output_mode = S5H1409_PARALLEL_OUTPUT,
  300. .gpio = S5H1409_GPIO_OFF,
  301. .qam_if = 4000,
  302. .inversion = S5H1409_INVERSION_ON,
  303. .status_mode = S5H1409_DEMODLOCKING,
  304. };
  305. static struct tda18271_std_map hauppauge_tda18271_std_map = {
  306. .atsc_6 = { .if_freq = 5380, .agc_mode = 3, .std = 3,
  307. .if_lvl = 6, .rfagc_top = 0x37, },
  308. .qam_6 = { .if_freq = 4000, .agc_mode = 3, .std = 0,
  309. .if_lvl = 6, .rfagc_top = 0x37, },
  310. };
  311. static struct tda18271_config hauppauge_tda18271_config = {
  312. .std_map = &hauppauge_tda18271_std_map,
  313. .gate = TDA18271_GATE_ANALOG,
  314. };
  315. static int pvr2_s5h1409_attach(struct pvr2_dvb_adapter *adap)
  316. {
  317. adap->fe = dvb_attach(s5h1409_attach, &pvr2_s5h1409_config,
  318. &adap->channel.hdw->i2c_adap);
  319. if (adap->fe)
  320. return 0;
  321. return -EIO;
  322. }
  323. static int pvr2_tda18271_8295_attach(struct pvr2_dvb_adapter *adap)
  324. {
  325. dvb_attach(tda829x_attach, adap->fe,
  326. &adap->channel.hdw->i2c_adap, 0x42,
  327. &tda829x_no_probe);
  328. dvb_attach(tda18271_attach, adap->fe, 0x60,
  329. &adap->channel.hdw->i2c_adap,
  330. &hauppauge_tda18271_config);
  331. return 0;
  332. }
  333. struct pvr2_dvb_props pvr2_750xx_dvb_props = {
  334. .frontend_attach = pvr2_s5h1409_attach,
  335. .tuner_attach = pvr2_tda18271_8295_attach,
  336. };
  337. #endif
  338. static const char *pvr2_client_75xxx[] = {
  339. "cx25840",
  340. "tuner",
  341. };
  342. static const char *pvr2_fw1_names_75xxx[] = {
  343. "v4l-pvrusb2-73xxx-01.fw",
  344. };
  345. static const struct pvr2_device_desc pvr2_device_750xx = {
  346. .description = "WinTV PVR USB2 Model Category 750xx",
  347. .shortname = "750xx",
  348. .client_modules.lst = pvr2_client_75xxx,
  349. .client_modules.cnt = ARRAY_SIZE(pvr2_client_75xxx),
  350. .fx2_firmware.lst = pvr2_fw1_names_75xxx,
  351. .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_75xxx),
  352. .flag_has_cx25840 = !0,
  353. .flag_has_hauppauge_rom = !0,
  354. .flag_has_analogtuner = !0,
  355. .flag_has_composite = !0,
  356. .flag_has_svideo = !0,
  357. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  358. .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
  359. .default_std_mask = V4L2_STD_NTSC_M,
  360. .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
  361. #ifdef CONFIG_VIDEO_PVRUSB2_DVB
  362. .dvb_props = &pvr2_750xx_dvb_props,
  363. #endif
  364. };
  365. static const struct pvr2_device_desc pvr2_device_751xx = {
  366. .description = "WinTV PVR USB2 Model Category 751xx",
  367. .shortname = "751xx",
  368. .client_modules.lst = pvr2_client_75xxx,
  369. .client_modules.cnt = ARRAY_SIZE(pvr2_client_75xxx),
  370. .fx2_firmware.lst = pvr2_fw1_names_75xxx,
  371. .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_75xxx),
  372. .flag_has_cx25840 = !0,
  373. .flag_has_hauppauge_rom = !0,
  374. .flag_has_analogtuner = !0,
  375. .flag_has_composite = !0,
  376. .flag_has_svideo = !0,
  377. .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
  378. .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
  379. .default_std_mask = V4L2_STD_NTSC_M,
  380. .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
  381. };
  382. /*------------------------------------------------------------------------*/
  383. struct usb_device_id pvr2_device_table[] = {
  384. { USB_DEVICE(0x2040, 0x2900),
  385. .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
  386. { USB_DEVICE(0x2040, 0x2400),
  387. .driver_info = (kernel_ulong_t)&pvr2_device_24xxx},
  388. { USB_DEVICE(0x1164, 0x0622),
  389. .driver_info = (kernel_ulong_t)&pvr2_device_gotview_2},
  390. { USB_DEVICE(0x1164, 0x0602),
  391. .driver_info = (kernel_ulong_t)&pvr2_device_gotview_2d},
  392. #ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_CREATOR
  393. { USB_DEVICE(0x11ba, 0x1003),
  394. .driver_info = (kernel_ulong_t)&pvr2_device_onair_creator},
  395. #endif
  396. #ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_USB2
  397. { USB_DEVICE(0x11ba, 0x1001),
  398. .driver_info = (kernel_ulong_t)&pvr2_device_onair_usb2},
  399. #endif
  400. { USB_DEVICE(0x2040, 0x7300),
  401. .driver_info = (kernel_ulong_t)&pvr2_device_73xxx},
  402. { USB_DEVICE(0x2040, 0x7500),
  403. .driver_info = (kernel_ulong_t)&pvr2_device_750xx},
  404. { USB_DEVICE(0x2040, 0x7501),
  405. .driver_info = (kernel_ulong_t)&pvr2_device_751xx},
  406. { }
  407. };
  408. MODULE_DEVICE_TABLE(usb, pvr2_device_table);
  409. /*
  410. Stuff for Emacs to see, in order to encourage consistent editing style:
  411. *** Local Variables: ***
  412. *** mode: c ***
  413. *** fill-column: 75 ***
  414. *** tab-width: 8 ***
  415. *** c-basic-offset: 8 ***
  416. *** End: ***
  417. */