Lines Matching refs:adap

92 pt3_demod_write(struct pt3_adapter *adap, const struct reg_val *data, int num)  in pt3_demod_write()  argument
98 msg.addr = adap->i2c_demod->addr; in pt3_demod_write()
103 ret = i2c_transfer(adap->i2c_demod->adapter, &msg, 1); in pt3_demod_write()
150 struct pt3_adapter *adap; in pt3_set_lna() local
157 adap = pt3_find_adapter(fe); in pt3_set_lna()
159 if (val == LNA_AUTO || val == adap->cur_lna) in pt3_set_lna()
162 pt3 = adap->dvb_adap.priv; in pt3_set_lna()
179 adap->cur_lna = (val != 0); in pt3_set_lna()
185 struct pt3_adapter *adap; in pt3_set_voltage() local
191 adap = pt3_find_adapter(fe); in pt3_set_voltage()
193 if (on == adap->cur_lnb) in pt3_set_voltage()
195 adap->cur_lnb = on; in pt3_set_voltage()
196 pt3 = adap->dvb_adap.priv; in pt3_set_voltage()
427 struct pt3_adapter *adap = data; in pt3_fetch_thread() local
435 pt3_init_dmabuf(adap); in pt3_fetch_thread()
436 adap->num_discard = PT3_INITIAL_BUF_DROPS; in pt3_fetch_thread()
438 dev_dbg(adap->dvb_adap.device, "PT3: [%s] started\n", in pt3_fetch_thread()
439 adap->thread->comm); in pt3_fetch_thread()
443 adap->num_discard = PT3_INITIAL_BUF_DROPS; in pt3_fetch_thread()
445 pt3_proc_dma(adap); in pt3_fetch_thread()
453 dev_dbg(adap->dvb_adap.device, "PT3: [%s] exited\n", in pt3_fetch_thread()
454 adap->thread->comm); in pt3_fetch_thread()
458 static int pt3_start_streaming(struct pt3_adapter *adap) in pt3_start_streaming() argument
463 thread = kthread_run(pt3_fetch_thread, adap, "pt3-ad%i-dmx%i", in pt3_start_streaming()
464 adap->dvb_adap.num, adap->dmxdev.dvbdev->id); in pt3_start_streaming()
468 adap->thread = NULL; in pt3_start_streaming()
469 dev_warn(adap->dvb_adap.device, in pt3_start_streaming()
471 adap->dvb_adap.num, adap->dmxdev.dvbdev->id); in pt3_start_streaming()
474 adap->thread = thread; in pt3_start_streaming()
476 return pt3_start_dma(adap); in pt3_start_streaming()
479 static int pt3_stop_streaming(struct pt3_adapter *adap) in pt3_stop_streaming() argument
483 ret = pt3_stop_dma(adap); in pt3_stop_streaming()
485 dev_warn(adap->dvb_adap.device, in pt3_stop_streaming()
487 adap->dvb_adap.num, adap->fe->id); in pt3_stop_streaming()
490 ret = kthread_stop(adap->thread); in pt3_stop_streaming()
491 adap->thread = NULL; in pt3_stop_streaming()
497 struct pt3_adapter *adap; in pt3_start_feed() local
502 adap = container_of(feed->demux, struct pt3_adapter, demux); in pt3_start_feed()
503 adap->num_feeds++; in pt3_start_feed()
504 if (adap->num_feeds > 1) in pt3_start_feed()
507 return pt3_start_streaming(adap); in pt3_start_feed()
513 struct pt3_adapter *adap; in pt3_stop_feed() local
515 adap = container_of(feed->demux, struct pt3_adapter, demux); in pt3_stop_feed()
517 adap->num_feeds--; in pt3_stop_feed()
518 if (adap->num_feeds > 0 || !adap->thread) in pt3_stop_feed()
520 adap->num_feeds = 0; in pt3_stop_feed()
522 return pt3_stop_streaming(adap); in pt3_stop_feed()
529 struct pt3_adapter *adap; in pt3_alloc_adapter() local
532 adap = kzalloc(sizeof(*adap), GFP_KERNEL); in pt3_alloc_adapter()
533 if (!adap) in pt3_alloc_adapter()
536 pt3->adaps[index] = adap; in pt3_alloc_adapter()
537 adap->adap_idx = index; in pt3_alloc_adapter()
540 ret = dvb_register_adapter(&adap->dvb_adap, "PT3 DVB", in pt3_alloc_adapter()
547 da = &adap->dvb_adap; in pt3_alloc_adapter()
551 adap->dvb_adap.priv = pt3; in pt3_alloc_adapter()
552 adap->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING; in pt3_alloc_adapter()
553 adap->demux.priv = adap; in pt3_alloc_adapter()
554 adap->demux.feednum = 256; in pt3_alloc_adapter()
555 adap->demux.filternum = 256; in pt3_alloc_adapter()
556 adap->demux.start_feed = pt3_start_feed; in pt3_alloc_adapter()
557 adap->demux.stop_feed = pt3_stop_feed; in pt3_alloc_adapter()
558 ret = dvb_dmx_init(&adap->demux); in pt3_alloc_adapter()
564 adap->dmxdev.filternum = 256; in pt3_alloc_adapter()
565 adap->dmxdev.demux = &adap->demux.dmx; in pt3_alloc_adapter()
566 ret = dvb_dmxdev_init(&adap->dmxdev, da); in pt3_alloc_adapter()
572 ret = pt3_alloc_dmabuf(adap); in pt3_alloc_adapter()
581 pt3_free_dmabuf(adap); in pt3_alloc_adapter()
582 dvb_dmxdev_release(&adap->dmxdev); in pt3_alloc_adapter()
584 dvb_dmx_release(&adap->demux); in pt3_alloc_adapter()
589 kfree(adap); in pt3_alloc_adapter()
596 struct pt3_adapter *adap; in pt3_cleanup_adapter() local
599 adap = pt3->adaps[index]; in pt3_cleanup_adapter()
600 if (adap == NULL) in pt3_cleanup_adapter()
604 if (adap->thread) in pt3_cleanup_adapter()
605 pt3_stop_streaming(adap); in pt3_cleanup_adapter()
607 dmx = &adap->demux.dmx; in pt3_cleanup_adapter()
609 if (adap->fe) { in pt3_cleanup_adapter()
610 adap->fe->callback = NULL; in pt3_cleanup_adapter()
611 if (adap->fe->frontend_priv) in pt3_cleanup_adapter()
612 dvb_unregister_frontend(adap->fe); in pt3_cleanup_adapter()
613 dvb_module_release(adap->i2c_tuner); in pt3_cleanup_adapter()
614 dvb_module_release(adap->i2c_demod); in pt3_cleanup_adapter()
616 pt3_free_dmabuf(adap); in pt3_cleanup_adapter()
617 dvb_dmxdev_release(&adap->dmxdev); in pt3_cleanup_adapter()
618 dvb_dmx_release(&adap->demux); in pt3_cleanup_adapter()
620 dvb_unregister_adapter(&adap->dvb_adap); in pt3_cleanup_adapter()
621 kfree(adap); in pt3_cleanup_adapter()
631 struct pt3_adapter *adap; in pt3_suspend() local
634 adap = pt3->adaps[i]; in pt3_suspend()
635 if (adap->num_feeds > 0) in pt3_suspend()
636 pt3_stop_dma(adap); in pt3_suspend()
637 dvb_frontend_suspend(adap->fe); in pt3_suspend()
638 pt3_free_dmabuf(adap); in pt3_suspend()
650 struct pt3_adapter *adap; in pt3_resume() local
662 adap = pt3->adaps[i]; in pt3_resume()
663 dvb_frontend_resume(adap->fe); in pt3_resume()
664 ret = pt3_alloc_dmabuf(adap); in pt3_resume()
669 if (adap->num_feeds > 0) in pt3_resume()
670 pt3_start_dma(adap); in pt3_resume()