On 22-07-08 09:16, Jason Hitt wrote:
[ please don't drop CCs on linux related mailinglists ]
I've been having the exact same issues. I had an on-board hda-intel card that
mysteriously quit working during some upgrade, so i disabled it and bought a
PCI card that ended up being a Creative Vibra128 (EV1938 chip)
I've applied the patch you listed and upon issuing a modprobe snd-ens1371 i
get the following:
ACPI: PCI Interrupt 0000:01:09.0[A] -> Link [APC2] -> GSI 17 (level, low)
-> IRQ 17
ALSA /home/rand/alsa/1.0.17/alsa-driver-1.0.17/pci/ens1370.c:713: codec read
timeout (final) at 0xcc14, reg = 0x7c [0x7c8384]
ALSA /home/rand/alsa/1.0.17/alsa-driver-1.0.17/pci/ens1370.c:713: codec read
timeout (final) at 0xcc14, reg = 0x7e [0x7e7605]
ALSA /home/rand/alsa/1.0.17/alsa-driver-1.0.17/pci/ens1370.c:713: codec read
timeout (final) at 0xcc14, reg = 0x0 [0x40000140]
Slight difference with "Media Fan's" output here...
ALSA /home/rand/alsa/1.0.17/alsa-driver-1.0.17/pci/ens1370.c:713: codec read
timeout (final) at 0xcc14, reg = 0x7c [0x7c8384]
ALSA /home/rand/alsa/1.0.17/alsa-driver-1.0.17/pci/ens1370.c:713: codec read
timeout (final) at 0xcc14, reg = 0x7e [0x7e7605]
ALSA /home/rand/alsa/1.0.17/alsa-driver-1.0.17/pci/ens1370.c:713: codec read
timeout (final) at 0xcc14, reg = 0x7c [0x7c8384]
ALSA /home/rand/alsa/1.0.17/alsa-driver-1.0.17/pci/ens1370.c:713: codec read
timeout (final) at 0xcc14, reg = 0x7e [0x7e7605]
ALSA /home/rand/alsa/1.0.17/alsa-driver-1.0.17/pci/ac97/ac97_codec.c:2071:
AC'97 0 access is not valid [0x0], removing mixer.
ACPI: PCI interrupt for device 0000:01:09.0 disabled
ENS1371: probe of 0000:01:09.0 failed with error -5
... but otherwise the same thing. Thank you for testing! I have already
posted a follow up patch that I have some hope for:
http://article.gmane.org/gmane.linux.alsa.user/30851
I will be able to run any further tests you may have for me...just let me know!
It seems this EV1938 thing is more popular than I expected. The ENS137x
is an old chip by now...
If you'd be able to test the new patch (I'll attach it again here for
convenience) that would be interesting.
The patch in itself would probably get a hit contract put out on me by
the latency people but let's try if it works before trying for anything
more subtle...
Rene.
>From 86d9e8d586df4d5065464db57506b75c999a5647 Mon Sep 17 00:00:00 2001
From: Rene Herman <rene.herman@xxxxxxxxx>
Date: Mon, 21 Jul 2008 21:57:13 +0200
Subject: [PATCH] ALSA: ens1371: replace src_mutex by the reg_lock spinlock
Signed-off-by: Rene Herman <rene.herman@xxxxxxxxx>
---
sound/pci/ens1370.c | 35 +++++++++++++++++++----------------
1 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index fbf1124..afed500 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -380,7 +380,6 @@ MODULE_PARM_DESC(lineio, "Line In to Rear Out (0 = auto, 1 = force).");
struct ensoniq {
spinlock_t reg_lock;
- struct mutex src_mutex;
int irq;
@@ -520,7 +519,7 @@ static unsigned int snd_es1371_wait_src_ready(struct ensoniq * ensoniq)
r = inl(ES_REG(ensoniq, 1371_SMPRATE));
if ((r & ES_1371_SRC_RAM_BUSY) == 0)
return r;
- cond_resched();
+ udelay(1);
}
snd_printk(KERN_ERR "wait source ready timeout 0x%lx [0x%x]\n",
ES_REG(ensoniq, 1371_SMPRATE), r);
@@ -606,10 +605,11 @@ static void snd_es1371_codec_write(struct snd_ac97 *ac97,
unsigned short reg, unsigned short val)
{
struct ensoniq *ensoniq = ac97->private_data;
+ unsigned long flags;
unsigned int t, x;
- mutex_lock(&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);
@@ -633,11 +633,11 @@ static void snd_es1371_codec_write(struct snd_ac97 *ac97,
/* restore SRC reg */
snd_es1371_wait_src_ready(ensoniq);
outl(x, ES_REG(ensoniq, 1371_SMPRATE));
- mutex_unlock(&ensoniq->src_mutex);
+ spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
return;
}
+ spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
}
- mutex_unlock(&ensoniq->src_mutex);
snd_printk(KERN_ERR "codec write timeout at 0x%lx [0x%x]\n",
ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC)));
}
@@ -646,11 +646,12 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
unsigned short reg)
{
struct ensoniq *ensoniq = ac97->private_data;
+ unsigned long flags;
unsigned int t, x, fail = 0;
__again:
- mutex_lock(&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);
@@ -682,11 +683,11 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *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) {
- mutex_unlock(&ensoniq->src_mutex);
+ spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
return ES_1371_CODEC_READ(x);
}
}
- mutex_unlock(&ensoniq->src_mutex);
+ spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
if (++fail > 10) {
snd_printk(KERN_ERR "codec read timeout (final) "
"at 0x%lx, reg = 0x%x [0x%x]\n",
@@ -696,8 +697,8 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
}
goto __again;
}
+ spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
}
- mutex_unlock(&ensoniq->src_mutex);
snd_printk(KERN_ERR "es1371: codec read timeout at 0x%lx [0x%x]\n",
ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC)));
return 0;
@@ -715,8 +716,9 @@ static void snd_es1371_codec_wait(struct snd_ac97 *ac97)
static void snd_es1371_adc_rate(struct ensoniq * ensoniq, unsigned int rate)
{
unsigned int n, truncm, freq, result;
+ unsigned long flags;
- mutex_lock(&ensoniq->src_mutex);
+ spin_lock_irqsave(&ensoniq->reg_lock, flags);
n = rate / 3000;
if ((1 << n) & ((1 << 15) | (1 << 13) | (1 << 11) | (1 << 9)))
n--;
@@ -741,14 +743,15 @@ static void snd_es1371_adc_rate(struct ensoniq * ensoniq, unsigned int rate)
snd_es1371_src_write(ensoniq, ES_SMPREG_ADC + ES_SMPREG_VFREQ_FRAC, freq & 0x7fff);
snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC, n << 8);
snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC + 1, n << 8);
- mutex_unlock(&ensoniq->src_mutex);
+ spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
}
static void snd_es1371_dac1_rate(struct ensoniq * ensoniq, unsigned int rate)
{
unsigned int freq, r;
+ unsigned long flags;
- mutex_lock(&ensoniq->src_mutex);
+ spin_lock_irqsave(&ensoniq->reg_lock, flags);
freq = ((rate << 15) + 1500) / 3000;
r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ES_1371_DIS_P2 | ES_1371_DIS_R1)) |
@@ -762,14 +765,15 @@ static void snd_es1371_dac1_rate(struct ensoniq * ensoniq, unsigned int rate)
r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ES_1371_DIS_P2 | ES_1371_DIS_R1));
outl(r, ES_REG(ensoniq, 1371_SMPRATE));
- mutex_unlock(&ensoniq->src_mutex);
+ spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
}
static void snd_es1371_dac2_rate(struct ensoniq * ensoniq, unsigned int rate)
{
unsigned int freq, r;
+ unsigned long flags;
- mutex_lock(&ensoniq->src_mutex);
+ spin_lock_irqsave(&ensoniq->reg_lock, flags);
freq = ((rate << 15) + 1500) / 3000;
r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ES_1371_DIS_P1 | ES_1371_DIS_R1)) |
@@ -784,7 +788,7 @@ static void snd_es1371_dac2_rate(struct ensoniq * ensoniq, unsigned int rate)
r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE |
ES_1371_DIS_P1 | ES_1371_DIS_R1));
outl(r, ES_REG(ensoniq, 1371_SMPRATE));
- mutex_unlock(&ensoniq->src_mutex);
+ spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
}
#endif /* CHIP1371 */
@@ -2092,7 +2096,6 @@ static int __devinit snd_ensoniq_create(struct snd_card *card,
return -ENOMEM;
}
spin_lock_init(&ensoniq->reg_lock);
- mutex_init(&ensoniq->src_mutex);
ensoniq->card = card;
ensoniq->pci = pci;
ensoniq->irq = -1;
--
1.5.5
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user