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_tasklet(port, t, tasklet); 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 pci_free_consistent(port->dev->pci_dev, SMI_TS_DMA_BUF_SIZE, in smi_port_dma_free()
355 port->cpu_addr[0], port->dma_addr[0]); in smi_port_dma_free()
356 port->cpu_addr[0] = NULL; in smi_port_dma_free()
358 if (port->cpu_addr[1]) { in smi_port_dma_free()
359 pci_free_consistent(port->dev->pci_dev, SMI_TS_DMA_BUF_SIZE, in smi_port_dma_free()
360 port->cpu_addr[1], port->dma_addr[1]); in smi_port_dma_free()
361 port->cpu_addr[1] = NULL; in smi_port_dma_free()
365 static int smi_port_init(struct smi_port *port, int dmaChanUsed) in smi_port_init() argument
367 dev_dbg(&port->dev->pci_dev->dev, in smi_port_init()
368 "%s, port %d, dmaused %d\n", __func__, port->idx, dmaChanUsed); in smi_port_init()
369 port->enable = 0; in smi_port_init()
370 if (port->idx == 0) { in smi_port_init()
371 /* Port A */ in smi_port_init()
372 port->_dmaInterruptCH0 = dmaChanUsed & 0x01; in smi_port_init()
373 port->_dmaInterruptCH1 = dmaChanUsed & 0x02; in smi_port_init()
375 port->DMA_CHAN0_ADDR_LOW = DMA_PORTA_CHAN0_ADDR_LOW; in smi_port_init()
376 port->DMA_CHAN0_ADDR_HI = DMA_PORTA_CHAN0_ADDR_HI; in smi_port_init()
377 port->DMA_CHAN0_TRANS_STATE = DMA_PORTA_CHAN0_TRANS_STATE; in smi_port_init()
378 port->DMA_CHAN0_CONTROL = DMA_PORTA_CHAN0_CONTROL; in smi_port_init()
379 port->DMA_CHAN1_ADDR_LOW = DMA_PORTA_CHAN1_ADDR_LOW; in smi_port_init()
380 port->DMA_CHAN1_ADDR_HI = DMA_PORTA_CHAN1_ADDR_HI; in smi_port_init()
381 port->DMA_CHAN1_TRANS_STATE = DMA_PORTA_CHAN1_TRANS_STATE; in smi_port_init()
382 port->DMA_CHAN1_CONTROL = DMA_PORTA_CHAN1_CONTROL; in smi_port_init()
383 port->DMA_MANAGEMENT = DMA_PORTA_MANAGEMENT; in smi_port_init()
385 /* Port B */ in smi_port_init()
386 port->_dmaInterruptCH0 = (dmaChanUsed << 2) & 0x04; in smi_port_init()
387 port->_dmaInterruptCH1 = (dmaChanUsed << 2) & 0x08; in smi_port_init()
389 port->DMA_CHAN0_ADDR_LOW = DMA_PORTB_CHAN0_ADDR_LOW; in smi_port_init()
390 port->DMA_CHAN0_ADDR_HI = DMA_PORTB_CHAN0_ADDR_HI; in smi_port_init()
391 port->DMA_CHAN0_TRANS_STATE = DMA_PORTB_CHAN0_TRANS_STATE; in smi_port_init()
392 port->DMA_CHAN0_CONTROL = DMA_PORTB_CHAN0_CONTROL; in smi_port_init()
393 port->DMA_CHAN1_ADDR_LOW = DMA_PORTB_CHAN1_ADDR_LOW; in smi_port_init()
394 port->DMA_CHAN1_ADDR_HI = DMA_PORTB_CHAN1_ADDR_HI; in smi_port_init()
395 port->DMA_CHAN1_TRANS_STATE = DMA_PORTB_CHAN1_TRANS_STATE; in smi_port_init()
396 port->DMA_CHAN1_CONTROL = DMA_PORTB_CHAN1_CONTROL; in smi_port_init()
397 port->DMA_MANAGEMENT = DMA_PORTB_MANAGEMENT; in smi_port_init()
400 if (port->_dmaInterruptCH0) { in smi_port_init()
401 port->cpu_addr[0] = pci_alloc_consistent(port->dev->pci_dev, in smi_port_init()
403 &port->dma_addr[0]); in smi_port_init()
404 if (!port->cpu_addr[0]) { in smi_port_init()
405 dev_err(&port->dev->pci_dev->dev, in smi_port_init()
406 "Port[%d] DMA CH0 memory allocation failed!\n", in smi_port_init()
407 port->idx); in smi_port_init()
412 if (port->_dmaInterruptCH1) { in smi_port_init()
413 port->cpu_addr[1] = pci_alloc_consistent(port->dev->pci_dev, in smi_port_init()
415 &port->dma_addr[1]); in smi_port_init()
416 if (!port->cpu_addr[1]) { in smi_port_init()
417 dev_err(&port->dev->pci_dev->dev, in smi_port_init()
418 "Port[%d] DMA CH1 memory allocation failed!\n", in smi_port_init()
419 port->idx); in smi_port_init()
424 smi_port_disableInterrupt(port); in smi_port_init()
425 tasklet_setup(&port->tasklet, smi_dma_xfer); in smi_port_init()
426 tasklet_disable(&port->tasklet); in smi_port_init()
427 port->enable = 1; in smi_port_init()
430 smi_port_dma_free(port); in smi_port_init()
431 return -ENOMEM; in smi_port_init()
434 static void smi_port_exit(struct smi_port *port) in smi_port_exit() argument
436 smi_port_disableInterrupt(port); in smi_port_exit()
437 tasklet_kill(&port->tasklet); in smi_port_exit()
438 smi_port_dma_free(port); in smi_port_exit()
439 port->enable = 0; in smi_port_exit()
442 static int smi_port_irq(struct smi_port *port, u32 int_status) in smi_port_irq() argument
444 u32 port_req_irq = port->_dmaInterruptCH0 | port->_dmaInterruptCH1; in smi_port_irq()
448 smi_port_disableInterrupt(port); in smi_port_irq()
449 port->_int_status = int_status; in smi_port_irq()
450 smi_port_clearInterrupt(port); in smi_port_irq()
451 tasklet_schedule(&port->tasklet); in smi_port_irq()
452 handled = 1; in smi_port_irq()
460 struct smi_port *port0 = &dev->ts_port[0]; in smi_irq_handler()
461 struct smi_port *port1 = &dev->ts_port[1]; in smi_irq_handler()
462 struct smi_rc *ir = &dev->ir; in smi_irq_handler()
468 if (dev->info->ts_0) in smi_irq_handler()
472 if (dev->info->ts_1) in smi_irq_handler()
486 request_module(info->type); in smi_add_i2c_client()
491 if (!try_module_get(client->dev.driver->owner)) { in smi_add_i2c_client()
504 module_put(client->dev.driver->owner); in smi_del_i2c_client()
515 .ts_clk_pol = 1,
518 .lnb_en_pol = 1,
521 static int smi_dvbsky_m88ds3103_fe_attach(struct smi_port *port) in smi_dvbsky_m88ds3103_fe_attach() argument
524 struct smi_dev *dev = port->dev; in smi_dvbsky_m88ds3103_fe_attach()
532 i2c = (port->idx == 0) ? &dev->i2c_bus[0] : &dev->i2c_bus[1]; in smi_dvbsky_m88ds3103_fe_attach()
535 port->fe = dvb_attach(m88ds3103_attach, in smi_dvbsky_m88ds3103_fe_attach()
537 if (!port->fe) { in smi_dvbsky_m88ds3103_fe_attach()
538 ret = -ENODEV; in smi_dvbsky_m88ds3103_fe_attach()
542 ts2020_config.fe = port->fe; in smi_dvbsky_m88ds3103_fe_attach()
548 ret = -ENODEV; in smi_dvbsky_m88ds3103_fe_attach()
553 port->fe->ops.read_signal_strength = in smi_dvbsky_m88ds3103_fe_attach()
554 port->fe->ops.tuner_ops.get_rf_strength; in smi_dvbsky_m88ds3103_fe_attach()
556 port->i2c_client_tuner = tuner_client; in smi_dvbsky_m88ds3103_fe_attach()
560 dvb_frontend_detach(port->fe); in smi_dvbsky_m88ds3103_fe_attach()
570 .ts_clk_pol = 1,
573 .lnb_en_pol = 1,
576 static int smi_dvbsky_m88rs6000_fe_attach(struct smi_port *port) in smi_dvbsky_m88rs6000_fe_attach() argument
579 struct smi_dev *dev = port->dev; in smi_dvbsky_m88rs6000_fe_attach()
588 i2c = (port->idx == 0) ? &dev->i2c_bus[0] : &dev->i2c_bus[1]; in smi_dvbsky_m88rs6000_fe_attach()
591 port->fe = dvb_attach(m88ds3103_attach, in smi_dvbsky_m88rs6000_fe_attach()
593 if (!port->fe) { in smi_dvbsky_m88rs6000_fe_attach()
594 ret = -ENODEV; in smi_dvbsky_m88rs6000_fe_attach()
598 m88rs6000t_config.fe = port->fe; in smi_dvbsky_m88rs6000_fe_attach()
604 ret = -ENODEV; in smi_dvbsky_m88rs6000_fe_attach()
609 port->fe->ops.read_signal_strength = in smi_dvbsky_m88rs6000_fe_attach()
610 port->fe->ops.tuner_ops.get_rf_strength; in smi_dvbsky_m88rs6000_fe_attach()
612 port->i2c_client_tuner = tuner_client; in smi_dvbsky_m88rs6000_fe_attach()
616 dvb_frontend_detach(port->fe); in smi_dvbsky_m88rs6000_fe_attach()
620 static int smi_dvbsky_sit2_fe_attach(struct smi_port *port) in smi_dvbsky_sit2_fe_attach() argument
623 struct smi_dev *dev = port->dev; in smi_dvbsky_sit2_fe_attach()
632 i2c = (port->idx == 0) ? &dev->i2c_bus[0] : &dev->i2c_bus[1]; in smi_dvbsky_sit2_fe_attach()
637 si2168_config.fe = &port->fe; in smi_dvbsky_sit2_fe_attach()
647 ret = -ENODEV; in smi_dvbsky_sit2_fe_attach()
650 port->i2c_client_demod = client_demod; in smi_dvbsky_sit2_fe_attach()
654 si2157_config.fe = port->fe; in smi_dvbsky_sit2_fe_attach()
655 si2157_config.if_port = 1; in smi_dvbsky_sit2_fe_attach()
664 smi_del_i2c_client(port->i2c_client_demod); in smi_dvbsky_sit2_fe_attach()
665 port->i2c_client_demod = NULL; in smi_dvbsky_sit2_fe_attach()
666 ret = -ENODEV; in smi_dvbsky_sit2_fe_attach()
669 port->i2c_client_tuner = client_tuner; in smi_dvbsky_sit2_fe_attach()
673 static int smi_fe_init(struct smi_port *port) in smi_fe_init() argument
676 struct smi_dev *dev = port->dev; in smi_fe_init()
677 struct dvb_adapter *adap = &port->dvb_adapter; in smi_fe_init()
680 dev_dbg(&port->dev->pci_dev->dev, in smi_fe_init()
681 "%s: port %d, fe_type = %d\n", in smi_fe_init()
682 __func__, port->idx, port->fe_type); in smi_fe_init()
683 switch (port->fe_type) { in smi_fe_init()
685 ret = smi_dvbsky_m88ds3103_fe_attach(port); in smi_fe_init()
688 ret = smi_dvbsky_m88rs6000_fe_attach(port); in smi_fe_init()
691 ret = smi_dvbsky_sit2_fe_attach(port); in smi_fe_init()
698 ret = dvb_register_frontend(adap, port->fe); in smi_fe_init()
700 if (port->i2c_client_tuner) in smi_fe_init()
701 smi_del_i2c_client(port->i2c_client_tuner); in smi_fe_init()
702 if (port->i2c_client_demod) in smi_fe_init()
703 smi_del_i2c_client(port->i2c_client_demod); in smi_fe_init()
704 dvb_frontend_detach(port->fe); in smi_fe_init()
708 ret = smi_read_eeprom(&dev->i2c_bus[0], 0xc0, mac_ee, 16); in smi_fe_init()
709 dev_info(&port->dev->pci_dev->dev, in smi_fe_init()
710 "%s port %d MAC: %pM\n", dev->info->name, in smi_fe_init()
711 port->idx, mac_ee + (port->idx)*8); in smi_fe_init()
712 memcpy(adap->proposed_mac, mac_ee + (port->idx)*8, 6); in smi_fe_init()
716 static void smi_fe_exit(struct smi_port *port) in smi_fe_exit() argument
718 dvb_unregister_frontend(port->fe); in smi_fe_exit()
720 if (port->i2c_client_tuner) in smi_fe_exit()
721 smi_del_i2c_client(port->i2c_client_tuner); in smi_fe_exit()
722 if (port->i2c_client_demod) in smi_fe_exit()
723 smi_del_i2c_client(port->i2c_client_demod); in smi_fe_exit()
724 dvb_frontend_detach(port->fe); in smi_fe_exit()
732 dvbdemux->priv = priv; in my_dvb_dmx_ts_card_init()
734 dvbdemux->filternum = 256; in my_dvb_dmx_ts_card_init()
735 dvbdemux->feednum = 256; in my_dvb_dmx_ts_card_init()
736 dvbdemux->start_feed = start_feed; in my_dvb_dmx_ts_card_init()
737 dvbdemux->stop_feed = stop_feed; in my_dvb_dmx_ts_card_init()
738 dvbdemux->write_to_decoder = NULL; in my_dvb_dmx_ts_card_init()
739 dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | in my_dvb_dmx_ts_card_init()
753 dmxdev->filternum = 256; in my_dvb_dmxdev_ts_card_init()
754 dmxdev->demux = &dvbdemux->dmx; in my_dvb_dmxdev_ts_card_init()
755 dmxdev->capabilities = 0; in my_dvb_dmxdev_ts_card_init()
760 hw_frontend->source = DMX_FRONTEND_0; in my_dvb_dmxdev_ts_card_init()
761 dvbdemux->dmx.add_frontend(&dvbdemux->dmx, hw_frontend); in my_dvb_dmxdev_ts_card_init()
762 mem_frontend->source = DMX_MEMORY_FE; in my_dvb_dmxdev_ts_card_init()
763 dvbdemux->dmx.add_frontend(&dvbdemux->dmx, mem_frontend); in my_dvb_dmxdev_ts_card_init()
764 return dvbdemux->dmx.connect_frontend(&dvbdemux->dmx, hw_frontend); in my_dvb_dmxdev_ts_card_init()
767 static u32 smi_config_DMA(struct smi_port *port) in smi_config_DMA() argument
769 struct smi_dev *dev = port->dev; in smi_config_DMA()
771 u8 chanLatencyTimer = 0, dmaChanEnable = 1, dmaTransStart = 1; in smi_config_DMA()
773 u8 tlpTc = 0, tlpTd = 1, tlpEp = 0, tlpAttr = 0; in smi_config_DMA()
776 dmaManagement = smi_read(port->DMA_MANAGEMENT); in smi_config_DMA()
777 /* Setup Channel-0 */ in smi_config_DMA()
778 if (port->_dmaInterruptCH0) { in smi_config_DMA()
780 mem = port->dma_addr[0]; in smi_config_DMA()
785 dmaManagement |= dmaChanEnable | (dmaTransStart << 1) in smi_config_DMA()
788 smi_write(port->DMA_CHAN0_ADDR_LOW, dmaMemPtrLow); in smi_config_DMA()
789 smi_write(port->DMA_CHAN0_ADDR_HI, dmaMemPtrHi); in smi_config_DMA()
790 smi_write(port->DMA_CHAN0_CONTROL, dmaCtlReg); in smi_config_DMA()
792 /* Setup Channel-1 */ in smi_config_DMA()
793 if (port->_dmaInterruptCH1) { in smi_config_DMA()
795 mem = port->dma_addr[1]; in smi_config_DMA()
803 smi_write(port->DMA_CHAN1_ADDR_LOW, dmaMemPtrLow); in smi_config_DMA()
804 smi_write(port->DMA_CHAN1_ADDR_HI, dmaMemPtrHi); in smi_config_DMA()
805 smi_write(port->DMA_CHAN1_CONTROL, dmaCtlReg); in smi_config_DMA()
812 struct dvb_demux *dvbdmx = dvbdmxfeed->demux; in smi_start_feed()
813 struct smi_port *port = dvbdmx->priv; in smi_start_feed() local
814 struct smi_dev *dev = port->dev; in smi_start_feed()
817 if (port->users++ == 0) { in smi_start_feed()
818 dmaManagement = smi_config_DMA(port); in smi_start_feed()
819 smi_port_clearInterrupt(port); in smi_start_feed()
820 smi_port_enableInterrupt(port); in smi_start_feed()
821 smi_write(port->DMA_MANAGEMENT, dmaManagement); in smi_start_feed()
822 tasklet_enable(&port->tasklet); in smi_start_feed()
824 return port->users; in smi_start_feed()
829 struct dvb_demux *dvbdmx = dvbdmxfeed->demux; in smi_stop_feed()
830 struct smi_port *port = dvbdmx->priv; in smi_stop_feed() local
831 struct smi_dev *dev = port->dev; in smi_stop_feed()
833 if (--port->users) in smi_stop_feed()
834 return port->users; in smi_stop_feed()
836 tasklet_disable(&port->tasklet); in smi_stop_feed()
837 smi_port_disableInterrupt(port); in smi_stop_feed()
838 smi_clear(port->DMA_MANAGEMENT, 0x30003); in smi_stop_feed()
842 static int smi_dvb_init(struct smi_port *port) in smi_dvb_init() argument
845 struct dvb_adapter *adap = &port->dvb_adapter; in smi_dvb_init()
846 struct dvb_demux *dvbdemux = &port->demux; in smi_dvb_init()
848 dev_dbg(&port->dev->pci_dev->dev, in smi_dvb_init()
849 "%s, port %d\n", __func__, port->idx); in smi_dvb_init()
852 &port->dev->pci_dev->dev, in smi_dvb_init()
855 dev_err(&port->dev->pci_dev->dev, "Fail to register DVB adapter.\n"); in smi_dvb_init()
860 smi_stop_feed, port); in smi_dvb_init()
864 ret = my_dvb_dmxdev_ts_card_init(&port->dmxdev, &port->demux, in smi_dvb_init()
865 &port->hw_frontend, in smi_dvb_init()
866 &port->mem_frontend, adap); in smi_dvb_init()
870 ret = dvb_net_init(adap, &port->dvbnet, port->dmxdev.demux); in smi_dvb_init()
875 dvbdemux->dmx.close(&dvbdemux->dmx); in smi_dvb_init()
876 dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &port->hw_frontend); in smi_dvb_init()
877 dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &port->mem_frontend); in smi_dvb_init()
878 dvb_dmxdev_release(&port->dmxdev); in smi_dvb_init()
880 dvb_dmx_release(&port->demux); in smi_dvb_init()
882 dvb_unregister_adapter(&port->dvb_adapter); in smi_dvb_init()
886 static void smi_dvb_exit(struct smi_port *port) in smi_dvb_exit() argument
888 struct dvb_demux *dvbdemux = &port->demux; in smi_dvb_exit()
890 dvb_net_release(&port->dvbnet); in smi_dvb_exit()
892 dvbdemux->dmx.close(&dvbdemux->dmx); in smi_dvb_exit()
893 dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &port->hw_frontend); in smi_dvb_exit()
894 dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &port->mem_frontend); in smi_dvb_exit()
895 dvb_dmxdev_release(&port->dmxdev); in smi_dvb_exit()
896 dvb_dmx_release(&port->demux); in smi_dvb_exit()
898 dvb_unregister_adapter(&port->dvb_adapter); in smi_dvb_exit()
902 struct smi_port *port, int index) in smi_port_attach() argument
906 port->dev = dev; in smi_port_attach()
907 port->idx = index; in smi_port_attach()
908 port->fe_type = (index == 0) ? dev->info->fe_0 : dev->info->fe_1; in smi_port_attach()
909 dmachs = (index == 0) ? dev->info->ts_0 : dev->info->ts_1; in smi_port_attach()
910 /* port init.*/ in smi_port_attach()
911 ret = smi_port_init(port, dmachs); in smi_port_attach()
915 ret = smi_dvb_init(port); in smi_port_attach()
919 ret = smi_fe_init(port); in smi_port_attach()
924 smi_dvb_exit(port); in smi_port_attach()
926 smi_port_exit(port); in smi_port_attach()
930 static void smi_port_detach(struct smi_port *port) in smi_port_detach() argument
932 smi_fe_exit(port); in smi_port_detach()
933 smi_dvb_exit(port); in smi_port_detach()
934 smi_port_exit(port); in smi_port_detach()
940 int ret = -ENOMEM; in smi_probe()
943 return -ENODEV; in smi_probe()
947 ret = -ENOMEM; in smi_probe()
951 dev->pci_dev = pdev; in smi_probe()
953 dev->info = (struct smi_cfg_info *) id->driver_data; in smi_probe()
954 dev_info(&dev->pci_dev->dev, in smi_probe()
955 "card detected: %s\n", dev->info->name); in smi_probe()
957 dev->nr = dev->info->type; in smi_probe()
958 dev->lmmio = ioremap(pci_resource_start(dev->pci_dev, 0), in smi_probe()
959 pci_resource_len(dev->pci_dev, 0)); in smi_probe()
960 if (!dev->lmmio) { in smi_probe()
961 ret = -ENOMEM; in smi_probe()
980 if (dev->info->ts_0) { in smi_probe()
981 ret = smi_port_attach(dev, &dev->ts_port[0], 0); in smi_probe()
986 if (dev->info->ts_1) { in smi_probe()
987 ret = smi_port_attach(dev, &dev->ts_port[1], 1); in smi_probe()
998 ret = pci_enable_msi(dev->pci_dev); in smi_probe()
1000 dev_info(&dev->pci_dev->dev, "MSI not available.\n"); in smi_probe()
1003 ret = request_irq(dev->pci_dev->irq, smi_irq_handler, in smi_probe()
1008 smi_ir_start(&dev->ir); in smi_probe()
1014 if (dev->info->ts_1) in smi_probe()
1015 smi_port_detach(&dev->ts_port[1]); in smi_probe()
1017 if (dev->info->ts_0) in smi_probe()
1018 smi_port_detach(&dev->ts_port[0]); in smi_probe()
1022 iounmap(dev->lmmio); in smi_probe()
1036 free_irq(dev->pci_dev->irq, dev); in smi_remove()
1038 pci_disable_msi(dev->pci_dev); in smi_remove()
1040 if (dev->info->ts_1) in smi_remove()
1041 smi_port_detach(&dev->ts_port[1]); in smi_remove()
1042 if (dev->info->ts_0) in smi_remove()
1043 smi_port_detach(&dev->ts_port[0]); in smi_remove()
1047 iounmap(dev->lmmio); in smi_remove()
1086 .name = "TechnoTrend TT-budget S2-4200 Twin",