diff options
Diffstat (limited to 'sound/pci/cs4281.c')
-rw-r--r-- | sound/pci/cs4281.c | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index 4c49b5c8a7b3..c296fd0dbc9c 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <asm/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
@@ -973,14 +973,11 @@ static struct snd_pcm_ops snd_cs4281_capture_ops = { | |||
973 | .pointer = snd_cs4281_pointer, | 973 | .pointer = snd_cs4281_pointer, |
974 | }; | 974 | }; |
975 | 975 | ||
976 | static int snd_cs4281_pcm(struct cs4281 *chip, int device, | 976 | static int snd_cs4281_pcm(struct cs4281 *chip, int device) |
977 | struct snd_pcm **rpcm) | ||
978 | { | 977 | { |
979 | struct snd_pcm *pcm; | 978 | struct snd_pcm *pcm; |
980 | int err; | 979 | int err; |
981 | 980 | ||
982 | if (rpcm) | ||
983 | *rpcm = NULL; | ||
984 | err = snd_pcm_new(chip->card, "CS4281", device, 1, 1, &pcm); | 981 | err = snd_pcm_new(chip->card, "CS4281", device, 1, 1, &pcm); |
985 | if (err < 0) | 982 | if (err < 0) |
986 | return err; | 983 | return err; |
@@ -996,8 +993,6 @@ static int snd_cs4281_pcm(struct cs4281 *chip, int device, | |||
996 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 993 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
997 | snd_dma_pci_data(chip->pci), 64*1024, 512*1024); | 994 | snd_dma_pci_data(chip->pci), 64*1024, 512*1024); |
998 | 995 | ||
999 | if (rpcm) | ||
1000 | *rpcm = pcm; | ||
1001 | return 0; | 996 | return 0; |
1002 | } | 997 | } |
1003 | 998 | ||
@@ -1321,10 +1316,8 @@ static int snd_cs4281_free(struct cs4281 *chip) | |||
1321 | 1316 | ||
1322 | if (chip->irq >= 0) | 1317 | if (chip->irq >= 0) |
1323 | free_irq(chip->irq, chip); | 1318 | free_irq(chip->irq, chip); |
1324 | if (chip->ba0) | 1319 | iounmap(chip->ba0); |
1325 | iounmap(chip->ba0); | 1320 | iounmap(chip->ba1); |
1326 | if (chip->ba1) | ||
1327 | iounmap(chip->ba1); | ||
1328 | pci_release_regions(chip->pci); | 1321 | pci_release_regions(chip->pci); |
1329 | pci_disable_device(chip->pci); | 1322 | pci_disable_device(chip->pci); |
1330 | 1323 | ||
@@ -1788,14 +1781,11 @@ static struct snd_rawmidi_ops snd_cs4281_midi_input = | |||
1788 | .trigger = snd_cs4281_midi_input_trigger, | 1781 | .trigger = snd_cs4281_midi_input_trigger, |
1789 | }; | 1782 | }; |
1790 | 1783 | ||
1791 | static int snd_cs4281_midi(struct cs4281 *chip, int device, | 1784 | static int snd_cs4281_midi(struct cs4281 *chip, int device) |
1792 | struct snd_rawmidi **rrawmidi) | ||
1793 | { | 1785 | { |
1794 | struct snd_rawmidi *rmidi; | 1786 | struct snd_rawmidi *rmidi; |
1795 | int err; | 1787 | int err; |
1796 | 1788 | ||
1797 | if (rrawmidi) | ||
1798 | *rrawmidi = NULL; | ||
1799 | if ((err = snd_rawmidi_new(chip->card, "CS4281", device, 1, 1, &rmidi)) < 0) | 1789 | if ((err = snd_rawmidi_new(chip->card, "CS4281", device, 1, 1, &rmidi)) < 0) |
1800 | return err; | 1790 | return err; |
1801 | strcpy(rmidi->name, "CS4281"); | 1791 | strcpy(rmidi->name, "CS4281"); |
@@ -1804,8 +1794,6 @@ static int snd_cs4281_midi(struct cs4281 *chip, int device, | |||
1804 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; | 1794 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; |
1805 | rmidi->private_data = chip; | 1795 | rmidi->private_data = chip; |
1806 | chip->rmidi = rmidi; | 1796 | chip->rmidi = rmidi; |
1807 | if (rrawmidi) | ||
1808 | *rrawmidi = rmidi; | ||
1809 | return 0; | 1797 | return 0; |
1810 | } | 1798 | } |
1811 | 1799 | ||
@@ -1941,11 +1929,11 @@ static int snd_cs4281_probe(struct pci_dev *pci, | |||
1941 | snd_card_free(card); | 1929 | snd_card_free(card); |
1942 | return err; | 1930 | return err; |
1943 | } | 1931 | } |
1944 | if ((err = snd_cs4281_pcm(chip, 0, NULL)) < 0) { | 1932 | if ((err = snd_cs4281_pcm(chip, 0)) < 0) { |
1945 | snd_card_free(card); | 1933 | snd_card_free(card); |
1946 | return err; | 1934 | return err; |
1947 | } | 1935 | } |
1948 | if ((err = snd_cs4281_midi(chip, 0, NULL)) < 0) { | 1936 | if ((err = snd_cs4281_midi(chip, 0)) < 0) { |
1949 | snd_card_free(card); | 1937 | snd_card_free(card); |
1950 | return err; | 1938 | return err; |
1951 | } | 1939 | } |
@@ -2008,7 +1996,6 @@ static int saved_regs[SUSPEND_REGISTERS] = { | |||
2008 | 1996 | ||
2009 | static int cs4281_suspend(struct device *dev) | 1997 | static int cs4281_suspend(struct device *dev) |
2010 | { | 1998 | { |
2011 | struct pci_dev *pci = to_pci_dev(dev); | ||
2012 | struct snd_card *card = dev_get_drvdata(dev); | 1999 | struct snd_card *card = dev_get_drvdata(dev); |
2013 | struct cs4281 *chip = card->private_data; | 2000 | struct cs4281 *chip = card->private_data; |
2014 | u32 ulCLK; | 2001 | u32 ulCLK; |
@@ -2047,30 +2034,16 @@ static int cs4281_suspend(struct device *dev) | |||
2047 | ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1); | 2034 | ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1); |
2048 | ulCLK &= ~CLKCR1_CKRA; | 2035 | ulCLK &= ~CLKCR1_CKRA; |
2049 | snd_cs4281_pokeBA0(chip, BA0_CLKCR1, ulCLK); | 2036 | snd_cs4281_pokeBA0(chip, BA0_CLKCR1, ulCLK); |
2050 | |||
2051 | pci_disable_device(pci); | ||
2052 | pci_save_state(pci); | ||
2053 | pci_set_power_state(pci, PCI_D3hot); | ||
2054 | return 0; | 2037 | return 0; |
2055 | } | 2038 | } |
2056 | 2039 | ||
2057 | static int cs4281_resume(struct device *dev) | 2040 | static int cs4281_resume(struct device *dev) |
2058 | { | 2041 | { |
2059 | struct pci_dev *pci = to_pci_dev(dev); | ||
2060 | struct snd_card *card = dev_get_drvdata(dev); | 2042 | struct snd_card *card = dev_get_drvdata(dev); |
2061 | struct cs4281 *chip = card->private_data; | 2043 | struct cs4281 *chip = card->private_data; |
2062 | unsigned int i; | 2044 | unsigned int i; |
2063 | u32 ulCLK; | 2045 | u32 ulCLK; |
2064 | 2046 | ||
2065 | pci_set_power_state(pci, PCI_D0); | ||
2066 | pci_restore_state(pci); | ||
2067 | if (pci_enable_device(pci) < 0) { | ||
2068 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
2069 | snd_card_disconnect(card); | ||
2070 | return -EIO; | ||
2071 | } | ||
2072 | pci_set_master(pci); | ||
2073 | |||
2074 | ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1); | 2047 | ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1); |
2075 | ulCLK |= CLKCR1_CKRA; | 2048 | ulCLK |= CLKCR1_CKRA; |
2076 | snd_cs4281_pokeBA0(chip, BA0_CLKCR1, ulCLK); | 2049 | snd_cs4281_pokeBA0(chip, BA0_CLKCR1, ulCLK); |