diff options
Diffstat (limited to 'sound/pci/ymfpci/ymfpci_main.c')
-rw-r--r-- | sound/pci/ymfpci/ymfpci_main.c | 53 |
1 files changed, 7 insertions, 46 deletions
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 81c916a5eb96..227d5c9dfe09 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c | |||
@@ -1145,13 +1145,11 @@ static struct snd_pcm_ops snd_ymfpci_capture_rec_ops = { | |||
1145 | .pointer = snd_ymfpci_capture_pointer, | 1145 | .pointer = snd_ymfpci_capture_pointer, |
1146 | }; | 1146 | }; |
1147 | 1147 | ||
1148 | int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm) | 1148 | int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device) |
1149 | { | 1149 | { |
1150 | struct snd_pcm *pcm; | 1150 | struct snd_pcm *pcm; |
1151 | int err; | 1151 | int err; |
1152 | 1152 | ||
1153 | if (rpcm) | ||
1154 | *rpcm = NULL; | ||
1155 | if ((err = snd_pcm_new(chip->card, "YMFPCI", device, 32, 1, &pcm)) < 0) | 1153 | if ((err = snd_pcm_new(chip->card, "YMFPCI", device, 32, 1, &pcm)) < 0) |
1156 | return err; | 1154 | return err; |
1157 | pcm->private_data = chip; | 1155 | pcm->private_data = chip; |
@@ -1167,14 +1165,8 @@ int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm) | |||
1167 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1165 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1168 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1166 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1169 | 1167 | ||
1170 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | 1168 | return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
1171 | snd_pcm_std_chmaps, 2, 0, NULL); | 1169 | snd_pcm_std_chmaps, 2, 0, NULL); |
1172 | if (err < 0) | ||
1173 | return err; | ||
1174 | |||
1175 | if (rpcm) | ||
1176 | *rpcm = pcm; | ||
1177 | return 0; | ||
1178 | } | 1170 | } |
1179 | 1171 | ||
1180 | static struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = { | 1172 | static struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = { |
@@ -1188,13 +1180,11 @@ static struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = { | |||
1188 | .pointer = snd_ymfpci_capture_pointer, | 1180 | .pointer = snd_ymfpci_capture_pointer, |
1189 | }; | 1181 | }; |
1190 | 1182 | ||
1191 | int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm) | 1183 | int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device) |
1192 | { | 1184 | { |
1193 | struct snd_pcm *pcm; | 1185 | struct snd_pcm *pcm; |
1194 | int err; | 1186 | int err; |
1195 | 1187 | ||
1196 | if (rpcm) | ||
1197 | *rpcm = NULL; | ||
1198 | if ((err = snd_pcm_new(chip->card, "YMFPCI - PCM2", device, 0, 1, &pcm)) < 0) | 1188 | if ((err = snd_pcm_new(chip->card, "YMFPCI - PCM2", device, 0, 1, &pcm)) < 0) |
1199 | return err; | 1189 | return err; |
1200 | pcm->private_data = chip; | 1190 | pcm->private_data = chip; |
@@ -1210,8 +1200,6 @@ int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm) | |||
1210 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1200 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1211 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1201 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1212 | 1202 | ||
1213 | if (rpcm) | ||
1214 | *rpcm = pcm; | ||
1215 | return 0; | 1203 | return 0; |
1216 | } | 1204 | } |
1217 | 1205 | ||
@@ -1226,14 +1214,11 @@ static struct snd_pcm_ops snd_ymfpci_playback_spdif_ops = { | |||
1226 | .pointer = snd_ymfpci_playback_pointer, | 1214 | .pointer = snd_ymfpci_playback_pointer, |
1227 | }; | 1215 | }; |
1228 | 1216 | ||
1229 | int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, | 1217 | int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device) |
1230 | struct snd_pcm **rpcm) | ||
1231 | { | 1218 | { |
1232 | struct snd_pcm *pcm; | 1219 | struct snd_pcm *pcm; |
1233 | int err; | 1220 | int err; |
1234 | 1221 | ||
1235 | if (rpcm) | ||
1236 | *rpcm = NULL; | ||
1237 | if ((err = snd_pcm_new(chip->card, "YMFPCI - IEC958", device, 1, 0, &pcm)) < 0) | 1222 | if ((err = snd_pcm_new(chip->card, "YMFPCI - IEC958", device, 1, 0, &pcm)) < 0) |
1238 | return err; | 1223 | return err; |
1239 | pcm->private_data = chip; | 1224 | pcm->private_data = chip; |
@@ -1248,8 +1233,6 @@ int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, | |||
1248 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1233 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1249 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1234 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1250 | 1235 | ||
1251 | if (rpcm) | ||
1252 | *rpcm = pcm; | ||
1253 | return 0; | 1236 | return 0; |
1254 | } | 1237 | } |
1255 | 1238 | ||
@@ -1272,14 +1255,11 @@ static const struct snd_pcm_chmap_elem surround_map[] = { | |||
1272 | { } | 1255 | { } |
1273 | }; | 1256 | }; |
1274 | 1257 | ||
1275 | int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, | 1258 | int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device) |
1276 | struct snd_pcm **rpcm) | ||
1277 | { | 1259 | { |
1278 | struct snd_pcm *pcm; | 1260 | struct snd_pcm *pcm; |
1279 | int err; | 1261 | int err; |
1280 | 1262 | ||
1281 | if (rpcm) | ||
1282 | *rpcm = NULL; | ||
1283 | if ((err = snd_pcm_new(chip->card, "YMFPCI - Rear", device, 1, 0, &pcm)) < 0) | 1263 | if ((err = snd_pcm_new(chip->card, "YMFPCI - Rear", device, 1, 0, &pcm)) < 0) |
1284 | return err; | 1264 | return err; |
1285 | pcm->private_data = chip; | 1265 | pcm->private_data = chip; |
@@ -1294,14 +1274,8 @@ int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, | |||
1294 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1274 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1295 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1275 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1296 | 1276 | ||
1297 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | 1277 | return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
1298 | surround_map, 2, 0, NULL); | 1278 | surround_map, 2, 0, NULL); |
1299 | if (err < 0) | ||
1300 | return err; | ||
1301 | |||
1302 | if (rpcm) | ||
1303 | *rpcm = pcm; | ||
1304 | return 0; | ||
1305 | } | 1279 | } |
1306 | 1280 | ||
1307 | static int snd_ymfpci_spdif_default_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1281 | static int snd_ymfpci_spdif_default_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
@@ -2272,8 +2246,7 @@ static int snd_ymfpci_free(struct snd_ymfpci *chip) | |||
2272 | release_and_free_resource(chip->mpu_res); | 2246 | release_and_free_resource(chip->mpu_res); |
2273 | release_and_free_resource(chip->fm_res); | 2247 | release_and_free_resource(chip->fm_res); |
2274 | snd_ymfpci_free_gameport(chip); | 2248 | snd_ymfpci_free_gameport(chip); |
2275 | if (chip->reg_area_virt) | 2249 | iounmap(chip->reg_area_virt); |
2276 | iounmap(chip->reg_area_virt); | ||
2277 | if (chip->work_ptr.area) | 2250 | if (chip->work_ptr.area) |
2278 | snd_dma_free_pages(&chip->work_ptr); | 2251 | snd_dma_free_pages(&chip->work_ptr); |
2279 | 2252 | ||
@@ -2326,7 +2299,6 @@ static int saved_regs_index[] = { | |||
2326 | 2299 | ||
2327 | static int snd_ymfpci_suspend(struct device *dev) | 2300 | static int snd_ymfpci_suspend(struct device *dev) |
2328 | { | 2301 | { |
2329 | struct pci_dev *pci = to_pci_dev(dev); | ||
2330 | struct snd_card *card = dev_get_drvdata(dev); | 2302 | struct snd_card *card = dev_get_drvdata(dev); |
2331 | struct snd_ymfpci *chip = card->private_data; | 2303 | struct snd_ymfpci *chip = card->private_data; |
2332 | unsigned int i; | 2304 | unsigned int i; |
@@ -2347,9 +2319,6 @@ static int snd_ymfpci_suspend(struct device *dev) | |||
2347 | snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0); | 2319 | snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0); |
2348 | snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0); | 2320 | snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0); |
2349 | snd_ymfpci_disable_dsp(chip); | 2321 | snd_ymfpci_disable_dsp(chip); |
2350 | pci_disable_device(pci); | ||
2351 | pci_save_state(pci); | ||
2352 | pci_set_power_state(pci, PCI_D3hot); | ||
2353 | return 0; | 2322 | return 0; |
2354 | } | 2323 | } |
2355 | 2324 | ||
@@ -2360,14 +2329,6 @@ static int snd_ymfpci_resume(struct device *dev) | |||
2360 | struct snd_ymfpci *chip = card->private_data; | 2329 | struct snd_ymfpci *chip = card->private_data; |
2361 | unsigned int i; | 2330 | unsigned int i; |
2362 | 2331 | ||
2363 | pci_set_power_state(pci, PCI_D0); | ||
2364 | pci_restore_state(pci); | ||
2365 | if (pci_enable_device(pci) < 0) { | ||
2366 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
2367 | snd_card_disconnect(card); | ||
2368 | return -EIO; | ||
2369 | } | ||
2370 | pci_set_master(pci); | ||
2371 | snd_ymfpci_aclink_reset(pci); | 2332 | snd_ymfpci_aclink_reset(pci); |
2372 | snd_ymfpci_codec_ready(chip, 0); | 2333 | snd_ymfpci_codec_ready(chip, 0); |
2373 | snd_ymfpci_download_image(chip); | 2334 | snd_ymfpci_download_image(chip); |