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

  • TabularUnified GPL/trunk/alsa-kernel/pci/trident/trident.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *  Driver for Trident 4DWave DX/NX & SiS SI7018 Audio PCI soundcard
     
    45 *  Driver was originated by Trident <audio@tridentmicro.com>
    56 *                           Fri Feb 19 15:55:28 MST 1999
    6  *
    7  *
    8  *   This program is free software; you can redistribute it and/or modify
    9  *   it under the terms of the GNU General Public License as published by
    10  *   the Free Software Foundation; either version 2 of the License, or
    11  *   (at your option) any later version.
    12  *
    13  *   This program is distributed in the hope that it will be useful,
    14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  *   GNU General Public License for more details.
    17  *
    18  *   You should have received a copy of the GNU General Public License
    19  *   along with this program; if not, write to the Free Software
    20  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    21  *
    227 */
    238
     
    2510#include <linux/pci.h>
    2611#include <linux/time.h>
    27 #include <linux/moduleparam.h>
     12#include <linux/module.h>
    2813#include <sound/core.h>
    29 #include <sound/trident.h>
     14#include "trident.h"
    3015#include <sound/initval.h>
     16
     17#ifdef TARGET_OS2
     18#define KBUILD_MODNAME "trident"
     19#endif
    3120
    3221MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, <audio@tridentmicro.com>");
     
    4837static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
    4938static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
    50 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;      /* Enable this card */
     39static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;     /* Enable this card */
    5140#ifndef TARGET_OS2
    5241static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 32};
     
    6857MODULE_PARM_DESC(wavetable_size, "Maximum memory size in kB for wavetable synth.");
    6958
    70 static DEFINE_PCI_DEVICE_TABLE(snd_trident_ids) = {
     59static const struct pci_device_id snd_trident_ids[] = {
    7160        {PCI_DEVICE(PCI_VENDOR_ID_TRIDENT, PCI_DEVICE_ID_TRIDENT_4DWAVE_DX),
    7261                PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0},
     
    7968MODULE_DEVICE_TABLE(pci, snd_trident_ids);
    8069
    81 static int __devinit snd_trident_probe(struct pci_dev *pci,
    82                                        const struct pci_device_id *pci_id)
     70static int snd_trident_probe(struct pci_dev *pci,
     71                             const struct pci_device_id *pci_id)
    8372{
    8473        static int dev;
     
    9584        }
    9685
    97         err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
     86        err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
     87                           0, &card);
    9888        if (err < 0)
    9989                return err;
     
    128118                strcpy(card->shortname, "Trident ");
    129119        }
    130         strcat(card->shortname, card->driver);
     120        strcat(card->shortname, str);
    131121        sprintf(card->longname, "%s PCI Audio at 0x%lx, irq %d",
    132122                card->shortname, trident->port, trident->irq);
    133123
    134         if ((err = snd_trident_pcm(trident, pcm_dev++, NULL)) < 0) {
     124        if ((err = snd_trident_pcm(trident, pcm_dev++)) < 0) {
    135125                snd_card_free(card);
    136126                return err;
     
    139129        case TRIDENT_DEVICE_ID_DX:
    140130        case TRIDENT_DEVICE_ID_NX:
    141                 if ((err = snd_trident_foldback_pcm(trident, pcm_dev++, NULL)) < 0) {
     131                if ((err = snd_trident_foldback_pcm(trident, pcm_dev++)) < 0) {
    142132                        snd_card_free(card);
    143133                        return err;
     
    146136        }
    147137        if (trident->device == TRIDENT_DEVICE_ID_NX || trident->device == TRIDENT_DEVICE_ID_SI7018) {
    148                 if ((err = snd_trident_spdif_pcm(trident, pcm_dev++, NULL)) < 0) {
     138                if ((err = snd_trident_spdif_pcm(trident, pcm_dev++)) < 0) {
    149139                        snd_card_free(card);
    150140                        return err;
     
    154144            (err = snd_mpu401_uart_new(card, 0, MPU401_HW_TRID4DWAVE,
    155145                                       trident->midi_port,
    156                                        MPU401_INFO_INTEGRATED,
    157                                        trident->irq, 0, &trident->rmidi)) < 0) {
     146                                       MPU401_INFO_INTEGRATED |
     147                                       MPU401_INFO_IRQ_HOOK,
     148                                       -1, &trident->rmidi)) < 0) {
    158149                snd_card_free(card);
    159150                return err;
     
    171162}
    172163
    173 static void __devexit snd_trident_remove(struct pci_dev *pci)
     164static void snd_trident_remove(struct pci_dev *pci)
    174165{
    175166        snd_card_free(pci_get_drvdata(pci));
    176         pci_set_drvdata(pci, NULL);
    177167}
    178168
    179 static struct pci_driver driver = {
    180         .name = "Trident4DWaveAudio",
     169static struct pci_driver trident_driver = {
     170        .name = KBUILD_MODNAME,
    181171        .id_table = snd_trident_ids,
    182172        .probe = snd_trident_probe,
    183         .remove = __devexit_p(snd_trident_remove),
    184 #ifdef CONFIG_PM
    185         .suspend = snd_trident_suspend,
    186         .resume = snd_trident_resume,
     173        .remove = snd_trident_remove,
     174#ifdef CONFIG_PM_SLEEP
     175        .driver = {
     176                .pm = &snd_trident_pm,
     177        },
    187178#endif
    188179};
    189180
    190 static int __init alsa_card_trident_init(void)
    191 {
    192         return pci_register_driver(&driver);
    193 }
    194 
    195 static void __exit alsa_card_trident_exit(void)
    196 {
    197         pci_unregister_driver(&driver);
    198 }
    199 
    200 module_init(alsa_card_trident_init)
    201 module_exit(alsa_card_trident_exit)
     181module_pci_driver(trident_driver);
Note: See TracChangeset for help on using the changeset viewer.