budget-core.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. /*
  2. * budget-core.c: driver for the SAA7146 based Budget DVB cards
  3. *
  4. * Compiled from various sources by Michael Hunold <michael@mihu.de>
  5. *
  6. * Copyright (C) 2002 Ralph Metzler <rjkm@metzlerbros.de>
  7. *
  8. * Copyright (C) 1999-2002 Ralph Metzler
  9. * & Marcus Metzler for convergence integrated media GmbH
  10. *
  11. * 26feb2004 Support for FS Activy Card (Grundig tuner) by
  12. * Michael Dreher <michael@5dot1.de>,
  13. * Oliver Endriss <o.endriss@gmx.de>,
  14. * Andreas 'randy' Weinberger
  15. *
  16. * This program is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU General Public License
  18. * as published by the Free Software Foundation; either version 2
  19. * of the License, or (at your option) any later version.
  20. *
  21. *
  22. * This program is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU General Public License for more details.
  26. *
  27. *
  28. * You should have received a copy of the GNU General Public License
  29. * along with this program; if not, write to the Free Software
  30. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  31. * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
  32. *
  33. *
  34. * the project's page is at http://www.linuxtv.org/
  35. */
  36. #include "budget.h"
  37. #include "ttpci-eeprom.h"
  38. #define TS_WIDTH (2 * TS_SIZE)
  39. #define TS_WIDTH_ACTIVY TS_SIZE
  40. #define TS_WIDTH_DVBC TS_SIZE
  41. #define TS_HEIGHT_MASK 0xf00
  42. #define TS_HEIGHT_MASK_ACTIVY 0xc00
  43. #define TS_HEIGHT_MASK_DVBC 0xe00
  44. #define TS_MIN_BUFSIZE_K 188
  45. #define TS_MAX_BUFSIZE_K 1410
  46. #define TS_MAX_BUFSIZE_K_ACTIVY 564
  47. #define TS_MAX_BUFSIZE_K_DVBC 1316
  48. #define BUFFER_WARNING_WAIT (30*HZ)
  49. int budget_debug;
  50. static int dma_buffer_size = TS_MIN_BUFSIZE_K;
  51. module_param_named(debug, budget_debug, int, 0644);
  52. module_param_named(bufsize, dma_buffer_size, int, 0444);
  53. MODULE_PARM_DESC(debug, "Turn on/off budget debugging (default:off).");
  54. MODULE_PARM_DESC(bufsize, "DMA buffer size in KB, default: 188, min: 188, max: 1410 (Activy: 564)");
  55. /****************************************************************************
  56. * TT budget / WinTV Nova
  57. ****************************************************************************/
  58. static int stop_ts_capture(struct budget *budget)
  59. {
  60. dprintk(2, "budget: %p\n", budget);
  61. saa7146_write(budget->dev, MC1, MASK_20); // DMA3 off
  62. SAA7146_IER_DISABLE(budget->dev, MASK_10);
  63. return 0;
  64. }
  65. static int start_ts_capture(struct budget *budget)
  66. {
  67. struct saa7146_dev *dev = budget->dev;
  68. dprintk(2, "budget: %p\n", budget);
  69. if (!budget->feeding || !budget->fe_synced)
  70. return 0;
  71. saa7146_write(dev, MC1, MASK_20); // DMA3 off
  72. memset(budget->grabbing, 0x00, budget->buffer_size);
  73. saa7146_write(dev, PCI_BT_V1, 0x001c0000 | (saa7146_read(dev, PCI_BT_V1) & ~0x001f0000));
  74. budget->ttbp = 0;
  75. /*
  76. * Signal path on the Activy:
  77. *
  78. * tuner -> SAA7146 port A -> SAA7146 BRS -> SAA7146 DMA3 -> memory
  79. *
  80. * Since the tuner feeds 204 bytes packets into the SAA7146,
  81. * DMA3 is configured to strip the trailing 16 FEC bytes:
  82. * Pitch: 188, NumBytes3: 188, NumLines3: 1024
  83. */
  84. switch(budget->card->type) {
  85. case BUDGET_FS_ACTIVY:
  86. saa7146_write(dev, DD1_INIT, 0x04000000);
  87. saa7146_write(dev, MC2, (MASK_09 | MASK_25));
  88. saa7146_write(dev, BRS_CTRL, 0x00000000);
  89. break;
  90. case BUDGET_PATCH:
  91. saa7146_write(dev, DD1_INIT, 0x00000200);
  92. saa7146_write(dev, MC2, (MASK_10 | MASK_26));
  93. saa7146_write(dev, BRS_CTRL, 0x60000000);
  94. break;
  95. case BUDGET_CIN1200C_MK3:
  96. case BUDGET_KNC1C_MK3:
  97. case BUDGET_KNC1CP_MK3:
  98. if (budget->video_port == BUDGET_VIDEO_PORTA) {
  99. saa7146_write(dev, DD1_INIT, 0x06000200);
  100. saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
  101. saa7146_write(dev, BRS_CTRL, 0x00000000);
  102. } else {
  103. saa7146_write(dev, DD1_INIT, 0x00000600);
  104. saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
  105. saa7146_write(dev, BRS_CTRL, 0x60000000);
  106. }
  107. break;
  108. default:
  109. if (budget->video_port == BUDGET_VIDEO_PORTA) {
  110. saa7146_write(dev, DD1_INIT, 0x06000200);
  111. saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
  112. saa7146_write(dev, BRS_CTRL, 0x00000000);
  113. } else {
  114. saa7146_write(dev, DD1_INIT, 0x02000600);
  115. saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
  116. saa7146_write(dev, BRS_CTRL, 0x60000000);
  117. }
  118. }
  119. saa7146_write(dev, MC2, (MASK_08 | MASK_24));
  120. mdelay(10);
  121. saa7146_write(dev, BASE_ODD3, 0);
  122. if (budget->buffer_size > budget->buffer_height * budget->buffer_width) {
  123. // using odd/even buffers
  124. saa7146_write(dev, BASE_EVEN3, budget->buffer_height * budget->buffer_width);
  125. } else {
  126. // using a single buffer
  127. saa7146_write(dev, BASE_EVEN3, 0);
  128. }
  129. saa7146_write(dev, PROT_ADDR3, budget->buffer_size);
  130. saa7146_write(dev, BASE_PAGE3, budget->pt.dma | ME1 | 0x90);
  131. saa7146_write(dev, PITCH3, budget->buffer_width);
  132. saa7146_write(dev, NUM_LINE_BYTE3,
  133. (budget->buffer_height << 16) | budget->buffer_width);
  134. saa7146_write(dev, MC2, (MASK_04 | MASK_20));
  135. SAA7146_ISR_CLEAR(budget->dev, MASK_10); /* VPE */
  136. SAA7146_IER_ENABLE(budget->dev, MASK_10); /* VPE */
  137. saa7146_write(dev, MC1, (MASK_04 | MASK_20)); /* DMA3 on */
  138. return 0;
  139. }
  140. static int budget_read_fe_status(struct dvb_frontend *fe, fe_status_t *status)
  141. {
  142. struct budget *budget = (struct budget *) fe->dvb->priv;
  143. int synced;
  144. int ret;
  145. if (budget->read_fe_status)
  146. ret = budget->read_fe_status(fe, status);
  147. else
  148. ret = -EINVAL;
  149. if (!ret) {
  150. synced = (*status & FE_HAS_LOCK);
  151. if (synced != budget->fe_synced) {
  152. budget->fe_synced = synced;
  153. spin_lock(&budget->feedlock);
  154. if (synced)
  155. start_ts_capture(budget);
  156. else
  157. stop_ts_capture(budget);
  158. spin_unlock(&budget->feedlock);
  159. }
  160. }
  161. return ret;
  162. }
  163. static void vpeirq(unsigned long data)
  164. {
  165. struct budget *budget = (struct budget *) data;
  166. u8 *mem = (u8 *) (budget->grabbing);
  167. u32 olddma = budget->ttbp;
  168. u32 newdma = saa7146_read(budget->dev, PCI_VDP3);
  169. u32 count;
  170. /* Ensure streamed PCI data is synced to CPU */
  171. pci_dma_sync_sg_for_cpu(budget->dev->pci, budget->pt.slist, budget->pt.nents, PCI_DMA_FROMDEVICE);
  172. /* nearest lower position divisible by 188 */
  173. newdma -= newdma % 188;
  174. if (newdma >= budget->buffer_size)
  175. return;
  176. budget->ttbp = newdma;
  177. if (budget->feeding == 0 || newdma == olddma)
  178. return;
  179. if (newdma > olddma) { /* no wraparound, dump olddma..newdma */
  180. count = newdma - olddma;
  181. dvb_dmx_swfilter_packets(&budget->demux, mem + olddma, count / 188);
  182. } else { /* wraparound, dump olddma..buflen and 0..newdma */
  183. count = budget->buffer_size - olddma;
  184. dvb_dmx_swfilter_packets(&budget->demux, mem + olddma, count / 188);
  185. count += newdma;
  186. dvb_dmx_swfilter_packets(&budget->demux, mem, newdma / 188);
  187. }
  188. if (count > budget->buffer_warning_threshold)
  189. budget->buffer_warnings++;
  190. if (budget->buffer_warnings && time_after(jiffies, budget->buffer_warning_time)) {
  191. printk("%s %s: used %d times >80%% of buffer (%u bytes now)\n",
  192. budget->dev->name, __func__, budget->buffer_warnings, count);
  193. budget->buffer_warning_time = jiffies + BUFFER_WARNING_WAIT;
  194. budget->buffer_warnings = 0;
  195. }
  196. }
  197. int ttpci_budget_debiread(struct budget *budget, u32 config, int addr, int count,
  198. int uselocks, int nobusyloop)
  199. {
  200. struct saa7146_dev *saa = budget->dev;
  201. int result = 0;
  202. unsigned long flags = 0;
  203. if (count > 4 || count <= 0)
  204. return 0;
  205. if (uselocks)
  206. spin_lock_irqsave(&budget->debilock, flags);
  207. if ((result = saa7146_wait_for_debi_done(saa, nobusyloop)) < 0) {
  208. if (uselocks)
  209. spin_unlock_irqrestore(&budget->debilock, flags);
  210. return result;
  211. }
  212. saa7146_write(saa, DEBI_COMMAND, (count << 17) | 0x10000 | (addr & 0xffff));
  213. saa7146_write(saa, DEBI_CONFIG, config);
  214. saa7146_write(saa, DEBI_PAGE, 0);
  215. saa7146_write(saa, MC2, (2 << 16) | 2);
  216. if ((result = saa7146_wait_for_debi_done(saa, nobusyloop)) < 0) {
  217. if (uselocks)
  218. spin_unlock_irqrestore(&budget->debilock, flags);
  219. return result;
  220. }
  221. result = saa7146_read(saa, DEBI_AD);
  222. result &= (0xffffffffUL >> ((4 - count) * 8));
  223. if (uselocks)
  224. spin_unlock_irqrestore(&budget->debilock, flags);
  225. return result;
  226. }
  227. int ttpci_budget_debiwrite(struct budget *budget, u32 config, int addr,
  228. int count, u32 value, int uselocks, int nobusyloop)
  229. {
  230. struct saa7146_dev *saa = budget->dev;
  231. unsigned long flags = 0;
  232. int result;
  233. if (count > 4 || count <= 0)
  234. return 0;
  235. if (uselocks)
  236. spin_lock_irqsave(&budget->debilock, flags);
  237. if ((result = saa7146_wait_for_debi_done(saa, nobusyloop)) < 0) {
  238. if (uselocks)
  239. spin_unlock_irqrestore(&budget->debilock, flags);
  240. return result;
  241. }
  242. saa7146_write(saa, DEBI_COMMAND, (count << 17) | 0x00000 | (addr & 0xffff));
  243. saa7146_write(saa, DEBI_CONFIG, config);
  244. saa7146_write(saa, DEBI_PAGE, 0);
  245. saa7146_write(saa, DEBI_AD, value);
  246. saa7146_write(saa, MC2, (2 << 16) | 2);
  247. if ((result = saa7146_wait_for_debi_done(saa, nobusyloop)) < 0) {
  248. if (uselocks)
  249. spin_unlock_irqrestore(&budget->debilock, flags);
  250. return result;
  251. }
  252. if (uselocks)
  253. spin_unlock_irqrestore(&budget->debilock, flags);
  254. return 0;
  255. }
  256. /****************************************************************************
  257. * DVB API SECTION
  258. ****************************************************************************/
  259. static int budget_start_feed(struct dvb_demux_feed *feed)
  260. {
  261. struct dvb_demux *demux = feed->demux;
  262. struct budget *budget = (struct budget *) demux->priv;
  263. int status = 0;
  264. dprintk(2, "budget: %p\n", budget);
  265. if (!demux->dmx.frontend)
  266. return -EINVAL;
  267. spin_lock(&budget->feedlock);
  268. feed->pusi_seen = 0; /* have a clean section start */
  269. if (budget->feeding++ == 0)
  270. status = start_ts_capture(budget);
  271. spin_unlock(&budget->feedlock);
  272. return status;
  273. }
  274. static int budget_stop_feed(struct dvb_demux_feed *feed)
  275. {
  276. struct dvb_demux *demux = feed->demux;
  277. struct budget *budget = (struct budget *) demux->priv;
  278. int status = 0;
  279. dprintk(2, "budget: %p\n", budget);
  280. spin_lock(&budget->feedlock);
  281. if (--budget->feeding == 0)
  282. status = stop_ts_capture(budget);
  283. spin_unlock(&budget->feedlock);
  284. return status;
  285. }
  286. static int budget_register(struct budget *budget)
  287. {
  288. struct dvb_demux *dvbdemux = &budget->demux;
  289. int ret;
  290. dprintk(2, "budget: %p\n", budget);
  291. dvbdemux->priv = (void *) budget;
  292. dvbdemux->filternum = 256;
  293. dvbdemux->feednum = 256;
  294. dvbdemux->start_feed = budget_start_feed;
  295. dvbdemux->stop_feed = budget_stop_feed;
  296. dvbdemux->write_to_decoder = NULL;
  297. dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING |
  298. DMX_MEMORY_BASED_FILTERING);
  299. dvb_dmx_init(&budget->demux);
  300. budget->dmxdev.filternum = 256;
  301. budget->dmxdev.demux = &dvbdemux->dmx;
  302. budget->dmxdev.capabilities = 0;
  303. dvb_dmxdev_init(&budget->dmxdev, &budget->dvb_adapter);
  304. budget->hw_frontend.source = DMX_FRONTEND_0;
  305. ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &budget->hw_frontend);
  306. if (ret < 0)
  307. return ret;
  308. budget->mem_frontend.source = DMX_MEMORY_FE;
  309. ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &budget->mem_frontend);
  310. if (ret < 0)
  311. return ret;
  312. ret = dvbdemux->dmx.connect_frontend(&dvbdemux->dmx, &budget->hw_frontend);
  313. if (ret < 0)
  314. return ret;
  315. dvb_net_init(&budget->dvb_adapter, &budget->dvb_net, &dvbdemux->dmx);
  316. return 0;
  317. }
  318. static void budget_unregister(struct budget *budget)
  319. {
  320. struct dvb_demux *dvbdemux = &budget->demux;
  321. dprintk(2, "budget: %p\n", budget);
  322. dvb_net_release(&budget->dvb_net);
  323. dvbdemux->dmx.close(&dvbdemux->dmx);
  324. dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &budget->hw_frontend);
  325. dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &budget->mem_frontend);
  326. dvb_dmxdev_release(&budget->dmxdev);
  327. dvb_dmx_release(&budget->demux);
  328. }
  329. int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
  330. struct saa7146_pci_extension_data *info,
  331. struct module *owner, short *adapter_nums)
  332. {
  333. int ret = 0;
  334. struct budget_info *bi = info->ext_priv;
  335. int max_bufsize;
  336. int height_mask;
  337. memset(budget, 0, sizeof(struct budget));
  338. dprintk(2, "dev: %p, budget: %p\n", dev, budget);
  339. budget->card = bi;
  340. budget->dev = (struct saa7146_dev *) dev;
  341. switch(budget->card->type) {
  342. case BUDGET_FS_ACTIVY:
  343. budget->buffer_width = TS_WIDTH_ACTIVY;
  344. max_bufsize = TS_MAX_BUFSIZE_K_ACTIVY;
  345. height_mask = TS_HEIGHT_MASK_ACTIVY;
  346. break;
  347. case BUDGET_KNC1C:
  348. case BUDGET_KNC1CP:
  349. case BUDGET_CIN1200C:
  350. case BUDGET_KNC1C_MK3:
  351. case BUDGET_KNC1CP_MK3:
  352. case BUDGET_CIN1200C_MK3:
  353. budget->buffer_width = TS_WIDTH_DVBC;
  354. max_bufsize = TS_MAX_BUFSIZE_K_DVBC;
  355. height_mask = TS_HEIGHT_MASK_DVBC;
  356. break;
  357. default:
  358. budget->buffer_width = TS_WIDTH;
  359. max_bufsize = TS_MAX_BUFSIZE_K;
  360. height_mask = TS_HEIGHT_MASK;
  361. }
  362. if (dma_buffer_size < TS_MIN_BUFSIZE_K)
  363. dma_buffer_size = TS_MIN_BUFSIZE_K;
  364. else if (dma_buffer_size > max_bufsize)
  365. dma_buffer_size = max_bufsize;
  366. budget->buffer_height = dma_buffer_size * 1024 / budget->buffer_width;
  367. if (budget->buffer_height > 0xfff) {
  368. budget->buffer_height /= 2;
  369. budget->buffer_height &= height_mask;
  370. budget->buffer_size = 2 * budget->buffer_height * budget->buffer_width;
  371. } else {
  372. budget->buffer_height &= height_mask;
  373. budget->buffer_size = budget->buffer_height * budget->buffer_width;
  374. }
  375. budget->buffer_warning_threshold = budget->buffer_size * 80/100;
  376. budget->buffer_warnings = 0;
  377. budget->buffer_warning_time = jiffies;
  378. dprintk(2, "%s: buffer type = %s, width = %d, height = %d\n",
  379. budget->dev->name,
  380. budget->buffer_size > budget->buffer_width * budget->buffer_height ? "odd/even" : "single",
  381. budget->buffer_width, budget->buffer_height);
  382. printk("%s: dma buffer size %u\n", budget->dev->name, budget->buffer_size);
  383. ret = dvb_register_adapter(&budget->dvb_adapter, budget->card->name,
  384. owner, &budget->dev->pci->dev, adapter_nums);
  385. if (ret < 0)
  386. return ret;
  387. /* set dd1 stream a & b */
  388. saa7146_write(dev, DD1_STREAM_B, 0x00000000);
  389. saa7146_write(dev, MC2, (MASK_09 | MASK_25));
  390. saa7146_write(dev, MC2, (MASK_10 | MASK_26));
  391. saa7146_write(dev, DD1_INIT, 0x02000000);
  392. saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
  393. if (bi->type != BUDGET_FS_ACTIVY)
  394. budget->video_port = BUDGET_VIDEO_PORTB;
  395. else
  396. budget->video_port = BUDGET_VIDEO_PORTA;
  397. spin_lock_init(&budget->feedlock);
  398. spin_lock_init(&budget->debilock);
  399. /* the Siemens DVB needs this if you want to have the i2c chips
  400. get recognized before the main driver is loaded */
  401. if (bi->type != BUDGET_FS_ACTIVY)
  402. saa7146_write(dev, GPIO_CTRL, 0x500000); /* GPIO 3 = 1 */
  403. strlcpy(budget->i2c_adap.name, budget->card->name, sizeof(budget->i2c_adap.name));
  404. saa7146_i2c_adapter_prepare(dev, &budget->i2c_adap, SAA7146_I2C_BUS_BIT_RATE_120);
  405. strcpy(budget->i2c_adap.name, budget->card->name);
  406. if (i2c_add_adapter(&budget->i2c_adap) < 0) {
  407. ret = -ENOMEM;
  408. goto err_dvb_unregister;
  409. }
  410. ttpci_eeprom_parse_mac(&budget->i2c_adap, budget->dvb_adapter.proposed_mac);
  411. budget->grabbing = saa7146_vmalloc_build_pgtable(dev->pci, budget->buffer_size, &budget->pt);
  412. if (NULL == budget->grabbing) {
  413. ret = -ENOMEM;
  414. goto err_del_i2c;
  415. }
  416. saa7146_write(dev, PCI_BT_V1, 0x001c0000);
  417. /* upload all */
  418. saa7146_write(dev, GPIO_CTRL, 0x000000);
  419. tasklet_init(&budget->vpe_tasklet, vpeirq, (unsigned long) budget);
  420. /* frontend power on */
  421. if (bi->type != BUDGET_FS_ACTIVY)
  422. saa7146_setgpio(dev, 2, SAA7146_GPIO_OUTHI);
  423. if ((ret = budget_register(budget)) == 0)
  424. return 0; /* Everything OK */
  425. /* An error occurred, cleanup resources */
  426. saa7146_vfree_destroy_pgtable(dev->pci, budget->grabbing, &budget->pt);
  427. err_del_i2c:
  428. i2c_del_adapter(&budget->i2c_adap);
  429. err_dvb_unregister:
  430. dvb_unregister_adapter(&budget->dvb_adapter);
  431. return ret;
  432. }
  433. void ttpci_budget_init_hooks(struct budget *budget)
  434. {
  435. if (budget->dvb_frontend && !budget->read_fe_status) {
  436. budget->read_fe_status = budget->dvb_frontend->ops.read_status;
  437. budget->dvb_frontend->ops.read_status = budget_read_fe_status;
  438. }
  439. }
  440. int ttpci_budget_deinit(struct budget *budget)
  441. {
  442. struct saa7146_dev *dev = budget->dev;
  443. dprintk(2, "budget: %p\n", budget);
  444. budget_unregister(budget);
  445. tasklet_kill(&budget->vpe_tasklet);
  446. saa7146_vfree_destroy_pgtable(dev->pci, budget->grabbing, &budget->pt);
  447. i2c_del_adapter(&budget->i2c_adap);
  448. dvb_unregister_adapter(&budget->dvb_adapter);
  449. return 0;
  450. }
  451. void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 * isr)
  452. {
  453. struct budget *budget = (struct budget *) dev->ext_priv;
  454. dprintk(8, "dev: %p, budget: %p\n", dev, budget);
  455. if (*isr & MASK_10)
  456. tasklet_schedule(&budget->vpe_tasklet);
  457. }
  458. void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port)
  459. {
  460. struct budget *budget = (struct budget *) dev->ext_priv;
  461. spin_lock(&budget->feedlock);
  462. budget->video_port = video_port;
  463. if (budget->feeding) {
  464. stop_ts_capture(budget);
  465. start_ts_capture(budget);
  466. }
  467. spin_unlock(&budget->feedlock);
  468. }
  469. EXPORT_SYMBOL_GPL(ttpci_budget_debiread);
  470. EXPORT_SYMBOL_GPL(ttpci_budget_debiwrite);
  471. EXPORT_SYMBOL_GPL(ttpci_budget_init);
  472. EXPORT_SYMBOL_GPL(ttpci_budget_init_hooks);
  473. EXPORT_SYMBOL_GPL(ttpci_budget_deinit);
  474. EXPORT_SYMBOL_GPL(ttpci_budget_irq10_handler);
  475. EXPORT_SYMBOL_GPL(ttpci_budget_set_video_port);
  476. EXPORT_SYMBOL_GPL(budget_debug);
  477. MODULE_LICENSE("GPL");