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/gus/interwave.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *  Driver for AMD InterWave soundcard
    34 *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
    45 *
    5  *
    6  *   This program is free software; you can redistribute it and/or modify
    7  *   it under the terms of the GNU General Public License as published by
    8  *   the Free Software Foundation; either version 2 of the License, or
    9  *   (at your option) any later version.
    10  *
    11  *   This program is distributed in the hope that it will be useful,
    12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  *   GNU General Public License for more details.
    15  *
    16  *   You should have received a copy of the GNU General Public License
    17  *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    19  *
    206 *   1999/07/22         Erik Inge Bolso <knan@mo.himolde.no>
    217 *                      * mixer group handlers
    22  *
    238 */
    249
     
    2813#include <linux/delay.h>
    2914#include <linux/pnp.h>
    30 #include <linux/moduleparam.h>
     15#include <linux/module.h>
    3116#include <asm/dma.h>
    3217#include <sound/core.h>
     
    5641static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
    5742static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
    58 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
     43static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
    5944#ifdef CONFIG_PNP
    60 static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
     45static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
    6146#endif
    6247static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;     /* 0x210,0x220,0x230,0x240,0x250,0x260 */
     
    9378MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard.");
    9479#endif
    95 module_param_array(port, long, NULL, 0444);
     80module_param_hw_array(port, long, ioport, NULL, 0444);
    9681MODULE_PARM_DESC(port, "Port # for InterWave driver.");
    9782#ifdef SNDRV_STB
    98 module_param_array(port_tc, long, NULL, 0444);
     83module_param_hw_array(port_tc, long, ioport, NULL, 0444);
    9984MODULE_PARM_DESC(port_tc, "Tone control (TEA6330T - i2c bus) port # for InterWave driver.");
    10085#endif
    101 module_param_array(irq, int, NULL, 0444);
     86module_param_hw_array(irq, int, irq, NULL, 0444);
    10287MODULE_PARM_DESC(irq, "IRQ # for InterWave driver.");
    103 module_param_array(dma1, int, NULL, 0444);
     88module_param_hw_array(dma1, int, dma, NULL, 0444);
    10489MODULE_PARM_DESC(dma1, "DMA1 # for InterWave driver.");
    105 module_param_array(dma2, int, NULL, 0444);
     90module_param_hw_array(dma2, int, dma, NULL, 0444);
    10691MODULE_PARM_DESC(dma2, "DMA2 # for InterWave driver.");
    10792module_param_array(joystick_dac, int, NULL, 0444);
     
    137122static int pnp_registered;
    138123
    139 static struct pnp_card_device_id snd_interwave_pnpids[] = {
     124static const struct pnp_card_device_id snd_interwave_pnpids[] = {
    140125#ifndef SNDRV_STB
    141126        /* Gravis UltraSound Plug & Play */
     
    208193};
    209194
    210 static int __devinit snd_interwave_detect_stb(struct snd_interwave *iwcard,
    211                                               struct snd_gus_card * gus, int dev,
    212                                               struct snd_i2c_bus **rbus)
     195static int snd_interwave_detect_stb(struct snd_interwave *iwcard,
     196                                    struct snd_gus_card *gus, int dev,
     197                                    struct snd_i2c_bus **rbus)
    213198{
    214199        unsigned long port;
     
    250235#endif
    251236
    252 static int __devinit snd_interwave_detect(struct snd_interwave *iwcard,
    253                                           struct snd_gus_card * gus,
    254                                           int dev
    255 #ifdef SNDRV_STB
    256                                           , struct snd_i2c_bus **rbus
     237static int snd_interwave_detect(struct snd_interwave *iwcard,
     238                                struct snd_gus_card *gus,
     239                                int dev
     240#ifdef SNDRV_STB
     241                                , struct snd_i2c_bus **rbus
    257242#endif
    258243                                          )
     
    319304}
    320305
    321 static void __devinit snd_interwave_reset(struct snd_gus_card * gus)
     306static void snd_interwave_reset(struct snd_gus_card *gus)
    322307{
    323308        snd_gf1_write8(gus, SNDRV_GF1_GB_RESET, 0x00);
     
    327312}
    328313
    329 static void __devinit snd_interwave_bank_sizes(struct snd_gus_card * gus, int *sizes)
     314static void snd_interwave_bank_sizes(struct snd_gus_card *gus, int *sizes)
    330315{
    331316        unsigned int idx;
     
    378363};
    379364
    380 static void __devinit snd_interwave_detect_memory(struct snd_gus_card * gus)
    381 {
    382         static unsigned int lmc[13] =
     365static void snd_interwave_detect_memory(struct snd_gus_card *gus)
     366{
     367        static const unsigned int lmc[13] =
    383368        {
    384369                0x00000001, 0x00000101, 0x01010101, 0x00000401,
     
    443428                for (i = 0; i < 8; ++i)
    444429                        iwave[i] = snd_gf1_peek(gus, bank_pos + i);
    445 #ifdef CONFIG_SND_DEBUG_ROM
    446                 printk(KERN_DEBUG "ROM at 0x%06x = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", bank_pos,
    447                        iwave[0], iwave[1], iwave[2], iwave[3],
    448                        iwave[4], iwave[5], iwave[6], iwave[7]);
    449 #endif
    450430                if (strncmp(iwave, "INTRWAVE", 8))
    451431                        continue;       /* first check */
     
    453433                for (i = 0; i < sizeof(struct rom_hdr); i++)
    454434                        csum += snd_gf1_peek(gus, bank_pos + i);
    455 #ifdef CONFIG_SND_DEBUG_ROM
    456                 printk(KERN_DEBUG "ROM checksum = 0x%x (computed)\n", csum);
    457 #endif
    458435                if (csum != 0)
    459436                        continue;       /* not valid rom */
     
    477454}
    478455
    479 static void __devinit snd_interwave_init(int dev, struct snd_gus_card * gus)
     456static void snd_interwave_init(int dev, struct snd_gus_card *gus)
    480457{
    481458        unsigned long flags;
     
    499476}
    500477
    501 static struct snd_kcontrol_new snd_interwave_controls[] = {
     478static const struct snd_kcontrol_new snd_interwave_controls[] = {
    502479WSS_DOUBLE("Master Playback Switch", 0,
    503480                CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 7, 7, 1, 1),
     
    510487};
    511488
    512 static int __devinit snd_interwave_mixer(struct snd_wss *chip)
     489static int snd_interwave_mixer(struct snd_wss *chip)
    513490{
    514491        struct snd_card *card = chip->card;
     
    560537#ifdef CONFIG_PNP
    561538
    562 static int __devinit snd_interwave_pnp(int dev, struct snd_interwave *iwcard,
    563                                        struct pnp_card_link *card,
    564                                        const struct pnp_card_device_id *id)
     539static int snd_interwave_pnp(int dev, struct snd_interwave *iwcard,
     540                             struct pnp_card_link *card,
     541                             const struct pnp_card_device_id *id)
    565542{
    566543        struct pnp_dev *pdev;
     
    628605}
    629606
    630 static int snd_interwave_card_new(int dev, struct snd_card **cardp)
     607static int snd_interwave_card_new(struct device *pdev, int dev,
     608                                  struct snd_card **cardp)
    631609{
    632610        struct snd_card *card;
     
    634612        int err;
    635613
    636         err = snd_card_create(index[dev], id[dev], THIS_MODULE,
    637                               sizeof(struct snd_interwave), &card);
     614        err = snd_card_new(pdev, index[dev], id[dev], THIS_MODULE,
     615                           sizeof(struct snd_interwave), &card);
    638616        if (err < 0)
    639617                return err;
     
    646624}
    647625
    648 static int __devinit snd_interwave_probe(struct snd_card *card, int dev)
     626static int snd_interwave_probe(struct snd_card *card, int dev)
    649627{
    650628        int xirq, xdma1, xdma2;
     
    655633        struct snd_i2c_bus *i2c_bus;
    656634#endif
    657         struct snd_pcm *pcm;
    658635        char *str;
    659636        int err;
     
    685662                return err;
    686663
    687         if (request_irq(xirq, snd_interwave_interrupt, IRQF_DISABLED,
     664        if (request_irq(xirq, snd_interwave_interrupt, 0,
    688665                        "InterWave", iwcard)) {
    689666                snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq);
     
    691668        }
    692669        iwcard->irq = xirq;
     670        card->sync_irq = iwcard->irq;
    693671
    694672        err = snd_wss_create(card,
     
    703681                return err;
    704682
    705         err = snd_wss_pcm(wss, 0, &pcm);
     683        err = snd_wss_pcm(wss, 0);
    706684        if (err < 0)
    707685                return err;
    708686
    709         sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A');
    710         strcat(pcm->name, " (codec)");
    711 
    712         err = snd_wss_timer(wss, 2, NULL);
     687        sprintf(wss->pcm->name + strlen(wss->pcm->name), " rev %c",
     688                gus->revision + 'A');
     689        strcat(wss->pcm->name, " (codec)");
     690
     691        err = snd_wss_timer(wss, 2);
    713692        if (err < 0)
    714693                return err;
     
    719698
    720699        if (pcm_channels[dev] > 0) {
    721                 err = snd_gf1_pcm_new(gus, 1, 1, NULL);
     700                err = snd_gf1_pcm_new(gus, 1, 1);
    722701                if (err < 0)
    723702                        return err;
     
    748727
    749728        gus->uart_enable = midi[dev];
    750         if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
     729        if ((err = snd_gf1_rawmidi_new(gus, 0)) < 0)
    751730                return err;
    752731
     
    777756}
    778757
    779 static int __devinit snd_interwave_isa_probe1(int dev, struct device *devptr)
     758static int snd_interwave_isa_probe1(int dev, struct device *devptr)
    780759{
    781760        struct snd_card *card;
    782761        int err;
    783762
    784         err = snd_interwave_card_new(dev, &card);
     763        err = snd_interwave_card_new(devptr, dev, &card);
    785764        if (err < 0)
    786765                return err;
    787766
    788         snd_card_set_dev(card, devptr);
    789767        if ((err = snd_interwave_probe(card, dev)) < 0) {
    790768                snd_card_free(card);
     
    795773}
    796774
    797 static int __devinit snd_interwave_isa_match(struct device *pdev,
    798                                              unsigned int dev)
     775static int snd_interwave_isa_match(struct device *pdev,
     776                                   unsigned int dev)
    799777{
    800778        if (!enable[dev])
     
    807785}
    808786
    809 static int __devinit snd_interwave_isa_probe(struct device *pdev,
    810                                              unsigned int dev)
     787static int snd_interwave_isa_probe(struct device *pdev,
     788                                   unsigned int dev)
    811789{
    812790        int err;
    813         static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1};
    814         static int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1};
     791        static const int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1};
     792        static const int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1};
    815793
    816794        if (irq[dev] == SNDRV_AUTO_IRQ) {
     
    836814                return snd_interwave_isa_probe1(dev, pdev);
    837815        else {
    838                 static long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260};
     816                static const long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260};
    839817                int i;
    840818                for (i = 0; i < ARRAY_SIZE(possible_ports); i++) {
     
    848826}
    849827
    850 static int __devexit snd_interwave_isa_remove(struct device *devptr, unsigned int dev)
     828static int snd_interwave_isa_remove(struct device *devptr, unsigned int dev)
    851829{
    852830        snd_card_free(dev_get_drvdata(devptr));
    853         dev_set_drvdata(devptr, NULL);
    854831        return 0;
    855832}
     
    858835        .match          = snd_interwave_isa_match,
    859836        .probe          = snd_interwave_isa_probe,
    860         .remove         = __devexit_p(snd_interwave_isa_remove),
     837        .remove         = snd_interwave_isa_remove,
    861838        /* FIXME: suspend,resume */
    862839        .driver         = {
     
    866843
    867844#ifdef CONFIG_PNP
    868 static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard,
    869                                               const struct pnp_card_device_id *pid)
     845static int snd_interwave_pnp_detect(struct pnp_card_link *pcard,
     846                                    const struct pnp_card_device_id *pid)
    870847{
    871848        static int dev;
     
    880857                return -ENODEV;
    881858                               
    882         res = snd_interwave_card_new(dev, &card);
     859        res = snd_interwave_card_new(&pcard->card->dev, dev, &card);
    883860        if (res < 0)
    884861                return res;
     
    888865                return res;
    889866        }
    890         snd_card_set_dev(card, &pcard->card->dev);
    891867        if ((res = snd_interwave_probe(card, dev)) < 0) {
    892868                snd_card_free(card);
     
    898874}
    899875
    900 static void __devexit snd_interwave_pnp_remove(struct pnp_card_link * pcard)
     876static void snd_interwave_pnp_remove(struct pnp_card_link *pcard)
    901877{
    902878        snd_card_free(pnp_get_card_drvdata(pcard));
     
    909885        .id_table = snd_interwave_pnpids,
    910886        .probe = snd_interwave_pnp_detect,
    911         .remove = __devexit_p(snd_interwave_pnp_remove),
     887        .remove = snd_interwave_pnp_remove,
    912888        /* FIXME: suspend,resume */
    913889};
Note: See TracChangeset for help on using the changeset viewer.