diff options
Diffstat (limited to 'sound/pci/riptide/riptide.c')
-rw-r--r-- | sound/pci/riptide/riptide.c | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 6abc2ac8fffb..94639d6b5fb5 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -99,7 +99,7 @@ | |||
99 | #include <linux/firmware.h> | 99 | #include <linux/firmware.h> |
100 | #include <linux/kernel.h> | 100 | #include <linux/kernel.h> |
101 | #include <linux/module.h> | 101 | #include <linux/module.h> |
102 | #include <asm/io.h> | 102 | #include <linux/io.h> |
103 | #include <sound/core.h> | 103 | #include <sound/core.h> |
104 | #include <sound/info.h> | 104 | #include <sound/info.h> |
105 | #include <sound/control.h> | 105 | #include <sound/control.h> |
@@ -1153,7 +1153,6 @@ static void riptide_handleirq(unsigned long dev_id) | |||
1153 | #ifdef CONFIG_PM_SLEEP | 1153 | #ifdef CONFIG_PM_SLEEP |
1154 | static int riptide_suspend(struct device *dev) | 1154 | static int riptide_suspend(struct device *dev) |
1155 | { | 1155 | { |
1156 | struct pci_dev *pci = to_pci_dev(dev); | ||
1157 | struct snd_card *card = dev_get_drvdata(dev); | 1156 | struct snd_card *card = dev_get_drvdata(dev); |
1158 | struct snd_riptide *chip = card->private_data; | 1157 | struct snd_riptide *chip = card->private_data; |
1159 | 1158 | ||
@@ -1161,27 +1160,14 @@ static int riptide_suspend(struct device *dev) | |||
1161 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1160 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1162 | snd_pcm_suspend_all(chip->pcm); | 1161 | snd_pcm_suspend_all(chip->pcm); |
1163 | snd_ac97_suspend(chip->ac97); | 1162 | snd_ac97_suspend(chip->ac97); |
1164 | pci_disable_device(pci); | ||
1165 | pci_save_state(pci); | ||
1166 | pci_set_power_state(pci, PCI_D3hot); | ||
1167 | return 0; | 1163 | return 0; |
1168 | } | 1164 | } |
1169 | 1165 | ||
1170 | static int riptide_resume(struct device *dev) | 1166 | static int riptide_resume(struct device *dev) |
1171 | { | 1167 | { |
1172 | struct pci_dev *pci = to_pci_dev(dev); | ||
1173 | struct snd_card *card = dev_get_drvdata(dev); | 1168 | struct snd_card *card = dev_get_drvdata(dev); |
1174 | struct snd_riptide *chip = card->private_data; | 1169 | struct snd_riptide *chip = card->private_data; |
1175 | 1170 | ||
1176 | pci_set_power_state(pci, PCI_D0); | ||
1177 | pci_restore_state(pci); | ||
1178 | if (pci_enable_device(pci) < 0) { | ||
1179 | printk(KERN_ERR "riptide: pci_enable_device failed, " | ||
1180 | "disabling device\n"); | ||
1181 | snd_card_disconnect(card); | ||
1182 | return -EIO; | ||
1183 | } | ||
1184 | pci_set_master(pci); | ||
1185 | snd_riptide_initialize(chip); | 1171 | snd_riptide_initialize(chip); |
1186 | snd_ac97_resume(chip->ac97); | 1172 | snd_ac97_resume(chip->ac97); |
1187 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 1173 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
@@ -1706,14 +1692,11 @@ static struct snd_pcm_ops snd_riptide_capture_ops = { | |||
1706 | .pointer = snd_riptide_pointer, | 1692 | .pointer = snd_riptide_pointer, |
1707 | }; | 1693 | }; |
1708 | 1694 | ||
1709 | static int | 1695 | static int snd_riptide_pcm(struct snd_riptide *chip, int device) |
1710 | snd_riptide_pcm(struct snd_riptide *chip, int device, struct snd_pcm **rpcm) | ||
1711 | { | 1696 | { |
1712 | struct snd_pcm *pcm; | 1697 | struct snd_pcm *pcm; |
1713 | int err; | 1698 | int err; |
1714 | 1699 | ||
1715 | if (rpcm) | ||
1716 | *rpcm = NULL; | ||
1717 | if ((err = | 1700 | if ((err = |
1718 | snd_pcm_new(chip->card, "RIPTIDE", device, PLAYBACK_SUBSTREAMS, 1, | 1701 | snd_pcm_new(chip->card, "RIPTIDE", device, PLAYBACK_SUBSTREAMS, 1, |
1719 | &pcm)) < 0) | 1702 | &pcm)) < 0) |
@@ -1729,8 +1712,6 @@ snd_riptide_pcm(struct snd_riptide *chip, int device, struct snd_pcm **rpcm) | |||
1729 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1712 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1730 | snd_dma_pci_data(chip->pci), | 1713 | snd_dma_pci_data(chip->pci), |
1731 | 64 * 1024, 128 * 1024); | 1714 | 64 * 1024, 128 * 1024); |
1732 | if (rpcm) | ||
1733 | *rpcm = pcm; | ||
1734 | return 0; | 1715 | return 0; |
1735 | } | 1716 | } |
1736 | 1717 | ||
@@ -2030,32 +2011,43 @@ snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id) | |||
2030 | { | 2011 | { |
2031 | static int dev; | 2012 | static int dev; |
2032 | struct gameport *gameport; | 2013 | struct gameport *gameport; |
2014 | int ret; | ||
2033 | 2015 | ||
2034 | if (dev >= SNDRV_CARDS) | 2016 | if (dev >= SNDRV_CARDS) |
2035 | return -ENODEV; | 2017 | return -ENODEV; |
2018 | |||
2036 | if (!enable[dev]) { | 2019 | if (!enable[dev]) { |
2037 | dev++; | 2020 | ret = -ENOENT; |
2038 | return -ENOENT; | 2021 | goto inc_dev; |
2039 | } | 2022 | } |
2040 | 2023 | ||
2041 | if (!joystick_port[dev++]) | 2024 | if (!joystick_port[dev]) { |
2042 | return 0; | 2025 | ret = 0; |
2026 | goto inc_dev; | ||
2027 | } | ||
2043 | 2028 | ||
2044 | gameport = gameport_allocate_port(); | 2029 | gameport = gameport_allocate_port(); |
2045 | if (!gameport) | 2030 | if (!gameport) { |
2046 | return -ENOMEM; | 2031 | ret = -ENOMEM; |
2032 | goto inc_dev; | ||
2033 | } | ||
2047 | if (!request_region(joystick_port[dev], 8, "Riptide gameport")) { | 2034 | if (!request_region(joystick_port[dev], 8, "Riptide gameport")) { |
2048 | snd_printk(KERN_WARNING | 2035 | snd_printk(KERN_WARNING |
2049 | "Riptide: cannot grab gameport 0x%x\n", | 2036 | "Riptide: cannot grab gameport 0x%x\n", |
2050 | joystick_port[dev]); | 2037 | joystick_port[dev]); |
2051 | gameport_free_port(gameport); | 2038 | gameport_free_port(gameport); |
2052 | return -EBUSY; | 2039 | ret = -EBUSY; |
2040 | goto inc_dev; | ||
2053 | } | 2041 | } |
2054 | 2042 | ||
2055 | gameport->io = joystick_port[dev]; | 2043 | gameport->io = joystick_port[dev]; |
2056 | gameport_register_port(gameport); | 2044 | gameport_register_port(gameport); |
2057 | pci_set_drvdata(pci, gameport); | 2045 | pci_set_drvdata(pci, gameport); |
2058 | return 0; | 2046 | |
2047 | ret = 0; | ||
2048 | inc_dev: | ||
2049 | dev++; | ||
2050 | return ret; | ||
2059 | } | 2051 | } |
2060 | 2052 | ||
2061 | static void snd_riptide_joystick_remove(struct pci_dev *pci) | 2053 | static void snd_riptide_joystick_remove(struct pci_dev *pci) |
@@ -2092,7 +2084,7 @@ snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2092 | if (err < 0) | 2084 | if (err < 0) |
2093 | goto error; | 2085 | goto error; |
2094 | card->private_data = chip; | 2086 | card->private_data = chip; |
2095 | err = snd_riptide_pcm(chip, 0, NULL); | 2087 | err = snd_riptide_pcm(chip, 0); |
2096 | if (err < 0) | 2088 | if (err < 0) |
2097 | goto error; | 2089 | goto error; |
2098 | err = snd_riptide_mixer(chip); | 2090 | err = snd_riptide_mixer(chip); |