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/isa/cs423x/cs4231.c

    r410 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *  Generic driver for CS4231 chips
     
    45 *  Originally the CS4232/CS4232A driver, modified for use on CS4231 by
    56 *  Tugrul Galatali <galatalt@stuy.edu>
    6  *
    7  *   This program is free software; you can redistribute it and/or modify
    8  *   it under the terms of the GNU General Public License as published by
    9  *   the Free Software Foundation; either version 2 of the License, or
    10  *   (at your option) any later version.
    11  *
    12  *   This program is distributed in the hope that it will be useful,
    13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15  *   GNU General Public License for more details.
    16  *
    17  *   You should have received a copy of the GNU General Public License
    18  *   along with this program; if not, write to the Free Software
    19  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    20  *
    217 */
    228
     
    2612#include <linux/time.h>
    2713#include <linux/wait.h>
    28 #include <linux/moduleparam.h>
     14#include <linux/module.h>
    2915#include <sound/core.h>
    3016#include <sound/wss.h>
     
    4228static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
    4329static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
    44 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;  /* Enable this card */
     30static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
    4531static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;     /* PnP setup */
    4632static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
     
    5642module_param_array(enable, bool, NULL, 0444);
    5743MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard.");
    58 module_param_array(port, long, NULL, 0444);
     44module_param_hw_array(port, long, ioport, NULL, 0444);
    5945MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver.");
    60 module_param_array(mpu_port, long, NULL, 0444);
     46module_param_hw_array(mpu_port, long, ioport, NULL, 0444);
    6147MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " CRD_NAME " driver.");
    62 module_param_array(irq, int, NULL, 0444);
     48module_param_hw_array(irq, int, irq, NULL, 0444);
    6349MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver.");
    64 module_param_array(mpu_irq, int, NULL, 0444);
     50module_param_hw_array(mpu_irq, int, irq, NULL, 0444);
    6551MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " CRD_NAME " driver.");
    66 module_param_array(dma1, int, NULL, 0444);
     52module_param_hw_array(dma1, int, dma, NULL, 0444);
    6753MODULE_PARM_DESC(dma1, "DMA1 # for " CRD_NAME " driver.");
    68 module_param_array(dma2, int, NULL, 0444);
     54module_param_hw_array(dma2, int, dma, NULL, 0444);
    6955MODULE_PARM_DESC(dma2, "DMA2 # for " CRD_NAME " driver.");
    7056
    71 static int __devinit snd_cs4231_match(struct device *dev, unsigned int n)
     57static int snd_cs4231_match(struct device *dev, unsigned int n)
    7258{
    7359        if (!enable[n])
     
    8975}
    9076
    91 static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n)
     77static int snd_cs4231_probe(struct device *dev, unsigned int n)
    9278{
    9379        struct snd_card *card;
    9480        struct snd_wss *chip;
    95         struct snd_pcm *pcm;
    9681        int error;
    9782
    98         error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
     83        error = snd_card_new(dev, index[n], id[n], THIS_MODULE, 0, &card);
    9984        if (error < 0)
    10085                return error;
     
    10792        card->private_data = chip;
    10893
    109         error = snd_wss_pcm(chip, 0, &pcm);
     94        error = snd_wss_pcm(chip, 0);
    11095        if (error < 0)
    11196                goto out;
    11297
    113         strcpy(card->driver, "CS4231");
    114         strcpy(card->shortname, pcm->name);
     98        strlcpy(card->driver, "CS4231", sizeof(card->driver));
     99        strlcpy(card->shortname, chip->pcm->name, sizeof(card->shortname));
    115100
    116         sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
    117                 pcm->name, chip->port, irq[n], dma1[n]);
    118         if (dma2[n] >= 0)
    119                 sprintf(card->longname + strlen(card->longname), "&%d", dma2[n]);
     101        if (dma2[n] < 0)
     102                snprintf(card->longname, sizeof(card->longname),
     103                         "%s at 0x%lx, irq %d, dma %d",
     104                         chip->pcm->name, chip->port, irq[n], dma1[n]);
     105        else
     106                snprintf(card->longname, sizeof(card->longname),
     107                         "%s at 0x%lx, irq %d, dma %d&%d",
     108                         chip->pcm->name, chip->port, irq[n], dma1[n], dma2[n]);
    120109
    121110        error = snd_wss_mixer(chip);
     
    123112                goto out;
    124113
    125         error = snd_wss_timer(chip, 0, NULL);
     114        error = snd_wss_timer(chip, 0);
    126115        if (error < 0)
    127116                goto out;
     
    132121                if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232,
    133122                                        mpu_port[n], 0, mpu_irq[n],
    134                                         mpu_irq[n] >= 0 ? IRQF_DISABLED : 0,
    135123                                        NULL) < 0)
    136124                        dev_warn(dev, "MPU401 not detected\n");
    137125        }
    138 
    139         snd_card_set_dev(card, dev);
    140126
    141127        error = snd_card_register(card);
     
    150136}
    151137
    152 static int __devexit snd_cs4231_remove(struct device *dev, unsigned int n)
     138static int snd_cs4231_remove(struct device *dev, unsigned int n)
    153139{
    154140        snd_card_free(dev_get_drvdata(dev));
    155         dev_set_drvdata(dev, NULL);
    156141        return 0;
    157142}
     
    182167        .match          = snd_cs4231_match,
    183168        .probe          = snd_cs4231_probe,
    184         .remove         = __devexit_p(snd_cs4231_remove),
     169        .remove         = snd_cs4231_remove,
    185170#ifdef CONFIG_PM
    186171        .suspend        = snd_cs4231_suspend,
     
    192177};
    193178
    194 static int __init alsa_card_cs4231_init(void)
    195 {
    196         return isa_register_driver(&snd_cs4231_driver, SNDRV_CARDS);
    197 }
    198 
    199 static void __exit alsa_card_cs4231_exit(void)
    200 {
    201         isa_unregister_driver(&snd_cs4231_driver);
    202 }
    203 
    204 module_init(alsa_card_cs4231_init);
    205 module_exit(alsa_card_cs4231_exit);
     179module_isa_driver(snd_cs4231_driver, SNDRV_CARDS);
Note: See TracChangeset for help on using the changeset viewer.