Ignore:
Timestamp:
Mar 18, 2021, 8:57:36 PM (4 years ago)
Author:
David Azarewicz
Message:

Merge changes from Paul's uniaud32next branch.

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/pci/es1938.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *  Driver for ESS Solo-1 (ES1938, ES1946, ES1969) soundcard
     
    1112 *  TODO:
    1213 *    Rewrite better spinlocks
    13  *
    14  *
    15  *   This program is free software; you can redistribute it and/or modify
    16  *   it under the terms of the GNU General Public License as published by
    17  *   the Free Software Foundation; either version 2 of the License, or
    18  *   (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 of
    22  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    23  *   GNU General Public License for more details.
    24  *
    25  *   You should have received a copy of the GNU General Public License
    26  *   along with this program; if not, write to the Free Software
    27  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    28  *
    2914 */
    3015
     
    4732*/
    4833
     34#ifdef TARGET_OS2
     35#define KBUILD_MODNAME "es1938"
     36#endif
    4937
    5038#include <linux/init.h>
     
    5341#include <linux/slab.h>
    5442#include <linux/gameport.h>
    55 #include <linux/moduleparam.h>
     43#include <linux/module.h>
    5644#include <linux/delay.h>
    5745#include <linux/dma-mapping.h>
     46#include <linux/io.h>
    5847#include <sound/core.h>
    5948#include <sound/control.h>
     
    6453#include <sound/tlv.h>
    6554
    66 #include <asm/io.h>
    67 
    6855MODULE_AUTHOR("Jaromir Koutek <miri@punknet.cz>");
    6956MODULE_DESCRIPTION("ESS Solo-1");
     
    7461                "{TerraTec,128i PCI}}");
    7562
    76 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
     63#if IS_REACHABLE(CONFIG_GAMEPORT)
    7764#define SUPPORT_JOYSTICK 1
    7865#endif
     
    8067static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
    8168static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
    82 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;      /* Enable this card */
     69static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;     /* Enable this card */
    8370
    8471module_param_array(index, int, NULL, 0444);
     
    237224        struct gameport *gameport;
    238225#endif
    239 #ifdef CONFIG_PM
     226#ifdef CONFIG_PM_SLEEP
    240227        unsigned char saved_regs[SAVED_REG_SIZE];
    241228#endif
     
    244231static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id);
    245232
    246 static DEFINE_PCI_DEVICE_TABLE(snd_es1938_ids) = {
     233static const struct pci_device_id snd_es1938_ids[] = {
    247234        { PCI_VDEVICE(ESS, 0x1969), 0, },   /* Solo-1 */
    248235        { 0, }
     
    255242#define GET_LOOP_TIMEOUT        0x01000
    256243
    257 #undef REG_DEBUG
    258244/* -----------------------------------------------------------------
    259245 * Write to a mixer register
     
    266252        outb(val, SLSB_REG(chip, MIXERDATA));
    267253        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);
    271255}
    272256
     
    282266        data = inb(SLSB_REG(chip, MIXERDATA));
    283267        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);
    287269        return data;
    288270}
     
    303285                new = (old & ~mask) | (val & mask);
    304286                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",
    307289                           reg, old, new);
    308 #endif
    309290        }
    310291        spin_unlock_irqrestore(&chip->mixer_lock, flags);
     
    325306                }
    326307        }
    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);
    328310}
    329311
     
    338320                if ((v = inb(SLSB_REG(chip, STATUS))) & 0x80)
    339321                        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);
    341323        return -ENODEV;
    342324}
     
    352334        snd_es1938_write_cmd(chip, val);
    353335        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);
    357337}
    358338
     
    369349        val = snd_es1938_get_byte(chip);
    370350        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);
    374352        return val;
    375353}
     
    392370                new = (old & ~mask) | (val & mask);
    393371                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",
    396373                           reg, old, new);
    397 #endif
    398374        }
    399375        spin_unlock_irqrestore(&chip->reg_lock, flags);
     
    417393                }
    418394        }
    419         snd_printk(KERN_ERR "ESS Solo-1 reset failed\n");
     395        dev_err(chip->card->dev, "ESS Solo-1 reset failed\n");
    420396
    421397     __next:
     
    449425}
    450426
    451 static struct snd_ratnum clocks[2] = {
     427static const struct snd_ratnum clocks[2] = {
    452428        {
    453429                .num = 793800,
     
    464440};
    465441
    466 static struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = {
     442static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = {
    467443        .nrats = 2,
    468444        .rats = clocks,
     
    852828
    853829static 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)
    858832{
    859833        struct snd_pcm_runtime *runtime = substream->runtime;
    860834        struct es1938 *chip = snd_pcm_substream_chip(substream);
    861         pos <<= chip->dma1_shift;
    862         count <<= chip->dma1_shift;
     835
    863836        if (snd_BUG_ON(pos + count > chip->dma1_size))
    864837                return -EINVAL;
     
    869842                if (copy_to_user(dst, runtime->dma_area + pos + 1, count - 1))
    870843                        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))
    872846                        return -EFAULT;
    873847        }
     
    875849}
    876850
    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);
     851static 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;
    894867}
    895868
     
    897870 * Audio1 Capture (ADC)
    898871 * ----------------------------------------------------------------------*/
    899 static struct snd_pcm_hardware snd_es1938_capture =
     872static const struct snd_pcm_hardware snd_es1938_capture =
    900873{
    901874        .info =                 (SNDRV_PCM_INFO_INTERLEAVED |
     
    919892 * Audio2 Playback (DAC)
    920893 * -----------------------------------------------------------------------*/
    921 static struct snd_pcm_hardware snd_es1938_playback =
     894static const struct snd_pcm_hardware snd_es1938_playback =
    922895{
    923896        .info =                 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
     
    1005978}
    1006979
    1007 static struct snd_pcm_ops snd_es1938_playback_ops = {
     980static const struct snd_pcm_ops snd_es1938_playback_ops = {
    1008981        .open =         snd_es1938_playback_open,
    1009982        .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,
    1013983        .prepare =      snd_es1938_playback_prepare,
    1014984        .trigger =      snd_es1938_playback_trigger,
     
    1016986};
    1017987
    1018 static struct snd_pcm_ops snd_es1938_capture_ops = {
     988static const struct snd_pcm_ops snd_es1938_capture_ops = {
    1019989        .open =         snd_es1938_capture_open,
    1020990        .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,
    1024991        .prepare =      snd_es1938_capture_prepare,
    1025992        .trigger =      snd_es1938_capture_trigger,
    1026993        .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,
    1028996};
    1029997
    1030 static int __devinit snd_es1938_new_pcm(struct es1938 *chip, int device)
     998static int snd_es1938_new_pcm(struct es1938 *chip, int device)
    1031999{
    10321000        struct snd_pcm *pcm;
     
    10421010        strcpy(pcm->name, "ESS Solo-1");
    10431011
    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);
    10461014
    10471015        chip->pcm = pcm;
     
    10571025                               struct snd_ctl_elem_info *uinfo)
    10581026{
    1059         static char *texts[8] = {
     1027        static const char * const texts[8] = {
    10601028                "Mic", "Mic Master", "CD", "AOUT",
    10611029                "Mic1", "Mix", "Line", "Master"
    10621030        };
    10631031
    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);
    10711033}
    10721034
     
    13221284}
    13231285
     1286#ifndef TARGET_OS2
     1287static 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
     1292static 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
     1297static 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
     1302static 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
     1307static 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
    13241312static unsigned int db_scale_master[] = {
    13251313        TLV_DB_RANGE_HEAD(2),
     
    13511339        8, 15, TLV_DB_SCALE_ITEM(-750, 150, 0),
    13521340};
     1341#endif
    13531342
    13541343static const DECLARE_TLV_DB_SCALE(db_scale_capture, 0, 150, 0);
    13551344
    1356 static struct snd_kcontrol_new snd_es1938_controls[] = {
     1345static const struct snd_kcontrol_new snd_es1938_controls[] = {
    13571346ES1938_DOUBLE_TLV("Master Playback Volume", 0, 0x60, 0x62, 0, 0, 63, 0,
    13581347                  db_scale_master),
     
    14621451}
    14631452
    1464 #ifdef CONFIG_PM
     1453#ifdef CONFIG_PM_SLEEP
    14651454/*
    14661455 * PM support
    14671456 */
    14681457
    1469 static unsigned char saved_regs[SAVED_REG_SIZE+1] = {
     1458static const unsigned char saved_regs[SAVED_REG_SIZE+1] = {
    14701459        0x14, 0x1a, 0x1c, 0x3a, 0x3c, 0x3e, 0x36, 0x38,
    14711460        0x50, 0x52, 0x60, 0x61, 0x62, 0x63, 0x64, 0x68,
     
    14751464
    14761465
    1477 static int es1938_suspend(struct pci_dev *pci, pm_message_t state)
    1478 {
    1479         struct snd_card *card = pci_get_drvdata(pci);
     1466static int es1938_suspend(struct device *dev)
     1467{
     1468        struct snd_card *card = dev_get_drvdata(dev);
    14801469        struct es1938 *chip = card->private_data;
    1481         unsigned char *s, *d;
     1470        const unsigned char *s;
     1471        unsigned char *d;
    14821472
    14831473        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
    1484         snd_pcm_suspend_all(chip->pcm);
    14851474
    14861475        /* save mixer-related registers */
     
    14921481                free_irq(chip->irq, chip);
    14931482                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
     1488static 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);
    15041492        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);
    15121500                snd_card_disconnect(card);
    15131501                return -EIO;
    15141502        }
    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         }
    15231503        chip->irq = pci->irq;
     1504        card->sync_irq = chip->irq;
    15241505        snd_es1938_chip_init(chip);
    15251506
     
    15351516        return 0;
    15361517}
    1537 #endif /* CONFIG_PM */
     1518
     1519static 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 */
    15381524
    15391525#ifdef SUPPORT_JOYSTICK
    1540 static int __devinit snd_es1938_create_gameport(struct es1938 *chip)
     1526static int snd_es1938_create_gameport(struct es1938 *chip)
    15411527{
    15421528        struct gameport *gp;
     
    15441530        chip->gameport = gp = gameport_allocate_port();
    15451531        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");
    15471534                return -ENOMEM;
    15481535        }
     
    15931580}
    15941581
    1595 static int __devinit snd_es1938_create(struct snd_card *card,
    1596                                     struct pci_dev * pci,
    1597                                     struct es1938 ** rchip)
     1582static int snd_es1938_create(struct snd_card *card,
     1583                             struct pci_dev *pci,
     1584                             struct es1938 **rchip)
    15981585{
    15991586        struct es1938 *chip;
    16001587        int err;
    1601         static struct snd_device_ops ops = {
     1588        static const struct snd_device_ops ops = {
    16021589                .dev_free =     snd_es1938_dev_free,
    16031590        };
     
    16091596                return err;
    16101597        /* 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");
    16141602                pci_disable_device(pci);
    16151603                return -ENXIO;
     
    16371625        chip->game_port = pci_resource_start(pci, 4);
    16381626        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);
    16411629                snd_es1938_free(chip);
    16421630                return -EBUSY;
    16431631        }
    16441632        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",
    16471636                   chip->io_port, chip->sb_port, chip->vc_port, chip->mpu_port, chip->game_port);
    1648 #endif
    16491637
    16501638        chip->ddma_port = chip->vc_port + 0x00;         /* fix from Thomas Sailer */
     
    16561644                return err;
    16571645        }
    1658 
    1659         snd_card_set_dev(card, &pci->dev);
    16601646
    16611647        *rchip = chip;
     
    16691655{
    16701656        struct es1938 *chip = dev_id;
    1671         unsigned char status, audiostatus;
     1657        unsigned char status;
     1658        __always_unused unsigned char audiostatus;
    16721659        int handled = 0;
    16731660
    16741661        status = inb(SLIO_REG(chip, IRQCONTROL));
    16751662#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);
    16771665#endif
    16781666       
     
    16801668        if (status & 0x10) {
    16811669#if 0
    1682                 printk(KERN_DEBUG
     1670                dev_dbg(chip->card->dev,
    16831671                       "Es1938debug - AUDIO channel 1 interrupt\n");
    1684                 printk(KERN_DEBUG
     1672                dev_dbg(chip->card->dev,
    16851673                       "Es1938debug - AUDIO channel 1 DMAC DMA count: %u\n",
    16861674                       inw(SLDM_REG(chip, DMACOUNT)));
    1687                 printk(KERN_DEBUG
     1675                dev_dbg(chip->card->dev,
    16881676                       "Es1938debug - AUDIO channel 1 DMAC DMA base: %u\n",
    16891677                       inl(SLDM_REG(chip, DMAADDR)));
    1690                 printk(KERN_DEBUG
     1678                dev_dbg(chip->card->dev,
    16911679                       "Es1938debug - AUDIO channel 1 DMAC DMA status: 0x%x\n",
    16921680                       inl(SLDM_REG(chip, DMASTATUS)));
     
    17041692        if (status & 0x20) {
    17051693#if 0
    1706                 printk(KERN_DEBUG
     1694                dev_dbg(chip->card->dev,
    17071695                       "Es1938debug - AUDIO channel 2 interrupt\n");
    1708                 printk(KERN_DEBUG
     1696                dev_dbg(chip->card->dev,
    17091697                       "Es1938debug - AUDIO channel 2 DMAC DMA count: %u\n",
    17101698                       inw(SLIO_REG(chip, AUDIO2DMACOUNT)));
    1711                 printk(KERN_DEBUG
     1699                dev_dbg(chip->card->dev,
    17121700                       "Es1938debug - AUDIO channel 2 DMAC DMA base: %u\n",
    17131701                       inl(SLIO_REG(chip, AUDIO2DMAADDR)));
     
    17531741#define ES1938_DMA_SIZE 64
    17541742
    1755 static int __devinit snd_es1938_mixer(struct es1938 *chip)
     1743static int snd_es1938_mixer(struct es1938 *chip)
    17561744{
    17571745        struct snd_card *card;
     
    17911779       
    17921780
    1793 static int __devinit snd_es1938_probe(struct pci_dev *pci,
    1794                                       const struct pci_device_id *pci_id)
     1781static int snd_es1938_probe(struct pci_dev *pci,
     1782                            const struct pci_device_id *pci_id)
    17951783{
    17961784        static int dev;
     
    18071795        }
    18081796
    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);
    18101799        if (err < 0)
    18111800                return err;
     
    18421831                            SLSB_REG(chip, FMHIGHADDR),
    18431832                            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",
    18451834                           SLSB_REG(chip, FMLOWADDR));
    18461835        } else {
     
    18551844        }
    18561845        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");
    18601850        } else {
    18611851                // this line is vital for MIDI interrupt handling on ess-solo1
     
    18761866}
    18771867
    1878 static void __devexit snd_es1938_remove(struct pci_dev *pci)
     1868static void snd_es1938_remove(struct pci_dev *pci)
    18791869{
    18801870        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
     1873static struct pci_driver es1938_driver = {
     1874        .name = KBUILD_MODNAME,
    18861875        .id_table = snd_es1938_ids,
    18871876        .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        },
    18931881};
    18941882
    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)
     1883module_pci_driver(es1938_driver);
Note: See TracChangeset for help on using the changeset viewer.