]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/isa/cs423x/cs4236_lib.c
ALSA: Kill snd_assert() in sound/isa/*
[linux-2.6-omap-h63xx.git] / sound / isa / cs423x / cs4236_lib.c
index 7a5a6c71f5e489b6a2fcb069c974319e1276ace4..6a85fdc53b60a716f248ad1c20210f1148732cd6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
+ *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  *  Routines for control of CS4235/4236B/4237B/4238B/4239 chips
  *
  *  Note:
  *
  */
 
-#include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/time.h>
 #include <linux/wait.h>
 #include <sound/core.h>
-#include <sound/cs4231.h>
+#include <sound/wss.h>
 #include <sound/asoundef.h>
 
-MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
+MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
 MODULE_DESCRIPTION("Routines for control of CS4235/4236B/4237B/4238B/4239 chips");
 MODULE_LICENSE("GPL");
 
@@ -122,13 +121,14 @@ static unsigned char snd_cs4236_ext_map[18] = {
  *
  */
 
-static void snd_cs4236_ctrl_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val)
+static void snd_cs4236_ctrl_out(struct snd_wss *chip,
+                               unsigned char reg, unsigned char val)
 {
        outb(reg, chip->cport + 3);
        outb(chip->cimage[reg] = val, chip->cport + 4);
 }
 
-static unsigned char snd_cs4236_ctrl_in(struct snd_cs4231 *chip, unsigned char reg)
+static unsigned char snd_cs4236_ctrl_in(struct snd_wss *chip, unsigned char reg)
 {
        outb(reg, chip->cport + 3);
        return inb(chip->cport + 4);
@@ -181,44 +181,52 @@ static unsigned char divisor_to_rate_register(unsigned int divisor)
        }
 }
 
-static void snd_cs4236_playback_format(struct snd_cs4231 *chip, struct snd_pcm_hw_params *params, unsigned char pdfr)
+static void snd_cs4236_playback_format(struct snd_wss *chip,
+                                      struct snd_pcm_hw_params *params,
+                                      unsigned char pdfr)
 {
        unsigned long flags;
        unsigned char rate = divisor_to_rate_register(params->rate_den);
        
        spin_lock_irqsave(&chip->reg_lock, flags);
        /* set fast playback format change and clean playback FIFO */
-       snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] | 0x10);
-       snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, pdfr & 0xf0);
-       snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] & ~0x10);
+       snd_wss_out(chip, CS4231_ALT_FEATURE_1,
+                   chip->image[CS4231_ALT_FEATURE_1] | 0x10);
+       snd_wss_out(chip, CS4231_PLAYBK_FORMAT, pdfr & 0xf0);
+       snd_wss_out(chip, CS4231_ALT_FEATURE_1,
+                   chip->image[CS4231_ALT_FEATURE_1] & ~0x10);
        snd_cs4236_ext_out(chip, CS4236_DAC_RATE, rate);
        spin_unlock_irqrestore(&chip->reg_lock, flags);
 }
 
-static void snd_cs4236_capture_format(struct snd_cs4231 *chip, struct snd_pcm_hw_params *params, unsigned char cdfr)
+static void snd_cs4236_capture_format(struct snd_wss *chip,
+                                     struct snd_pcm_hw_params *params,
+                                     unsigned char cdfr)
 {
        unsigned long flags;
        unsigned char rate = divisor_to_rate_register(params->rate_den);
        
        spin_lock_irqsave(&chip->reg_lock, flags);
        /* set fast capture format change and clean capture FIFO */
-       snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] | 0x20);
-       snd_cs4231_out(chip, CS4231_REC_FORMAT, cdfr & 0xf0);
-       snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] & ~0x20);
+       snd_wss_out(chip, CS4231_ALT_FEATURE_1,
+                   chip->image[CS4231_ALT_FEATURE_1] | 0x20);
+       snd_wss_out(chip, CS4231_REC_FORMAT, cdfr & 0xf0);
+       snd_wss_out(chip, CS4231_ALT_FEATURE_1,
+                   chip->image[CS4231_ALT_FEATURE_1] & ~0x20);
        snd_cs4236_ext_out(chip, CS4236_ADC_RATE, rate);
        spin_unlock_irqrestore(&chip->reg_lock, flags);
 }
 
 #ifdef CONFIG_PM
 
-static void snd_cs4236_suspend(struct snd_cs4231 *chip)
+static void snd_cs4236_suspend(struct snd_wss *chip)
 {
        int reg;
        unsigned long flags;
        
        spin_lock_irqsave(&chip->reg_lock, flags);
        for (reg = 0; reg < 32; reg++)
-               chip->image[reg] = snd_cs4231_in(chip, reg);
+               chip->image[reg] = snd_wss_in(chip, reg);
        for (reg = 0; reg < 18; reg++)
                chip->eimage[reg] = snd_cs4236_ext_in(chip, CS4236_I23VAL(reg));
        for (reg = 2; reg < 9; reg++)
@@ -226,12 +234,12 @@ static void snd_cs4236_suspend(struct snd_cs4231 *chip)
        spin_unlock_irqrestore(&chip->reg_lock, flags);
 }
 
-static void snd_cs4236_resume(struct snd_cs4231 *chip)
+static void snd_cs4236_resume(struct snd_wss *chip)
 {
        int reg;
        unsigned long flags;
        
-       snd_cs4231_mce_up(chip);
+       snd_wss_mce_up(chip);
        spin_lock_irqsave(&chip->reg_lock, flags);
        for (reg = 0; reg < 32; reg++) {
                switch (reg) {
@@ -241,7 +249,7 @@ static void snd_cs4236_resume(struct snd_cs4231 *chip)
                case 29:        /* why? CS4235 - master right */
                        break;
                default:
-                       snd_cs4231_out(chip, reg, chip->image[reg]);
+                       snd_wss_out(chip, reg, chip->image[reg]);
                        break;
                }
        }
@@ -256,7 +264,7 @@ static void snd_cs4236_resume(struct snd_cs4231 *chip)
                }
        }
        spin_unlock_irqrestore(&chip->reg_lock, flags);
-       snd_cs4231_mce_down(chip);
+       snd_wss_mce_down(chip);
 }
 
 #endif /* CONFIG_PM */
@@ -267,24 +275,26 @@ int snd_cs4236_create(struct snd_card *card,
                      int irq, int dma1, int dma2,
                      unsigned short hardware,
                      unsigned short hwshare,
-                     struct snd_cs4231 ** rchip)
+                     struct snd_wss **rchip)
 {
-       struct snd_cs4231 *chip;
+       struct snd_wss *chip;
        unsigned char ver1, ver2;
        unsigned int reg;
        int err;
 
        *rchip = NULL;
-       if (hardware == CS4231_HW_DETECT)
-               hardware = CS4231_HW_DETECT3;
+       if (hardware == WSS_HW_DETECT)
+               hardware = WSS_HW_DETECT3;
        if (cport < 0x100) {
                snd_printk("please, specify control port for CS4236+ chips\n");
                return -ENODEV;
        }
-       if ((err = snd_cs4231_create(card, port, cport, irq, dma1, dma2, hardware, hwshare, &chip)) < 0)
+       err = snd_wss_create(card, port, cport,
+                            irq, dma1, dma2, hardware, hwshare, &chip);
+       if (err < 0)
                return err;
 
-       if (!(chip->hardware & CS4231_HW_CS4236B_MASK)) {
+       if (!(chip->hardware & WSS_HW_CS4236B_MASK)) {
                snd_printk("CS4236+: MODE3 and extended registers not available, hardware=0x%x\n",chip->hardware);
                snd_device_free(card, chip);
                return -ENODEV;
@@ -331,20 +341,20 @@ int snd_cs4236_create(struct snd_card *card,
                snd_cs4236_ext_out(chip, CS4236_I23VAL(reg), snd_cs4236_ext_map[reg]);
 
         /* initialize compatible but more featured registers */
-       snd_cs4231_out(chip, CS4231_LEFT_INPUT, 0x40);
-       snd_cs4231_out(chip, CS4231_RIGHT_INPUT, 0x40);
-       snd_cs4231_out(chip, CS4231_AUX1_LEFT_INPUT, 0xff);
-       snd_cs4231_out(chip, CS4231_AUX1_RIGHT_INPUT, 0xff);
-       snd_cs4231_out(chip, CS4231_AUX2_LEFT_INPUT, 0xdf);
-       snd_cs4231_out(chip, CS4231_AUX2_RIGHT_INPUT, 0xdf);
-       snd_cs4231_out(chip, CS4231_RIGHT_LINE_IN, 0xff);
-       snd_cs4231_out(chip, CS4231_LEFT_LINE_IN, 0xff);
-       snd_cs4231_out(chip, CS4231_RIGHT_LINE_IN, 0xff);
+       snd_wss_out(chip, CS4231_LEFT_INPUT, 0x40);
+       snd_wss_out(chip, CS4231_RIGHT_INPUT, 0x40);
+       snd_wss_out(chip, CS4231_AUX1_LEFT_INPUT, 0xff);
+       snd_wss_out(chip, CS4231_AUX1_RIGHT_INPUT, 0xff);
+       snd_wss_out(chip, CS4231_AUX2_LEFT_INPUT, 0xdf);
+       snd_wss_out(chip, CS4231_AUX2_RIGHT_INPUT, 0xdf);
+       snd_wss_out(chip, CS4231_RIGHT_LINE_IN, 0xff);
+       snd_wss_out(chip, CS4231_LEFT_LINE_IN, 0xff);
+       snd_wss_out(chip, CS4231_RIGHT_LINE_IN, 0xff);
        switch (chip->hardware) {
-       case CS4231_HW_CS4235:
-       case CS4231_HW_CS4239:
-               snd_cs4231_out(chip, CS4235_LEFT_MASTER, 0xff);
-               snd_cs4231_out(chip, CS4235_RIGHT_MASTER, 0xff);
+       case WSS_HW_CS4235:
+       case WSS_HW_CS4239:
+               snd_wss_out(chip, CS4235_LEFT_MASTER, 0xff);
+               snd_wss_out(chip, CS4235_RIGHT_MASTER, 0xff);
                break;
        }
 
@@ -352,12 +362,13 @@ int snd_cs4236_create(struct snd_card *card,
        return 0;
 }
 
-int snd_cs4236_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm)
+int snd_cs4236_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm)
 {
        struct snd_pcm *pcm;
        int err;
        
-       if ((err = snd_cs4231_pcm(chip, device, &pcm)) < 0)
+       err = snd_wss_pcm(chip, device, &pcm);
+       if (err < 0)
                return err;
        pcm->info_flags &= ~SNDRV_PCM_INFO_JOINT_DUPLEX;
        if (rpcm)
@@ -388,7 +399,7 @@ static int snd_cs4236_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_
 
 static int snd_cs4236_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int reg = kcontrol->private_value & 0xff;
        int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -405,7 +416,7 @@ static int snd_cs4236_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_e
 
 static int snd_cs4236_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int reg = kcontrol->private_value & 0xff;
        int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -434,7 +445,7 @@ static int snd_cs4236_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_e
 
 static int snd_cs4236_get_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int reg = kcontrol->private_value & 0xff;
        int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -451,7 +462,7 @@ static int snd_cs4236_get_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_
 
 static int snd_cs4236_put_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int reg = kcontrol->private_value & 0xff;
        int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -491,7 +502,7 @@ static int snd_cs4236_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_
 
 static int snd_cs4236_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int left_reg = kcontrol->private_value & 0xff;
        int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -513,7 +524,7 @@ static int snd_cs4236_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
 
 static int snd_cs4236_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int left_reg = kcontrol->private_value & 0xff;
        int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -556,7 +567,7 @@ static int snd_cs4236_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
 
 static int snd_cs4236_get_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int left_reg = kcontrol->private_value & 0xff;
        int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -578,7 +589,7 @@ static int snd_cs4236_get_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_
 
 static int snd_cs4236_put_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int left_reg = kcontrol->private_value & 0xff;
        int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -601,7 +612,7 @@ static int snd_cs4236_put_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_
        val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1;
        val2 = (chip->eimage[CS4236_REG(right_reg)] & ~(mask << shift_right)) | val2;
        change = val1 != chip->image[left_reg] || val2 != chip->eimage[CS4236_REG(right_reg)];
-       snd_cs4231_out(chip, left_reg, val1);
+       snd_wss_out(chip, left_reg, val1);
        snd_cs4236_ext_out(chip, right_reg, val2);
        spin_unlock_irqrestore(&chip->reg_lock, flags);
        return change;
@@ -620,7 +631,7 @@ static inline int snd_cs4236_mixer_master_digital_invert_volume(int vol)
 
 static int snd_cs4236_get_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        
        spin_lock_irqsave(&chip->reg_lock, flags);
@@ -632,7 +643,7 @@ static int snd_cs4236_get_master_digital(struct snd_kcontrol *kcontrol, struct s
 
 static int snd_cs4236_put_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int change;
        unsigned short val1, val2;
@@ -679,7 +690,7 @@ static inline int snd_cs4235_mixer_output_accu_set_volume(int vol)
 
 static int snd_cs4235_get_output_accu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        
        spin_lock_irqsave(&chip->reg_lock, flags);
@@ -691,7 +702,7 @@ static int snd_cs4235_get_output_accu(struct snd_kcontrol *kcontrol, struct snd_
 
 static int snd_cs4235_put_output_accu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int change;
        unsigned short val1, val2;
@@ -702,108 +713,160 @@ static int snd_cs4235_put_output_accu(struct snd_kcontrol *kcontrol, struct snd_
        val1 = (chip->image[CS4235_LEFT_MASTER] & ~(3 << 5)) | val1;
        val2 = (chip->image[CS4235_RIGHT_MASTER] & ~(3 << 5)) | val2;
        change = val1 != chip->image[CS4235_LEFT_MASTER] || val2 != chip->image[CS4235_RIGHT_MASTER];
-       snd_cs4231_out(chip, CS4235_LEFT_MASTER, val1);
-       snd_cs4231_out(chip, CS4235_RIGHT_MASTER, val2);
+       snd_wss_out(chip, CS4235_LEFT_MASTER, val1);
+       snd_wss_out(chip, CS4235_RIGHT_MASTER, val2);
        spin_unlock_irqrestore(&chip->reg_lock, flags);
        return change;
 }
 
 static struct snd_kcontrol_new snd_cs4236_controls[] = {
 
-CS4236_DOUBLE("Master Digital Playback Switch", 0, CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1),
-CS4236_DOUBLE("Master Digital Capture Switch", 0, CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1),
+CS4236_DOUBLE("Master Digital Playback Switch", 0,
+               CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1),
+CS4236_DOUBLE("Master Digital Capture Switch", 0,
+               CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1),
 CS4236_MASTER_DIGITAL("Master Digital Volume", 0),
 
-CS4236_DOUBLE("Capture Boost Volume", 0, CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1),
-
-CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
-CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1),
-
-CS4236_DOUBLE("DSP Playback Switch", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1),
-CS4236_DOUBLE("DSP Playback Volume", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 0, 0, 63, 1),
-
-CS4236_DOUBLE("FM Playback Switch", 0, CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1),
-CS4236_DOUBLE("FM Playback Volume", 0, CS4236_LEFT_FM, CS4236_RIGHT_FM, 0, 0, 63, 1),
-
-CS4236_DOUBLE("Wavetable Playback Switch", 0, CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1),
-CS4236_DOUBLE("Wavetable Playback Volume", 0, CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 0, 0, 63, 1),
-
-CS4231_DOUBLE("Synth Playback Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1),
-CS4231_DOUBLE("Synth Volume", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1),
-CS4231_DOUBLE("Synth Capture Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1),
-CS4231_DOUBLE("Synth Capture Bypass", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 5, 5, 1, 1),
-
-CS4236_DOUBLE("Mic Playback Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1),
-CS4236_DOUBLE("Mic Capture Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1),
+CS4236_DOUBLE("Capture Boost Volume", 0,
+               CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1),
+
+WSS_DOUBLE("PCM Playback Switch", 0,
+               CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
+WSS_DOUBLE("PCM Playback Volume", 0,
+               CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1),
+
+CS4236_DOUBLE("DSP Playback Switch", 0,
+               CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1),
+CS4236_DOUBLE("DSP Playback Volume", 0,
+               CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 0, 0, 63, 1),
+
+CS4236_DOUBLE("FM Playback Switch", 0,
+               CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1),
+CS4236_DOUBLE("FM Playback Volume", 0,
+               CS4236_LEFT_FM, CS4236_RIGHT_FM, 0, 0, 63, 1),
+
+CS4236_DOUBLE("Wavetable Playback Switch", 0,
+               CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1),
+CS4236_DOUBLE("Wavetable Playback Volume", 0,
+               CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 0, 0, 63, 1),
+
+WSS_DOUBLE("Synth Playback Switch", 0,
+               CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1),
+WSS_DOUBLE("Synth Volume", 0,
+               CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1),
+WSS_DOUBLE("Synth Capture Switch", 0,
+               CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1),
+WSS_DOUBLE("Synth Capture Bypass", 0,
+               CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 5, 5, 1, 1),
+
+CS4236_DOUBLE("Mic Playback Switch", 0,
+               CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1),
+CS4236_DOUBLE("Mic Capture Switch", 0,
+               CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1),
 CS4236_DOUBLE("Mic Volume", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 0, 0, 31, 1),
-CS4236_DOUBLE("Mic Playback Boost", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 5, 5, 1, 0),
-
-CS4231_DOUBLE("Line Playback Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1),
-CS4231_DOUBLE("Line Volume", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1),
-CS4231_DOUBLE("Line Capture Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1),
-CS4231_DOUBLE("Line Capture Bypass", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 5, 5, 1, 1),
-
-CS4231_DOUBLE("CD Playback Switch", 0, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
-CS4231_DOUBLE("CD Volume", 0, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1),
-CS4231_DOUBLE("CD Capture Switch", 0, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1),
-
-CS4236_DOUBLE1("Mono Output Playback Switch", 0, CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1),
-CS4236_DOUBLE1("Mono Playback Switch", 0, CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1),
-CS4231_SINGLE("Mono Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1),
-CS4231_SINGLE("Mono Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0),
-
-CS4231_DOUBLE("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0),
-CS4231_DOUBLE("Analog Loopback Capture Switch", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0),
-
-CS4231_SINGLE("Digital Loopback Playback Switch", 0, CS4231_LOOPBACK, 0, 1, 0),
-CS4236_DOUBLE1("Digital Loopback Playback Volume", 0, CS4231_LOOPBACK, CS4236_RIGHT_LOOPBACK, 2, 0, 63, 1)
+CS4236_DOUBLE("Mic Playback Boost", 0,
+               CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 5, 5, 1, 0),
+
+WSS_DOUBLE("Line Playback Switch", 0,
+               CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1),
+WSS_DOUBLE("Line Volume", 0,
+               CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1),
+WSS_DOUBLE("Line Capture Switch", 0,
+               CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1),
+WSS_DOUBLE("Line Capture Bypass", 0,
+               CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 5, 5, 1, 1),
+
+WSS_DOUBLE("CD Playback Switch", 0,
+               CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
+WSS_DOUBLE("CD Volume", 0,
+               CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1),
+WSS_DOUBLE("CD Capture Switch", 0,
+               CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1),
+
+CS4236_DOUBLE1("Mono Output Playback Switch", 0,
+               CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1),
+CS4236_DOUBLE1("Mono Playback Switch", 0,
+               CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1),
+WSS_SINGLE("Mono Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1),
+WSS_SINGLE("Mono Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0),
+
+WSS_DOUBLE("Capture Volume", 0,
+               CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0),
+WSS_DOUBLE("Analog Loopback Capture Switch", 0,
+               CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0),
+
+WSS_SINGLE("Digital Loopback Playback Switch", 0, CS4231_LOOPBACK, 0, 1, 0),
+CS4236_DOUBLE1("Digital Loopback Playback Volume", 0,
+               CS4231_LOOPBACK, CS4236_RIGHT_LOOPBACK, 2, 0, 63, 1)
 };
 
 static struct snd_kcontrol_new snd_cs4235_controls[] = {
 
-CS4231_DOUBLE("Master Switch", 0, CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 7, 7, 1, 1),
-CS4231_DOUBLE("Master Volume", 0, CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 0, 0, 31, 1),
+WSS_DOUBLE("Master Switch", 0,
+               CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 7, 7, 1, 1),
+WSS_DOUBLE("Master Volume", 0,
+               CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 0, 0, 31, 1),
 
 CS4235_OUTPUT_ACCU("Playback Volume", 0),
 
-CS4236_DOUBLE("Master Digital Playback Switch", 0, CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1),
-CS4236_DOUBLE("Master Digital Capture Switch", 0, CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1),
+CS4236_DOUBLE("Master Digital Playback Switch", 0,
+               CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1),
+CS4236_DOUBLE("Master Digital Capture Switch", 0,
+               CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1),
 CS4236_MASTER_DIGITAL("Master Digital Volume", 0),
 
-CS4231_DOUBLE("Master Digital Playback Switch", 1, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1),
-CS4231_DOUBLE("Master Digital Capture Switch", 1, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1),
-CS4231_DOUBLE("Master Digital Volume", 1, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1),
+WSS_DOUBLE("Master Digital Playback Switch", 1,
+               CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1),
+WSS_DOUBLE("Master Digital Capture Switch", 1,
+               CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1),
+WSS_DOUBLE("Master Digital Volume", 1,
+               CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1),
 
-CS4236_DOUBLE("Capture Volume", 0, CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1),
+CS4236_DOUBLE("Capture Volume", 0,
+               CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1),
 
-CS4231_DOUBLE("PCM Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
-CS4231_DOUBLE("PCM Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1),
+WSS_DOUBLE("PCM Switch", 0,
+               CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
+WSS_DOUBLE("PCM Volume", 0,
+               CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1),
 
 CS4236_DOUBLE("DSP Switch", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1),
 
 CS4236_DOUBLE("FM Switch", 0, CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1),
 
-CS4236_DOUBLE("Wavetable Switch", 0, CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1),
+CS4236_DOUBLE("Wavetable Switch", 0,
+               CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1),
 
-CS4236_DOUBLE("Mic Capture Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1),
-CS4236_DOUBLE("Mic Playback Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1),
+CS4236_DOUBLE("Mic Capture Switch", 0,
+               CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1),
+CS4236_DOUBLE("Mic Playback Switch", 0,
+               CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1),
 CS4236_SINGLE("Mic Volume", 0, CS4236_LEFT_MIC, 0, 31, 1),
 CS4236_SINGLE("Mic Playback Boost", 0, CS4236_LEFT_MIC, 5, 1, 0),
 
-CS4231_DOUBLE("Aux Playback Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1),
-CS4231_DOUBLE("Aux Capture Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1),
-CS4231_DOUBLE("Aux Volume", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1),
-
-CS4231_DOUBLE("Aux Playback Switch", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
-CS4231_DOUBLE("Aux Capture Switch", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1),
-CS4231_DOUBLE("Aux Volume", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1),
-
-CS4236_DOUBLE1("Master Mono Switch", 0, CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1),
-
-CS4236_DOUBLE1("Mono Switch", 0, CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1),
-CS4231_SINGLE("Mono Volume", 0, CS4231_MONO_CTRL, 0, 15, 1),
-
-CS4231_DOUBLE("Analog Loopback Switch", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0),
+WSS_DOUBLE("Aux Playback Switch", 0,
+               CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1),
+WSS_DOUBLE("Aux Capture Switch", 0,
+               CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1),
+WSS_DOUBLE("Aux Volume", 0,
+               CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1),
+
+WSS_DOUBLE("Aux Playback Switch", 1,
+               CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
+WSS_DOUBLE("Aux Capture Switch", 1,
+               CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1),
+WSS_DOUBLE("Aux Volume", 1,
+               CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1),
+
+CS4236_DOUBLE1("Master Mono Switch", 0,
+               CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1),
+
+CS4236_DOUBLE1("Mono Switch", 0,
+               CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1),
+WSS_SINGLE("Mono Volume", 0, CS4231_MONO_CTRL, 0, 15, 1),
+
+WSS_DOUBLE("Analog Loopback Switch", 0,
+               CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0),
 };
 
 #define CS4236_IEC958_ENABLE(xname, xindex) \
@@ -814,14 +877,14 @@ CS4231_DOUBLE("Analog Loopback Switch", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT
 
 static int snd_cs4236_get_iec958_switch(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        
        spin_lock_irqsave(&chip->reg_lock, flags);
        ucontrol->value.integer.value[0] = chip->image[CS4231_ALT_FEATURE_1] & 0x02 ? 1 : 0;
 #if 0
        printk("get valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",
-                       snd_cs4231_in(chip, CS4231_ALT_FEATURE_1),
+                       snd_wss_in(chip, CS4231_ALT_FEATURE_1),
                        snd_cs4236_ctrl_in(chip, 3),
                        snd_cs4236_ctrl_in(chip, 4),
                        snd_cs4236_ctrl_in(chip, 5),
@@ -834,7 +897,7 @@ static int snd_cs4236_get_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
 
 static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int change;
        unsigned short enable, val;
@@ -842,23 +905,23 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
        enable = ucontrol->value.integer.value[0] & 1;
 
        mutex_lock(&chip->mce_mutex);
-       snd_cs4231_mce_up(chip);
+       snd_wss_mce_up(chip);
        spin_lock_irqsave(&chip->reg_lock, flags);
        val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1);
        change = val != chip->image[CS4231_ALT_FEATURE_1];
-       snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, val);
+       snd_wss_out(chip, CS4231_ALT_FEATURE_1, val);
        val = snd_cs4236_ctrl_in(chip, 4) | 0xc0;
        snd_cs4236_ctrl_out(chip, 4, val);
        udelay(100);
        val &= ~0x40;
        snd_cs4236_ctrl_out(chip, 4, val);
        spin_unlock_irqrestore(&chip->reg_lock, flags);
-       snd_cs4231_mce_down(chip);
+       snd_wss_mce_down(chip);
        mutex_unlock(&chip->mce_mutex);
 
 #if 0
        printk("set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",
-                       snd_cs4231_in(chip, CS4231_ALT_FEATURE_1),
+                       snd_wss_in(chip, CS4231_ALT_FEATURE_1),
                        snd_cs4236_ctrl_in(chip, 3),
                        snd_cs4236_ctrl_in(chip, 4),
                        snd_cs4236_ctrl_in(chip, 5),
@@ -897,19 +960,20 @@ CS4236_SINGLEC("3D Control - Volume", 0, 2, 0, 15, 1),
 CS4236_SINGLEC("3D Control - IEC958", 0, 3, 5, 1, 0)
 };
 
-int snd_cs4236_mixer(struct snd_cs4231 *chip)
+int snd_cs4236_mixer(struct snd_wss *chip)
 {
        struct snd_card *card;
        unsigned int idx, count;
        int err;
        struct snd_kcontrol_new *kcontrol;
 
-       snd_assert(chip != NULL && chip->card != NULL, return -EINVAL);
+       if (snd_BUG_ON(!chip || !chip->card))
+               return -EINVAL;
        card = chip->card;
-       strcpy(card->mixername, snd_cs4231_chip_id(chip));
+       strcpy(card->mixername, snd_wss_chip_id(chip));
 
-       if (chip->hardware == CS4231_HW_CS4235 ||
-           chip->hardware == CS4231_HW_CS4239) {
+       if (chip->hardware == WSS_HW_CS4235 ||
+           chip->hardware == WSS_HW_CS4239) {
                for (idx = 0; idx < ARRAY_SIZE(snd_cs4235_controls); idx++) {
                        if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4235_controls[idx], chip))) < 0)
                                return err;
@@ -921,16 +985,16 @@ int snd_cs4236_mixer(struct snd_cs4231 *chip)
                }
        }
        switch (chip->hardware) {
-       case CS4231_HW_CS4235:
-       case CS4231_HW_CS4239:
+       case WSS_HW_CS4235:
+       case WSS_HW_CS4239:
                count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4235);
                kcontrol = snd_cs4236_3d_controls_cs4235;
                break;
-       case CS4231_HW_CS4237B:
+       case WSS_HW_CS4237B:
                count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4237);
                kcontrol = snd_cs4236_3d_controls_cs4237;
                break;
-       case CS4231_HW_CS4238B:
+       case WSS_HW_CS4238B:
                count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4238);
                kcontrol = snd_cs4236_3d_controls_cs4238;
                break;
@@ -942,8 +1006,8 @@ int snd_cs4236_mixer(struct snd_cs4231 *chip)
                if ((err = snd_ctl_add(card, snd_ctl_new1(kcontrol, chip))) < 0)
                        return err;
        }
-       if (chip->hardware == CS4231_HW_CS4237B ||
-           chip->hardware == CS4231_HW_CS4238B) {
+       if (chip->hardware == WSS_HW_CS4237B ||
+           chip->hardware == WSS_HW_CS4238B) {
                for (idx = 0; idx < ARRAY_SIZE(snd_cs4236_iec958_controls); idx++) {
                        if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_iec958_controls[idx], chip))) < 0)
                                return err;