diff options
Diffstat (limited to 'sound/pci/cs46xx/cs46xx_lib.c')
-rw-r--r-- | sound/pci/cs46xx/cs46xx_lib.c | 59 |
1 files changed, 7 insertions, 52 deletions
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 32b44f25b5c8..fb3abb2203cd 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c | |||
@@ -1778,13 +1778,11 @@ static struct snd_pcm_ops snd_cs46xx_capture_indirect_ops = { | |||
1778 | #define MAX_PLAYBACK_CHANNELS 1 | 1778 | #define MAX_PLAYBACK_CHANNELS 1 |
1779 | #endif | 1779 | #endif |
1780 | 1780 | ||
1781 | int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm) | 1781 | int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device) |
1782 | { | 1782 | { |
1783 | struct snd_pcm *pcm; | 1783 | struct snd_pcm *pcm; |
1784 | int err; | 1784 | int err; |
1785 | 1785 | ||
1786 | if (rpcm) | ||
1787 | *rpcm = NULL; | ||
1788 | if ((err = snd_pcm_new(chip->card, "CS46xx", device, MAX_PLAYBACK_CHANNELS, 1, &pcm)) < 0) | 1786 | if ((err = snd_pcm_new(chip->card, "CS46xx", device, MAX_PLAYBACK_CHANNELS, 1, &pcm)) < 0) |
1789 | return err; | 1787 | return err; |
1790 | 1788 | ||
@@ -1801,23 +1799,16 @@ int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm) | |||
1801 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1799 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1802 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1800 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1803 | 1801 | ||
1804 | if (rpcm) | ||
1805 | *rpcm = pcm; | ||
1806 | |||
1807 | return 0; | 1802 | return 0; |
1808 | } | 1803 | } |
1809 | 1804 | ||
1810 | 1805 | ||
1811 | #ifdef CONFIG_SND_CS46XX_NEW_DSP | 1806 | #ifdef CONFIG_SND_CS46XX_NEW_DSP |
1812 | int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, | 1807 | int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device) |
1813 | struct snd_pcm **rpcm) | ||
1814 | { | 1808 | { |
1815 | struct snd_pcm *pcm; | 1809 | struct snd_pcm *pcm; |
1816 | int err; | 1810 | int err; |
1817 | 1811 | ||
1818 | if (rpcm) | ||
1819 | *rpcm = NULL; | ||
1820 | |||
1821 | if ((err = snd_pcm_new(chip->card, "CS46xx - Rear", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) | 1812 | if ((err = snd_pcm_new(chip->card, "CS46xx - Rear", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) |
1822 | return err; | 1813 | return err; |
1823 | 1814 | ||
@@ -1833,21 +1824,14 @@ int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, | |||
1833 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1824 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1834 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1825 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1835 | 1826 | ||
1836 | if (rpcm) | ||
1837 | *rpcm = pcm; | ||
1838 | |||
1839 | return 0; | 1827 | return 0; |
1840 | } | 1828 | } |
1841 | 1829 | ||
1842 | int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, | 1830 | int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device) |
1843 | struct snd_pcm **rpcm) | ||
1844 | { | 1831 | { |
1845 | struct snd_pcm *pcm; | 1832 | struct snd_pcm *pcm; |
1846 | int err; | 1833 | int err; |
1847 | 1834 | ||
1848 | if (rpcm) | ||
1849 | *rpcm = NULL; | ||
1850 | |||
1851 | if ((err = snd_pcm_new(chip->card, "CS46xx - Center LFE", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) | 1835 | if ((err = snd_pcm_new(chip->card, "CS46xx - Center LFE", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) |
1852 | return err; | 1836 | return err; |
1853 | 1837 | ||
@@ -1863,21 +1847,14 @@ int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, | |||
1863 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1847 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1864 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1848 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1865 | 1849 | ||
1866 | if (rpcm) | ||
1867 | *rpcm = pcm; | ||
1868 | |||
1869 | return 0; | 1850 | return 0; |
1870 | } | 1851 | } |
1871 | 1852 | ||
1872 | int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, | 1853 | int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device) |
1873 | struct snd_pcm **rpcm) | ||
1874 | { | 1854 | { |
1875 | struct snd_pcm *pcm; | 1855 | struct snd_pcm *pcm; |
1876 | int err; | 1856 | int err; |
1877 | 1857 | ||
1878 | if (rpcm) | ||
1879 | *rpcm = NULL; | ||
1880 | |||
1881 | if ((err = snd_pcm_new(chip->card, "CS46xx - IEC958", device, 1, 0, &pcm)) < 0) | 1858 | if ((err = snd_pcm_new(chip->card, "CS46xx - IEC958", device, 1, 0, &pcm)) < 0) |
1882 | return err; | 1859 | return err; |
1883 | 1860 | ||
@@ -1893,9 +1870,6 @@ int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, | |||
1893 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1870 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1894 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1871 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1895 | 1872 | ||
1896 | if (rpcm) | ||
1897 | *rpcm = pcm; | ||
1898 | |||
1899 | return 0; | 1873 | return 0; |
1900 | } | 1874 | } |
1901 | #endif | 1875 | #endif |
@@ -2724,13 +2698,11 @@ static struct snd_rawmidi_ops snd_cs46xx_midi_input = | |||
2724 | .trigger = snd_cs46xx_midi_input_trigger, | 2698 | .trigger = snd_cs46xx_midi_input_trigger, |
2725 | }; | 2699 | }; |
2726 | 2700 | ||
2727 | int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rrawmidi) | 2701 | int snd_cs46xx_midi(struct snd_cs46xx *chip, int device) |
2728 | { | 2702 | { |
2729 | struct snd_rawmidi *rmidi; | 2703 | struct snd_rawmidi *rmidi; |
2730 | int err; | 2704 | int err; |
2731 | 2705 | ||
2732 | if (rrawmidi) | ||
2733 | *rrawmidi = NULL; | ||
2734 | if ((err = snd_rawmidi_new(chip->card, "CS46XX", device, 1, 1, &rmidi)) < 0) | 2706 | if ((err = snd_rawmidi_new(chip->card, "CS46XX", device, 1, 1, &rmidi)) < 0) |
2735 | return err; | 2707 | return err; |
2736 | strcpy(rmidi->name, "CS46XX"); | 2708 | strcpy(rmidi->name, "CS46XX"); |
@@ -2739,8 +2711,6 @@ int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rr | |||
2739 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; | 2711 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; |
2740 | rmidi->private_data = chip; | 2712 | rmidi->private_data = chip; |
2741 | chip->rmidi = rmidi; | 2713 | chip->rmidi = rmidi; |
2742 | if (rrawmidi) | ||
2743 | *rrawmidi = NULL; | ||
2744 | return 0; | 2714 | return 0; |
2745 | } | 2715 | } |
2746 | 2716 | ||
@@ -2979,8 +2949,8 @@ static int snd_cs46xx_free(struct snd_cs46xx *chip) | |||
2979 | 2949 | ||
2980 | for (idx = 0; idx < 5; idx++) { | 2950 | for (idx = 0; idx < 5; idx++) { |
2981 | struct snd_cs46xx_region *region = &chip->region.idx[idx]; | 2951 | struct snd_cs46xx_region *region = &chip->region.idx[idx]; |
2982 | if (region->remap_addr) | 2952 | |
2983 | iounmap(region->remap_addr); | 2953 | iounmap(region->remap_addr); |
2984 | release_and_free_resource(region->resource); | 2954 | release_and_free_resource(region->resource); |
2985 | } | 2955 | } |
2986 | 2956 | ||
@@ -3804,7 +3774,6 @@ static unsigned int saved_regs[] = { | |||
3804 | 3774 | ||
3805 | static int snd_cs46xx_suspend(struct device *dev) | 3775 | static int snd_cs46xx_suspend(struct device *dev) |
3806 | { | 3776 | { |
3807 | struct pci_dev *pci = to_pci_dev(dev); | ||
3808 | struct snd_card *card = dev_get_drvdata(dev); | 3777 | struct snd_card *card = dev_get_drvdata(dev); |
3809 | struct snd_cs46xx *chip = card->private_data; | 3778 | struct snd_cs46xx *chip = card->private_data; |
3810 | int i, amp_saved; | 3779 | int i, amp_saved; |
@@ -3829,16 +3798,11 @@ static int snd_cs46xx_suspend(struct device *dev) | |||
3829 | /* disable CLKRUN */ | 3798 | /* disable CLKRUN */ |
3830 | chip->active_ctrl(chip, -chip->amplifier); | 3799 | chip->active_ctrl(chip, -chip->amplifier); |
3831 | chip->amplifier = amp_saved; /* restore the status */ | 3800 | chip->amplifier = amp_saved; /* restore the status */ |
3832 | |||
3833 | pci_disable_device(pci); | ||
3834 | pci_save_state(pci); | ||
3835 | pci_set_power_state(pci, PCI_D3hot); | ||
3836 | return 0; | 3801 | return 0; |
3837 | } | 3802 | } |
3838 | 3803 | ||
3839 | static int snd_cs46xx_resume(struct device *dev) | 3804 | static int snd_cs46xx_resume(struct device *dev) |
3840 | { | 3805 | { |
3841 | struct pci_dev *pci = to_pci_dev(dev); | ||
3842 | struct snd_card *card = dev_get_drvdata(dev); | 3806 | struct snd_card *card = dev_get_drvdata(dev); |
3843 | struct snd_cs46xx *chip = card->private_data; | 3807 | struct snd_cs46xx *chip = card->private_data; |
3844 | int amp_saved; | 3808 | int amp_saved; |
@@ -3847,15 +3811,6 @@ static int snd_cs46xx_resume(struct device *dev) | |||
3847 | #endif | 3811 | #endif |
3848 | unsigned int tmp; | 3812 | unsigned int tmp; |
3849 | 3813 | ||
3850 | pci_set_power_state(pci, PCI_D0); | ||
3851 | pci_restore_state(pci); | ||
3852 | if (pci_enable_device(pci) < 0) { | ||
3853 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
3854 | snd_card_disconnect(card); | ||
3855 | return -EIO; | ||
3856 | } | ||
3857 | pci_set_master(pci); | ||
3858 | |||
3859 | amp_saved = chip->amplifier; | 3814 | amp_saved = chip->amplifier; |
3860 | chip->amplifier = 0; | 3815 | chip->amplifier = 0; |
3861 | chip->active_ctrl(chip, 1); /* force to on */ | 3816 | chip->active_ctrl(chip, 1); /* force to on */ |