Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

V4L/DVB (13795): [Mantis/Hopper] Code overhaul, add Hopper devices into the PCI ID list

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Manu Abraham and committed by
Mauro Carvalho Chehab
b3b96144 add20636

+1891 -745
+21 -1
drivers/media/dvb/mantis/Kconfig
··· 1 + config MANTIS_CORE 2 + tristate "Mantis/Hopper PCI bridge based devices" 3 + depends on PCI && I2C 4 + 5 + help 6 + Support for PCI cards based on the Mantis and Hopper PCi bridge. 7 + 8 + Say Y if you own such a device and want to use it. 9 + 1 10 config DVB_MANTIS 2 11 tristate "MANTIS based cards" 3 - depends on DVB_CORE && PCI && I2C 12 + depends on MANTIS_CORE && DVB_CORE && PCI && I2C 4 13 select DVB_MB86A16 5 14 select DVB_CU1216 6 15 select DVB_ZL10353 ··· 20 11 Say Y when you have a Mantis based DVB card and want to use it. 21 12 22 13 If unsure say N. 14 + 15 + config DVB_HOPPER 16 + tristate "HOPPER based cards" 17 + depends on MANTIS_CORE && DVB_CORE && PCI && I2C 18 + select DVB_ZL10353 19 + select DVB_PLL 20 + help 21 + Support for PCI cards based on the Hopper PCI bridge. 22 + Say Y when you have a Hopper based DVB card and want to use it. 23 + 24 + If unsure say N
+24 -18
drivers/media/dvb/mantis/Makefile
··· 1 - mantis-objs = mantis_core.o \ 2 - mantis_uart.o \ 3 - mantis_dma.o \ 4 - mantis_pci.o \ 5 - mantis_i2c.o \ 6 - mantis_dvb.o \ 7 - mantis_evm.o \ 8 - mantis_hif.o \ 9 - mantis_ca.o \ 10 - mantis_pcmcia.o \ 11 - mantis_vp1033.o \ 12 - mantis_vp1034.o \ 13 - mantis_vp1041.o \ 14 - mantis_vp2033.o \ 15 - mantis_vp2040.o \ 16 - mantis_vp3028.o \ 17 - mantis_vp3030.o 1 + mantis_core-objs := mantis_ioc.o \ 2 + mantis_uart.o \ 3 + mantis_dma.o \ 4 + mantis_pci.o \ 5 + mantis_i2c.o \ 6 + mantis_dvb.o \ 7 + mantis_evm.o \ 8 + mantis_hif.o \ 9 + mantis_ca.o \ 10 + mantis_pcmcia.o 18 11 19 - obj-$(CONFIG_DVB_MANTIS) += mantis.o 12 + mantis-objs := mantis_cards.o \ 13 + mantis_vp1033.o \ 14 + mantis_vp1034.o \ 15 + mantis_vp1041.o \ 16 + mantis_vp2033.o \ 17 + mantis_vp2040.o \ 18 + mantis_vp3030.o 19 + 20 + hopper-objs := hopper_cards.o \ 21 + hopper_vp3028.o 22 + 23 + obj-$(CONFIG_MANTIS_CORE) += mantis_core.o 24 + obj-$(CONFIG_DVB_MANTIS) += mantis.o 25 + obj-$(CONFIG_DVB_HOPPER) += hopper.o 20 26 21 27 EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
+260
drivers/media/dvb/mantis/hopper_cards.c
··· 1 + #include <linux/module.h> 2 + #include <linux/moduleparam.h> 3 + #include <linux/kernel.h> 4 + #include <linux/pci.h> 5 + #include <asm/irq.h> 6 + #include <linux/interrupt.h> 7 + 8 + #include "dmxdev.h" 9 + #include "dvbdev.h" 10 + #include "dvb_demux.h" 11 + #include "dvb_frontend.h" 12 + #include "dvb_net.h" 13 + 14 + #include "mantis_common.h" 15 + #include "hopper_vp3028.h" 16 + #include "mantis_dma.h" 17 + #include "mantis_dvb.h" 18 + #include "mantis_uart.h" 19 + #include "mantis_ioc.h" 20 + #include "mantis_pci.h" 21 + #include "mantis_i2c.h" 22 + #include "mantis_reg.h" 23 + 24 + static unsigned int verbose; 25 + module_param(verbose, int, 0644); 26 + MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)"); 27 + 28 + #define DRIVER_NAME "Hopper" 29 + 30 + static char *label[10] = { 31 + "DMA", 32 + "IRQ-0", 33 + "IRQ-1", 34 + "OCERR", 35 + "PABRT", 36 + "RIPRR", 37 + "PPERR", 38 + "FTRGT", 39 + "RISCI", 40 + "RACK" 41 + }; 42 + 43 + static int devs; 44 + 45 + static irqreturn_t hopper_irq_handler(int irq, void *dev_id) 46 + { 47 + u32 stat = 0, mask = 0, lstat = 0, mstat = 0; 48 + u32 rst_stat = 0, rst_mask = 0; 49 + 50 + struct mantis_pci *mantis; 51 + struct mantis_ca *ca; 52 + 53 + mantis = (struct mantis_pci *) dev_id; 54 + if (unlikely(mantis == NULL)) { 55 + dprintk(MANTIS_ERROR, 1, "Mantis == NULL"); 56 + return IRQ_NONE; 57 + } 58 + ca = mantis->mantis_ca; 59 + 60 + stat = mmread(MANTIS_INT_STAT); 61 + mask = mmread(MANTIS_INT_MASK); 62 + mstat = lstat = stat & ~MANTIS_INT_RISCSTAT; 63 + if (!(stat & mask)) 64 + return IRQ_NONE; 65 + 66 + rst_mask = MANTIS_GPIF_WRACK | 67 + MANTIS_GPIF_OTHERR | 68 + MANTIS_SBUF_WSTO | 69 + MANTIS_GPIF_EXTIRQ; 70 + 71 + rst_stat = mmread(MANTIS_GPIF_STATUS); 72 + rst_stat &= rst_mask; 73 + mmwrite(rst_stat, MANTIS_GPIF_STATUS); 74 + 75 + mantis->mantis_int_stat = stat; 76 + mantis->mantis_int_mask = mask; 77 + dprintk(MANTIS_DEBUG, 0, "\n-- Stat=<%02x> Mask=<%02x> --", stat, mask); 78 + if (stat & MANTIS_INT_RISCEN) { 79 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[0]); 80 + } 81 + if (stat & MANTIS_INT_IRQ0) { 82 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[1]); 83 + mantis->gpif_status = rst_stat; 84 + wake_up(&ca->hif_write_wq); 85 + schedule_work(&ca->hif_evm_work); 86 + } 87 + if (stat & MANTIS_INT_IRQ1) { 88 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[2]); 89 + schedule_work(&mantis->uart_work); 90 + } 91 + if (stat & MANTIS_INT_OCERR) { 92 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[3]); 93 + } 94 + if (stat & MANTIS_INT_PABORT) { 95 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[4]); 96 + } 97 + if (stat & MANTIS_INT_RIPERR) { 98 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[5]); 99 + } 100 + if (stat & MANTIS_INT_PPERR) { 101 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[6]); 102 + } 103 + if (stat & MANTIS_INT_FTRGT) { 104 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[7]); 105 + } 106 + if (stat & MANTIS_INT_RISCI) { 107 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[8]); 108 + mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28; 109 + tasklet_schedule(&mantis->tasklet); 110 + } 111 + if (stat & MANTIS_INT_I2CDONE) { 112 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[9]); 113 + wake_up(&mantis->i2c_wq); 114 + } 115 + mmwrite(stat, MANTIS_INT_STAT); 116 + stat &= ~(MANTIS_INT_RISCEN | MANTIS_INT_I2CDONE | 117 + MANTIS_INT_I2CRACK | MANTIS_INT_PCMCIA7 | 118 + MANTIS_INT_PCMCIA6 | MANTIS_INT_PCMCIA5 | 119 + MANTIS_INT_PCMCIA4 | MANTIS_INT_PCMCIA3 | 120 + MANTIS_INT_PCMCIA2 | MANTIS_INT_PCMCIA1 | 121 + MANTIS_INT_PCMCIA0 | MANTIS_INT_IRQ1 | 122 + MANTIS_INT_IRQ0 | MANTIS_INT_OCERR | 123 + MANTIS_INT_PABORT | MANTIS_INT_RIPERR | 124 + MANTIS_INT_PPERR | MANTIS_INT_FTRGT | 125 + MANTIS_INT_RISCI); 126 + 127 + if (stat) 128 + dprintk(MANTIS_DEBUG, 0, "<Unknown> Stat=<%02x> Mask=<%02x>", stat, mask); 129 + 130 + dprintk(MANTIS_DEBUG, 0, "\n"); 131 + return IRQ_HANDLED; 132 + } 133 + 134 + static int __devinit hopper_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) 135 + { 136 + struct mantis_pci *mantis; 137 + struct mantis_hwconfig *config; 138 + int err = 0; 139 + 140 + mantis = kzalloc(sizeof (struct mantis_pci), GFP_KERNEL); 141 + if (mantis == NULL) { 142 + printk(KERN_ERR "%s ERROR: Out of memory\n", __func__); 143 + err = -ENOMEM; 144 + goto fail0; 145 + } 146 + 147 + mantis->num = devs; 148 + mantis->verbose = verbose; 149 + mantis->pdev = pdev; 150 + config = (struct mantis_hwconfig *) pci_id->driver_data; 151 + config->irq_handler = &hopper_irq_handler; 152 + mantis->hwconfig = config; 153 + 154 + err = mantis_pci_init(mantis); 155 + if (err) { 156 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis PCI initialization failed <%d>", err); 157 + goto fail1; 158 + } 159 + 160 + err = mantis_stream_control(mantis, STREAM_TO_HIF); 161 + if (err < 0) { 162 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis stream control failed <%d>", err); 163 + goto fail1; 164 + } 165 + 166 + err = mantis_i2c_init(mantis); 167 + if (err < 0) { 168 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis I2C initialization failed <%d>", err); 169 + goto fail2; 170 + } 171 + 172 + err = mantis_get_mac(mantis); 173 + if (err < 0) { 174 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis MAC address read failed <%d>", err); 175 + goto fail2; 176 + } 177 + 178 + err = mantis_dma_init(mantis); 179 + if (err < 0) { 180 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DMA initialization failed <%d>", err); 181 + goto fail3; 182 + } 183 + 184 + err = mantis_dvb_init(mantis); 185 + if (err < 0) { 186 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DVB initialization failed <%d>", err); 187 + goto fail4; 188 + } 189 + devs++; 190 + 191 + return err; 192 + 193 + fail5: 194 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DVB exit! <%d>", err); 195 + mantis_dvb_exit(mantis); 196 + 197 + fail4: 198 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DMA exit! <%d>", err); 199 + mantis_dma_exit(mantis); 200 + 201 + fail3: 202 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis I2C exit! <%d>", err); 203 + mantis_i2c_exit(mantis); 204 + 205 + fail2: 206 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis PCI exit! <%d>", err); 207 + mantis_pci_exit(mantis); 208 + 209 + fail1: 210 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis free! <%d>", err); 211 + kfree(mantis); 212 + 213 + fail0: 214 + return err; 215 + } 216 + 217 + static void __devexit hopper_pci_remove(struct pci_dev *pdev) 218 + { 219 + struct mantis_pci *mantis = pci_get_drvdata(pdev); 220 + 221 + if (mantis) { 222 + // mantis_uart_exit(mantis); 223 + mantis_dvb_exit(mantis); 224 + mantis_dma_exit(mantis); 225 + mantis_i2c_exit(mantis); 226 + mantis_pci_exit(mantis); 227 + kfree(mantis); 228 + } 229 + return; 230 + 231 + } 232 + 233 + static struct pci_device_id hopper_pci_table[] = { 234 + MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_3028_DVB_T, &vp3028_config), 235 + { } 236 + }; 237 + 238 + static struct pci_driver hopper_pci_driver = { 239 + .name = DRIVER_NAME, 240 + .id_table = hopper_pci_table, 241 + .probe = hopper_pci_probe, 242 + .remove = hopper_pci_remove, 243 + }; 244 + 245 + static int __devinit hopper_init(void) 246 + { 247 + return pci_register_driver(&hopper_pci_driver); 248 + } 249 + 250 + static void __devexit hopper_exit(void) 251 + { 252 + return pci_unregister_driver(&hopper_pci_driver); 253 + } 254 + 255 + module_init(hopper_init); 256 + module_exit(hopper_exit); 257 + 258 + MODULE_DESCRIPTION("HOPPER driver"); 259 + MODULE_AUTHOR("Manu Abraham"); 260 + MODULE_LICENSE("GPL");
+76
drivers/media/dvb/mantis/hopper_vp3028.c
··· 1 + /* 2 + Mantis VP-3028 driver 3 + 4 + Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com) 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 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with this program; if not, write to the Free Software 18 + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 + */ 20 + 21 + #include <asm/irq.h> 22 + #include <linux/signal.h> 23 + #include <linux/sched.h> 24 + #include <linux/interrupt.h> 25 + 26 + #include "dmxdev.h" 27 + #include "dvbdev.h" 28 + #include "dvb_demux.h" 29 + #include "dvb_frontend.h" 30 + #include "dvb_net.h" 31 + 32 + #include "zl10353.h" 33 + #include "mantis_common.h" 34 + #include "mantis_ioc.h" 35 + #include "mantis_dvb.h" 36 + #include "hopper_vp3028.h" 37 + 38 + struct zl10353_config hopper_vp3028_config = { 39 + .demod_address = 0x0f, 40 + }; 41 + 42 + #define MANTIS_MODEL_NAME "VP-3028" 43 + #define MANTIS_DEV_TYPE "DVB-T" 44 + 45 + static int vp3028_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe) 46 + { 47 + struct i2c_adapter *adapter = &mantis->adapter; 48 + int err = 0; 49 + 50 + err = mantis_frontend_power(mantis, POWER_ON); 51 + mantis_frontend_soft_reset(mantis); 52 + 53 + dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)"); 54 + fe = zl10353_attach(&hopper_vp3028_config, adapter); 55 + 56 + if (!fe) 57 + return -1; 58 + 59 + dprintk(MANTIS_ERROR, 1, "Done!"); 60 + 61 + return 0; 62 + } 63 + 64 + struct mantis_hwconfig vp3028_config = { 65 + .model_name = MANTIS_MODEL_NAME, 66 + .dev_type = MANTIS_DEV_TYPE, 67 + .ts_size = MANTIS_TS_188, 68 + 69 + .baud_rate = MANTIS_BAUD_9600, 70 + .parity = MANTIS_PARITY_NONE, 71 + .bytes = 0, 72 + 73 + .frontend_init = vp3028_frontend_init, 74 + .power = GPIF_A00, 75 + .reset = GPIF_A03, 76 + };
+10
drivers/media/dvb/mantis/hopper_vp3028.h
··· 1 + #ifndef __MANTIS_VP3028_H 2 + #define __MANTIS_VP3028_H 3 + 4 + #include "mantis_common.h" 5 + 6 + #define MANTIS_VP_3028_DVB_T 0x0028 7 + 8 + extern struct mantis_hwconfig vp3028_config; 9 + 10 + #endif /* __MANTIS_VP3028_H */
+44 -25
drivers/media/dvb/mantis/mantis_ca.c
··· 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 20 21 + #include <asm/irq.h> 22 + #include <linux/signal.h> 23 + #include <linux/sched.h> 24 + #include <linux/interrupt.h> 25 + 26 + #include "dmxdev.h" 27 + #include "dvbdev.h" 28 + #include "dvb_demux.h" 29 + #include "dvb_frontend.h" 30 + #include "dvb_net.h" 31 + 21 32 #include "mantis_common.h" 22 33 #include "mantis_link.h" 23 34 #include "mantis_hif.h" 35 + #include "mantis_reg.h" 36 + 37 + #include "mantis_ca.h" 24 38 25 39 static int mantis_ca_read_attr_mem(struct dvb_ca_en50221 *en50221, int slot, int addr) 26 40 { 27 41 struct mantis_ca *ca = en50221->data; 28 42 struct mantis_pci *mantis = ca->ca_priv; 29 43 30 - dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Request Attribute Mem Read", slot); 44 + dprintk(MANTIS_DEBUG, 1, "Slot(%d): Request Attribute Mem Read", slot); 31 45 32 46 if (slot != 0) 33 47 return -EINVAL; ··· 54 40 struct mantis_ca *ca = en50221->data; 55 41 struct mantis_pci *mantis = ca->ca_priv; 56 42 57 - dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Request Attribute Mem Write", slot); 43 + dprintk(MANTIS_DEBUG, 1, "Slot(%d): Request Attribute Mem Write", slot); 58 44 59 45 if (slot != 0) 60 46 return -EINVAL; ··· 67 53 struct mantis_ca *ca = en50221->data; 68 54 struct mantis_pci *mantis = ca->ca_priv; 69 55 70 - dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Request CAM control Read", slot); 56 + dprintk(MANTIS_DEBUG, 1, "Slot(%d): Request CAM control Read", slot); 71 57 72 58 if (slot != 0) 73 59 return -EINVAL; ··· 80 66 struct mantis_ca *ca = en50221->data; 81 67 struct mantis_pci *mantis = ca->ca_priv; 82 68 83 - dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Request CAM control Write", slot); 69 + dprintk(MANTIS_DEBUG, 1, "Slot(%d): Request CAM control Write", slot); 84 70 85 71 if (slot != 0) 86 72 return -EINVAL; ··· 93 79 struct mantis_ca *ca = en50221->data; 94 80 struct mantis_pci *mantis = ca->ca_priv; 95 81 96 - dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Slot RESET", slot); 82 + dprintk(MANTIS_DEBUG, 1, "Slot(%d): Slot RESET", slot); 97 83 udelay(500); /* Wait.. */ 98 84 mmwrite(0xda, MANTIS_PCMCIA_RESET); /* Leading edge assert */ 99 85 udelay(500); ··· 109 95 struct mantis_ca *ca = en50221->data; 110 96 struct mantis_pci *mantis = ca->ca_priv; 111 97 112 - dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Slot shutdown", slot); 98 + dprintk(MANTIS_DEBUG, 1, "Slot(%d): Slot shutdown", slot); 113 99 114 100 return 0; 115 101 } ··· 119 105 struct mantis_ca *ca = en50221->data; 120 106 struct mantis_pci *mantis = ca->ca_priv; 121 107 122 - dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): TS control", slot); 123 - mantis_set_direction(mantis, 1); /* Enable TS through CAM */ 108 + dprintk(MANTIS_DEBUG, 1, "Slot(%d): TS control", slot); 109 + // mantis_set_direction(mantis, 1); /* Enable TS through CAM */ 124 110 125 111 return 0; 126 112 } ··· 130 116 struct mantis_ca *ca = en50221->data; 131 117 struct mantis_pci *mantis = ca->ca_priv; 132 118 133 - dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Poll Slot status", slot); 119 + dprintk(MANTIS_DEBUG, 1, "Slot(%d): Poll Slot status", slot); 134 120 135 121 if (ca->slot_state == MODULE_INSERTED) { 136 - dprintk(verbose, MANTIS_DEBUG, 1, "CA Module present and ready"); 122 + dprintk(MANTIS_DEBUG, 1, "CA Module present and ready"); 137 123 return DVB_CA_EN50221_POLL_CAM_PRESENT | DVB_CA_EN50221_POLL_CAM_READY; 138 124 } else { 139 - dprintk(verbose, MANTIS_DEBUG, 1, "CA Module not present or not ready"); 125 + dprintk(MANTIS_DEBUG, 1, "CA Module not present or not ready"); 140 126 } 141 127 142 128 return 0; ··· 144 130 145 131 int mantis_ca_init(struct mantis_pci *mantis) 146 132 { 147 - struct dvb_adapter *dvb_adapter = &mantis->dvb_adapter; 133 + struct dvb_adapter *dvb_adapter = &mantis->dvb_adapter; 148 134 struct mantis_ca *ca; 149 135 int ca_flags = 0, result; 150 136 151 - dprintk(verbose, MANTIS_DEBUG, 1, "Initializing Mantis CA"); 152 - if (!(ca = kzalloc(sizeof (struct mantis_ca), GFP_KERNEL))) { 153 - dprintk(verbose, MANTIS_ERROR, 1, "Out of memory!, exiting .."); 137 + dprintk(MANTIS_DEBUG, 1, "Initializing Mantis CA"); 138 + ca = kzalloc(sizeof (struct mantis_ca), GFP_KERNEL); 139 + if (!ca) { 140 + dprintk(MANTIS_ERROR, 1, "Out of memory!, exiting .."); 154 141 result = -ENOMEM; 155 142 goto err; 156 143 } 157 144 158 - ca->ca_priv = mantis; 159 - mantis->mantis_ca = ca; 160 - ca_flags = DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE; 145 + ca->ca_priv = mantis; 146 + mantis->mantis_ca = ca; 147 + ca_flags = DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE; 161 148 /* register CA interface */ 162 149 ca->en50221.owner = THIS_MODULE; 163 150 ca->en50221.read_attribute_mem = mantis_ca_read_attr_mem; ··· 177 162 init_waitqueue_head(&ca->hif_opdone_wq); 178 163 init_waitqueue_head(&ca->hif_write_wq); 179 164 180 - dprintk(verbose, MANTIS_ERROR, 1, "Registering EN50221 device"); 181 - if ((result = dvb_ca_en50221_init(dvb_adapter, &ca->en50221, ca_flags, 1)) != 0) { 182 - dprintk(verbose, MANTIS_ERROR, 1, "EN50221: Initialization failed"); 165 + dprintk(MANTIS_ERROR, 1, "Registering EN50221 device"); 166 + result = dvb_ca_en50221_init(dvb_adapter, &ca->en50221, ca_flags, 1); 167 + if (result != 0) { 168 + dprintk(MANTIS_ERROR, 1, "EN50221: Initialization failed <%d>", result); 183 169 goto err; 184 170 } 185 - dprintk(verbose, MANTIS_ERROR, 1, "Registered EN50221 device"); 171 + dprintk(MANTIS_ERROR, 1, "Registered EN50221 device"); 186 172 mantis_evmgr_init(ca); 187 173 return 0; 188 174 err: 189 175 kfree(ca); 190 176 return result; 191 177 } 178 + EXPORT_SYMBOL_GPL(mantis_ca_init); 192 179 193 180 void mantis_ca_exit(struct mantis_pci *mantis) 194 181 { 195 182 struct mantis_ca *ca = mantis->mantis_ca; 196 183 197 - dprintk(verbose, MANTIS_DEBUG, 1, "Mantis CA exit"); 184 + dprintk(MANTIS_DEBUG, 1, "Mantis CA exit"); 198 185 199 186 mantis_evmgr_exit(ca); 200 - dprintk(verbose, MANTIS_ERROR, 1, "Unregistering EN50221 device"); 201 - dvb_ca_en50221_release(&ca->en50221); 187 + dprintk(MANTIS_ERROR, 1, "Unregistering EN50221 device"); 188 + if (ca) 189 + dvb_ca_en50221_release(&ca->en50221); 202 190 203 191 kfree(ca); 204 192 } 193 + EXPORT_SYMBOL_GPL(mantis_ca_exit);
+7
drivers/media/dvb/mantis/mantis_ca.h
··· 1 + #ifndef __MANTIS_CA_H 2 + #define __MANTIS_CA_H 3 + 4 + extern int mantis_ca_init(struct mantis_pci *mantis); 5 + extern void mantis_ca_exit(struct mantis_pci *mantis); 6 + 7 + #endif /* __MANTIS_CA_H */
+279
drivers/media/dvb/mantis/mantis_cards.c
··· 1 + #include <linux/module.h> 2 + #include <linux/moduleparam.h> 3 + #include <linux/kernel.h> 4 + #include <linux/pci.h> 5 + #include <asm/irq.h> 6 + #include <linux/interrupt.h> 7 + 8 + #include "dmxdev.h" 9 + #include "dvbdev.h" 10 + #include "dvb_demux.h" 11 + #include "dvb_frontend.h" 12 + #include "dvb_net.h" 13 + 14 + #include "mantis_common.h" 15 + 16 + #include "mantis_vp1033.h" 17 + #include "mantis_vp1034.h" 18 + #include "mantis_vp1041.h" 19 + #include "mantis_vp2033.h" 20 + #include "mantis_vp2040.h" 21 + #include "mantis_vp3030.h" 22 + 23 + #include "mantis_dma.h" 24 + #include "mantis_ca.h" 25 + #include "mantis_dvb.h" 26 + #include "mantis_uart.h" 27 + #include "mantis_ioc.h" 28 + #include "mantis_pci.h" 29 + #include "mantis_i2c.h" 30 + #include "mantis_reg.h" 31 + 32 + static unsigned int verbose; 33 + module_param(verbose, int, 0644); 34 + MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)"); 35 + 36 + static int devs; 37 + 38 + #define DRIVER_NAME "Mantis" 39 + 40 + static char *label[10] = { 41 + "DMA", 42 + "IRQ-0", 43 + "IRQ-1", 44 + "OCERR", 45 + "PABRT", 46 + "RIPRR", 47 + "PPERR", 48 + "FTRGT", 49 + "RISCI", 50 + "RACK" 51 + }; 52 + 53 + 54 + static irqreturn_t mantis_irq_handler(int irq, void *dev_id) 55 + { 56 + u32 stat = 0, mask = 0, lstat = 0, mstat = 0; 57 + u32 rst_stat = 0, rst_mask = 0; 58 + 59 + struct mantis_pci *mantis; 60 + struct mantis_ca *ca; 61 + 62 + mantis = (struct mantis_pci *) dev_id; 63 + if (unlikely(mantis == NULL)) { 64 + dprintk(MANTIS_ERROR, 1, "Mantis == NULL"); 65 + return IRQ_NONE; 66 + } 67 + ca = mantis->mantis_ca; 68 + 69 + stat = mmread(MANTIS_INT_STAT); 70 + mask = mmread(MANTIS_INT_MASK); 71 + mstat = lstat = stat & ~MANTIS_INT_RISCSTAT; 72 + if (!(stat & mask)) 73 + return IRQ_NONE; 74 + 75 + rst_mask = MANTIS_GPIF_WRACK | 76 + MANTIS_GPIF_OTHERR | 77 + MANTIS_SBUF_WSTO | 78 + MANTIS_GPIF_EXTIRQ; 79 + 80 + rst_stat = mmread(MANTIS_GPIF_STATUS); 81 + rst_stat &= rst_mask; 82 + mmwrite(rst_stat, MANTIS_GPIF_STATUS); 83 + 84 + mantis->mantis_int_stat = stat; 85 + mantis->mantis_int_mask = mask; 86 + dprintk(MANTIS_DEBUG, 0, "\n-- Stat=<%02x> Mask=<%02x> --", stat, mask); 87 + if (stat & MANTIS_INT_RISCEN) { 88 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[0]); 89 + } 90 + if (stat & MANTIS_INT_IRQ0) { 91 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[1]); 92 + mantis->gpif_status = rst_stat; 93 + wake_up(&ca->hif_write_wq); 94 + schedule_work(&ca->hif_evm_work); 95 + } 96 + if (stat & MANTIS_INT_IRQ1) { 97 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[2]); 98 + schedule_work(&mantis->uart_work); 99 + } 100 + if (stat & MANTIS_INT_OCERR) { 101 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[3]); 102 + } 103 + if (stat & MANTIS_INT_PABORT) { 104 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[4]); 105 + } 106 + if (stat & MANTIS_INT_RIPERR) { 107 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[5]); 108 + } 109 + if (stat & MANTIS_INT_PPERR) { 110 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[6]); 111 + } 112 + if (stat & MANTIS_INT_FTRGT) { 113 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[7]); 114 + } 115 + if (stat & MANTIS_INT_RISCI) { 116 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[8]); 117 + mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28; 118 + tasklet_schedule(&mantis->tasklet); 119 + } 120 + if (stat & MANTIS_INT_I2CDONE) { 121 + dprintk(MANTIS_DEBUG, 0, "<%s>", label[9]); 122 + wake_up(&mantis->i2c_wq); 123 + } 124 + mmwrite(stat, MANTIS_INT_STAT); 125 + stat &= ~(MANTIS_INT_RISCEN | MANTIS_INT_I2CDONE | 126 + MANTIS_INT_I2CRACK | MANTIS_INT_PCMCIA7 | 127 + MANTIS_INT_PCMCIA6 | MANTIS_INT_PCMCIA5 | 128 + MANTIS_INT_PCMCIA4 | MANTIS_INT_PCMCIA3 | 129 + MANTIS_INT_PCMCIA2 | MANTIS_INT_PCMCIA1 | 130 + MANTIS_INT_PCMCIA0 | MANTIS_INT_IRQ1 | 131 + MANTIS_INT_IRQ0 | MANTIS_INT_OCERR | 132 + MANTIS_INT_PABORT | MANTIS_INT_RIPERR | 133 + MANTIS_INT_PPERR | MANTIS_INT_FTRGT | 134 + MANTIS_INT_RISCI); 135 + 136 + if (stat) 137 + dprintk(MANTIS_DEBUG, 0, "<Unknown> Stat=<%02x> Mask=<%02x>", stat, mask); 138 + 139 + dprintk(MANTIS_DEBUG, 0, "\n"); 140 + return IRQ_HANDLED; 141 + } 142 + 143 + static int __devinit mantis_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) 144 + { 145 + struct mantis_pci *mantis; 146 + struct mantis_hwconfig *config; 147 + int err = 0; 148 + 149 + mantis = kzalloc(sizeof (struct mantis_pci), GFP_KERNEL); 150 + if (mantis == NULL) { 151 + printk(KERN_ERR "%s ERROR: Out of memory\n", __func__); 152 + err = -ENOMEM; 153 + goto fail0; 154 + } 155 + 156 + mantis->num = devs; 157 + mantis->verbose = verbose; 158 + mantis->pdev = pdev; 159 + config = (struct mantis_hwconfig *) pci_id->driver_data; 160 + config->irq_handler = &mantis_irq_handler; 161 + mantis->hwconfig = config; 162 + 163 + err = mantis_pci_init(mantis); 164 + if (err) { 165 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis PCI initialization failed <%d>", err); 166 + goto fail1; 167 + } 168 + 169 + err = mantis_stream_control(mantis, STREAM_TO_HIF); 170 + if (err < 0) { 171 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis stream control failed <%d>", err); 172 + goto fail1; 173 + } 174 + 175 + err = mantis_i2c_init(mantis); 176 + if (err < 0) { 177 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis I2C initialization failed <%d>", err); 178 + goto fail2; 179 + } 180 + 181 + err = mantis_get_mac(mantis); 182 + if (err < 0) { 183 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis MAC address read failed <%d>", err); 184 + goto fail2; 185 + } 186 + 187 + err = mantis_dma_init(mantis); 188 + if (err < 0) { 189 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DMA initialization failed <%d>", err); 190 + goto fail3; 191 + } 192 + 193 + err = mantis_dvb_init(mantis); 194 + if (err < 0) { 195 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DVB initialization failed <%d>", err); 196 + goto fail4; 197 + } 198 + devs++; 199 + 200 + return err; 201 + 202 + fail5: 203 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DVB exit! <%d>", err); 204 + mantis_dvb_exit(mantis); 205 + 206 + fail4: 207 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DMA exit! <%d>", err); 208 + mantis_dma_exit(mantis); 209 + 210 + fail3: 211 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis I2C exit! <%d>", err); 212 + mantis_i2c_exit(mantis); 213 + 214 + fail2: 215 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis PCI exit! <%d>", err); 216 + mantis_pci_exit(mantis); 217 + 218 + fail1: 219 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis free! <%d>", err); 220 + kfree(mantis); 221 + 222 + fail0: 223 + return err; 224 + } 225 + 226 + static void __devexit mantis_pci_remove(struct pci_dev *pdev) 227 + { 228 + struct mantis_pci *mantis = pci_get_drvdata(pdev); 229 + 230 + if (mantis) { 231 + mantis_uart_exit(mantis); 232 + // mantis_ca_exit(mantis); 233 + mantis_dvb_exit(mantis); 234 + mantis_dma_exit(mantis); 235 + mantis_i2c_exit(mantis); 236 + mantis_pci_exit(mantis); 237 + kfree(mantis); 238 + } 239 + return; 240 + } 241 + 242 + static struct pci_device_id mantis_pci_table[] = { 243 + MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_1033_DVB_S, &vp1033_config), 244 + MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_1034_DVB_S, &vp1034_config), 245 + MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_1041_DVB_S2, &vp1041_config), 246 + MAKE_ENTRY(TECHNISAT, SKYSTAR_HD2_10, &vp1041_config), 247 + MAKE_ENTRY(TECHNISAT, SKYSTAR_HD2_20, &vp1041_config), 248 + MAKE_ENTRY(TERRATEC, CINERGY_S2_PCI_HD, &vp1041_config), 249 + MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_2033_DVB_C, &vp2033_config), 250 + MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_2040_DVB_C, &vp2040_config), 251 + MAKE_ENTRY(TECHNISAT, CABLESTAR_HD2, &vp2040_config), 252 + MAKE_ENTRY(TERRATEC, CINERGY_C, &vp2033_config), 253 + MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_3030_DVB_T, &vp3030_config), 254 + { } 255 + }; 256 + 257 + static struct pci_driver mantis_pci_driver = { 258 + .name = DRIVER_NAME, 259 + .id_table = mantis_pci_table, 260 + .probe = mantis_pci_probe, 261 + .remove = mantis_pci_remove, 262 + }; 263 + 264 + static int __devinit mantis_init(void) 265 + { 266 + return pci_register_driver(&mantis_pci_driver); 267 + } 268 + 269 + static void __devexit mantis_exit(void) 270 + { 271 + return pci_unregister_driver(&mantis_pci_driver); 272 + } 273 + 274 + module_init(mantis_init); 275 + module_exit(mantis_exit); 276 + 277 + MODULE_DESCRIPTION("MANTIS driver"); 278 + MODULE_AUTHOR("Manu Abraham"); 279 + MODULE_LICENSE("GPL");
+32 -36
drivers/media/dvb/mantis/mantis_common.h
··· 21 21 #ifndef __MANTIS_COMMON_H 22 22 #define __MANTIS_COMMON_H 23 23 24 - #include <linux/module.h> 25 - #include <linux/moduleparam.h> 26 - #include <linux/kernel.h> 27 - #include <linux/pci.h> 28 24 #include <linux/mutex.h> 29 25 #include <linux/workqueue.h> 30 26 31 - #include "dvbdev.h" 32 - #include "dvb_demux.h" 33 - #include "dmxdev.h" 34 - #include "dvb_frontend.h" 35 - #include "dvb_net.h" 36 - #include <linux/i2c.h> 37 - #include "mantis_reg.h" 38 27 #include "mantis_uart.h" 39 28 40 29 #include "mantis_link.h" ··· 33 44 #define MANTIS_INFO 2 34 45 #define MANTIS_DEBUG 3 35 46 36 - #define dprintk(x, y, z, format, arg...) do { \ 47 + #define dprintk(y, z, format, arg...) do { \ 37 48 if (z) { \ 38 - if ((x > MANTIS_ERROR) && (x > y)) \ 49 + if ((mantis->verbose > MANTIS_ERROR) && (mantis->verbose > y)) \ 39 50 printk(KERN_ERR "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \ 40 - else if ((x > MANTIS_NOTICE) && (x > y)) \ 51 + else if ((mantis->verbose > MANTIS_NOTICE) && (mantis->verbose > y)) \ 41 52 printk(KERN_NOTICE "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \ 42 - else if ((x > MANTIS_INFO) && (x > y)) \ 53 + else if ((mantis->verbose > MANTIS_INFO) && (mantis->verbose > y)) \ 43 54 printk(KERN_INFO "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \ 44 - else if ((x > MANTIS_DEBUG) && (x > y)) \ 55 + else if ((mantis->verbose > MANTIS_DEBUG) && (mantis->verbose > y)) \ 45 56 printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \ 46 57 } else { \ 47 - if (x > y) \ 58 + if (mantis->verbose > y) \ 48 59 printk(format , ##arg); \ 49 60 } \ 50 61 } while(0) ··· 52 63 #define mwrite(dat, addr) writel((dat), addr) 53 64 #define mread(addr) readl(addr) 54 65 55 - #define mmwrite(dat, addr) mwrite((dat), (mantis->mantis_mmio + (addr))) 56 - #define mmread(addr) mread(mantis->mantis_mmio + (addr)) 66 + #define mmwrite(dat, addr) mwrite((dat), (mantis->mmio + (addr))) 67 + #define mmread(addr) mread(mantis->mmio + (addr)) 57 68 #define mmand(dat, addr) mmwrite((dat) & mmread(addr), addr) 58 69 #define mmor(dat, addr) mmwrite((dat) | mmread(addr), addr) 59 70 #define mmaor(dat, addr) mmwrite((dat) | ((mask) & mmread(addr)), addr) 60 71 61 72 #define MANTIS_TS_188 0 62 73 #define MANTIS_TS_204 1 74 + 75 + #define TWINHAN_TECHNOLOGIES 0x1822 76 + #define MANTIS 0x4e35 77 + 78 + #define TECHNISAT 0x1ae4 79 + #define TERRATEC 0x153b 80 + 81 + #define MAKE_ENTRY(__subven, __subdev, __configptr) { \ 82 + .vendor = TWINHAN_TECHNOLOGIES, \ 83 + .device = MANTIS, \ 84 + .subvendor = (__subven), \ 85 + .subdevice = (__subdev), \ 86 + .driver_data = (unsigned long) (__configptr) \ 87 + } 88 + 89 + struct mantis_pci; 63 90 64 91 struct mantis_hwconfig { 65 92 char *model_name; ··· 85 80 enum mantis_baud baud_rate; 86 81 enum mantis_parity parity; 87 82 u32 bytes; 83 + 84 + irqreturn_t (*irq_handler)(int irq, void *dev_id); 85 + int (*frontend_init)(struct mantis_pci *mantis, struct dvb_frontend *fe); 86 + 87 + u8 power; 88 + u8 reset; 88 89 }; 89 90 90 91 struct mantis_pci { ··· 107 96 struct pci_dev *pdev; 108 97 109 98 unsigned long mantis_addr; 110 - volatile void __iomem *mantis_mmio; 99 + void __iomem *mmio; 111 100 112 101 u8 irq; 113 102 u8 revision; ··· 167 156 168 157 #define MANTIS_HIF_STATUS (mantis->gpio_status) 169 158 170 - extern unsigned int verbose; 171 - extern unsigned int devs; 172 - extern unsigned int i2c; 173 - extern int mantis_dvb_init(struct mantis_pci *mantis); 174 - extern int mantis_frontend_init(struct mantis_pci *mantis); 175 - extern int mantis_dvb_exit(struct mantis_pci *mantis); 176 - extern void mantis_dma_xfer(unsigned long data); 177 - extern void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value); 178 - 179 - extern void mantis_set_direction(struct mantis_pci *mantis, int direction); 180 - 181 - extern int mantis_ca_init(struct mantis_pci *mantis); 182 - extern void mantis_ca_exit(struct mantis_pci *mantis); 183 - 184 - 185 - #endif //__MANTIS_COMMON_H 159 + #endif /* __MANTIS_COMMON_H */
+36 -19
drivers/media/dvb/mantis/mantis_dma.c
··· 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 20 21 + #include <linux/kernel.h> 21 22 #include <asm/page.h> 22 23 #include <linux/vmalloc.h> 24 + #include <linux/pci.h> 25 + 26 + #include <asm/irq.h> 27 + #include <linux/signal.h> 28 + #include <linux/sched.h> 29 + #include <linux/interrupt.h> 30 + 31 + #include "dmxdev.h" 32 + #include "dvbdev.h" 33 + #include "dvb_demux.h" 34 + #include "dvb_frontend.h" 35 + #include "dvb_net.h" 36 + 23 37 #include "mantis_common.h" 38 + #include "mantis_reg.h" 39 + #include "mantis_dma.h" 24 40 25 41 #define RISC_WRITE (0x01 << 28) 26 42 #define RISC_JUMP (0x07 << 28) ··· 54 38 int mantis_dma_exit(struct mantis_pci *mantis) 55 39 { 56 40 if (mantis->buf_cpu) { 57 - dprintk(verbose, MANTIS_ERROR, 1, 41 + dprintk(MANTIS_ERROR, 1, 58 42 "DMA=0x%lx cpu=0x%p size=%d", 59 43 (unsigned long) mantis->buf_dma, 60 44 mantis->buf_cpu, ··· 66 50 mantis->buf_cpu = NULL; 67 51 } 68 52 if (mantis->risc_cpu) { 69 - dprintk(verbose, MANTIS_ERROR, 1, 53 + dprintk(MANTIS_ERROR, 1, 70 54 "RISC=0x%lx cpu=0x%p size=%lx", 71 55 (unsigned long) mantis->risc_dma, 72 56 mantis->risc_cpu, ··· 80 64 81 65 return 0; 82 66 } 67 + EXPORT_SYMBOL_GPL(mantis_dma_exit); 83 68 84 69 static inline int mantis_alloc_buffers(struct mantis_pci *mantis) 85 70 { ··· 89 72 MANTIS_BUF_SIZE, 90 73 &mantis->buf_dma); 91 74 if (!mantis->buf_cpu) { 92 - dprintk(verbose, MANTIS_ERROR, 1, 75 + dprintk(MANTIS_ERROR, 1, 93 76 "DMA buffer allocation failed"); 94 77 95 78 goto err; 96 79 } 97 - dprintk(verbose, MANTIS_ERROR, 1, 80 + dprintk(MANTIS_ERROR, 1, 98 81 "DMA=0x%lx cpu=0x%p size=%d", 99 82 (unsigned long) mantis->buf_dma, 100 83 mantis->buf_cpu, MANTIS_BUF_SIZE); ··· 105 88 &mantis->risc_dma); 106 89 107 90 if (!mantis->risc_cpu) { 108 - dprintk(verbose, MANTIS_ERROR, 1, 91 + dprintk(MANTIS_ERROR, 1, 109 92 "RISC program allocation failed"); 110 93 111 94 mantis_dma_exit(mantis); 112 95 113 96 goto err; 114 97 } 115 - dprintk(verbose, MANTIS_ERROR, 1, 98 + dprintk(MANTIS_ERROR, 1, 116 99 "RISC=0x%lx cpu=0x%p size=%lx", 117 100 (unsigned long) mantis->risc_dma, 118 101 mantis->risc_cpu, MANTIS_RISC_SIZE); ··· 120 103 121 104 return 0; 122 105 err: 123 - dprintk(verbose, MANTIS_ERROR, 1, "Out of memory (?) ....."); 106 + dprintk(MANTIS_ERROR, 1, "Out of memory (?) ....."); 124 107 return -ENOMEM; 125 108 } 126 109 ··· 134 117 mantis->line_count <<= 1; 135 118 } 136 119 137 - dprintk(verbose, MANTIS_DEBUG, 1, 138 - "Mantis RISC block bytes=[%d], line bytes=[%d], line count=[%d]", 120 + dprintk(MANTIS_DEBUG, 1, "Mantis RISC block bytes=[%d], line bytes=[%d], line count=[%d]", 139 121 MANTIS_BLOCK_BYTES, mantis->line_bytes, mantis->line_count); 140 122 141 123 if (mantis->line_count > 255) { 142 - dprintk(verbose, MANTIS_ERROR, 1, "Buffer size error"); 124 + dprintk(MANTIS_ERROR, 1, "Buffer size error"); 143 125 return -EINVAL; 144 126 } 145 127 ··· 149 133 { 150 134 int err = 0; 151 135 152 - dprintk(verbose, MANTIS_DEBUG, 1, "Mantis DMA init"); 136 + dprintk(MANTIS_DEBUG, 1, "Mantis DMA init"); 153 137 if (mantis_alloc_buffers(mantis) < 0) { 154 - dprintk(verbose, MANTIS_ERROR, 1, "Error allocating DMA buffer"); 138 + dprintk(MANTIS_ERROR, 1, "Error allocating DMA buffer"); 155 139 156 140 // Stop RISC Engine 157 141 // mmwrite(mmread(MANTIS_DMA_CTL) & ~MANTIS_RISC_EN, MANTIS_DMA_CTL); ··· 160 144 goto err; 161 145 } 162 146 if ((err = mantis_calc_lines(mantis)) < 0) { 163 - dprintk(verbose, MANTIS_ERROR, 1, "Mantis calc lines failed"); 147 + dprintk(MANTIS_ERROR, 1, "Mantis calc lines failed"); 164 148 165 149 goto err; 166 150 } ··· 169 153 err: 170 154 return err; 171 155 } 156 + EXPORT_SYMBOL_GPL(mantis_dma_init); 172 157 173 158 static inline void mantis_risc_program(struct mantis_pci *mantis) 174 159 { 175 160 u32 buf_pos = 0; 176 161 u32 line; 177 162 178 - dprintk(verbose, MANTIS_DEBUG, 1, "Mantis create RISC program"); 163 + dprintk(MANTIS_DEBUG, 1, "Mantis create RISC program"); 179 164 RISC_FLUSH(); 180 165 181 - dprintk(verbose, MANTIS_DEBUG, 1, "risc len lines %u, bytes per line %u", 166 + dprintk(MANTIS_DEBUG, 1, "risc len lines %u, bytes per line %u", 182 167 mantis->line_count, mantis->line_bytes); 183 168 184 169 for (line = 0; line < mantis->line_count; line++) { 185 - dprintk(verbose, MANTIS_DEBUG, 1, "RISC PROG line=[%d]", line); 170 + dprintk(MANTIS_DEBUG, 1, "RISC PROG line=[%d]", line); 186 171 if (!(buf_pos % MANTIS_BLOCK_BYTES)) { 187 172 RISC_INSTR(RISC_WRITE | 188 173 RISC_IRQ | ··· 203 186 204 187 void mantis_dma_start(struct mantis_pci *mantis) 205 188 { 206 - dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Start DMA engine"); 189 + dprintk(MANTIS_DEBUG, 1, "Mantis Start DMA engine"); 207 190 208 191 mantis_risc_program(mantis); 209 192 mmwrite(mantis->risc_dma, MANTIS_RISC_START); ··· 225 208 226 209 stat = mmread(MANTIS_INT_STAT); 227 210 mask = mmread(MANTIS_INT_MASK); 228 - dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Stop DMA engine"); 211 + dprintk(MANTIS_DEBUG, 1, "Mantis Stop DMA engine"); 229 212 230 213 mmwrite((mmread(MANTIS_GPIF_ADDR) & (~(MANTIS_GPIF_HIFRDWRN))), MANTIS_GPIF_ADDR); 231 214 ··· 246 229 struct mantis_hwconfig *config = mantis->hwconfig; 247 230 248 231 while (mantis->last_block != mantis->finished_block) { 249 - dprintk(verbose, MANTIS_DEBUG, 1, "last block=[%d] finished block=[%d]", 232 + dprintk(MANTIS_DEBUG, 1, "last block=[%d] finished block=[%d]", 250 233 mantis->last_block, mantis->finished_block); 251 234 252 235 (config->ts_size ? dvb_dmx_swfilter_204: dvb_dmx_swfilter)
+10
drivers/media/dvb/mantis/mantis_dma.h
··· 1 + #ifndef __MANTIS_DMA_H 2 + #define __MANTIS_DMA_H 3 + 4 + extern int mantis_dma_init(struct mantis_pci *mantis); 5 + extern int mantis_dma_exit(struct mantis_pci *mantis); 6 + extern void mantis_dma_start(struct mantis_pci *mantis); 7 + extern void mantis_dma_stop(struct mantis_pci *mantis); 8 + extern void mantis_dma_xfer(unsigned long data); 9 + 10 + #endif /* __MANTIS_DMA_H */
+160 -202
drivers/media/dvb/mantis/mantis_dvb.c
··· 17 17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 18 */ 19 19 20 + #include <linux/kernel.h> 20 21 #include <linux/bitops.h> 21 - #include "mantis_common.h" 22 - #include "mantis_core.h" 22 + 23 + #include <asm/irq.h> 24 + #include <linux/signal.h> 25 + #include <linux/sched.h> 26 + #include <linux/interrupt.h> 27 + #include <linux/pci.h> 28 + #include <linux/i2c.h> 23 29 24 30 #include "dmxdev.h" 25 31 #include "dvbdev.h" 26 32 #include "dvb_demux.h" 27 33 #include "dvb_frontend.h" 28 - #include "mantis_vp1033.h" 29 - #include "mantis_vp1034.h" 30 - #include "mantis_vp1041.h" 31 - #include "mantis_vp2033.h" 32 - #include "mantis_vp2040.h" 33 - #include "mantis_vp3030.h" 34 + #include "dvb_net.h" 35 + 36 + #include "mantis_common.h" 37 + #include "mantis_dma.h" 38 + #include "mantis_ca.h" 39 + #include "mantis_ioc.h" 40 + #include "mantis_dvb.h" 34 41 35 42 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 36 43 37 - /* Tuner power supply control */ 38 - void mantis_fe_powerup(struct mantis_pci *mantis) 44 + int mantis_frontend_power(struct mantis_pci *mantis, enum mantis_power power) 39 45 { 40 - dprintk(verbose, MANTIS_DEBUG, 1, "Frontend Power ON"); 41 - gpio_set_bits(mantis, 0x0c, 1); 42 - msleep_interruptible(100); 43 - gpio_set_bits(mantis, 0x0c, 1); 44 - msleep_interruptible(100); 45 - } 46 + struct mantis_hwconfig *config = mantis->hwconfig; 46 47 47 - void mantis_fe_powerdown(struct mantis_pci *mantis) 48 - { 49 - dprintk(verbose, MANTIS_DEBUG, 1, "Frontend Power OFF"); 50 - gpio_set_bits(mantis, 0x0c, 0); 51 - } 48 + switch (power) { 49 + case POWER_ON: 50 + dprintk(MANTIS_DEBUG, 1, "Power ON"); 51 + gpio_set_bits(mantis, config->power, POWER_ON); 52 + msleep(100); 53 + gpio_set_bits(mantis, config->power, POWER_ON); 54 + msleep(100); 55 + break; 52 56 53 - static int mantis_fe_reset(struct dvb_frontend *fe) 54 - { 55 - struct mantis_pci *mantis = fe->dvb->priv; 57 + case POWER_OFF: 58 + dprintk(MANTIS_DEBUG, 1, "Power OFF"); 59 + gpio_set_bits(mantis, config->power, POWER_OFF); 60 + msleep(100); 61 + break; 56 62 57 - dprintk(verbose, MANTIS_DEBUG, 1, "Frontend Reset"); 58 - gpio_set_bits(mantis, 13, 0); 59 - msleep_interruptible(100); 60 - gpio_set_bits(mantis, 13, 0); 61 - msleep_interruptible(100); 62 - gpio_set_bits(mantis, 13, 1); 63 - msleep_interruptible(100); 64 - gpio_set_bits(mantis, 13, 1); 63 + default: 64 + dprintk(MANTIS_DEBUG, 1, "Unknown state <%02x>", power); 65 + return -1; 66 + } 65 67 66 68 return 0; 67 69 } 70 + EXPORT_SYMBOL_GPL(mantis_frontend_power); 68 71 69 - static int mantis_frontend_reset(struct mantis_pci *mantis) 72 + void mantis_frontend_soft_reset(struct mantis_pci *mantis) 70 73 { 71 - dprintk(verbose, MANTIS_DEBUG, 1, "Frontend Reset"); 72 - gpio_set_bits(mantis, 13, 0); 73 - msleep_interruptible(100); 74 - gpio_set_bits(mantis, 13, 0); 75 - msleep_interruptible(100); 76 - gpio_set_bits(mantis, 13, 1); 77 - msleep_interruptible(100); 78 - gpio_set_bits(mantis, 13, 1); 74 + struct mantis_hwconfig *config = mantis->hwconfig; 75 + 76 + dprintk(MANTIS_DEBUG, 1, "Frontend RESET"); 77 + gpio_set_bits(mantis, config->reset, 0); 78 + msleep(100); 79 + gpio_set_bits(mantis, config->reset, 0); 80 + msleep(100); 81 + gpio_set_bits(mantis, config->reset, 1); 82 + msleep(100); 83 + gpio_set_bits(mantis, config->reset, 1); 84 + msleep(100); 85 + 86 + return; 87 + } 88 + EXPORT_SYMBOL_GPL(mantis_frontend_soft_reset); 89 + 90 + static int mantis_frontend_shutdown(struct mantis_pci *mantis) 91 + { 92 + int err; 93 + 94 + mantis_frontend_soft_reset(mantis); 95 + err = mantis_frontend_power(mantis, POWER_OFF); 96 + if (err != 0) { 97 + dprintk(MANTIS_ERROR, 1, "Frontend POWER OFF failed! <%d>", err); 98 + return 1; 99 + } 79 100 80 101 return 0; 81 102 } ··· 106 85 struct dvb_demux *dvbdmx = dvbdmxfeed->demux; 107 86 struct mantis_pci *mantis = dvbdmx->priv; 108 87 109 - dprintk(verbose, MANTIS_DEBUG, 1, "Mantis DVB Start feed"); 88 + dprintk(MANTIS_DEBUG, 1, "Mantis DVB Start feed"); 110 89 if (!dvbdmx->dmx.frontend) { 111 - dprintk(verbose, MANTIS_DEBUG, 1, "no frontend ?"); 90 + dprintk(MANTIS_DEBUG, 1, "no frontend ?"); 112 91 return -EINVAL; 113 92 } 93 + 114 94 mantis->feeds++; 115 - dprintk(verbose, MANTIS_DEBUG, 1, 116 - "mantis start feed, feeds=%d", 117 - mantis->feeds); 95 + dprintk(MANTIS_DEBUG, 1, "mantis start feed, feeds=%d", mantis->feeds); 118 96 119 97 if (mantis->feeds == 1) { 120 - dprintk(verbose, MANTIS_DEBUG, 1, "mantis start feed & dma"); 98 + dprintk(MANTIS_DEBUG, 1, "mantis start feed & dma"); 121 99 printk("mantis start feed & dma\n"); 122 100 mantis_dma_start(mantis); 123 101 } ··· 129 109 struct dvb_demux *dvbdmx = dvbdmxfeed->demux; 130 110 struct mantis_pci *mantis = dvbdmx->priv; 131 111 132 - dprintk(verbose, MANTIS_DEBUG, 1, "Mantis DVB Stop feed"); 112 + dprintk(MANTIS_DEBUG, 1, "Mantis DVB Stop feed"); 133 113 if (!dvbdmx->dmx.frontend) { 134 - dprintk(verbose, MANTIS_DEBUG, 1, "no frontend ?"); 114 + dprintk(MANTIS_DEBUG, 1, "no frontend ?"); 135 115 return -EINVAL; 136 116 } 117 + 137 118 mantis->feeds--; 138 119 if (mantis->feeds == 0) { 139 - dprintk(verbose, MANTIS_DEBUG, 1, "mantis stop feed and dma"); 120 + dprintk(MANTIS_DEBUG, 1, "mantis stop feed and dma"); 140 121 printk("mantis stop feed and dma\n"); 141 122 mantis_dma_stop(mantis); 142 123 } 124 + 143 125 return 0; 144 126 } 145 127 146 128 int __devinit mantis_dvb_init(struct mantis_pci *mantis) 147 129 { 148 - int result; 130 + struct mantis_hwconfig *config = mantis->hwconfig; 131 + int result = -1; 149 132 150 - dprintk(verbose, MANTIS_DEBUG, 1, "dvb_register_adapter"); 151 - if (dvb_register_adapter(&mantis->dvb_adapter, 152 - "Mantis dvb adapter", THIS_MODULE, 153 - &mantis->pdev->dev, 154 - adapter_nr) < 0) { 133 + dprintk(MANTIS_DEBUG, 1, "dvb_register_adapter"); 155 134 156 - dprintk(verbose, MANTIS_ERROR, 1, "Error registering adapter"); 135 + result = dvb_register_adapter(&mantis->dvb_adapter, 136 + "Mantis DVB adapter", 137 + THIS_MODULE, 138 + &mantis->pdev->dev, 139 + adapter_nr); 140 + 141 + if (result < 0) { 142 + 143 + dprintk(MANTIS_ERROR, 1, "Error registering adapter"); 157 144 return -ENODEV; 158 145 } 159 - mantis->dvb_adapter.priv = mantis; 160 - mantis->demux.dmx.capabilities = DMX_TS_FILTERING | 146 + 147 + mantis->dvb_adapter.priv = mantis; 148 + mantis->demux.dmx.capabilities = DMX_TS_FILTERING | 161 149 DMX_SECTION_FILTERING | 162 150 DMX_MEMORY_BASED_FILTERING; 163 151 164 - mantis->demux.priv = mantis; 165 - mantis->demux.filternum = 256; 166 - mantis->demux.feednum = 256; 167 - mantis->demux.start_feed = mantis_dvb_start_feed; 168 - mantis->demux.stop_feed = mantis_dvb_stop_feed; 169 - mantis->demux.write_to_decoder = NULL; 170 - dprintk(verbose, MANTIS_DEBUG, 1, "dvb_dmx_init"); 171 - if ((result = dvb_dmx_init(&mantis->demux)) < 0) { 172 - dprintk(verbose, MANTIS_ERROR, 1, 173 - "dvb_dmx_init failed, ERROR=%d", result); 152 + mantis->demux.priv = mantis; 153 + mantis->demux.filternum = 256; 154 + mantis->demux.feednum = 256; 155 + mantis->demux.start_feed = mantis_dvb_start_feed; 156 + mantis->demux.stop_feed = mantis_dvb_stop_feed; 157 + mantis->demux.write_to_decoder = NULL; 158 + 159 + dprintk(MANTIS_DEBUG, 1, "dvb_dmx_init"); 160 + result = dvb_dmx_init(&mantis->demux); 161 + if (result < 0) { 162 + dprintk(MANTIS_ERROR, 1, "dvb_dmx_init failed, ERROR=%d", result); 174 163 175 164 goto err0; 176 165 } 177 - mantis->dmxdev.filternum = 256; 178 - mantis->dmxdev.demux = &mantis->demux.dmx; 179 - mantis->dmxdev.capabilities = 0; 180 - dprintk(verbose, MANTIS_DEBUG, 1, "dvb_dmxdev_init"); 181 - if ((result = dvb_dmxdev_init(&mantis->dmxdev, 182 - &mantis->dvb_adapter)) < 0) { 183 166 184 - dprintk(verbose, MANTIS_ERROR, 1, 185 - "dvb_dmxdev_init failed, ERROR=%d", result); 167 + mantis->dmxdev.filternum = 256; 168 + mantis->dmxdev.demux = &mantis->demux.dmx; 169 + mantis->dmxdev.capabilities = 0; 170 + dprintk(MANTIS_DEBUG, 1, "dvb_dmxdev_init"); 171 + 172 + result = dvb_dmxdev_init(&mantis->dmxdev, &mantis->dvb_adapter); 173 + if (result < 0) { 174 + 175 + dprintk(MANTIS_ERROR, 1, "dvb_dmxdev_init failed, ERROR=%d", result); 186 176 goto err1; 187 177 } 188 - mantis->fe_hw.source = DMX_FRONTEND_0; 189 - if ((result = mantis->demux.dmx.add_frontend(&mantis->demux.dmx, 190 - &mantis->fe_hw)) < 0) { 191 178 192 - dprintk(verbose, MANTIS_ERROR, 1, 193 - "dvb_dmx_init failed, ERROR=%d", result); 179 + mantis->fe_hw.source = DMX_FRONTEND_0; 180 + result = mantis->demux.dmx.add_frontend(&mantis->demux.dmx, &mantis->fe_hw); 181 + if (result < 0) { 194 182 183 + dprintk(MANTIS_ERROR, 1, "dvb_dmx_init failed, ERROR=%d", result); 195 184 goto err2; 196 185 } 197 - mantis->fe_mem.source = DMX_MEMORY_FE; 198 - if ((result = mantis->demux.dmx.add_frontend(&mantis->demux.dmx, 199 - &mantis->fe_mem)) < 0) { 200 - dprintk(verbose, MANTIS_ERROR, 1, 201 - "dvb_dmx_init failed, ERROR=%d", result); 202 186 187 + mantis->fe_mem.source = DMX_MEMORY_FE; 188 + result = mantis->demux.dmx.add_frontend(&mantis->demux.dmx,&mantis->fe_mem); 189 + if (result < 0) { 190 + dprintk(MANTIS_ERROR, 1,"dvb_dmx_init failed, ERROR=%d", result); 203 191 goto err3; 204 192 } 205 - if ((result = mantis->demux.dmx.connect_frontend(&mantis->demux.dmx, 206 - &mantis->fe_hw)) < 0) { 207 193 208 - dprintk(verbose, MANTIS_ERROR, 1, 209 - "dvb_dmx_init failed, ERROR=%d", result); 210 - 194 + result = mantis->demux.dmx.connect_frontend(&mantis->demux.dmx, &mantis->fe_hw); 195 + if (result < 0) { 196 + dprintk(MANTIS_ERROR, 1, "dvb_dmx_init failed, ERROR=%d", result); 211 197 goto err4; 212 198 } 199 + 213 200 dvb_net_init(&mantis->dvb_adapter, &mantis->dvbnet, &mantis->demux.dmx); 214 201 tasklet_init(&mantis->tasklet, mantis_dma_xfer, (unsigned long) mantis); 215 - mantis_frontend_init(mantis); 216 - mantis_ca_init(mantis); 202 + if (mantis->hwconfig) { 203 + result = config->frontend_init(mantis, mantis->fe); 204 + if (result < 0) { 205 + dprintk(MANTIS_ERROR, 1, "!!! NO Frontends found !!!"); 206 + goto err5; 207 + } else { 208 + // if (mantis->dvb_adapter == NULL) { 209 + // dprintk(MANTIS_ERROR, 1, "DVB adapter <NULL>"); 210 + // goto err5; 211 + // } 212 + if (mantis->fe == NULL) { 213 + dprintk(MANTIS_ERROR, 1, "FE <NULL>"); 214 + goto err5; 215 + } 216 + 217 + if (dvb_register_frontend(&mantis->dvb_adapter, mantis->fe)) { 218 + dprintk(MANTIS_ERROR, 1, "ERROR: Frontend registration failed"); 219 + 220 + if (mantis->fe->ops.release) 221 + mantis->fe->ops.release(mantis->fe); 222 + 223 + mantis->fe = NULL; 224 + goto err5; 225 + } 226 + } 227 + } 217 228 218 229 return 0; 219 230 220 - /* Error conditions .. */ 231 + /* Error conditions .. */ 232 + err5: 233 + tasklet_kill(&mantis->tasklet); 234 + dvb_net_release(&mantis->dvbnet); 221 235 err4: 222 236 mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_mem); 223 237 err3: ··· 265 211 266 212 return result; 267 213 } 268 - 269 - int __devinit mantis_frontend_init(struct mantis_pci *mantis) 270 - { 271 - dprintk(verbose, MANTIS_DEBUG, 1, "Mantis frontend Init"); 272 - mantis_fe_powerup(mantis); 273 - mantis_frontend_reset(mantis); 274 - dprintk(verbose, MANTIS_DEBUG, 1, "Device ID=%02x", mantis->subsystem_device); 275 - switch (mantis->subsystem_device) { 276 - case MANTIS_VP_1033_DVB_S: // VP-1033 277 - dprintk(verbose, MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)"); 278 - mantis->fe = stv0299_attach(&lgtdqcs001f_config, 279 - &mantis->adapter); 280 - 281 - if (mantis->fe) { 282 - mantis->fe->ops.tuner_ops.set_params = lgtdqcs001f_tuner_set; 283 - dprintk(verbose, MANTIS_ERROR, 1, 284 - "found STV0299 DVB-S frontend @ 0x%02x", 285 - lgtdqcs001f_config.demod_address); 286 - 287 - dprintk(verbose, MANTIS_ERROR, 1, 288 - "Mantis DVB-S STV0299 frontend attach success"); 289 - } 290 - break; 291 - case MANTIS_VP_1034_DVB_S: // VP-1034 292 - dprintk(verbose, MANTIS_ERROR, 1, "Probing for MB86A16 (DVB-S/DSS)"); 293 - mantis->fe = mb86a16_attach(&vp1034_config, &mantis->adapter); 294 - if (mantis->fe) { 295 - dprintk(verbose, MANTIS_ERROR, 1, 296 - "found MB86A16 DVB-S/DSS frontend @0x%02x", 297 - vp1034_config.demod_address); 298 - 299 - } 300 - break; 301 - case MANTIS_VP_1041_DVB_S2: 302 - case TECHNISAT_SKYSTAR_HD2: 303 - mantis->fe = stb0899_attach(&vp1041_config, &mantis->adapter); 304 - if (mantis->fe) { 305 - dprintk(verbose, MANTIS_ERROR, 1, 306 - "found STB0899 DVB-S/DVB-S2 frontend @0x%02x", 307 - vp1041_config.demod_address); 308 - 309 - if (stb6100_attach(mantis->fe, &vp1041_stb6100_config, &mantis->adapter)) { 310 - if (!lnbp21_attach(mantis->fe, &mantis->adapter, 0, 0)) { 311 - printk("%s: No LNBP21 found!\n", __FUNCTION__); 312 - mantis->fe = NULL; 313 - } 314 - } else { 315 - mantis->fe = NULL; 316 - } 317 - } 318 - break; 319 - case MANTIS_VP_2033_DVB_C: // VP-2033 320 - case MANTIS_VP_2040_DVB_C: // VP-2040 321 - case TERRATEC_CINERGY_C_PCI: 322 - case TECHNISAT_CABLESTAR_HD2: 323 - dprintk(verbose, MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)"); 324 - mantis->fe = tda10021_attach(&philips_cu1216_config, 325 - &mantis->adapter, 326 - read_pwm(mantis)); 327 - 328 - if (mantis->fe) { 329 - dprintk(verbose, MANTIS_ERROR, 1, 330 - "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x", 331 - philips_cu1216_config.demod_address); 332 - } else { 333 - mantis->fe = tda10023_attach(&tda10023_cu1216_config, 334 - &mantis->adapter, 335 - read_pwm(mantis)); 336 - 337 - if (mantis->fe) { 338 - dprintk(verbose, MANTIS_ERROR, 1, 339 - "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x", 340 - philips_cu1216_config.demod_address); 341 - } 342 - } 343 - if (mantis->fe) { 344 - mantis->fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set; 345 - dprintk(verbose, MANTIS_ERROR, 1, 346 - "Mantis DVB-C Philips CU1216 frontend attach success"); 347 - } 348 - break; 349 - default: 350 - dprintk(verbose, MANTIS_DEBUG, 1, "Unknown frontend:[0x%02x]", 351 - mantis->sub_device_id); 352 - 353 - return -ENODEV; 354 - } 355 - if (mantis->fe == NULL) { 356 - dprintk(verbose, MANTIS_ERROR, 1, "!!! NO Frontends found !!!"); 357 - return -ENODEV; 358 - } else { 359 - if (dvb_register_frontend(&mantis->dvb_adapter, mantis->fe)) { 360 - dprintk(verbose, MANTIS_ERROR, 1, 361 - "ERROR: Frontend registration failed"); 362 - 363 - if (mantis->fe->ops.release) 364 - mantis->fe->ops.release(mantis->fe); 365 - 366 - mantis->fe = NULL; 367 - return -ENODEV; 368 - } 369 - } 370 - 371 - return 0; 372 - } 214 + EXPORT_SYMBOL_GPL(mantis_dvb_init); 373 215 374 216 int __devexit mantis_dvb_exit(struct mantis_pci *mantis) 375 217 { 376 - mantis_ca_exit(mantis); 218 + int err; 219 + 220 + err = mantis_frontend_shutdown(mantis); 221 + if (err != 0) 222 + dprintk(MANTIS_ERROR, 1, "Frontend exit while POWER ON! <%d>", err); 223 + 224 + // mantis_ca_exit(mantis); 377 225 tasklet_kill(&mantis->tasklet); 378 226 dvb_net_release(&mantis->dvbnet); 379 227 mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_mem); ··· 285 329 286 330 if (mantis->fe) 287 331 dvb_unregister_frontend(mantis->fe); 288 - dprintk(verbose, MANTIS_DEBUG, 1, "dvb_unregister_adapter"); 332 + 333 + dprintk(MANTIS_DEBUG, 1, "dvb_unregister_adapter"); 289 334 dvb_unregister_adapter(&mantis->dvb_adapter); 290 335 291 336 return 0; 292 337 } 338 + EXPORT_SYMBOL_GPL(mantis_dvb_exit);
+15
drivers/media/dvb/mantis/mantis_dvb.h
··· 1 + #ifndef __MANTIS_DVB_H 2 + #define __MANTIS_DVB_H 3 + 4 + enum mantis_power { 5 + POWER_OFF = 0, 6 + POWER_ON = 1 7 + }; 8 + 9 + extern int mantis_frontend_power(struct mantis_pci *mantis, enum mantis_power power); 10 + extern void mantis_frontend_soft_reset(struct mantis_pci *mantis); 11 + 12 + extern int mantis_dvb_init(struct mantis_pci *mantis); 13 + extern int mantis_dvb_exit(struct mantis_pci *mantis); 14 + 15 + #endif /* __MANTIS_DVB_H */
+26 -12
drivers/media/dvb/mantis/mantis_evm.c
··· 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 20 21 + #include <linux/kernel.h> 22 + 23 + #include <asm/irq.h> 24 + #include <linux/signal.h> 25 + #include <linux/sched.h> 26 + #include <linux/interrupt.h> 27 + 28 + #include "dmxdev.h" 29 + #include "dvbdev.h" 30 + #include "dvb_demux.h" 31 + #include "dvb_frontend.h" 32 + #include "dvb_net.h" 33 + 21 34 #include "mantis_common.h" 22 35 #include "mantis_link.h" 23 36 #include "mantis_hif.h" 37 + #include "mantis_reg.h" 24 38 25 39 static void mantis_hifevm_work(struct work_struct *work) 26 40 { ··· 48 34 49 35 if (gpif_stat & MANTIS_GPIF_DETSTAT) { 50 36 if (gpif_stat & MANTIS_CARD_PLUGIN) { 51 - dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Plugin", mantis->num); 37 + dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Plugin", mantis->num); 52 38 mmwrite(0xdada0000, MANTIS_CARD_RESET); 53 39 mantis_event_cam_plugin(ca); 54 40 dvb_ca_en50221_camchange_irq(&ca->en50221, ··· 57 43 } 58 44 } else { 59 45 if (gpif_stat & MANTIS_CARD_PLUGOUT) { 60 - dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Unplug", mantis->num); 46 + dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Unplug", mantis->num); 61 47 mmwrite(0xdada0000, MANTIS_CARD_RESET); 62 48 mantis_event_cam_unplug(ca); 63 49 dvb_ca_en50221_camchange_irq(&ca->en50221, ··· 67 53 } 68 54 69 55 if (mantis->gpif_status & MANTIS_GPIF_EXTIRQ) 70 - dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Ext IRQ", mantis->num); 56 + dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Ext IRQ", mantis->num); 71 57 72 58 if (mantis->gpif_status & MANTIS_SBUF_WSTO) 73 - dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Timeout", mantis->num); 59 + dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Timeout", mantis->num); 74 60 75 61 if (mantis->gpif_status & MANTIS_GPIF_OTHERR) 76 - dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Alignment Error", mantis->num); 62 + dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Alignment Error", mantis->num); 77 63 78 64 if (gpif_stat & MANTIS_SBUF_OVFLW) 79 - dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Overflow", mantis->num); 65 + dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Overflow", mantis->num); 80 66 81 67 if (gpif_stat & MANTIS_GPIF_BRRDY) 82 - dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num); 68 + dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num); 83 69 84 70 if (gpif_stat & MANTIS_GPIF_INTSTAT) 85 - dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): GPIF IRQ", mantis->num); 71 + dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): GPIF IRQ", mantis->num); 86 72 87 73 if (gpif_stat & MANTIS_SBUF_EMPTY) 88 - dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Empty", mantis->num); 74 + dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Empty", mantis->num); 89 75 90 76 if (gpif_stat & MANTIS_SBUF_OPDONE) { 91 - dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer operation complete", mantis->num); 77 + dprintk(MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer operation complete", mantis->num); 92 78 ca->sbuf_status = MANTIS_SBUF_DATA_AVAIL; 93 79 ca->hif_event = MANTIS_SBUF_OPDONE; 94 80 wake_up(&ca->hif_opdone_wq); ··· 99 85 { 100 86 struct mantis_pci *mantis = ca->ca_priv; 101 87 102 - dprintk(verbose, MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager"); 88 + dprintk(MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager"); 103 89 INIT_WORK(&ca->hif_evm_work, mantis_hifevm_work); 104 90 mantis_pcmcia_init(ca); 105 91 schedule_work(&ca->hif_evm_work); ··· 111 97 { 112 98 struct mantis_pci *mantis = ca->ca_priv; 113 99 114 - dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting"); 100 + dprintk(MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting"); 115 101 flush_scheduled_work(); 116 102 mantis_hif_exit(ca); 117 103 mantis_pcmcia_exit(ca);
+39 -21
drivers/media/dvb/mantis/mantis_hif.c
··· 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 20 21 + #include <linux/kernel.h> 22 + #include <linux/signal.h> 23 + #include <linux/sched.h> 24 + 25 + #include <asm/irq.h> 26 + #include <linux/signal.h> 27 + #include <linux/sched.h> 28 + #include <linux/interrupt.h> 29 + 30 + #include "dmxdev.h" 31 + #include "dvbdev.h" 32 + #include "dvb_demux.h" 33 + #include "dvb_frontend.h" 34 + #include "dvb_net.h" 35 + 21 36 #include "mantis_common.h" 37 + 22 38 #include "mantis_hif.h" 23 39 #include "mantis_link.h" /* temporary due to physical layer stuff */ 40 + 41 + #include "mantis_reg.h" 24 42 25 43 static int mantis_hif_data_available(struct mantis_ca *ca) 26 44 { ··· 49 31 ca->sbuf_status & MANTIS_SBUF_DATA_AVAIL, 50 32 msecs_to_jiffies(500)) == -ERESTARTSYS) { 51 33 52 - dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Read wait event timeout !", mantis->num); 34 + dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Read wait event timeout !", mantis->num); 53 35 rc = -EREMOTEIO; 54 36 } 55 37 ca->sbuf_status &= ~MANTIS_SBUF_DATA_AVAIL; ··· 66 48 ca->hif_event & MANTIS_SBUF_OPDONE, 67 49 msecs_to_jiffies(500)) == -ERESTARTSYS) { 68 50 69 - dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): Smart buffer operation timeout !", mantis->num); 51 + dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): Smart buffer operation timeout !", mantis->num); 70 52 rc = -EREMOTEIO; 71 53 } 72 - dprintk(verbose, MANTIS_DEBUG, 1, "Smart Buffer Operation complete"); 54 + dprintk(MANTIS_DEBUG, 1, "Smart Buffer Operation complete"); 73 55 ca->hif_event &= ~MANTIS_SBUF_OPDONE; 74 56 return rc; 75 57 } ··· 84 66 mantis->gpif_status & MANTIS_GPIF_WRACK, 85 67 msecs_to_jiffies(500)) == -ERESTARTSYS) { 86 68 87 - dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): Write ACK timed out !", mantis->num); 69 + dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): Write ACK timed out !", mantis->num); 88 70 rc = -EREMOTEIO; 89 71 } 90 - dprintk(verbose, MANTIS_DEBUG, 1, "Write Acknowledged"); 72 + dprintk(MANTIS_DEBUG, 1, "Write Acknowledged"); 91 73 mantis->gpif_status &= ~MANTIS_GPIF_WRACK; 92 74 while (!opdone) { 93 75 opdone = (mmread(MANTIS_GPIF_STATUS) & MANTIS_SBUF_OPDONE); 94 76 udelay(500); 95 77 timeout++; 96 78 if (timeout > 100) { 97 - dprintk(verbose, MANTIS_ERROR, 1, "Adater(%d) Slot(0): Write operation timed out!", mantis->num); 79 + dprintk(MANTIS_ERROR, 1, "Adater(%d) Slot(0): Write operation timed out!", mantis->num); 98 80 rc = -ETIMEDOUT; 99 81 break; 100 82 } 101 83 } 102 - dprintk(verbose, MANTIS_DEBUG, 1, "HIF Write success"); 84 + dprintk(MANTIS_DEBUG, 1, "HIF Write success"); 103 85 return rc; 104 86 } 105 87 ··· 109 91 struct mantis_pci *mantis = ca->ca_priv; 110 92 u32 hif_addr = 0, data, count = 4; 111 93 112 - dprintk(verbose, MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF Mem Read", mantis->num); 94 + dprintk(MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF Mem Read", mantis->num); 113 95 mutex_lock(&ca->ca_lock); 114 96 hif_addr &= ~MANTIS_GPIF_PCMCIAREG; 115 97 hif_addr &= ~MANTIS_GPIF_PCMCIAIOM; ··· 122 104 mmwrite(hif_addr | MANTIS_GPIF_HIFRDWRN, MANTIS_GPIF_ADDR); 123 105 124 106 if (mantis_hif_sbuf_opdone_wait(ca) != 0) { 125 - dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): GPIF Smart Buffer operation failed", mantis->num); 107 + dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): GPIF Smart Buffer operation failed", mantis->num); 126 108 mutex_unlock(&ca->ca_lock); 127 109 return -EREMOTEIO; 128 110 } 129 111 data = mmread(MANTIS_GPIF_DIN); 130 112 mutex_unlock(&ca->ca_lock); 131 - dprintk(verbose, MANTIS_DEBUG, 1, "Mem Read: 0x%02x", data); 113 + dprintk(MANTIS_DEBUG, 1, "Mem Read: 0x%02x", data); 132 114 return (data >> 24) & 0xff; 133 115 } 134 116 ··· 138 120 struct mantis_pci *mantis = ca->ca_priv; 139 121 u32 hif_addr = 0; 140 122 141 - dprintk(verbose, MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF Mem Write", mantis->num); 123 + dprintk(MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF Mem Write", mantis->num); 142 124 mutex_lock(&ca->ca_lock); 143 125 hif_addr &= ~MANTIS_GPIF_HIFRDWRN; 144 126 hif_addr &= ~MANTIS_GPIF_PCMCIAREG; ··· 151 133 mmwrite(data, MANTIS_GPIF_DOUT); 152 134 153 135 if (mantis_hif_write_wait(ca) != 0) { 154 - dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num); 136 + dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num); 155 137 mutex_unlock(&ca->ca_lock); 156 138 return -EREMOTEIO; 157 139 } 158 - dprintk(verbose, MANTIS_DEBUG, 1, "Mem Write: (0x%02x to 0x%02x)", data, addr); 140 + dprintk(MANTIS_DEBUG, 1, "Mem Write: (0x%02x to 0x%02x)", data, addr); 159 141 mutex_unlock(&ca->ca_lock); 160 142 161 143 return 0; ··· 166 148 struct mantis_pci *mantis = ca->ca_priv; 167 149 u32 data, hif_addr = 0; 168 150 169 - dprintk(verbose, MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF I/O Read", mantis->num); 151 + dprintk(MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF I/O Read", mantis->num); 170 152 mutex_lock(&ca->ca_lock); 171 153 hif_addr &= ~MANTIS_GPIF_PCMCIAREG; 172 154 hif_addr |= MANTIS_GPIF_PCMCIAIOM; ··· 179 161 mmwrite(hif_addr | MANTIS_GPIF_HIFRDWRN, MANTIS_GPIF_ADDR); 180 162 181 163 if (mantis_hif_sbuf_opdone_wait(ca) != 0) { 182 - dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num); 164 + dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num); 183 165 mutex_unlock(&ca->ca_lock); 184 166 return -EREMOTEIO; 185 167 } 186 168 data = mmread(MANTIS_GPIF_DIN); 187 - dprintk(verbose, MANTIS_DEBUG, 1, "I/O Read: 0x%02x", data); 169 + dprintk(MANTIS_DEBUG, 1, "I/O Read: 0x%02x", data); 188 170 udelay(50); 189 171 mutex_unlock(&ca->ca_lock); 190 172 ··· 196 178 struct mantis_pci *mantis = ca->ca_priv; 197 179 u32 hif_addr = 0; 198 180 199 - dprintk(verbose, MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF I/O Write", mantis->num); 181 + dprintk(MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF I/O Write", mantis->num); 200 182 mutex_lock(&ca->ca_lock); 201 183 hif_addr &= ~MANTIS_GPIF_PCMCIAREG; 202 184 hif_addr &= ~MANTIS_GPIF_HIFRDWRN; ··· 208 190 mmwrite(data, MANTIS_GPIF_DOUT); 209 191 210 192 if (mantis_hif_write_wait(ca) != 0) { 211 - dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num); 193 + dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num); 212 194 mutex_unlock(&ca->ca_lock); 213 195 return -EREMOTEIO; 214 196 } 215 - dprintk(verbose, MANTIS_DEBUG, 1, "I/O Write: (0x%02x to 0x%02x)", data, addr); 197 + dprintk(MANTIS_DEBUG, 1, "I/O Write: (0x%02x to 0x%02x)", data, addr); 216 198 mutex_unlock(&ca->ca_lock); 217 199 udelay(50); 218 200 ··· 226 208 u32 irqcfg; 227 209 228 210 slot[0].slave_cfg = 0x70773028; 229 - dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Initializing Mantis Host Interface", mantis->num); 211 + dprintk(MANTIS_ERROR, 1, "Adapter(%d) Initializing Mantis Host Interface", mantis->num); 230 212 231 213 mutex_lock(&ca->ca_lock); 232 214 irqcfg = mmread(MANTIS_GPIF_IRQCFG); ··· 248 230 struct mantis_pci *mantis = ca->ca_priv; 249 231 u32 irqcfg; 250 232 251 - dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Exiting Mantis Host Interface", mantis->num); 233 + dprintk(MANTIS_ERROR, 1, "Adapter(%d) Exiting Mantis Host Interface", mantis->num); 252 234 mutex_lock(&ca->ca_lock); 253 235 irqcfg = mmread(MANTIS_GPIF_IRQCFG); 254 236 irqcfg &= ~MANTIS_MASK_BRRDY;
+1 -1
drivers/media/dvb/mantis/mantis_hif.h
··· 26 26 #define MANTIS_HIF_IOMRD 3 27 27 #define MANTIS_HIF_IOMWR 4 28 28 29 - #endif // __MANTIS_HIF_H 29 + #endif /* __MANTIS_HIF_H */
+42 -33
drivers/media/dvb/mantis/mantis_i2c.c
··· 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 20 21 - #include <linux/module.h> 22 - #include <linux/moduleparam.h> 23 - #include <linux/init.h> 24 - #include <linux/delay.h> 25 21 #include <asm/io.h> 26 22 #include <linux/ioport.h> 27 - #include <asm/pgtable.h> 28 - #include <asm/page.h> 23 + #include <linux/pci.h> 24 + #include <linux/i2c.h> 25 + 26 + #include "dmxdev.h" 27 + #include "dvbdev.h" 28 + #include "dvb_demux.h" 29 + #include "dvb_frontend.h" 30 + #include "dvb_net.h" 31 + 29 32 #include "mantis_common.h" 33 + #include "mantis_reg.h" 34 + #include "mantis_i2c.h" 30 35 31 36 #define I2C_HW_B_MANTIS 0x1c 32 37 ··· 40 35 int rc = 0; 41 36 u32 timeout = 0; 42 37 43 - if (wait_event_interruptible_timeout(mantis->i2c_wq, 44 - mantis->mantis_int_stat & MANTIS_INT_I2CDONE, 45 - msecs_to_jiffies(50)) == -ERESTARTSYS) { 38 + if (wait_event_timeout(mantis->i2c_wq, 39 + mantis->mantis_int_stat & MANTIS_INT_I2CDONE, 40 + msecs_to_jiffies(50)) == -ERESTARTSYS) { 46 41 47 - dprintk(verbose, MANTIS_DEBUG, 1, "Master !I2CDONE"); 42 + dprintk(MANTIS_DEBUG, 1, "Master !I2CDONE"); 48 43 rc = -EREMOTEIO; 49 44 } 45 + 50 46 while (!(mantis->mantis_int_stat & MANTIS_INT_I2CRACK)) { 51 - dprintk(verbose, MANTIS_DEBUG, 1, "Waiting for Slave RACK"); 47 + dprintk(MANTIS_DEBUG, 1, "Waiting for Slave RACK"); 52 48 mantis->mantis_int_stat = mmread(MANTIS_INT_STAT); 53 49 msleep(5); 54 50 timeout++; 55 51 if (timeout > 500) { 56 - dprintk(verbose, MANTIS_ERROR, 1, "Slave RACK Fail !"); 52 + dprintk(MANTIS_ERROR, 1, "Slave RACK Fail !"); 57 53 rc = -EREMOTEIO; 58 54 break; 59 55 } ··· 68 62 { 69 63 u32 rxd, i; 70 64 71 - dprintk(verbose, MANTIS_INFO, 0, " %s: Address=[0x%02x] <R>[ ", 65 + dprintk(MANTIS_INFO, 0, " %s: Address=[0x%02x] <R>[ ", 72 66 __func__, msg->addr); 73 67 74 68 for (i = 0; i < msg->len; i++) { ··· 83 77 mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT); 84 78 mmwrite(rxd, MANTIS_I2CDATA_CTL); 85 79 if (mantis_ack_wait(mantis) != 0) { 86 - dprintk(verbose, MANTIS_DEBUG, 1, "ACK failed<R>"); 80 + dprintk(MANTIS_DEBUG, 1, "ACK failed<R>"); 87 81 return -EREMOTEIO; 88 82 } 89 83 rxd = mmread(MANTIS_I2CDATA_CTL); 90 84 msg->buf[i] = (u8)((rxd >> 8) & 0xFF); 91 - dprintk(verbose, MANTIS_INFO, 0, "%02x ", msg->buf[i]); 85 + dprintk(MANTIS_INFO, 0, "%02x ", msg->buf[i]); 92 86 } 93 - dprintk(verbose, MANTIS_INFO, 0, "]\n"); 87 + dprintk(MANTIS_INFO, 0, "]\n"); 94 88 95 89 return 0; 96 90 } ··· 100 94 int i; 101 95 u32 txd = 0; 102 96 103 - dprintk(verbose, MANTIS_INFO, 0, " %s: Address=[0x%02x] <W>[ ", 97 + dprintk(MANTIS_INFO, 0, " %s: Address=[0x%02x] <W>[ ", 104 98 __func__, msg->addr); 105 99 106 100 for (i = 0; i < msg->len; i++) { 107 - dprintk(verbose, MANTIS_INFO, 0, "%02x ", msg->buf[i]); 101 + dprintk(MANTIS_INFO, 0, "%02x ", msg->buf[i]); 108 102 txd = (msg->addr << 25) | (msg->buf[i] << 8) 109 103 | MANTIS_I2C_RATE_3 110 104 | MANTIS_I2C_STOP ··· 116 110 mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT); 117 111 mmwrite(txd, MANTIS_I2CDATA_CTL); 118 112 if (mantis_ack_wait(mantis) != 0) { 119 - dprintk(verbose, MANTIS_DEBUG, 1, "ACK failed<W>"); 113 + dprintk(MANTIS_DEBUG, 1, "ACK failed<W>"); 120 114 return -EREMOTEIO; 121 115 } 122 116 } 123 - dprintk(verbose, MANTIS_INFO, 0, "]\n"); 117 + dprintk(MANTIS_INFO, 0, "]\n"); 124 118 125 119 return 0; 126 120 } ··· 160 154 .functionality = mantis_i2c_func, 161 155 }; 162 156 163 - static struct i2c_adapter mantis_i2c_adapter = { 164 - .owner = THIS_MODULE, 165 - .name = "Mantis I2C", 166 - .id = I2C_HW_B_MANTIS, 167 - .class = I2C_CLASS_TV_DIGITAL, 168 - .algo = &mantis_algo, 169 - }; 170 - 171 157 int __devinit mantis_i2c_init(struct mantis_pci *mantis) 172 158 { 173 159 u32 intstat, intmask; 174 160 struct i2c_adapter *i2c_adapter = &mantis->adapter; 175 161 struct pci_dev *pdev = mantis->pdev; 176 162 163 + init_waitqueue_head(&mantis->i2c_wq); 177 164 mutex_init(&mantis->i2c_lock); 178 - memcpy(i2c_adapter, &mantis_i2c_adapter, sizeof (mantis_i2c_adapter)); 165 + strncpy(i2c_adapter->name, "Mantis I2C", sizeof (i2c_adapter->name)); 179 166 i2c_set_adapdata(i2c_adapter, mantis); 180 167 181 - i2c_adapter->dev.parent = &pdev->dev; 168 + i2c_adapter->owner = THIS_MODULE; 169 + i2c_adapter->class = I2C_CLASS_TV_DIGITAL; 170 + i2c_adapter->algo = &mantis_algo; 171 + i2c_adapter->algo_data = NULL; 172 + i2c_adapter->id = I2C_HW_B_MANTIS; 173 + i2c_adapter->timeout = 500; 174 + i2c_adapter->retries = 3; 175 + i2c_adapter->dev.parent = &pdev->dev; 176 + 182 177 mantis->i2c_rc = i2c_add_adapter(i2c_adapter); 183 178 if (mantis->i2c_rc < 0) 184 179 return mantis->i2c_rc; 185 180 186 - dprintk(verbose, MANTIS_DEBUG, 1, "Initializing I2C .."); 181 + dprintk(MANTIS_DEBUG, 1, "Initializing I2C .."); 187 182 188 183 intstat = mmread(MANTIS_INT_STAT); 189 184 intmask = mmread(MANTIS_INT_MASK); 190 185 mmwrite(intstat, MANTIS_INT_STAT); 191 186 mmwrite(intmask | MANTIS_INT_I2CDONE, MANTIS_INT_MASK); 192 187 193 - dprintk(verbose, MANTIS_DEBUG, 1, "[0x%08x/%08x]", intstat, intmask); 188 + dprintk(MANTIS_DEBUG, 1, "Status=<%02x> Mask=<%02x>", intstat, intmask); 194 189 195 190 return 0; 196 191 } 192 + EXPORT_SYMBOL_GPL(mantis_i2c_init); 197 193 198 194 int __devexit mantis_i2c_exit(struct mantis_pci *mantis) 199 195 { 200 - dprintk(verbose, MANTIS_DEBUG, 1, "Removing I2C adapter"); 196 + dprintk(MANTIS_DEBUG, 1, "Removing I2C adapter"); 201 197 return i2c_del_adapter(&mantis->adapter); 202 198 } 199 + EXPORT_SYMBOL_GPL(mantis_i2c_exit);
+7
drivers/media/dvb/mantis/mantis_i2c.h
··· 1 + #ifndef __MANTIS_I2C_H 2 + #define __MANTIS_I2C_H 3 + 4 + extern int mantis_i2c_init(struct mantis_pci *mantis); 5 + extern int mantis_i2c_exit(struct mantis_pci *mantis); 6 + 7 + #endif /* __MANTIS_I2C_H */
+145
drivers/media/dvb/mantis/mantis_ioc.c
··· 1 + /* 2 + Mantis PCI bridge driver 3 + 4 + Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com) 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 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with this program; if not, write to the Free Software 18 + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 + */ 20 + 21 + #include <linux/kernel.h> 22 + #include <linux/i2c.h> 23 + 24 + #include <asm/irq.h> 25 + #include <linux/signal.h> 26 + #include <linux/sched.h> 27 + #include <linux/interrupt.h> 28 + 29 + #include "dmxdev.h" 30 + #include "dvbdev.h" 31 + #include "dvb_demux.h" 32 + #include "dvb_frontend.h" 33 + #include "dvb_net.h" 34 + 35 + #include "mantis_common.h" 36 + #include "mantis_reg.h" 37 + #include "mantis_ioc.h" 38 + 39 + static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length) 40 + { 41 + struct i2c_adapter *adapter = &mantis->adapter; 42 + 43 + int err; 44 + struct i2c_msg msg[] = { 45 + { .addr = 0x50, .flags = 0, .buf = data, .len = 1 }, 46 + { .addr = 0x50, .flags = I2C_M_RD, .buf = data, .len = length }, 47 + }; 48 + 49 + err = i2c_transfer(adapter, msg, 2); 50 + if (err < 0) { 51 + dprintk(MANTIS_ERROR, 1, "ERROR: i2c read: < err=%i d0=0x%02x d1=0x%02x >", 52 + err, data[0], data[1]); 53 + 54 + return err; 55 + } 56 + 57 + return 0; 58 + } 59 + 60 + static int write_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length) 61 + { 62 + struct i2c_adapter *adapter = &mantis->adapter; 63 + int err; 64 + 65 + struct i2c_msg msg = { .addr = 0x50, .flags = 0, .buf = data, .len = length }; 66 + 67 + err = i2c_transfer(adapter, &msg, 1); 68 + if (err < 0) { 69 + dprintk(MANTIS_ERROR, 1, "ERROR: i2c write: < err=%i length=0x%02x d0=0x%02x, d1=0x%02x >", 70 + err, length, data[0], data[1]); 71 + 72 + return err; 73 + } 74 + 75 + return 0; 76 + } 77 + 78 + int mantis_get_mac(struct mantis_pci *mantis) 79 + { 80 + int err; 81 + 82 + mantis->mac_address[0] = 0x08; 83 + 84 + err = read_eeprom_byte(mantis, &mantis->mac_address[0], 6); 85 + if (err < 0) { 86 + dprintk(MANTIS_ERROR, 1, "ERROR: Mantis EEPROM read error <%d>", err); 87 + 88 + return err; 89 + } 90 + 91 + dprintk(MANTIS_ERROR, 0, 92 + " MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]\n", 93 + mantis->mac_address[0], mantis->mac_address[1], 94 + mantis->mac_address[2], mantis->mac_address[3], 95 + mantis->mac_address[4], mantis->mac_address[5]); 96 + 97 + return 0; 98 + } 99 + EXPORT_SYMBOL_GPL(mantis_get_mac); 100 + 101 + /* Turn the given bit on or off. */ 102 + void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value) 103 + { 104 + u32 cur; 105 + 106 + cur = mmread(MANTIS_GPIF_ADDR); 107 + if (value) 108 + mantis->gpio_status = cur | (1 << bitpos); 109 + else 110 + mantis->gpio_status = cur & (~(1 << bitpos)); 111 + 112 + mmwrite(mantis->gpio_status, MANTIS_GPIF_ADDR); 113 + mmwrite(0x00, MANTIS_GPIF_DOUT); 114 + } 115 + EXPORT_SYMBOL_GPL(gpio_set_bits); 116 + 117 + int mantis_stream_control(struct mantis_pci *mantis, enum mantis_stream_control stream_ctl) 118 + { 119 + u32 reg; 120 + 121 + reg = mmread(MANTIS_CONTROL); 122 + switch (stream_ctl) { 123 + case STREAM_TO_HIF: 124 + dprintk(MANTIS_DEBUG, 1, "Set stream to HIF"); 125 + reg &= 0xff - MANTIS_BYPASS; 126 + mmwrite(reg, MANTIS_CONTROL); 127 + reg |= MANTIS_BYPASS; 128 + mmwrite(reg, MANTIS_CONTROL); 129 + break; 130 + 131 + case STREAM_TO_CAM: 132 + dprintk(MANTIS_DEBUG, 1, "Set stream to CAM"); 133 + reg |= MANTIS_BYPASS; 134 + mmwrite(reg, MANTIS_CONTROL); 135 + reg &= 0xff - MANTIS_BYPASS; 136 + mmwrite(reg, MANTIS_CONTROL); 137 + break; 138 + default: 139 + dprintk(MANTIS_ERROR, 1, "Unknown MODE <%02x>", stream_ctl); 140 + return -1; 141 + } 142 + 143 + return 0; 144 + } 145 + EXPORT_SYMBOL_GPL(mantis_stream_control);
+1 -2
drivers/media/dvb/mantis/mantis_link.h
··· 58 58 59 59 enum mantis_slot_state slot_state; 60 60 61 - // struct dvb_device *ca_dev; 62 61 void *ca_priv; 63 62 64 63 struct dvb_ca_en50221 en50221; ··· 80 81 extern int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr); 81 82 extern int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data); 82 83 83 - #endif // __MANTIS_LINK_H 84 + #endif /* __MANTIS_LINK_H */
+106 -218
drivers/media/dvb/mantis/mantis_pci.c
··· 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 20 21 + #include <linux/module.h> 22 + #include <linux/moduleparam.h> 23 + #include <linux/kernel.h> 21 24 #include <asm/io.h> 22 25 #include <asm/pgtable.h> 23 26 #include <asm/page.h> ··· 28 25 #include <linux/vmalloc.h> 29 26 #include <linux/init.h> 30 27 #include <linux/device.h> 31 - #include "mantis_common.h" 32 - #include "mantis_core.h" 33 - #include "mantis_uart.h" 28 + #include <linux/pci.h> 34 29 35 30 #include <asm/irq.h> 36 31 #include <linux/signal.h> 37 32 #include <linux/sched.h> 38 33 #include <linux/interrupt.h> 39 34 40 - unsigned int verbose = 1; 41 - module_param(verbose, int, 0644); 42 - MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)"); 35 + #include "dmxdev.h" 36 + #include "dvbdev.h" 37 + #include "dvb_demux.h" 38 + #include "dvb_frontend.h" 39 + #include "dvb_net.h" 43 40 44 - unsigned int devs; 41 + #include <asm/irq.h> 42 + #include <linux/signal.h> 43 + #include <linux/sched.h> 44 + #include <linux/interrupt.h> 45 45 46 - #define PCI_VENDOR_ID_MANTIS 0x1822 47 - #define PCI_DEVICE_ID_MANTIS_R11 0x4e35 48 - #define DRIVER_NAME "Mantis" 46 + #include "mantis_common.h" 47 + #include "mantis_reg.h" 48 + #include "mantis_pci.h" 49 49 50 - static struct pci_device_id mantis_pci_table[] = { 51 - { PCI_DEVICE(PCI_VENDOR_ID_MANTIS, PCI_DEVICE_ID_MANTIS_R11) }, 52 - { 0 }, 53 - }; 50 + #define DRIVER_NAME "Mantis Core" 54 51 55 - MODULE_DEVICE_TABLE(pci, mantis_pci_table); 56 - 57 - static irqreturn_t mantis_pci_irq(int irq, void *dev_id) 58 - { 59 - u32 stat = 0, mask = 0, lstat = 0, mstat = 0; 60 - u32 rst_stat = 0, rst_mask = 0; 61 - 62 - struct mantis_pci *mantis; 63 - struct mantis_ca *ca; 64 - 65 - mantis = (struct mantis_pci *) dev_id; 66 - if (unlikely(mantis == NULL)) { 67 - dprintk(verbose, MANTIS_ERROR, 1, "Mantis == NULL"); 68 - return IRQ_NONE; 69 - } 70 - ca = mantis->mantis_ca; 71 - 72 - stat = mmread(MANTIS_INT_STAT); 73 - mask = mmread(MANTIS_INT_MASK); 74 - mstat = lstat = stat & ~MANTIS_INT_RISCSTAT; 75 - if (!(stat & mask)) 76 - return IRQ_NONE; 77 - 78 - rst_mask = MANTIS_GPIF_WRACK | 79 - MANTIS_GPIF_OTHERR | 80 - MANTIS_SBUF_WSTO | 81 - MANTIS_GPIF_EXTIRQ; 82 - 83 - rst_stat = mmread(MANTIS_GPIF_STATUS); 84 - rst_stat &= rst_mask; 85 - mmwrite(rst_stat, MANTIS_GPIF_STATUS); 86 - 87 - mantis->mantis_int_stat = stat; 88 - mantis->mantis_int_mask = mask; 89 - dprintk(verbose, MANTIS_DEBUG, 0, "=== Interrupts[%04x/%04x]= [", stat, mask); 90 - if (stat & MANTIS_INT_RISCEN) { 91 - dprintk(verbose, MANTIS_DEBUG, 0, "* DMA enabl *"); 92 - } 93 - if (stat & MANTIS_INT_IRQ0) { 94 - dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *"); 95 - mantis->gpif_status = rst_stat; 96 - wake_up(&ca->hif_write_wq); 97 - schedule_work(&ca->hif_evm_work); 98 - } 99 - if (stat & MANTIS_INT_IRQ1) { 100 - dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *"); 101 - schedule_work(&mantis->uart_work); 102 - } 103 - if (stat & MANTIS_INT_OCERR) { 104 - dprintk(verbose, MANTIS_DEBUG, 0, "* INT OCERR *"); 105 - } 106 - if (stat & MANTIS_INT_PABORT) { 107 - dprintk(verbose, MANTIS_DEBUG, 0, "* INT PABRT *"); 108 - } 109 - if (stat & MANTIS_INT_RIPERR) { 110 - dprintk(verbose, MANTIS_DEBUG, 0, "* INT RIPRR *"); 111 - } 112 - if (stat & MANTIS_INT_PPERR) { 113 - dprintk(verbose, MANTIS_DEBUG, 0, "* INT PPERR *"); 114 - } 115 - if (stat & MANTIS_INT_FTRGT) { 116 - dprintk(verbose, MANTIS_DEBUG, 0, "* INT FTRGT *"); 117 - } 118 - if (stat & MANTIS_INT_RISCI) { 119 - dprintk(verbose, MANTIS_DEBUG, 0, "* INT RISCI *"); 120 - mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28; 121 - tasklet_schedule(&mantis->tasklet); 122 - } 123 - if (stat & MANTIS_INT_I2CDONE) { 124 - dprintk(verbose, MANTIS_DEBUG, 0, "* I2C DONE *"); 125 - wake_up(&mantis->i2c_wq); 126 - } 127 - mmwrite(stat, MANTIS_INT_STAT); 128 - stat &= ~(MANTIS_INT_RISCEN | MANTIS_INT_I2CDONE | 129 - MANTIS_INT_I2CRACK | MANTIS_INT_PCMCIA7 | 130 - MANTIS_INT_PCMCIA6 | MANTIS_INT_PCMCIA5 | 131 - MANTIS_INT_PCMCIA4 | MANTIS_INT_PCMCIA3 | 132 - MANTIS_INT_PCMCIA2 | MANTIS_INT_PCMCIA1 | 133 - MANTIS_INT_PCMCIA0 | MANTIS_INT_IRQ1 | 134 - MANTIS_INT_IRQ0 | MANTIS_INT_OCERR | 135 - MANTIS_INT_PABORT | MANTIS_INT_RIPERR | 136 - MANTIS_INT_PPERR | MANTIS_INT_FTRGT | 137 - MANTIS_INT_RISCI); 138 - 139 - if (stat) 140 - dprintk(verbose, MANTIS_DEBUG, 0, "* Unknown [%04x] *", stat); 141 - 142 - dprintk(verbose, MANTIS_DEBUG, 0, "] ===\n"); 143 - 144 - return IRQ_HANDLED; 145 - } 146 - 147 - 148 - static int __devinit mantis_pci_probe(struct pci_dev *pdev, 149 - const struct pci_device_id *mantis_pci_table) 52 + int __devinit mantis_pci_init(struct mantis_pci *mantis) 150 53 { 151 54 u8 revision, latency; 152 - struct mantis_pci *mantis; 153 - int ret = 0; 55 + struct mantis_hwconfig *config = mantis->hwconfig; 56 + struct pci_dev *pdev = mantis->pdev; 57 + int err, ret = 0; 154 58 155 - mantis = kmalloc(sizeof (struct mantis_pci), GFP_KERNEL); 156 - if (mantis == NULL) { 157 - printk("%s: Out of memory\n", __func__); 59 + dprintk(MANTIS_ERROR, 0, "found a %s PCI %s device on (%02x:%02x.%x),\n", 60 + config->model_name, 61 + config->dev_type, 62 + mantis->pdev->bus->number, 63 + PCI_SLOT(mantis->pdev->devfn), 64 + PCI_FUNC(mantis->pdev->devfn)); 65 + 66 + err = pci_enable_device(pdev); 67 + if (err != 0) { 68 + ret = -ENODEV; 69 + dprintk(MANTIS_ERROR, 1, "ERROR: PCI enable failed <%i>", err); 70 + goto fail0; 71 + } 72 + 73 + err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); 74 + if (err != 0) { 75 + dprintk(MANTIS_ERROR, 1, "ERROR: Unable to obtain 32 bit DMA <%i>", err); 158 76 ret = -ENOMEM; 159 - goto err; 160 - } 161 - memset(mantis, 0, sizeof (struct mantis_pci)); 162 - mantis->num = devs; 163 - devs++; 164 - 165 - if (pci_enable_device(pdev)) { 166 - dprintk(verbose, MANTIS_ERROR, 1, "Mantis PCI enable failed"); 167 - ret = -ENODEV; 168 - goto err; 169 - } 170 - mantis->mantis_addr = pci_resource_start(pdev, 0); 171 - if (!request_mem_region(pci_resource_start(pdev, 0), 172 - pci_resource_len(pdev, 0), DRIVER_NAME)) { 173 - ret = -ENODEV; 174 - goto err0; 77 + goto fail1; 175 78 } 176 79 177 - mantis->mantis_mmio = ioremap(pci_resource_start(pdev, 0), 178 - pci_resource_len(pdev, 0)); 179 - 180 - if (!mantis->mantis_mmio) { 181 - dprintk(verbose, MANTIS_ERROR, 1, "IO remap failed"); 182 - ret = -ENODEV; 183 - goto err1; 184 - } 185 - 186 - // Clear and disable all interrupts at startup 187 - // to avoid lockup situations 188 - mmwrite(0x00, MANTIS_INT_MASK); 189 - if (request_irq(pdev->irq, 190 - mantis_pci_irq, 191 - IRQF_SHARED, 192 - DRIVER_NAME, 193 - mantis) < 0) { 194 - 195 - dprintk(verbose, MANTIS_ERROR, 1, "Mantis IRQ reg failed"); 196 - ret = -ENODEV; 197 - goto err2; 198 - } 199 80 pci_set_master(pdev); 200 - pci_set_drvdata(pdev, mantis); 81 + 82 + if (!request_mem_region(pci_resource_start(pdev, 0), 83 + pci_resource_len(pdev, 0), 84 + DRIVER_NAME)) { 85 + 86 + dprintk(MANTIS_ERROR, 1, "ERROR: BAR0 Request failed !"); 87 + ret = -ENODEV; 88 + goto fail1; 89 + } 90 + 91 + mantis->mmio = ioremap(pci_resource_start(pdev, 0), 92 + pci_resource_len(pdev, 0)); 93 + 94 + if (!mantis->mmio) { 95 + dprintk(MANTIS_ERROR, 1, "ERROR: BAR0 remap failed !"); 96 + ret = -ENODEV; 97 + goto fail2; 98 + } 99 + 201 100 pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency); 202 101 pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); 203 102 mantis->latency = latency; 204 103 mantis->revision = revision; 205 - mantis->pdev = pdev; 206 - mantis->subsystem_vendor = pdev->subsystem_vendor; 207 - mantis->subsystem_device = pdev->subsystem_device; 208 - init_waitqueue_head(&mantis->i2c_wq); 209 104 210 - mantis_set_direction(mantis, 0); /* CAM bypass */ 105 + dprintk(MANTIS_ERROR, 0, " Mantis Rev %d [%04x:%04x], ", 106 + mantis->revision, 107 + mantis->pdev->subsystem_vendor, 108 + mantis->pdev->subsystem_device); 211 109 212 - if (!latency) 213 - pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 32); 110 + dprintk(MANTIS_ERROR, 0, 111 + "irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p\n", 112 + mantis->pdev->irq, 113 + mantis->latency, 114 + mantis->mantis_addr, 115 + mantis->mmio); 214 116 215 - dprintk(verbose, MANTIS_ERROR, 0, 216 - "irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p\n", 217 - pdev->irq, mantis->latency, 218 - mantis->mantis_addr, mantis->mantis_mmio); 117 + err = request_irq(pdev->irq, 118 + config->irq_handler, 119 + IRQF_SHARED, 120 + DRIVER_NAME, 121 + mantis); 219 122 220 - // No more PCI specific stuff ! 221 - if (mantis_core_init(mantis) < 0) { 222 - dprintk(verbose, MANTIS_ERROR, 1, "Mantis core init failed"); 123 + if (err != 0) { 124 + 125 + dprintk(MANTIS_ERROR, 1, "ERROR: IRQ registration failed ! <%d>", err); 223 126 ret = -ENODEV; 224 - goto err2; 127 + goto fail3; 225 128 } 226 129 227 - return 0; 130 + pci_set_drvdata(pdev, mantis); 131 + return ret; 228 132 229 - // Error conditions .. 230 - err2: 231 - dprintk(verbose, MANTIS_DEBUG, 1, "Err: IO Unmap"); 232 - if (mantis->mantis_mmio) 233 - iounmap(mantis->mantis_mmio); 234 - err1: 235 - dprintk(verbose, MANTIS_DEBUG, 1, "Err: Release regions"); 133 + /* Error conditions */ 134 + fail3: 135 + dprintk(MANTIS_ERROR, 1, "ERROR: <%d> I/O unmap", ret); 136 + if (mantis->mmio) 137 + iounmap(mantis->mmio); 138 + 139 + fail2: 140 + dprintk(MANTIS_ERROR, 1, "ERROR: <%d> releasing regions", ret); 236 141 release_mem_region(pci_resource_start(pdev, 0), 237 - pci_resource_len(pdev, 0)); 142 + pci_resource_len(pdev, 0)); 143 + 144 + fail1: 145 + dprintk(MANTIS_ERROR, 1, "ERROR: <%d> disabling device", ret); 238 146 pci_disable_device(pdev); 239 - err0: 240 - dprintk(verbose, MANTIS_DEBUG, 1, "Err: Free"); 241 - kfree(mantis); 242 - err: 243 - dprintk(verbose, MANTIS_DEBUG, 1, "Err:"); 147 + 148 + fail0: 149 + dprintk(MANTIS_ERROR, 1, "ERROR: <%d> exiting", ret); 150 + pci_set_drvdata(pdev, NULL); 244 151 return ret; 245 152 } 153 + EXPORT_SYMBOL_GPL(mantis_pci_init); 246 154 247 - static void __devexit mantis_pci_remove(struct pci_dev *pdev) 155 + void __devexit mantis_pci_exit(struct mantis_pci *mantis) 248 156 { 249 - struct mantis_pci *mantis = pci_get_drvdata(pdev); 157 + struct pci_dev *pdev = mantis->pdev; 250 158 251 - if (mantis == NULL) { 252 - dprintk(verbose, MANTIS_ERROR, 1, "Aeio, Mantis NULL ptr"); 253 - return; 254 - } 255 - mantis_core_exit(mantis); 256 - dprintk(verbose, MANTIS_ERROR, 1, "Removing -->Mantis irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p", 257 - pdev->irq, mantis->latency, mantis->mantis_addr, 258 - mantis->mantis_mmio); 259 - 159 + dprintk(MANTIS_NOTICE, 1, " mem: 0x%p", mantis->mmio); 260 160 free_irq(pdev->irq, mantis); 261 - pci_release_regions(pdev); 262 - if (mantis_dma_exit(mantis) < 0) 263 - dprintk(verbose, MANTIS_ERROR, 1, "DMA exit failed"); 161 + if (mantis->mmio) { 162 + iounmap(mantis->mmio); 163 + release_mem_region(pci_resource_start(pdev, 0), 164 + pci_resource_len(pdev, 0)); 165 + } 264 166 265 - pci_set_drvdata(pdev, NULL); 266 167 pci_disable_device(pdev); 267 - kfree(mantis); 168 + pci_set_drvdata(pdev, NULL); 268 169 } 269 - 270 - static struct pci_driver mantis_pci_driver = { 271 - .name = DRIVER_NAME, 272 - .id_table = mantis_pci_table, 273 - .probe = mantis_pci_probe, 274 - .remove = mantis_pci_remove, 275 - }; 276 - 277 - static int __devinit mantis_pci_init(void) 278 - { 279 - return pci_register_driver(&mantis_pci_driver); 280 - } 281 - 282 - static void __devexit mantis_pci_exit(void) 283 - { 284 - pci_unregister_driver(&mantis_pci_driver); 285 - } 286 - 287 - module_init(mantis_pci_init); 288 - module_exit(mantis_pci_exit); 170 + EXPORT_SYMBOL_GPL(mantis_pci_exit); 289 171 290 172 MODULE_DESCRIPTION("Mantis PCI DTV bridge driver"); 291 173 MODULE_AUTHOR("Manu Abraham");
+7
drivers/media/dvb/mantis/mantis_pci.h
··· 1 + #ifndef __MANTIS_PCI_H 2 + #define __MANTIS_PCI_H 3 + 4 + extern int mantis_pci_init(struct mantis_pci *mantis); 5 + extern void mantis_pci_exit(struct mantis_pci *mantis); 6 + 7 + #endif /* __MANTIS_PCI_H */
+18 -4
drivers/media/dvb/mantis/mantis_pcmcia.c
··· 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 20 21 + #include <linux/kernel.h> 22 + 23 + #include <asm/irq.h> 24 + #include <linux/signal.h> 25 + #include <linux/sched.h> 26 + #include <linux/interrupt.h> 27 + 28 + #include "dmxdev.h" 29 + #include "dvbdev.h" 30 + #include "dvb_demux.h" 31 + #include "dvb_frontend.h" 32 + #include "dvb_net.h" 33 + 21 34 #include "mantis_common.h" 22 35 #include "mantis_link.h" /* temporary due to physical layer stuff */ 36 + #include "mantis_reg.h" 23 37 24 38 /* 25 39 * If Slot state is already PLUG_IN event and we are called ··· 46 32 u32 gpif_irqcfg; 47 33 48 34 if (ca->slot_state == MODULE_XTRACTED) { 49 - dprintk(verbose, MANTIS_DEBUG, 1, "Event: CAM Plugged IN: Adapter(%d) Slot(0)", mantis->num); 35 + dprintk(MANTIS_DEBUG, 1, "Event: CAM Plugged IN: Adapter(%d) Slot(0)", mantis->num); 50 36 udelay(50); 51 37 mmwrite(0xda000000, MANTIS_CARD_RESET); 52 38 gpif_irqcfg = mmread(MANTIS_GPIF_IRQCFG); ··· 70 56 u32 gpif_irqcfg; 71 57 72 58 if (ca->slot_state == MODULE_INSERTED) { 73 - dprintk(verbose, MANTIS_DEBUG, 1, "Event: CAM Unplugged: Adapter(%d) Slot(0)", mantis->num); 59 + dprintk(MANTIS_DEBUG, 1, "Event: CAM Unplugged: Adapter(%d) Slot(0)", mantis->num); 74 60 udelay(50); 75 61 mmwrite(0x00da0000, MANTIS_CARD_RESET); 76 62 gpif_irqcfg = mmread(MANTIS_GPIF_IRQCFG); ··· 94 80 card_stat = mmread(MANTIS_GPIF_IRQCFG); 95 81 96 82 if (gpif_stat & MANTIS_GPIF_DETSTAT) { 97 - dprintk(verbose, MANTIS_DEBUG, 1, "CAM found on Adapter(%d) Slot(0)", mantis->num); 83 + dprintk(MANTIS_DEBUG, 1, "CAM found on Adapter(%d) Slot(0)", mantis->num); 98 84 mmwrite(card_stat | MANTIS_MASK_PLUGOUT, MANTIS_GPIF_IRQCFG); 99 85 ca->slot_state = MODULE_INSERTED; 100 86 dvb_ca_en50221_camchange_irq(&ca->en50221, 101 87 0, 102 88 DVB_CA_EN50221_CAMCHANGE_INSERTED); 103 89 } else { 104 - dprintk(verbose, MANTIS_DEBUG, 1, "Empty Slot on Adapter(%d) Slot(0)", mantis->num); 90 + dprintk(MANTIS_DEBUG, 1, "Empty Slot on Adapter(%d) Slot(0)", mantis->num); 105 91 mmwrite(card_stat | MANTIS_MASK_PLUGIN, MANTIS_GPIF_IRQCFG); 106 92 ca->slot_state = MODULE_XTRACTED; 107 93 dvb_ca_en50221_camchange_irq(&ca->en50221,
+36 -4
drivers/media/dvb/mantis/mantis_reg.h
··· 21 21 #ifndef __MANTIS_REG_H 22 22 #define __MANTIS_REG_H 23 23 24 - // Interrupts 24 + /* Interrupts */ 25 25 #define MANTIS_INT_STAT 0x00 26 26 #define MANTIS_INT_MASK 0x04 27 27 ··· 49 49 #define MANTIS_INT_RISCI (0x01 << 1) 50 50 #define MANTIS_INT_I2CDONE (0x01 << 0) 51 51 52 - // DMA 52 + /* DMA */ 53 53 #define MANTIS_DMA_CTL 0x08 54 + #define MANTIS_GPIF_RD (0xff << 24) 55 + #define MANTIS_GPIF_WR (0xff << 16) 56 + #define MANTIS_CPU_DO (0x01 << 10) 57 + #define MANTIS_DRV_DO (0x01 << 9) 54 58 #define MANTIS_I2C_RD (0x01 << 7) 55 59 #define MANTIS_I2C_WR (0x01 << 6) 56 60 #define MANTIS_DCAP_MODE (0x01 << 5) ··· 65 61 #define MANTIS_DCAP_EN (0x01 << 1) 66 62 #define MANTIS_RISC_EN (0x01 << 0) 67 63 64 + /* DEBUG */ 65 + #define MANTIS_DEBUGREG 0x0c 66 + #define MANTIS_DATINV (0x0e << 7) 67 + #define MANTIS_TOP_DEBUGSEL (0x07 << 4) 68 + #define MANTIS_PCMCIA_DEBUGSEL (0x0f << 0) 69 + 68 70 #define MANTIS_RISC_START 0x10 69 71 #define MANTIS_RISC_PC 0x14 70 72 71 - // I2C 73 + /* I2C */ 72 74 #define MANTIS_I2CDATA_CTL 0x18 73 75 #define MANTIS_I2C_RATE_1 (0x00 << 6) 74 76 #define MANTIS_I2C_RATE_2 (0x01 << 6) ··· 82 72 #define MANTIS_I2C_RATE_4 (0x03 << 6) 83 73 #define MANTIS_I2C_STOP (0x01 << 5) 84 74 #define MANTIS_I2C_PGMODE (0x01 << 3) 75 + 76 + /* DATA */ 77 + #define MANTIS_CMD_DATA_R1 0x20 78 + #define MANTIS_CMD_DATA_3 (0xff << 24) 79 + #define MANTIS_CMD_DATA_2 (0xff << 16) 80 + #define MANTIS_CMD_DATA_1 (0xff << 8) 81 + #define MANTIS_CMD_DATA_0 (0xff << 0) 82 + 83 + #define MANTIS_CMD_DATA_R2 0x24 84 + #define MANTIS_CMD_DATA_7 (0xff << 24) 85 + #define MANTIS_CMD_DATA_6 (0xff << 16) 86 + #define MANTIS_CMD_DATA_5 (0xff << 8) 87 + #define MANTIS_CMD_DATA_4 (0xff << 0) 88 + 89 + #define MANTIS_CONTROL 0x28 90 + #define MANTIS_DET (0x01 << 7) 91 + #define MANTIS_DAT_CF_EN (0x01 << 6) 92 + #define MANTIS_ACS (0x03 << 4) 93 + #define MANTIS_VCCEN (0x01 << 3) 94 + #define MANTIS_BYPASS (0x01 << 2) 95 + #define MANTIS_MRST (0x01 << 1) 96 + #define MANTIS_CRST_INT (0x01 << 0) 85 97 86 98 #define MANTIS_GPIF_CFGSLA 0x84 87 99 #define MANTIS_GPIF_WAITSMPL (0x07 << 28) ··· 194 162 #define MANTIS_GPIF_LOGICRD (0xffff << 16) 195 163 #define MANTIS_GPIF_LOGICRW (0xffff << 0) 196 164 197 - #endif //__MANTIS_REG_H 165 + #endif /* __MANTIS_REG_H */
+27 -10
drivers/media/dvb/mantis/mantis_uart.c
··· 1 + #include <linux/kernel.h> 1 2 #include <linux/spinlock.h> 3 + 4 + #include <asm/irq.h> 5 + #include <linux/signal.h> 6 + #include <linux/sched.h> 7 + #include <linux/interrupt.h> 8 + 9 + #include "dmxdev.h" 10 + #include "dvbdev.h" 11 + #include "dvb_demux.h" 12 + #include "dvb_frontend.h" 13 + #include "dvb_net.h" 14 + 2 15 #include "mantis_common.h" 16 + #include "mantis_reg.h" 17 + #include "mantis_uart.h" 3 18 4 19 struct mantis_uart_params { 5 20 enum mantis_baud baud_rate; ··· 33 18 for (i = 0; i < (config->bytes + 1); i++) { 34 19 35 20 if (stat & MANTIS_UART_RXFIFO_FULL) { 36 - dprintk(verbose, MANTIS_ERROR, 1, "RX Fifo FULL"); 21 + dprintk(MANTIS_ERROR, 1, "RX Fifo FULL"); 37 22 } 38 23 data[i] = mmread(MANTIS_UART_RXD) & 0x3f; 39 24 40 25 stat = mmread(MANTIS_UART_STAT); 41 26 42 - dprintk(verbose, MANTIS_DEBUG, 1, "Reading ... <%02x>", data[i] & 0x3f); 27 + dprintk(MANTIS_DEBUG, 1, "Reading ... <%02x>", data[i] & 0x3f); 43 28 44 29 if (data[i] & (1 << 7)) { 45 - dprintk(verbose, MANTIS_ERROR, 1, "UART framing error"); 30 + dprintk(MANTIS_ERROR, 1, "UART framing error"); 46 31 return -EINVAL; 47 32 } 48 33 if (data[i] & (1 << 6)) { 49 - dprintk(verbose, MANTIS_ERROR, 1, "UART parity error"); 34 + dprintk(MANTIS_ERROR, 1, "UART parity error"); 50 35 return -EINVAL; 51 36 } 52 37 } ··· 61 46 u8 buf[16]; 62 47 int i; 63 48 64 - dprintk(verbose, MANTIS_DEBUG, 1, "UART read"); 49 + dprintk(MANTIS_DEBUG, 1, "UART read"); 65 50 mantis_uart_read(mantis, buf); 66 51 67 - dprintk(verbose, MANTIS_DEBUG, 1, "UART: "); 52 + dprintk(MANTIS_DEBUG, 1, "UART: "); 68 53 for (i = 0; i < (config->bytes + 1); i++) 69 - dprintk(verbose, MANTIS_DEBUG, 0, "<%02x> ", buf[i]); 54 + dprintk(MANTIS_DEBUG, 0, "<%02x> ", buf[i]); 70 55 71 - dprintk(verbose, MANTIS_DEBUG, 0, "\n"); 56 + dprintk(MANTIS_DEBUG, 0, "\n"); 72 57 } 73 58 74 59 static int mantis_uart_setup(struct mantis_pci *mantis, ··· 79 64 80 65 u32 reg; 81 66 82 - dprintk(verbose, MANTIS_DEBUG, 1, "Set Parity <%s> Baud Rate <%s>", 67 + dprintk(MANTIS_DEBUG, 1, "Set Parity <%s> Baud Rate <%s>", 83 68 parity[params->parity], 84 69 rates[params->baud_rate]); 85 70 ··· 117 102 struct mantis_hwconfig *config = mantis->hwconfig; 118 103 struct mantis_uart_params params; 119 104 120 - dprintk(verbose, MANTIS_DEBUG, 1, "Initializing UART .."); 105 + dprintk(MANTIS_DEBUG, 1, "Initializing UART .."); 121 106 /* default parity: */ 122 107 params.baud_rate = config->baud_rate; 123 108 params.parity = config->parity; ··· 146 131 147 132 return 0; 148 133 } 134 + EXPORT_SYMBOL_GPL(mantis_uart_init); 149 135 150 136 void mantis_uart_exit(struct mantis_pci *mantis) 151 137 { 152 138 /* disable interrupt */ 153 139 mmwrite(mmread(MANTIS_UART_CTL) & 0xffef, MANTIS_UART_CTL); 154 140 } 141 + EXPORT_SYMBOL_GPL(mantis_uart_exit);
+1 -1
drivers/media/dvb/mantis/mantis_uart.h
··· 56 56 extern int mantis_uart_init(struct mantis_pci *mantis); 57 57 extern void mantis_uart_exit(struct mantis_pci *mantis); 58 58 59 - #endif // __MANTIS_UART_H 59 + #endif /* __MANTIS_UART_H */
+65 -33
drivers/media/dvb/mantis/mantis_vp1033.c
··· 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 20 21 + #include <asm/irq.h> 22 + #include <linux/signal.h> 23 + #include <linux/sched.h> 24 + #include <linux/interrupt.h> 25 + 26 + #include "dmxdev.h" 27 + #include "dvbdev.h" 28 + #include "dvb_demux.h" 29 + #include "dvb_frontend.h" 30 + #include "dvb_net.h" 31 + 32 + #include "stv0299.h" 21 33 #include "mantis_common.h" 22 34 #include "mantis_vp1033.h" 23 35 ··· 78 66 0xff, 0xff, 79 67 }; 80 68 81 - struct stv0299_config lgtdqcs001f_config = { 82 - .demod_address = 0x68, 83 - .inittab = lgtdqcs001f_inittab, 84 - .mclk = 88000000UL, 85 - // .invert = 0, 86 - .invert = 1, 87 - // .enhanced_tuning = 0, 88 - .skip_reinit = 0, 89 - // .lock_output = STV0229_LOCKOUTPUT_0, 90 - .volt13_op0_op1 = STV0299_VOLT13_OP0, 91 - .min_delay_ms = 100, 92 - .set_symbol_rate = lgtdqcs001f_set_symbol_rate, 93 - // .pll_set = lgtdqcs001f_pll_set, 94 - }; 95 - 96 69 #define MANTIS_MODEL_NAME "VP-1033" 97 70 #define MANTIS_DEV_TYPE "DVB-S/DSS" 98 - 99 - struct mantis_hwconfig vp1033_mantis_config = { 100 - .model_name = MANTIS_MODEL_NAME, 101 - .dev_type = MANTIS_DEV_TYPE, 102 - .ts_size = MANTIS_TS_204, 103 - .baud_rate = MANTIS_BAUD_9600, 104 - .parity = MANTIS_PARITY_NONE, 105 - .bytes = 0, 106 - }; 107 71 108 72 int lgtdqcs001f_tuner_set(struct dvb_frontend *fe, 109 73 struct dvb_frontend_parameters *params) 110 74 { 75 + struct mantis_pci *mantis = fe->dvb->priv; 76 + struct i2c_adapter *adapter = &mantis->adapter; 77 + 111 78 u8 buf[4]; 112 79 u32 div; 113 80 114 - struct mantis_pci *mantis = fe->dvb->priv; 115 81 116 - struct i2c_msg msg = { 117 - .addr = 0x61, 118 - .flags = 0, 119 - .buf = buf, 120 - .len = sizeof (buf) 121 - }; 82 + struct i2c_msg msg = {.addr = 0x61, .flags = 0, .buf = buf, .len = sizeof (buf) }; 83 + 122 84 div = params->frequency / 250; 123 85 124 86 buf[0] = (div >> 8) & 0x7f; ··· 104 118 buf[3] |= 0x04; 105 119 else 106 120 buf[3] &= ~0x04; 107 - if (i2c_transfer(&mantis->adapter, &msg, 1) < 0) { 108 - dprintk(verbose, MANTIS_ERROR, 1, "Write: I2C Transfer failed"); 121 + if (i2c_transfer(adapter, &msg, 1) < 0) { 122 + dprintk(MANTIS_ERROR, 1, "Write: I2C Transfer failed"); 109 123 return -EIO; 110 124 } 111 125 msleep_interruptible(100); ··· 147 161 148 162 return 0; 149 163 } 164 + 165 + struct stv0299_config lgtdqcs001f_config = { 166 + .demod_address = 0x68, 167 + .inittab = lgtdqcs001f_inittab, 168 + .mclk = 88000000UL, 169 + .invert = 0, 170 + .skip_reinit = 0, 171 + .volt13_op0_op1 = STV0299_VOLT13_OP0, 172 + .min_delay_ms = 100, 173 + .set_symbol_rate = lgtdqcs001f_set_symbol_rate, 174 + }; 175 + 176 + static int vp1033_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe) 177 + { 178 + struct i2c_adapter *adapter = &mantis->adapter; 179 + 180 + dprintk(MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)"); 181 + fe = stv0299_attach(&lgtdqcs001f_config, adapter); 182 + 183 + if (fe) { 184 + fe->ops.tuner_ops.set_params = lgtdqcs001f_tuner_set; 185 + dprintk(MANTIS_ERROR, 1, "found STV0299 DVB-S frontend @ 0x%02x", 186 + lgtdqcs001f_config.demod_address); 187 + 188 + dprintk(MANTIS_ERROR, 1, "Mantis DVB-S STV0299 frontend attach success"); 189 + } else { 190 + return -1; 191 + } 192 + 193 + mantis->fe = fe; 194 + dprintk(MANTIS_ERROR, 1, "Done!"); 195 + 196 + return 0; 197 + } 198 + 199 + struct mantis_hwconfig vp1033_config = { 200 + .model_name = MANTIS_MODEL_NAME, 201 + .dev_type = MANTIS_DEV_TYPE, 202 + .ts_size = MANTIS_TS_204, 203 + 204 + .baud_rate = MANTIS_BAUD_9600, 205 + .parity = MANTIS_PARITY_NONE, 206 + .bytes = 0, 207 + 208 + .frontend_init = vp1033_frontend_init, 209 + };
+2 -11
drivers/media/dvb/mantis/mantis_vp1033.h
··· 21 21 #ifndef __MANTIS_VP1033_H 22 22 #define __MANTIS_VP1033_H 23 23 24 - #include "dvb_frontend.h" 25 24 #include "mantis_common.h" 26 - #include "stv0299.h" 27 25 28 26 #define MANTIS_VP_1033_DVB_S 0x0016 29 27 30 - extern struct stv0299_config lgtdqcs001f_config; 31 - extern struct mantis_hwconfig vp1033_mantis_config; 28 + extern struct mantis_hwconfig vp1033_config; 32 29 33 - extern int lgtdqcs001f_tuner_set(struct dvb_frontend *fe, 34 - struct dvb_frontend_parameters *params); 35 - 36 - extern int lgtdqcs001f_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 ratio); 37 - 38 - 39 - #endif // __MANTIS_VP1033_H 30 + #endif /* __MANTIS_VP1033_H */
+54 -16
drivers/media/dvb/mantis/mantis_vp1034.c
··· 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 20 21 - #include "mantis_common.h" 22 - #include "mantis_vp1034.h" 21 + #include <asm/irq.h> 22 + #include <linux/signal.h> 23 + #include <linux/sched.h> 24 + #include <linux/interrupt.h> 23 25 24 - struct mb86a16_config vp1034_config = { 26 + #include "dmxdev.h" 27 + #include "dvbdev.h" 28 + #include "dvb_demux.h" 29 + #include "dvb_frontend.h" 30 + #include "dvb_net.h" 31 + 32 + #include "mb86a16.h" 33 + #include "mantis_common.h" 34 + #include "mantis_ioc.h" 35 + #include "mantis_vp1034.h" 36 + #include "mantis_reg.h" 37 + 38 + struct mb86a16_config vp1034_mb86a16_config = { 25 39 .demod_address = 0x08, 26 40 .set_voltage = vp1034_set_voltage, 27 41 }; ··· 43 29 #define MANTIS_MODEL_NAME "VP-1034" 44 30 #define MANTIS_DEV_TYPE "DVB-S/DSS" 45 31 46 - struct mantis_hwconfig vp1034_mantis_config = { 47 - .model_name = MANTIS_MODEL_NAME, 48 - .dev_type = MANTIS_DEV_TYPE, 49 - .ts_size = MANTIS_TS_204, 50 - .baud_rate = MANTIS_BAUD_9600, 51 - .parity = MANTIS_PARITY_NONE, 52 - .bytes = 0, 53 - }; 54 - 55 32 int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) 56 33 { 57 34 struct mantis_pci *mantis = fe->dvb->priv; 58 35 59 36 switch (voltage) { 60 37 case SEC_VOLTAGE_13: 61 - dprintk(verbose, MANTIS_ERROR, 1, "Polarization=[13V]"); 38 + dprintk(MANTIS_ERROR, 1, "Polarization=[13V]"); 62 39 gpio_set_bits(mantis, 13, 1); 63 40 gpio_set_bits(mantis, 14, 0); 64 41 break; 65 42 case SEC_VOLTAGE_18: 66 - dprintk(verbose, MANTIS_ERROR, 1, "Polarization=[18V]"); 43 + dprintk(MANTIS_ERROR, 1, "Polarization=[18V]"); 67 44 gpio_set_bits(mantis, 13, 1); 68 45 gpio_set_bits(mantis, 14, 1); 69 46 break; 70 47 case SEC_VOLTAGE_OFF: 71 - dprintk(verbose, MANTIS_ERROR, 1, "Frontend (dummy) POWERDOWN"); 48 + dprintk(MANTIS_ERROR, 1, "Frontend (dummy) POWERDOWN"); 72 49 break; 73 50 default: 74 - dprintk(verbose, MANTIS_ERROR, 1, "Invalid = (%d)", (u32 ) voltage); 51 + dprintk(MANTIS_ERROR, 1, "Invalid = (%d)", (u32 ) voltage); 75 52 return -EINVAL; 76 53 } 77 54 mmwrite(0x00, MANTIS_GPIF_DOUT); 78 55 79 56 return 0; 80 57 } 58 + 59 + static int vp1034_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe) 60 + { 61 + struct i2c_adapter *adapter = &mantis->adapter; 62 + 63 + dprintk(MANTIS_ERROR, 1, "Probing for MB86A16 (DVB-S/DSS)"); 64 + fe = mb86a16_attach(&vp1034_mb86a16_config, adapter); 65 + if (fe) { 66 + dprintk(MANTIS_ERROR, 1, 67 + "found MB86A16 DVB-S/DSS frontend @0x%02x", 68 + vp1034_mb86a16_config.demod_address); 69 + 70 + } else { 71 + return -1; 72 + } 73 + 74 + mantis->fe = fe; 75 + dprintk(MANTIS_ERROR, 1, "Done!"); 76 + 77 + return 0; 78 + } 79 + 80 + struct mantis_hwconfig vp1034_config = { 81 + .model_name = MANTIS_MODEL_NAME, 82 + .dev_type = MANTIS_DEV_TYPE, 83 + .ts_size = MANTIS_TS_204, 84 + 85 + .baud_rate = MANTIS_BAUD_9600, 86 + .parity = MANTIS_PARITY_NONE, 87 + .bytes = 0, 88 + 89 + .frontend_init = vp1034_frontend_init, 90 + };
+2 -4
drivers/media/dvb/mantis/mantis_vp1034.h
··· 23 23 24 24 #include "dvb_frontend.h" 25 25 #include "mantis_common.h" 26 - #include "mb86a16.h" 27 26 28 27 29 28 #define MANTIS_VP_1034_DVB_S 0x0014 30 29 31 - extern struct mantis_hwconfig vp1034_mantis_config; 32 - extern struct mb86a16_config vp1034_config; 30 + extern struct mantis_hwconfig vp1034_config; 33 31 extern int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage); 34 32 35 - #endif // __MANTIS_VP1034_H 33 + #endif /* __MANTIS_VP1034_H */
+69 -10
drivers/media/dvb/mantis/mantis_vp1041.c
··· 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 20 21 + #include <asm/irq.h> 22 + #include <linux/signal.h> 23 + #include <linux/sched.h> 24 + #include <linux/interrupt.h> 25 + 26 + #include "dmxdev.h" 27 + #include "dvbdev.h" 28 + #include "dvb_demux.h" 29 + #include "dvb_frontend.h" 30 + #include "dvb_net.h" 31 + 21 32 #include "mantis_common.h" 33 + #include "mantis_ioc.h" 34 + #include "mantis_dvb.h" 22 35 #include "mantis_vp1041.h" 23 36 #include "stb0899_reg.h" 37 + #include "stb0899_drv.h" 24 38 #include "stb0899_cfg.h" 25 39 #include "stb6100_cfg.h" 40 + #include "stb6100.h" 41 + #include "lnbp21.h" 26 42 27 43 #define MANTIS_MODEL_NAME "VP-1041" 28 44 #define MANTIS_DEV_TYPE "DSS/DVB-S/DVB-S2" 29 - 30 - struct mantis_hwconfig vp1041_mantis_config = { 31 - .model_name = MANTIS_MODEL_NAME, 32 - .dev_type = MANTIS_DEV_TYPE, 33 - .ts_size = MANTIS_TS_188, 34 - .baud_rate = MANTIS_BAUD_9600, 35 - .parity = MANTIS_PARITY_NONE, 36 - .bytes = 0, 37 - }; 38 45 39 46 static const struct stb0899_s1_reg vp1041_stb0899_s1_init_1[] = { 40 47 ··· 265 258 { 0xffff , 0xff }, 266 259 }; 267 260 268 - struct stb0899_config vp1041_config = { 261 + struct stb0899_config vp1041_stb0899_config = { 269 262 .init_dev = vp1041_stb0899_s1_init_1, 270 263 .init_s2_demod = stb0899_s2_init_2, 271 264 .init_s1_demod = vp1041_stb0899_s1_init_3, ··· 305 298 struct stb6100_config vp1041_stb6100_config = { 306 299 .tuner_address = 0x60, 307 300 .refclock = 27000000, 301 + }; 302 + 303 + static int vp1041_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe) 304 + { 305 + struct i2c_adapter *adapter = &mantis->adapter; 306 + 307 + int err = 0; 308 + 309 + err = mantis_frontend_power(mantis, POWER_ON); 310 + if (err == 0) { 311 + mantis_frontend_soft_reset(mantis); 312 + msleep(250); 313 + mantis->fe = stb0899_attach(&vp1041_stb0899_config, adapter); 314 + if (mantis->fe) { 315 + dprintk(MANTIS_ERROR, 1, 316 + "found STB0899 DVB-S/DVB-S2 frontend @0x%02x", 317 + vp1041_stb0899_config.demod_address); 318 + 319 + if (stb6100_attach(mantis->fe, &vp1041_stb6100_config, adapter)) { 320 + if (!lnbp21_attach(mantis->fe, adapter, 0, 0)) { 321 + printk("%s: No LNBP21 found!\n", __func__); 322 + } 323 + } 324 + } else { 325 + return -EREMOTEIO; 326 + } 327 + } else { 328 + dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>", 329 + adapter->name, 330 + err); 331 + 332 + return -EIO; 333 + } 334 + 335 + 336 + dprintk(MANTIS_ERROR, 1, "Done!"); 337 + 338 + return 0; 339 + } 340 + 341 + struct mantis_hwconfig vp1041_config = { 342 + .model_name = MANTIS_MODEL_NAME, 343 + .dev_type = MANTIS_DEV_TYPE, 344 + .ts_size = MANTIS_TS_188, 345 + 346 + .baud_rate = MANTIS_BAUD_9600, 347 + .parity = MANTIS_PARITY_NONE, 348 + .bytes = 0, 349 + 350 + .frontend_init = vp1041_frontend_init, 351 + .power = GPIF_A12, 352 + .reset = GPIF_A13, 308 353 };
+5 -9
drivers/media/dvb/mantis/mantis_vp1041.h
··· 21 21 #ifndef __MANTIS_VP1041_H 22 22 #define __MANTIS_VP1041_H 23 23 24 - #include "dvb_frontend.h" 25 24 #include "mantis_common.h" 26 - #include "stb0899_drv.h" 27 - #include "stb6100.h" 28 - #include "lnbp21.h" 29 25 30 26 #define MANTIS_VP_1041_DVB_S2 0x0031 31 - #define TECHNISAT_SKYSTAR_HD2 0x0001 27 + #define SKYSTAR_HD2_10 0x0001 28 + #define SKYSTAR_HD2_20 0x0003 29 + #define CINERGY_S2_PCI_HD 0x1179 32 30 33 - extern struct mantis_hwconfig vp1041_mantis_config; 34 - extern struct stb0899_config vp1041_config; 35 - extern struct stb6100_config vp1041_stb6100_config; 31 + extern struct mantis_hwconfig vp1041_config; 36 32 37 - #endif // __MANTIS_VP1041_H 33 + #endif /* __MANTIS_VP1041_H */
+80 -19
drivers/media/dvb/mantis/mantis_vp2033.c
··· 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 20 21 + #include <asm/irq.h> 22 + #include <linux/signal.h> 23 + #include <linux/sched.h> 24 + #include <linux/interrupt.h> 25 + 26 + #include "dmxdev.h" 27 + #include "dvbdev.h" 28 + #include "dvb_demux.h" 29 + #include "dvb_frontend.h" 30 + #include "dvb_net.h" 31 + 32 + #include "tda1002x.h" 21 33 #include "mantis_common.h" 22 34 #include "mantis_vp2033.h" 23 35 24 36 #define MANTIS_MODEL_NAME "VP-2033" 25 37 #define MANTIS_DEV_TYPE "DVB-C" 26 38 27 - struct mantis_hwconfig vp2033_mantis_config = { 28 - .model_name = MANTIS_MODEL_NAME, 29 - .dev_type = MANTIS_DEV_TYPE, 30 - .ts_size = MANTIS_TS_204, 31 - .baud_rate = MANTIS_BAUD_9600, 32 - .parity = MANTIS_PARITY_NONE, 33 - .bytes = 0, 34 - }; 35 - 36 - struct tda1002x_config philips_cu1216_config = { 39 + struct tda1002x_config vp2033_tda1002x_cu1216_config = { 37 40 .demod_address = 0x18 >> 1, 38 41 .invert = 1, 39 42 }; 40 43 41 - u8 read_pwm(struct mantis_pci *mantis) 44 + struct tda10023_config vp2033_tda10023_cu1216_config = { 45 + .demod_address = 0x18 >> 1, 46 + .invert = 1, 47 + }; 48 + 49 + static u8 read_pwm(struct mantis_pci *mantis) 42 50 { 51 + struct i2c_adapter *adapter = &mantis->adapter; 52 + 43 53 u8 b = 0xff; 44 54 u8 pwm; 45 55 struct i2c_msg msg[] = { 46 - {.addr = 0x50,.flags = 0,.buf = &b,.len = 1}, 47 - {.addr = 0x50,.flags = I2C_M_RD,.buf = &pwm,.len = 1} 56 + {.addr = 0x50, .flags = 0, .buf = &b, .len = 1}, 57 + {.addr = 0x50, .flags = I2C_M_RD, .buf = &pwm, .len = 1} 48 58 }; 49 59 50 - if ((i2c_transfer(&mantis->adapter, msg, 2) != 2) 60 + if ((i2c_transfer(adapter, msg, 2) != 2) 51 61 || (pwm == 0xff)) 52 62 pwm = 0x48; 53 63 54 64 return pwm; 55 65 } 56 66 57 - int philips_cu1216_tuner_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) 67 + static int tda1002x_cu1216_tuner_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) 58 68 { 59 69 struct mantis_pci *mantis = fe->dvb->priv; 70 + struct i2c_adapter *adapter = &mantis->adapter; 60 71 61 72 u8 buf[6]; 62 - struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; 73 + struct i2c_msg msg = {.addr = 0x60, .flags = 0, .buf = buf, .len = sizeof (buf) }; 63 74 int i; 64 75 65 76 #define CU1216_IF 36125000 ··· 89 78 if (fe->ops.i2c_gate_ctrl) 90 79 fe->ops.i2c_gate_ctrl(fe, 1); 91 80 92 - if (i2c_transfer(&mantis->adapter, &msg, 1) != 1) 81 + if (i2c_transfer(adapter, &msg, 1) != 1) 93 82 return -EIO; 94 83 95 84 /* wait for the pll lock */ ··· 99 88 if (fe->ops.i2c_gate_ctrl) 100 89 fe->ops.i2c_gate_ctrl(fe, 1); 101 90 102 - if (i2c_transfer(&mantis->adapter, &msg, 1) == 1 && (buf[0] & 0x40)) 91 + if (i2c_transfer(adapter, &msg, 1) == 1 && (buf[0] & 0x40)) 103 92 break; 104 93 105 94 msleep(10); ··· 113 102 if (fe->ops.i2c_gate_ctrl) 114 103 fe->ops.i2c_gate_ctrl(fe, 1); 115 104 116 - if (i2c_transfer(&mantis->adapter, &msg, 1) != 1) 105 + if (i2c_transfer(adapter, &msg, 1) != 1) 117 106 return -EIO; 118 107 119 108 return 0; 120 109 } 110 + 111 + static int vp2033_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe) 112 + { 113 + struct i2c_adapter *adapter = &mantis->adapter; 114 + 115 + dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)"); 116 + fe = tda10021_attach(&vp2033_tda1002x_cu1216_config, 117 + adapter, 118 + read_pwm(mantis)); 119 + 120 + if (fe) { 121 + dprintk(MANTIS_ERROR, 1, 122 + "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x", 123 + vp2033_tda1002x_cu1216_config.demod_address); 124 + } else { 125 + fe = tda10023_attach(&vp2033_tda10023_cu1216_config, 126 + adapter, 127 + read_pwm(mantis)); 128 + 129 + if (fe) { 130 + dprintk(MANTIS_ERROR, 1, 131 + "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x", 132 + vp2033_tda1002x_cu1216_config.demod_address); 133 + } 134 + } 135 + 136 + if (fe) { 137 + fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set; 138 + dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success"); 139 + } else { 140 + return -1; 141 + } 142 + 143 + mantis->fe = fe; 144 + dprintk(MANTIS_DEBUG, 1, "Done!"); 145 + 146 + return 0; 147 + } 148 + 149 + struct mantis_hwconfig vp2033_config = { 150 + .model_name = MANTIS_MODEL_NAME, 151 + .dev_type = MANTIS_DEV_TYPE, 152 + .ts_size = MANTIS_TS_204, 153 + 154 + .baud_rate = MANTIS_BAUD_9600, 155 + .parity = MANTIS_PARITY_NONE, 156 + .bytes = 0, 157 + 158 + .frontend_init = vp2033_frontend_init, 159 + };
+2 -9
drivers/media/dvb/mantis/mantis_vp2033.h
··· 21 21 #ifndef __MANTIS_VP2033_H 22 22 #define __MANTIS_VP2033_H 23 23 24 - #include "dvb_frontend.h" 25 24 #include "mantis_common.h" 26 - #include "tda1002x.h" 27 25 28 26 #define MANTIS_VP_2033_DVB_C 0x0008 29 27 30 - extern struct tda1002x_config philips_cu1216_config; 31 - extern struct mantis_hwconfig vp2033_mantis_config; 28 + extern struct mantis_hwconfig vp2033_config; 32 29 33 - extern int philips_cu1216_tuner_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params); 34 - 35 - extern u8 read_pwm(struct mantis_pci *mantis); 36 - 37 - #endif // __MANTIS_VP2033_H 30 + #endif /* __MANTIS_VP2033_H */
+136 -5
drivers/media/dvb/mantis/mantis_vp2040.c
··· 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 20 21 + #include <asm/irq.h> 22 + #include <linux/signal.h> 23 + #include <linux/sched.h> 24 + #include <linux/interrupt.h> 25 + 26 + #include "dmxdev.h" 27 + #include "dvbdev.h" 28 + #include "dvb_demux.h" 29 + #include "dvb_frontend.h" 30 + #include "dvb_net.h" 31 + 32 + #include "tda1002x.h" 21 33 #include "mantis_common.h" 22 34 #include "mantis_vp2040.h" 23 35 24 36 #define MANTIS_MODEL_NAME "VP-2040" 25 37 #define MANTIS_DEV_TYPE "DVB-C" 26 38 27 - struct mantis_hwconfig vp2040_mantis_config = { 39 + struct tda1002x_config vp2040_tda1002x_cu1216_config = { 40 + .demod_address = 0x18 >> 1, 41 + .invert = 1, 42 + }; 43 + 44 + struct tda10023_config vp2040_tda10023_cu1216_config = { 45 + .demod_address = 0x18 >> 1, 46 + .invert = 1, 47 + }; 48 + 49 + static int tda1002x_cu1216_tuner_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) 50 + { 51 + struct mantis_pci *mantis = fe->dvb->priv; 52 + struct i2c_adapter *adapter = &mantis->adapter; 53 + 54 + u8 buf[6]; 55 + struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof (buf) }; 56 + int i; 57 + 58 + #define CU1216_IF 36125000 59 + #define TUNER_MUL 62500 60 + 61 + u32 div = (params->frequency + CU1216_IF + TUNER_MUL / 2) / TUNER_MUL; 62 + 63 + buf[0] = (div >> 8) & 0x7f; 64 + buf[1] = div & 0xff; 65 + buf[2] = 0xce; 66 + buf[3] = (params->frequency < 150000000 ? 0x01 : 67 + params->frequency < 445000000 ? 0x02 : 0x04); 68 + buf[4] = 0xde; 69 + buf[5] = 0x20; 70 + 71 + if (fe->ops.i2c_gate_ctrl) 72 + fe->ops.i2c_gate_ctrl(fe, 1); 73 + 74 + if (i2c_transfer(adapter, &msg, 1) != 1) 75 + return -EIO; 76 + 77 + /* wait for the pll lock */ 78 + msg.flags = I2C_M_RD; 79 + msg.len = 1; 80 + for (i = 0; i < 20; i++) { 81 + if (fe->ops.i2c_gate_ctrl) 82 + fe->ops.i2c_gate_ctrl(fe, 1); 83 + 84 + if (i2c_transfer(adapter, &msg, 1) == 1 && (buf[0] & 0x40)) 85 + break; 86 + 87 + msleep(10); 88 + } 89 + 90 + /* switch the charge pump to the lower current */ 91 + msg.flags = 0; 92 + msg.len = 2; 93 + msg.buf = &buf[2]; 94 + buf[2] &= ~0x40; 95 + if (fe->ops.i2c_gate_ctrl) 96 + fe->ops.i2c_gate_ctrl(fe, 1); 97 + 98 + if (i2c_transfer(adapter, &msg, 1) != 1) 99 + return -EIO; 100 + 101 + return 0; 102 + } 103 + 104 + static u8 read_pwm(struct mantis_pci *mantis) 105 + { 106 + struct i2c_adapter *adapter = &mantis->adapter; 107 + 108 + u8 b = 0xff; 109 + u8 pwm; 110 + struct i2c_msg msg[] = { 111 + {.addr = 0x50, .flags = 0, .buf = &b, .len = 1}, 112 + {.addr = 0x50, .flags = I2C_M_RD, .buf = &pwm, .len = 1} 113 + }; 114 + 115 + if ((i2c_transfer(adapter, msg, 2) != 2) 116 + || (pwm == 0xff)) 117 + pwm = 0x48; 118 + 119 + return pwm; 120 + } 121 + 122 + static int vp2040_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe) 123 + { 124 + struct i2c_adapter *adapter = &mantis->adapter; 125 + 126 + dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)"); 127 + fe = tda10021_attach(&vp2040_tda1002x_cu1216_config, 128 + adapter, 129 + read_pwm(mantis)); 130 + 131 + if (fe) { 132 + dprintk(MANTIS_ERROR, 1, 133 + "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x", 134 + vp2040_tda1002x_cu1216_config.demod_address); 135 + } else { 136 + fe = tda10023_attach(&vp2040_tda10023_cu1216_config, 137 + adapter, 138 + read_pwm(mantis)); 139 + 140 + if (fe) { 141 + dprintk(MANTIS_ERROR, 1, 142 + "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x", 143 + vp2040_tda1002x_cu1216_config.demod_address); 144 + } 145 + } 146 + 147 + if (fe) { 148 + fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set; 149 + dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success"); 150 + } else { 151 + return -1; 152 + } 153 + 154 + mantis->fe = fe; 155 + dprintk(MANTIS_DEBUG, 1, "Done!"); 156 + 157 + return 0; 158 + } 159 + 160 + struct mantis_hwconfig vp2040_config = { 28 161 .model_name = MANTIS_MODEL_NAME, 29 162 .dev_type = MANTIS_DEV_TYPE, 30 163 .ts_size = MANTIS_TS_204, 164 + 31 165 .baud_rate = MANTIS_BAUD_9600, 32 166 .parity = MANTIS_PARITY_NONE, 33 167 .bytes = 0, 34 - }; 35 168 36 - struct tda10023_config tda10023_cu1216_config = { 37 - .demod_address = 0x18 >> 1, 38 - .invert = 1, 169 + .frontend_init = vp2040_frontend_init, 39 170 };
+4 -7
drivers/media/dvb/mantis/mantis_vp2040.h
··· 21 21 #ifndef __MANTIS_VP2040_H 22 22 #define __MANTIS_VP2040_H 23 23 24 - #include "dvb_frontend.h" 25 24 #include "mantis_common.h" 26 - #include "tda1002x.h" 27 25 28 26 #define MANTIS_VP_2040_DVB_C 0x0043 29 - #define TERRATEC_CINERGY_C_PCI 0x1178 30 - #define TECHNISAT_CABLESTAR_HD2 0x0002 27 + #define CINERGY_C 0x1178 28 + #define CABLESTAR_HD2 0x0002 31 29 32 - extern struct tda10023_config tda10023_cu1216_config; 33 - extern struct mantis_hwconfig vp2040_mantis_config; 30 + extern struct mantis_hwconfig vp2040_config; 34 31 35 - #endif //__MANTIS_VP2040_H 32 + #endif /* __MANTIS_VP2040_H */
+40 -9
drivers/media/dvb/mantis/mantis_vp3030.c
··· 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 20 21 + #include <asm/irq.h> 22 + #include <linux/signal.h> 23 + #include <linux/sched.h> 24 + #include <linux/interrupt.h> 25 + 26 + #include "dmxdev.h" 27 + #include "dvbdev.h" 28 + #include "dvb_demux.h" 29 + #include "dvb_frontend.h" 30 + #include "dvb_net.h" 31 + 32 + #include "zl10353.h" 21 33 #include "mantis_common.h" 22 34 #include "mantis_vp3030.h" 23 35 ··· 39 27 40 28 #define MANTIS_MODEL_NAME "VP-3030" 41 29 #define MANTIS_DEV_TYPE "DVB-T" 42 - 43 - struct mantis_hwconfig vp3030_mantis_config = { 44 - .model_name = MANTIS_MODEL_NAME, 45 - .dev_type = MANTIS_DEV_TYPE, 46 - .ts_size = MANTIS_TS_188, 47 - .baud_rate = MANTIS_BAUD_9600, 48 - .parity = MANTIS_PARITY_NONE, 49 - .bytes = 0, 50 - }; 51 30 52 31 int panasonic_en57h12d5_set_params(struct dvb_frontend *fe, 53 32 struct dvb_frontend_parameters *params) ··· 66 63 67 64 return 0; 68 65 } 66 + 67 + static int vp3030_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe) 68 + { 69 + struct i2c_adapter *adapter = &mantis->adapter; 70 + 71 + dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)"); 72 + fe = zl10353_attach(&mantis_vp3030_config, adapter); 73 + 74 + if (!fe) 75 + return -1; 76 + 77 + mantis->fe = fe; 78 + dprintk(MANTIS_ERROR, 1, "Done!"); 79 + 80 + return 0; 81 + } 82 + 83 + struct mantis_hwconfig vp3030_config = { 84 + .model_name = MANTIS_MODEL_NAME, 85 + .dev_type = MANTIS_DEV_TYPE, 86 + .ts_size = MANTIS_TS_188, 87 + 88 + .baud_rate = MANTIS_BAUD_9600, 89 + .parity = MANTIS_PARITY_NONE, 90 + .bytes = 0, 91 + 92 + .frontend_init = vp3030_frontend_init, 93 + };
+2 -6
drivers/media/dvb/mantis/mantis_vp3030.h
··· 21 21 #ifndef __MANTIS_VP3030_H 22 22 #define __MANTIS_VP3030_H 23 23 24 - #include "dvb_frontend.h" 25 24 #include "mantis_common.h" 26 - #include "dvb-pll.h" 27 - #include "zl10353.h" 28 25 29 26 #define MANTIS_VP_3030_DVB_T 0x0024 30 27 31 - extern struct zl10353_config mantis_vp3030_config; 32 - extern struct mantis_hwconfig vp3030_mantis_config; 28 + extern struct mantis_hwconfig vp3030_config; 33 29 34 - #endif // __MANTIS_VP3030_H 30 + #endif /* __MANTIS_VP3030_H */