Changeset 679 for GPL/trunk/alsa-kernel/pci/es1938.c
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (4 years ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-linux-3.2.102 (added) merged: 611-614 /GPL/branches/uniaud32-next (added) merged: 615-678
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/pci/es1938.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Driver for ESS Solo-1 (ES1938, ES1946, ES1969) soundcard … … 11 12 * TODO: 12 13 * Rewrite better spinlocks 13 *14 *15 * This program is free software; you can redistribute it and/or modify16 * it under the terms of the GNU General Public License as published by17 * the Free Software Foundation; either version 2 of the License, or18 * (at your option) any later version.19 *20 * This program is distributed in the hope that it will be useful,21 * but WITHOUT ANY WARRANTY; without even the implied warranty of22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the23 * GNU General Public License for more details.24 *25 * You should have received a copy of the GNU General Public License26 * along with this program; if not, write to the Free Software27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA28 *29 14 */ 30 15 … … 47 32 */ 48 33 34 #ifdef TARGET_OS2 35 #define KBUILD_MODNAME "es1938" 36 #endif 49 37 50 38 #include <linux/init.h> … … 53 41 #include <linux/slab.h> 54 42 #include <linux/gameport.h> 55 #include <linux/module param.h>43 #include <linux/module.h> 56 44 #include <linux/delay.h> 57 45 #include <linux/dma-mapping.h> 46 #include <linux/io.h> 58 47 #include <sound/core.h> 59 48 #include <sound/control.h> … … 64 53 #include <sound/tlv.h> 65 54 66 #include <asm/io.h>67 68 55 MODULE_AUTHOR("Jaromir Koutek <miri@punknet.cz>"); 69 56 MODULE_DESCRIPTION("ESS Solo-1"); … … 74 61 "{TerraTec,128i PCI}}"); 75 62 76 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))63 #if IS_REACHABLE(CONFIG_GAMEPORT) 77 64 #define SUPPORT_JOYSTICK 1 78 65 #endif … … 80 67 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 81 68 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 82 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */69 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 83 70 84 71 module_param_array(index, int, NULL, 0444); … … 237 224 struct gameport *gameport; 238 225 #endif 239 #ifdef CONFIG_PM 226 #ifdef CONFIG_PM_SLEEP 240 227 unsigned char saved_regs[SAVED_REG_SIZE]; 241 228 #endif … … 244 231 static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id); 245 232 246 static DEFINE_PCI_DEVICE_TABLE(snd_es1938_ids)= {233 static const struct pci_device_id snd_es1938_ids[] = { 247 234 { PCI_VDEVICE(ESS, 0x1969), 0, }, /* Solo-1 */ 248 235 { 0, } … … 255 242 #define GET_LOOP_TIMEOUT 0x01000 256 243 257 #undef REG_DEBUG258 244 /* ----------------------------------------------------------------- 259 245 * Write to a mixer register … … 266 252 outb(val, SLSB_REG(chip, MIXERDATA)); 267 253 spin_unlock_irqrestore(&chip->mixer_lock, flags); 268 #ifdef REG_DEBUG 269 snd_printk(KERN_DEBUG "Mixer reg %02x set to %02x\n", reg, val); 270 #endif 254 dev_dbg(chip->card->dev, "Mixer reg %02x set to %02x\n", reg, val); 271 255 } 272 256 … … 282 266 data = inb(SLSB_REG(chip, MIXERDATA)); 283 267 spin_unlock_irqrestore(&chip->mixer_lock, flags); 284 #ifdef REG_DEBUG 285 snd_printk(KERN_DEBUG "Mixer reg %02x now is %02x\n", reg, data); 286 #endif 268 dev_dbg(chip->card->dev, "Mixer reg %02x now is %02x\n", reg, data); 287 269 return data; 288 270 } … … 303 285 new = (old & ~mask) | (val & mask); 304 286 outb(new, SLSB_REG(chip, MIXERDATA)); 305 #ifdef REG_DEBUG 306 snd_printk(KERN_DEBUG"Mixer reg %02x was %02x, set to %02x\n",287 dev_dbg(chip->card->dev, 288 "Mixer reg %02x was %02x, set to %02x\n", 307 289 reg, old, new); 308 #endif309 290 } 310 291 spin_unlock_irqrestore(&chip->mixer_lock, flags); … … 325 306 } 326 307 } 327 printk(KERN_ERR "snd_es1938_write_cmd timeout (0x02%x/0x02%x)\n", cmd, v); 308 dev_err(chip->card->dev, 309 "snd_es1938_write_cmd timeout (0x02%x/0x02%x)\n", cmd, v); 328 310 } 329 311 … … 338 320 if ((v = inb(SLSB_REG(chip, STATUS))) & 0x80) 339 321 return inb(SLSB_REG(chip, READDATA)); 340 snd_printk(KERN_ERR"get_byte timeout: status 0x02%x\n", v);322 dev_err(chip->card->dev, "get_byte timeout: status 0x02%x\n", v); 341 323 return -ENODEV; 342 324 } … … 352 334 snd_es1938_write_cmd(chip, val); 353 335 spin_unlock_irqrestore(&chip->reg_lock, flags); 354 #ifdef REG_DEBUG 355 snd_printk(KERN_DEBUG "Reg %02x set to %02x\n", reg, val); 356 #endif 336 dev_dbg(chip->card->dev, "Reg %02x set to %02x\n", reg, val); 357 337 } 358 338 … … 369 349 val = snd_es1938_get_byte(chip); 370 350 spin_unlock_irqrestore(&chip->reg_lock, flags); 371 #ifdef REG_DEBUG 372 snd_printk(KERN_DEBUG "Reg %02x now is %02x\n", reg, val); 373 #endif 351 dev_dbg(chip->card->dev, "Reg %02x now is %02x\n", reg, val); 374 352 return val; 375 353 } … … 392 370 new = (old & ~mask) | (val & mask); 393 371 snd_es1938_write_cmd(chip, new); 394 #ifdef REG_DEBUG 395 snd_printk(KERN_DEBUG "Reg %02x was %02x, set to %02x\n", 372 dev_dbg(chip->card->dev, "Reg %02x was %02x, set to %02x\n", 396 373 reg, old, new); 397 #endif398 374 } 399 375 spin_unlock_irqrestore(&chip->reg_lock, flags); … … 417 393 } 418 394 } 419 snd_printk(KERN_ERR"ESS Solo-1 reset failed\n");395 dev_err(chip->card->dev, "ESS Solo-1 reset failed\n"); 420 396 421 397 __next: … … 449 425 } 450 426 451 static struct snd_ratnum clocks[2] = {427 static const struct snd_ratnum clocks[2] = { 452 428 { 453 429 .num = 793800, … … 464 440 }; 465 441 466 static struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = {442 static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { 467 443 .nrats = 2, 468 444 .rats = clocks, … … 852 828 853 829 static int snd_es1938_capture_copy(struct snd_pcm_substream *substream, 854 int channel, 855 snd_pcm_uframes_t pos, 856 void __user *dst, 857 snd_pcm_uframes_t count) 830 int channel, unsigned long pos, 831 void __user *dst, unsigned long count) 858 832 { 859 833 struct snd_pcm_runtime *runtime = substream->runtime; 860 834 struct es1938 *chip = snd_pcm_substream_chip(substream); 861 pos <<= chip->dma1_shift; 862 count <<= chip->dma1_shift; 835 863 836 if (snd_BUG_ON(pos + count > chip->dma1_size)) 864 837 return -EINVAL; … … 869 842 if (copy_to_user(dst, runtime->dma_area + pos + 1, count - 1)) 870 843 return -EFAULT; 871 if (put_user(runtime->dma_area[0], ((unsigned char __user *)dst) + count - 1)) 844 if (put_user(runtime->dma_area[0], 845 ((unsigned char __user *)dst) + count - 1)) 872 846 return -EFAULT; 873 847 } … … 875 849 } 876 850 877 /* 878 * buffer management 879 */ 880 static int snd_es1938_pcm_hw_params(struct snd_pcm_substream *substream, 881 struct snd_pcm_hw_params *hw_params) 882 883 { 884 int err; 885 886 if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) 887 return err; 888 return 0; 889 } 890 891 static int snd_es1938_pcm_hw_free(struct snd_pcm_substream *substream) 892 { 893 return snd_pcm_lib_free_pages(substream); 851 static int snd_es1938_capture_copy_kernel(struct snd_pcm_substream *substream, 852 int channel, unsigned long pos, 853 void *dst, unsigned long count) 854 { 855 struct snd_pcm_runtime *runtime = substream->runtime; 856 struct es1938 *chip = snd_pcm_substream_chip(substream); 857 858 if (snd_BUG_ON(pos + count > chip->dma1_size)) 859 return -EINVAL; 860 if (pos + count < chip->dma1_size) { 861 memcpy(dst, runtime->dma_area + pos + 1, count); 862 } else { 863 memcpy(dst, runtime->dma_area + pos + 1, count - 1); 864 runtime->dma_area[0] = *((unsigned char *)dst + count - 1); 865 } 866 return 0; 894 867 } 895 868 … … 897 870 * Audio1 Capture (ADC) 898 871 * ----------------------------------------------------------------------*/ 899 static struct snd_pcm_hardware snd_es1938_capture =872 static const struct snd_pcm_hardware snd_es1938_capture = 900 873 { 901 874 .info = (SNDRV_PCM_INFO_INTERLEAVED | … … 919 892 * Audio2 Playback (DAC) 920 893 * -----------------------------------------------------------------------*/ 921 static struct snd_pcm_hardware snd_es1938_playback =894 static const struct snd_pcm_hardware snd_es1938_playback = 922 895 { 923 896 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | … … 1005 978 } 1006 979 1007 static struct snd_pcm_ops snd_es1938_playback_ops = {980 static const struct snd_pcm_ops snd_es1938_playback_ops = { 1008 981 .open = snd_es1938_playback_open, 1009 982 .close = snd_es1938_playback_close, 1010 .ioctl = snd_pcm_lib_ioctl,1011 .hw_params = snd_es1938_pcm_hw_params,1012 .hw_free = snd_es1938_pcm_hw_free,1013 983 .prepare = snd_es1938_playback_prepare, 1014 984 .trigger = snd_es1938_playback_trigger, … … 1016 986 }; 1017 987 1018 static struct snd_pcm_ops snd_es1938_capture_ops = {988 static const struct snd_pcm_ops snd_es1938_capture_ops = { 1019 989 .open = snd_es1938_capture_open, 1020 990 .close = snd_es1938_capture_close, 1021 .ioctl = snd_pcm_lib_ioctl,1022 .hw_params = snd_es1938_pcm_hw_params,1023 .hw_free = snd_es1938_pcm_hw_free,1024 991 .prepare = snd_es1938_capture_prepare, 1025 992 .trigger = snd_es1938_capture_trigger, 1026 993 .pointer = snd_es1938_capture_pointer, 1027 .copy = snd_es1938_capture_copy, 994 .copy_user = snd_es1938_capture_copy, 995 .copy_kernel = snd_es1938_capture_copy_kernel, 1028 996 }; 1029 997 1030 static int __devinitsnd_es1938_new_pcm(struct es1938 *chip, int device)998 static int snd_es1938_new_pcm(struct es1938 *chip, int device) 1031 999 { 1032 1000 struct snd_pcm *pcm; … … 1042 1010 strcpy(pcm->name, "ESS Solo-1"); 1043 1011 1044 snd_pcm_ lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,1045 snd_dma_pci_data(chip->pci), 64*1024, 64*1024);1012 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, 1013 &chip->pci->dev, 64*1024, 64*1024); 1046 1014 1047 1015 chip->pcm = pcm; … … 1057 1025 struct snd_ctl_elem_info *uinfo) 1058 1026 { 1059 static c har *texts[8] = {1027 static const char * const texts[8] = { 1060 1028 "Mic", "Mic Master", "CD", "AOUT", 1061 1029 "Mic1", "Mix", "Line", "Master" 1062 1030 }; 1063 1031 1064 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1065 uinfo->count = 1; 1066 uinfo->value.enumerated.items = 8; 1067 if (uinfo->value.enumerated.item > 7) 1068 uinfo->value.enumerated.item = 7; 1069 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); 1070 return 0; 1032 return snd_ctl_enum_info(uinfo, 1, 8, texts); 1071 1033 } 1072 1034 … … 1322 1284 } 1323 1285 1286 #ifndef TARGET_OS2 1287 static const DECLARE_TLV_DB_RANGE(db_scale_master, 1288 0, 54, TLV_DB_SCALE_ITEM(-3600, 50, 1), 1289 54, 63, TLV_DB_SCALE_ITEM(-900, 100, 0), 1290 ); 1291 1292 static const DECLARE_TLV_DB_RANGE(db_scale_audio1, 1293 0, 8, TLV_DB_SCALE_ITEM(-3300, 300, 1), 1294 8, 15, TLV_DB_SCALE_ITEM(-900, 150, 0), 1295 ); 1296 1297 static const DECLARE_TLV_DB_RANGE(db_scale_audio2, 1298 0, 8, TLV_DB_SCALE_ITEM(-3450, 300, 1), 1299 8, 15, TLV_DB_SCALE_ITEM(-1050, 150, 0), 1300 ); 1301 1302 static const DECLARE_TLV_DB_RANGE(db_scale_mic, 1303 0, 8, TLV_DB_SCALE_ITEM(-2400, 300, 1), 1304 8, 15, TLV_DB_SCALE_ITEM(0, 150, 0), 1305 ); 1306 1307 static const DECLARE_TLV_DB_RANGE(db_scale_line, 1308 0, 8, TLV_DB_SCALE_ITEM(-3150, 300, 1), 1309 8, 15, TLV_DB_SCALE_ITEM(-750, 150, 0), 1310 ); 1311 #else 1324 1312 static unsigned int db_scale_master[] = { 1325 1313 TLV_DB_RANGE_HEAD(2), … … 1351 1339 8, 15, TLV_DB_SCALE_ITEM(-750, 150, 0), 1352 1340 }; 1341 #endif 1353 1342 1354 1343 static const DECLARE_TLV_DB_SCALE(db_scale_capture, 0, 150, 0); 1355 1344 1356 static struct snd_kcontrol_new snd_es1938_controls[] = {1345 static const struct snd_kcontrol_new snd_es1938_controls[] = { 1357 1346 ES1938_DOUBLE_TLV("Master Playback Volume", 0, 0x60, 0x62, 0, 0, 63, 0, 1358 1347 db_scale_master), … … 1462 1451 } 1463 1452 1464 #ifdef CONFIG_PM 1453 #ifdef CONFIG_PM_SLEEP 1465 1454 /* 1466 1455 * PM support 1467 1456 */ 1468 1457 1469 static unsigned char saved_regs[SAVED_REG_SIZE+1] = {1458 static const unsigned char saved_regs[SAVED_REG_SIZE+1] = { 1470 1459 0x14, 0x1a, 0x1c, 0x3a, 0x3c, 0x3e, 0x36, 0x38, 1471 1460 0x50, 0x52, 0x60, 0x61, 0x62, 0x63, 0x64, 0x68, … … 1475 1464 1476 1465 1477 static int es1938_suspend(struct pci_dev *pci, pm_message_t state)1478 { 1479 struct snd_card *card = pci_get_drvdata(pci);1466 static int es1938_suspend(struct device *dev) 1467 { 1468 struct snd_card *card = dev_get_drvdata(dev); 1480 1469 struct es1938 *chip = card->private_data; 1481 unsigned char *s, *d; 1470 const unsigned char *s; 1471 unsigned char *d; 1482 1472 1483 1473 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 1484 snd_pcm_suspend_all(chip->pcm);1485 1474 1486 1475 /* save mixer-related registers */ … … 1492 1481 free_irq(chip->irq, chip); 1493 1482 chip->irq = -1; 1494 } 1495 pci_disable_device(pci); 1496 pci_save_state(pci); 1497 pci_set_power_state(pci, pci_choose_state(pci, state)); 1498 return 0; 1499 } 1500 1501 static int es1938_resume(struct pci_dev *pci) 1502 { 1503 struct snd_card *card = pci_get_drvdata(pci); 1483 card->sync_irq = -1; 1484 } 1485 return 0; 1486 } 1487 1488 static int es1938_resume(struct device *dev) 1489 { 1490 struct pci_dev *pci = to_pci_dev(dev); 1491 struct snd_card *card = dev_get_drvdata(dev); 1504 1492 struct es1938 *chip = card->private_data; 1505 unsigned char *s, *d;1506 1507 pci_set_power_state(pci, PCI_D0); 1508 pci_restore_state(pci);1509 if (pci_enable_device(pci) < 0) {1510 printk(KERN_ERR "es1938: pci_enable_device failed, "1511 "disabling device\n");1493 const unsigned char *s; 1494 unsigned char *d; 1495 1496 if (request_irq(pci->irq, snd_es1938_interrupt, 1497 IRQF_SHARED, KBUILD_MODNAME, chip)) { 1498 dev_err(dev, "unable to grab IRQ %d, disabling device\n", 1499 pci->irq); 1512 1500 snd_card_disconnect(card); 1513 1501 return -EIO; 1514 1502 } 1515 1516 if (request_irq(pci->irq, snd_es1938_interrupt,1517 IRQF_SHARED, "ES1938", chip)) {1518 printk(KERN_ERR "es1938: unable to grab IRQ %d, "1519 "disabling device\n", pci->irq);1520 snd_card_disconnect(card);1521 return -EIO;1522 }1523 1503 chip->irq = pci->irq; 1504 card->sync_irq = chip->irq; 1524 1505 snd_es1938_chip_init(chip); 1525 1506 … … 1535 1516 return 0; 1536 1517 } 1537 #endif /* CONFIG_PM */ 1518 1519 static SIMPLE_DEV_PM_OPS(es1938_pm, es1938_suspend, es1938_resume); 1520 #define ES1938_PM_OPS &es1938_pm 1521 #else 1522 #define ES1938_PM_OPS NULL 1523 #endif /* CONFIG_PM_SLEEP */ 1538 1524 1539 1525 #ifdef SUPPORT_JOYSTICK 1540 static int __devinitsnd_es1938_create_gameport(struct es1938 *chip)1526 static int snd_es1938_create_gameport(struct es1938 *chip) 1541 1527 { 1542 1528 struct gameport *gp; … … 1544 1530 chip->gameport = gp = gameport_allocate_port(); 1545 1531 if (!gp) { 1546 printk(KERN_ERR "es1938: cannot allocate memory for gameport\n"); 1532 dev_err(chip->card->dev, 1533 "cannot allocate memory for gameport\n"); 1547 1534 return -ENOMEM; 1548 1535 } … … 1593 1580 } 1594 1581 1595 static int __devinitsnd_es1938_create(struct snd_card *card,1596 struct pci_dev *pci,1597 struct es1938 **rchip)1582 static int snd_es1938_create(struct snd_card *card, 1583 struct pci_dev *pci, 1584 struct es1938 **rchip) 1598 1585 { 1599 1586 struct es1938 *chip; 1600 1587 int err; 1601 static struct snd_device_ops ops = {1588 static const struct snd_device_ops ops = { 1602 1589 .dev_free = snd_es1938_dev_free, 1603 1590 }; … … 1609 1596 return err; 1610 1597 /* check, if we can restrict PCI DMA transfers to 24 bits */ 1611 if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || 1612 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { 1613 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 1598 if (dma_set_mask(&pci->dev, DMA_BIT_MASK(24)) < 0 || 1599 dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(24)) < 0) { 1600 dev_err(card->dev, 1601 "architecture does not support 24bit PCI busmaster DMA\n"); 1614 1602 pci_disable_device(pci); 1615 1603 return -ENXIO; … … 1637 1625 chip->game_port = pci_resource_start(pci, 4); 1638 1626 if (request_irq(pci->irq, snd_es1938_interrupt, IRQF_SHARED, 1639 "ES1938", chip)) {1640 snd_printk(KERN_ERR"unable to grab IRQ %d\n", pci->irq);1627 KBUILD_MODNAME, chip)) { 1628 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); 1641 1629 snd_es1938_free(chip); 1642 1630 return -EBUSY; 1643 1631 } 1644 1632 chip->irq = pci->irq; 1645 #ifdef ES1938_DDEBUG 1646 snd_printk(KERN_DEBUG "create: io: 0x%lx, sb: 0x%lx, vc: 0x%lx, mpu: 0x%lx, game: 0x%lx\n", 1633 card->sync_irq = chip->irq; 1634 dev_dbg(card->dev, 1635 "create: io: 0x%lx, sb: 0x%lx, vc: 0x%lx, mpu: 0x%lx, game: 0x%lx\n", 1647 1636 chip->io_port, chip->sb_port, chip->vc_port, chip->mpu_port, chip->game_port); 1648 #endif1649 1637 1650 1638 chip->ddma_port = chip->vc_port + 0x00; /* fix from Thomas Sailer */ … … 1656 1644 return err; 1657 1645 } 1658 1659 snd_card_set_dev(card, &pci->dev);1660 1646 1661 1647 *rchip = chip; … … 1669 1655 { 1670 1656 struct es1938 *chip = dev_id; 1671 unsigned char status, audiostatus; 1657 unsigned char status; 1658 __always_unused unsigned char audiostatus; 1672 1659 int handled = 0; 1673 1660 1674 1661 status = inb(SLIO_REG(chip, IRQCONTROL)); 1675 1662 #if 0 1676 printk(KERN_DEBUG "Es1938debug - interrupt status: =0x%x\n", status); 1663 dev_dbg(chip->card->dev, 1664 "Es1938debug - interrupt status: =0x%x\n", status); 1677 1665 #endif 1678 1666 … … 1680 1668 if (status & 0x10) { 1681 1669 #if 0 1682 printk(KERN_DEBUG 1670 dev_dbg(chip->card->dev, 1683 1671 "Es1938debug - AUDIO channel 1 interrupt\n"); 1684 printk(KERN_DEBUG1672 dev_dbg(chip->card->dev, 1685 1673 "Es1938debug - AUDIO channel 1 DMAC DMA count: %u\n", 1686 1674 inw(SLDM_REG(chip, DMACOUNT))); 1687 printk(KERN_DEBUG1675 dev_dbg(chip->card->dev, 1688 1676 "Es1938debug - AUDIO channel 1 DMAC DMA base: %u\n", 1689 1677 inl(SLDM_REG(chip, DMAADDR))); 1690 printk(KERN_DEBUG1678 dev_dbg(chip->card->dev, 1691 1679 "Es1938debug - AUDIO channel 1 DMAC DMA status: 0x%x\n", 1692 1680 inl(SLDM_REG(chip, DMASTATUS))); … … 1704 1692 if (status & 0x20) { 1705 1693 #if 0 1706 printk(KERN_DEBUG 1694 dev_dbg(chip->card->dev, 1707 1695 "Es1938debug - AUDIO channel 2 interrupt\n"); 1708 printk(KERN_DEBUG1696 dev_dbg(chip->card->dev, 1709 1697 "Es1938debug - AUDIO channel 2 DMAC DMA count: %u\n", 1710 1698 inw(SLIO_REG(chip, AUDIO2DMACOUNT))); 1711 printk(KERN_DEBUG1699 dev_dbg(chip->card->dev, 1712 1700 "Es1938debug - AUDIO channel 2 DMAC DMA base: %u\n", 1713 1701 inl(SLIO_REG(chip, AUDIO2DMAADDR))); … … 1753 1741 #define ES1938_DMA_SIZE 64 1754 1742 1755 static int __devinitsnd_es1938_mixer(struct es1938 *chip)1743 static int snd_es1938_mixer(struct es1938 *chip) 1756 1744 { 1757 1745 struct snd_card *card; … … 1791 1779 1792 1780 1793 static int __devinitsnd_es1938_probe(struct pci_dev *pci,1794 1781 static int snd_es1938_probe(struct pci_dev *pci, 1782 const struct pci_device_id *pci_id) 1795 1783 { 1796 1784 static int dev; … … 1807 1795 } 1808 1796 1809 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); 1797 err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, 1798 0, &card); 1810 1799 if (err < 0) 1811 1800 return err; … … 1842 1831 SLSB_REG(chip, FMHIGHADDR), 1843 1832 OPL3_HW_OPL3, 1, &opl3) < 0) { 1844 printk(KERN_ERR "es1938:OPL3 not detected at 0x%lx\n",1833 dev_err(card->dev, "OPL3 not detected at 0x%lx\n", 1845 1834 SLSB_REG(chip, FMLOWADDR)); 1846 1835 } else { … … 1855 1844 } 1856 1845 if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, 1857 chip->mpu_port, MPU401_INFO_INTEGRATED, 1858 chip->irq, 0, &chip->rmidi) < 0) { 1859 printk(KERN_ERR "es1938: unable to initialize MPU-401\n"); 1846 chip->mpu_port, 1847 MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK, 1848 -1, &chip->rmidi) < 0) { 1849 dev_err(card->dev, "unable to initialize MPU-401\n"); 1860 1850 } else { 1861 1851 // this line is vital for MIDI interrupt handling on ess-solo1 … … 1876 1866 } 1877 1867 1878 static void __devexitsnd_es1938_remove(struct pci_dev *pci)1868 static void snd_es1938_remove(struct pci_dev *pci) 1879 1869 { 1880 1870 snd_card_free(pci_get_drvdata(pci)); 1881 pci_set_drvdata(pci, NULL); 1882 } 1883 1884 static struct pci_driver driver = { 1885 .name = "ESS ES1938 (Solo-1)", 1871 } 1872 1873 static struct pci_driver es1938_driver = { 1874 .name = KBUILD_MODNAME, 1886 1875 .id_table = snd_es1938_ids, 1887 1876 .probe = snd_es1938_probe, 1888 .remove = __devexit_p(snd_es1938_remove), 1889 #ifdef CONFIG_PM 1890 .suspend = es1938_suspend, 1891 .resume = es1938_resume, 1892 #endif 1877 .remove = snd_es1938_remove, 1878 .driver = { 1879 .pm = ES1938_PM_OPS, 1880 }, 1893 1881 }; 1894 1882 1895 static int __init alsa_card_es1938_init(void) 1896 { 1897 return pci_register_driver(&driver); 1898 } 1899 1900 static void __exit alsa_card_es1938_exit(void) 1901 { 1902 pci_unregister_driver(&driver); 1903 } 1904 1905 module_init(alsa_card_es1938_init) 1906 module_exit(alsa_card_es1938_exit) 1883 module_pci_driver(es1938_driver);
Note:
See TracChangeset
for help on using the changeset viewer.