aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@suse.cz>2005-01-03 13:37:31 +0100
committerJaroslav Kysela <perex@suse.cz>2005-01-03 13:37:31 +0100
commit8aedeb7a9643ef562ce63d80c27327f3984690df (patch)
tree2b3d926a3f881fd4c7ff7a814951c77de351d64e /sound
parent9c0df338ecf8901c3846080a82a4d277278234c1 (diff)
downloadhistory-8aedeb7a9643ef562ce63d80c27327f3984690df.tar.gz
[ALSA] Remove unnecessary ac97 spinlocks
ATIIXP driver,ATIIXP-modem driver,ENS1370/1+ driver,Intel8x0 driver Intel8x0-modem driver,Maestro3 driver,VIA82xx driver VIA82xx-modem driver Removed unnecessary spinlocks in ac97 callbacks. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/atiixp.c10
-rw-r--r--sound/pci/atiixp_modem.c10
-rw-r--r--sound/pci/ens1370.c22
-rw-r--r--sound/pci/intel8x0.c16
-rw-r--r--sound/pci/intel8x0m.c6
-rw-r--r--sound/pci/maestro3.c24
-rw-r--r--sound/pci/via82xx.c7
-rw-r--r--sound/pci/via82xx_modem.c7
8 files changed, 17 insertions, 85 deletions
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 07800df4690f55..f05b51b23bdc7e 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -264,7 +264,6 @@ struct snd_atiixp {
ac97_t *ac97[NUM_ATI_CODECS];
spinlock_t reg_lock;
- spinlock_t ac97_lock;
atiixp_dma_t dmas[NUM_ATI_DMAS];
struct ac97_pcm *pcms[NUM_ATI_PCMS];
@@ -476,20 +475,14 @@ static void snd_atiixp_codec_write(atiixp_t *chip, unsigned short codec, unsigne
static unsigned short snd_atiixp_ac97_read(ac97_t *ac97, unsigned short reg)
{
atiixp_t *chip = ac97->private_data;
- unsigned short data;
- spin_lock(&chip->ac97_lock);
- data = snd_atiixp_codec_read(chip, ac97->num, reg);
- spin_unlock(&chip->ac97_lock);
- return data;
+ return snd_atiixp_codec_read(chip, ac97->num, reg);
}
static void snd_atiixp_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val)
{
atiixp_t *chip = ac97->private_data;
- spin_lock(&chip->ac97_lock);
snd_atiixp_codec_write(chip, ac97->num, reg, val);
- spin_unlock(&chip->ac97_lock);
}
/*
@@ -1506,7 +1499,6 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
}
spin_lock_init(&chip->reg_lock);
- spin_lock_init(&chip->ac97_lock);
init_MUTEX(&chip->open_mutex);
chip->card = card;
chip->pci = pci;
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 4404f564c506e0..e55a7c6bdde950 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -247,7 +247,6 @@ struct snd_atiixp {
ac97_t *ac97[NUM_ATI_CODECS];
spinlock_t reg_lock;
- spinlock_t ac97_lock;
atiixp_dma_t dmas[NUM_ATI_DMAS];
struct ac97_pcm *pcms[NUM_ATI_PCMS];
@@ -457,20 +456,14 @@ static void snd_atiixp_codec_write(atiixp_t *chip, unsigned short codec, unsigne
static unsigned short snd_atiixp_ac97_read(ac97_t *ac97, unsigned short reg)
{
atiixp_t *chip = ac97->private_data;
- unsigned short data;
- spin_lock(&chip->ac97_lock);
- data = snd_atiixp_codec_read(chip, ac97->num, reg);
- spin_unlock(&chip->ac97_lock);
- return data;
+ return snd_atiixp_codec_read(chip, ac97->num, reg);
}
static void snd_atiixp_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val)
{
atiixp_t *chip = ac97->private_data;
- spin_lock(&chip->ac97_lock);
snd_atiixp_codec_write(chip, ac97->num, reg, val);
- spin_unlock(&chip->ac97_lock);
}
/*
@@ -1228,7 +1221,6 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
}
spin_lock_init(&chip->reg_lock);
- spin_lock_init(&chip->ac97_lock);
init_MUTEX(&chip->open_mutex);
chip->card = card;
chip->pci = pci;
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 31a39810178fdd..d2a9b4c4d620d0 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -573,24 +573,18 @@ static void snd_es1370_codec_write(ak4531_t *ak4531,
unsigned short reg, unsigned short val)
{
ensoniq_t *ensoniq = ak4531->private_data;
- unsigned long flags;
unsigned long end_time = jiffies + HZ / 10;
#if 0
printk("CODEC WRITE: reg = 0x%x, val = 0x%x (0x%x), creg = 0x%x\n", reg, val, ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC));
#endif
do {
- spin_lock_irqsave(&ensoniq->reg_lock, flags);
if (!(inl(ES_REG(ensoniq, STATUS)) & ES_1370_CSTAT)) {
outw(ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC));
- spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
return;
}
- spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
-#if 0
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
-#endif
} while (time_after(end_time, jiffies));
snd_printk("codec write timeout, status = 0x%x\n", inl(ES_REG(ensoniq, STATUS)));
}
@@ -603,11 +597,10 @@ static void snd_es1371_codec_write(ac97_t *ac97,
unsigned short reg, unsigned short val)
{
ensoniq_t *ensoniq = ac97->private_data;
- unsigned long flags;
unsigned int t, x;
+ down(&ensoniq->src_mutex);
for (t = 0; t < POLL_COUNT; t++) {
- spin_lock_irqsave(&ensoniq->reg_lock, flags);
if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) {
/* save the current state for latter */
x = snd_es1371_wait_src_ready(ensoniq);
@@ -629,11 +622,11 @@ static void snd_es1371_codec_write(ac97_t *ac97,
/* restore SRC reg */
snd_es1371_wait_src_ready(ensoniq);
outl(x, ES_REG(ensoniq, 1371_SMPRATE));
- spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
+ up(&ensoniq->src_mutex);
return;
}
- spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
}
+ up(&ensoniq->src_mutex);
snd_printk("codec write timeout at 0x%lx [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC)));
}
@@ -641,12 +634,11 @@ static unsigned short snd_es1371_codec_read(ac97_t *ac97,
unsigned short reg)
{
ensoniq_t *ensoniq = ac97->private_data;
- unsigned long flags;
unsigned int t, x, fail = 0;
__again:
+ down(&ensoniq->src_mutex);
for (t = 0; t < POLL_COUNT; t++) {
- spin_lock_irqsave(&ensoniq->reg_lock, flags);
if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) {
/* save the current state for latter */
x = snd_es1371_wait_src_ready(ensoniq);
@@ -676,19 +668,19 @@ static unsigned short snd_es1371_codec_read(ac97_t *ac97,
/* now wait for the stinkin' data (RDY) */
for (t = 0; t < POLL_COUNT; t++) {
if ((x = inl(ES_REG(ensoniq, 1371_CODEC))) & ES_1371_CODEC_RDY) {
- spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
+ up(&ensoniq->src_mutex);
return ES_1371_CODEC_READ(x);
}
}
- spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
+ up(&ensoniq->src_mutex);
if (++fail > 10) {
snd_printk("codec read timeout (final) at 0x%lx, reg = 0x%x [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), reg, inl(ES_REG(ensoniq, 1371_CODEC)));
return 0;
}
goto __again;
}
- spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
}
+ up(&ensoniq->src_mutex);
snd_printk("es1371: codec read timeout at 0x%lx [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC)));
return 0;
}
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index e901a48c2046dd..15aee25229fac8 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -422,7 +422,6 @@ struct _snd_intel8x0 {
unsigned int ac97_sdin[3];
spinlock_t reg_lock;
- spinlock_t ac97_lock;
u32 bdbars_count;
struct snd_dma_buffer bdbars;
@@ -590,13 +589,11 @@ static void snd_intel8x0_codec_write(ac97_t *ac97,
{
intel8x0_t *chip = ac97->private_data;
- spin_lock(&chip->ac97_lock);
if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) {
if (! chip->in_ac97_init)
snd_printk("codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg);
}
iaputword(chip, reg + ac97->num * 0x80, val);
- spin_unlock(&chip->ac97_lock);
}
static unsigned short snd_intel8x0_codec_read(ac97_t *ac97,
@@ -606,7 +603,6 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97,
unsigned short res;
unsigned int tmp;
- spin_lock(&chip->ac97_lock);
if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) {
if (! chip->in_ac97_init)
snd_printk("codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg);
@@ -621,7 +617,6 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97,
res = 0xffff;
}
}
- spin_unlock(&chip->ac97_lock);
return res;
}
@@ -629,7 +624,6 @@ static void snd_intel8x0_codec_read_test(intel8x0_t *chip, unsigned int codec)
{
unsigned int tmp;
- spin_lock(&chip->ac97_lock);
if (snd_intel8x0_codec_semaphore(chip, codec) >= 0) {
iagetword(chip, codec * 0x80);
if ((tmp = igetdword(chip, ICHREG(GLOB_STA))) & ICH_RCS) {
@@ -637,7 +631,6 @@ static void snd_intel8x0_codec_read_test(intel8x0_t *chip, unsigned int codec)
iputdword(chip, ICHREG(GLOB_STA), tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI));
}
}
- spin_unlock(&chip->ac97_lock);
}
/*
@@ -670,7 +663,6 @@ static unsigned short snd_intel8x0_ali_codec_read(ac97_t *ac97, unsigned short r
intel8x0_t *chip = ac97->private_data;
unsigned short data = 0xffff;
- spin_lock(&chip->ac97_lock);
if (snd_intel8x0_ali_codec_semaphore(chip))
goto __err;
reg |= ALI_CPR_ADDR_READ;
@@ -681,7 +673,6 @@ static unsigned short snd_intel8x0_ali_codec_read(ac97_t *ac97, unsigned short r
goto __err;
data = igetword(chip, ICHREG(ALI_SPR));
__err:
- spin_unlock(&chip->ac97_lock);
return data;
}
@@ -689,17 +680,13 @@ static void snd_intel8x0_ali_codec_write(ac97_t *ac97, unsigned short reg, unsig
{
intel8x0_t *chip = ac97->private_data;
- spin_lock(&chip->ac97_lock);
- if (snd_intel8x0_ali_codec_semaphore(chip)) {
- spin_unlock(&chip->ac97_lock);
+ if (snd_intel8x0_ali_codec_semaphore(chip))
return;
- }
iputword(chip, ICHREG(ALI_CPR), val);
if (ac97->num)
reg |= ALI_CPR_ADDR_SECONDARY;
iputword(chip, ICHREG(ALI_CPR_ADDR), reg);
snd_intel8x0_ali_codec_ready(chip, ALI_CSPSR_WRITE_OK);
- spin_unlock(&chip->ac97_lock);
}
@@ -2546,7 +2533,6 @@ static int __devinit snd_intel8x0_create(snd_card_t * card,
return -ENOMEM;
}
spin_lock_init(&chip->reg_lock);
- spin_lock_init(&chip->ac97_lock);
chip->device_type = device_type;
chip->card = card;
chip->pci = pci;
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index e638be03c294ab..91df9308b04092 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -253,7 +253,6 @@ struct _snd_intel8x0m {
ac97_t *ac97;
spinlock_t reg_lock;
- spinlock_t ac97_lock;
struct snd_dma_buffer bdbars;
u32 bdbars_count;
@@ -411,13 +410,11 @@ static void snd_intel8x0_codec_write(ac97_t *ac97,
{
intel8x0_t *chip = ac97->private_data;
- spin_lock(&chip->ac97_lock);
if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) {
if (! chip->in_ac97_init)
snd_printk("codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg);
}
iaputword(chip, reg + ac97->num * 0x80, val);
- spin_unlock(&chip->ac97_lock);
}
static unsigned short snd_intel8x0_codec_read(ac97_t *ac97,
@@ -427,7 +424,6 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97,
unsigned short res;
unsigned int tmp;
- spin_lock(&chip->ac97_lock);
if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) {
if (! chip->in_ac97_init)
snd_printk("codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg);
@@ -442,7 +438,6 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97,
res = 0xffff;
}
}
- spin_unlock(&chip->ac97_lock);
return res;
}
@@ -1177,7 +1172,6 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card,
return -ENOMEM;
}
spin_lock_init(&chip->reg_lock);
- spin_lock_init(&chip->ac97_lock);
chip->device_type = device_type;
chip->card = card;
chip->pci = pci;
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index a617badec89a11..1b191022b42a10 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -1835,34 +1835,24 @@ static unsigned short
snd_m3_ac97_read(ac97_t *ac97, unsigned short reg)
{
m3_t *chip = ac97->private_data;
- unsigned short ret = 0;
- unsigned long flags;
- spin_lock_irqsave(&chip->reg_lock, flags);
if (snd_m3_ac97_wait(chip))
- goto __error;
- snd_m3_outb(chip, 0x80 | (reg & 0x7f), 0x30);
+ return 0xffff;
+ snd_m3_outb(chip, 0x80 | (reg & 0x7f), CODEC_COMMAND);
if (snd_m3_ac97_wait(chip))
- goto __error;
- ret = snd_m3_inw(chip, 0x32);
-__error:
- spin_unlock_irqrestore(&chip->reg_lock, flags);
- return ret;
+ return 0xffff;
+ return snd_m3_inw(chip, CODEC_DATA);
}
static void
snd_m3_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val)
{
m3_t *chip = ac97->private_data;
- unsigned long flags;
- spin_lock_irqsave(&chip->reg_lock, flags);
if (snd_m3_ac97_wait(chip))
- goto __error;
- snd_m3_outw(chip, val, 0x32);
- snd_m3_outb(chip, reg & 0x7f, 0x30);
-__error:
- spin_unlock_irqrestore(&chip->reg_lock, flags);
+ return;
+ snd_m3_outw(chip, val, CODEC_DATA);
+ snd_m3_outb(chip, reg & 0x7f, CODEC_COMMAND);
}
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index cefe6b0a1919fd..805c805ee44d4b 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -391,7 +391,6 @@ struct _snd_via82xx {
unsigned int ac97_secondary; /* secondary AC'97 codec is present */
spinlock_t reg_lock;
- spinlock_t ac97_lock;
snd_info_entry_t *proc_entry;
#ifdef SUPPORT_JOYSTICK
@@ -564,10 +563,8 @@ static void snd_via82xx_codec_write(ac97_t *ac97,
xval <<= VIA_REG_AC97_CODEC_ID_SHIFT;
xval |= reg << VIA_REG_AC97_CMD_SHIFT;
xval |= val << VIA_REG_AC97_DATA_SHIFT;
- spin_lock(&chip->ac97_lock);
snd_via82xx_codec_xwrite(chip, xval);
snd_via82xx_codec_ready(chip, ac97->num);
- spin_unlock(&chip->ac97_lock);
}
static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg)
@@ -580,10 +577,8 @@ static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg)
xval |= ac97->num ? VIA_REG_AC97_SECONDARY_VALID : VIA_REG_AC97_PRIMARY_VALID;
xval |= VIA_REG_AC97_READ;
xval |= (reg & 0x7f) << VIA_REG_AC97_CMD_SHIFT;
- spin_lock(&chip->ac97_lock);
while (1) {
if (again++ > 3) {
- spin_unlock(&chip->ac97_lock);
snd_printk(KERN_ERR "codec_read: codec %i is not valid [0x%x]\n", ac97->num, snd_via82xx_codec_xread(chip));
return 0xffff;
}
@@ -595,7 +590,6 @@ static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg)
break;
}
}
- spin_unlock(&chip->ac97_lock);
return val & 0xffff;
}
@@ -2026,7 +2020,6 @@ static int __devinit snd_via82xx_create(snd_card_t * card,
chip->revision = revision;
spin_lock_init(&chip->reg_lock);
- spin_lock_init(&chip->ac97_lock);
spin_lock_init(&chip->rates[0].lock);
spin_lock_init(&chip->rates[1].lock);
chip->card = card;
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 0efc41e728a446..0b5f2ad2901512 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -260,7 +260,6 @@ struct _snd_via82xx_modem {
unsigned int ac97_secondary; /* secondary AC'97 codec is present */
spinlock_t reg_lock;
- spinlock_t ac97_lock;
snd_info_entry_t *proc_entry;
};
@@ -426,10 +425,8 @@ static void snd_via82xx_codec_write(ac97_t *ac97,
xval <<= VIA_REG_AC97_CODEC_ID_SHIFT;
xval |= reg << VIA_REG_AC97_CMD_SHIFT;
xval |= val << VIA_REG_AC97_DATA_SHIFT;
- spin_lock(&chip->ac97_lock);
snd_via82xx_codec_xwrite(chip, xval);
snd_via82xx_codec_ready(chip, ac97->num);
- spin_unlock(&chip->ac97_lock);
}
static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg)
@@ -442,10 +439,8 @@ static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg)
xval |= ac97->num ? VIA_REG_AC97_SECONDARY_VALID : VIA_REG_AC97_PRIMARY_VALID;
xval |= VIA_REG_AC97_READ;
xval |= (reg & 0x7f) << VIA_REG_AC97_CMD_SHIFT;
- spin_lock(&chip->ac97_lock);
while (1) {
if (again++ > 3) {
- spin_unlock(&chip->ac97_lock);
snd_printk(KERN_ERR "codec_read: codec %i is not valid [0x%x]\n", ac97->num, snd_via82xx_codec_xread(chip));
return 0xffff;
}
@@ -457,7 +452,6 @@ static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg)
break;
}
}
- spin_unlock(&chip->ac97_lock);
return val & 0xffff;
}
@@ -1124,7 +1118,6 @@ static int __devinit snd_via82xx_create(snd_card_t * card,
}
spin_lock_init(&chip->reg_lock);
- spin_lock_init(&chip->ac97_lock);
chip->card = card;
chip->pci = pci;
chip->irq = -1;