au0828-dvb.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. /*
  2. * Driver for the Auvitek USB bridge
  3. *
  4. * Copyright (c) 2008 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 "au0828.h"
  22. #include <linux/module.h>
  23. #include <linux/slab.h>
  24. #include <linux/init.h>
  25. #include <linux/device.h>
  26. #include <media/v4l2-common.h>
  27. #include <media/tuner.h>
  28. #include "au8522.h"
  29. #include "xc5000.h"
  30. #include "mxl5007t.h"
  31. #include "tda18271.h"
  32. static int preallocate_big_buffers;
  33. module_param_named(preallocate_big_buffers, preallocate_big_buffers, int, 0644);
  34. MODULE_PARM_DESC(preallocate_big_buffers, "Preallocate the larger transfer buffers at module load time");
  35. DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
  36. #define _AU0828_BULKPIPE 0x83
  37. #define _BULKPIPESIZE 0xe522
  38. static u8 hauppauge_hvr950q_led_states[] = {
  39. 0x00, /* off */
  40. 0x02, /* yellow */
  41. 0x04, /* green */
  42. };
  43. static struct au8522_led_config hauppauge_hvr950q_led_cfg = {
  44. .gpio_output = 0x00e0,
  45. .gpio_output_enable = 0x6006,
  46. .gpio_output_disable = 0x0660,
  47. .gpio_leds = 0x00e2,
  48. .led_states = hauppauge_hvr950q_led_states,
  49. .num_led_states = sizeof(hauppauge_hvr950q_led_states),
  50. .vsb8_strong = 20 /* dB */ * 10,
  51. .qam64_strong = 25 /* dB */ * 10,
  52. .qam256_strong = 32 /* dB */ * 10,
  53. };
  54. static struct au8522_config hauppauge_hvr950q_config = {
  55. .demod_address = 0x8e >> 1,
  56. .status_mode = AU8522_DEMODLOCKING,
  57. .qam_if = AU8522_IF_6MHZ,
  58. .vsb_if = AU8522_IF_6MHZ,
  59. .led_cfg = &hauppauge_hvr950q_led_cfg,
  60. };
  61. static struct au8522_config fusionhdtv7usb_config = {
  62. .demod_address = 0x8e >> 1,
  63. .status_mode = AU8522_DEMODLOCKING,
  64. .qam_if = AU8522_IF_6MHZ,
  65. .vsb_if = AU8522_IF_6MHZ,
  66. };
  67. static struct au8522_config hauppauge_woodbury_config = {
  68. .demod_address = 0x8e >> 1,
  69. .status_mode = AU8522_DEMODLOCKING,
  70. .qam_if = AU8522_IF_4MHZ,
  71. .vsb_if = AU8522_IF_3_25MHZ,
  72. };
  73. static struct xc5000_config hauppauge_xc5000a_config = {
  74. .i2c_address = 0x61,
  75. .if_khz = 6000,
  76. .chip_id = XC5000A,
  77. .output_amp = 0x8f,
  78. };
  79. static struct xc5000_config hauppauge_xc5000c_config = {
  80. .i2c_address = 0x61,
  81. .if_khz = 6000,
  82. .chip_id = XC5000C,
  83. .output_amp = 0x8f,
  84. };
  85. static struct mxl5007t_config mxl5007t_hvr950q_config = {
  86. .xtal_freq_hz = MxL_XTAL_24_MHZ,
  87. .if_freq_hz = MxL_IF_6_MHZ,
  88. };
  89. static struct tda18271_config hauppauge_woodbury_tunerconfig = {
  90. .gate = TDA18271_GATE_DIGITAL,
  91. };
  92. static void au0828_restart_dvb_streaming(struct work_struct *work);
  93. /*-------------------------------------------------------------------*/
  94. static void urb_completion(struct urb *purb)
  95. {
  96. struct au0828_dev *dev = purb->context;
  97. int ptype = usb_pipetype(purb->pipe);
  98. unsigned char *ptr;
  99. dprintk(2, "%s: %d\n", __func__, purb->actual_length);
  100. if (!dev) {
  101. dprintk(2, "%s: no dev!\n", __func__);
  102. return;
  103. }
  104. if (!dev->urb_streaming) {
  105. dprintk(2, "%s: not streaming!\n", __func__);
  106. return;
  107. }
  108. if (ptype != PIPE_BULK) {
  109. pr_err("%s: Unsupported URB type %d\n",
  110. __func__, ptype);
  111. return;
  112. }
  113. /* See if the stream is corrupted (to work around a hardware
  114. bug where the stream gets misaligned */
  115. ptr = purb->transfer_buffer;
  116. if (purb->actual_length > 0 && ptr[0] != 0x47) {
  117. dprintk(1, "Need to restart streaming %02x len=%d!\n",
  118. ptr[0], purb->actual_length);
  119. schedule_work(&dev->restart_streaming);
  120. return;
  121. }
  122. /* Feed the transport payload into the kernel demux */
  123. dvb_dmx_swfilter_packets(&dev->dvb.demux,
  124. purb->transfer_buffer, purb->actual_length / 188);
  125. /* Clean the buffer before we requeue */
  126. memset(purb->transfer_buffer, 0, URB_BUFSIZE);
  127. /* Requeue URB */
  128. usb_submit_urb(purb, GFP_ATOMIC);
  129. }
  130. static int stop_urb_transfer(struct au0828_dev *dev)
  131. {
  132. int i;
  133. dprintk(2, "%s()\n", __func__);
  134. if (!dev->urb_streaming)
  135. return 0;
  136. dev->urb_streaming = false;
  137. for (i = 0; i < URB_COUNT; i++) {
  138. if (dev->urbs[i]) {
  139. usb_kill_urb(dev->urbs[i]);
  140. if (!preallocate_big_buffers)
  141. kfree(dev->urbs[i]->transfer_buffer);
  142. usb_free_urb(dev->urbs[i]);
  143. }
  144. }
  145. return 0;
  146. }
  147. static int start_urb_transfer(struct au0828_dev *dev)
  148. {
  149. struct urb *purb;
  150. int i, ret = -ENOMEM;
  151. dprintk(2, "%s()\n", __func__);
  152. if (dev->urb_streaming) {
  153. dprintk(2, "%s: bulk xfer already running!\n", __func__);
  154. return 0;
  155. }
  156. for (i = 0; i < URB_COUNT; i++) {
  157. dev->urbs[i] = usb_alloc_urb(0, GFP_KERNEL);
  158. if (!dev->urbs[i])
  159. goto err;
  160. purb = dev->urbs[i];
  161. if (preallocate_big_buffers)
  162. purb->transfer_buffer = dev->dig_transfer_buffer[i];
  163. else
  164. purb->transfer_buffer = kzalloc(URB_BUFSIZE,
  165. GFP_KERNEL);
  166. if (!purb->transfer_buffer) {
  167. usb_free_urb(purb);
  168. dev->urbs[i] = NULL;
  169. pr_err("%s: failed big buffer allocation, err = %d\n",
  170. __func__, ret);
  171. goto err;
  172. }
  173. purb->status = -EINPROGRESS;
  174. usb_fill_bulk_urb(purb,
  175. dev->usbdev,
  176. usb_rcvbulkpipe(dev->usbdev,
  177. _AU0828_BULKPIPE),
  178. purb->transfer_buffer,
  179. URB_BUFSIZE,
  180. urb_completion,
  181. dev);
  182. }
  183. for (i = 0; i < URB_COUNT; i++) {
  184. ret = usb_submit_urb(dev->urbs[i], GFP_ATOMIC);
  185. if (ret != 0) {
  186. stop_urb_transfer(dev);
  187. pr_err("%s: failed urb submission, err = %d\n",
  188. __func__, ret);
  189. return ret;
  190. }
  191. }
  192. dev->urb_streaming = true;
  193. ret = 0;
  194. err:
  195. return ret;
  196. }
  197. static void au0828_start_transport(struct au0828_dev *dev)
  198. {
  199. au0828_write(dev, 0x608, 0x90);
  200. au0828_write(dev, 0x609, 0x72);
  201. au0828_write(dev, 0x60a, 0x71);
  202. au0828_write(dev, 0x60b, 0x01);
  203. }
  204. static void au0828_stop_transport(struct au0828_dev *dev, int full_stop)
  205. {
  206. if (full_stop) {
  207. au0828_write(dev, 0x608, 0x00);
  208. au0828_write(dev, 0x609, 0x00);
  209. au0828_write(dev, 0x60a, 0x00);
  210. }
  211. au0828_write(dev, 0x60b, 0x00);
  212. }
  213. static int au0828_dvb_start_feed(struct dvb_demux_feed *feed)
  214. {
  215. struct dvb_demux *demux = feed->demux;
  216. struct au0828_dev *dev = (struct au0828_dev *) demux->priv;
  217. struct au0828_dvb *dvb = &dev->dvb;
  218. int ret = 0;
  219. dprintk(1, "%s()\n", __func__);
  220. if (!demux->dmx.frontend)
  221. return -EINVAL;
  222. if (dvb->frontend) {
  223. mutex_lock(&dvb->lock);
  224. dvb->start_count++;
  225. dprintk(1, "%s(), start_count: %d, stop_count: %d\n", __func__,
  226. dvb->start_count, dvb->stop_count);
  227. if (dvb->feeding++ == 0) {
  228. /* Start transport */
  229. au0828_start_transport(dev);
  230. ret = start_urb_transfer(dev);
  231. if (ret < 0) {
  232. au0828_stop_transport(dev, 0);
  233. dvb->feeding--; /* We ran out of memory... */
  234. }
  235. }
  236. mutex_unlock(&dvb->lock);
  237. }
  238. return ret;
  239. }
  240. static int au0828_dvb_stop_feed(struct dvb_demux_feed *feed)
  241. {
  242. struct dvb_demux *demux = feed->demux;
  243. struct au0828_dev *dev = (struct au0828_dev *) demux->priv;
  244. struct au0828_dvb *dvb = &dev->dvb;
  245. int ret = 0;
  246. dprintk(1, "%s()\n", __func__);
  247. if (dvb->frontend) {
  248. cancel_work_sync(&dev->restart_streaming);
  249. mutex_lock(&dvb->lock);
  250. dvb->stop_count++;
  251. dprintk(1, "%s(), start_count: %d, stop_count: %d\n", __func__,
  252. dvb->start_count, dvb->stop_count);
  253. if (dvb->feeding > 0) {
  254. dvb->feeding--;
  255. if (dvb->feeding == 0) {
  256. /* Stop transport */
  257. ret = stop_urb_transfer(dev);
  258. au0828_stop_transport(dev, 0);
  259. }
  260. }
  261. mutex_unlock(&dvb->lock);
  262. }
  263. return ret;
  264. }
  265. static void au0828_restart_dvb_streaming(struct work_struct *work)
  266. {
  267. struct au0828_dev *dev = container_of(work, struct au0828_dev,
  268. restart_streaming);
  269. struct au0828_dvb *dvb = &dev->dvb;
  270. if (!dev->urb_streaming)
  271. return;
  272. dprintk(1, "Restarting streaming...!\n");
  273. mutex_lock(&dvb->lock);
  274. /* Stop transport */
  275. stop_urb_transfer(dev);
  276. au0828_stop_transport(dev, 1);
  277. /* Start transport */
  278. au0828_start_transport(dev);
  279. start_urb_transfer(dev);
  280. mutex_unlock(&dvb->lock);
  281. }
  282. static int au0828_set_frontend(struct dvb_frontend *fe)
  283. {
  284. struct au0828_dev *dev = fe->dvb->priv;
  285. struct au0828_dvb *dvb = &dev->dvb;
  286. int ret, was_streaming;
  287. mutex_lock(&dvb->lock);
  288. was_streaming = dev->urb_streaming;
  289. if (was_streaming) {
  290. au0828_stop_transport(dev, 1);
  291. /*
  292. * We can't hold a mutex here, as the restart_streaming
  293. * kthread may also hold it.
  294. */
  295. mutex_unlock(&dvb->lock);
  296. cancel_work_sync(&dev->restart_streaming);
  297. mutex_lock(&dvb->lock);
  298. stop_urb_transfer(dev);
  299. }
  300. mutex_unlock(&dvb->lock);
  301. ret = dvb->set_frontend(fe);
  302. if (was_streaming) {
  303. mutex_lock(&dvb->lock);
  304. au0828_start_transport(dev);
  305. start_urb_transfer(dev);
  306. mutex_unlock(&dvb->lock);
  307. }
  308. return ret;
  309. }
  310. static int dvb_register(struct au0828_dev *dev)
  311. {
  312. struct au0828_dvb *dvb = &dev->dvb;
  313. int result;
  314. dprintk(1, "%s()\n", __func__);
  315. if (preallocate_big_buffers) {
  316. int i;
  317. for (i = 0; i < URB_COUNT; i++) {
  318. dev->dig_transfer_buffer[i] = kzalloc(URB_BUFSIZE,
  319. GFP_KERNEL);
  320. if (!dev->dig_transfer_buffer[i]) {
  321. result = -ENOMEM;
  322. pr_err("failed buffer allocation (errno = %d)\n",
  323. result);
  324. goto fail_adapter;
  325. }
  326. }
  327. }
  328. INIT_WORK(&dev->restart_streaming, au0828_restart_dvb_streaming);
  329. /* register adapter */
  330. result = dvb_register_adapter(&dvb->adapter,
  331. KBUILD_MODNAME, THIS_MODULE,
  332. &dev->usbdev->dev, adapter_nr);
  333. if (result < 0) {
  334. pr_err("dvb_register_adapter failed (errno = %d)\n",
  335. result);
  336. goto fail_adapter;
  337. }
  338. dvb->adapter.priv = dev;
  339. /* register frontend */
  340. result = dvb_register_frontend(&dvb->adapter, dvb->frontend);
  341. if (result < 0) {
  342. pr_err("dvb_register_frontend failed (errno = %d)\n",
  343. result);
  344. goto fail_frontend;
  345. }
  346. /* Hook dvb frontend */
  347. dvb->set_frontend = dvb->frontend->ops.set_frontend;
  348. dvb->frontend->ops.set_frontend = au0828_set_frontend;
  349. /* register demux stuff */
  350. dvb->demux.dmx.capabilities =
  351. DMX_TS_FILTERING | DMX_SECTION_FILTERING |
  352. DMX_MEMORY_BASED_FILTERING;
  353. dvb->demux.priv = dev;
  354. dvb->demux.filternum = 256;
  355. dvb->demux.feednum = 256;
  356. dvb->demux.start_feed = au0828_dvb_start_feed;
  357. dvb->demux.stop_feed = au0828_dvb_stop_feed;
  358. result = dvb_dmx_init(&dvb->demux);
  359. if (result < 0) {
  360. pr_err("dvb_dmx_init failed (errno = %d)\n", result);
  361. goto fail_dmx;
  362. }
  363. dvb->dmxdev.filternum = 256;
  364. dvb->dmxdev.demux = &dvb->demux.dmx;
  365. dvb->dmxdev.capabilities = 0;
  366. result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
  367. if (result < 0) {
  368. pr_err("dvb_dmxdev_init failed (errno = %d)\n", result);
  369. goto fail_dmxdev;
  370. }
  371. dvb->fe_hw.source = DMX_FRONTEND_0;
  372. result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw);
  373. if (result < 0) {
  374. pr_err("add_frontend failed (DMX_FRONTEND_0, errno = %d)\n",
  375. result);
  376. goto fail_fe_hw;
  377. }
  378. dvb->fe_mem.source = DMX_MEMORY_FE;
  379. result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem);
  380. if (result < 0) {
  381. pr_err("add_frontend failed (DMX_MEMORY_FE, errno = %d)\n",
  382. result);
  383. goto fail_fe_mem;
  384. }
  385. result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw);
  386. if (result < 0) {
  387. pr_err("connect_frontend failed (errno = %d)\n", result);
  388. goto fail_fe_conn;
  389. }
  390. /* register network adapter */
  391. dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);
  392. dvb->start_count = 0;
  393. dvb->stop_count = 0;
  394. return 0;
  395. fail_fe_conn:
  396. dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem);
  397. fail_fe_mem:
  398. dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw);
  399. fail_fe_hw:
  400. dvb_dmxdev_release(&dvb->dmxdev);
  401. fail_dmxdev:
  402. dvb_dmx_release(&dvb->demux);
  403. fail_dmx:
  404. dvb_unregister_frontend(dvb->frontend);
  405. fail_frontend:
  406. dvb_frontend_detach(dvb->frontend);
  407. dvb_unregister_adapter(&dvb->adapter);
  408. fail_adapter:
  409. if (preallocate_big_buffers) {
  410. int i;
  411. for (i = 0; i < URB_COUNT; i++)
  412. kfree(dev->dig_transfer_buffer[i]);
  413. }
  414. return result;
  415. }
  416. void au0828_dvb_unregister(struct au0828_dev *dev)
  417. {
  418. struct au0828_dvb *dvb = &dev->dvb;
  419. dprintk(1, "%s()\n", __func__);
  420. if (dvb->frontend == NULL)
  421. return;
  422. cancel_work_sync(&dev->restart_streaming);
  423. dvb_net_release(&dvb->net);
  424. dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem);
  425. dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw);
  426. dvb_dmxdev_release(&dvb->dmxdev);
  427. dvb_dmx_release(&dvb->demux);
  428. dvb_unregister_frontend(dvb->frontend);
  429. dvb_frontend_detach(dvb->frontend);
  430. dvb_unregister_adapter(&dvb->adapter);
  431. if (preallocate_big_buffers) {
  432. int i;
  433. for (i = 0; i < URB_COUNT; i++)
  434. kfree(dev->dig_transfer_buffer[i]);
  435. }
  436. dvb->frontend = NULL;
  437. }
  438. /* All the DVB attach calls go here, this function get's modified
  439. * for each new card. No other function in this file needs
  440. * to change.
  441. */
  442. int au0828_dvb_register(struct au0828_dev *dev)
  443. {
  444. struct au0828_dvb *dvb = &dev->dvb;
  445. int ret;
  446. dprintk(1, "%s()\n", __func__);
  447. /* init frontend */
  448. switch (dev->boardnr) {
  449. case AU0828_BOARD_HAUPPAUGE_HVR850:
  450. case AU0828_BOARD_HAUPPAUGE_HVR950Q:
  451. dvb->frontend = dvb_attach(au8522_attach,
  452. &hauppauge_hvr950q_config,
  453. &dev->i2c_adap);
  454. if (dvb->frontend != NULL)
  455. switch (dev->board.tuner_type) {
  456. default:
  457. case TUNER_XC5000:
  458. dvb_attach(xc5000_attach, dvb->frontend,
  459. &dev->i2c_adap,
  460. &hauppauge_xc5000a_config);
  461. break;
  462. case TUNER_XC5000C:
  463. dvb_attach(xc5000_attach, dvb->frontend,
  464. &dev->i2c_adap,
  465. &hauppauge_xc5000c_config);
  466. break;
  467. }
  468. break;
  469. case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
  470. dvb->frontend = dvb_attach(au8522_attach,
  471. &hauppauge_hvr950q_config,
  472. &dev->i2c_adap);
  473. if (dvb->frontend != NULL)
  474. dvb_attach(mxl5007t_attach, dvb->frontend,
  475. &dev->i2c_adap, 0x60,
  476. &mxl5007t_hvr950q_config);
  477. break;
  478. case AU0828_BOARD_HAUPPAUGE_WOODBURY:
  479. dvb->frontend = dvb_attach(au8522_attach,
  480. &hauppauge_woodbury_config,
  481. &dev->i2c_adap);
  482. if (dvb->frontend != NULL)
  483. dvb_attach(tda18271_attach, dvb->frontend,
  484. 0x60, &dev->i2c_adap,
  485. &hauppauge_woodbury_tunerconfig);
  486. break;
  487. case AU0828_BOARD_DVICO_FUSIONHDTV7:
  488. dvb->frontend = dvb_attach(au8522_attach,
  489. &fusionhdtv7usb_config,
  490. &dev->i2c_adap);
  491. if (dvb->frontend != NULL) {
  492. dvb_attach(xc5000_attach, dvb->frontend,
  493. &dev->i2c_adap,
  494. &hauppauge_xc5000a_config);
  495. }
  496. break;
  497. default:
  498. pr_warn("The frontend of your DVB/ATSC card isn't supported yet\n");
  499. break;
  500. }
  501. if (NULL == dvb->frontend) {
  502. pr_err("%s() Frontend initialization failed\n",
  503. __func__);
  504. return -1;
  505. }
  506. /* define general-purpose callback pointer */
  507. dvb->frontend->callback = au0828_tuner_callback;
  508. /* register everything */
  509. ret = dvb_register(dev);
  510. if (ret < 0) {
  511. if (dvb->frontend->ops.release)
  512. dvb->frontend->ops.release(dvb->frontend);
  513. dvb->frontend = NULL;
  514. return ret;
  515. }
  516. return 0;
  517. }
  518. void au0828_dvb_suspend(struct au0828_dev *dev)
  519. {
  520. struct au0828_dvb *dvb = &dev->dvb;
  521. int rc;
  522. if (dvb->frontend) {
  523. if (dev->urb_streaming) {
  524. cancel_work_sync(&dev->restart_streaming);
  525. /* Stop transport */
  526. mutex_lock(&dvb->lock);
  527. stop_urb_transfer(dev);
  528. au0828_stop_transport(dev, 1);
  529. mutex_unlock(&dvb->lock);
  530. dev->need_urb_start = true;
  531. }
  532. /* suspend frontend - does tuner and fe to sleep */
  533. rc = dvb_frontend_suspend(dvb->frontend);
  534. pr_info("au0828_dvb_suspend(): Suspending DVB fe %d\n", rc);
  535. }
  536. }
  537. void au0828_dvb_resume(struct au0828_dev *dev)
  538. {
  539. struct au0828_dvb *dvb = &dev->dvb;
  540. int rc;
  541. if (dvb->frontend) {
  542. /* resume frontend - does fe and tuner init */
  543. rc = dvb_frontend_resume(dvb->frontend);
  544. pr_info("au0828_dvb_resume(): Resuming DVB fe %d\n", rc);
  545. if (dev->need_urb_start) {
  546. /* Start transport */
  547. mutex_lock(&dvb->lock);
  548. au0828_start_transport(dev);
  549. start_urb_transfer(dev);
  550. mutex_unlock(&dvb->lock);
  551. }
  552. }
  553. }