Changeset 112 for GPL/branches/alsa-resync1/alsa-kernel/pci/sonicvibes.c
- Timestamp:
- May 31, 2007, 6:45:32 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/alsa-resync1/alsa-kernel/pci/sonicvibes.c
r77 r112 19 19 * You should have received a copy of the GNU General Public License 20 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 22 * 23 23 */ 24 24 25 #define SNDRV_MAIN_OBJECT_FILE26 25 #include <sound/driver.h> 26 #include <asm/io.h> 27 #include <linux/delay.h> 28 #include <linux/init.h> 29 #include <linux/slab.h> 30 #include <sound/core.h> 27 31 #include <sound/pcm.h> 28 32 #include <sound/info.h> … … 32 36 #define SNDRV_GET_ID 33 37 #include <sound/initval.h> 38 #ifndef LINUX_2_2 39 #include <linux/gameport.h> 40 #endif 34 41 35 42 EXPORT_NO_SYMBOLS; 43 44 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 36 45 MODULE_DESCRIPTION("S3 SonicVibes PCI"); 46 MODULE_LICENSE("GPL"); 37 47 MODULE_CLASSES("{sound}"); 38 48 MODULE_DEVICES("{{S3,SonicVibes PCI}}"); … … 47 57 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 48 58 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 49 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE ; /* Enable this card */59 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 50 60 #ifdef TARGET_OS2 51 61 static int snd_reverb[SNDRV_CARDS] = {0,0,0,0,0,0,0,0}; … … 250 260 snd_kcontrol_t *master_mute; 251 261 snd_kcontrol_t *master_volume; 262 263 #ifndef LINUX_2_2 264 struct gameport gameport; 265 #endif 252 266 }; 253 267 … … 940 954 } 941 955 942 static int __ init snd_sonicvibes_pcm(sonicvibes_t * sonic, int device, snd_pcm_t ** rpcm)956 static int __devinit snd_sonicvibes_pcm(sonicvibes_t * sonic, int device, snd_pcm_t ** rpcm) 943 957 { 944 958 snd_pcm_t *pcm; … … 1179 1193 #define SONICVIBES_CONTROLS (sizeof(snd_sonicvibes_controls)/sizeof(snd_kcontrol_new_t)) 1180 1194 1181 static snd_kcontrol_new_t snd_sonicvibes_controls[] = {1195 static snd_kcontrol_new_t snd_sonicvibes_controls[] __devinitdata = { 1182 1196 SONICVIBES_DOUBLE("Capture Volume", 0, SV_IREG_LEFT_ADC, SV_IREG_RIGHT_ADC, 0, 0, 15, 0), 1183 1197 SONICVIBES_DOUBLE("Aux Playback Switch", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 7, 7, 1, 1), … … 1210 1224 } 1211 1225 1212 static int __ init snd_sonicvibes_mixer(sonicvibes_t * sonic)1226 static int __devinit snd_sonicvibes_mixer(sonicvibes_t * sonic) 1213 1227 { 1214 1228 snd_card_t *card; … … 1265 1279 } 1266 1280 1267 static void __ init snd_sonicvibes_proc_init(sonicvibes_t * sonic)1281 static void __devinit snd_sonicvibes_proc_init(sonicvibes_t * sonic) 1268 1282 { 1269 1283 snd_info_entry_t *entry; … … 1295 1309 */ 1296 1310 1297 static snd_kcontrol_new_t snd_sonicvibes_game_control =1311 static snd_kcontrol_new_t snd_sonicvibes_game_control __devinitdata = 1298 1312 SONICVIBES_SINGLE("Joystick Speed", 0, SV_IREG_GAME_PORT, 1, 15, 0); 1299 1313 1300 1314 static int snd_sonicvibes_free(sonicvibes_t *sonic) 1301 1315 { 1316 #ifndef LINUX_2_2 1317 if (sonic->gameport.io) 1318 gameport_unregister_port(&sonic->gameport); 1319 #endif 1302 1320 snd_sonicvibes_proc_done(sonic); 1303 1321 pci_write_config_dword(sonic->pci, 0x40, sonic->dmaa_port); 1304 1322 pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port); 1305 if (sonic->res_sb_port) 1323 if (sonic->res_sb_port) { 1306 1324 release_resource(sonic->res_sb_port); 1307 if (sonic->res_enh_port) 1325 kfree_nocheck(sonic->res_sb_port); 1326 } 1327 if (sonic->res_enh_port) { 1308 1328 release_resource(sonic->res_enh_port); 1309 if (sonic->res_synth_port) 1329 kfree_nocheck(sonic->res_enh_port); 1330 } 1331 if (sonic->res_synth_port) { 1310 1332 release_resource(sonic->res_synth_port); 1311 if (sonic->res_midi_port) 1333 kfree_nocheck(sonic->res_synth_port); 1334 } 1335 if (sonic->res_midi_port) { 1312 1336 release_resource(sonic->res_midi_port); 1313 if (sonic->res_dmaa) 1337 kfree_nocheck(sonic->res_midi_port); 1338 } 1339 if (sonic->res_dmaa) { 1314 1340 release_resource(sonic->res_dmaa); 1315 if (sonic->res_dmac) 1341 kfree_nocheck(sonic->res_dmaa); 1342 } 1343 if (sonic->res_dmac) { 1316 1344 release_resource(sonic->res_dmac); 1345 kfree_nocheck(sonic->res_dmac); 1346 } 1317 1347 if (sonic->irq >= 0) 1318 1348 free_irq(sonic->irq, (void *)sonic); … … 1327 1357 } 1328 1358 1329 static int __ init snd_sonicvibes_create(snd_card_t * card,1359 static int __devinit snd_sonicvibes_create(snd_card_t * card, 1330 1360 struct pci_dev *pci, 1331 1361 int reverb, … … 1496 1526 #define SONICVIBES_MIDI_CONTROLS (sizeof(snd_sonicvibes_midi_controls)/sizeof(snd_kcontrol_new_t)) 1497 1527 1498 static snd_kcontrol_new_t snd_sonicvibes_midi_controls[] = {1528 static snd_kcontrol_new_t snd_sonicvibes_midi_controls[] __devinitdata = { 1499 1529 SONICVIBES_SINGLE("SonicVibes Wave Source RAM", 0, SV_IREG_WAVE_SOURCE, 0, 1, 0), 1500 1530 SONICVIBES_SINGLE("SonicVibes Wave Source RAM+ROM", 0, SV_IREG_WAVE_SOURCE, 1, 1, 0), … … 1504 1534 }; 1505 1535 1506 static voidsnd_sonicvibes_midi_input_open(mpu401_t * mpu)1507 { 1508 sonicvibes_t *sonic = snd_magic_cast(sonicvibes_t, mpu->private_data, return );1536 static int snd_sonicvibes_midi_input_open(mpu401_t * mpu) 1537 { 1538 sonicvibes_t *sonic = snd_magic_cast(sonicvibes_t, mpu->private_data, return -EIO); 1509 1539 outb(sonic->irqmask &= ~SV_MIDI_MASK, SV_REG(sonic, IRQMASK)); 1540 return 0; 1510 1541 } 1511 1542 … … 1516 1547 } 1517 1548 1518 static int snd_sonicvibes_midi(sonicvibes_t * sonic, snd_rawmidi_t * rmidi)1549 static int __devinit snd_sonicvibes_midi(sonicvibes_t * sonic, snd_rawmidi_t * rmidi) 1519 1550 { 1520 1551 mpu401_t * mpu = snd_magic_cast(mpu401_t, rmidi->private_data, return -ENXIO); … … 1533 1564 } 1534 1565 1535 static int __ init snd_sonic_probe(struct pci_dev *pci,1566 static int __devinit snd_sonic_probe(struct pci_dev *pci, 1536 1567 const struct pci_device_id *id) 1537 1568 { 1538 static int dev = 0;1569 static int dev; 1539 1570 snd_card_t *card; 1540 1571 sonicvibes_t *sonic; … … 1543 1574 int idx, err; 1544 1575 1545 for ( ; dev < SNDRV_CARDS; dev++) { 1576 if (dev >= SNDRV_CARDS) 1577 return -ENODEV; 1546 1578 if (!snd_enable[dev]) { 1547 1579 dev++; 1548 1580 return -ENOENT; 1549 1581 } 1550 break;1551 }1552 if (dev >= SNDRV_CARDS)1553 return -ENODEV;1554 1582 1555 1583 card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE, 0); … … 1596 1624 return err; 1597 1625 } 1626 #ifndef LINUX_2_2 1627 sonic->gameport.io = sonic->game_port; 1628 gameport_register_port(&sonic->gameport); 1629 #endif 1598 1630 strcpy(card->driver, "SonicVibes"); 1599 1631 strcpy(card->shortname, "S3 SonicVibes"); … … 1609 1641 } 1610 1642 1611 PCI_SET_DRIVER_DATA(pci, card);1643 pci_set_drvdata(pci, card); 1612 1644 dev++; 1613 1645 return 0; 1614 1646 } 1615 1647 1616 static void __ exit snd_sonic_remove(struct pci_dev *pci)1617 { 1618 snd_card_free( PCI_GET_DRIVER_DATA(pci));1619 PCI_SET_DRIVER_DATA(pci, NULL);1648 static void __devexit snd_sonic_remove(struct pci_dev *pci) 1649 { 1650 snd_card_free(pci_get_drvdata(pci)); 1651 pci_set_drvdata(pci, NULL); 1620 1652 } 1621 1653 … … 1632 1664 id_table: snd_sonic_ids, 1633 1665 probe: snd_sonic_probe, 1634 remove: snd_sonic_remove,1666 remove: __devexit_p(snd_sonic_remove), 1635 1667 #endif 1636 1668 }; … … 1642 1674 if ((err = pci_module_init(&driver)) < 0) { 1643 1675 #ifdef MODULE 1644 // snd_printk("S3 SonicVibes soundcard not found or device busy\n");1676 // printk(KERN_ERR "S3 SonicVibes soundcard not found or device busy\n"); 1645 1677 #endif 1646 1678 return err; … … 1659 1691 #ifndef MODULE 1660 1692 1661 /* format is: snd- card-sonicvibes=snd_enable,snd_index,snd_id,1693 /* format is: snd-sonicvibes=snd_enable,snd_index,snd_id, 1662 1694 snd_reverb,snd_mge,snd_dmaio */ 1663 1695 … … 1678 1710 } 1679 1711 1680 __setup("snd- card-sonicvibes=", alsa_card_sonicvibes_setup);1712 __setup("snd-sonicvibes=", alsa_card_sonicvibes_setup); 1681 1713 1682 1714 #endif /* ifndef MODULE */
Note:
See TracChangeset
for help on using the changeset viewer.