Lines Matching +full:port +full:- +full:1
1 // SPDX-License-Identifier: GPL-2.0-or-later
21 /* set port mux.*/ in smi_hw_init()
32 /* Port A */ in smi_hw_init()
40 /* Port B */ in smi_hw_init()
109 udelay(1); in smi_i2c_getsda()
110 return (smi_read(sw_ctl) & SW_I2C_MSK_DAT_IN) ? 1 : 0; in smi_i2c_getsda()
118 udelay(1); in smi_i2c_getscl()
119 return (smi_read(sw_ctl) & SW_I2C_MSK_CLK_IN) ? 1 : 0; in smi_i2c_getscl()
149 /* i2c 1.*/
184 i2c_set_adapdata(&dev->i2c_bus[0], dev); in smi_i2c_init()
185 strscpy(dev->i2c_bus[0].name, "SMI-I2C0", sizeof(dev->i2c_bus[0].name)); in smi_i2c_init()
186 dev->i2c_bus[0].owner = THIS_MODULE; in smi_i2c_init()
187 dev->i2c_bus[0].dev.parent = &dev->pci_dev->dev; in smi_i2c_init()
188 dev->i2c_bus[0].algo_data = &dev->i2c_bit[0]; in smi_i2c_init()
189 dev->i2c_bit[0].data = dev; in smi_i2c_init()
190 dev->i2c_bit[0].setsda = smi_i2c0_setsda; in smi_i2c_init()
191 dev->i2c_bit[0].setscl = smi_i2c0_setscl; in smi_i2c_init()
192 dev->i2c_bit[0].getsda = smi_i2c0_getsda; in smi_i2c_init()
193 dev->i2c_bit[0].getscl = smi_i2c0_getscl; in smi_i2c_init()
194 dev->i2c_bit[0].udelay = 12; in smi_i2c_init()
195 dev->i2c_bit[0].timeout = 10; in smi_i2c_init()
197 smi_i2c0_setsda(dev, 1); in smi_i2c_init()
198 smi_i2c0_setscl(dev, 1); in smi_i2c_init()
200 ret = i2c_bit_add_bus(&dev->i2c_bus[0]); in smi_i2c_init()
204 /* i2c bus 1 */ in smi_i2c_init()
206 i2c_set_adapdata(&dev->i2c_bus[1], dev); in smi_i2c_init()
207 strscpy(dev->i2c_bus[1].name, "SMI-I2C1", sizeof(dev->i2c_bus[1].name)); in smi_i2c_init()
208 dev->i2c_bus[1].owner = THIS_MODULE; in smi_i2c_init()
209 dev->i2c_bus[1].dev.parent = &dev->pci_dev->dev; in smi_i2c_init()
210 dev->i2c_bus[1].algo_data = &dev->i2c_bit[1]; in smi_i2c_init()
211 dev->i2c_bit[1].data = dev; in smi_i2c_init()
212 dev->i2c_bit[1].setsda = smi_i2c1_setsda; in smi_i2c_init()
213 dev->i2c_bit[1].setscl = smi_i2c1_setscl; in smi_i2c_init()
214 dev->i2c_bit[1].getsda = smi_i2c1_getsda; in smi_i2c_init()
215 dev->i2c_bit[1].getscl = smi_i2c1_getscl; in smi_i2c_init()
216 dev->i2c_bit[1].udelay = 12; in smi_i2c_init()
217 dev->i2c_bit[1].timeout = 10; in smi_i2c_init()
219 smi_i2c1_setsda(dev, 1); in smi_i2c_init()
220 smi_i2c1_setscl(dev, 1); in smi_i2c_init()
222 ret = i2c_bit_add_bus(&dev->i2c_bus[1]); in smi_i2c_init()
224 i2c_del_adapter(&dev->i2c_bus[0]); in smi_i2c_init()
231 i2c_del_adapter(&dev->i2c_bus[0]); in smi_i2c_exit()
232 i2c_del_adapter(&dev->i2c_bus[1]); in smi_i2c_exit()
250 dev_err(&i2c->dev, "%s: reg=0x%x (error=%d)\n", in smi_read_eeprom()
257 /* ts port interrupt operations */
258 static void smi_port_disableInterrupt(struct smi_port *port) in smi_port_disableInterrupt() argument
260 struct smi_dev *dev = port->dev; in smi_port_disableInterrupt()
263 (port->_dmaInterruptCH0 | port->_dmaInterruptCH1)); in smi_port_disableInterrupt()
266 static void smi_port_enableInterrupt(struct smi_port *port) in smi_port_enableInterrupt() argument
268 struct smi_dev *dev = port->dev; in smi_port_enableInterrupt()
271 (port->_dmaInterruptCH0 | port->_dmaInterruptCH1)); in smi_port_enableInterrupt()
274 static void smi_port_clearInterrupt(struct smi_port *port) in smi_port_clearInterrupt() argument
276 struct smi_dev *dev = port->dev; in smi_port_clearInterrupt()
279 (port->_dmaInterruptCH0 | port->_dmaInterruptCH1)); in smi_port_clearInterrupt()
285 struct smi_port *port = from_work(port, t, bh_work); in smi_dma_xfer() local
286 struct smi_dev *dev = port->dev; in smi_dma_xfer()
290 intr_status = port->_int_status; in smi_dma_xfer()
291 dmaManagement = smi_read(port->DMA_MANAGEMENT); in smi_dma_xfer()
295 /* CH-0 DMA interrupt.*/ in smi_dma_xfer()
296 if ((intr_status & port->_dmaInterruptCH0) && (dmaChan0State == 0x01)) { in smi_dma_xfer()
297 dev_dbg(&dev->pci_dev->dev, in smi_dma_xfer()
298 "Port[%d]-DMA CH0 engine complete successful !\n", in smi_dma_xfer()
299 port->idx); in smi_dma_xfer()
300 finishedData = smi_read(port->DMA_CHAN0_TRANS_STATE); in smi_dma_xfer()
309 dev_dbg(&dev->pci_dev->dev, in smi_dma_xfer()
313 dvb_dmx_swfilter_packets(&port->demux, in smi_dma_xfer()
314 port->cpu_addr[0], (finishedData / 188)); in smi_dma_xfer()
315 /*dvb_dmx_swfilter(&port->demux, in smi_dma_xfer()
316 port->cpu_addr[0], finishedData);*/ in smi_dma_xfer()
318 /* CH-1 DMA interrupt.*/ in smi_dma_xfer()
319 if ((intr_status & port->_dmaInterruptCH1) && (dmaChan1State == 0x01)) { in smi_dma_xfer()
320 dev_dbg(&dev->pci_dev->dev, in smi_dma_xfer()
321 "Port[%d]-DMA CH1 engine complete successful !\n", in smi_dma_xfer()
322 port->idx); in smi_dma_xfer()
323 finishedData = smi_read(port->DMA_CHAN1_TRANS_STATE); in smi_dma_xfer()
332 dev_dbg(&dev->pci_dev->dev, in smi_dma_xfer()
336 dvb_dmx_swfilter_packets(&port->demux, in smi_dma_xfer()
337 port->cpu_addr[1], (finishedData / 188)); in smi_dma_xfer()
338 /*dvb_dmx_swfilter(&port->demux, in smi_dma_xfer()
339 port->cpu_addr[1], finishedData);*/ in smi_dma_xfer()
342 if (intr_status & port->_dmaInterruptCH0) in smi_dma_xfer()
344 if (intr_status & port->_dmaInterruptCH1) in smi_dma_xfer()
346 smi_write(port->DMA_MANAGEMENT, dmaManagement); in smi_dma_xfer()
347 /* Re-enable interrupts */ in smi_dma_xfer()
348 smi_port_enableInterrupt(port); in smi_dma_xfer()
351 static void smi_port_dma_free(struct smi_port *port) in smi_port_dma_free() argument
353 if (port->cpu_addr[0]) { in smi_port_dma_free()
354 dma_free_coherent(&port->dev->pci_dev->dev, in smi_port_dma_free()
355 SMI_TS_DMA_BUF_SIZE, port->cpu_addr[0], in smi_port_dma_free()
356 port->dma_addr[0]); in smi_port_dma_free()
357 port->cpu_addr[0] = NULL; in smi_port_dma_free()
359 if (port->cpu_addr[1]) { in smi_port_dma_free()
360 dma_free_coherent(&port->dev->pci_dev->dev, in smi_port_dma_free()
361 SMI_TS_DMA_BUF_SIZE, port->cpu_addr[1], in smi_port_dma_free()
362 port->dma_addr[1]); in smi_port_dma_free()
363 port->cpu_addr[1] = NULL; in smi_port_dma_free()
367 static int smi_port_init(struct smi_port *port, int dmaChanUsed) in smi_port_init() argument
369 dev_dbg(&port->dev->pci_dev->dev, in smi_port_init()
370 "%s, port %d, dmaused %d\n", __func__, port->idx, dmaChanUsed); in smi_port_init()
371 port->enable = 0; in smi_port_init()
372 if (port->idx == 0) { in smi_port_init()
373 /* Port A */ in smi_port_init()
374 port->_dmaInterruptCH0 = dmaChanUsed & 0x01; in smi_port_init()
375 port->_dmaInterruptCH1 = dmaChanUsed & 0x02; in smi_port_init()
377 port->DMA_CHAN0_ADDR_LOW = DMA_PORTA_CHAN0_ADDR_LOW; in smi_port_init()
378 port->DMA_CHAN0_ADDR_HI = DMA_PORTA_CHAN0_ADDR_HI; in smi_port_init()
379 port->DMA_CHAN0_TRANS_STATE = DMA_PORTA_CHAN0_TRANS_STATE; in smi_port_init()
380 port->DMA_CHAN0_CONTROL = DMA_PORTA_CHAN0_CONTROL; in smi_port_init()
381 port->DMA_CHAN1_ADDR_LOW = DMA_PORTA_CHAN1_ADDR_LOW; in smi_port_init()
382 port->DMA_CHAN1_ADDR_HI = DMA_PORTA_CHAN1_ADDR_HI; in smi_port_init()
383 port->DMA_CHAN1_TRANS_STATE = DMA_PORTA_CHAN1_TRANS_STATE; in smi_port_init()
384 port->DMA_CHAN1_CONTROL = DMA_PORTA_CHAN1_CONTROL; in smi_port_init()
385 port->DMA_MANAGEMENT = DMA_PORTA_MANAGEMENT; in smi_port_init()
387 /* Port B */ in smi_port_init()
388 port->_dmaInterruptCH0 = (dmaChanUsed << 2) & 0x04; in smi_port_init()
389 port->_dmaInterruptCH1 = (dmaChanUsed << 2) & 0x08; in smi_port_init()
391 port->DMA_CHAN0_ADDR_LOW = DMA_PORTB_CHAN0_ADDR_LOW; in smi_port_init()
392 port->DMA_CHAN0_ADDR_HI = DMA_PORTB_CHAN0_ADDR_HI; in smi_port_init()
393 port->DMA_CHAN0_TRANS_STATE = DMA_PORTB_CHAN0_TRANS_STATE; in smi_port_init()
394 port->DMA_CHAN0_CONTROL = DMA_PORTB_CHAN0_CONTROL; in smi_port_init()
395 port->DMA_CHAN1_ADDR_LOW = DMA_PORTB_CHAN1_ADDR_LOW; in smi_port_init()
396 port->DMA_CHAN1_ADDR_HI = DMA_PORTB_CHAN1_ADDR_HI; in smi_port_init()
397 port->DMA_CHAN1_TRANS_STATE = DMA_PORTB_CHAN1_TRANS_STATE; in smi_port_init()
398 port->DMA_CHAN1_CONTROL = DMA_PORTB_CHAN1_CONTROL; in smi_port_init()
399 port->DMA_MANAGEMENT = DMA_PORTB_MANAGEMENT; in smi_port_init()
402 if (port->_dmaInterruptCH0) { in smi_port_init()
403 port->cpu_addr[0] = dma_alloc_coherent(&port->dev->pci_dev->dev, in smi_port_init()
405 &port->dma_addr[0], in smi_port_init()
407 if (!port->cpu_addr[0]) { in smi_port_init()
408 dev_err(&port->dev->pci_dev->dev, in smi_port_init()
409 "Port[%d] DMA CH0 memory allocation failed!\n", in smi_port_init()
410 port->idx); in smi_port_init()
415 if (port->_dmaInterruptCH1) { in smi_port_init()
416 port->cpu_addr[1] = dma_alloc_coherent(&port->dev->pci_dev->dev, in smi_port_init()
418 &port->dma_addr[1], in smi_port_init()
420 if (!port->cpu_addr[1]) { in smi_port_init()
421 dev_err(&port->dev->pci_dev->dev, in smi_port_init()
422 "Port[%d] DMA CH1 memory allocation failed!\n", in smi_port_init()
423 port->idx); in smi_port_init()
428 smi_port_disableInterrupt(port); in smi_port_init()
429 INIT_WORK(&port->bh_work, smi_dma_xfer); in smi_port_init()
430 disable_work_sync(&port->bh_work); in smi_port_init()
431 port->enable = 1; in smi_port_init()
434 smi_port_dma_free(port); in smi_port_init()
435 return -ENOMEM; in smi_port_init()
438 static void smi_port_exit(struct smi_port *port) in smi_port_exit() argument
440 smi_port_disableInterrupt(port); in smi_port_exit()
441 cancel_work_sync(&port->bh_work); in smi_port_exit()
442 smi_port_dma_free(port); in smi_port_exit()
443 port->enable = 0; in smi_port_exit()
446 static int smi_port_irq(struct smi_port *port, u32 int_status) in smi_port_irq() argument
448 u32 port_req_irq = port->_dmaInterruptCH0 | port->_dmaInterruptCH1; in smi_port_irq()
452 smi_port_disableInterrupt(port); in smi_port_irq()
453 port->_int_status = int_status; in smi_port_irq()
454 smi_port_clearInterrupt(port); in smi_port_irq()
455 queue_work(system_bh_wq, &port->bh_work); in smi_port_irq()
456 handled = 1; in smi_port_irq()
464 struct smi_port *port0 = &dev->ts_port[0]; in smi_irq_handler()
465 struct smi_port *port1 = &dev->ts_port[1]; in smi_irq_handler()
466 struct smi_rc *ir = &dev->ir; in smi_irq_handler()
472 if (dev->info->ts_0) in smi_irq_handler()
476 if (dev->info->ts_1) in smi_irq_handler()
490 request_module(info->type); in smi_add_i2c_client()
495 if (!try_module_get(client->dev.driver->owner)) { in smi_add_i2c_client()
508 module_put(client->dev.driver->owner); in smi_del_i2c_client()
519 .ts_clk_pol = 1,
522 .lnb_en_pol = 1,
525 static int smi_dvbsky_m88ds3103_fe_attach(struct smi_port *port) in smi_dvbsky_m88ds3103_fe_attach() argument
528 struct smi_dev *dev = port->dev; in smi_dvbsky_m88ds3103_fe_attach()
536 i2c = (port->idx == 0) ? &dev->i2c_bus[0] : &dev->i2c_bus[1]; in smi_dvbsky_m88ds3103_fe_attach()
539 port->fe = dvb_attach(m88ds3103_attach, in smi_dvbsky_m88ds3103_fe_attach()
541 if (!port->fe) { in smi_dvbsky_m88ds3103_fe_attach()
542 ret = -ENODEV; in smi_dvbsky_m88ds3103_fe_attach()
546 ts2020_config.fe = port->fe; in smi_dvbsky_m88ds3103_fe_attach()
552 ret = -ENODEV; in smi_dvbsky_m88ds3103_fe_attach()
557 port->fe->ops.read_signal_strength = in smi_dvbsky_m88ds3103_fe_attach()
558 port->fe->ops.tuner_ops.get_rf_strength; in smi_dvbsky_m88ds3103_fe_attach()
560 port->i2c_client_tuner = tuner_client; in smi_dvbsky_m88ds3103_fe_attach()
564 dvb_frontend_detach(port->fe); in smi_dvbsky_m88ds3103_fe_attach()
574 .ts_clk_pol = 1,
577 .lnb_en_pol = 1,
580 static int smi_dvbsky_m88rs6000_fe_attach(struct smi_port *port) in smi_dvbsky_m88rs6000_fe_attach() argument
583 struct smi_dev *dev = port->dev; in smi_dvbsky_m88rs6000_fe_attach()
592 i2c = (port->idx == 0) ? &dev->i2c_bus[0] : &dev->i2c_bus[1]; in smi_dvbsky_m88rs6000_fe_attach()
595 port->fe = dvb_attach(m88ds3103_attach, in smi_dvbsky_m88rs6000_fe_attach()
597 if (!port->fe) { in smi_dvbsky_m88rs6000_fe_attach()
598 ret = -ENODEV; in smi_dvbsky_m88rs6000_fe_attach()
602 m88rs6000t_config.fe = port->fe; in smi_dvbsky_m88rs6000_fe_attach()
608 ret = -ENODEV; in smi_dvbsky_m88rs6000_fe_attach()
613 port->fe->ops.read_signal_strength = in smi_dvbsky_m88rs6000_fe_attach()
614 port->fe->ops.tuner_ops.get_rf_strength; in smi_dvbsky_m88rs6000_fe_attach()
616 port->i2c_client_tuner = tuner_client; in smi_dvbsky_m88rs6000_fe_attach()
620 dvb_frontend_detach(port->fe); in smi_dvbsky_m88rs6000_fe_attach()
624 static int smi_dvbsky_sit2_fe_attach(struct smi_port *port) in smi_dvbsky_sit2_fe_attach() argument
627 struct smi_dev *dev = port->dev; in smi_dvbsky_sit2_fe_attach()
636 i2c = (port->idx == 0) ? &dev->i2c_bus[0] : &dev->i2c_bus[1]; in smi_dvbsky_sit2_fe_attach()
641 si2168_config.fe = &port->fe; in smi_dvbsky_sit2_fe_attach()
651 ret = -ENODEV; in smi_dvbsky_sit2_fe_attach()
654 port->i2c_client_demod = client_demod; in smi_dvbsky_sit2_fe_attach()
658 si2157_config.fe = port->fe; in smi_dvbsky_sit2_fe_attach()
659 si2157_config.if_port = 1; in smi_dvbsky_sit2_fe_attach()
668 smi_del_i2c_client(port->i2c_client_demod); in smi_dvbsky_sit2_fe_attach()
669 port->i2c_client_demod = NULL; in smi_dvbsky_sit2_fe_attach()
670 ret = -ENODEV; in smi_dvbsky_sit2_fe_attach()
673 port->i2c_client_tuner = client_tuner; in smi_dvbsky_sit2_fe_attach()
677 static int smi_fe_init(struct smi_port *port) in smi_fe_init() argument
680 struct smi_dev *dev = port->dev; in smi_fe_init()
681 struct dvb_adapter *adap = &port->dvb_adapter; in smi_fe_init()
684 dev_dbg(&port->dev->pci_dev->dev, in smi_fe_init()
685 "%s: port %d, fe_type = %d\n", in smi_fe_init()
686 __func__, port->idx, port->fe_type); in smi_fe_init()
687 switch (port->fe_type) { in smi_fe_init()
689 ret = smi_dvbsky_m88ds3103_fe_attach(port); in smi_fe_init()
692 ret = smi_dvbsky_m88rs6000_fe_attach(port); in smi_fe_init()
695 ret = smi_dvbsky_sit2_fe_attach(port); in smi_fe_init()
702 ret = dvb_register_frontend(adap, port->fe); in smi_fe_init()
704 if (port->i2c_client_tuner) in smi_fe_init()
705 smi_del_i2c_client(port->i2c_client_tuner); in smi_fe_init()
706 if (port->i2c_client_demod) in smi_fe_init()
707 smi_del_i2c_client(port->i2c_client_demod); in smi_fe_init()
708 dvb_frontend_detach(port->fe); in smi_fe_init()
712 ret = smi_read_eeprom(&dev->i2c_bus[0], 0xc0, mac_ee, 16); in smi_fe_init()
713 dev_info(&port->dev->pci_dev->dev, in smi_fe_init()
714 "%s port %d MAC: %pM\n", dev->info->name, in smi_fe_init()
715 port->idx, mac_ee + (port->idx)*8); in smi_fe_init()
716 memcpy(adap->proposed_mac, mac_ee + (port->idx)*8, 6); in smi_fe_init()
720 static void smi_fe_exit(struct smi_port *port) in smi_fe_exit() argument
722 dvb_unregister_frontend(port->fe); in smi_fe_exit()
724 if (port->i2c_client_tuner) in smi_fe_exit()
725 smi_del_i2c_client(port->i2c_client_tuner); in smi_fe_exit()
726 if (port->i2c_client_demod) in smi_fe_exit()
727 smi_del_i2c_client(port->i2c_client_demod); in smi_fe_exit()
728 dvb_frontend_detach(port->fe); in smi_fe_exit()
736 dvbdemux->priv = priv; in my_dvb_dmx_ts_card_init()
738 dvbdemux->filternum = 256; in my_dvb_dmx_ts_card_init()
739 dvbdemux->feednum = 256; in my_dvb_dmx_ts_card_init()
740 dvbdemux->start_feed = start_feed; in my_dvb_dmx_ts_card_init()
741 dvbdemux->stop_feed = stop_feed; in my_dvb_dmx_ts_card_init()
742 dvbdemux->write_to_decoder = NULL; in my_dvb_dmx_ts_card_init()
743 dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | in my_dvb_dmx_ts_card_init()
757 dmxdev->filternum = 256; in my_dvb_dmxdev_ts_card_init()
758 dmxdev->demux = &dvbdemux->dmx; in my_dvb_dmxdev_ts_card_init()
759 dmxdev->capabilities = 0; in my_dvb_dmxdev_ts_card_init()
764 hw_frontend->source = DMX_FRONTEND_0; in my_dvb_dmxdev_ts_card_init()
765 dvbdemux->dmx.add_frontend(&dvbdemux->dmx, hw_frontend); in my_dvb_dmxdev_ts_card_init()
766 mem_frontend->source = DMX_MEMORY_FE; in my_dvb_dmxdev_ts_card_init()
767 dvbdemux->dmx.add_frontend(&dvbdemux->dmx, mem_frontend); in my_dvb_dmxdev_ts_card_init()
768 return dvbdemux->dmx.connect_frontend(&dvbdemux->dmx, hw_frontend); in my_dvb_dmxdev_ts_card_init()
771 static u32 smi_config_DMA(struct smi_port *port) in smi_config_DMA() argument
773 struct smi_dev *dev = port->dev; in smi_config_DMA()
775 u8 chanLatencyTimer = 0, dmaChanEnable = 1, dmaTransStart = 1; in smi_config_DMA()
777 u8 tlpTc = 0, tlpTd = 1, tlpEp = 0, tlpAttr = 0; in smi_config_DMA()
780 dmaManagement = smi_read(port->DMA_MANAGEMENT); in smi_config_DMA()
781 /* Setup Channel-0 */ in smi_config_DMA()
782 if (port->_dmaInterruptCH0) { in smi_config_DMA()
784 mem = port->dma_addr[0]; in smi_config_DMA()
789 dmaManagement |= dmaChanEnable | (dmaTransStart << 1) in smi_config_DMA()
792 smi_write(port->DMA_CHAN0_ADDR_LOW, dmaMemPtrLow); in smi_config_DMA()
793 smi_write(port->DMA_CHAN0_ADDR_HI, dmaMemPtrHi); in smi_config_DMA()
794 smi_write(port->DMA_CHAN0_CONTROL, dmaCtlReg); in smi_config_DMA()
796 /* Setup Channel-1 */ in smi_config_DMA()
797 if (port->_dmaInterruptCH1) { in smi_config_DMA()
799 mem = port->dma_addr[1]; in smi_config_DMA()
807 smi_write(port->DMA_CHAN1_ADDR_LOW, dmaMemPtrLow); in smi_config_DMA()
808 smi_write(port->DMA_CHAN1_ADDR_HI, dmaMemPtrHi); in smi_config_DMA()
809 smi_write(port->DMA_CHAN1_CONTROL, dmaCtlReg); in smi_config_DMA()
816 struct dvb_demux *dvbdmx = dvbdmxfeed->demux; in smi_start_feed()
817 struct smi_port *port = dvbdmx->priv; in smi_start_feed() local
818 struct smi_dev *dev = port->dev; in smi_start_feed()
821 if (port->users++ == 0) { in smi_start_feed()
822 dmaManagement = smi_config_DMA(port); in smi_start_feed()
823 smi_port_clearInterrupt(port); in smi_start_feed()
824 smi_port_enableInterrupt(port); in smi_start_feed()
825 smi_write(port->DMA_MANAGEMENT, dmaManagement); in smi_start_feed()
826 enable_and_queue_work(system_bh_wq, &port->bh_work); in smi_start_feed()
828 return port->users; in smi_start_feed()
833 struct dvb_demux *dvbdmx = dvbdmxfeed->demux; in smi_stop_feed()
834 struct smi_port *port = dvbdmx->priv; in smi_stop_feed() local
835 struct smi_dev *dev = port->dev; in smi_stop_feed()
837 if (--port->users) in smi_stop_feed()
838 return port->users; in smi_stop_feed()
840 disable_work_sync(&port->bh_work); in smi_stop_feed()
841 smi_port_disableInterrupt(port); in smi_stop_feed()
842 smi_clear(port->DMA_MANAGEMENT, 0x30003); in smi_stop_feed()
846 static int smi_dvb_init(struct smi_port *port) in smi_dvb_init() argument
849 struct dvb_adapter *adap = &port->dvb_adapter; in smi_dvb_init()
850 struct dvb_demux *dvbdemux = &port->demux; in smi_dvb_init()
852 dev_dbg(&port->dev->pci_dev->dev, in smi_dvb_init()
853 "%s, port %d\n", __func__, port->idx); in smi_dvb_init()
856 &port->dev->pci_dev->dev, in smi_dvb_init()
859 dev_err(&port->dev->pci_dev->dev, "Fail to register DVB adapter.\n"); in smi_dvb_init()
864 smi_stop_feed, port); in smi_dvb_init()
868 ret = my_dvb_dmxdev_ts_card_init(&port->dmxdev, &port->demux, in smi_dvb_init()
869 &port->hw_frontend, in smi_dvb_init()
870 &port->mem_frontend, adap); in smi_dvb_init()
874 ret = dvb_net_init(adap, &port->dvbnet, port->dmxdev.demux); in smi_dvb_init()
879 dvbdemux->dmx.close(&dvbdemux->dmx); in smi_dvb_init()
880 dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &port->hw_frontend); in smi_dvb_init()
881 dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &port->mem_frontend); in smi_dvb_init()
882 dvb_dmxdev_release(&port->dmxdev); in smi_dvb_init()
884 dvb_dmx_release(&port->demux); in smi_dvb_init()
886 dvb_unregister_adapter(&port->dvb_adapter); in smi_dvb_init()
890 static void smi_dvb_exit(struct smi_port *port) in smi_dvb_exit() argument
892 struct dvb_demux *dvbdemux = &port->demux; in smi_dvb_exit()
894 dvb_net_release(&port->dvbnet); in smi_dvb_exit()
896 dvbdemux->dmx.close(&dvbdemux->dmx); in smi_dvb_exit()
897 dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &port->hw_frontend); in smi_dvb_exit()
898 dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &port->mem_frontend); in smi_dvb_exit()
899 dvb_dmxdev_release(&port->dmxdev); in smi_dvb_exit()
900 dvb_dmx_release(&port->demux); in smi_dvb_exit()
902 dvb_unregister_adapter(&port->dvb_adapter); in smi_dvb_exit()
906 struct smi_port *port, int index) in smi_port_attach() argument
910 port->dev = dev; in smi_port_attach()
911 port->idx = index; in smi_port_attach()
912 port->fe_type = (index == 0) ? dev->info->fe_0 : dev->info->fe_1; in smi_port_attach()
913 dmachs = (index == 0) ? dev->info->ts_0 : dev->info->ts_1; in smi_port_attach()
914 /* port init.*/ in smi_port_attach()
915 ret = smi_port_init(port, dmachs); in smi_port_attach()
919 ret = smi_dvb_init(port); in smi_port_attach()
923 ret = smi_fe_init(port); in smi_port_attach()
928 smi_dvb_exit(port); in smi_port_attach()
930 smi_port_exit(port); in smi_port_attach()
934 static void smi_port_detach(struct smi_port *port) in smi_port_detach() argument
936 smi_fe_exit(port); in smi_port_detach()
937 smi_dvb_exit(port); in smi_port_detach()
938 smi_port_exit(port); in smi_port_detach()
944 int ret = -ENOMEM; in smi_probe()
947 return -ENODEV; in smi_probe()
951 ret = -ENOMEM; in smi_probe()
955 dev->pci_dev = pdev; in smi_probe()
957 dev->info = (struct smi_cfg_info *) id->driver_data; in smi_probe()
958 dev_info(&dev->pci_dev->dev, in smi_probe()
959 "card detected: %s\n", dev->info->name); in smi_probe()
961 dev->nr = dev->info->type; in smi_probe()
962 dev->lmmio = ioremap(pci_resource_start(dev->pci_dev, 0), in smi_probe()
963 pci_resource_len(dev->pci_dev, 0)); in smi_probe()
964 if (!dev->lmmio) { in smi_probe()
965 ret = -ENOMEM; in smi_probe()
970 ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); in smi_probe()
984 if (dev->info->ts_0) { in smi_probe()
985 ret = smi_port_attach(dev, &dev->ts_port[0], 0); in smi_probe()
990 if (dev->info->ts_1) { in smi_probe()
991 ret = smi_port_attach(dev, &dev->ts_port[1], 1); in smi_probe()
1002 ret = pci_enable_msi(dev->pci_dev); in smi_probe()
1004 dev_info(&dev->pci_dev->dev, "MSI not available.\n"); in smi_probe()
1007 ret = request_irq(dev->pci_dev->irq, smi_irq_handler, in smi_probe()
1012 smi_ir_start(&dev->ir); in smi_probe()
1018 if (dev->info->ts_1) in smi_probe()
1019 smi_port_detach(&dev->ts_port[1]); in smi_probe()
1021 if (dev->info->ts_0) in smi_probe()
1022 smi_port_detach(&dev->ts_port[0]); in smi_probe()
1026 iounmap(dev->lmmio); in smi_probe()
1040 free_irq(dev->pci_dev->irq, dev); in smi_remove()
1042 pci_disable_msi(dev->pci_dev); in smi_remove()
1044 if (dev->info->ts_1) in smi_remove()
1045 smi_port_detach(&dev->ts_port[1]); in smi_remove()
1046 if (dev->info->ts_0) in smi_remove()
1047 smi_port_detach(&dev->ts_port[0]); in smi_remove()
1051 iounmap(dev->lmmio); in smi_remove()
1090 .name = "TechnoTrend TT-budget S2-4200 Twin",