diff options
Diffstat (limited to 'sound/pci/ens1370.c')
-rw-r--r-- | sound/pci/ens1370.c | 70 |
1 files changed, 38 insertions, 32 deletions
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index f7e6f73186e1..5674cc316530 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -55,8 +55,10 @@ | |||
55 | 55 | ||
56 | #ifdef CHIP1370 | 56 | #ifdef CHIP1370 |
57 | #define DRIVER_NAME "ENS1370" | 57 | #define DRIVER_NAME "ENS1370" |
58 | #define CHIP_NAME "ES1370" /* it can be ENS but just to keep compatibility... */ | ||
58 | #else | 59 | #else |
59 | #define DRIVER_NAME "ENS1371" | 60 | #define DRIVER_NAME "ENS1371" |
61 | #define CHIP_NAME "ES1371" | ||
60 | #endif | 62 | #endif |
61 | 63 | ||
62 | 64 | ||
@@ -1258,6 +1260,14 @@ static struct snd_pcm_ops snd_ensoniq_capture_ops = { | |||
1258 | .pointer = snd_ensoniq_capture_pointer, | 1260 | .pointer = snd_ensoniq_capture_pointer, |
1259 | }; | 1261 | }; |
1260 | 1262 | ||
1263 | static const struct snd_pcm_chmap_elem surround_map[] = { | ||
1264 | { .channels = 1, | ||
1265 | .map = { SNDRV_CHMAP_MONO } }, | ||
1266 | { .channels = 2, | ||
1267 | .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, | ||
1268 | { } | ||
1269 | }; | ||
1270 | |||
1261 | static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, | 1271 | static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, |
1262 | struct snd_pcm ** rpcm) | 1272 | struct snd_pcm ** rpcm) |
1263 | { | 1273 | { |
@@ -1266,11 +1276,7 @@ static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, | |||
1266 | 1276 | ||
1267 | if (rpcm) | 1277 | if (rpcm) |
1268 | *rpcm = NULL; | 1278 | *rpcm = NULL; |
1269 | #ifdef CHIP1370 | 1279 | err = snd_pcm_new(ensoniq->card, CHIP_NAME "/1", device, 1, 1, &pcm); |
1270 | err = snd_pcm_new(ensoniq->card, "ES1370/1", device, 1, 1, &pcm); | ||
1271 | #else | ||
1272 | err = snd_pcm_new(ensoniq->card, "ES1371/1", device, 1, 1, &pcm); | ||
1273 | #endif | ||
1274 | if (err < 0) | 1280 | if (err < 0) |
1275 | return err; | 1281 | return err; |
1276 | 1282 | ||
@@ -1283,16 +1289,22 @@ static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, | |||
1283 | 1289 | ||
1284 | pcm->private_data = ensoniq; | 1290 | pcm->private_data = ensoniq; |
1285 | pcm->info_flags = 0; | 1291 | pcm->info_flags = 0; |
1286 | #ifdef CHIP1370 | 1292 | strcpy(pcm->name, CHIP_NAME " DAC2/ADC"); |
1287 | strcpy(pcm->name, "ES1370 DAC2/ADC"); | ||
1288 | #else | ||
1289 | strcpy(pcm->name, "ES1371 DAC2/ADC"); | ||
1290 | #endif | ||
1291 | ensoniq->pcm1 = pcm; | 1293 | ensoniq->pcm1 = pcm; |
1292 | 1294 | ||
1293 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1295 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1294 | snd_dma_pci_data(ensoniq->pci), 64*1024, 128*1024); | 1296 | snd_dma_pci_data(ensoniq->pci), 64*1024, 128*1024); |
1295 | 1297 | ||
1298 | #ifdef CHIP1370 | ||
1299 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1300 | surround_map, 2, 0, NULL); | ||
1301 | #else | ||
1302 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1303 | snd_pcm_std_chmaps, 2, 0, NULL); | ||
1304 | #endif | ||
1305 | if (err < 0) | ||
1306 | return err; | ||
1307 | |||
1296 | if (rpcm) | 1308 | if (rpcm) |
1297 | *rpcm = pcm; | 1309 | *rpcm = pcm; |
1298 | return 0; | 1310 | return 0; |
@@ -1306,11 +1318,7 @@ static int __devinit snd_ensoniq_pcm2(struct ensoniq * ensoniq, int device, | |||
1306 | 1318 | ||
1307 | if (rpcm) | 1319 | if (rpcm) |
1308 | *rpcm = NULL; | 1320 | *rpcm = NULL; |
1309 | #ifdef CHIP1370 | 1321 | err = snd_pcm_new(ensoniq->card, CHIP_NAME "/2", device, 1, 0, &pcm); |
1310 | err = snd_pcm_new(ensoniq->card, "ES1370/2", device, 1, 0, &pcm); | ||
1311 | #else | ||
1312 | err = snd_pcm_new(ensoniq->card, "ES1371/2", device, 1, 0, &pcm); | ||
1313 | #endif | ||
1314 | if (err < 0) | 1322 | if (err < 0) |
1315 | return err; | 1323 | return err; |
1316 | 1324 | ||
@@ -1321,16 +1329,22 @@ static int __devinit snd_ensoniq_pcm2(struct ensoniq * ensoniq, int device, | |||
1321 | #endif | 1329 | #endif |
1322 | pcm->private_data = ensoniq; | 1330 | pcm->private_data = ensoniq; |
1323 | pcm->info_flags = 0; | 1331 | pcm->info_flags = 0; |
1324 | #ifdef CHIP1370 | 1332 | strcpy(pcm->name, CHIP_NAME " DAC1"); |
1325 | strcpy(pcm->name, "ES1370 DAC1"); | ||
1326 | #else | ||
1327 | strcpy(pcm->name, "ES1371 DAC1"); | ||
1328 | #endif | ||
1329 | ensoniq->pcm2 = pcm; | 1333 | ensoniq->pcm2 = pcm; |
1330 | 1334 | ||
1331 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1335 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1332 | snd_dma_pci_data(ensoniq->pci), 64*1024, 128*1024); | 1336 | snd_dma_pci_data(ensoniq->pci), 64*1024, 128*1024); |
1333 | 1337 | ||
1338 | #ifdef CHIP1370 | ||
1339 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1340 | snd_pcm_std_chmaps, 2, 0, NULL); | ||
1341 | #else | ||
1342 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1343 | surround_map, 2, 0, NULL); | ||
1344 | #endif | ||
1345 | if (err < 0) | ||
1346 | return err; | ||
1347 | |||
1334 | if (rpcm) | 1348 | if (rpcm) |
1335 | *rpcm = pcm; | 1349 | *rpcm = pcm; |
1336 | return 0; | 1350 | return 0; |
@@ -1885,11 +1899,7 @@ static void snd_ensoniq_proc_read(struct snd_info_entry *entry, | |||
1885 | { | 1899 | { |
1886 | struct ensoniq *ensoniq = entry->private_data; | 1900 | struct ensoniq *ensoniq = entry->private_data; |
1887 | 1901 | ||
1888 | #ifdef CHIP1370 | 1902 | snd_iprintf(buffer, "Ensoniq AudioPCI " CHIP_NAME "\n\n"); |
1889 | snd_iprintf(buffer, "Ensoniq AudioPCI ES1370\n\n"); | ||
1890 | #else | ||
1891 | snd_iprintf(buffer, "Ensoniq AudioPCI ES1371\n\n"); | ||
1892 | #endif | ||
1893 | snd_iprintf(buffer, "Joystick enable : %s\n", | 1903 | snd_iprintf(buffer, "Joystick enable : %s\n", |
1894 | ensoniq->ctrl & ES_JYSTK_EN ? "on" : "off"); | 1904 | ensoniq->ctrl & ES_JYSTK_EN ? "on" : "off"); |
1895 | #ifdef CHIP1370 | 1905 | #ifdef CHIP1370 |
@@ -2032,7 +2042,7 @@ static void snd_ensoniq_chip_init(struct ensoniq *ensoniq) | |||
2032 | synchronize_irq(ensoniq->irq); | 2042 | synchronize_irq(ensoniq->irq); |
2033 | } | 2043 | } |
2034 | 2044 | ||
2035 | #ifdef CONFIG_PM | 2045 | #ifdef CONFIG_PM_SLEEP |
2036 | static int snd_ensoniq_suspend(struct device *dev) | 2046 | static int snd_ensoniq_suspend(struct device *dev) |
2037 | { | 2047 | { |
2038 | struct pci_dev *pci = to_pci_dev(dev); | 2048 | struct pci_dev *pci = to_pci_dev(dev); |
@@ -2094,7 +2104,7 @@ static SIMPLE_DEV_PM_OPS(snd_ensoniq_pm, snd_ensoniq_suspend, snd_ensoniq_resume | |||
2094 | #define SND_ENSONIQ_PM_OPS &snd_ensoniq_pm | 2104 | #define SND_ENSONIQ_PM_OPS &snd_ensoniq_pm |
2095 | #else | 2105 | #else |
2096 | #define SND_ENSONIQ_PM_OPS NULL | 2106 | #define SND_ENSONIQ_PM_OPS NULL |
2097 | #endif /* CONFIG_PM */ | 2107 | #endif /* CONFIG_PM_SLEEP */ |
2098 | 2108 | ||
2099 | static int __devinit snd_ensoniq_create(struct snd_card *card, | 2109 | static int __devinit snd_ensoniq_create(struct snd_card *card, |
2100 | struct pci_dev *pci, | 2110 | struct pci_dev *pci, |
@@ -2361,11 +2371,7 @@ static int __devinit snd_ensoniq_midi(struct ensoniq * ensoniq, int device, | |||
2361 | *rrawmidi = NULL; | 2371 | *rrawmidi = NULL; |
2362 | if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0) | 2372 | if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0) |
2363 | return err; | 2373 | return err; |
2364 | #ifdef CHIP1370 | 2374 | strcpy(rmidi->name, CHIP_NAME); |
2365 | strcpy(rmidi->name, "ES1370"); | ||
2366 | #else | ||
2367 | strcpy(rmidi->name, "ES1371"); | ||
2368 | #endif | ||
2369 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_ensoniq_midi_output); | 2375 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_ensoniq_midi_output); |
2370 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_ensoniq_midi_input); | 2376 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_ensoniq_midi_input); |
2371 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | | 2377 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | |