aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/oxygen/oxygen_lib.c')
-rw-r--r--sound/pci/oxygen/oxygen_lib.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index b67e30602473..ffff3b25fd73 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -319,11 +319,12 @@ static void oxygen_restore_eeprom(struct oxygen *chip,
319 319
320static void configure_pcie_bridge(struct pci_dev *pci) 320static void configure_pcie_bridge(struct pci_dev *pci)
321{ 321{
322 enum { PEX811X, PI7C9X110 }; 322 enum { PEX811X, PI7C9X110, XIO2001 };
323 static const struct pci_device_id bridge_ids[] = { 323 static const struct pci_device_id bridge_ids[] = {
324 { PCI_VDEVICE(PLX, 0x8111), .driver_data = PEX811X }, 324 { PCI_VDEVICE(PLX, 0x8111), .driver_data = PEX811X },
325 { PCI_VDEVICE(PLX, 0x8112), .driver_data = PEX811X }, 325 { PCI_VDEVICE(PLX, 0x8112), .driver_data = PEX811X },
326 { PCI_DEVICE(0x12d8, 0xe110), .driver_data = PI7C9X110 }, 326 { PCI_DEVICE(0x12d8, 0xe110), .driver_data = PI7C9X110 },
327 { PCI_VDEVICE(TI, 0x8240), .driver_data = XIO2001 },
327 { } 328 { }
328 }; 329 };
329 struct pci_dev *bridge; 330 struct pci_dev *bridge;
@@ -357,6 +358,14 @@ static void configure_pcie_bridge(struct pci_dev *pci)
357 tmp |= 1; /* park the PCI arbiter to the sound chip */ 358 tmp |= 1; /* park the PCI arbiter to the sound chip */
358 pci_write_config_dword(bridge, 0x40, tmp); 359 pci_write_config_dword(bridge, 0x40, tmp);
359 break; 360 break;
361
362 case XIO2001: /* Texas Instruments XIO2001 PCIe/PCI bridge */
363 pci_read_config_dword(bridge, 0xe8, &tmp);
364 tmp &= ~0xf; /* request length limit: 64 bytes */
365 tmp &= ~(0xf << 8);
366 tmp |= 1 << 8; /* request count limit: one buffer */
367 pci_write_config_dword(bridge, 0xe8, tmp);
368 break;
360 } 369 }
361} 370}
362 371
@@ -441,9 +450,18 @@ static void oxygen_init(struct oxygen *chip)
441 oxygen_write16(chip, OXYGEN_I2S_B_FORMAT, 450 oxygen_write16(chip, OXYGEN_I2S_B_FORMAT,
442 OXYGEN_I2S_MASTER | 451 OXYGEN_I2S_MASTER |
443 OXYGEN_I2S_MUTE_MCLK); 452 OXYGEN_I2S_MUTE_MCLK);
444 oxygen_write16(chip, OXYGEN_I2S_C_FORMAT, 453 if (chip->model.device_config & CAPTURE_3_FROM_I2S_3)
445 OXYGEN_I2S_MASTER | 454 oxygen_write16(chip, OXYGEN_I2S_C_FORMAT,
446 OXYGEN_I2S_MUTE_MCLK); 455 OXYGEN_RATE_48000 |
456 chip->model.adc_i2s_format |
457 OXYGEN_I2S_MCLK(chip->model.adc_mclks) |
458 OXYGEN_I2S_BITS_16 |
459 OXYGEN_I2S_MASTER |
460 OXYGEN_I2S_BCLK_64);
461 else
462 oxygen_write16(chip, OXYGEN_I2S_C_FORMAT,
463 OXYGEN_I2S_MASTER |
464 OXYGEN_I2S_MUTE_MCLK);
447 oxygen_clear_bits32(chip, OXYGEN_SPDIF_CONTROL, 465 oxygen_clear_bits32(chip, OXYGEN_SPDIF_CONTROL,
448 OXYGEN_SPDIF_OUT_ENABLE | 466 OXYGEN_SPDIF_OUT_ENABLE |
449 OXYGEN_SPDIF_LOOPBACK); 467 OXYGEN_SPDIF_LOOPBACK);
@@ -728,7 +746,6 @@ EXPORT_SYMBOL(oxygen_pci_remove);
728#ifdef CONFIG_PM_SLEEP 746#ifdef CONFIG_PM_SLEEP
729static int oxygen_pci_suspend(struct device *dev) 747static int oxygen_pci_suspend(struct device *dev)
730{ 748{
731 struct pci_dev *pci = to_pci_dev(dev);
732 struct snd_card *card = dev_get_drvdata(dev); 749 struct snd_card *card = dev_get_drvdata(dev);
733 struct oxygen *chip = card->private_data; 750 struct oxygen *chip = card->private_data;
734 unsigned int i, saved_interrupt_mask; 751 unsigned int i, saved_interrupt_mask;
@@ -736,8 +753,7 @@ static int oxygen_pci_suspend(struct device *dev)
736 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 753 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
737 754
738 for (i = 0; i < PCM_COUNT; ++i) 755 for (i = 0; i < PCM_COUNT; ++i)
739 if (chip->streams[i]) 756 snd_pcm_suspend(chip->streams[i]);
740 snd_pcm_suspend(chip->streams[i]);
741 757
742 if (chip->model.suspend) 758 if (chip->model.suspend)
743 chip->model.suspend(chip); 759 chip->model.suspend(chip);
@@ -753,10 +769,6 @@ static int oxygen_pci_suspend(struct device *dev)
753 flush_work(&chip->spdif_input_bits_work); 769 flush_work(&chip->spdif_input_bits_work);
754 flush_work(&chip->gpio_work); 770 flush_work(&chip->gpio_work);
755 chip->interrupt_mask = saved_interrupt_mask; 771 chip->interrupt_mask = saved_interrupt_mask;
756
757 pci_disable_device(pci);
758 pci_save_state(pci);
759 pci_set_power_state(pci, PCI_D3hot);
760 return 0; 772 return 0;
761} 773}
762 774
@@ -788,20 +800,10 @@ static void oxygen_restore_ac97(struct oxygen *chip, unsigned int codec)
788 800
789static int oxygen_pci_resume(struct device *dev) 801static int oxygen_pci_resume(struct device *dev)
790{ 802{
791 struct pci_dev *pci = to_pci_dev(dev);
792 struct snd_card *card = dev_get_drvdata(dev); 803 struct snd_card *card = dev_get_drvdata(dev);
793 struct oxygen *chip = card->private_data; 804 struct oxygen *chip = card->private_data;
794 unsigned int i; 805 unsigned int i;
795 806
796 pci_set_power_state(pci, PCI_D0);
797 pci_restore_state(pci);
798 if (pci_enable_device(pci) < 0) {
799 dev_err(dev, "cannot reenable device");
800 snd_card_disconnect(card);
801 return -EIO;
802 }
803 pci_set_master(pci);
804
805 oxygen_write16(chip, OXYGEN_DMA_STATUS, 0); 807 oxygen_write16(chip, OXYGEN_DMA_STATUS, 0);
806 oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, 0); 808 oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, 0);
807 for (i = 0; i < OXYGEN_IO_SIZE; ++i) 809 for (i = 0; i < OXYGEN_IO_SIZE; ++i)