diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/oss/trident.c | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/sound/oss/trident.c b/sound/oss/trident.c index d4844de0c3b7..ce79cd82478a 100644 --- a/sound/oss/trident.c +++ b/sound/oss/trident.c | |||
@@ -3269,8 +3269,8 @@ ali_setup_spdif_out(struct trident_card *card, int flag) | |||
3269 | char temp; | 3269 | char temp; |
3270 | struct pci_dev *pci_dev = NULL; | 3270 | struct pci_dev *pci_dev = NULL; |
3271 | 3271 | ||
3272 | pci_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, | 3272 | pci_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, |
3273 | pci_dev); | 3273 | pci_dev); |
3274 | if (pci_dev == NULL) | 3274 | if (pci_dev == NULL) |
3275 | return; | 3275 | return; |
3276 | pci_read_config_byte(pci_dev, 0x61, &temp); | 3276 | pci_read_config_byte(pci_dev, 0x61, &temp); |
@@ -3284,6 +3284,8 @@ ali_setup_spdif_out(struct trident_card *card, int flag) | |||
3284 | temp |= 0x10; | 3284 | temp |= 0x10; |
3285 | pci_write_config_byte(pci_dev, 0x7e, temp); | 3285 | pci_write_config_byte(pci_dev, 0x7e, temp); |
3286 | 3286 | ||
3287 | pci_dev_put(pci_dev); | ||
3288 | |||
3287 | ch = inb(TRID_REG(card, ALI_SCTRL)); | 3289 | ch = inb(TRID_REG(card, ALI_SCTRL)); |
3288 | outb(ch | ALI_SPDIF_OUT_ENABLE, TRID_REG(card, ALI_SCTRL)); | 3290 | outb(ch | ALI_SPDIF_OUT_ENABLE, TRID_REG(card, ALI_SCTRL)); |
3289 | ch = inb(TRID_REG(card, ALI_SPDIF_CTRL)); | 3291 | ch = inb(TRID_REG(card, ALI_SPDIF_CTRL)); |
@@ -3490,16 +3492,19 @@ ali_close_multi_channels(void) | |||
3490 | char temp = 0; | 3492 | char temp = 0; |
3491 | struct pci_dev *pci_dev = NULL; | 3493 | struct pci_dev *pci_dev = NULL; |
3492 | 3494 | ||
3493 | pci_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, | 3495 | pci_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, |
3494 | pci_dev); | 3496 | pci_dev); |
3495 | if (pci_dev == NULL) | 3497 | if (pci_dev == NULL) |
3496 | return -1; | 3498 | return -1; |
3499 | |||
3497 | pci_read_config_byte(pci_dev, 0x59, &temp); | 3500 | pci_read_config_byte(pci_dev, 0x59, &temp); |
3498 | temp &= ~0x80; | 3501 | temp &= ~0x80; |
3499 | pci_write_config_byte(pci_dev, 0x59, temp); | 3502 | pci_write_config_byte(pci_dev, 0x59, temp); |
3500 | 3503 | ||
3501 | pci_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, | 3504 | pci_dev_put(pci_dev); |
3502 | pci_dev); | 3505 | |
3506 | pci_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, | ||
3507 | NULL); | ||
3503 | if (pci_dev == NULL) | 3508 | if (pci_dev == NULL) |
3504 | return -1; | 3509 | return -1; |
3505 | 3510 | ||
@@ -3507,6 +3512,8 @@ ali_close_multi_channels(void) | |||
3507 | temp &= ~0x20; | 3512 | temp &= ~0x20; |
3508 | pci_write_config_byte(pci_dev, 0xB8, temp); | 3513 | pci_write_config_byte(pci_dev, 0xB8, temp); |
3509 | 3514 | ||
3515 | pci_dev_put(pci_dev); | ||
3516 | |||
3510 | return 0; | 3517 | return 0; |
3511 | } | 3518 | } |
3512 | 3519 | ||
@@ -3517,21 +3524,26 @@ ali_setup_multi_channels(struct trident_card *card, int chan_nums) | |||
3517 | char temp = 0; | 3524 | char temp = 0; |
3518 | struct pci_dev *pci_dev = NULL; | 3525 | struct pci_dev *pci_dev = NULL; |
3519 | 3526 | ||
3520 | pci_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, | 3527 | pci_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, |
3521 | pci_dev); | 3528 | pci_dev); |
3522 | if (pci_dev == NULL) | 3529 | if (pci_dev == NULL) |
3523 | return -1; | 3530 | return -1; |
3524 | pci_read_config_byte(pci_dev, 0x59, &temp); | 3531 | pci_read_config_byte(pci_dev, 0x59, &temp); |
3525 | temp |= 0x80; | 3532 | temp |= 0x80; |
3526 | pci_write_config_byte(pci_dev, 0x59, temp); | 3533 | pci_write_config_byte(pci_dev, 0x59, temp); |
3527 | 3534 | ||
3528 | pci_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, | 3535 | pci_dev_put(pci_dev); |
3529 | pci_dev); | 3536 | |
3537 | pci_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, | ||
3538 | NULL); | ||
3530 | if (pci_dev == NULL) | 3539 | if (pci_dev == NULL) |
3531 | return -1; | 3540 | return -1; |
3532 | pci_read_config_byte(pci_dev, (int) 0xB8, &temp); | 3541 | pci_read_config_byte(pci_dev, (int) 0xB8, &temp); |
3533 | temp |= 0x20; | 3542 | temp |= 0x20; |
3534 | pci_write_config_byte(pci_dev, (int) 0xB8, (u8) temp); | 3543 | pci_write_config_byte(pci_dev, (int) 0xB8, (u8) temp); |
3544 | |||
3545 | pci_dev_put(pci_dev); | ||
3546 | |||
3535 | if (chan_nums == 6) { | 3547 | if (chan_nums == 6) { |
3536 | dwValue = inl(TRID_REG(card, ALI_SCTRL)) | 0x000f0000; | 3548 | dwValue = inl(TRID_REG(card, ALI_SCTRL)) | 0x000f0000; |
3537 | outl(dwValue, TRID_REG(card, ALI_SCTRL)); | 3549 | outl(dwValue, TRID_REG(card, ALI_SCTRL)); |
@@ -4103,8 +4115,8 @@ ali_reset_5451(struct trident_card *card) | |||
4103 | unsigned int dwVal; | 4115 | unsigned int dwVal; |
4104 | unsigned short wCount, wReg; | 4116 | unsigned short wCount, wReg; |
4105 | 4117 | ||
4106 | pci_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, | 4118 | pci_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, |
4107 | pci_dev); | 4119 | pci_dev); |
4108 | if (pci_dev == NULL) | 4120 | if (pci_dev == NULL) |
4109 | return -1; | 4121 | return -1; |
4110 | 4122 | ||
@@ -4114,6 +4126,7 @@ ali_reset_5451(struct trident_card *card) | |||
4114 | pci_read_config_dword(pci_dev, 0x7c, &dwVal); | 4126 | pci_read_config_dword(pci_dev, 0x7c, &dwVal); |
4115 | pci_write_config_dword(pci_dev, 0x7c, dwVal & 0xf7ffffff); | 4127 | pci_write_config_dword(pci_dev, 0x7c, dwVal & 0xf7ffffff); |
4116 | udelay(5000); | 4128 | udelay(5000); |
4129 | pci_dev_put(pci_dev); | ||
4117 | 4130 | ||
4118 | pci_dev = card->pci_dev; | 4131 | pci_dev = card->pci_dev; |
4119 | if (pci_dev == NULL) | 4132 | if (pci_dev == NULL) |
@@ -4393,7 +4406,7 @@ trident_probe(struct pci_dev *pci_dev, const struct pci_device_id *pci_id) | |||
4393 | 4406 | ||
4394 | init_timer(&card->timer); | 4407 | init_timer(&card->timer); |
4395 | card->iobase = iobase; | 4408 | card->iobase = iobase; |
4396 | card->pci_dev = pci_dev; | 4409 | card->pci_dev = pci_dev_get(pci_dev); |
4397 | card->pci_id = pci_id->device; | 4410 | card->pci_id = pci_id->device; |
4398 | card->revision = revision; | 4411 | card->revision = revision; |
4399 | card->irq = pci_dev->irq; | 4412 | card->irq = pci_dev->irq; |
@@ -4547,6 +4560,7 @@ out_unregister_sound_dsp: | |||
4547 | out_free_irq: | 4560 | out_free_irq: |
4548 | free_irq(card->irq, card); | 4561 | free_irq(card->irq, card); |
4549 | out_proc_fs: | 4562 | out_proc_fs: |
4563 | pci_dev_put(card->pci_dev); | ||
4550 | if (res) { | 4564 | if (res) { |
4551 | remove_proc_entry("ALi5451", NULL); | 4565 | remove_proc_entry("ALi5451", NULL); |
4552 | res = NULL; | 4566 | res = NULL; |
@@ -4597,9 +4611,9 @@ trident_remove(struct pci_dev *pci_dev) | |||
4597 | } | 4611 | } |
4598 | unregister_sound_dsp(card->dev_audio); | 4612 | unregister_sound_dsp(card->dev_audio); |
4599 | 4613 | ||
4600 | kfree(card); | ||
4601 | |||
4602 | pci_set_drvdata(pci_dev, NULL); | 4614 | pci_set_drvdata(pci_dev, NULL); |
4615 | pci_dev_put(card->pci_dev); | ||
4616 | kfree(card); | ||
4603 | } | 4617 | } |
4604 | 4618 | ||
4605 | MODULE_AUTHOR("Alan Cox, Aaron Holtzman, Ollie Lho, Ching Ling Lee, Muli Ben-Yehuda"); | 4619 | MODULE_AUTHOR("Alan Cox, Aaron Holtzman, Ollie Lho, Ching Ling Lee, Muli Ben-Yehuda"); |