diff options
author | Oliver Endriss <o.endriss@gmx.de> | 2010-05-16 04:29:14 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-06-01 00:20:12 -0400 |
commit | 4387418129895fd9aa2e2f6368ea69e9c4ddd0f2 (patch) | |
tree | 00780b29a16c8bde363d4d65d074f938fb853517 /drivers/media/dvb | |
parent | eb05d155bc9f51ff701c09bc9b5e4b4f5a4b4d9f (diff) |
V4L/DVB: ngene: Implement support for MSI
Add MSI support, may be enabled with firmware version 18.
Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/ngene/ngene-core.c | 33 | ||||
-rw-r--r-- | drivers/media/dvb/ngene/ngene.h | 2 |
2 files changed, 34 insertions, 1 deletions
diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index 46749d6ef1ee..35bed6095b1e 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c | |||
@@ -1299,11 +1299,14 @@ static void ngene_stop(struct ngene *dev) | |||
1299 | ngwritel(0, NGENE_EVENT); | 1299 | ngwritel(0, NGENE_EVENT); |
1300 | ngwritel(0, NGENE_EVENT_HI); | 1300 | ngwritel(0, NGENE_EVENT_HI); |
1301 | free_irq(dev->pci_dev->irq, dev); | 1301 | free_irq(dev->pci_dev->irq, dev); |
1302 | if (dev->msi_enabled) | ||
1303 | pci_disable_msi(dev->pci_dev); | ||
1302 | } | 1304 | } |
1303 | 1305 | ||
1304 | static int ngene_start(struct ngene *dev) | 1306 | static int ngene_start(struct ngene *dev) |
1305 | { | 1307 | { |
1306 | int stat; | 1308 | int stat; |
1309 | unsigned long flags; | ||
1307 | int i; | 1310 | int i; |
1308 | 1311 | ||
1309 | pci_set_master(dev->pci_dev); | 1312 | pci_set_master(dev->pci_dev); |
@@ -1333,6 +1336,28 @@ static int ngene_start(struct ngene *dev) | |||
1333 | if (stat < 0) | 1336 | if (stat < 0) |
1334 | goto fail; | 1337 | goto fail; |
1335 | 1338 | ||
1339 | #ifdef CONFIG_PCI_MSI | ||
1340 | /* enable MSI if kernel and card support it */ | ||
1341 | if (dev->card_info->msi_supported) { | ||
1342 | ngwritel(0, NGENE_INT_ENABLE); | ||
1343 | free_irq(dev->pci_dev->irq, dev); | ||
1344 | stat = pci_enable_msi(dev->pci_dev); | ||
1345 | if (stat) { | ||
1346 | printk(KERN_INFO DEVICE_NAME | ||
1347 | ": MSI not available\n"); | ||
1348 | flags = IRQF_SHARED; | ||
1349 | } else { | ||
1350 | flags = 0; | ||
1351 | dev->msi_enabled = true; | ||
1352 | } | ||
1353 | stat = request_irq(dev->pci_dev->irq, irq_handler, | ||
1354 | flags, "nGene", dev); | ||
1355 | if (stat < 0) | ||
1356 | goto fail2; | ||
1357 | ngwritel(1, NGENE_INT_ENABLE); | ||
1358 | } | ||
1359 | #endif | ||
1360 | |||
1336 | stat = ngene_i2c_init(dev, 0); | 1361 | stat = ngene_i2c_init(dev, 0); |
1337 | if (stat < 0) | 1362 | if (stat < 0) |
1338 | goto fail; | 1363 | goto fail; |
@@ -1358,10 +1383,16 @@ static int ngene_start(struct ngene *dev) | |||
1358 | bconf = BUFFER_CONFIG_3333; | 1383 | bconf = BUFFER_CONFIG_3333; |
1359 | stat = ngene_command_config_buf(dev, bconf); | 1384 | stat = ngene_command_config_buf(dev, bconf); |
1360 | } | 1385 | } |
1361 | return stat; | 1386 | if (!stat) |
1387 | return stat; | ||
1388 | |||
1389 | /* otherwise error: fall through */ | ||
1362 | fail: | 1390 | fail: |
1363 | ngwritel(0, NGENE_INT_ENABLE); | 1391 | ngwritel(0, NGENE_INT_ENABLE); |
1364 | free_irq(dev->pci_dev->irq, dev); | 1392 | free_irq(dev->pci_dev->irq, dev); |
1393 | fail2: | ||
1394 | if (dev->msi_enabled) | ||
1395 | pci_disable_msi(dev->pci_dev); | ||
1365 | return stat; | 1396 | return stat; |
1366 | } | 1397 | } |
1367 | 1398 | ||
diff --git a/drivers/media/dvb/ngene/ngene.h b/drivers/media/dvb/ngene/ngene.h index 676fcbb79026..b951d59e3617 100644 --- a/drivers/media/dvb/ngene/ngene.h +++ b/drivers/media/dvb/ngene/ngene.h | |||
@@ -725,6 +725,7 @@ struct ngene { | |||
725 | u32 device_version; | 725 | u32 device_version; |
726 | u32 fw_interface_version; | 726 | u32 fw_interface_version; |
727 | u32 icounts; | 727 | u32 icounts; |
728 | bool msi_enabled; | ||
728 | 729 | ||
729 | u8 *CmdDoneByte; | 730 | u8 *CmdDoneByte; |
730 | int BootFirmware; | 731 | int BootFirmware; |
@@ -797,6 +798,7 @@ struct ngene_info { | |||
797 | #define NGENE_VBOX_V2 7 | 798 | #define NGENE_VBOX_V2 7 |
798 | 799 | ||
799 | int fw_version; | 800 | int fw_version; |
801 | bool msi_supported; | ||
800 | char *name; | 802 | char *name; |
801 | 803 | ||
802 | int io_type[MAX_STREAM]; | 804 | int io_type[MAX_STREAM]; |