cx23885-cards.c 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965
  1. /*
  2. * Driver for the Conexant CX23885 PCIe bridge
  3. *
  4. * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org>
  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, or
  9. * (at your option) any later version.
  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. *
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21. #include <linux/init.h>
  22. #include <linux/module.h>
  23. #include <linux/pci.h>
  24. #include <linux/delay.h>
  25. #include <media/cx25840.h>
  26. #include "cx23885.h"
  27. #include "tuner-xc2028.h"
  28. #include "netup-init.h"
  29. #include "cx23888-ir.h"
  30. /* ------------------------------------------------------------------ */
  31. /* board config info */
  32. struct cx23885_board cx23885_boards[] = {
  33. [CX23885_BOARD_UNKNOWN] = {
  34. .name = "UNKNOWN/GENERIC",
  35. /* Ensure safe default for unknown boards */
  36. .clk_freq = 0,
  37. .input = {{
  38. .type = CX23885_VMUX_COMPOSITE1,
  39. .vmux = 0,
  40. }, {
  41. .type = CX23885_VMUX_COMPOSITE2,
  42. .vmux = 1,
  43. }, {
  44. .type = CX23885_VMUX_COMPOSITE3,
  45. .vmux = 2,
  46. }, {
  47. .type = CX23885_VMUX_COMPOSITE4,
  48. .vmux = 3,
  49. } },
  50. },
  51. [CX23885_BOARD_HAUPPAUGE_HVR1800lp] = {
  52. .name = "Hauppauge WinTV-HVR1800lp",
  53. .portc = CX23885_MPEG_DVB,
  54. .input = {{
  55. .type = CX23885_VMUX_TELEVISION,
  56. .vmux = 0,
  57. .gpio0 = 0xff00,
  58. }, {
  59. .type = CX23885_VMUX_DEBUG,
  60. .vmux = 0,
  61. .gpio0 = 0xff01,
  62. }, {
  63. .type = CX23885_VMUX_COMPOSITE1,
  64. .vmux = 1,
  65. .gpio0 = 0xff02,
  66. }, {
  67. .type = CX23885_VMUX_SVIDEO,
  68. .vmux = 2,
  69. .gpio0 = 0xff02,
  70. } },
  71. },
  72. [CX23885_BOARD_HAUPPAUGE_HVR1800] = {
  73. .name = "Hauppauge WinTV-HVR1800",
  74. .porta = CX23885_ANALOG_VIDEO,
  75. .portb = CX23885_MPEG_ENCODER,
  76. .portc = CX23885_MPEG_DVB,
  77. .tuner_type = TUNER_PHILIPS_TDA8290,
  78. .tuner_addr = 0x42, /* 0x84 >> 1 */
  79. .input = {{
  80. .type = CX23885_VMUX_TELEVISION,
  81. .vmux = CX25840_VIN7_CH3 |
  82. CX25840_VIN5_CH2 |
  83. CX25840_VIN2_CH1,
  84. .gpio0 = 0,
  85. }, {
  86. .type = CX23885_VMUX_COMPOSITE1,
  87. .vmux = CX25840_VIN7_CH3 |
  88. CX25840_VIN4_CH2 |
  89. CX25840_VIN6_CH1,
  90. .gpio0 = 0,
  91. }, {
  92. .type = CX23885_VMUX_SVIDEO,
  93. .vmux = CX25840_VIN7_CH3 |
  94. CX25840_VIN4_CH2 |
  95. CX25840_VIN8_CH1 |
  96. CX25840_SVIDEO_ON,
  97. .gpio0 = 0,
  98. } },
  99. },
  100. [CX23885_BOARD_HAUPPAUGE_HVR1250] = {
  101. .name = "Hauppauge WinTV-HVR1250",
  102. .portc = CX23885_MPEG_DVB,
  103. .input = {{
  104. .type = CX23885_VMUX_TELEVISION,
  105. .vmux = 0,
  106. .gpio0 = 0xff00,
  107. }, {
  108. .type = CX23885_VMUX_DEBUG,
  109. .vmux = 0,
  110. .gpio0 = 0xff01,
  111. }, {
  112. .type = CX23885_VMUX_COMPOSITE1,
  113. .vmux = 1,
  114. .gpio0 = 0xff02,
  115. }, {
  116. .type = CX23885_VMUX_SVIDEO,
  117. .vmux = 2,
  118. .gpio0 = 0xff02,
  119. } },
  120. },
  121. [CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP] = {
  122. .name = "DViCO FusionHDTV5 Express",
  123. .portb = CX23885_MPEG_DVB,
  124. },
  125. [CX23885_BOARD_HAUPPAUGE_HVR1500Q] = {
  126. .name = "Hauppauge WinTV-HVR1500Q",
  127. .portc = CX23885_MPEG_DVB,
  128. },
  129. [CX23885_BOARD_HAUPPAUGE_HVR1500] = {
  130. .name = "Hauppauge WinTV-HVR1500",
  131. .portc = CX23885_MPEG_DVB,
  132. },
  133. [CX23885_BOARD_HAUPPAUGE_HVR1200] = {
  134. .name = "Hauppauge WinTV-HVR1200",
  135. .portc = CX23885_MPEG_DVB,
  136. },
  137. [CX23885_BOARD_HAUPPAUGE_HVR1700] = {
  138. .name = "Hauppauge WinTV-HVR1700",
  139. .portc = CX23885_MPEG_DVB,
  140. },
  141. [CX23885_BOARD_HAUPPAUGE_HVR1400] = {
  142. .name = "Hauppauge WinTV-HVR1400",
  143. .portc = CX23885_MPEG_DVB,
  144. },
  145. [CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP] = {
  146. .name = "DViCO FusionHDTV7 Dual Express",
  147. .portb = CX23885_MPEG_DVB,
  148. .portc = CX23885_MPEG_DVB,
  149. },
  150. [CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP] = {
  151. .name = "DViCO FusionHDTV DVB-T Dual Express",
  152. .portb = CX23885_MPEG_DVB,
  153. .portc = CX23885_MPEG_DVB,
  154. },
  155. [CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H] = {
  156. .name = "Leadtek Winfast PxDVR3200 H",
  157. .portc = CX23885_MPEG_DVB,
  158. },
  159. [CX23885_BOARD_COMPRO_VIDEOMATE_E650F] = {
  160. .name = "Compro VideoMate E650F",
  161. .portc = CX23885_MPEG_DVB,
  162. },
  163. [CX23885_BOARD_TBS_6920] = {
  164. .name = "TurboSight TBS 6920",
  165. .portb = CX23885_MPEG_DVB,
  166. },
  167. [CX23885_BOARD_TEVII_S470] = {
  168. .name = "TeVii S470",
  169. .portb = CX23885_MPEG_DVB,
  170. },
  171. [CX23885_BOARD_DVBWORLD_2005] = {
  172. .name = "DVBWorld DVB-S2 2005",
  173. .portb = CX23885_MPEG_DVB,
  174. },
  175. [CX23885_BOARD_NETUP_DUAL_DVBS2_CI] = {
  176. .cimax = 1,
  177. .name = "NetUP Dual DVB-S2 CI",
  178. .portb = CX23885_MPEG_DVB,
  179. .portc = CX23885_MPEG_DVB,
  180. },
  181. [CX23885_BOARD_HAUPPAUGE_HVR1270] = {
  182. .name = "Hauppauge WinTV-HVR1270",
  183. .portc = CX23885_MPEG_DVB,
  184. },
  185. [CX23885_BOARD_HAUPPAUGE_HVR1275] = {
  186. .name = "Hauppauge WinTV-HVR1275",
  187. .portc = CX23885_MPEG_DVB,
  188. },
  189. [CX23885_BOARD_HAUPPAUGE_HVR1255] = {
  190. .name = "Hauppauge WinTV-HVR1255",
  191. .portc = CX23885_MPEG_DVB,
  192. },
  193. [CX23885_BOARD_HAUPPAUGE_HVR1210] = {
  194. .name = "Hauppauge WinTV-HVR1210",
  195. .portc = CX23885_MPEG_DVB,
  196. },
  197. [CX23885_BOARD_MYGICA_X8506] = {
  198. .name = "Mygica X8506 DMB-TH",
  199. .portb = CX23885_MPEG_DVB,
  200. },
  201. [CX23885_BOARD_MAGICPRO_PROHDTVE2] = {
  202. .name = "Magic-Pro ProHDTV Extreme 2",
  203. .portb = CX23885_MPEG_DVB,
  204. },
  205. [CX23885_BOARD_HAUPPAUGE_HVR1850] = {
  206. .name = "Hauppauge WinTV-HVR1850",
  207. .portb = CX23885_MPEG_ENCODER,
  208. .portc = CX23885_MPEG_DVB,
  209. },
  210. [CX23885_BOARD_COMPRO_VIDEOMATE_E800] = {
  211. .name = "Compro VideoMate E800",
  212. .portc = CX23885_MPEG_DVB,
  213. },
  214. };
  215. const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
  216. /* ------------------------------------------------------------------ */
  217. /* PCI subsystem IDs */
  218. struct cx23885_subid cx23885_subids[] = {
  219. {
  220. .subvendor = 0x0070,
  221. .subdevice = 0x3400,
  222. .card = CX23885_BOARD_UNKNOWN,
  223. }, {
  224. .subvendor = 0x0070,
  225. .subdevice = 0x7600,
  226. .card = CX23885_BOARD_HAUPPAUGE_HVR1800lp,
  227. }, {
  228. .subvendor = 0x0070,
  229. .subdevice = 0x7800,
  230. .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
  231. }, {
  232. .subvendor = 0x0070,
  233. .subdevice = 0x7801,
  234. .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
  235. }, {
  236. .subvendor = 0x0070,
  237. .subdevice = 0x7809,
  238. .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
  239. }, {
  240. .subvendor = 0x0070,
  241. .subdevice = 0x7911,
  242. .card = CX23885_BOARD_HAUPPAUGE_HVR1250,
  243. }, {
  244. .subvendor = 0x18ac,
  245. .subdevice = 0xd500,
  246. .card = CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP,
  247. }, {
  248. .subvendor = 0x0070,
  249. .subdevice = 0x7790,
  250. .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
  251. }, {
  252. .subvendor = 0x0070,
  253. .subdevice = 0x7797,
  254. .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
  255. }, {
  256. .subvendor = 0x0070,
  257. .subdevice = 0x7710,
  258. .card = CX23885_BOARD_HAUPPAUGE_HVR1500,
  259. }, {
  260. .subvendor = 0x0070,
  261. .subdevice = 0x7717,
  262. .card = CX23885_BOARD_HAUPPAUGE_HVR1500,
  263. }, {
  264. .subvendor = 0x0070,
  265. .subdevice = 0x71d1,
  266. .card = CX23885_BOARD_HAUPPAUGE_HVR1200,
  267. }, {
  268. .subvendor = 0x0070,
  269. .subdevice = 0x71d3,
  270. .card = CX23885_BOARD_HAUPPAUGE_HVR1200,
  271. }, {
  272. .subvendor = 0x0070,
  273. .subdevice = 0x8101,
  274. .card = CX23885_BOARD_HAUPPAUGE_HVR1700,
  275. }, {
  276. .subvendor = 0x0070,
  277. .subdevice = 0x8010,
  278. .card = CX23885_BOARD_HAUPPAUGE_HVR1400,
  279. }, {
  280. .subvendor = 0x18ac,
  281. .subdevice = 0xd618,
  282. .card = CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP,
  283. }, {
  284. .subvendor = 0x18ac,
  285. .subdevice = 0xdb78,
  286. .card = CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP,
  287. }, {
  288. .subvendor = 0x107d,
  289. .subdevice = 0x6681,
  290. .card = CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H,
  291. }, {
  292. .subvendor = 0x185b,
  293. .subdevice = 0xe800,
  294. .card = CX23885_BOARD_COMPRO_VIDEOMATE_E650F,
  295. }, {
  296. .subvendor = 0x6920,
  297. .subdevice = 0x8888,
  298. .card = CX23885_BOARD_TBS_6920,
  299. }, {
  300. .subvendor = 0xd470,
  301. .subdevice = 0x9022,
  302. .card = CX23885_BOARD_TEVII_S470,
  303. }, {
  304. .subvendor = 0x0001,
  305. .subdevice = 0x2005,
  306. .card = CX23885_BOARD_DVBWORLD_2005,
  307. }, {
  308. .subvendor = 0x1b55,
  309. .subdevice = 0x2a2c,
  310. .card = CX23885_BOARD_NETUP_DUAL_DVBS2_CI,
  311. }, {
  312. .subvendor = 0x0070,
  313. .subdevice = 0x2211,
  314. .card = CX23885_BOARD_HAUPPAUGE_HVR1270,
  315. }, {
  316. .subvendor = 0x0070,
  317. .subdevice = 0x2215,
  318. .card = CX23885_BOARD_HAUPPAUGE_HVR1275,
  319. }, {
  320. .subvendor = 0x0070,
  321. .subdevice = 0x2251,
  322. .card = CX23885_BOARD_HAUPPAUGE_HVR1255,
  323. }, {
  324. .subvendor = 0x0070,
  325. .subdevice = 0x2291,
  326. .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
  327. }, {
  328. .subvendor = 0x0070,
  329. .subdevice = 0x2295,
  330. .card = CX23885_BOARD_HAUPPAUGE_HVR1210,
  331. }, {
  332. .subvendor = 0x14f1,
  333. .subdevice = 0x8651,
  334. .card = CX23885_BOARD_MYGICA_X8506,
  335. }, {
  336. .subvendor = 0x14f1,
  337. .subdevice = 0x8657,
  338. .card = CX23885_BOARD_MAGICPRO_PROHDTVE2,
  339. }, {
  340. .subvendor = 0x0070,
  341. .subdevice = 0x8541,
  342. .card = CX23885_BOARD_HAUPPAUGE_HVR1850,
  343. }, {
  344. .subvendor = 0x1858,
  345. .subdevice = 0xe800,
  346. .card = CX23885_BOARD_COMPRO_VIDEOMATE_E800,
  347. },
  348. };
  349. const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
  350. void cx23885_card_list(struct cx23885_dev *dev)
  351. {
  352. int i;
  353. if (0 == dev->pci->subsystem_vendor &&
  354. 0 == dev->pci->subsystem_device) {
  355. printk(KERN_INFO
  356. "%s: Board has no valid PCIe Subsystem ID and can't\n"
  357. "%s: be autodetected. Pass card=<n> insmod option\n"
  358. "%s: to workaround that. Redirect complaints to the\n"
  359. "%s: vendor of the TV card. Best regards,\n"
  360. "%s: -- tux\n",
  361. dev->name, dev->name, dev->name, dev->name, dev->name);
  362. } else {
  363. printk(KERN_INFO
  364. "%s: Your board isn't known (yet) to the driver.\n"
  365. "%s: Try to pick one of the existing card configs via\n"
  366. "%s: card=<n> insmod option. Updating to the latest\n"
  367. "%s: version might help as well.\n",
  368. dev->name, dev->name, dev->name, dev->name);
  369. }
  370. printk(KERN_INFO "%s: Here is a list of valid choices for the card=<n> insmod option:\n",
  371. dev->name);
  372. for (i = 0; i < cx23885_bcount; i++)
  373. printk(KERN_INFO "%s: card=%d -> %s\n",
  374. dev->name, i, cx23885_boards[i].name);
  375. }
  376. static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
  377. {
  378. struct tveeprom tv;
  379. tveeprom_hauppauge_analog(&dev->i2c_bus[0].i2c_client, &tv,
  380. eeprom_data);
  381. /* Make sure we support the board model */
  382. switch (tv.model) {
  383. case 22001:
  384. /* WinTV-HVR1270 (PCIe, Retail, half height)
  385. * ATSC/QAM and basic analog, IR Blast */
  386. case 22009:
  387. /* WinTV-HVR1210 (PCIe, Retail, half height)
  388. * DVB-T and basic analog, IR Blast */
  389. case 22011:
  390. /* WinTV-HVR1270 (PCIe, Retail, half height)
  391. * ATSC/QAM and basic analog, IR Recv */
  392. case 22019:
  393. /* WinTV-HVR1210 (PCIe, Retail, half height)
  394. * DVB-T and basic analog, IR Recv */
  395. case 22021:
  396. /* WinTV-HVR1275 (PCIe, Retail, half height)
  397. * ATSC/QAM and basic analog, IR Recv */
  398. case 22029:
  399. /* WinTV-HVR1210 (PCIe, Retail, half height)
  400. * DVB-T and basic analog, IR Recv */
  401. case 22101:
  402. /* WinTV-HVR1270 (PCIe, Retail, full height)
  403. * ATSC/QAM and basic analog, IR Blast */
  404. case 22109:
  405. /* WinTV-HVR1210 (PCIe, Retail, full height)
  406. * DVB-T and basic analog, IR Blast */
  407. case 22111:
  408. /* WinTV-HVR1270 (PCIe, Retail, full height)
  409. * ATSC/QAM and basic analog, IR Recv */
  410. case 22119:
  411. /* WinTV-HVR1210 (PCIe, Retail, full height)
  412. * DVB-T and basic analog, IR Recv */
  413. case 22121:
  414. /* WinTV-HVR1275 (PCIe, Retail, full height)
  415. * ATSC/QAM and basic analog, IR Recv */
  416. case 22129:
  417. /* WinTV-HVR1210 (PCIe, Retail, full height)
  418. * DVB-T and basic analog, IR Recv */
  419. case 71009:
  420. /* WinTV-HVR1200 (PCIe, Retail, full height)
  421. * DVB-T and basic analog */
  422. case 71359:
  423. /* WinTV-HVR1200 (PCIe, OEM, half height)
  424. * DVB-T and basic analog */
  425. case 71439:
  426. /* WinTV-HVR1200 (PCIe, OEM, half height)
  427. * DVB-T and basic analog */
  428. case 71449:
  429. /* WinTV-HVR1200 (PCIe, OEM, full height)
  430. * DVB-T and basic analog */
  431. case 71939:
  432. /* WinTV-HVR1200 (PCIe, OEM, half height)
  433. * DVB-T and basic analog */
  434. case 71949:
  435. /* WinTV-HVR1200 (PCIe, OEM, full height)
  436. * DVB-T and basic analog */
  437. case 71959:
  438. /* WinTV-HVR1200 (PCIe, OEM, full height)
  439. * DVB-T and basic analog */
  440. case 71979:
  441. /* WinTV-HVR1200 (PCIe, OEM, half height)
  442. * DVB-T and basic analog */
  443. case 71999:
  444. /* WinTV-HVR1200 (PCIe, OEM, full height)
  445. * DVB-T and basic analog */
  446. case 76601:
  447. /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual
  448. channel ATSC and MPEG2 HW Encoder */
  449. case 77001:
  450. /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC
  451. and Basic analog */
  452. case 77011:
  453. /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC
  454. and Basic analog */
  455. case 77041:
  456. /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM
  457. and Basic analog */
  458. case 77051:
  459. /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM
  460. and Basic analog */
  461. case 78011:
  462. /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM,
  463. Dual channel ATSC and MPEG2 HW Encoder */
  464. case 78501:
  465. /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM,
  466. Dual channel ATSC and MPEG2 HW Encoder */
  467. case 78521:
  468. /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM,
  469. Dual channel ATSC and MPEG2 HW Encoder */
  470. case 78531:
  471. /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM,
  472. Dual channel ATSC and MPEG2 HW Encoder */
  473. case 78631:
  474. /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM,
  475. Dual channel ATSC and MPEG2 HW Encoder */
  476. case 79001:
  477. /* WinTV-HVR1250 (PCIe, Retail, IR, full height,
  478. ATSC and Basic analog */
  479. case 79101:
  480. /* WinTV-HVR1250 (PCIe, Retail, IR, half height,
  481. ATSC and Basic analog */
  482. case 79561:
  483. /* WinTV-HVR1250 (PCIe, OEM, No IR, half height,
  484. ATSC and Basic analog */
  485. case 79571:
  486. /* WinTV-HVR1250 (PCIe, OEM, No IR, full height,
  487. ATSC and Basic analog */
  488. case 79671:
  489. /* WinTV-HVR1250 (PCIe, OEM, No IR, half height,
  490. ATSC and Basic analog */
  491. case 80019:
  492. /* WinTV-HVR1400 (Express Card, Retail, IR,
  493. * DVB-T and Basic analog */
  494. case 81509:
  495. /* WinTV-HVR1700 (PCIe, OEM, No IR, half height)
  496. * DVB-T and MPEG2 HW Encoder */
  497. case 81519:
  498. /* WinTV-HVR1700 (PCIe, OEM, No IR, full height)
  499. * DVB-T and MPEG2 HW Encoder */
  500. break;
  501. case 85021:
  502. /* WinTV-HVR1850 (PCIe, OEM, RCA in, IR, FM,
  503. Dual channel ATSC and MPEG2 HW Encoder */
  504. break;
  505. default:
  506. printk(KERN_WARNING "%s: warning: "
  507. "unknown hauppauge model #%d\n",
  508. dev->name, tv.model);
  509. break;
  510. }
  511. printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n",
  512. dev->name, tv.model);
  513. }
  514. int cx23885_tuner_callback(void *priv, int component, int command, int arg)
  515. {
  516. struct cx23885_tsport *port = priv;
  517. struct cx23885_dev *dev = port->dev;
  518. u32 bitmask = 0;
  519. if (command == XC2028_RESET_CLK)
  520. return 0;
  521. if (command != 0) {
  522. printk(KERN_ERR "%s(): Unknown command 0x%x.\n",
  523. __func__, command);
  524. return -EINVAL;
  525. }
  526. switch (dev->board) {
  527. case CX23885_BOARD_HAUPPAUGE_HVR1400:
  528. case CX23885_BOARD_HAUPPAUGE_HVR1500:
  529. case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
  530. case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
  531. case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
  532. case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
  533. /* Tuner Reset Command */
  534. bitmask = 0x04;
  535. break;
  536. case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
  537. case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
  538. /* Two identical tuners on two different i2c buses,
  539. * we need to reset the correct gpio. */
  540. if (port->nr == 1)
  541. bitmask = 0x01;
  542. else if (port->nr == 2)
  543. bitmask = 0x04;
  544. break;
  545. }
  546. if (bitmask) {
  547. /* Drive the tuner into reset and back out */
  548. cx_clear(GP0_IO, bitmask);
  549. mdelay(200);
  550. cx_set(GP0_IO, bitmask);
  551. }
  552. return 0;
  553. }
  554. void cx23885_gpio_setup(struct cx23885_dev *dev)
  555. {
  556. switch (dev->board) {
  557. case CX23885_BOARD_HAUPPAUGE_HVR1250:
  558. /* GPIO-0 cx24227 demodulator reset */
  559. cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
  560. break;
  561. case CX23885_BOARD_HAUPPAUGE_HVR1500:
  562. /* GPIO-0 cx24227 demodulator */
  563. /* GPIO-2 xc3028 tuner */
  564. /* Put the parts into reset */
  565. cx_set(GP0_IO, 0x00050000);
  566. cx_clear(GP0_IO, 0x00000005);
  567. msleep(5);
  568. /* Bring the parts out of reset */
  569. cx_set(GP0_IO, 0x00050005);
  570. break;
  571. case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
  572. /* GPIO-0 cx24227 demodulator reset */
  573. /* GPIO-2 xc5000 tuner reset */
  574. cx_set(GP0_IO, 0x00050005); /* Bring the part out of reset */
  575. break;
  576. case CX23885_BOARD_HAUPPAUGE_HVR1800:
  577. /* GPIO-0 656_CLK */
  578. /* GPIO-1 656_D0 */
  579. /* GPIO-2 8295A Reset */
  580. /* GPIO-3-10 cx23417 data0-7 */
  581. /* GPIO-11-14 cx23417 addr0-3 */
  582. /* GPIO-15-18 cx23417 READY, CS, RD, WR */
  583. /* GPIO-19 IR_RX */
  584. /* CX23417 GPIO's */
  585. /* EIO15 Zilog Reset */
  586. /* EIO14 S5H1409/CX24227 Reset */
  587. mc417_gpio_enable(dev, GPIO_15 | GPIO_14, 1);
  588. /* Put the demod into reset and protect the eeprom */
  589. mc417_gpio_clear(dev, GPIO_15 | GPIO_14);
  590. mdelay(100);
  591. /* Bring the demod and blaster out of reset */
  592. mc417_gpio_set(dev, GPIO_15 | GPIO_14);
  593. mdelay(100);
  594. /* Force the TDA8295A into reset and back */
  595. cx23885_gpio_enable(dev, GPIO_2, 1);
  596. cx23885_gpio_set(dev, GPIO_2);
  597. mdelay(20);
  598. cx23885_gpio_clear(dev, GPIO_2);
  599. mdelay(20);
  600. cx23885_gpio_set(dev, GPIO_2);
  601. mdelay(20);
  602. break;
  603. case CX23885_BOARD_HAUPPAUGE_HVR1200:
  604. /* GPIO-0 tda10048 demodulator reset */
  605. /* GPIO-2 tda18271 tuner reset */
  606. /* Put the parts into reset and back */
  607. cx_set(GP0_IO, 0x00050000);
  608. mdelay(20);
  609. cx_clear(GP0_IO, 0x00000005);
  610. mdelay(20);
  611. cx_set(GP0_IO, 0x00050005);
  612. break;
  613. case CX23885_BOARD_HAUPPAUGE_HVR1700:
  614. /* GPIO-0 TDA10048 demodulator reset */
  615. /* GPIO-2 TDA8295A Reset */
  616. /* GPIO-3-10 cx23417 data0-7 */
  617. /* GPIO-11-14 cx23417 addr0-3 */
  618. /* GPIO-15-18 cx23417 READY, CS, RD, WR */
  619. /* The following GPIO's are on the interna AVCore (cx25840) */
  620. /* GPIO-19 IR_RX */
  621. /* GPIO-20 IR_TX 416/DVBT Select */
  622. /* GPIO-21 IIS DAT */
  623. /* GPIO-22 IIS WCLK */
  624. /* GPIO-23 IIS BCLK */
  625. /* Put the parts into reset and back */
  626. cx_set(GP0_IO, 0x00050000);
  627. mdelay(20);
  628. cx_clear(GP0_IO, 0x00000005);
  629. mdelay(20);
  630. cx_set(GP0_IO, 0x00050005);
  631. break;
  632. case CX23885_BOARD_HAUPPAUGE_HVR1400:
  633. /* GPIO-0 Dibcom7000p demodulator reset */
  634. /* GPIO-2 xc3028L tuner reset */
  635. /* GPIO-13 LED */
  636. /* Put the parts into reset and back */
  637. cx_set(GP0_IO, 0x00050000);
  638. mdelay(20);
  639. cx_clear(GP0_IO, 0x00000005);
  640. mdelay(20);
  641. cx_set(GP0_IO, 0x00050005);
  642. break;
  643. case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
  644. /* GPIO-0 xc5000 tuner reset i2c bus 0 */
  645. /* GPIO-1 s5h1409 demod reset i2c bus 0 */
  646. /* GPIO-2 xc5000 tuner reset i2c bus 1 */
  647. /* GPIO-3 s5h1409 demod reset i2c bus 0 */
  648. /* Put the parts into reset and back */
  649. cx_set(GP0_IO, 0x000f0000);
  650. mdelay(20);
  651. cx_clear(GP0_IO, 0x0000000f);
  652. mdelay(20);
  653. cx_set(GP0_IO, 0x000f000f);
  654. break;
  655. case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
  656. /* GPIO-0 portb xc3028 reset */
  657. /* GPIO-1 portb zl10353 reset */
  658. /* GPIO-2 portc xc3028 reset */
  659. /* GPIO-3 portc zl10353 reset */
  660. /* Put the parts into reset and back */
  661. cx_set(GP0_IO, 0x000f0000);
  662. mdelay(20);
  663. cx_clear(GP0_IO, 0x0000000f);
  664. mdelay(20);
  665. cx_set(GP0_IO, 0x000f000f);
  666. break;
  667. case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
  668. case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
  669. case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
  670. /* GPIO-2 xc3028 tuner reset */
  671. /* The following GPIO's are on the internal AVCore (cx25840) */
  672. /* GPIO-? zl10353 demod reset */
  673. /* Put the parts into reset and back */
  674. cx_set(GP0_IO, 0x00040000);
  675. mdelay(20);
  676. cx_clear(GP0_IO, 0x00000004);
  677. mdelay(20);
  678. cx_set(GP0_IO, 0x00040004);
  679. break;
  680. case CX23885_BOARD_TBS_6920:
  681. case CX23885_BOARD_TEVII_S470:
  682. cx_write(MC417_CTL, 0x00000036);
  683. cx_write(MC417_OEN, 0x00001000);
  684. cx_write(MC417_RWD, 0x00001800);
  685. break;
  686. case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
  687. /* GPIO-0 INTA from CiMax1
  688. GPIO-1 INTB from CiMax2
  689. GPIO-2 reset chips
  690. GPIO-3 to GPIO-10 data/addr for CA
  691. GPIO-11 ~CS0 to CiMax1
  692. GPIO-12 ~CS1 to CiMax2
  693. GPIO-13 ADL0 load LSB addr
  694. GPIO-14 ADL1 load MSB addr
  695. GPIO-15 ~RDY from CiMax
  696. GPIO-17 ~RD to CiMax
  697. GPIO-18 ~WR to CiMax
  698. */
  699. cx_set(GP0_IO, 0x00040000); /* GPIO as out */
  700. /* GPIO1 and GPIO2 as INTA and INTB from CiMaxes, reset low */
  701. cx_clear(GP0_IO, 0x00030004);
  702. mdelay(100);/* reset delay */
  703. cx_set(GP0_IO, 0x00040004); /* GPIO as out, reset high */
  704. cx_write(MC417_CTL, 0x00000037);/* enable GPIO3-18 pins */
  705. /* GPIO-15 IN as ~ACK, rest as OUT */
  706. cx_write(MC417_OEN, 0x00001000);
  707. /* ~RD, ~WR high; ADL0, ADL1 low; ~CS0, ~CS1 high */
  708. cx_write(MC417_RWD, 0x0000c300);
  709. /* enable irq */
  710. cx_write(GPIO_ISM, 0x00000000);/* INTERRUPTS active low*/
  711. break;
  712. case CX23885_BOARD_HAUPPAUGE_HVR1270:
  713. case CX23885_BOARD_HAUPPAUGE_HVR1275:
  714. case CX23885_BOARD_HAUPPAUGE_HVR1255:
  715. case CX23885_BOARD_HAUPPAUGE_HVR1210:
  716. /* GPIO-5 RF Control: 0 = RF1 Terrestrial, 1 = RF2 Cable */
  717. /* GPIO-6 I2C Gate which can isolate the demod from the bus */
  718. /* GPIO-9 Demod reset */
  719. /* Put the parts into reset and back */
  720. cx23885_gpio_enable(dev, GPIO_9 | GPIO_6 | GPIO_5, 1);
  721. cx23885_gpio_set(dev, GPIO_9 | GPIO_6 | GPIO_5);
  722. cx23885_gpio_clear(dev, GPIO_9);
  723. mdelay(20);
  724. cx23885_gpio_set(dev, GPIO_9);
  725. break;
  726. case CX23885_BOARD_MYGICA_X8506:
  727. case CX23885_BOARD_MAGICPRO_PROHDTVE2:
  728. /* GPIO-1 reset XC5000 */
  729. /* GPIO-2 reset LGS8GL5 / LGS8G75 */
  730. cx_set(GP0_IO, 0x00060000);
  731. cx_clear(GP0_IO, 0x00000006);
  732. mdelay(100);
  733. cx_set(GP0_IO, 0x00060006);
  734. mdelay(100);
  735. break;
  736. case CX23885_BOARD_HAUPPAUGE_HVR1850:
  737. /* GPIO-0 656_CLK */
  738. /* GPIO-1 656_D0 */
  739. /* GPIO-2 Wake# */
  740. /* GPIO-3-10 cx23417 data0-7 */
  741. /* GPIO-11-14 cx23417 addr0-3 */
  742. /* GPIO-15-18 cx23417 READY, CS, RD, WR */
  743. /* GPIO-19 IR_RX */
  744. /* GPIO-20 C_IR_TX */
  745. /* GPIO-21 I2S DAT */
  746. /* GPIO-22 I2S WCLK */
  747. /* GPIO-23 I2S BCLK */
  748. /* ALT GPIO: EXP GPIO LATCH */
  749. /* CX23417 GPIO's */
  750. /* GPIO-14 S5H1411/CX24228 Reset */
  751. /* GPIO-13 EEPROM write protect */
  752. mc417_gpio_enable(dev, GPIO_14 | GPIO_13, 1);
  753. /* Put the demod into reset and protect the eeprom */
  754. mc417_gpio_clear(dev, GPIO_14 | GPIO_13);
  755. mdelay(100);
  756. /* Bring the demod out of reset */
  757. mc417_gpio_set(dev, GPIO_14);
  758. mdelay(100);
  759. /* CX24228 GPIO */
  760. /* Connected to IF / Mux */
  761. break;
  762. }
  763. }
  764. int cx23885_ir_init(struct cx23885_dev *dev)
  765. {
  766. int ret = 0;
  767. switch (dev->board) {
  768. case CX23885_BOARD_HAUPPAUGE_HVR1250:
  769. case CX23885_BOARD_HAUPPAUGE_HVR1500:
  770. case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
  771. case CX23885_BOARD_HAUPPAUGE_HVR1800:
  772. case CX23885_BOARD_HAUPPAUGE_HVR1200:
  773. case CX23885_BOARD_HAUPPAUGE_HVR1400:
  774. case CX23885_BOARD_HAUPPAUGE_HVR1270:
  775. case CX23885_BOARD_HAUPPAUGE_HVR1275:
  776. case CX23885_BOARD_HAUPPAUGE_HVR1255:
  777. case CX23885_BOARD_HAUPPAUGE_HVR1210:
  778. /* FIXME: Implement me */
  779. break;
  780. case CX23885_BOARD_HAUPPAUGE_HVR1850:
  781. ret = cx23888_ir_probe(dev);
  782. if (ret)
  783. break;
  784. dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_888_IR);
  785. break;
  786. case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
  787. request_module("ir-kbd-i2c");
  788. break;
  789. }
  790. return ret;
  791. }
  792. void cx23885_card_setup(struct cx23885_dev *dev)
  793. {
  794. struct cx23885_tsport *ts1 = &dev->ts1;
  795. struct cx23885_tsport *ts2 = &dev->ts2;
  796. static u8 eeprom[256];
  797. if (dev->i2c_bus[0].i2c_rc == 0) {
  798. dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1;
  799. tveeprom_read(&dev->i2c_bus[0].i2c_client,
  800. eeprom, sizeof(eeprom));
  801. }
  802. switch (dev->board) {
  803. case CX23885_BOARD_HAUPPAUGE_HVR1250:
  804. case CX23885_BOARD_HAUPPAUGE_HVR1500:
  805. case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
  806. case CX23885_BOARD_HAUPPAUGE_HVR1400:
  807. if (dev->i2c_bus[0].i2c_rc == 0)
  808. hauppauge_eeprom(dev, eeprom+0x80);
  809. break;
  810. case CX23885_BOARD_HAUPPAUGE_HVR1800:
  811. case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
  812. case CX23885_BOARD_HAUPPAUGE_HVR1200:
  813. case CX23885_BOARD_HAUPPAUGE_HVR1700:
  814. case CX23885_BOARD_HAUPPAUGE_HVR1270:
  815. case CX23885_BOARD_HAUPPAUGE_HVR1275:
  816. case CX23885_BOARD_HAUPPAUGE_HVR1255:
  817. case CX23885_BOARD_HAUPPAUGE_HVR1210:
  818. case CX23885_BOARD_HAUPPAUGE_HVR1850:
  819. if (dev->i2c_bus[0].i2c_rc == 0)
  820. hauppauge_eeprom(dev, eeprom+0xc0);
  821. break;
  822. }
  823. switch (dev->board) {
  824. case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
  825. case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
  826. ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
  827. ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  828. ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  829. /* break omitted intentionally */
  830. case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP:
  831. ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
  832. ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  833. ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  834. break;
  835. case CX23885_BOARD_HAUPPAUGE_HVR1800:
  836. /* Defaults for VID B - Analog encoder */
  837. /* DREQ_POL, SMODE, PUNC_CLK, MCLK_POL Serial bus + punc clk */
  838. ts1->gen_ctrl_val = 0x10e;
  839. ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  840. ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  841. /* APB_TSVALERR_POL (active low)*/
  842. ts1->vld_misc_val = 0x2000;
  843. ts1->hw_sop_ctrl_val = (0x47 << 16 | 188 << 4 | 0xc);
  844. /* Defaults for VID C */
  845. ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
  846. ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  847. ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  848. break;
  849. case CX23885_BOARD_TEVII_S470:
  850. case CX23885_BOARD_TBS_6920:
  851. case CX23885_BOARD_DVBWORLD_2005:
  852. ts1->gen_ctrl_val = 0x5; /* Parallel */
  853. ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  854. ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  855. break;
  856. case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
  857. ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
  858. ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  859. ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  860. ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
  861. ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  862. ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  863. break;
  864. case CX23885_BOARD_MYGICA_X8506:
  865. case CX23885_BOARD_MAGICPRO_PROHDTVE2:
  866. ts1->gen_ctrl_val = 0x5; /* Parallel */
  867. ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  868. ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  869. break;
  870. case CX23885_BOARD_HAUPPAUGE_HVR1250:
  871. case CX23885_BOARD_HAUPPAUGE_HVR1500:
  872. case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
  873. case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
  874. case CX23885_BOARD_HAUPPAUGE_HVR1200:
  875. case CX23885_BOARD_HAUPPAUGE_HVR1700:
  876. case CX23885_BOARD_HAUPPAUGE_HVR1400:
  877. case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
  878. case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
  879. case CX23885_BOARD_HAUPPAUGE_HVR1270:
  880. case CX23885_BOARD_HAUPPAUGE_HVR1275:
  881. case CX23885_BOARD_HAUPPAUGE_HVR1255:
  882. case CX23885_BOARD_HAUPPAUGE_HVR1210:
  883. case CX23885_BOARD_HAUPPAUGE_HVR1850:
  884. case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
  885. default:
  886. ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
  887. ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  888. ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  889. }
  890. /* Certain boards support analog, or require the avcore to be
  891. * loaded, ensure this happens.
  892. */
  893. switch (dev->board) {
  894. case CX23885_BOARD_HAUPPAUGE_HVR1800:
  895. case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
  896. case CX23885_BOARD_HAUPPAUGE_HVR1700:
  897. case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
  898. case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
  899. case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
  900. case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
  901. case CX23885_BOARD_HAUPPAUGE_HVR1850:
  902. dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev,
  903. &dev->i2c_bus[2].i2c_adap,
  904. "cx25840", "cx25840", 0x88 >> 1, NULL);
  905. v4l2_subdev_call(dev->sd_cx25840, core, load_fw);
  906. break;
  907. }
  908. /* AUX-PLL 27MHz CLK */
  909. switch (dev->board) {
  910. case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
  911. netup_initialize(dev);
  912. break;
  913. }
  914. }
  915. /* ------------------------------------------------------------------ */