cx88-core.c 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091
  1. /*
  2. *
  3. * device driver for Conexant 2388x based TV cards
  4. * driver core
  5. *
  6. * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
  7. *
  8. * (c) 2005-2006 Mauro Carvalho Chehab <mchehab@infradead.org>
  9. * - Multituner support
  10. * - video_ioctl2 conversion
  11. * - PAL/M fixes
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation; either version 2 of the License, or
  16. * (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  26. */
  27. #include <linux/init.h>
  28. #include <linux/list.h>
  29. #include <linux/module.h>
  30. #include <linux/kernel.h>
  31. #include <linux/slab.h>
  32. #include <linux/kmod.h>
  33. #include <linux/sound.h>
  34. #include <linux/interrupt.h>
  35. #include <linux/pci.h>
  36. #include <linux/delay.h>
  37. #include <linux/videodev2.h>
  38. #include <linux/mutex.h>
  39. #include "cx88.h"
  40. #include <media/v4l2-common.h>
  41. #include <media/v4l2-ioctl.h>
  42. MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards");
  43. MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
  44. MODULE_LICENSE("GPL");
  45. /* ------------------------------------------------------------------ */
  46. unsigned int cx88_core_debug;
  47. module_param_named(core_debug, cx88_core_debug, int, 0644);
  48. MODULE_PARM_DESC(core_debug, "enable debug messages [core]");
  49. static unsigned int nicam;
  50. module_param(nicam,int,0644);
  51. MODULE_PARM_DESC(nicam,"tv audio is nicam");
  52. static unsigned int nocomb;
  53. module_param(nocomb,int,0644);
  54. MODULE_PARM_DESC(nocomb,"disable comb filter");
  55. #define dprintk(level,fmt, arg...) do { \
  56. if (cx88_core_debug >= level) \
  57. printk(KERN_DEBUG "%s: " fmt, core->name , ## arg); \
  58. } while(0)
  59. static unsigned int cx88_devcount;
  60. static LIST_HEAD(cx88_devlist);
  61. static DEFINE_MUTEX(devlist);
  62. #define NO_SYNC_LINE (-1U)
  63. /* @lpi: lines per IRQ, or 0 to not generate irqs. Note: IRQ to be
  64. generated _after_ lpi lines are transferred. */
  65. static __le32* cx88_risc_field(__le32 *rp, struct scatterlist *sglist,
  66. unsigned int offset, u32 sync_line,
  67. unsigned int bpl, unsigned int padding,
  68. unsigned int lines, unsigned int lpi, bool jump)
  69. {
  70. struct scatterlist *sg;
  71. unsigned int line,todo,sol;
  72. if (jump) {
  73. (*rp++) = cpu_to_le32(RISC_JUMP);
  74. (*rp++) = 0;
  75. }
  76. /* sync instruction */
  77. if (sync_line != NO_SYNC_LINE)
  78. *(rp++) = cpu_to_le32(RISC_RESYNC | sync_line);
  79. /* scan lines */
  80. sg = sglist;
  81. for (line = 0; line < lines; line++) {
  82. while (offset && offset >= sg_dma_len(sg)) {
  83. offset -= sg_dma_len(sg);
  84. sg = sg_next(sg);
  85. }
  86. if (lpi && line>0 && !(line % lpi))
  87. sol = RISC_SOL | RISC_IRQ1 | RISC_CNT_INC;
  88. else
  89. sol = RISC_SOL;
  90. if (bpl <= sg_dma_len(sg)-offset) {
  91. /* fits into current chunk */
  92. *(rp++)=cpu_to_le32(RISC_WRITE|sol|RISC_EOL|bpl);
  93. *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset);
  94. offset+=bpl;
  95. } else {
  96. /* scanline needs to be split */
  97. todo = bpl;
  98. *(rp++)=cpu_to_le32(RISC_WRITE|sol|
  99. (sg_dma_len(sg)-offset));
  100. *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset);
  101. todo -= (sg_dma_len(sg)-offset);
  102. offset = 0;
  103. sg = sg_next(sg);
  104. while (todo > sg_dma_len(sg)) {
  105. *(rp++)=cpu_to_le32(RISC_WRITE|
  106. sg_dma_len(sg));
  107. *(rp++)=cpu_to_le32(sg_dma_address(sg));
  108. todo -= sg_dma_len(sg);
  109. sg = sg_next(sg);
  110. }
  111. *(rp++)=cpu_to_le32(RISC_WRITE|RISC_EOL|todo);
  112. *(rp++)=cpu_to_le32(sg_dma_address(sg));
  113. offset += todo;
  114. }
  115. offset += padding;
  116. }
  117. return rp;
  118. }
  119. int cx88_risc_buffer(struct pci_dev *pci, struct cx88_riscmem *risc,
  120. struct scatterlist *sglist,
  121. unsigned int top_offset, unsigned int bottom_offset,
  122. unsigned int bpl, unsigned int padding, unsigned int lines)
  123. {
  124. u32 instructions,fields;
  125. __le32 *rp;
  126. fields = 0;
  127. if (UNSET != top_offset)
  128. fields++;
  129. if (UNSET != bottom_offset)
  130. fields++;
  131. /* estimate risc mem: worst case is one write per page border +
  132. one write per scan line + syncs + jump (all 2 dwords). Padding
  133. can cause next bpl to start close to a page border. First DMA
  134. region may be smaller than PAGE_SIZE */
  135. instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines);
  136. instructions += 4;
  137. risc->size = instructions * 8;
  138. risc->dma = 0;
  139. risc->cpu = pci_zalloc_consistent(pci, risc->size, &risc->dma);
  140. if (NULL == risc->cpu)
  141. return -ENOMEM;
  142. /* write risc instructions */
  143. rp = risc->cpu;
  144. if (UNSET != top_offset)
  145. rp = cx88_risc_field(rp, sglist, top_offset, 0,
  146. bpl, padding, lines, 0, true);
  147. if (UNSET != bottom_offset)
  148. rp = cx88_risc_field(rp, sglist, bottom_offset, 0x200,
  149. bpl, padding, lines, 0, top_offset == UNSET);
  150. /* save pointer to jmp instruction address */
  151. risc->jmp = rp;
  152. BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size);
  153. return 0;
  154. }
  155. int cx88_risc_databuffer(struct pci_dev *pci, struct cx88_riscmem *risc,
  156. struct scatterlist *sglist, unsigned int bpl,
  157. unsigned int lines, unsigned int lpi)
  158. {
  159. u32 instructions;
  160. __le32 *rp;
  161. /* estimate risc mem: worst case is one write per page border +
  162. one write per scan line + syncs + jump (all 2 dwords). Here
  163. there is no padding and no sync. First DMA region may be smaller
  164. than PAGE_SIZE */
  165. instructions = 1 + (bpl * lines) / PAGE_SIZE + lines;
  166. instructions += 3;
  167. risc->size = instructions * 8;
  168. risc->dma = 0;
  169. risc->cpu = pci_zalloc_consistent(pci, risc->size, &risc->dma);
  170. if (NULL == risc->cpu)
  171. return -ENOMEM;
  172. /* write risc instructions */
  173. rp = risc->cpu;
  174. rp = cx88_risc_field(rp, sglist, 0, NO_SYNC_LINE, bpl, 0, lines, lpi, !lpi);
  175. /* save pointer to jmp instruction address */
  176. risc->jmp = rp;
  177. BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size);
  178. return 0;
  179. }
  180. /* ------------------------------------------------------------------ */
  181. /* our SRAM memory layout */
  182. /* we are going to put all thr risc programs into host memory, so we
  183. * can use the whole SDRAM for the DMA fifos. To simplify things, we
  184. * use a static memory layout. That surely will waste memory in case
  185. * we don't use all DMA channels at the same time (which will be the
  186. * case most of the time). But that still gives us enough FIFO space
  187. * to be able to deal with insane long pci latencies ...
  188. *
  189. * FIFO space allocations:
  190. * channel 21 (y video) - 10.0k
  191. * channel 22 (u video) - 2.0k
  192. * channel 23 (v video) - 2.0k
  193. * channel 24 (vbi) - 4.0k
  194. * channels 25+26 (audio) - 4.0k
  195. * channel 28 (mpeg) - 4.0k
  196. * channel 27 (audio rds)- 3.0k
  197. * TOTAL = 29.0k
  198. *
  199. * Every channel has 160 bytes control data (64 bytes instruction
  200. * queue and 6 CDT entries), which is close to 2k total.
  201. *
  202. * Address layout:
  203. * 0x0000 - 0x03ff CMDs / reserved
  204. * 0x0400 - 0x0bff instruction queues + CDs
  205. * 0x0c00 - FIFOs
  206. */
  207. const struct sram_channel cx88_sram_channels[] = {
  208. [SRAM_CH21] = {
  209. .name = "video y / packed",
  210. .cmds_start = 0x180040,
  211. .ctrl_start = 0x180400,
  212. .cdt = 0x180400 + 64,
  213. .fifo_start = 0x180c00,
  214. .fifo_size = 0x002800,
  215. .ptr1_reg = MO_DMA21_PTR1,
  216. .ptr2_reg = MO_DMA21_PTR2,
  217. .cnt1_reg = MO_DMA21_CNT1,
  218. .cnt2_reg = MO_DMA21_CNT2,
  219. },
  220. [SRAM_CH22] = {
  221. .name = "video u",
  222. .cmds_start = 0x180080,
  223. .ctrl_start = 0x1804a0,
  224. .cdt = 0x1804a0 + 64,
  225. .fifo_start = 0x183400,
  226. .fifo_size = 0x000800,
  227. .ptr1_reg = MO_DMA22_PTR1,
  228. .ptr2_reg = MO_DMA22_PTR2,
  229. .cnt1_reg = MO_DMA22_CNT1,
  230. .cnt2_reg = MO_DMA22_CNT2,
  231. },
  232. [SRAM_CH23] = {
  233. .name = "video v",
  234. .cmds_start = 0x1800c0,
  235. .ctrl_start = 0x180540,
  236. .cdt = 0x180540 + 64,
  237. .fifo_start = 0x183c00,
  238. .fifo_size = 0x000800,
  239. .ptr1_reg = MO_DMA23_PTR1,
  240. .ptr2_reg = MO_DMA23_PTR2,
  241. .cnt1_reg = MO_DMA23_CNT1,
  242. .cnt2_reg = MO_DMA23_CNT2,
  243. },
  244. [SRAM_CH24] = {
  245. .name = "vbi",
  246. .cmds_start = 0x180100,
  247. .ctrl_start = 0x1805e0,
  248. .cdt = 0x1805e0 + 64,
  249. .fifo_start = 0x184400,
  250. .fifo_size = 0x001000,
  251. .ptr1_reg = MO_DMA24_PTR1,
  252. .ptr2_reg = MO_DMA24_PTR2,
  253. .cnt1_reg = MO_DMA24_CNT1,
  254. .cnt2_reg = MO_DMA24_CNT2,
  255. },
  256. [SRAM_CH25] = {
  257. .name = "audio from",
  258. .cmds_start = 0x180140,
  259. .ctrl_start = 0x180680,
  260. .cdt = 0x180680 + 64,
  261. .fifo_start = 0x185400,
  262. .fifo_size = 0x001000,
  263. .ptr1_reg = MO_DMA25_PTR1,
  264. .ptr2_reg = MO_DMA25_PTR2,
  265. .cnt1_reg = MO_DMA25_CNT1,
  266. .cnt2_reg = MO_DMA25_CNT2,
  267. },
  268. [SRAM_CH26] = {
  269. .name = "audio to",
  270. .cmds_start = 0x180180,
  271. .ctrl_start = 0x180720,
  272. .cdt = 0x180680 + 64, /* same as audio IN */
  273. .fifo_start = 0x185400, /* same as audio IN */
  274. .fifo_size = 0x001000, /* same as audio IN */
  275. .ptr1_reg = MO_DMA26_PTR1,
  276. .ptr2_reg = MO_DMA26_PTR2,
  277. .cnt1_reg = MO_DMA26_CNT1,
  278. .cnt2_reg = MO_DMA26_CNT2,
  279. },
  280. [SRAM_CH28] = {
  281. .name = "mpeg",
  282. .cmds_start = 0x180200,
  283. .ctrl_start = 0x1807C0,
  284. .cdt = 0x1807C0 + 64,
  285. .fifo_start = 0x186400,
  286. .fifo_size = 0x001000,
  287. .ptr1_reg = MO_DMA28_PTR1,
  288. .ptr2_reg = MO_DMA28_PTR2,
  289. .cnt1_reg = MO_DMA28_CNT1,
  290. .cnt2_reg = MO_DMA28_CNT2,
  291. },
  292. [SRAM_CH27] = {
  293. .name = "audio rds",
  294. .cmds_start = 0x1801C0,
  295. .ctrl_start = 0x180860,
  296. .cdt = 0x180860 + 64,
  297. .fifo_start = 0x187400,
  298. .fifo_size = 0x000C00,
  299. .ptr1_reg = MO_DMA27_PTR1,
  300. .ptr2_reg = MO_DMA27_PTR2,
  301. .cnt1_reg = MO_DMA27_CNT1,
  302. .cnt2_reg = MO_DMA27_CNT2,
  303. },
  304. };
  305. int cx88_sram_channel_setup(struct cx88_core *core,
  306. const struct sram_channel *ch,
  307. unsigned int bpl, u32 risc)
  308. {
  309. unsigned int i,lines;
  310. u32 cdt;
  311. bpl = (bpl + 7) & ~7; /* alignment */
  312. cdt = ch->cdt;
  313. lines = ch->fifo_size / bpl;
  314. if (lines > 6)
  315. lines = 6;
  316. BUG_ON(lines < 2);
  317. /* write CDT */
  318. for (i = 0; i < lines; i++)
  319. cx_write(cdt + 16*i, ch->fifo_start + bpl*i);
  320. /* write CMDS */
  321. cx_write(ch->cmds_start + 0, risc);
  322. cx_write(ch->cmds_start + 4, cdt);
  323. cx_write(ch->cmds_start + 8, (lines*16) >> 3);
  324. cx_write(ch->cmds_start + 12, ch->ctrl_start);
  325. cx_write(ch->cmds_start + 16, 64 >> 2);
  326. for (i = 20; i < 64; i += 4)
  327. cx_write(ch->cmds_start + i, 0);
  328. /* fill registers */
  329. cx_write(ch->ptr1_reg, ch->fifo_start);
  330. cx_write(ch->ptr2_reg, cdt);
  331. cx_write(ch->cnt1_reg, (bpl >> 3) -1);
  332. cx_write(ch->cnt2_reg, (lines*16) >> 3);
  333. dprintk(2,"sram setup %s: bpl=%d lines=%d\n", ch->name, bpl, lines);
  334. return 0;
  335. }
  336. /* ------------------------------------------------------------------ */
  337. /* debug helper code */
  338. static int cx88_risc_decode(u32 risc)
  339. {
  340. static const char * const instr[16] = {
  341. [ RISC_SYNC >> 28 ] = "sync",
  342. [ RISC_WRITE >> 28 ] = "write",
  343. [ RISC_WRITEC >> 28 ] = "writec",
  344. [ RISC_READ >> 28 ] = "read",
  345. [ RISC_READC >> 28 ] = "readc",
  346. [ RISC_JUMP >> 28 ] = "jump",
  347. [ RISC_SKIP >> 28 ] = "skip",
  348. [ RISC_WRITERM >> 28 ] = "writerm",
  349. [ RISC_WRITECM >> 28 ] = "writecm",
  350. [ RISC_WRITECR >> 28 ] = "writecr",
  351. };
  352. static int const incr[16] = {
  353. [ RISC_WRITE >> 28 ] = 2,
  354. [ RISC_JUMP >> 28 ] = 2,
  355. [ RISC_WRITERM >> 28 ] = 3,
  356. [ RISC_WRITECM >> 28 ] = 3,
  357. [ RISC_WRITECR >> 28 ] = 4,
  358. };
  359. static const char * const bits[] = {
  360. "12", "13", "14", "resync",
  361. "cnt0", "cnt1", "18", "19",
  362. "20", "21", "22", "23",
  363. "irq1", "irq2", "eol", "sol",
  364. };
  365. int i;
  366. printk("0x%08x [ %s", risc,
  367. instr[risc >> 28] ? instr[risc >> 28] : "INVALID");
  368. for (i = ARRAY_SIZE(bits)-1; i >= 0; i--)
  369. if (risc & (1 << (i + 12)))
  370. printk(" %s",bits[i]);
  371. printk(" count=%d ]\n", risc & 0xfff);
  372. return incr[risc >> 28] ? incr[risc >> 28] : 1;
  373. }
  374. void cx88_sram_channel_dump(struct cx88_core *core,
  375. const struct sram_channel *ch)
  376. {
  377. static const char * const name[] = {
  378. "initial risc",
  379. "cdt base",
  380. "cdt size",
  381. "iq base",
  382. "iq size",
  383. "risc pc",
  384. "iq wr ptr",
  385. "iq rd ptr",
  386. "cdt current",
  387. "pci target",
  388. "line / byte",
  389. };
  390. u32 risc;
  391. unsigned int i,j,n;
  392. printk("%s: %s - dma channel status dump\n",
  393. core->name,ch->name);
  394. for (i = 0; i < ARRAY_SIZE(name); i++)
  395. printk("%s: cmds: %-12s: 0x%08x\n",
  396. core->name,name[i],
  397. cx_read(ch->cmds_start + 4*i));
  398. for (n = 1, i = 0; i < 4; i++) {
  399. risc = cx_read(ch->cmds_start + 4 * (i+11));
  400. printk("%s: risc%d: ", core->name, i);
  401. if (--n)
  402. printk("0x%08x [ arg #%d ]\n", risc, n);
  403. else
  404. n = cx88_risc_decode(risc);
  405. }
  406. for (i = 0; i < 16; i += n) {
  407. risc = cx_read(ch->ctrl_start + 4 * i);
  408. printk("%s: iq %x: ", core->name, i);
  409. n = cx88_risc_decode(risc);
  410. for (j = 1; j < n; j++) {
  411. risc = cx_read(ch->ctrl_start + 4 * (i+j));
  412. printk("%s: iq %x: 0x%08x [ arg #%d ]\n",
  413. core->name, i+j, risc, j);
  414. }
  415. }
  416. printk("%s: fifo: 0x%08x -> 0x%x\n",
  417. core->name, ch->fifo_start, ch->fifo_start+ch->fifo_size);
  418. printk("%s: ctrl: 0x%08x -> 0x%x\n",
  419. core->name, ch->ctrl_start, ch->ctrl_start+6*16);
  420. printk("%s: ptr1_reg: 0x%08x\n",
  421. core->name,cx_read(ch->ptr1_reg));
  422. printk("%s: ptr2_reg: 0x%08x\n",
  423. core->name,cx_read(ch->ptr2_reg));
  424. printk("%s: cnt1_reg: 0x%08x\n",
  425. core->name,cx_read(ch->cnt1_reg));
  426. printk("%s: cnt2_reg: 0x%08x\n",
  427. core->name,cx_read(ch->cnt2_reg));
  428. }
  429. static const char *cx88_pci_irqs[32] = {
  430. "vid", "aud", "ts", "vip", "hst", "5", "6", "tm1",
  431. "src_dma", "dst_dma", "risc_rd_err", "risc_wr_err",
  432. "brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err",
  433. "i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1"
  434. };
  435. void cx88_print_irqbits(const char *name, const char *tag, const char *strings[],
  436. int len, u32 bits, u32 mask)
  437. {
  438. unsigned int i;
  439. printk(KERN_DEBUG "%s: %s [0x%x]", name, tag, bits);
  440. for (i = 0; i < len; i++) {
  441. if (!(bits & (1 << i)))
  442. continue;
  443. if (strings[i])
  444. printk(" %s", strings[i]);
  445. else
  446. printk(" %d", i);
  447. if (!(mask & (1 << i)))
  448. continue;
  449. printk("*");
  450. }
  451. printk("\n");
  452. }
  453. /* ------------------------------------------------------------------ */
  454. int cx88_core_irq(struct cx88_core *core, u32 status)
  455. {
  456. int handled = 0;
  457. if (status & PCI_INT_IR_SMPINT) {
  458. cx88_ir_irq(core);
  459. handled++;
  460. }
  461. if (!handled)
  462. cx88_print_irqbits(core->name, "irq pci",
  463. cx88_pci_irqs, ARRAY_SIZE(cx88_pci_irqs),
  464. status, core->pci_irqmask);
  465. return handled;
  466. }
  467. void cx88_wakeup(struct cx88_core *core,
  468. struct cx88_dmaqueue *q, u32 count)
  469. {
  470. struct cx88_buffer *buf;
  471. buf = list_entry(q->active.next,
  472. struct cx88_buffer, list);
  473. v4l2_get_timestamp(&buf->vb.timestamp);
  474. buf->vb.field = core->field;
  475. buf->vb.sequence = q->count++;
  476. list_del(&buf->list);
  477. vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
  478. }
  479. void cx88_shutdown(struct cx88_core *core)
  480. {
  481. /* disable RISC controller + IRQs */
  482. cx_write(MO_DEV_CNTRL2, 0);
  483. /* stop dma transfers */
  484. cx_write(MO_VID_DMACNTRL, 0x0);
  485. cx_write(MO_AUD_DMACNTRL, 0x0);
  486. cx_write(MO_TS_DMACNTRL, 0x0);
  487. cx_write(MO_VIP_DMACNTRL, 0x0);
  488. cx_write(MO_GPHST_DMACNTRL, 0x0);
  489. /* stop interrupts */
  490. cx_write(MO_PCI_INTMSK, 0x0);
  491. cx_write(MO_VID_INTMSK, 0x0);
  492. cx_write(MO_AUD_INTMSK, 0x0);
  493. cx_write(MO_TS_INTMSK, 0x0);
  494. cx_write(MO_VIP_INTMSK, 0x0);
  495. cx_write(MO_GPHST_INTMSK, 0x0);
  496. /* stop capturing */
  497. cx_write(VID_CAPTURE_CONTROL, 0);
  498. }
  499. int cx88_reset(struct cx88_core *core)
  500. {
  501. dprintk(1,"%s\n",__func__);
  502. cx88_shutdown(core);
  503. /* clear irq status */
  504. cx_write(MO_VID_INTSTAT, 0xFFFFFFFF); // Clear PIV int
  505. cx_write(MO_PCI_INTSTAT, 0xFFFFFFFF); // Clear PCI int
  506. cx_write(MO_INT1_STAT, 0xFFFFFFFF); // Clear RISC int
  507. /* wait a bit */
  508. msleep(100);
  509. /* init sram */
  510. cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH21], 720*4, 0);
  511. cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH22], 128, 0);
  512. cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH23], 128, 0);
  513. cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH24], 128, 0);
  514. cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH25], 128, 0);
  515. cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH26], 128, 0);
  516. cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH28], 188*4, 0);
  517. cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH27], 128, 0);
  518. /* misc init ... */
  519. cx_write(MO_INPUT_FORMAT, ((1 << 13) | // agc enable
  520. (1 << 12) | // agc gain
  521. (1 << 11) | // adaptibe agc
  522. (0 << 10) | // chroma agc
  523. (0 << 9) | // ckillen
  524. (7)));
  525. /* setup image format */
  526. cx_andor(MO_COLOR_CTRL, 0x4000, 0x4000);
  527. /* setup FIFO Thresholds */
  528. cx_write(MO_PDMA_STHRSH, 0x0807);
  529. cx_write(MO_PDMA_DTHRSH, 0x0807);
  530. /* fixes flashing of image */
  531. cx_write(MO_AGC_SYNC_TIP1, 0x0380000F);
  532. cx_write(MO_AGC_BACK_VBI, 0x00E00555);
  533. cx_write(MO_VID_INTSTAT, 0xFFFFFFFF); // Clear PIV int
  534. cx_write(MO_PCI_INTSTAT, 0xFFFFFFFF); // Clear PCI int
  535. cx_write(MO_INT1_STAT, 0xFFFFFFFF); // Clear RISC int
  536. /* Reset on-board parts */
  537. cx_write(MO_SRST_IO, 0);
  538. msleep(10);
  539. cx_write(MO_SRST_IO, 1);
  540. return 0;
  541. }
  542. /* ------------------------------------------------------------------ */
  543. static inline unsigned int norm_swidth(v4l2_std_id norm)
  544. {
  545. return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 754 : 922;
  546. }
  547. static inline unsigned int norm_hdelay(v4l2_std_id norm)
  548. {
  549. return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 135 : 186;
  550. }
  551. static inline unsigned int norm_vdelay(v4l2_std_id norm)
  552. {
  553. return (norm & V4L2_STD_625_50) ? 0x24 : 0x18;
  554. }
  555. static inline unsigned int norm_fsc8(v4l2_std_id norm)
  556. {
  557. if (norm & V4L2_STD_PAL_M)
  558. return 28604892; // 3.575611 MHz
  559. if (norm & (V4L2_STD_PAL_Nc))
  560. return 28656448; // 3.582056 MHz
  561. if (norm & V4L2_STD_NTSC) // All NTSC/M and variants
  562. return 28636360; // 3.57954545 MHz +/- 10 Hz
  563. /* SECAM have also different sub carrier for chroma,
  564. but step_db and step_dr, at cx88_set_tvnorm already handles that.
  565. The same FSC applies to PAL/BGDKIH, PAL/60, NTSC/4.43 and PAL/N
  566. */
  567. return 35468950; // 4.43361875 MHz +/- 5 Hz
  568. }
  569. static inline unsigned int norm_htotal(v4l2_std_id norm)
  570. {
  571. unsigned int fsc4=norm_fsc8(norm)/2;
  572. /* returns 4*FSC / vtotal / frames per seconds */
  573. return (norm & V4L2_STD_625_50) ?
  574. ((fsc4+312)/625+12)/25 :
  575. ((fsc4+262)/525*1001+15000)/30000;
  576. }
  577. static inline unsigned int norm_vbipack(v4l2_std_id norm)
  578. {
  579. return (norm & V4L2_STD_625_50) ? 511 : 400;
  580. }
  581. int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int height,
  582. enum v4l2_field field)
  583. {
  584. unsigned int swidth = norm_swidth(core->tvnorm);
  585. unsigned int sheight = norm_maxh(core->tvnorm);
  586. u32 value;
  587. dprintk(1,"set_scale: %dx%d [%s%s,%s]\n", width, height,
  588. V4L2_FIELD_HAS_TOP(field) ? "T" : "",
  589. V4L2_FIELD_HAS_BOTTOM(field) ? "B" : "",
  590. v4l2_norm_to_name(core->tvnorm));
  591. if (!V4L2_FIELD_HAS_BOTH(field))
  592. height *= 2;
  593. // recalc H delay and scale registers
  594. value = (width * norm_hdelay(core->tvnorm)) / swidth;
  595. value &= 0x3fe;
  596. cx_write(MO_HDELAY_EVEN, value);
  597. cx_write(MO_HDELAY_ODD, value);
  598. dprintk(1,"set_scale: hdelay 0x%04x (width %d)\n", value,swidth);
  599. value = (swidth * 4096 / width) - 4096;
  600. cx_write(MO_HSCALE_EVEN, value);
  601. cx_write(MO_HSCALE_ODD, value);
  602. dprintk(1,"set_scale: hscale 0x%04x\n", value);
  603. cx_write(MO_HACTIVE_EVEN, width);
  604. cx_write(MO_HACTIVE_ODD, width);
  605. dprintk(1,"set_scale: hactive 0x%04x\n", width);
  606. // recalc V scale Register (delay is constant)
  607. cx_write(MO_VDELAY_EVEN, norm_vdelay(core->tvnorm));
  608. cx_write(MO_VDELAY_ODD, norm_vdelay(core->tvnorm));
  609. dprintk(1,"set_scale: vdelay 0x%04x\n", norm_vdelay(core->tvnorm));
  610. value = (0x10000 - (sheight * 512 / height - 512)) & 0x1fff;
  611. cx_write(MO_VSCALE_EVEN, value);
  612. cx_write(MO_VSCALE_ODD, value);
  613. dprintk(1,"set_scale: vscale 0x%04x\n", value);
  614. cx_write(MO_VACTIVE_EVEN, sheight);
  615. cx_write(MO_VACTIVE_ODD, sheight);
  616. dprintk(1,"set_scale: vactive 0x%04x\n", sheight);
  617. // setup filters
  618. value = 0;
  619. value |= (1 << 19); // CFILT (default)
  620. if (core->tvnorm & V4L2_STD_SECAM) {
  621. value |= (1 << 15);
  622. value |= (1 << 16);
  623. }
  624. if (INPUT(core->input).type == CX88_VMUX_SVIDEO)
  625. value |= (1 << 13) | (1 << 5);
  626. if (V4L2_FIELD_INTERLACED == field)
  627. value |= (1 << 3); // VINT (interlaced vertical scaling)
  628. if (width < 385)
  629. value |= (1 << 0); // 3-tap interpolation
  630. if (width < 193)
  631. value |= (1 << 1); // 5-tap interpolation
  632. if (nocomb)
  633. value |= (3 << 5); // disable comb filter
  634. cx_andor(MO_FILTER_EVEN, 0x7ffc7f, value); /* preserve PEAKEN, PSEL */
  635. cx_andor(MO_FILTER_ODD, 0x7ffc7f, value);
  636. dprintk(1,"set_scale: filter 0x%04x\n", value);
  637. return 0;
  638. }
  639. static const u32 xtal = 28636363;
  640. static int set_pll(struct cx88_core *core, int prescale, u32 ofreq)
  641. {
  642. static const u32 pre[] = { 0, 0, 0, 3, 2, 1 };
  643. u64 pll;
  644. u32 reg;
  645. int i;
  646. if (prescale < 2)
  647. prescale = 2;
  648. if (prescale > 5)
  649. prescale = 5;
  650. pll = ofreq * 8 * prescale * (u64)(1 << 20);
  651. do_div(pll,xtal);
  652. reg = (pll & 0x3ffffff) | (pre[prescale] << 26);
  653. if (((reg >> 20) & 0x3f) < 14) {
  654. printk("%s/0: pll out of range\n",core->name);
  655. return -1;
  656. }
  657. dprintk(1,"set_pll: MO_PLL_REG 0x%08x [old=0x%08x,freq=%d]\n",
  658. reg, cx_read(MO_PLL_REG), ofreq);
  659. cx_write(MO_PLL_REG, reg);
  660. for (i = 0; i < 100; i++) {
  661. reg = cx_read(MO_DEVICE_STATUS);
  662. if (reg & (1<<2)) {
  663. dprintk(1,"pll locked [pre=%d,ofreq=%d]\n",
  664. prescale,ofreq);
  665. return 0;
  666. }
  667. dprintk(1,"pll not locked yet, waiting ...\n");
  668. msleep(10);
  669. }
  670. dprintk(1,"pll NOT locked [pre=%d,ofreq=%d]\n",prescale,ofreq);
  671. return -1;
  672. }
  673. int cx88_start_audio_dma(struct cx88_core *core)
  674. {
  675. /* constant 128 made buzz in analog Nicam-stereo for bigger fifo_size */
  676. int bpl = cx88_sram_channels[SRAM_CH25].fifo_size/4;
  677. int rds_bpl = cx88_sram_channels[SRAM_CH27].fifo_size/AUD_RDS_LINES;
  678. /* If downstream RISC is enabled, bail out; ALSA is managing DMA */
  679. if (cx_read(MO_AUD_DMACNTRL) & 0x10)
  680. return 0;
  681. /* setup fifo + format */
  682. cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH25], bpl, 0);
  683. cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH26], bpl, 0);
  684. cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH27],
  685. rds_bpl, 0);
  686. cx_write(MO_AUDD_LNGTH, bpl); /* fifo bpl size */
  687. cx_write(MO_AUDR_LNGTH, rds_bpl); /* fifo bpl size */
  688. /* enable Up, Down and Audio RDS fifo */
  689. cx_write(MO_AUD_DMACNTRL, 0x0007);
  690. return 0;
  691. }
  692. int cx88_stop_audio_dma(struct cx88_core *core)
  693. {
  694. /* If downstream RISC is enabled, bail out; ALSA is managing DMA */
  695. if (cx_read(MO_AUD_DMACNTRL) & 0x10)
  696. return 0;
  697. /* stop dma */
  698. cx_write(MO_AUD_DMACNTRL, 0x0000);
  699. return 0;
  700. }
  701. static int set_tvaudio(struct cx88_core *core)
  702. {
  703. v4l2_std_id norm = core->tvnorm;
  704. if (CX88_VMUX_TELEVISION != INPUT(core->input).type &&
  705. CX88_VMUX_CABLE != INPUT(core->input).type)
  706. return 0;
  707. if (V4L2_STD_PAL_BG & norm) {
  708. core->tvaudio = WW_BG;
  709. } else if (V4L2_STD_PAL_DK & norm) {
  710. core->tvaudio = WW_DK;
  711. } else if (V4L2_STD_PAL_I & norm) {
  712. core->tvaudio = WW_I;
  713. } else if (V4L2_STD_SECAM_L & norm) {
  714. core->tvaudio = WW_L;
  715. } else if ((V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H) & norm) {
  716. core->tvaudio = WW_BG;
  717. } else if (V4L2_STD_SECAM_DK & norm) {
  718. core->tvaudio = WW_DK;
  719. } else if ((V4L2_STD_NTSC_M & norm) ||
  720. (V4L2_STD_PAL_M & norm)) {
  721. core->tvaudio = WW_BTSC;
  722. } else if (V4L2_STD_NTSC_M_JP & norm) {
  723. core->tvaudio = WW_EIAJ;
  724. } else {
  725. printk("%s/0: tvaudio support needs work for this tv norm [%s], sorry\n",
  726. core->name, v4l2_norm_to_name(core->tvnorm));
  727. core->tvaudio = WW_NONE;
  728. return 0;
  729. }
  730. cx_andor(MO_AFECFG_IO, 0x1f, 0x0);
  731. cx88_set_tvaudio(core);
  732. /* cx88_set_stereo(dev,V4L2_TUNER_MODE_STEREO); */
  733. /*
  734. This should be needed only on cx88-alsa. It seems that some cx88 chips have
  735. bugs and does require DMA enabled for it to work.
  736. */
  737. cx88_start_audio_dma(core);
  738. return 0;
  739. }
  740. int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm)
  741. {
  742. u32 fsc8;
  743. u32 adc_clock;
  744. u32 vdec_clock;
  745. u32 step_db,step_dr;
  746. u64 tmp64;
  747. u32 bdelay,agcdelay,htotal;
  748. u32 cxiformat, cxoformat;
  749. if (norm == core->tvnorm)
  750. return 0;
  751. if (core->v4ldev && (vb2_is_busy(&core->v4ldev->vb2_vidq) ||
  752. vb2_is_busy(&core->v4ldev->vb2_vbiq)))
  753. return -EBUSY;
  754. if (core->dvbdev && vb2_is_busy(&core->dvbdev->vb2_mpegq))
  755. return -EBUSY;
  756. core->tvnorm = norm;
  757. fsc8 = norm_fsc8(norm);
  758. adc_clock = xtal;
  759. vdec_clock = fsc8;
  760. step_db = fsc8;
  761. step_dr = fsc8;
  762. if (norm & V4L2_STD_NTSC_M_JP) {
  763. cxiformat = VideoFormatNTSCJapan;
  764. cxoformat = 0x181f0008;
  765. } else if (norm & V4L2_STD_NTSC_443) {
  766. cxiformat = VideoFormatNTSC443;
  767. cxoformat = 0x181f0008;
  768. } else if (norm & V4L2_STD_PAL_M) {
  769. cxiformat = VideoFormatPALM;
  770. cxoformat = 0x1c1f0008;
  771. } else if (norm & V4L2_STD_PAL_N) {
  772. cxiformat = VideoFormatPALN;
  773. cxoformat = 0x1c1f0008;
  774. } else if (norm & V4L2_STD_PAL_Nc) {
  775. cxiformat = VideoFormatPALNC;
  776. cxoformat = 0x1c1f0008;
  777. } else if (norm & V4L2_STD_PAL_60) {
  778. cxiformat = VideoFormatPAL60;
  779. cxoformat = 0x181f0008;
  780. } else if (norm & V4L2_STD_NTSC) {
  781. cxiformat = VideoFormatNTSC;
  782. cxoformat = 0x181f0008;
  783. } else if (norm & V4L2_STD_SECAM) {
  784. step_db = 4250000 * 8;
  785. step_dr = 4406250 * 8;
  786. cxiformat = VideoFormatSECAM;
  787. cxoformat = 0x181f0008;
  788. } else { /* PAL */
  789. cxiformat = VideoFormatPAL;
  790. cxoformat = 0x181f0008;
  791. }
  792. dprintk(1,"set_tvnorm: \"%s\" fsc8=%d adc=%d vdec=%d db/dr=%d/%d\n",
  793. v4l2_norm_to_name(core->tvnorm), fsc8, adc_clock, vdec_clock,
  794. step_db, step_dr);
  795. set_pll(core,2,vdec_clock);
  796. dprintk(1,"set_tvnorm: MO_INPUT_FORMAT 0x%08x [old=0x%08x]\n",
  797. cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f);
  798. /* Chroma AGC must be disabled if SECAM is used, we enable it
  799. by default on PAL and NTSC */
  800. cx_andor(MO_INPUT_FORMAT, 0x40f,
  801. norm & V4L2_STD_SECAM ? cxiformat : cxiformat | 0x400);
  802. // FIXME: as-is from DScaler
  803. dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n",
  804. cxoformat, cx_read(MO_OUTPUT_FORMAT));
  805. cx_write(MO_OUTPUT_FORMAT, cxoformat);
  806. // MO_SCONV_REG = adc clock / video dec clock * 2^17
  807. tmp64 = adc_clock * (u64)(1 << 17);
  808. do_div(tmp64, vdec_clock);
  809. dprintk(1,"set_tvnorm: MO_SCONV_REG 0x%08x [old=0x%08x]\n",
  810. (u32)tmp64, cx_read(MO_SCONV_REG));
  811. cx_write(MO_SCONV_REG, (u32)tmp64);
  812. // MO_SUB_STEP = 8 * fsc / video dec clock * 2^22
  813. tmp64 = step_db * (u64)(1 << 22);
  814. do_div(tmp64, vdec_clock);
  815. dprintk(1,"set_tvnorm: MO_SUB_STEP 0x%08x [old=0x%08x]\n",
  816. (u32)tmp64, cx_read(MO_SUB_STEP));
  817. cx_write(MO_SUB_STEP, (u32)tmp64);
  818. // MO_SUB_STEP_DR = 8 * 4406250 / video dec clock * 2^22
  819. tmp64 = step_dr * (u64)(1 << 22);
  820. do_div(tmp64, vdec_clock);
  821. dprintk(1,"set_tvnorm: MO_SUB_STEP_DR 0x%08x [old=0x%08x]\n",
  822. (u32)tmp64, cx_read(MO_SUB_STEP_DR));
  823. cx_write(MO_SUB_STEP_DR, (u32)tmp64);
  824. // bdelay + agcdelay
  825. bdelay = vdec_clock * 65 / 20000000 + 21;
  826. agcdelay = vdec_clock * 68 / 20000000 + 15;
  827. dprintk(1,"set_tvnorm: MO_AGC_BURST 0x%08x [old=0x%08x,bdelay=%d,agcdelay=%d]\n",
  828. (bdelay << 8) | agcdelay, cx_read(MO_AGC_BURST), bdelay, agcdelay);
  829. cx_write(MO_AGC_BURST, (bdelay << 8) | agcdelay);
  830. // htotal
  831. tmp64 = norm_htotal(norm) * (u64)vdec_clock;
  832. do_div(tmp64, fsc8);
  833. htotal = (u32)tmp64;
  834. dprintk(1,"set_tvnorm: MO_HTOTAL 0x%08x [old=0x%08x,htotal=%d]\n",
  835. htotal, cx_read(MO_HTOTAL), (u32)tmp64);
  836. cx_andor(MO_HTOTAL, 0x07ff, htotal);
  837. // vbi stuff, set vbi offset to 10 (for 20 Clk*2 pixels), this makes
  838. // the effective vbi offset ~244 samples, the same as the Bt8x8
  839. cx_write(MO_VBI_PACKET, (10<<11) | norm_vbipack(norm));
  840. // this is needed as well to set all tvnorm parameter
  841. cx88_set_scale(core, 320, 240, V4L2_FIELD_INTERLACED);
  842. // audio
  843. set_tvaudio(core);
  844. // tell i2c chips
  845. call_all(core, video, s_std, norm);
  846. /* The chroma_agc control should be inaccessible if the video format is SECAM */
  847. v4l2_ctrl_grab(core->chroma_agc, cxiformat == VideoFormatSECAM);
  848. // done
  849. return 0;
  850. }
  851. /* ------------------------------------------------------------------ */
  852. void cx88_vdev_init(struct cx88_core *core,
  853. struct pci_dev *pci,
  854. struct video_device *vfd,
  855. const struct video_device *template_,
  856. const char *type)
  857. {
  858. *vfd = *template_;
  859. /*
  860. * The dev pointer of v4l2_device is NULL, instead we set the
  861. * video_device dev_parent pointer to the correct PCI bus device.
  862. * This driver is a rare example where there is one v4l2_device,
  863. * but the video nodes have different parent (PCI) devices.
  864. */
  865. vfd->v4l2_dev = &core->v4l2_dev;
  866. vfd->dev_parent = &pci->dev;
  867. vfd->release = video_device_release_empty;
  868. vfd->lock = &core->lock;
  869. snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
  870. core->name, type, core->board.name);
  871. }
  872. struct cx88_core* cx88_core_get(struct pci_dev *pci)
  873. {
  874. struct cx88_core *core;
  875. mutex_lock(&devlist);
  876. list_for_each_entry(core, &cx88_devlist, devlist) {
  877. if (pci->bus->number != core->pci_bus)
  878. continue;
  879. if (PCI_SLOT(pci->devfn) != core->pci_slot)
  880. continue;
  881. if (0 != cx88_get_resources(core, pci)) {
  882. mutex_unlock(&devlist);
  883. return NULL;
  884. }
  885. atomic_inc(&core->refcount);
  886. mutex_unlock(&devlist);
  887. return core;
  888. }
  889. core = cx88_core_create(pci, cx88_devcount);
  890. if (NULL != core) {
  891. cx88_devcount++;
  892. list_add_tail(&core->devlist, &cx88_devlist);
  893. }
  894. mutex_unlock(&devlist);
  895. return core;
  896. }
  897. void cx88_core_put(struct cx88_core *core, struct pci_dev *pci)
  898. {
  899. release_mem_region(pci_resource_start(pci,0),
  900. pci_resource_len(pci,0));
  901. if (!atomic_dec_and_test(&core->refcount))
  902. return;
  903. mutex_lock(&devlist);
  904. cx88_ir_fini(core);
  905. if (0 == core->i2c_rc) {
  906. if (core->i2c_rtc)
  907. i2c_unregister_device(core->i2c_rtc);
  908. i2c_del_adapter(&core->i2c_adap);
  909. }
  910. list_del(&core->devlist);
  911. iounmap(core->lmmio);
  912. cx88_devcount--;
  913. mutex_unlock(&devlist);
  914. v4l2_ctrl_handler_free(&core->video_hdl);
  915. v4l2_ctrl_handler_free(&core->audio_hdl);
  916. v4l2_device_unregister(&core->v4l2_dev);
  917. kfree(core);
  918. }
  919. /* ------------------------------------------------------------------ */
  920. EXPORT_SYMBOL(cx88_print_irqbits);
  921. EXPORT_SYMBOL(cx88_core_irq);
  922. EXPORT_SYMBOL(cx88_wakeup);
  923. EXPORT_SYMBOL(cx88_reset);
  924. EXPORT_SYMBOL(cx88_shutdown);
  925. EXPORT_SYMBOL(cx88_risc_buffer);
  926. EXPORT_SYMBOL(cx88_risc_databuffer);
  927. EXPORT_SYMBOL(cx88_sram_channels);
  928. EXPORT_SYMBOL(cx88_sram_channel_setup);
  929. EXPORT_SYMBOL(cx88_sram_channel_dump);
  930. EXPORT_SYMBOL(cx88_set_tvnorm);
  931. EXPORT_SYMBOL(cx88_set_scale);
  932. EXPORT_SYMBOL(cx88_vdev_init);
  933. EXPORT_SYMBOL(cx88_core_get);
  934. EXPORT_SYMBOL(cx88_core_put);
  935. EXPORT_SYMBOL(cx88_ir_start);
  936. EXPORT_SYMBOL(cx88_ir_stop);