diff options
Diffstat (limited to 'sound/isa')
-rw-r--r-- | sound/isa/ad1816a/ad1816a_lib.c | 15 | ||||
-rw-r--r-- | sound/isa/ad1848/ad1848.c | 4 | ||||
-rw-r--r-- | sound/isa/ad1848/ad1848_lib.c | 18 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4231.c | 4 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4231_lib.c | 30 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4236.c | 4 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4236_lib.c | 6 | ||||
-rw-r--r-- | sound/isa/es1688/es1688.c | 4 | ||||
-rw-r--r-- | sound/isa/es18xx.c | 223 | ||||
-rw-r--r-- | sound/isa/gus/gus_dma.c | 10 | ||||
-rw-r--r-- | sound/isa/gus/gus_main.c | 2 | ||||
-rw-r--r-- | sound/isa/gus/gus_mem.c | 14 | ||||
-rw-r--r-- | sound/isa/gus/gus_pcm.c | 2 | ||||
-rw-r--r-- | sound/isa/gus/gus_synth.c | 14 | ||||
-rw-r--r-- | sound/isa/gus/gusclassic.c | 4 | ||||
-rw-r--r-- | sound/isa/gus/gusextreme.c | 4 | ||||
-rw-r--r-- | sound/isa/gus/gusmax.c | 4 | ||||
-rw-r--r-- | sound/isa/gus/interwave.c | 4 | ||||
-rw-r--r-- | sound/isa/opl3sa2.c | 4 | ||||
-rw-r--r-- | sound/isa/opti9xx/opti92x-ad1848.c | 6 | ||||
-rw-r--r-- | sound/isa/sb/sb16.c | 4 | ||||
-rw-r--r-- | sound/isa/sb/sb16_csp.c | 12 | ||||
-rw-r--r-- | sound/isa/sb/sb8.c | 4 | ||||
-rw-r--r-- | sound/isa/sb/sb_mixer.c | 4 | ||||
-rw-r--r-- | sound/isa/sgalaxy.c | 4 | ||||
-rw-r--r-- | sound/isa/wavefront/wavefront.c | 4 |
26 files changed, 295 insertions, 113 deletions
diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index ac0d808fff5..fd8fe16c09e 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c @@ -1,4 +1,3 @@ - /* ad1816a.c - lowlevel code for Analog Devices AD1816A chip. Copyright (C) 1999-2000 by Massimo Piccioni <dafastidio@libero.it> @@ -175,7 +174,7 @@ static void snd_ad1816a_close(struct snd_ad1816a *chip, unsigned int mode) static int snd_ad1816a_trigger(struct snd_ad1816a *chip, unsigned char what, - int channel, int cmd) + int channel, int cmd, int iscapture) { int error = 0; @@ -184,10 +183,14 @@ static int snd_ad1816a_trigger(struct snd_ad1816a *chip, unsigned char what, case SNDRV_PCM_TRIGGER_STOP: spin_lock(&chip->lock); cmd = (cmd == SNDRV_PCM_TRIGGER_START) ? 0xff: 0x00; - if (what & AD1816A_PLAYBACK_ENABLE) + /* if (what & AD1816A_PLAYBACK_ENABLE) */ + /* That is not valid, because playback and capture enable + * are the same bit pattern, just to different addresses + */ + if (! iscapture) snd_ad1816a_out_mask(chip, AD1816A_PLAYBACK_CONFIG, AD1816A_PLAYBACK_ENABLE, cmd); - if (what & AD1816A_CAPTURE_ENABLE) + else snd_ad1816a_out_mask(chip, AD1816A_CAPTURE_CONFIG, AD1816A_CAPTURE_ENABLE, cmd); spin_unlock(&chip->lock); @@ -204,14 +207,14 @@ static int snd_ad1816a_playback_trigger(struct snd_pcm_substream *substream, int { struct snd_ad1816a *chip = snd_pcm_substream_chip(substream); return snd_ad1816a_trigger(chip, AD1816A_PLAYBACK_ENABLE, - SNDRV_PCM_STREAM_PLAYBACK, cmd); + SNDRV_PCM_STREAM_PLAYBACK, cmd, 0); } static int snd_ad1816a_capture_trigger(struct snd_pcm_substream *substream, int cmd) { struct snd_ad1816a *chip = snd_pcm_substream_chip(substream); return snd_ad1816a_trigger(chip, AD1816A_CAPTURE_ENABLE, - SNDRV_PCM_STREAM_CAPTURE, cmd); + SNDRV_PCM_STREAM_CAPTURE, cmd, 1); } static int snd_ad1816a_hw_params(struct snd_pcm_substream *substream, diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c index e091bbeffd2..326a057f752 100644 --- a/sound/isa/ad1848/ad1848.c +++ b/sound/isa/ad1848/ad1848.c @@ -187,8 +187,10 @@ static int __init alsa_card_ad1848_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(SND_AD1848_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c index b78530d7ea9..e0f8baa843b 100644 --- a/sound/isa/ad1848/ad1848_lib.c +++ b/sound/isa/ad1848/ad1848_lib.c @@ -387,9 +387,9 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode) { unsigned long flags; - down(&chip->open_mutex); + mutex_lock(&chip->open_mutex); if (chip->mode & AD1848_MODE_OPEN) { - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return -EAGAIN; } snd_ad1848_mce_down(chip); @@ -432,7 +432,7 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode) spin_unlock_irqrestore(&chip->reg_lock, flags); chip->mode = mode; - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return 0; } @@ -441,9 +441,9 @@ static void snd_ad1848_close(struct snd_ad1848 *chip) { unsigned long flags; - down(&chip->open_mutex); + mutex_lock(&chip->open_mutex); if (!chip->mode) { - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return; } /* disable IRQ */ @@ -471,7 +471,7 @@ static void snd_ad1848_close(struct snd_ad1848 *chip) spin_unlock_irqrestore(&chip->reg_lock, flags); chip->mode = 0; - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); } /* @@ -889,7 +889,7 @@ int snd_ad1848_create(struct snd_card *card, if (chip == NULL) return -ENOMEM; spin_lock_init(&chip->reg_lock); - init_MUTEX(&chip->open_mutex); + mutex_init(&chip->open_mutex); chip->card = card; chip->port = port; chip->irq = -1; @@ -1202,10 +1202,8 @@ int snd_ad1848_add_ctl(struct snd_ad1848 *chip, const char *name, int index, int strlcpy(ctl->id.name, name, sizeof(ctl->id.name)); ctl->id.index = index; ctl->private_value = value; - if ((err = snd_ctl_add(chip->card, ctl)) < 0) { - snd_ctl_free_one(ctl); + if ((err = snd_ctl_add(chip->card, ctl)) < 0) return err; - } return 0; } diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c index ab67b5c2590..a30dcd96252 100644 --- a/sound/isa/cs423x/cs4231.c +++ b/sound/isa/cs423x/cs4231.c @@ -203,8 +203,10 @@ static int __init alsa_card_cs4231_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(SND_CS4231_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c index eab7eb59b5f..823db824670 100644 --- a/sound/isa/cs423x/cs4231_lib.c +++ b/sound/isa/cs423x/cs4231_lib.c @@ -531,7 +531,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip, unsigned long flags; int full_calib = 1; - down(&chip->mce_mutex); + mutex_lock(&chip->mce_mutex); snd_cs4231_calibrate_mute(chip, 1); if (chip->hardware == CS4231_HW_CS4231A || (chip->hardware & CS4231_HW_CS4232_MASK)) { @@ -560,7 +560,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip, snd_cs4231_mce_down(chip); } snd_cs4231_calibrate_mute(chip, 0); - up(&chip->mce_mutex); + mutex_unlock(&chip->mce_mutex); } static void snd_cs4231_capture_format(struct snd_cs4231 *chip, @@ -570,7 +570,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip, unsigned long flags; int full_calib = 1; - down(&chip->mce_mutex); + mutex_lock(&chip->mce_mutex); snd_cs4231_calibrate_mute(chip, 1); if (chip->hardware == CS4231_HW_CS4231A || (chip->hardware & CS4231_HW_CS4232_MASK)) { @@ -603,7 +603,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip, snd_cs4231_mce_down(chip); } snd_cs4231_calibrate_mute(chip, 0); - up(&chip->mce_mutex); + mutex_unlock(&chip->mce_mutex); } /* @@ -709,15 +709,15 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode) { unsigned long flags; - down(&chip->open_mutex); + mutex_lock(&chip->open_mutex); if ((chip->mode & mode) || ((chip->mode & CS4231_MODE_OPEN) && chip->single_dma)) { - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return -EAGAIN; } if (chip->mode & CS4231_MODE_OPEN) { chip->mode |= mode; - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return 0; } /* ok. now enable and ack CODEC IRQ */ @@ -737,7 +737,7 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode) spin_unlock_irqrestore(&chip->reg_lock, flags); chip->mode = mode; - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return 0; } @@ -745,10 +745,10 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode) { unsigned long flags; - down(&chip->open_mutex); + mutex_lock(&chip->open_mutex); chip->mode &= ~mode; if (chip->mode & CS4231_MODE_OPEN) { - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return; } snd_cs4231_calibrate_mute(chip, 1); @@ -785,7 +785,7 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode) snd_cs4231_calibrate_mute(chip, 0); chip->mode = 0; - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); } /* @@ -1408,8 +1408,8 @@ static int snd_cs4231_new(struct snd_card *card, chip->hwshare = hwshare; spin_lock_init(&chip->reg_lock); - init_MUTEX(&chip->mce_mutex); - init_MUTEX(&chip->open_mutex); + mutex_init(&chip->mce_mutex); + mutex_init(&chip->open_mutex); chip->card = card; chip->rate_constraint = snd_cs4231_xrate; chip->set_playback_format = snd_cs4231_playback_format; @@ -1538,8 +1538,8 @@ int snd_cs4231_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm) return err; spin_lock_init(&chip->reg_lock); - init_MUTEX(&chip->mce_mutex); - init_MUTEX(&chip->open_mutex); + mutex_init(&chip->mce_mutex); + mutex_init(&chip->open_mutex); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cs4231_playback_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cs4231_capture_ops); diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 99a42138bea..4060918e032 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c @@ -771,9 +771,9 @@ static int __init alsa_card_cs423x_init(void) if ((err = platform_driver_register(&cs423x_nonpnp_driver)) < 0) return err; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; - if (is_isapnp_selected(i)) + if (! enable[i] || is_isapnp_selected(i)) continue; device = platform_device_register_simple(CS423X_DRIVER, i, NULL, 0); diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c index e36981d64ec..7a5a6c71f5e 100644 --- a/sound/isa/cs423x/cs4236_lib.c +++ b/sound/isa/cs423x/cs4236_lib.c @@ -644,7 +644,7 @@ static int snd_cs4236_put_master_digital(struct snd_kcontrol *kcontrol, struct s val2 = (chip->eimage[CS4236_REG(CS4236_RIGHT_MASTER)] & ~0x7f) | val2; change = val1 != chip->eimage[CS4236_REG(CS4236_LEFT_MASTER)] || val2 != chip->eimage[CS4236_REG(CS4236_RIGHT_MASTER)]; snd_cs4236_ext_out(chip, CS4236_LEFT_MASTER, val1); - snd_cs4236_ext_out(chip, CS4236_RIGHT_MASTER, val1); + snd_cs4236_ext_out(chip, CS4236_RIGHT_MASTER, val2); spin_unlock_irqrestore(&chip->reg_lock, flags); return change; } @@ -841,7 +841,7 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn enable = ucontrol->value.integer.value[0] & 1; - down(&chip->mce_mutex); + mutex_lock(&chip->mce_mutex); snd_cs4231_mce_up(chip); spin_lock_irqsave(&chip->reg_lock, flags); val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1); @@ -854,7 +854,7 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn snd_cs4236_ctrl_out(chip, 4, val); spin_unlock_irqrestore(&chip->reg_lock, flags); snd_cs4231_mce_down(chip); - up(&chip->mce_mutex); + 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", diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index 50d23cf3d7c..2b69fc82926 100644 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c @@ -207,8 +207,10 @@ static int __init alsa_card_es1688_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(ES1688_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 08f032b5110..721955d2619 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -49,6 +49,10 @@ * - contrarily to some pages in DS_1869.PDF the rates can be set * independently. * + * - Zoom Video is implemented by sharing the FM DAC, thus the user can + * have either FM playback or Video playback but not both simultaneously. + * The Video Playback Switch mixer control toggles this choice. + * * BUGS: * * - There is a major trouble I noted: @@ -63,7 +67,16 @@ * */ - +/* + * ES1879 NOTES: + * - When Zoom Video is enabled (reg 0x71 bit 6 toggled on) the PCM playback + * seems to be effected (speaker_test plays a lower frequency). Can't find + * anything in the datasheet to account for this, so a Video Playback Switch + * control has been included to allow ZV to be enabled only when necessary. + * Then again on at least one test system the 0x71 bit 6 enable bit is not + * needed for ZV, so maybe the datasheet is entirely wrong here. + */ + #include <sound/driver.h> #include <linux/init.h> #include <linux/err.h> @@ -148,7 +161,7 @@ struct snd_audiodrive { #define ES18XX_DUPLEX_SAME 0x0010 /* Playback and record must share the same rate */ #define ES18XX_NEW_RATE 0x0020 /* More precise rate setting */ #define ES18XX_AUXB 0x0040 /* AuxB mixer control */ -#define ES18XX_HWV 0x0080 /* Has hardware volume */ +#define ES18XX_HWV 0x0080 /* Has seperate hardware volume mixer controls*/ #define ES18XX_MONO 0x0100 /* Mono_in mixer control */ #define ES18XX_I2S 0x0200 /* I2S mixer control */ #define ES18XX_MUTEREC 0x0400 /* Record source can be muted */ @@ -788,9 +801,12 @@ static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id, struct pt_regs *r /* Hardware volume */ if (status & HWV_IRQ) { - int split = snd_es18xx_mixer_read(chip, 0x64) & 0x80; - snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_switch->id); - snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_volume->id); + int split = 0; + if (chip->caps & ES18XX_HWV) { + split = snd_es18xx_mixer_read(chip, 0x64) & 0x80; + snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_switch->id); + snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_volume->id); + } if (!split) { snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_switch->id); snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_volume->id); @@ -939,37 +955,118 @@ static int snd_es18xx_capture_close(struct snd_pcm_substream *substream) * MIXER part */ +/* Record source mux routines: + * Depending on the chipset this mux switches between 4, 5, or 8 possible inputs. + * bit table for the 4/5 source mux: + * reg 1C: + * b2 b1 b0 muxSource + * x 0 x microphone + * 0 1 x CD + * 1 1 0 line + * 1 1 1 mixer + * if it's "mixer" and it's a 5 source mux chipset then reg 7A bit 3 determines + * either the play mixer or the capture mixer. + * + * "map4Source" translates from source number to reg bit pattern + * "invMap4Source" translates from reg bit pattern to source number + */ + static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static char *texts[8] = { + static char *texts4Source[4] = { + "Mic", "CD", "Line", "Master" + }; + static char *texts5Source[5] = { + "Mic", "CD", "Line", "Master", "Mix" + }; + static char *texts8Source[8] = { "Mic", "Mic Master", "CD", "AOUT", "Mic1", "Mix", "Line", "Master" }; + struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; - uinfo->value.enumerated.items = 8; - if (uinfo->value.enumerated.item > 7) - uinfo->value.enumerated.item = 7; - strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); + switch (chip->version) { + case 0x1868: + case 0x1878: + uinfo->value.enumerated.items = 4; + if (uinfo->value.enumerated.item > 3) + uinfo->value.enumerated.item = 3; + strcpy(uinfo->value.enumerated.name, texts4Source[uinfo->value.enumerated.item]); + break; + case 0x1887: + case 0x1888: + uinfo->value.enumerated.items = 5; + if (uinfo->value.enumerated.item > 4) + uinfo->value.enumerated.item = 4; + strcpy(uinfo->value.enumerated.name, texts5Source[uinfo->value.enumerated.item]); + break; + case 0x1869: /* DS somewhat contradictory for 1869: could be be 5 or 8 */ + case 0x1879: + uinfo->value.enumerated.items = 8; + if (uinfo->value.enumerated.item > 7) + uinfo->value.enumerated.item = 7; + strcpy(uinfo->value.enumerated.name, texts8Source[uinfo->value.enumerated.item]); + break; + default: + return -EINVAL; + } return 0; } static int snd_es18xx_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { + static unsigned char invMap4Source[8] = {0, 0, 1, 1, 0, 0, 2, 3}; struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); - ucontrol->value.enumerated.item[0] = snd_es18xx_mixer_read(chip, 0x1c) & 0x07; + int muxSource = snd_es18xx_mixer_read(chip, 0x1c) & 0x07; + if (!(chip->version == 0x1869 || chip->version == 0x1879)) { + muxSource = invMap4Source[muxSource]; + if (muxSource==3 && + (chip->version == 0x1887 || chip->version == 0x1888) && + (snd_es18xx_mixer_read(chip, 0x7a) & 0x08) + ) + muxSource = 4; + } + ucontrol->value.enumerated.item[0] = muxSource; return 0; } static int snd_es18xx_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { + static unsigned char map4Source[4] = {0, 2, 6, 7}; struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); unsigned char val = ucontrol->value.enumerated.item[0]; - - if (val > 7) + unsigned char retVal = 0; + + switch (chip->version) { + /* 5 source chips */ + case 0x1887: + case 0x1888: + if (val > 4) + return -EINVAL; + if (val == 4) { + retVal = snd_es18xx_mixer_bits(chip, 0x7a, 0x08, 0x08) != 0x08; + val = 3; + } else + retVal = snd_es18xx_mixer_bits(chip, 0x7a, 0x08, 0x00) != 0x00; + /* 4 source chips */ + case 0x1868: + case 0x1878: + if (val > 3) + return -EINVAL; + val = map4Source[val]; + break; + /* 8 source chips */ + case 0x1869: + case 0x1879: + if (val > 7) + return -EINVAL; + break; + default: return -EINVAL; - return snd_es18xx_mixer_bits(chip, 0x1c, 0x07, val) != val; + } + return (snd_es18xx_mixer_bits(chip, 0x1c, 0x07, val) != val) || retVal; } static int snd_es18xx_info_spatializer_enable(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) @@ -1191,19 +1288,22 @@ static int snd_es18xx_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e return change; } +/* Mixer controls + * These arrays contain setup data for mixer controls. + * + * The controls that are universal to all chipsets are fully initialized + * here. + */ static struct snd_kcontrol_new snd_es18xx_base_controls[] = { ES18XX_DOUBLE("Master Playback Volume", 0, 0x60, 0x62, 0, 0, 63, 0), ES18XX_DOUBLE("Master Playback Switch", 0, 0x60, 0x62, 6, 6, 1, 1), ES18XX_DOUBLE("Line Playback Volume", 0, 0x3e, 0x3e, 4, 0, 15, 0), ES18XX_DOUBLE("CD Playback Volume", 0, 0x38, 0x38, 4, 0, 15, 0), ES18XX_DOUBLE("FM Playback Volume", 0, 0x36, 0x36, 4, 0, 15, 0), -ES18XX_DOUBLE("Mono Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0), ES18XX_DOUBLE("Mic Playback Volume", 0, 0x1a, 0x1a, 4, 0, 15, 0), ES18XX_DOUBLE("Aux Playback Volume", 0, 0x3a, 0x3a, 4, 0, 15, 0), -ES18XX_SINGLE("PC Speaker Playback Volume", 0, 0x3c, 0, 7, 0), ES18XX_SINGLE("Record Monitor", 0, 0xa8, 3, 1, 0), ES18XX_DOUBLE("Capture Volume", 0, 0xb4, 0xb4, 4, 0, 15, 0), -ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1), { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Capture Source", @@ -1213,19 +1313,37 @@ ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1), } }; -static struct snd_kcontrol_new snd_es18xx_mono_in_control = -ES18XX_DOUBLE("Mono Input Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0); - static struct snd_kcontrol_new snd_es18xx_recmix_controls[] = { ES18XX_DOUBLE("PCM Capture Volume", 0, 0x69, 0x69, 4, 0, 15, 0), ES18XX_DOUBLE("Mic Capture Volume", 0, 0x68, 0x68, 4, 0, 15, 0), ES18XX_DOUBLE("Line Capture Volume", 0, 0x6e, 0x6e, 4, 0, 15, 0), ES18XX_DOUBLE("FM Capture Volume", 0, 0x6b, 0x6b, 4, 0, 15, 0), -ES18XX_DOUBLE("Mono Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0), ES18XX_DOUBLE("CD Capture Volume", 0, 0x6a, 0x6a, 4, 0, 15, 0), ES18XX_DOUBLE("Aux Capture Volume", 0, 0x6c, 0x6c, 4, 0, 15, 0) }; +/* + * The chipset specific mixer controls + */ +static struct snd_kcontrol_new snd_es18xx_opt_speaker = + ES18XX_SINGLE("PC Speaker Playback Volume", 0, 0x3c, 0, 7, 0); + +static struct snd_kcontrol_new snd_es18xx_opt_1869[] = { +ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1), +ES18XX_SINGLE("Video Playback Switch", 0, 0x7f, 0, 1, 0), +ES18XX_DOUBLE("Mono Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0), +ES18XX_DOUBLE("Mono Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0) +}; + +static struct snd_kcontrol_new snd_es18xx_opt_1878 = + ES18XX_DOUBLE("Video Playback Volume", 0, 0x68, 0x68, 4, 0, 15, 0); + +static struct snd_kcontrol_new snd_es18xx_opt_1879[] = { +ES18XX_SINGLE("Video Playback Switch", 0, 0x71, 6, 1, 0), +ES18XX_DOUBLE("Video Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0), +ES18XX_DOUBLE("Video Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0) +}; + static struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = { ES18XX_DOUBLE("PCM Playback Volume", 0, 0x14, 0x14, 4, 0, 15, 0), }; @@ -1270,7 +1388,6 @@ static struct snd_kcontrol_new snd_es18xx_hw_volume_controls[] = { ES18XX_SINGLE("Hardware Master Volume Split", 0, 0x64, 7, 1, 0), }; -#if 0 static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg) { int data; @@ -1281,7 +1398,6 @@ static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned ch spin_unlock_irqrestore(&chip->ctrl_lock, flags); return data; } -#endif static void __devinit snd_es18xx_config_write(struct snd_es18xx *chip, unsigned char reg, unsigned char data) @@ -1427,6 +1543,17 @@ static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip) snd_es18xx_mixer_write(chip, 0x58, 0x94); snd_es18xx_mixer_write(chip, 0x5a, 0x80); } + /* Flip the "enable I2S" bits for those chipsets that need it */ + switch (chip->version) { + case 0x1879: + //Leaving I2S enabled on the 1879 screws up the PCM playback (rate effected somehow) + //so a Switch control has been added to toggle this 0x71 bit on/off: + //snd_es18xx_mixer_bits(chip, 0x71, 0x40, 0x40); + /* Note: we fall through on purpose here. */ + case 0x1878: + snd_es18xx_config_write(chip, 0x29, snd_es18xx_config_read(chip, 0x29) | 0x40); + break; + } /* Mute input source */ if (chip->caps & ES18XX_MUTEREC) mask = 0x10; @@ -1476,11 +1603,14 @@ static int __devinit snd_es18xx_identify(struct snd_es18xx *chip) } outb(0x40, chip->port + 0x04); + udelay(10); hi = inb(chip->port + 0x05); + udelay(10); lo = inb(chip->port + 0x05); if (hi != lo) { chip->version = hi << 8 | lo; chip->ctrl_port = inb(chip->port + 0x05) << 8; + udelay(10); chip->ctrl_port += inb(chip->port + 0x05); if ((chip->res_ctrl_port = request_region(chip->ctrl_port, 8, "ES18xx - CTRL")) == NULL) { @@ -1519,22 +1649,22 @@ static int __devinit snd_es18xx_probe(struct snd_es18xx *chip) switch (chip->version) { case 0x1868: - chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_CONTROL | ES18XX_HWV; + chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_CONTROL; break; case 0x1869: chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_MONO | ES18XX_MUTEREC | ES18XX_CONTROL | ES18XX_HWV; break; case 0x1878: - chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_I2S | ES18XX_CONTROL | ES18XX_HWV; + chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_I2S | ES18XX_CONTROL; break; case 0x1879: chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_I2S | ES18XX_CONTROL | ES18XX_HWV; break; case 0x1887: - chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME | ES18XX_HWV; + chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME; break; case 0x1888: - chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME | ES18XX_HWV; + chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME; break; default: snd_printk(KERN_ERR "[0x%lx] unsupported chip ES%x\n", @@ -1778,10 +1908,6 @@ static int __devinit snd_es18xx_mixer(struct snd_es18xx *chip) } } - if (chip->caps & ES18XX_MONO) { - if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_mono_in_control, chip))) < 0) - return err; - } if (chip->caps & ES18XX_RECMIX) { for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_recmix_controls); idx++) { if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_recmix_controls[idx], chip))) < 0) @@ -1819,6 +1945,36 @@ static int __devinit snd_es18xx_mixer(struct snd_es18xx *chip) } } + /* finish initializing other chipset specific controls + */ + if (chip->version != 0x1868) { + err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_opt_speaker, + chip)); + if (err < 0) + return err; + } + if (chip->version == 0x1869) { + for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_opt_1869); idx++) { + err = snd_ctl_add(card, + snd_ctl_new1(&snd_es18xx_opt_1869[idx], + chip)); + if (err < 0) + return err; + } + } else if (chip->version == 0x1878) { + err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_opt_1878, + chip)); + if (err < 0) + return err; + } else if (chip->version == 0x1879) { + for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_opt_1879); idx++) { + err = snd_ctl_add(card, + snd_ctl_new1(&snd_es18xx_opt_1879[idx], + chip)); + if (err < 0) + return err; + } + } return 0; } @@ -1927,6 +2083,7 @@ static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard, err = pnp_activate_dev(acard->devc); if (err < 0) { snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n"); + kfree(cfg); return -EAGAIN; } snd_printdd("pnp: port=0x%lx\n", pnp_port_start(acard->devc, 0)); @@ -2225,9 +2382,9 @@ static int __init alsa_card_es18xx_init(void) if ((err = platform_driver_register(&snd_es18xx_nonpnp_driver)) < 0) return err; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; - if (is_isapnp_selected(i)) + if (! enable[i] || is_isapnp_selected(i)) continue; device = platform_device_register_simple(ES18XX_DRIVER, i, NULL, 0); diff --git a/sound/isa/gus/gus_dma.c b/sound/isa/gus/gus_dma.c index 930f4bc56f3..44ee5d3674a 100644 --- a/sound/isa/gus/gus_dma.c +++ b/sound/isa/gus/gus_dma.c @@ -149,10 +149,10 @@ static void snd_gf1_dma_interrupt(struct snd_gus_card * gus) int snd_gf1_dma_init(struct snd_gus_card * gus) { - down(&gus->dma_mutex); + mutex_lock(&gus->dma_mutex); gus->gf1.dma_shared++; if (gus->gf1.dma_shared > 1) { - up(&gus->dma_mutex); + mutex_unlock(&gus->dma_mutex); return 0; } gus->gf1.interrupt_handler_dma_write = snd_gf1_dma_interrupt; @@ -160,7 +160,7 @@ int snd_gf1_dma_init(struct snd_gus_card * gus) gus->gf1.dma_data_pcm_last = gus->gf1.dma_data_synth = gus->gf1.dma_data_synth_last = NULL; - up(&gus->dma_mutex); + mutex_unlock(&gus->dma_mutex); return 0; } @@ -168,7 +168,7 @@ int snd_gf1_dma_done(struct snd_gus_card * gus) { struct snd_gf1_dma_block *block; - down(&gus->dma_mutex); + mutex_lock(&gus->dma_mutex); gus->gf1.dma_shared--; if (!gus->gf1.dma_shared) { snd_dma_disable(gus->gf1.dma1); @@ -185,7 +185,7 @@ int snd_gf1_dma_done(struct snd_gus_card * gus) gus->gf1.dma_data_pcm_last = gus->gf1.dma_data_synth_last = NULL; } - up(&gus->dma_mutex); + mutex_unlock(&gus->dma_mutex); return 0; } diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index 6d15b3d18a8..53eeaf37007 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c @@ -225,7 +225,7 @@ int snd_gus_create(struct snd_card *card, spin_lock_init(&gus->dma_lock); spin_lock_init(&gus->pcm_volume_level_lock); spin_lock_init(&gus->uart_cmd_lock); - init_MUTEX(&gus->dma_mutex); + mutex_init(&gus->dma_mutex); if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, gus, &ops)) < 0) { snd_gus_free(gus); return err; diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c index e8bdb860a19..3c0d27aa08b 100644 --- a/sound/isa/gus/gus_mem.c +++ b/sound/isa/gus/gus_mem.c @@ -34,9 +34,9 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry, void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup) { if (!xup) { - down(&alloc->memory_mutex); + mutex_lock(&alloc->memory_mutex); } else { - up(&alloc->memory_mutex); + mutex_unlock(&alloc->memory_mutex); } } @@ -59,7 +59,7 @@ static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc, alloc->first = nblock; else nblock->prev->next = nblock; - up(&alloc->memory_mutex); + mutex_unlock(&alloc->memory_mutex); return NULL; } pblock = pblock->next; @@ -80,7 +80,7 @@ int snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * blo { if (block->share) { /* ok.. shared block */ block->share--; - up(&alloc->memory_mutex); + mutex_unlock(&alloc->memory_mutex); return 0; } if (alloc->first == block) { @@ -244,7 +244,7 @@ int snd_gf1_mem_init(struct snd_gus_card * gus) #endif alloc = &gus->gf1.mem_alloc; - init_MUTEX(&alloc->memory_mutex); + mutex_init(&alloc->memory_mutex); alloc->first = alloc->last = NULL; if (!gus->gf1.memory) return 0; @@ -299,7 +299,7 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry, gus = entry->private_data; alloc = &gus->gf1.mem_alloc; - down(&alloc->memory_mutex); + mutex_lock(&alloc->memory_mutex); snd_iprintf(buffer, "8-bit banks : \n "); for (i = 0; i < 4; i++) snd_iprintf(buffer, "0x%06x (%04ik)%s", alloc->banks_8[i].address, alloc->banks_8[i].size >> 10, i + 1 < 4 ? "," : ""); @@ -343,7 +343,7 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry, } snd_iprintf(buffer, " Total: memory = %i, used = %i, free = %i\n", total, used, total - used); - up(&alloc->memory_mutex); + mutex_unlock(&alloc->memory_mutex); #if 0 ultra_iprintf(buffer, " Verify: free = %i, max 8-bit block = %i, max 16-bit block = %i\n", ultra_memory_free_size(card, &card->gf1.mem_alloc), diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c index d0829393ec8..c7f95e7aa01 100644 --- a/sound/isa/gus/gus_pcm.c +++ b/sound/isa/gus/gus_pcm.c @@ -114,8 +114,6 @@ static void snd_gf1_pcm_trigger_up(struct snd_pcm_substream *substream) unsigned char pan; unsigned int voice; - if (substream == NULL) - return; spin_lock_irqsave(&pcmp->lock, flags); if (pcmp->flags & SNDRV_GF1_PCM_PFLG_ACTIVE) { spin_unlock_irqrestore(&pcmp->lock, flags); diff --git a/sound/isa/gus/gus_synth.c b/sound/isa/gus/gus_synth.c index 85a1b051f09..2767cc187ae 100644 --- a/sound/isa/gus/gus_synth.c +++ b/sound/isa/gus/gus_synth.c @@ -55,9 +55,9 @@ static int snd_gus_synth_use(void *private_data, struct snd_seq_port_subscribe * if (info->voices > 32) return -EINVAL; - down(&gus->register_mutex); + mutex_lock(&gus->register_mutex); if (!snd_gus_use_inc(gus)) { - up(&gus->register_mutex); + mutex_unlock(&gus->register_mutex); return -EFAULT; } for (idx = 0; idx < info->voices; idx++) { @@ -65,12 +65,12 @@ static int snd_gus_synth_use(void *private_data, struct snd_seq_port_subscribe * if (voice == NULL) { snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port); snd_gus_use_dec(gus); - up(&gus->register_mutex); + mutex_unlock(&gus->register_mutex); return -EBUSY; } voice->index = idx; } - up(&gus->register_mutex); + mutex_unlock(&gus->register_mutex); return 0; } @@ -79,10 +79,10 @@ static int snd_gus_synth_unuse(void *private_data, struct snd_seq_port_subscribe struct snd_gus_port * port = private_data; struct snd_gus_card * gus = port->gus; - down(&gus->register_mutex); + mutex_lock(&gus->register_mutex); snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port); snd_gus_use_dec(gus); - up(&gus->register_mutex); + mutex_unlock(&gus->register_mutex); return 0; } @@ -223,7 +223,7 @@ static int snd_gus_synth_new_device(struct snd_seq_device *dev) if (gus == NULL) return -EINVAL; - init_MUTEX(&gus->register_mutex); + mutex_init(&gus->register_mutex); gus->gf1.seq_client = -1; /* allocate new client */ diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c index 91c219116d7..26dccfea243 100644 --- a/sound/isa/gus/gusclassic.c +++ b/sound/isa/gus/gusclassic.c @@ -247,8 +247,10 @@ static int __init alsa_card_gusclassic_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(GUSCLASSIC_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index 239f16e6b9e..31dc20501d0 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c @@ -357,8 +357,10 @@ static int __init alsa_card_gusextreme_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(GUSEXTREME_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index d4d2b2a517d..cafb9b67fa7 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c @@ -384,8 +384,10 @@ static int __init alsa_card_gusmax_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(GUSMAX_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 9838d992b10..2cacd0fa687 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -935,8 +935,10 @@ static int __init alsa_card_interwave_init(void) if ((err = platform_driver_register(&snd_interwave_driver)) < 0) return err; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; #ifdef CONFIG_PNP if (isapnp[i]) continue; diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 9d843197850..56fcd8a946a 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -949,8 +949,10 @@ static int __init alsa_card_opl3sa2_init(void) if ((err = platform_driver_register(&snd_opl3sa2_nonpnp_driver)) < 0) return err; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; #ifdef CONFIG_PNP if (isapnp[i]) continue; diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 63d96be11b2..65b28cbc0eb 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -2088,9 +2088,11 @@ static int __init alsa_card_opti9xx_init(void) int error; struct platform_device *device; +#ifdef CONFIG_PNP pnp_register_card_driver(&opti9xx_pnpc_driver); if (snd_opti9xx_pnp_is_probed) return 0; +#endif if (! is_isapnp_selected()) { error = platform_driver_register(&snd_opti9xx_driver); if (error < 0) @@ -2102,7 +2104,9 @@ static int __init alsa_card_opti9xx_init(void) } platform_driver_unregister(&snd_opti9xx_driver); } +#ifdef CONFIG_PNP pnp_unregister_card_driver(&opti9xx_pnpc_driver); +#endif #ifdef MODULE printk(KERN_ERR "no OPTi " CHIP_NAME " soundcard found\n"); #endif @@ -2115,7 +2119,9 @@ static void __exit alsa_card_opti9xx_exit(void) platform_device_unregister(snd_opti9xx_platform_device); platform_driver_unregister(&snd_opti9xx_driver); } +#ifdef CONFIG_PNP pnp_unregister_card_driver(&opti9xx_pnpc_driver); +#endif } module_init(alsa_card_opti9xx_init) diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index 0667bd14ad6..5737ab76160 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c @@ -712,9 +712,9 @@ static int __init alsa_card_sb16_init(void) if ((err = platform_driver_register(&snd_sb16_nonpnp_driver)) < 0) return err; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; - if (is_isapnp_selected(i)) + if (! enable[i] || is_isapnp_selected(i)) continue; device = platform_device_register_simple(SND_SB16_DRIVER, i, NULL, 0); diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c index 9c2b5efbacb..9703c68e4e0 100644 --- a/sound/isa/sb/sb16_csp.c +++ b/sound/isa/sb/sb16_csp.c @@ -138,7 +138,7 @@ int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep) p->ops.csp_stop = snd_sb_csp_stop; p->ops.csp_qsound_transfer = snd_sb_csp_qsound_transfer; - init_MUTEX(&p->access_mutex); + mutex_init(&p->access_mutex); sprintf(hw->name, "CSP v%d.%d", (version >> 4), (version & 0x0f)); hw->iface = SNDRV_HWDEP_IFACE_SB16CSP; hw->private_data = p; @@ -265,13 +265,13 @@ static int snd_sb_csp_release(struct snd_hwdep * hw, struct file *file) */ static int snd_sb_csp_use(struct snd_sb_csp * p) { - down(&p->access_mutex); + mutex_lock(&p->access_mutex); if (p->used) { - up(&p->access_mutex); + mutex_unlock(&p->access_mutex); return -EAGAIN; } p->used++; - up(&p->access_mutex); + mutex_unlock(&p->access_mutex); return 0; @@ -282,9 +282,9 @@ static int snd_sb_csp_use(struct snd_sb_csp * p) */ static int snd_sb_csp_unuse(struct snd_sb_csp * p) { - down(&p->access_mutex); + mutex_lock(&p->access_mutex); p->used--; - up(&p->access_mutex); + mutex_unlock(&p->access_mutex); return 0; } diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index 60ee79cd14a..3efa23d303c 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c @@ -258,8 +258,10 @@ static int __init alsa_card_sb8_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(SND_SB8_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c index 1a6ee344ddd..490b1ca5cf5 100644 --- a/sound/isa/sb/sb_mixer.c +++ b/sound/isa/sb/sb_mixer.c @@ -453,10 +453,8 @@ int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int ty strlcpy(ctl->id.name, name, sizeof(ctl->id.name)); ctl->id.index = index; ctl->private_value = value; - if ((err = snd_ctl_add(chip->card, ctl)) < 0) { - snd_ctl_free_one(ctl); + if ((err = snd_ctl_add(chip->card, ctl)) < 0) return err; - } return 0; } diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c index 0dbbb35b242..a60e66afbf9 100644 --- a/sound/isa/sgalaxy.c +++ b/sound/isa/sgalaxy.c @@ -360,8 +360,10 @@ static int __init alsa_card_sgalaxy_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(SND_SGALAXY_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index fa3ab960de1..c0115bf9065 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c @@ -710,8 +710,10 @@ static int __init alsa_card_wavefront_init(void) if ((err = platform_driver_register(&snd_wavefront_driver)) < 0) return err; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; #ifdef CONFIG_PNP if (isapnp[i]) continue; |