cx23885-cards.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  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. /* ------------------------------------------------------------------ */
  29. /* board config info */
  30. struct cx23885_board cx23885_boards[] = {
  31. [CX23885_BOARD_UNKNOWN] = {
  32. .name = "UNKNOWN/GENERIC",
  33. /* Ensure safe default for unknown boards */
  34. .clk_freq = 0,
  35. .input = {{
  36. .type = CX23885_VMUX_COMPOSITE1,
  37. .vmux = 0,
  38. }, {
  39. .type = CX23885_VMUX_COMPOSITE2,
  40. .vmux = 1,
  41. }, {
  42. .type = CX23885_VMUX_COMPOSITE3,
  43. .vmux = 2,
  44. }, {
  45. .type = CX23885_VMUX_COMPOSITE4,
  46. .vmux = 3,
  47. } },
  48. },
  49. [CX23885_BOARD_HAUPPAUGE_HVR1800lp] = {
  50. .name = "Hauppauge WinTV-HVR1800lp",
  51. .portc = CX23885_MPEG_DVB,
  52. .input = {{
  53. .type = CX23885_VMUX_TELEVISION,
  54. .vmux = 0,
  55. .gpio0 = 0xff00,
  56. }, {
  57. .type = CX23885_VMUX_DEBUG,
  58. .vmux = 0,
  59. .gpio0 = 0xff01,
  60. }, {
  61. .type = CX23885_VMUX_COMPOSITE1,
  62. .vmux = 1,
  63. .gpio0 = 0xff02,
  64. }, {
  65. .type = CX23885_VMUX_SVIDEO,
  66. .vmux = 2,
  67. .gpio0 = 0xff02,
  68. } },
  69. },
  70. [CX23885_BOARD_HAUPPAUGE_HVR1800] = {
  71. .name = "Hauppauge WinTV-HVR1800",
  72. .porta = CX23885_ANALOG_VIDEO,
  73. .portb = CX23885_MPEG_ENCODER,
  74. .portc = CX23885_MPEG_DVB,
  75. .tuner_type = TUNER_PHILIPS_TDA8290,
  76. .tuner_addr = 0x42, /* 0x84 >> 1 */
  77. .input = {{
  78. .type = CX23885_VMUX_TELEVISION,
  79. .vmux = CX25840_VIN7_CH3 |
  80. CX25840_VIN5_CH2 |
  81. CX25840_VIN2_CH1,
  82. .gpio0 = 0,
  83. }, {
  84. .type = CX23885_VMUX_COMPOSITE1,
  85. .vmux = CX25840_VIN7_CH3 |
  86. CX25840_VIN4_CH2 |
  87. CX25840_VIN6_CH1,
  88. .gpio0 = 0,
  89. }, {
  90. .type = CX23885_VMUX_SVIDEO,
  91. .vmux = CX25840_VIN7_CH3 |
  92. CX25840_VIN4_CH2 |
  93. CX25840_VIN8_CH1 |
  94. CX25840_SVIDEO_ON,
  95. .gpio0 = 0,
  96. } },
  97. },
  98. [CX23885_BOARD_HAUPPAUGE_HVR1250] = {
  99. .name = "Hauppauge WinTV-HVR1250",
  100. .portc = CX23885_MPEG_DVB,
  101. .input = {{
  102. .type = CX23885_VMUX_TELEVISION,
  103. .vmux = 0,
  104. .gpio0 = 0xff00,
  105. }, {
  106. .type = CX23885_VMUX_DEBUG,
  107. .vmux = 0,
  108. .gpio0 = 0xff01,
  109. }, {
  110. .type = CX23885_VMUX_COMPOSITE1,
  111. .vmux = 1,
  112. .gpio0 = 0xff02,
  113. }, {
  114. .type = CX23885_VMUX_SVIDEO,
  115. .vmux = 2,
  116. .gpio0 = 0xff02,
  117. } },
  118. },
  119. [CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP] = {
  120. .name = "DViCO FusionHDTV5 Express",
  121. .portb = CX23885_MPEG_DVB,
  122. },
  123. [CX23885_BOARD_HAUPPAUGE_HVR1500Q] = {
  124. .name = "Hauppauge WinTV-HVR1500Q",
  125. .portc = CX23885_MPEG_DVB,
  126. },
  127. [CX23885_BOARD_HAUPPAUGE_HVR1500] = {
  128. .name = "Hauppauge WinTV-HVR1500",
  129. .portc = CX23885_MPEG_DVB,
  130. },
  131. [CX23885_BOARD_HAUPPAUGE_HVR1200] = {
  132. .name = "Hauppauge WinTV-HVR1200",
  133. .portc = CX23885_MPEG_DVB,
  134. },
  135. [CX23885_BOARD_HAUPPAUGE_HVR1700] = {
  136. .name = "Hauppauge WinTV-HVR1700",
  137. .portc = CX23885_MPEG_DVB,
  138. },
  139. [CX23885_BOARD_HAUPPAUGE_HVR1400] = {
  140. .name = "Hauppauge WinTV-HVR1400",
  141. .portc = CX23885_MPEG_DVB,
  142. },
  143. [CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP] = {
  144. .name = "DViCO FusionHDTV7 Dual Express",
  145. .portb = CX23885_MPEG_DVB,
  146. .portc = CX23885_MPEG_DVB,
  147. },
  148. [CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP] = {
  149. .name = "DViCO FusionHDTV DVB-T Dual Express",
  150. .portb = CX23885_MPEG_DVB,
  151. .portc = CX23885_MPEG_DVB,
  152. },
  153. [CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H] = {
  154. .name = "Leadtek Winfast PxDVR3200 H",
  155. .portc = CX23885_MPEG_DVB,
  156. },
  157. [CX23885_BOARD_COMPRO_VIDEOMATE_E650F] = {
  158. .name = "Compro VideoMate E650F",
  159. .portc = CX23885_MPEG_DVB,
  160. },
  161. [CX23885_BOARD_TBS_6920] = {
  162. .name = "TurboSight TBS 6920",
  163. .portb = CX23885_MPEG_DVB,
  164. },
  165. [CX23885_BOARD_TEVII_S470] = {
  166. .name = "TeVii S470",
  167. .portb = CX23885_MPEG_DVB,
  168. },
  169. [CX23885_BOARD_DVBWORLD_2005] = {
  170. .name = "DVBWorld DVB-S2 2005",
  171. .portb = CX23885_MPEG_DVB,
  172. },
  173. };
  174. const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
  175. /* ------------------------------------------------------------------ */
  176. /* PCI subsystem IDs */
  177. struct cx23885_subid cx23885_subids[] = {
  178. {
  179. .subvendor = 0x0070,
  180. .subdevice = 0x3400,
  181. .card = CX23885_BOARD_UNKNOWN,
  182. }, {
  183. .subvendor = 0x0070,
  184. .subdevice = 0x7600,
  185. .card = CX23885_BOARD_HAUPPAUGE_HVR1800lp,
  186. }, {
  187. .subvendor = 0x0070,
  188. .subdevice = 0x7800,
  189. .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
  190. }, {
  191. .subvendor = 0x0070,
  192. .subdevice = 0x7801,
  193. .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
  194. }, {
  195. .subvendor = 0x0070,
  196. .subdevice = 0x7809,
  197. .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
  198. }, {
  199. .subvendor = 0x0070,
  200. .subdevice = 0x7911,
  201. .card = CX23885_BOARD_HAUPPAUGE_HVR1250,
  202. }, {
  203. .subvendor = 0x18ac,
  204. .subdevice = 0xd500,
  205. .card = CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP,
  206. }, {
  207. .subvendor = 0x0070,
  208. .subdevice = 0x7790,
  209. .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
  210. }, {
  211. .subvendor = 0x0070,
  212. .subdevice = 0x7797,
  213. .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
  214. }, {
  215. .subvendor = 0x0070,
  216. .subdevice = 0x7710,
  217. .card = CX23885_BOARD_HAUPPAUGE_HVR1500,
  218. }, {
  219. .subvendor = 0x0070,
  220. .subdevice = 0x7717,
  221. .card = CX23885_BOARD_HAUPPAUGE_HVR1500,
  222. }, {
  223. .subvendor = 0x0070,
  224. .subdevice = 0x71d1,
  225. .card = CX23885_BOARD_HAUPPAUGE_HVR1200,
  226. }, {
  227. .subvendor = 0x0070,
  228. .subdevice = 0x71d3,
  229. .card = CX23885_BOARD_HAUPPAUGE_HVR1200,
  230. }, {
  231. .subvendor = 0x0070,
  232. .subdevice = 0x8101,
  233. .card = CX23885_BOARD_HAUPPAUGE_HVR1700,
  234. }, {
  235. .subvendor = 0x0070,
  236. .subdevice = 0x8010,
  237. .card = CX23885_BOARD_HAUPPAUGE_HVR1400,
  238. }, {
  239. .subvendor = 0x18ac,
  240. .subdevice = 0xd618,
  241. .card = CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP,
  242. }, {
  243. .subvendor = 0x18ac,
  244. .subdevice = 0xdb78,
  245. .card = CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP,
  246. }, {
  247. .subvendor = 0x107d,
  248. .subdevice = 0x6681,
  249. .card = CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H,
  250. }, {
  251. .subvendor = 0x185b,
  252. .subdevice = 0xe800,
  253. .card = CX23885_BOARD_COMPRO_VIDEOMATE_E650F,
  254. }, {
  255. .subvendor = 0x6920,
  256. .subdevice = 0x8888,
  257. .card = CX23885_BOARD_TBS_6920,
  258. }, {
  259. .subvendor = 0xd470,
  260. .subdevice = 0x9022,
  261. .card = CX23885_BOARD_TEVII_S470,
  262. }, {
  263. .subvendor = 0x0001,
  264. .subdevice = 0x2005,
  265. .card = CX23885_BOARD_DVBWORLD_2005,
  266. },
  267. };
  268. const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
  269. void cx23885_card_list(struct cx23885_dev *dev)
  270. {
  271. int i;
  272. if (0 == dev->pci->subsystem_vendor &&
  273. 0 == dev->pci->subsystem_device) {
  274. printk(KERN_INFO
  275. "%s: Board has no valid PCIe Subsystem ID and can't\n"
  276. "%s: be autodetected. Pass card=<n> insmod option\n"
  277. "%s: to workaround that. Redirect complaints to the\n"
  278. "%s: vendor of the TV card. Best regards,\n"
  279. "%s: -- tux\n",
  280. dev->name, dev->name, dev->name, dev->name, dev->name);
  281. } else {
  282. printk(KERN_INFO
  283. "%s: Your board isn't known (yet) to the driver.\n"
  284. "%s: Try to pick one of the existing card configs via\n"
  285. "%s: card=<n> insmod option. Updating to the latest\n"
  286. "%s: version might help as well.\n",
  287. dev->name, dev->name, dev->name, dev->name);
  288. }
  289. printk(KERN_INFO "%s: Here is a list of valid choices for the card=<n> insmod option:\n",
  290. dev->name);
  291. for (i = 0; i < cx23885_bcount; i++)
  292. printk(KERN_INFO "%s: card=%d -> %s\n",
  293. dev->name, i, cx23885_boards[i].name);
  294. }
  295. static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
  296. {
  297. struct tveeprom tv;
  298. tveeprom_hauppauge_analog(&dev->i2c_bus[0].i2c_client, &tv,
  299. eeprom_data);
  300. /* Make sure we support the board model */
  301. switch (tv.model) {
  302. case 71009:
  303. /* WinTV-HVR1200 (PCIe, Retail, full height)
  304. * DVB-T and basic analog */
  305. case 71359:
  306. /* WinTV-HVR1200 (PCIe, OEM, half height)
  307. * DVB-T and basic analog */
  308. case 71439:
  309. /* WinTV-HVR1200 (PCIe, OEM, half height)
  310. * DVB-T and basic analog */
  311. case 71449:
  312. /* WinTV-HVR1200 (PCIe, OEM, full height)
  313. * DVB-T and basic analog */
  314. case 71939:
  315. /* WinTV-HVR1200 (PCIe, OEM, half height)
  316. * DVB-T and basic analog */
  317. case 71949:
  318. /* WinTV-HVR1200 (PCIe, OEM, full height)
  319. * DVB-T and basic analog */
  320. case 71959:
  321. /* WinTV-HVR1200 (PCIe, OEM, full height)
  322. * DVB-T and basic analog */
  323. case 71979:
  324. /* WinTV-HVR1200 (PCIe, OEM, half height)
  325. * DVB-T and basic analog */
  326. case 71999:
  327. /* WinTV-HVR1200 (PCIe, OEM, full height)
  328. * DVB-T and basic analog */
  329. case 76601:
  330. /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual
  331. channel ATSC and MPEG2 HW Encoder */
  332. case 77001:
  333. /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC
  334. and Basic analog */
  335. case 77011:
  336. /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC
  337. and Basic analog */
  338. case 77041:
  339. /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM
  340. and Basic analog */
  341. case 77051:
  342. /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM
  343. and Basic analog */
  344. case 78011:
  345. /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM,
  346. Dual channel ATSC and MPEG2 HW Encoder */
  347. case 78501:
  348. /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM,
  349. Dual channel ATSC and MPEG2 HW Encoder */
  350. case 78521:
  351. /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM,
  352. Dual channel ATSC and MPEG2 HW Encoder */
  353. case 78531:
  354. /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM,
  355. Dual channel ATSC and MPEG2 HW Encoder */
  356. case 78631:
  357. /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM,
  358. Dual channel ATSC and MPEG2 HW Encoder */
  359. case 79001:
  360. /* WinTV-HVR1250 (PCIe, Retail, IR, full height,
  361. ATSC and Basic analog */
  362. case 79101:
  363. /* WinTV-HVR1250 (PCIe, Retail, IR, half height,
  364. ATSC and Basic analog */
  365. case 79561:
  366. /* WinTV-HVR1250 (PCIe, OEM, No IR, half height,
  367. ATSC and Basic analog */
  368. case 79571:
  369. /* WinTV-HVR1250 (PCIe, OEM, No IR, full height,
  370. ATSC and Basic analog */
  371. case 79671:
  372. /* WinTV-HVR1250 (PCIe, OEM, No IR, half height,
  373. ATSC and Basic analog */
  374. case 80019:
  375. /* WinTV-HVR1400 (Express Card, Retail, IR,
  376. * DVB-T and Basic analog */
  377. case 81509:
  378. /* WinTV-HVR1700 (PCIe, OEM, No IR, half height)
  379. * DVB-T and MPEG2 HW Encoder */
  380. case 81519:
  381. /* WinTV-HVR1700 (PCIe, OEM, No IR, full height)
  382. * DVB-T and MPEG2 HW Encoder */
  383. break;
  384. default:
  385. printk(KERN_WARNING "%s: warning: unknown hauppauge model #%d\n",
  386. dev->name, tv.model);
  387. break;
  388. }
  389. printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n",
  390. dev->name, tv.model);
  391. }
  392. int cx23885_tuner_callback(void *priv, int component, int command, int arg)
  393. {
  394. struct cx23885_tsport *port = priv;
  395. struct cx23885_dev *dev = port->dev;
  396. u32 bitmask = 0;
  397. if (command == XC2028_RESET_CLK)
  398. return 0;
  399. if (command != 0) {
  400. printk(KERN_ERR "%s(): Unknown command 0x%x.\n",
  401. __func__, command);
  402. return -EINVAL;
  403. }
  404. switch (dev->board) {
  405. case CX23885_BOARD_HAUPPAUGE_HVR1400:
  406. case CX23885_BOARD_HAUPPAUGE_HVR1500:
  407. case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
  408. case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
  409. case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
  410. /* Tuner Reset Command */
  411. bitmask = 0x04;
  412. break;
  413. case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
  414. case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
  415. /* Two identical tuners on two different i2c buses,
  416. * we need to reset the correct gpio. */
  417. if (port->nr == 0)
  418. bitmask = 0x01;
  419. else if (port->nr == 1)
  420. bitmask = 0x04;
  421. break;
  422. }
  423. if (bitmask) {
  424. /* Drive the tuner into reset and back out */
  425. cx_clear(GP0_IO, bitmask);
  426. mdelay(200);
  427. cx_set(GP0_IO, bitmask);
  428. }
  429. return 0;
  430. }
  431. void cx23885_gpio_setup(struct cx23885_dev *dev)
  432. {
  433. switch (dev->board) {
  434. case CX23885_BOARD_HAUPPAUGE_HVR1250:
  435. /* GPIO-0 cx24227 demodulator reset */
  436. cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
  437. break;
  438. case CX23885_BOARD_HAUPPAUGE_HVR1500:
  439. /* GPIO-0 cx24227 demodulator */
  440. /* GPIO-2 xc3028 tuner */
  441. /* Put the parts into reset */
  442. cx_set(GP0_IO, 0x00050000);
  443. cx_clear(GP0_IO, 0x00000005);
  444. msleep(5);
  445. /* Bring the parts out of reset */
  446. cx_set(GP0_IO, 0x00050005);
  447. break;
  448. case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
  449. /* GPIO-0 cx24227 demodulator reset */
  450. /* GPIO-2 xc5000 tuner reset */
  451. cx_set(GP0_IO, 0x00050005); /* Bring the part out of reset */
  452. break;
  453. case CX23885_BOARD_HAUPPAUGE_HVR1800:
  454. /* GPIO-0 656_CLK */
  455. /* GPIO-1 656_D0 */
  456. /* GPIO-2 8295A Reset */
  457. /* GPIO-3-10 cx23417 data0-7 */
  458. /* GPIO-11-14 cx23417 addr0-3 */
  459. /* GPIO-15-18 cx23417 READY, CS, RD, WR */
  460. /* GPIO-19 IR_RX */
  461. /* CX23417 GPIO's */
  462. /* EIO15 Zilog Reset */
  463. /* EIO14 S5H1409/CX24227 Reset */
  464. /* Force the TDA8295A into reset and back */
  465. cx_set(GP0_IO, 0x00040004);
  466. mdelay(20);
  467. cx_clear(GP0_IO, 0x00000004);
  468. mdelay(20);
  469. cx_set(GP0_IO, 0x00040004);
  470. mdelay(20);
  471. break;
  472. case CX23885_BOARD_HAUPPAUGE_HVR1200:
  473. /* GPIO-0 tda10048 demodulator reset */
  474. /* GPIO-2 tda18271 tuner reset */
  475. /* Put the parts into reset and back */
  476. cx_set(GP0_IO, 0x00050000);
  477. mdelay(20);
  478. cx_clear(GP0_IO, 0x00000005);
  479. mdelay(20);
  480. cx_set(GP0_IO, 0x00050005);
  481. break;
  482. case CX23885_BOARD_HAUPPAUGE_HVR1700:
  483. /* GPIO-0 TDA10048 demodulator reset */
  484. /* GPIO-2 TDA8295A Reset */
  485. /* GPIO-3-10 cx23417 data0-7 */
  486. /* GPIO-11-14 cx23417 addr0-3 */
  487. /* GPIO-15-18 cx23417 READY, CS, RD, WR */
  488. /* The following GPIO's are on the interna AVCore (cx25840) */
  489. /* GPIO-19 IR_RX */
  490. /* GPIO-20 IR_TX 416/DVBT Select */
  491. /* GPIO-21 IIS DAT */
  492. /* GPIO-22 IIS WCLK */
  493. /* GPIO-23 IIS BCLK */
  494. /* Put the parts into reset and back */
  495. cx_set(GP0_IO, 0x00050000);
  496. mdelay(20);
  497. cx_clear(GP0_IO, 0x00000005);
  498. mdelay(20);
  499. cx_set(GP0_IO, 0x00050005);
  500. break;
  501. case CX23885_BOARD_HAUPPAUGE_HVR1400:
  502. /* GPIO-0 Dibcom7000p demodulator reset */
  503. /* GPIO-2 xc3028L tuner reset */
  504. /* GPIO-13 LED */
  505. /* Put the parts into reset and back */
  506. cx_set(GP0_IO, 0x00050000);
  507. mdelay(20);
  508. cx_clear(GP0_IO, 0x00000005);
  509. mdelay(20);
  510. cx_set(GP0_IO, 0x00050005);
  511. break;
  512. case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
  513. /* GPIO-0 xc5000 tuner reset i2c bus 0 */
  514. /* GPIO-1 s5h1409 demod reset i2c bus 0 */
  515. /* GPIO-2 xc5000 tuner reset i2c bus 1 */
  516. /* GPIO-3 s5h1409 demod reset i2c bus 0 */
  517. /* Put the parts into reset and back */
  518. cx_set(GP0_IO, 0x000f0000);
  519. mdelay(20);
  520. cx_clear(GP0_IO, 0x0000000f);
  521. mdelay(20);
  522. cx_set(GP0_IO, 0x000f000f);
  523. break;
  524. case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
  525. /* GPIO-0 portb xc3028 reset */
  526. /* GPIO-1 portb zl10353 reset */
  527. /* GPIO-2 portc xc3028 reset */
  528. /* GPIO-3 portc zl10353 reset */
  529. /* Put the parts into reset and back */
  530. cx_set(GP0_IO, 0x000f0000);
  531. mdelay(20);
  532. cx_clear(GP0_IO, 0x0000000f);
  533. mdelay(20);
  534. cx_set(GP0_IO, 0x000f000f);
  535. break;
  536. case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
  537. case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
  538. /* GPIO-2 xc3028 tuner reset */
  539. /* The following GPIO's are on the internal AVCore (cx25840) */
  540. /* GPIO-? zl10353 demod reset */
  541. /* Put the parts into reset and back */
  542. cx_set(GP0_IO, 0x00040000);
  543. mdelay(20);
  544. cx_clear(GP0_IO, 0x00000004);
  545. mdelay(20);
  546. cx_set(GP0_IO, 0x00040004);
  547. break;
  548. case CX23885_BOARD_TBS_6920:
  549. case CX23885_BOARD_TEVII_S470:
  550. cx_write(MC417_CTL, 0x00000036);
  551. cx_write(MC417_OEN, 0x00001000);
  552. cx_write(MC417_RWD, 0x00001800);
  553. break;
  554. }
  555. }
  556. int cx23885_ir_init(struct cx23885_dev *dev)
  557. {
  558. switch (dev->board) {
  559. case CX23885_BOARD_HAUPPAUGE_HVR1250:
  560. case CX23885_BOARD_HAUPPAUGE_HVR1500:
  561. case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
  562. case CX23885_BOARD_HAUPPAUGE_HVR1800:
  563. case CX23885_BOARD_HAUPPAUGE_HVR1200:
  564. case CX23885_BOARD_HAUPPAUGE_HVR1400:
  565. /* FIXME: Implement me */
  566. break;
  567. case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
  568. request_module("ir-kbd-i2c");
  569. break;
  570. }
  571. return 0;
  572. }
  573. void cx23885_card_setup(struct cx23885_dev *dev)
  574. {
  575. struct cx23885_tsport *ts1 = &dev->ts1;
  576. struct cx23885_tsport *ts2 = &dev->ts2;
  577. static u8 eeprom[256];
  578. if (dev->i2c_bus[0].i2c_rc == 0) {
  579. dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1;
  580. tveeprom_read(&dev->i2c_bus[0].i2c_client,
  581. eeprom, sizeof(eeprom));
  582. }
  583. switch (dev->board) {
  584. case CX23885_BOARD_HAUPPAUGE_HVR1250:
  585. case CX23885_BOARD_HAUPPAUGE_HVR1500:
  586. case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
  587. case CX23885_BOARD_HAUPPAUGE_HVR1400:
  588. if (dev->i2c_bus[0].i2c_rc == 0)
  589. hauppauge_eeprom(dev, eeprom+0x80);
  590. break;
  591. case CX23885_BOARD_HAUPPAUGE_HVR1800:
  592. case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
  593. case CX23885_BOARD_HAUPPAUGE_HVR1200:
  594. case CX23885_BOARD_HAUPPAUGE_HVR1700:
  595. if (dev->i2c_bus[0].i2c_rc == 0)
  596. hauppauge_eeprom(dev, eeprom+0xc0);
  597. break;
  598. }
  599. switch (dev->board) {
  600. case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
  601. case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
  602. ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
  603. ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  604. ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  605. /* break omitted intentionally */
  606. case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP:
  607. ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
  608. ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  609. ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  610. break;
  611. case CX23885_BOARD_HAUPPAUGE_HVR1800:
  612. /* Defaults for VID B - Analog encoder */
  613. /* DREQ_POL, SMODE, PUNC_CLK, MCLK_POL Serial bus + punc clk */
  614. ts1->gen_ctrl_val = 0x10e;
  615. ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  616. ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  617. /* APB_TSVALERR_POL (active low)*/
  618. ts1->vld_misc_val = 0x2000;
  619. ts1->hw_sop_ctrl_val = (0x47 << 16 | 188 << 4 | 0xc);
  620. /* Defaults for VID C */
  621. ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
  622. ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  623. ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  624. break;
  625. case CX23885_BOARD_TEVII_S470:
  626. case CX23885_BOARD_TBS_6920:
  627. case CX23885_BOARD_DVBWORLD_2005:
  628. ts1->gen_ctrl_val = 0x5; /* Parallel */
  629. ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  630. ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  631. break;
  632. case CX23885_BOARD_HAUPPAUGE_HVR1250:
  633. case CX23885_BOARD_HAUPPAUGE_HVR1500:
  634. case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
  635. case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
  636. case CX23885_BOARD_HAUPPAUGE_HVR1200:
  637. case CX23885_BOARD_HAUPPAUGE_HVR1700:
  638. case CX23885_BOARD_HAUPPAUGE_HVR1400:
  639. case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
  640. case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
  641. default:
  642. ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
  643. ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
  644. ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
  645. }
  646. /* Certain boards support analog, or require the avcore to be
  647. * loaded, ensure this happens.
  648. */
  649. switch (dev->board) {
  650. case CX23885_BOARD_HAUPPAUGE_HVR1800:
  651. case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
  652. case CX23885_BOARD_HAUPPAUGE_HVR1700:
  653. case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
  654. case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
  655. request_module("cx25840");
  656. break;
  657. }
  658. }
  659. /* ------------------------------------------------------------------ */