aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/mantis/mantis_cards.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/pci/mantis/mantis_cards.c')
-rw-r--r--drivers/media/pci/mantis/mantis_cards.c94
1 files changed, 60 insertions, 34 deletions
diff --git a/drivers/media/pci/mantis/mantis_cards.c b/drivers/media/pci/mantis/mantis_cards.c
index 801fc55b6167..cdefffc16d9e 100644
--- a/drivers/media/pci/mantis/mantis_cards.c
+++ b/drivers/media/pci/mantis/mantis_cards.c
@@ -25,6 +25,7 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <asm/irq.h> 26#include <asm/irq.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <media/rc-map.h>
28 29
29#include "dmxdev.h" 30#include "dmxdev.h"
30#include "dvbdev.h" 31#include "dvbdev.h"
@@ -49,6 +50,7 @@
49#include "mantis_pci.h" 50#include "mantis_pci.h"
50#include "mantis_i2c.h" 51#include "mantis_i2c.h"
51#include "mantis_reg.h" 52#include "mantis_reg.h"
53#include "mantis_input.h"
52 54
53static unsigned int verbose; 55static unsigned int verbose;
54module_param(verbose, int, 0644); 56module_param(verbose, int, 0644);
@@ -114,6 +116,10 @@ static irqreturn_t mantis_irq_handler(int irq, void *dev_id)
114 } 116 }
115 if (stat & MANTIS_INT_IRQ1) { 117 if (stat & MANTIS_INT_IRQ1) {
116 dprintk(MANTIS_DEBUG, 0, "<%s>", label[2]); 118 dprintk(MANTIS_DEBUG, 0, "<%s>", label[2]);
119 spin_lock(&mantis->intmask_lock);
120 mmwrite(mmread(MANTIS_INT_MASK) & ~MANTIS_INT_IRQ1,
121 MANTIS_INT_MASK);
122 spin_unlock(&mantis->intmask_lock);
117 schedule_work(&mantis->uart_work); 123 schedule_work(&mantis->uart_work);
118 } 124 }
119 if (stat & MANTIS_INT_OCERR) { 125 if (stat & MANTIS_INT_OCERR) {
@@ -162,6 +168,7 @@ static irqreturn_t mantis_irq_handler(int irq, void *dev_id)
162static int mantis_pci_probe(struct pci_dev *pdev, 168static int mantis_pci_probe(struct pci_dev *pdev,
163 const struct pci_device_id *pci_id) 169 const struct pci_device_id *pci_id)
164{ 170{
171 struct mantis_pci_drvdata *drvdata;
165 struct mantis_pci *mantis; 172 struct mantis_pci *mantis;
166 struct mantis_hwconfig *config; 173 struct mantis_hwconfig *config;
167 int err = 0; 174 int err = 0;
@@ -169,84 +176,91 @@ static int mantis_pci_probe(struct pci_dev *pdev,
169 mantis = kzalloc(sizeof(struct mantis_pci), GFP_KERNEL); 176 mantis = kzalloc(sizeof(struct mantis_pci), GFP_KERNEL);
170 if (mantis == NULL) { 177 if (mantis == NULL) {
171 printk(KERN_ERR "%s ERROR: Out of memory\n", __func__); 178 printk(KERN_ERR "%s ERROR: Out of memory\n", __func__);
172 err = -ENOMEM; 179 return -ENOMEM;
173 goto fail0;
174 } 180 }
175 181
182 drvdata = (void *)pci_id->driver_data;
176 mantis->num = devs; 183 mantis->num = devs;
177 mantis->verbose = verbose; 184 mantis->verbose = verbose;
178 mantis->pdev = pdev; 185 mantis->pdev = pdev;
179 config = (struct mantis_hwconfig *) pci_id->driver_data; 186 config = drvdata->hwconfig;
180 config->irq_handler = &mantis_irq_handler; 187 config->irq_handler = &mantis_irq_handler;
181 mantis->hwconfig = config; 188 mantis->hwconfig = config;
189 mantis->rc_map_name = drvdata->rc_map_name;
190
191 spin_lock_init(&mantis->intmask_lock);
182 192
183 err = mantis_pci_init(mantis); 193 err = mantis_pci_init(mantis);
184 if (err) { 194 if (err) {
185 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis PCI initialization failed <%d>", err); 195 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis PCI initialization failed <%d>", err);
186 goto fail1; 196 goto err_free_mantis;
187 } 197 }
188 198
189 err = mantis_stream_control(mantis, STREAM_TO_HIF); 199 err = mantis_stream_control(mantis, STREAM_TO_HIF);
190 if (err < 0) { 200 if (err < 0) {
191 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis stream control failed <%d>", err); 201 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis stream control failed <%d>", err);
192 goto fail1; 202 goto err_pci_exit;
193 } 203 }
194 204
195 err = mantis_i2c_init(mantis); 205 err = mantis_i2c_init(mantis);
196 if (err < 0) { 206 if (err < 0) {
197 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis I2C initialization failed <%d>", err); 207 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis I2C initialization failed <%d>", err);
198 goto fail2; 208 goto err_pci_exit;
199 } 209 }
200 210
201 err = mantis_get_mac(mantis); 211 err = mantis_get_mac(mantis);
202 if (err < 0) { 212 if (err < 0) {
203 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis MAC address read failed <%d>", err); 213 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis MAC address read failed <%d>", err);
204 goto fail2; 214 goto err_i2c_exit;
205 } 215 }
206 216
207 err = mantis_dma_init(mantis); 217 err = mantis_dma_init(mantis);
208 if (err < 0) { 218 if (err < 0) {
209 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DMA initialization failed <%d>", err); 219 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DMA initialization failed <%d>", err);
210 goto fail3; 220 goto err_i2c_exit;
211 } 221 }
212 222
213 err = mantis_dvb_init(mantis); 223 err = mantis_dvb_init(mantis);
214 if (err < 0) { 224 if (err < 0) {
215 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DVB initialization failed <%d>", err); 225 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DVB initialization failed <%d>", err);
216 goto fail4; 226 goto err_dma_exit;
227 }
228
229 err = mantis_input_init(mantis);
230 if (err < 0) {
231 dprintk(MANTIS_ERROR, 1,
232 "ERROR: Mantis DVB initialization failed <%d>", err);
233 goto err_dvb_exit;
217 } 234 }
235
218 err = mantis_uart_init(mantis); 236 err = mantis_uart_init(mantis);
219 if (err < 0) { 237 if (err < 0) {
220 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis UART initialization failed <%d>", err); 238 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis UART initialization failed <%d>", err);
221 goto fail6; 239 goto err_input_exit;
222 } 240 }
223 241
224 devs++; 242 devs++;
225 243
226 return err; 244 return 0;
227 245
246err_input_exit:
247 mantis_input_exit(mantis);
228 248
229 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis UART exit! <%d>", err); 249err_dvb_exit:
230 mantis_uart_exit(mantis); 250 mantis_dvb_exit(mantis);
231 251
232fail6: 252err_dma_exit:
233fail4:
234 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DMA exit! <%d>", err);
235 mantis_dma_exit(mantis); 253 mantis_dma_exit(mantis);
236 254
237fail3: 255err_i2c_exit:
238 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis I2C exit! <%d>", err);
239 mantis_i2c_exit(mantis); 256 mantis_i2c_exit(mantis);
240 257
241fail2: 258err_pci_exit:
242 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis PCI exit! <%d>", err);
243 mantis_pci_exit(mantis); 259 mantis_pci_exit(mantis);
244 260
245fail1: 261err_free_mantis:
246 dprintk(MANTIS_ERROR, 1, "ERROR: Mantis free! <%d>", err);
247 kfree(mantis); 262 kfree(mantis);
248 263
249fail0:
250 return err; 264 return err;
251} 265}
252 266
@@ -257,6 +271,7 @@ static void mantis_pci_remove(struct pci_dev *pdev)
257 if (mantis) { 271 if (mantis) {
258 272
259 mantis_uart_exit(mantis); 273 mantis_uart_exit(mantis);
274 mantis_input_exit(mantis);
260 mantis_dvb_exit(mantis); 275 mantis_dvb_exit(mantis);
261 mantis_dma_exit(mantis); 276 mantis_dma_exit(mantis);
262 mantis_i2c_exit(mantis); 277 mantis_i2c_exit(mantis);
@@ -267,17 +282,28 @@ static void mantis_pci_remove(struct pci_dev *pdev)
267} 282}
268 283
269static struct pci_device_id mantis_pci_table[] = { 284static struct pci_device_id mantis_pci_table[] = {
270 MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_1033_DVB_S, &vp1033_config), 285 MAKE_ENTRY(TECHNISAT, CABLESTAR_HD2, &vp2040_config,
271 MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_1034_DVB_S, &vp1034_config), 286 RC_MAP_TECHNISAT_TS35),
272 MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_1041_DVB_S2, &vp1041_config), 287 MAKE_ENTRY(TECHNISAT, SKYSTAR_HD2_10, &vp1041_config,
273 MAKE_ENTRY(TECHNISAT, SKYSTAR_HD2_10, &vp1041_config), 288 NULL),
274 MAKE_ENTRY(TECHNISAT, SKYSTAR_HD2_20, &vp1041_config), 289 MAKE_ENTRY(TECHNISAT, SKYSTAR_HD2_20, &vp1041_config,
275 MAKE_ENTRY(TERRATEC, CINERGY_S2_PCI_HD, &vp1041_config), 290 NULL),
276 MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_2033_DVB_C, &vp2033_config), 291 MAKE_ENTRY(TERRATEC, CINERGY_C, &vp2040_config,
277 MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_2040_DVB_C, &vp2040_config), 292 RC_MAP_TERRATEC_CINERGY_C_PCI),
278 MAKE_ENTRY(TECHNISAT, CABLESTAR_HD2, &vp2040_config), 293 MAKE_ENTRY(TERRATEC, CINERGY_S2_PCI_HD, &vp1041_config,
279 MAKE_ENTRY(TERRATEC, CINERGY_C, &vp2040_config), 294 RC_MAP_TERRATEC_CINERGY_S2_HD),
280 MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_3030_DVB_T, &vp3030_config), 295 MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_1033_DVB_S, &vp1033_config,
296 NULL),
297 MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_1034_DVB_S, &vp1034_config,
298 NULL),
299 MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_1041_DVB_S2, &vp1041_config,
300 RC_MAP_TWINHAN_DTV_CAB_CI),
301 MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_2033_DVB_C, &vp2033_config,
302 RC_MAP_TWINHAN_DTV_CAB_CI),
303 MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_2040_DVB_C, &vp2040_config,
304 NULL),
305 MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_3030_DVB_T, &vp3030_config,
306 NULL),
281 { } 307 { }
282}; 308};
283 309