Ignore:
Timestamp:
Mar 24, 2008, 2:43:42 AM (17 years ago)
Author:
Paul Smedley
Message:

Update source to ALSA 1.0.16 level

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud-2.0/alsa-kernel/pci/sonicvibes.c

    r77 r305  
    11/*
    22 *  Driver for S3 SonicVibes soundcard
    3  *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
     3 *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
    44 *
    55 *  BUGS:
     
    1919 *   You should have received a copy of the GNU General Public License
    2020 *   along with this program; if not, write to the Free Software
    21  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     21 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2222 *
    2323 */
    2424
    25 #define SNDRV_MAIN_OBJECT_FILE
    26 #include <sound/driver.h>
     25#include <linux/delay.h>
     26#include <linux/init.h>
     27#include <linux/interrupt.h>
     28#include <linux/pci.h>
     29#include <linux/slab.h>
     30#include <linux/gameport.h>
     31#include <linux/moduleparam.h>
     32#include <linux/dma-mapping.h>
     33
     34#include <sound/core.h>
    2735#include <sound/pcm.h>
    2836#include <sound/info.h>
     
    3038#include <sound/mpu401.h>
    3139#include <sound/opl3.h>
    32 #define SNDRV_GET_ID
    3340#include <sound/initval.h>
    3441
    35 EXPORT_NO_SYMBOLS;
     42#include <asm/io.h>
     43
     44MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
    3645MODULE_DESCRIPTION("S3 SonicVibes PCI");
    37 MODULE_CLASSES("{sound}");
    38 MODULE_DEVICES("{{S3,SonicVibes PCI}}");
    39 
    40 #ifndef PCI_VENDOR_ID_S3
    41 #define PCI_VENDOR_ID_S3             0x5333
     46MODULE_LICENSE("GPL");
     47MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}");
     48
     49#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
     50#define SUPPORT_JOYSTICK 1
    4251#endif
    43 #ifndef PCI_DEVICE_ID_S3_SONICVIBES
    44 #define PCI_DEVICE_ID_S3_SONICVIBES  0xca00
    45 #endif
    46 
    47 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;  /* Index 0-MAX */
    48 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;   /* ID for this card */
    49 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;      /* Enable this card */
    50 #ifdef TARGET_OS2
    51 static int snd_reverb[SNDRV_CARDS] = {0,0,0,0,0,0,0,0};
    52 static int snd_mge[SNDRV_CARDS] = {0,0,0,0,0,0,0,0};
    53 #else
    54 static int snd_reverb[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
    55 static int snd_mge[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
    56 #endif
    57 static unsigned int snd_dmaio = 0x7a00; /* DDMA i/o address */
    58 
    59 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    60 MODULE_PARM_DESC(snd_index, "Index value for S3 SonicVibes soundcard.");
    61 MODULE_PARM_SYNTAX(snd_index, SNDRV_INDEX_DESC);
    62 MODULE_PARM(snd_id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
    63 MODULE_PARM_DESC(snd_id, "ID string for S3 SonicVibes soundcard.");
    64 MODULE_PARM_SYNTAX(snd_id, SNDRV_ID_DESC);
    65 MODULE_PARM(snd_enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    66 MODULE_PARM_DESC(snd_enable, "Enable S3 SonicVibes soundcard.");
    67 MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC);
    68 MODULE_PARM(snd_reverb, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    69 MODULE_PARM_DESC(snd_reverb, "Enable reverb (SRAM is present) for S3 SonicVibes soundcard.");
    70 MODULE_PARM_SYNTAX(snd_reverb, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
    71 MODULE_PARM(snd_mge, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    72 MODULE_PARM_DESC(snd_mge, "MIC Gain Enable for S3 SonicVibes soundcard.");
    73 MODULE_PARM_SYNTAX(snd_mge, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
    74 MODULE_PARM(snd_dmaio, "i");
    75 MODULE_PARM_DESC(snd_dmaio, "DDMA i/o base address for S3 SonicVibes soundcard.");
    76 MODULE_PARM_SYNTAX(snd_dmaio, "global," SNDRV_PORT_DESC);
     52
     53static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
     54static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
     55static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;      /* Enable this card */
     56static int reverb[SNDRV_CARDS];
     57static int mge[SNDRV_CARDS];
     58static unsigned int dmaio = 0x7a00;     /* DDMA i/o address */
     59
     60module_param_array(index, int, NULL, 0444);
     61MODULE_PARM_DESC(index, "Index value for S3 SonicVibes soundcard.");
     62module_param_array(id, charp, NULL, 0444);
     63MODULE_PARM_DESC(id, "ID string for S3 SonicVibes soundcard.");
     64module_param_array(enable, bool, NULL, 0444);
     65MODULE_PARM_DESC(enable, "Enable S3 SonicVibes soundcard.");
     66module_param_array(reverb, bool, NULL, 0444);
     67MODULE_PARM_DESC(reverb, "Enable reverb (SRAM is present) for S3 SonicVibes soundcard.");
     68module_param_array(mge, bool, NULL, 0444);
     69MODULE_PARM_DESC(mge, "MIC Gain Enable for S3 SonicVibes soundcard.");
     70module_param(dmaio, uint, 0444);
     71MODULE_PARM_DESC(dmaio, "DDMA i/o base address for S3 SonicVibes soundcard.");
    7772
    7873/*
     
    201196 */
    202197
    203 typedef struct _snd_sonicvibes sonicvibes_t;
    204 #define chip_t sonicvibes_t
    205 
    206 struct _snd_sonicvibes {
     198struct sonicvibes {
    207199        unsigned long dma1size;
    208200        unsigned long dma2size;
     
    210202
    211203        unsigned long sb_port;
    212         struct resource *res_sb_port;
    213204        unsigned long enh_port;
    214         struct resource *res_enh_port;
    215205        unsigned long synth_port;
    216         struct resource *res_synth_port;
    217206        unsigned long midi_port;
    218         struct resource *res_midi_port;
    219207        unsigned long game_port;
    220208        unsigned int dmaa_port;
     
    235223
    236224        struct pci_dev *pci;
    237         snd_card_t *card;
    238         snd_pcm_t *pcm;
    239         snd_pcm_substream_t *playback_substream;
    240         snd_pcm_substream_t *capture_substream;
    241         snd_rawmidi_t *rmidi;
    242         snd_hwdep_t *fmsynth;   /* S3FM */
     225        struct snd_card *card;
     226        struct snd_pcm *pcm;
     227        struct snd_pcm_substream *playback_substream;
     228        struct snd_pcm_substream *capture_substream;
     229        struct snd_rawmidi *rmidi;
     230        struct snd_hwdep *fmsynth;      /* S3FM */
    243231
    244232        spinlock_t reg_lock;
    245         snd_info_entry_t *proc_entry;
    246233
    247234        unsigned int p_dma_size;
    248235        unsigned int c_dma_size;
    249236
    250         snd_kcontrol_t *master_mute;
    251         snd_kcontrol_t *master_volume;
     237        struct snd_kcontrol *master_mute;
     238        struct snd_kcontrol *master_volume;
     239
     240#ifdef SUPPORT_JOYSTICK
     241        struct gameport *gameport;
     242#endif
    252243};
    253244
    254 static struct pci_device_id snd_sonic_ids[] __devinitdata = {
     245static struct pci_device_id snd_sonic_ids[] = {
    255246        { 0x5333, 0xca00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
    256247        { 0, }
     
    259250MODULE_DEVICE_TABLE(pci, snd_sonic_ids);
    260251
    261 #ifdef TARGET_OS2
    262 static ratden_t sonicvibes_adc_clock = {
    263         4000 * 65536,
    264         48000UL * 65536,
    265         1,
    266         65536,
     252static struct snd_ratden sonicvibes_adc_clock = {
     253        .num_min = 4000 * 65536,
     254        .num_max = 48000UL * 65536,
     255        .num_step = 1,
     256        .den = 65536,
    267257};
    268 static snd_pcm_hw_constraint_ratdens_t snd_sonicvibes_hw_constraints_adc_clock = {
    269         1,
    270         &sonicvibes_adc_clock,
     258static struct snd_pcm_hw_constraint_ratdens snd_sonicvibes_hw_constraints_adc_clock = {
     259        .nrats = 1,
     260        .rats = &sonicvibes_adc_clock,
    271261};
    272 #else
    273 static ratden_t sonicvibes_adc_clock = {
    274         num_min: 4000 * 65536,
    275         num_max: 48000UL * 65536,
    276         num_step: 1,
    277         den: 65536,
    278 };
    279 static snd_pcm_hw_constraint_ratdens_t snd_sonicvibes_hw_constraints_adc_clock = {
    280         nrats: 1,
    281         rats: &sonicvibes_adc_clock,
    282 };
    283 #endif
    284262
    285263/*
     
    287265 */
    288266
    289 static inline void snd_sonicvibes_setdmaa(sonicvibes_t * sonic,
     267static inline void snd_sonicvibes_setdmaa(struct sonicvibes * sonic,
    290268                                          unsigned int addr,
    291269                                          unsigned int count)
     
    300278}
    301279
    302 static inline void snd_sonicvibes_setdmac(sonicvibes_t * sonic,
     280static inline void snd_sonicvibes_setdmac(struct sonicvibes * sonic,
    303281                                          unsigned int addr,
    304282                                          unsigned int count)
     
    315293}
    316294
    317 static inline unsigned int snd_sonicvibes_getdmaa(sonicvibes_t * sonic)
     295static inline unsigned int snd_sonicvibes_getdmaa(struct sonicvibes * sonic)
    318296{
    319297        return (inl(sonic->dmaa_port + SV_DMA_COUNT0) & 0xffffff) + 1;
    320298}
    321299
    322 static inline unsigned int snd_sonicvibes_getdmac(sonicvibes_t * sonic)
     300static inline unsigned int snd_sonicvibes_getdmac(struct sonicvibes * sonic)
    323301{
    324302        /* note: dmac is working in word mode!!! */
     
    326304}
    327305
    328 static void snd_sonicvibes_out1(sonicvibes_t * sonic,
     306static void snd_sonicvibes_out1(struct sonicvibes * sonic,
    329307                                unsigned char reg,
    330308                                unsigned char value)
     
    336314}
    337315
    338 static void snd_sonicvibes_out(sonicvibes_t * sonic,
     316static void snd_sonicvibes_out(struct sonicvibes * sonic,
    339317                               unsigned char reg,
    340318                               unsigned char value)
     
    350328}
    351329
    352 static unsigned char snd_sonicvibes_in1(sonicvibes_t * sonic, unsigned char reg)
     330static unsigned char snd_sonicvibes_in1(struct sonicvibes * sonic, unsigned char reg)
    353331{
    354332        unsigned char value;
     
    361339}
    362340
    363 static unsigned char snd_sonicvibes_in(sonicvibes_t * sonic, unsigned char reg)
     341static unsigned char snd_sonicvibes_in(struct sonicvibes * sonic, unsigned char reg)
    364342{
    365343        unsigned long flags;
     
    375353}
    376354
    377 #ifdef CONFIG_SND_DEBUG
    378 void snd_sonicvibes_debug(sonicvibes_t * sonic)
     355#if 0
     356static void snd_sonicvibes_debug(struct sonicvibes * sonic)
    379357{
    380358        printk("SV REGS:          INDEX = 0x%02x  ", inb(SV_REG(sonic, INDEX)));
     
    448426#endif
    449427
    450 static void snd_sonicvibes_setfmt(sonicvibes_t * sonic,
     428static void snd_sonicvibes_setfmt(struct sonicvibes * sonic,
    451429                                  unsigned char mask,
    452430                                  unsigned char value)
     
    504482}
    505483
    506 static void snd_sonicvibes_setpll(sonicvibes_t * sonic,
     484static void snd_sonicvibes_setpll(struct sonicvibes * sonic,
    507485                                  unsigned char reg,
    508486                                  unsigned int rate)
     
    520498}
    521499
    522 static void snd_sonicvibes_set_adc_rate(sonicvibes_t * sonic, unsigned int rate)
     500static void snd_sonicvibes_set_adc_rate(struct sonicvibes * sonic, unsigned int rate)
    523501{
    524502        unsigned long flags;
     
    541519}
    542520
    543 static int snd_sonicvibes_hw_constraint_dac_rate(snd_pcm_hw_params_t *params,
    544                                                  snd_pcm_hw_rule_t *rule)
     521static int snd_sonicvibes_hw_constraint_dac_rate(struct snd_pcm_hw_params *params,
     522                                                 struct snd_pcm_hw_rule *rule)
    545523{
    546524        unsigned int rate, div, r, m, n;
     
    566544}
    567545
    568 static void snd_sonicvibes_set_dac_rate(sonicvibes_t * sonic, unsigned int rate)
     546static void snd_sonicvibes_set_dac_rate(struct sonicvibes * sonic, unsigned int rate)
    569547{
    570548        unsigned int div;
     
    580558}
    581559
    582 static int snd_sonicvibes_trigger(sonicvibes_t * sonic, int what, int cmd)
     560static int snd_sonicvibes_trigger(struct sonicvibes * sonic, int what, int cmd)
    583561{
    584562        int result = 0;
     
    602580}
    603581
    604 static void snd_sonicvibes_interrupt(int irq, void *dev_id, struct pt_regs *regs)
    605 {
    606         sonicvibes_t *sonic = snd_magic_cast(sonicvibes_t, dev_id, return);
     582static irqreturn_t snd_sonicvibes_interrupt(int irq, void *dev_id)
     583{
     584        struct sonicvibes *sonic = dev_id;
    607585        unsigned char status;
    608586
    609587        status = inb(SV_REG(sonic, STATUS));
    610588        if (!(status & (SV_DMAA_IRQ | SV_DMAC_IRQ | SV_MIDI_IRQ)))
    611                 return;
     589                return IRQ_NONE;
    612590        if (status == 0xff) {   /* failure */
    613591                outb(sonic->irqmask = ~0, SV_REG(sonic, IRQMASK));
    614                 snd_printk("IRQ failure - interrupts disabled!!\n");
    615                 return;
     592                snd_printk(KERN_ERR "IRQ failure - interrupts disabled!!\n");
     593                return IRQ_HANDLED;
    616594        }
    617595        if (sonic->pcm) {
     
    623601        if (sonic->rmidi) {
    624602                if (status & SV_MIDI_IRQ)
    625                         snd_mpu401_uart_interrupt(irq, sonic->rmidi->private_data, regs);
     603                        snd_mpu401_uart_interrupt(irq, sonic->rmidi->private_data);
    626604        }
    627605        if (status & SV_UD_IRQ) {
     
    660638                snd_ctl_notify(sonic->card, SNDRV_CTL_EVENT_MASK_VALUE, &sonic->master_volume->id);
    661639        }
     640        return IRQ_HANDLED;
    662641}
    663642
     
    666645 */
    667646
    668 static int snd_sonicvibes_playback_trigger(snd_pcm_substream_t * substream,
     647static int snd_sonicvibes_playback_trigger(struct snd_pcm_substream *substream,
    669648                                           int cmd)
    670649{
    671         sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
     650        struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
    672651        return snd_sonicvibes_trigger(sonic, 1, cmd);
    673652}
    674653
    675 static int snd_sonicvibes_capture_trigger(snd_pcm_substream_t * substream,
     654static int snd_sonicvibes_capture_trigger(struct snd_pcm_substream *substream,
    676655                                          int cmd)
    677656{
    678         sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
     657        struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
    679658        return snd_sonicvibes_trigger(sonic, 2, cmd);
    680659}
    681660
    682 static int snd_sonicvibes_hw_params(snd_pcm_substream_t * substream,
    683                                     snd_pcm_hw_params_t * hw_params)
     661static int snd_sonicvibes_hw_params(struct snd_pcm_substream *substream,
     662                                    struct snd_pcm_hw_params *hw_params)
    684663{
    685664        return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
    686665}
    687666
    688 static int snd_sonicvibes_hw_free(snd_pcm_substream_t * substream)
     667static int snd_sonicvibes_hw_free(struct snd_pcm_substream *substream)
    689668{
    690669        return snd_pcm_lib_free_pages(substream);
    691670}
    692671
    693 static int snd_sonicvibes_playback_prepare(snd_pcm_substream_t * substream)
    694 {
    695         unsigned long flags;
    696         sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
    697         snd_pcm_runtime_t *runtime = substream->runtime;
     672static int snd_sonicvibes_playback_prepare(struct snd_pcm_substream *substream)
     673{
     674        struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
     675        struct snd_pcm_runtime *runtime = substream->runtime;
    698676        unsigned char fmt = 0;
    699677        unsigned int size = snd_pcm_lib_buffer_bytes(substream);
     
    708686        snd_sonicvibes_setfmt(sonic, ~3, fmt);
    709687        snd_sonicvibes_set_dac_rate(sonic, runtime->rate);
    710         spin_lock_irqsave(&sonic->reg_lock, flags);
     688        spin_lock_irq(&sonic->reg_lock);
    711689        snd_sonicvibes_setdmaa(sonic, runtime->dma_addr, size);
    712690        snd_sonicvibes_out1(sonic, SV_IREG_DMA_A_UPPER, count >> 8);
    713691        snd_sonicvibes_out1(sonic, SV_IREG_DMA_A_LOWER, count);
    714         spin_unlock_irqrestore(&sonic->reg_lock, flags);
    715         return 0;
    716 }
    717 
    718 static int snd_sonicvibes_capture_prepare(snd_pcm_substream_t * substream)
    719 {
    720         unsigned long flags;
    721         sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
    722         snd_pcm_runtime_t *runtime = substream->runtime;
     692        spin_unlock_irq(&sonic->reg_lock);
     693        return 0;
     694}
     695
     696static int snd_sonicvibes_capture_prepare(struct snd_pcm_substream *substream)
     697{
     698        struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
     699        struct snd_pcm_runtime *runtime = substream->runtime;
    723700        unsigned char fmt = 0;
    724701        unsigned int size = snd_pcm_lib_buffer_bytes(substream);
     
    734711        snd_sonicvibes_setfmt(sonic, ~0x30, fmt);
    735712        snd_sonicvibes_set_adc_rate(sonic, runtime->rate);
    736         spin_lock_irqsave(&sonic->reg_lock, flags);
     713        spin_lock_irq(&sonic->reg_lock);
    737714        snd_sonicvibes_setdmac(sonic, runtime->dma_addr, size);
    738715        snd_sonicvibes_out1(sonic, SV_IREG_DMA_C_UPPER, count >> 8);
    739716        snd_sonicvibes_out1(sonic, SV_IREG_DMA_C_LOWER, count);
    740         spin_unlock_irqrestore(&sonic->reg_lock, flags);
    741         return 0;
    742 }
    743 
    744 static snd_pcm_uframes_t snd_sonicvibes_playback_pointer(snd_pcm_substream_t * substream)
    745 {
    746         sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
     717        spin_unlock_irq(&sonic->reg_lock);
     718        return 0;
     719}
     720
     721static snd_pcm_uframes_t snd_sonicvibes_playback_pointer(struct snd_pcm_substream *substream)
     722{
     723        struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
    747724        size_t ptr;
    748725
     
    753730}
    754731
    755 static snd_pcm_uframes_t snd_sonicvibes_capture_pointer(snd_pcm_substream_t * substream)
    756 {
    757         sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
     732static snd_pcm_uframes_t snd_sonicvibes_capture_pointer(struct snd_pcm_substream *substream)
     733{
     734        struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
    758735        size_t ptr;
    759736        if (!(sonic->enable & 2))
     
    763740}
    764741
    765 #ifdef TARGET_OS2
    766 static snd_pcm_hardware_t snd_sonicvibes_playback =
    767 {
    768 /*      info:             */    (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
     742static struct snd_pcm_hardware snd_sonicvibes_playback =
     743{
     744        .info =                 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
    769745                                 SNDRV_PCM_INFO_BLOCK_TRANSFER |
    770746                                 SNDRV_PCM_INFO_MMAP_VALID),
    771 /*      formats:          */    SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
    772 /*      rates:            */    SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
    773 /*      rate_min:         */    4000,
    774 /*      rate_max:         */    48000,
    775 /*      channels_min:     */    1,
    776 /*      channels_max:     */    2,
    777 /*      buffer_bytes_max: */    (128*1024),
    778 /*      period_bytes_min: */    32,
    779 /*      period_bytes_max: */    (128*1024),
    780 /*      periods_min:      */    1,
    781 /*      periods_max:      */    1024,
    782 /*      fifo_size:        */    0,
     747        .formats =              SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
     748        .rates =                SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
     749        .rate_min =             4000,
     750        .rate_max =             48000,
     751        .channels_min =         1,
     752        .channels_max =         2,
     753        .buffer_bytes_max =     (128*1024),
     754        .period_bytes_min =     32,
     755        .period_bytes_max =     (128*1024),
     756        .periods_min =          1,
     757        .periods_max =          1024,
     758        .fifo_size =            0,
    783759};
    784760
    785 static snd_pcm_hardware_t snd_sonicvibes_capture =
    786 {
    787 /*      info:             */    (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
     761static struct snd_pcm_hardware snd_sonicvibes_capture =
     762{
     763        .info =                 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
    788764                                 SNDRV_PCM_INFO_BLOCK_TRANSFER |
    789765                                 SNDRV_PCM_INFO_MMAP_VALID),
    790 /*      formats:          */    SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
    791 /*      rates:            */    SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
    792 /*      rate_min:         */    4000,
    793 /*      rate_max:         */    48000,
    794 /*      channels_min:     */    1,
    795 /*      channels_max:     */    2,
    796 /*      buffer_bytes_max: */    (128*1024),
    797 /*      period_bytes_min: */    32,
    798 /*      period_bytes_max: */    (128*1024),
    799 /*      periods_min:      */    1,
    800 /*      periods_max:      */    1024,
    801 /*      fifo_size:        */    0,
     766        .formats =              SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
     767        .rates =                SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
     768        .rate_min =             4000,
     769        .rate_max =             48000,
     770        .channels_min =         1,
     771        .channels_max =         2,
     772        .buffer_bytes_max =     (128*1024),
     773        .period_bytes_min =     32,
     774        .period_bytes_max =     (128*1024),
     775        .periods_min =          1,
     776        .periods_max =          1024,
     777        .fifo_size =            0,
    802778};
    803 #else
    804 static snd_pcm_hardware_t snd_sonicvibes_playback =
    805 {
    806         info:                   (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
    807                                  SNDRV_PCM_INFO_BLOCK_TRANSFER |
    808                                  SNDRV_PCM_INFO_MMAP_VALID),
    809         formats:                SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
    810         rates:                  SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
    811         rate_min:               4000,
    812         rate_max:               48000,
    813         channels_min:           1,
    814         channels_max:           2,
    815         buffer_bytes_max:       (128*1024),
    816         period_bytes_min:       32,
    817         period_bytes_max:       (128*1024),
    818         periods_min:            1,
    819         periods_max:            1024,
    820         fifo_size:              0,
    821 };
    822 
    823 static snd_pcm_hardware_t snd_sonicvibes_capture =
    824 {
    825         info:                   (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
    826                                  SNDRV_PCM_INFO_BLOCK_TRANSFER |
    827                                  SNDRV_PCM_INFO_MMAP_VALID),
    828         formats:                SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
    829         rates:                  SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
    830         rate_min:               4000,
    831         rate_max:               48000,
    832         channels_min:           1,
    833         channels_max:           2,
    834         buffer_bytes_max:       (128*1024),
    835         period_bytes_min:       32,
    836         period_bytes_max:       (128*1024),
    837         periods_min:            1,
    838         periods_max:            1024,
    839         fifo_size:              0,
    840 };
    841 #endif
    842 
    843 static int snd_sonicvibes_playback_open(snd_pcm_substream_t * substream)
    844 {
    845         sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
    846         snd_pcm_runtime_t *runtime = substream->runtime;
     779
     780static int snd_sonicvibes_playback_open(struct snd_pcm_substream *substream)
     781{
     782        struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
     783        struct snd_pcm_runtime *runtime = substream->runtime;
    847784
    848785        sonic->mode |= SV_MODE_PLAY;
    849786        sonic->playback_substream = substream;
    850787        runtime->hw = snd_sonicvibes_playback;
    851         snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_sonicvibes_hw_constraint_dac_rate, 0, SNDRV_PCM_HW_PARAM_RATE, -1);
    852         return 0;
    853 }
    854 
    855 static int snd_sonicvibes_capture_open(snd_pcm_substream_t * substream)
    856 {
    857         sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
    858         snd_pcm_runtime_t *runtime = substream->runtime;
     788        snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_sonicvibes_hw_constraint_dac_rate, NULL, SNDRV_PCM_HW_PARAM_RATE, -1);
     789        return 0;
     790}
     791
     792static int snd_sonicvibes_capture_open(struct snd_pcm_substream *substream)
     793{
     794        struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
     795        struct snd_pcm_runtime *runtime = substream->runtime;
    859796
    860797        sonic->mode |= SV_MODE_CAPTURE;
     
    866803}
    867804
    868 static int snd_sonicvibes_playback_close(snd_pcm_substream_t * substream)
    869 {
    870         sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
     805static int snd_sonicvibes_playback_close(struct snd_pcm_substream *substream)
     806{
     807        struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
    871808
    872809        sonic->playback_substream = NULL;
     
    875812}
    876813
    877 static int snd_sonicvibes_capture_close(snd_pcm_substream_t * substream)
    878 {
    879         sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
     814static int snd_sonicvibes_capture_close(struct snd_pcm_substream *substream)
     815{
     816        struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
    880817
    881818        sonic->capture_substream = NULL;
     
    884821}
    885822
    886 
    887 #ifdef TARGET_OS2
    888 static snd_pcm_ops_t snd_sonicvibes_playback_ops = {
    889 /*      open:     */    snd_sonicvibes_playback_open,
    890 /*      close:    */    snd_sonicvibes_playback_close,
    891 /*      ioctl:    */    snd_pcm_lib_ioctl,
    892 /*      hw_params:*/    snd_sonicvibes_hw_params,
    893 /*      hw_free:  */    snd_sonicvibes_hw_free,
    894 /*      prepare:  */    snd_sonicvibes_playback_prepare,
    895 /*      trigger:  */    snd_sonicvibes_playback_trigger,
    896 /*      pointer:  */    snd_sonicvibes_playback_pointer,
    897         0, 0
     823static struct snd_pcm_ops snd_sonicvibes_playback_ops = {
     824        .open =         snd_sonicvibes_playback_open,
     825        .close =        snd_sonicvibes_playback_close,
     826        .ioctl =        snd_pcm_lib_ioctl,
     827        .hw_params =    snd_sonicvibes_hw_params,
     828        .hw_free =      snd_sonicvibes_hw_free,
     829        .prepare =      snd_sonicvibes_playback_prepare,
     830        .trigger =      snd_sonicvibes_playback_trigger,
     831        .pointer =      snd_sonicvibes_playback_pointer,
    898832};
    899833
    900 static snd_pcm_ops_t snd_sonicvibes_capture_ops = {
    901 /*      open:     */    snd_sonicvibes_capture_open,
    902 /*      close:    */    snd_sonicvibes_capture_close,
    903 /*      ioctl:    */    snd_pcm_lib_ioctl,
    904 /*      hw_params:*/    snd_sonicvibes_hw_params,
    905 /*      hw_free:  */    snd_sonicvibes_hw_free,
    906 /*      prepare:  */    snd_sonicvibes_capture_prepare,
    907 /*      trigger:  */    snd_sonicvibes_capture_trigger,
    908 /*      pointer:  */    snd_sonicvibes_capture_pointer,
    909         0, 0
     834static struct snd_pcm_ops snd_sonicvibes_capture_ops = {
     835        .open =         snd_sonicvibes_capture_open,
     836        .close =        snd_sonicvibes_capture_close,
     837        .ioctl =        snd_pcm_lib_ioctl,
     838        .hw_params =    snd_sonicvibes_hw_params,
     839        .hw_free =      snd_sonicvibes_hw_free,
     840        .prepare =      snd_sonicvibes_capture_prepare,
     841        .trigger =      snd_sonicvibes_capture_trigger,
     842        .pointer =      snd_sonicvibes_capture_pointer,
    910843};
    911 #else
    912 static snd_pcm_ops_t snd_sonicvibes_playback_ops = {
    913         open:           snd_sonicvibes_playback_open,
    914         close:          snd_sonicvibes_playback_close,
    915         ioctl:          snd_pcm_lib_ioctl,
    916         hw_params:      snd_sonicvibes_hw_params,
    917         hw_free:        snd_sonicvibes_hw_free,
    918         prepare:        snd_sonicvibes_playback_prepare,
    919         trigger:        snd_sonicvibes_playback_trigger,
    920         pointer:        snd_sonicvibes_playback_pointer,
    921 };
    922 
    923 static snd_pcm_ops_t snd_sonicvibes_capture_ops = {
    924         open:           snd_sonicvibes_capture_open,
    925         close:          snd_sonicvibes_capture_close,
    926         ioctl:          snd_pcm_lib_ioctl,
    927         hw_params:      snd_sonicvibes_hw_params,
    928         hw_free:        snd_sonicvibes_hw_free,
    929         prepare:        snd_sonicvibes_capture_prepare,
    930         trigger:        snd_sonicvibes_capture_trigger,
    931         pointer:        snd_sonicvibes_capture_pointer,
    932 };
    933 #endif
    934 
    935 static void snd_sonicvibes_pcm_free(snd_pcm_t *pcm)
    936 {
    937         sonicvibes_t *sonic = snd_magic_cast(sonicvibes_t, pcm->private_data, return);
    938         sonic->pcm = NULL;
    939         snd_pcm_lib_preallocate_free_for_all(pcm);
    940 }
    941 
    942 static int __init snd_sonicvibes_pcm(sonicvibes_t * sonic, int device, snd_pcm_t ** rpcm)
    943 {
    944         snd_pcm_t *pcm;
     844
     845static int __devinit snd_sonicvibes_pcm(struct sonicvibes * sonic, int device, struct snd_pcm ** rpcm)
     846{
     847        struct snd_pcm *pcm;
    945848        int err;
    946849
     
    948851                return err;
    949852        snd_assert(pcm != NULL, return -EINVAL);
     853
    950854        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sonicvibes_playback_ops);
    951855        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sonicvibes_capture_ops);
    952856
    953857        pcm->private_data = sonic;
    954         pcm->private_free = snd_sonicvibes_pcm_free;
    955858        pcm->info_flags = 0;
    956859        strcpy(pcm->name, "S3 SonicVibes");
    957860        sonic->pcm = pcm;
    958861
    959         snd_pcm_lib_preallocate_pci_pages_for_all(sonic->pci, pcm, 64*1024, 128*1024);
     862        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
     863                                              snd_dma_pci_data(sonic->pci), 64*1024, 128*1024);
    960864
    961865        if (rpcm)
     
    968872 */
    969873
    970 #ifdef TARGET_OS2
    971874#define SONICVIBES_MUX(xname, xindex) \
    972 { SNDRV_CTL_ELEM_IFACE_MIXER, 0, 0, xname, xindex, \
    973   0, 0,snd_sonicvibes_info_mux, \
    974   snd_sonicvibes_get_mux, snd_sonicvibes_put_mux, 0}
    975 #else
    976 #define SONICVIBES_MUX(xname, xindex) \
    977 { iface: SNDRV_CTL_ELEM_IFACE_MIXER, name: xname, index: xindex, \
    978   info: snd_sonicvibes_info_mux, \
    979   get: snd_sonicvibes_get_mux, put: snd_sonicvibes_put_mux }
    980 #endif
    981 
    982 static int snd_sonicvibes_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
     875{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
     876  .info = snd_sonicvibes_info_mux, \
     877  .get = snd_sonicvibes_get_mux, .put = snd_sonicvibes_put_mux }
     878
     879static int snd_sonicvibes_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
    983880{
    984881        static char *texts[7] = {
     
    995892}
    996893
    997 static int snd_sonicvibes_get_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    998 {
    999         sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol);
    1000         unsigned long flags;
     894static int snd_sonicvibes_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
     895{
     896        struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
    1001897       
    1002         spin_lock_irqsave(&sonic->reg_lock, flags);
     898        spin_lock_irq(&sonic->reg_lock);
    1003899        ucontrol->value.enumerated.item[0] = ((snd_sonicvibes_in1(sonic, SV_IREG_LEFT_ADC) & SV_RECSRC_OUT) >> 5) - 1;
    1004900        ucontrol->value.enumerated.item[1] = ((snd_sonicvibes_in1(sonic, SV_IREG_RIGHT_ADC) & SV_RECSRC_OUT) >> 5) - 1;
    1005         spin_unlock_irqrestore(&sonic->reg_lock, flags);
    1006         return 0;
    1007 }
    1008 
    1009 static int snd_sonicvibes_put_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    1010 {
    1011         sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol);
    1012         unsigned long flags;
     901        spin_unlock_irq(&sonic->reg_lock);
     902        return 0;
     903}
     904
     905static int snd_sonicvibes_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
     906{
     907        struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
    1013908        unsigned short left, right, oval1, oval2;
    1014909        int change;
     
    1019914        left = (ucontrol->value.enumerated.item[0] + 1) << 5;
    1020915        right = (ucontrol->value.enumerated.item[1] + 1) << 5;
    1021         spin_lock_irqsave(&sonic->reg_lock, flags);
     916        spin_lock_irq(&sonic->reg_lock);
    1022917        oval1 = snd_sonicvibes_in1(sonic, SV_IREG_LEFT_ADC);
    1023918        oval2 = snd_sonicvibes_in1(sonic, SV_IREG_RIGHT_ADC);
     
    1027922        snd_sonicvibes_out1(sonic, SV_IREG_LEFT_ADC, left);
    1028923        snd_sonicvibes_out1(sonic, SV_IREG_RIGHT_ADC, right);
    1029         spin_unlock_irqrestore(&sonic->reg_lock, flags);
     924        spin_unlock_irq(&sonic->reg_lock);
    1030925        return change;
    1031926}
    1032927
    1033 #ifdef TARGET_OS2
    1034928#define SONICVIBES_SINGLE(xname, xindex, reg, shift, mask, invert) \
    1035 { SNDRV_CTL_ELEM_IFACE_MIXER, 0, 0, xname, xindex, \
    1036   0, 0, snd_sonicvibes_info_single, \
    1037   snd_sonicvibes_get_single, snd_sonicvibes_put_single, \
    1038   reg | (shift << 8) | (mask << 16) | (invert << 24) }
    1039 #else
    1040 #define SONICVIBES_SINGLE(xname, xindex, reg, shift, mask, invert) \
    1041 { iface: SNDRV_CTL_ELEM_IFACE_MIXER, name: xname, index: xindex, \
    1042   info: snd_sonicvibes_info_single, \
    1043   get: snd_sonicvibes_get_single, put: snd_sonicvibes_put_single, \
    1044   private_value: reg | (shift << 8) | (mask << 16) | (invert << 24) }
    1045 #endif
    1046 
    1047 static int snd_sonicvibes_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
     929{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
     930  .info = snd_sonicvibes_info_single, \
     931  .get = snd_sonicvibes_get_single, .put = snd_sonicvibes_put_single, \
     932  .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
     933
     934static int snd_sonicvibes_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
    1048935{
    1049936        int mask = (kcontrol->private_value >> 16) & 0xff;
     
    1056943}
    1057944
    1058 static int snd_sonicvibes_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    1059 {
    1060         sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol);
    1061         unsigned long flags;
     945static int snd_sonicvibes_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
     946{
     947        struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
    1062948        int reg = kcontrol->private_value & 0xff;
    1063949        int shift = (kcontrol->private_value >> 8) & 0xff;
     
    1065951        int invert = (kcontrol->private_value >> 24) & 0xff;
    1066952       
    1067         spin_lock_irqsave(&sonic->reg_lock, flags);
     953        spin_lock_irq(&sonic->reg_lock);
    1068954        ucontrol->value.integer.value[0] = (snd_sonicvibes_in1(sonic, reg)>> shift) & mask;
    1069         spin_unlock_irqrestore(&sonic->reg_lock, flags);
     955        spin_unlock_irq(&sonic->reg_lock);
    1070956        if (invert)
    1071957                ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];
     
    1073959}
    1074960
    1075 static int snd_sonicvibes_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    1076 {
    1077         sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol);
    1078         unsigned long flags;
     961static int snd_sonicvibes_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
     962{
     963        struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
    1079964        int reg = kcontrol->private_value & 0xff;
    1080965        int shift = (kcontrol->private_value >> 8) & 0xff;
     
    1088973                val = mask - val;
    1089974        val <<= shift;
    1090         spin_lock_irqsave(&sonic->reg_lock, flags);
     975        spin_lock_irq(&sonic->reg_lock);
    1091976        oval = snd_sonicvibes_in1(sonic, reg);
    1092977        val = (oval & ~(mask << shift)) | val;
    1093978        change = val != oval;
    1094979        snd_sonicvibes_out1(sonic, reg, val);
    1095         spin_unlock_irqrestore(&sonic->reg_lock, flags);
     980        spin_unlock_irq(&sonic->reg_lock);
    1096981        return change;
    1097982}
    1098983
    1099 #ifdef TARGET_OS2
    1100984#define SONICVIBES_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
    1101 { SNDRV_CTL_ELEM_IFACE_MIXER, 0, 0, xname, xindex, \
    1102   0, 0, snd_sonicvibes_info_double, \
    1103   snd_sonicvibes_get_double, snd_sonicvibes_put_double, \
    1104   left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
    1105 #else
    1106 #define SONICVIBES_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
    1107 { iface: SNDRV_CTL_ELEM_IFACE_MIXER, name: xname, index: xindex, \
    1108   info: snd_sonicvibes_info_double, \
    1109   get: snd_sonicvibes_get_double, put: snd_sonicvibes_put_double, \
    1110   private_value: left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
    1111 #endif
    1112 
    1113 static int snd_sonicvibes_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
     985{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
     986  .info = snd_sonicvibes_info_double, \
     987  .get = snd_sonicvibes_get_double, .put = snd_sonicvibes_put_double, \
     988  .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
     989
     990static int snd_sonicvibes_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
    1114991{
    1115992        int mask = (kcontrol->private_value >> 24) & 0xff;
     
    1122999}
    11231000
    1124 static int snd_sonicvibes_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    1125 {
    1126         sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol);
    1127         unsigned long flags;
     1001static int snd_sonicvibes_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
     1002{
     1003        struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
    11281004        int left_reg = kcontrol->private_value & 0xff;
    11291005        int right_reg = (kcontrol->private_value >> 8) & 0xff;
     
    11331009        int invert = (kcontrol->private_value >> 22) & 1;
    11341010       
    1135         spin_lock_irqsave(&sonic->reg_lock, flags);
     1011        spin_lock_irq(&sonic->reg_lock);
    11361012        ucontrol->value.integer.value[0] = (snd_sonicvibes_in1(sonic, left_reg) >> shift_left) & mask;
    11371013        ucontrol->value.integer.value[1] = (snd_sonicvibes_in1(sonic, right_reg) >> shift_right) & mask;
    1138         spin_unlock_irqrestore(&sonic->reg_lock, flags);
     1014        spin_unlock_irq(&sonic->reg_lock);
    11391015        if (invert) {
    11401016                ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];
     
    11441020}
    11451021
    1146 static int snd_sonicvibes_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
    1147 {
    1148         sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol);
    1149         unsigned long flags;
     1022static int snd_sonicvibes_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
     1023{
     1024        struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
    11501025        int left_reg = kcontrol->private_value & 0xff;
    11511026        int right_reg = (kcontrol->private_value >> 8) & 0xff;
     
    11651040        val1 <<= shift_left;
    11661041        val2 <<= shift_right;
    1167         spin_lock_irqsave(&sonic->reg_lock, flags);
     1042        spin_lock_irq(&sonic->reg_lock);
    11681043        oval1 = snd_sonicvibes_in1(sonic, left_reg);
    11691044        oval2 = snd_sonicvibes_in1(sonic, right_reg);
     
    11731048        snd_sonicvibes_out1(sonic, left_reg, val1);
    11741049        snd_sonicvibes_out1(sonic, right_reg, val2);
    1175         spin_unlock_irqrestore(&sonic->reg_lock, flags);
     1050        spin_unlock_irq(&sonic->reg_lock);
    11761051        return change;
    11771052}
    11781053
    1179 #define SONICVIBES_CONTROLS (sizeof(snd_sonicvibes_controls)/sizeof(snd_kcontrol_new_t))
    1180 
    1181 static snd_kcontrol_new_t snd_sonicvibes_controls[] = {
     1054static struct snd_kcontrol_new snd_sonicvibes_controls[] __devinitdata = {
    11821055SONICVIBES_DOUBLE("Capture Volume", 0, SV_IREG_LEFT_ADC, SV_IREG_RIGHT_ADC, 0, 0, 15, 0),
    11831056SONICVIBES_DOUBLE("Aux Playback Switch", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 7, 7, 1, 1),
     
    12031076};
    12041077
    1205 static void snd_sonicvibes_master_free(snd_kcontrol_t *kcontrol)
    1206 {
    1207         sonicvibes_t *sonic = snd_magic_cast(sonicvibes_t, _snd_kcontrol_chip(kcontrol), return);
     1078static void snd_sonicvibes_master_free(struct snd_kcontrol *kcontrol)
     1079{
     1080        struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
    12081081        sonic->master_mute = NULL;
    12091082        sonic->master_volume = NULL;
    12101083}
    12111084
    1212 static int __init snd_sonicvibes_mixer(sonicvibes_t * sonic)
    1213 {
    1214         snd_card_t *card;
    1215         snd_kcontrol_t *kctl;
    1216         int idx, err;
     1085static int __devinit snd_sonicvibes_mixer(struct sonicvibes * sonic)
     1086{
     1087        struct snd_card *card;
     1088        struct snd_kcontrol *kctl;
     1089        unsigned int idx;
     1090        int err;
    12171091
    12181092        snd_assert(sonic != NULL && sonic->card != NULL, return -EINVAL);
     
    12201094        strcpy(card->mixername, "S3 SonicVibes");
    12211095
    1222         for (idx = 0; idx < SONICVIBES_CONTROLS; idx++) {
     1096        for (idx = 0; idx < ARRAY_SIZE(snd_sonicvibes_controls); idx++) {
    12231097                if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_sonicvibes_controls[idx], sonic))) < 0)
    12241098                        return err;
     
    12351109 */
    12361110
    1237 static void snd_sonicvibes_proc_read(snd_info_entry_t *entry,
    1238                                      snd_info_buffer_t * buffer)
    1239 {
    1240         sonicvibes_t *sonic = snd_magic_cast(sonicvibes_t, entry->private_data, return);
     1111static void snd_sonicvibes_proc_read(struct snd_info_entry *entry,
     1112                                     struct snd_info_buffer *buffer)
     1113{
     1114        struct sonicvibes *sonic = entry->private_data;
    12411115        unsigned char tmp;
    12421116
     
    12651139}
    12661140
    1267 static void __init snd_sonicvibes_proc_init(sonicvibes_t * sonic)
    1268 {
    1269         snd_info_entry_t *entry;
    1270 
    1271         if ((entry = snd_info_create_card_entry(sonic->card, "sonicvibes", sonic->card->proc_root)) != NULL) {
    1272                 entry->content = SNDRV_INFO_CONTENT_TEXT;
    1273                 entry->private_data = sonic;
    1274                 entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
    1275                 entry->c.text.read_size = 256;
    1276                 entry->c.text.read = snd_sonicvibes_proc_read;
    1277                 if (snd_info_register(entry) < 0) {
    1278                         snd_info_free_entry(entry);
    1279                         entry = NULL;
    1280                 }
    1281         }
    1282         sonic->proc_entry = entry;
    1283 }
    1284 
    1285 static void snd_sonicvibes_proc_done(sonicvibes_t * sonic)
    1286 {
    1287         if (sonic->proc_entry) {
    1288                 snd_info_unregister(sonic->proc_entry);
    1289                 sonic->proc_entry = NULL;
    1290         }
     1141static void __devinit snd_sonicvibes_proc_init(struct sonicvibes * sonic)
     1142{
     1143        struct snd_info_entry *entry;
     1144
     1145        if (! snd_card_proc_new(sonic->card, "sonicvibes", &entry))
     1146                snd_info_set_text_ops(entry, sonic, snd_sonicvibes_proc_read);
    12911147}
    12921148
     
    12951151 */
    12961152
    1297 static snd_kcontrol_new_t snd_sonicvibes_game_control =
     1153#ifdef SUPPORT_JOYSTICK
     1154static struct snd_kcontrol_new snd_sonicvibes_game_control __devinitdata =
    12981155SONICVIBES_SINGLE("Joystick Speed", 0, SV_IREG_GAME_PORT, 1, 15, 0);
    12991156
    1300 static int snd_sonicvibes_free(sonicvibes_t *sonic)
    1301 {
    1302         snd_sonicvibes_proc_done(sonic);
     1157static int __devinit snd_sonicvibes_create_gameport(struct sonicvibes *sonic)
     1158{
     1159        struct gameport *gp;
     1160
     1161        sonic->gameport = gp = gameport_allocate_port();
     1162        if (!gp) {
     1163                printk(KERN_ERR "sonicvibes: cannot allocate memory for gameport\n");
     1164                return -ENOMEM;
     1165        }
     1166
     1167        gameport_set_name(gp, "SonicVibes Gameport");
     1168        gameport_set_phys(gp, "pci%s/gameport0", pci_name(sonic->pci));
     1169        gameport_set_dev_parent(gp, &sonic->pci->dev);
     1170        gp->io = sonic->game_port;
     1171
     1172        gameport_register_port(gp);
     1173
     1174        snd_ctl_add(sonic->card, snd_ctl_new1(&snd_sonicvibes_game_control, sonic));
     1175
     1176        return 0;
     1177}
     1178
     1179static void snd_sonicvibes_free_gameport(struct sonicvibes *sonic)
     1180{
     1181        if (sonic->gameport) {
     1182                gameport_unregister_port(sonic->gameport);
     1183                sonic->gameport = NULL;
     1184        }
     1185}
     1186#else
     1187static inline int snd_sonicvibes_create_gameport(struct sonicvibes *sonic) { return -ENOSYS; }
     1188static inline void snd_sonicvibes_free_gameport(struct sonicvibes *sonic) { }
     1189#endif
     1190
     1191static int snd_sonicvibes_free(struct sonicvibes *sonic)
     1192{
     1193        snd_sonicvibes_free_gameport(sonic);
    13031194        pci_write_config_dword(sonic->pci, 0x40, sonic->dmaa_port);
    13041195        pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port);
    1305         if (sonic->res_sb_port)
    1306                 release_resource(sonic->res_sb_port);
    1307         if (sonic->res_enh_port)
    1308                 release_resource(sonic->res_enh_port);
    1309         if (sonic->res_synth_port)
    1310                 release_resource(sonic->res_synth_port);
    1311         if (sonic->res_midi_port)
    1312                 release_resource(sonic->res_midi_port);
    1313         if (sonic->res_dmaa)
    1314                 release_resource(sonic->res_dmaa);
    1315         if (sonic->res_dmac)
    1316                 release_resource(sonic->res_dmac);
    13171196        if (sonic->irq >= 0)
    1318                 free_irq(sonic->irq, (void *)sonic);
    1319         snd_magic_kfree(sonic);
    1320         return 0;
    1321 }
    1322 
    1323 static int snd_sonicvibes_dev_free(snd_device_t *device)
    1324 {
    1325         sonicvibes_t *sonic = snd_magic_cast(sonicvibes_t, device->device_data, return -ENXIO);
     1197                free_irq(sonic->irq, sonic);
     1198        release_and_free_resource(sonic->res_dmaa);
     1199        release_and_free_resource(sonic->res_dmac);
     1200        pci_release_regions(sonic->pci);
     1201        pci_disable_device(sonic->pci);
     1202        kfree(sonic);
     1203        return 0;
     1204}
     1205
     1206static int snd_sonicvibes_dev_free(struct snd_device *device)
     1207{
     1208        struct sonicvibes *sonic = device->device_data;
    13261209        return snd_sonicvibes_free(sonic);
    13271210}
    13281211
    1329 static int __init snd_sonicvibes_create(snd_card_t * card,
     1212static int __devinit snd_sonicvibes_create(struct snd_card *card,
    13301213                                        struct pci_dev *pci,
    13311214                                        int reverb,
    13321215                                        int mge,
    1333                                         sonicvibes_t ** rsonic)
    1334 {
    1335         sonicvibes_t *sonic;
     1216                                        struct sonicvibes ** rsonic)
     1217{
     1218        struct sonicvibes *sonic;
    13361219        unsigned int dmaa, dmac;
    13371220        int err;
    1338 #ifdef TARGET_OS2
    1339         static snd_device_ops_t ops = {
    1340                 snd_sonicvibes_dev_free,0,0,0
     1221        static struct snd_device_ops ops = {
     1222                .dev_free =     snd_sonicvibes_dev_free,
    13411223        };
    1342 #else
    1343         static snd_device_ops_t ops = {
    1344                 dev_free:       snd_sonicvibes_dev_free,
    1345         };
    1346 #endif
    13471224
    13481225        *rsonic = NULL;
     
    13511228                return err;
    13521229        /* check, if we can restrict PCI DMA transfers to 24 bits */
    1353         if (!pci_dma_supported(pci, 0x00ffffff)) {
    1354                 snd_printk("architecture does not support 24bit PCI busmaster DMA\n");
     1230        if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 ||
     1231            pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) {
     1232                snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
     1233                pci_disable_device(pci);
    13551234                return -ENXIO;
    13561235        }
    1357         pci_set_dma_mask(pci, 0x00ffffff);
    1358 
    1359         sonic = snd_magic_kcalloc(sonicvibes_t, 0, GFP_KERNEL);
    1360         if (sonic == NULL)
     1236
     1237        sonic = kzalloc(sizeof(*sonic), GFP_KERNEL);
     1238        if (sonic == NULL) {
     1239                pci_disable_device(pci);
    13611240                return -ENOMEM;
     1241        }
    13621242        spin_lock_init(&sonic->reg_lock);
    13631243        sonic->card = card;
    13641244        sonic->pci = pci;
    13651245        sonic->irq = -1;
     1246
     1247        if ((err = pci_request_regions(pci, "S3 SonicVibes")) < 0) {
     1248                kfree(sonic);
     1249                pci_disable_device(pci);
     1250                return err;
     1251        }
     1252
    13661253        sonic->sb_port = pci_resource_start(pci, 0);
    1367         if ((sonic->res_sb_port = request_region(sonic->sb_port, 0x10, "S3 SonicVibes SB")) == NULL) {
     1254        sonic->enh_port = pci_resource_start(pci, 1);
     1255        sonic->synth_port = pci_resource_start(pci, 2);
     1256        sonic->midi_port = pci_resource_start(pci, 3);
     1257        sonic->game_port = pci_resource_start(pci, 4);
     1258
     1259        if (request_irq(pci->irq, snd_sonicvibes_interrupt, IRQF_SHARED,
     1260                        "S3 SonicVibes", sonic)) {
     1261                snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
    13681262                snd_sonicvibes_free(sonic);
    1369                 snd_printk("unable to grab SB port at 0x%lx-0x%lx\n", sonic->sb_port, sonic->sb_port + 0x10 - 1);
    1370                 return -EBUSY;
    1371         }
    1372         sonic->enh_port = pci_resource_start(pci, 1);
    1373         if ((sonic->res_enh_port = request_region(sonic->enh_port, 0x10, "S3 SonicVibes Enhanced")) == NULL) {
    1374                 snd_sonicvibes_free(sonic);
    1375                 snd_printk("unable to grab PCM port at 0x%lx-0x%lx\n", sonic->enh_port, sonic->enh_port + 0x10 - 1);
    1376                 return -EBUSY;
    1377         }
    1378         sonic->synth_port = pci_resource_start(pci, 2);
    1379         if ((sonic->res_synth_port = request_region(sonic->synth_port, 4, "S3 SonicVibes Synth")) == NULL) {
    1380                 snd_sonicvibes_free(sonic);
    1381                 snd_printk("unable to grab synth port at 0x%lx-0x%lx\n", sonic->synth_port, sonic->synth_port + 4 - 1);
    1382                 return -EBUSY;
    1383         }
    1384         sonic->midi_port = pci_resource_start(pci, 3);
    1385         if ((sonic->res_midi_port = request_region(sonic->midi_port, 4, "S3 SonicVibes Midi")) == NULL) {
    1386                 snd_sonicvibes_free(sonic);
    1387                 snd_printk("unable to grab MIDI port at 0x%lx-0x%lx\n", sonic->midi_port, sonic->midi_port + 4 - 1);
    1388                 return -EBUSY;
    1389         }
    1390         sonic->game_port = pci_resource_start(pci, 4);
    1391         if (request_irq(pci->irq, snd_sonicvibes_interrupt, SA_INTERRUPT|SA_SHIRQ, "S3 SonicVibes", (void *)sonic)) {
    1392                 snd_magic_kfree(sonic);
    1393                 snd_printk("unable to grab IRQ %d\n", pci->irq);
    13941263                return -EBUSY;
    13951264        }
     
    13981267        pci_read_config_dword(pci, 0x40, &dmaa);
    13991268        pci_read_config_dword(pci, 0x48, &dmac);
    1400         snd_dmaio &= ~0x0f;
     1269        dmaio &= ~0x0f;
    14011270        dmaa &= ~0x0f;
    14021271        dmac &= ~0x0f;
    14031272        if (!dmaa) {
    1404                 dmaa = snd_dmaio;
    1405                 snd_dmaio += 0x10;
    1406                 snd_printk("BIOS did not allocate DDMA channel A i/o, allocated at 0x%x\n", dmaa);
     1273                dmaa = dmaio;
     1274                dmaio += 0x10;
     1275                snd_printk(KERN_INFO "BIOS did not allocate DDMA channel A i/o, allocated at 0x%x\n", dmaa);
    14071276        }
    14081277        if (!dmac) {
    1409                 dmac = snd_dmaio;
    1410                 snd_dmaio += 0x10;
    1411                 snd_printk("BIOS did not allocate DDMA channel C i/o, allocated at 0x%x\n", dmac);
     1278                dmac = dmaio;
     1279                dmaio += 0x10;
     1280                snd_printk(KERN_INFO "BIOS did not allocate DDMA channel C i/o, allocated at 0x%x\n", dmac);
    14121281        }
    14131282        pci_write_config_dword(pci, 0x40, dmaa);
     
    14161285        if ((sonic->res_dmaa = request_region(dmaa, 0x10, "S3 SonicVibes DDMA-A")) == NULL) {
    14171286                snd_sonicvibes_free(sonic);
    1418                 snd_printk("unable to grab DDMA-A port at 0x%x-0x%x\n", dmaa, dmaa + 0x10 - 1);
     1287                snd_printk(KERN_ERR "unable to grab DDMA-A port at 0x%x-0x%x\n", dmaa, dmaa + 0x10 - 1);
    14191288                return -EBUSY;
    14201289        }
    14211290        if ((sonic->res_dmac = request_region(dmac, 0x10, "S3 SonicVibes DDMA-C")) == NULL) {
    14221291                snd_sonicvibes_free(sonic);
    1423                 snd_printk("unable to grab DDMA-C port at 0x%x-0x%x\n", dmac, dmac + 0x10 - 1);
     1292                snd_printk(KERN_ERR "unable to grab DDMA-C port at 0x%x-0x%x\n", dmac, dmac + 0x10 - 1);
    14241293                return -EBUSY;
    14251294        }
     
    14781347#endif
    14791348        sonic->revision = snd_sonicvibes_in(sonic, SV_IREG_REVISION);
    1480         snd_ctl_add(card, snd_ctl_new1(&snd_sonicvibes_game_control, sonic));
    1481         snd_sonicvibes_proc_init(sonic);
    14821349
    14831350        if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, sonic, &ops)) < 0) {
     
    14861353        }
    14871354
     1355        snd_sonicvibes_proc_init(sonic);
     1356
     1357        snd_card_set_dev(card, &pci->dev);
     1358
    14881359        *rsonic = sonic;
    14891360        return 0;
     
    14941365 */
    14951366
    1496 #define SONICVIBES_MIDI_CONTROLS (sizeof(snd_sonicvibes_midi_controls)/sizeof(snd_kcontrol_new_t))
    1497 
    1498 static snd_kcontrol_new_t snd_sonicvibes_midi_controls[] = {
     1367static struct snd_kcontrol_new snd_sonicvibes_midi_controls[] __devinitdata = {
    14991368SONICVIBES_SINGLE("SonicVibes Wave Source RAM", 0, SV_IREG_WAVE_SOURCE, 0, 1, 0),
    15001369SONICVIBES_SINGLE("SonicVibes Wave Source RAM+ROM", 0, SV_IREG_WAVE_SOURCE, 1, 1, 0),
     
    15041373};
    15051374
    1506 static void snd_sonicvibes_midi_input_open(mpu401_t * mpu)
    1507 {
    1508         sonicvibes_t *sonic = snd_magic_cast(sonicvibes_t, mpu->private_data, return);
     1375static int snd_sonicvibes_midi_input_open(struct snd_mpu401 * mpu)
     1376{
     1377        struct sonicvibes *sonic = mpu->private_data;
    15091378        outb(sonic->irqmask &= ~SV_MIDI_MASK, SV_REG(sonic, IRQMASK));
    1510 }
    1511 
    1512 static void snd_sonicvibes_midi_input_close(mpu401_t * mpu)
    1513 {
    1514         sonicvibes_t *sonic = snd_magic_cast(sonicvibes_t, mpu->private_data, return);
     1379        return 0;
     1380}
     1381
     1382static void snd_sonicvibes_midi_input_close(struct snd_mpu401 * mpu)
     1383{
     1384        struct sonicvibes *sonic = mpu->private_data;
    15151385        outb(sonic->irqmask |= SV_MIDI_MASK, SV_REG(sonic, IRQMASK));
    15161386}
    15171387
    1518 static int snd_sonicvibes_midi(sonicvibes_t * sonic, snd_rawmidi_t * rmidi)
    1519 {
    1520         mpu401_t * mpu = snd_magic_cast(mpu401_t, rmidi->private_data, return -ENXIO);
    1521         snd_card_t *card = sonic->card;
    1522         snd_rawmidi_str_t *dir;
    1523         int idx, err;
     1388static int __devinit snd_sonicvibes_midi(struct sonicvibes * sonic,
     1389                                         struct snd_rawmidi *rmidi)
     1390{
     1391        struct snd_mpu401 * mpu = rmidi->private_data;
     1392        struct snd_card *card = sonic->card;
     1393        struct snd_rawmidi_str *dir;
     1394        unsigned int idx;
     1395        int err;
    15241396
    15251397        mpu->private_data = sonic;
     
    15271399        mpu->close_input = snd_sonicvibes_midi_input_close;
    15281400        dir = &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT];
    1529         for (idx = 0; idx < SONICVIBES_MIDI_CONTROLS; idx++)
     1401        for (idx = 0; idx < ARRAY_SIZE(snd_sonicvibes_midi_controls); idx++)
    15301402                if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_sonicvibes_midi_controls[idx], sonic))) < 0)
    15311403                        return err;
     
    15331405}
    15341406
    1535 static int __init snd_sonic_probe(struct pci_dev *pci,
    1536                                   const struct pci_device_id *id)
    1537 {
    1538         static int dev = 0;
    1539         snd_card_t *card;
    1540         sonicvibes_t *sonic;
    1541         snd_rawmidi_t *midi_uart;
    1542         opl3_t *opl3;
     1407static int __devinit snd_sonic_probe(struct pci_dev *pci,
     1408                                     const struct pci_device_id *pci_id)
     1409{
     1410        static int dev;
     1411        struct snd_card *card;
     1412        struct sonicvibes *sonic;
     1413        struct snd_rawmidi *midi_uart;
     1414        struct snd_opl3 *opl3;
    15431415        int idx, err;
    15441416
    1545         for ( ; dev < SNDRV_CARDS; dev++) {
    1546                 if (!snd_enable[dev]) {
    1547                         dev++;
    1548                         return -ENOENT;
    1549                 }
    1550                 break;
    1551         }
    15521417        if (dev >= SNDRV_CARDS)
    15531418                return -ENODEV;
     1419        if (!enable[dev]) {
     1420                dev++;
     1421                return -ENOENT;
     1422        }
    15541423 
    1555         card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE, 0);
     1424        card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
    15561425        if (card == NULL)
    15571426                return -ENOMEM;
     
    15641433        }
    15651434        if ((err = snd_sonicvibes_create(card, pci,
    1566                                          snd_reverb[dev] ? 1 : 0,
    1567                                          snd_mge[dev] ? 1 : 0,
     1435                                         reverb[dev] ? 1 : 0,
     1436                                         mge[dev] ? 1 : 0,
    15681437                                         &sonic)) < 0) {
    15691438                snd_card_free(card);
    15701439                return err;
    15711440        }
     1441
     1442        strcpy(card->driver, "SonicVibes");
     1443        strcpy(card->shortname, "S3 SonicVibes");
     1444        sprintf(card->longname, "%s rev %i at 0x%llx, irq %i",
     1445                card->shortname,
     1446                sonic->revision,
     1447                (unsigned long long)pci_resource_start(pci, 1),
     1448                sonic->irq);
     1449
    15721450        if ((err = snd_sonicvibes_pcm(sonic, 0, NULL)) < 0) {
    15731451                snd_card_free(card);
     
    15781456                return err;
    15791457        }
    1580         if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SONICVIBES,
    1581                                        sonic->midi_port, MPU401_INFO_INTEGRATED,
     1458        if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SONICVIBES,
     1459                                       sonic->midi_port, MPU401_INFO_INTEGRATED,
    15821460                                       sonic->irq, 0,
    15831461                                       &midi_uart)) < 0) {
     
    15961474                return err;
    15971475        }
    1598         strcpy(card->driver, "SonicVibes");
    1599         strcpy(card->shortname, "S3 SonicVibes");
    1600         sprintf(card->longname, "%s rev %i at 0x%lx, irq %i",
    1601                 card->shortname,
    1602                 sonic->revision,
    1603                 pci_resource_start(pci, 1),
    1604                 sonic->irq);
     1476
     1477        snd_sonicvibes_create_gameport(sonic);
    16051478
    16061479        if ((err = snd_card_register(card)) < 0) {
     
    16091482        }
    16101483       
    1611         PCI_SET_DRIVER_DATA(pci, card);
     1484        pci_set_drvdata(pci, card);
    16121485        dev++;
    16131486        return 0;
    16141487}
    16151488
    1616 static void __exit snd_sonic_remove(struct pci_dev *pci)
    1617 {
    1618         snd_card_free(PCI_GET_DRIVER_DATA(pci));
    1619         PCI_SET_DRIVER_DATA(pci, NULL);
     1489static void __devexit snd_sonic_remove(struct pci_dev *pci)
     1490{
     1491        snd_card_free(pci_get_drvdata(pci));
     1492        pci_set_drvdata(pci, NULL);
    16201493}
    16211494
    16221495static struct pci_driver driver = {
    1623 #ifdef TARGET_OS2
    1624         0, 0, 0,
    1625         "S3 SonicVibes",
    1626         snd_sonic_ids,
    1627         snd_sonic_probe,
    1628         snd_sonic_remove,
    1629         0, 0
    1630 #else
    1631         name: "S3 SonicVibes",
    1632         id_table: snd_sonic_ids,
    1633         probe: snd_sonic_probe,
    1634         remove: snd_sonic_remove,
    1635 #endif
     1496        .name = "S3 SonicVibes",
     1497        .id_table = snd_sonic_ids,
     1498        .probe = snd_sonic_probe,
     1499        .remove = __devexit_p(snd_sonic_remove),
    16361500};
    16371501
    16381502static int __init alsa_card_sonicvibes_init(void)
    16391503{
    1640         int err;
    1641 
    1642         if ((err = pci_module_init(&driver)) < 0) {
    1643 #ifdef MODULE
    1644 //              snd_printk("S3 SonicVibes soundcard not found or device busy\n");
    1645 #endif
    1646                 return err;
    1647         }
    1648         return 0;
     1504        return pci_register_driver(&driver);
    16491505}
    16501506
     
    16561512module_init(alsa_card_sonicvibes_init)
    16571513module_exit(alsa_card_sonicvibes_exit)
    1658 
    1659 #ifndef MODULE
    1660 
    1661 /* format is: snd-card-sonicvibes=snd_enable,snd_index,snd_id,
    1662                                   snd_reverb,snd_mge,snd_dmaio */
    1663 
    1664 static int __init alsa_card_sonicvibes_setup(char *str)
    1665 {
    1666         static unsigned __initdata nr_dev = 0;
    1667 
    1668         if (nr_dev >= SNDRV_CARDS)
    1669                 return 0;
    1670         (void)(get_option(&str,&snd_enable[nr_dev]) == 2 &&
    1671                get_option(&str,&snd_index[nr_dev]) == 2 &&
    1672                get_id(&str,&snd_id[nr_dev]) == 2 &&
    1673                get_option(&str,&snd_reverb[nr_dev]) == 2 &&
    1674                get_option(&str,&snd_mge[nr_dev]) == 2 &&
    1675                get_option(&str,(int *)&snd_dmaio) == 2);
    1676         nr_dev++;
    1677         return 1;
    1678 }
    1679 
    1680 __setup("snd-card-sonicvibes=", alsa_card_sonicvibes_setup);
    1681 
    1682 #endif /* ifndef MODULE */
Note: See TracChangeset for help on using the changeset viewer.