Update of /cvsroot/alsa/alsa-kernel/pci/ac97
In directory sc8-pr-cvs1:/tmp/cvs-serv26791
Modified Files:
ac97_codec.c ac97_pcm.c
Log Message:
- fixed the detection of rates due to collision with the spdif slots.
- fixed the typo in the error message.
- replaced the numbers with constants.
Index: ac97_codec.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ac97/ac97_codec.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- ac97_codec.c 3 Dec 2003 17:25:55 -0000 1.116
+++ ac97_codec.c 3 Dec 2003 18:44:32 -0000 1.117
@@ -1039,17 +1039,17 @@
}
return 0;
case AC97_CENTER_LFE_MASTER: /* center */
- if ((ac97->ext_id & 0x40) == 0)
+ if ((ac97->ext_id & AC97_EI_CDAC) == 0)
return 0;
break;
case AC97_CENTER_LFE_MASTER+1: /* lfe */
- if ((ac97->ext_id & 0x100) == 0)
+ if ((ac97->ext_id & AC97_EI_LDAC) == 0)
return 0;
reg = AC97_CENTER_LFE_MASTER;
mask = 0x0080;
break;
case AC97_SURROUND_MASTER:
- if ((ac97->ext_id & 0x80) == 0)
+ if ((ac97->ext_id & AC97_EI_SDAC) == 0)
return 0;
break;
}
Index: ac97_pcm.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ac97/ac97_pcm.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ac97_pcm.c 3 Dec 2003 13:39:06 -0000 1.8
+++ ac97_pcm.c 3 Dec 2003 18:44:32 -0000 1.9
@@ -275,7 +275,7 @@
return 0;
}
-static unsigned short get_pslots(ac97_t *ac97, unsigned char *rate_table)
+static unsigned short get_pslots(ac97_t *ac97, unsigned char *rate_table, unsigned
short *spdif_slots)
{
if (!ac97_is_audio(ac97))
return 0;
@@ -301,11 +301,11 @@
slots |= (1<<AC97_SLOT_PCM_CENTER)|(1<<AC97_SLOT_LFE);
if (ac97->ext_id & AC97_EI_SPDIF) {
if (!(ac97->scaps & AC97_SCAP_SURROUND_DAC))
- slots |=
(1<<AC97_SLOT_SPDIF_LEFT)|(1<<AC97_SLOT_SPDIF_RIGHT);
+ *spdif_slots =
(1<<AC97_SLOT_SPDIF_LEFT)|(1<<AC97_SLOT_SPDIF_RIGHT);
else if (!(ac97->scaps & AC97_SCAP_CENTER_LFE_DAC))
- slots |=
(1<<AC97_SLOT_SPDIF_LEFT1)|(1<<AC97_SLOT_SPDIF_RIGHT1);
+ *spdif_slots =
(1<<AC97_SLOT_SPDIF_LEFT1)|(1<<AC97_SLOT_SPDIF_RIGHT1);
else
- slots |=
(1<<AC97_SLOT_SPDIF_LEFT2)|(1<<AC97_SLOT_SPDIF_RIGHT2);
+ *spdif_slots =
(1<<AC97_SLOT_SPDIF_LEFT2)|(1<<AC97_SLOT_SPDIF_RIGHT2);
}
*rate_table = 0;
break;
@@ -316,16 +316,16 @@
slots |= (1<<AC97_SLOT_PCM_CENTER)|(1<<AC97_SLOT_LFE);
if (ac97->ext_id & AC97_EI_SPDIF) {
if (!(ac97->scaps & AC97_SCAP_SURROUND_DAC))
- slots |=
(1<<AC97_SLOT_SPDIF_LEFT1)|(1<<AC97_SLOT_SPDIF_RIGHT1);
+ *spdif_slots =
(1<<AC97_SLOT_SPDIF_LEFT1)|(1<<AC97_SLOT_SPDIF_RIGHT1);
else
- slots |=
(1<<AC97_SLOT_SPDIF_LEFT2)|(1<<AC97_SLOT_SPDIF_RIGHT2);
+ *spdif_slots =
(1<<AC97_SLOT_SPDIF_LEFT2)|(1<<AC97_SLOT_SPDIF_RIGHT2);
}
*rate_table = 1;
break;
case 3:
slots |= (1<<AC97_SLOT_PCM_CENTER)|(1<<AC97_SLOT_LFE);
if (ac97->ext_id & AC97_EI_SPDIF)
- slots |=
(1<<AC97_SLOT_SPDIF_LEFT2)|(1<<AC97_SLOT_SPDIF_RIGHT2);
+ *spdif_slots =
(1<<AC97_SLOT_SPDIF_LEFT2)|(1<<AC97_SLOT_SPDIF_RIGHT2);
*rate_table = 2;
break;
}
@@ -339,11 +339,11 @@
slots |= (1<<AC97_SLOT_PCM_CENTER)|(1<<AC97_SLOT_LFE);
if (ac97->ext_id & AC97_EI_SPDIF) {
if (!(ac97->scaps & AC97_SCAP_SURROUND_DAC))
- slots |=
(1<<AC97_SLOT_SPDIF_LEFT)|(1<<AC97_SLOT_SPDIF_RIGHT);
+ *spdif_slots =
(1<<AC97_SLOT_SPDIF_LEFT)|(1<<AC97_SLOT_SPDIF_RIGHT);
else if (!(ac97->scaps & AC97_SCAP_CENTER_LFE_DAC))
- slots |=
(1<<AC97_SLOT_SPDIF_LEFT1)|(1<<AC97_SLOT_SPDIF_RIGHT1);
+ *spdif_slots =
(1<<AC97_SLOT_SPDIF_LEFT1)|(1<<AC97_SLOT_SPDIF_RIGHT1);
else
- slots |=
(1<<AC97_SLOT_SPDIF_LEFT2)|(1<<AC97_SLOT_SPDIF_RIGHT2);
+ *spdif_slots =
(1<<AC97_SLOT_SPDIF_LEFT2)|(1<<AC97_SLOT_SPDIF_RIGHT2);
}
*rate_table = 0;
return slots;
@@ -404,6 +404,7 @@
unsigned short avail_slots[2][4];
unsigned char rate_table[2][4];
unsigned short tmp, slots;
+ unsigned short spdif_slots[4];
unsigned int rates;
ac97_t *codec;
@@ -412,11 +413,12 @@
return -ENOMEM;
memset(avail_slots, 0, sizeof(avail_slots));
memset(rate_table, 0, sizeof(rate_table));
+ memset(spdif_slots, 0, sizeof(spdif_slots));
for (i = 0; i < 4; i++) {
codec = bus->codec[i];
if (!codec)
continue;
- avail_slots[0][i] = get_pslots(codec, &rate_table[0][i]);
+ avail_slots[0][i] = get_pslots(codec, &rate_table[0][i],
&spdif_slots[i]);
avail_slots[1][i] = get_cslots(codec);
if (!(codec->scaps & AC97_SCAP_INDEP_SDIN)) {
for (j = 0; j < i; j++) {
@@ -446,29 +448,28 @@
if (!bus->codec[j])
continue;
rates = ~0;
+ if (pcm->spdif && pcm->stream == 0)
+ tmp = spdif_slots[j];
+ else
+ tmp = avail_slots[pcm->stream][j];
if (pcm->exclusive) {
/* exclusive access */
- tmp = avail_slots[pcm->stream][j] & slots;
+ tmp &= slots;
for (k = 0; k < i; k++) {
if (rpcm->stream == rpcms[k].stream)
tmp &= ~rpcms[k].r[0].rslots[j];
}
- if (tmp) {
- rpcm->r[0].rslots[j] = tmp;
- rpcm->r[0].codec[j] = bus->codec[j];
- rpcm->r[0].rate_table[j] =
rate_table[pcm->stream][j];
- rates = get_rates(rpcm, j, tmp, 0);
- avail_slots[pcm->stream][j] &= ~tmp;
- }
} else {
/* non-exclusive access */
- tmp = avail_slots[pcm->stream][j] & pcm->r[0].slots;
- if (tmp) {
- rpcm->r[0].rslots[j] = tmp;
- rpcm->r[0].codec[j] = bus->codec[j];
- rpcm->r[0].rate_table[j] = rate_table[0][j];
- rates = get_rates(rpcm, j, tmp, 0);
- }
+ tmp &= pcm->r[0].slots;
+ }
+ if (tmp) {
+ rpcm->r[0].rslots[j] = tmp;
+ rpcm->r[0].codec[j] = bus->codec[j];
+ rpcm->r[0].rate_table[j] = rate_table[pcm->stream][j];
+ rates = get_rates(rpcm, j, tmp, 0);
+ if (pcm->exclusive)
+ avail_slots[pcm->stream][j] &= ~tmp;
}
slots &= ~tmp;
rpcm->r[0].slots |= tmp;
@@ -548,9 +549,10 @@
}
if (reg_ok & (1 << (reg - AC97_PCM_FRONT_DAC_RATE)))
continue;
+ printk(KERN_DEBUG "setting ac97 reg 0x%x to rate
%d\n", reg, rate);
err = snd_ac97_set_rate(pcm->r[r].codec[cidx], reg,
rate);
if (err < 0)
- snd_printk(KERN_ERR "error in
snd_ac97_set_rate: cidx=%d, reg=0x%x, rate=%d\n, err=%d", cidx, reg, rate, err);
+ snd_printk(KERN_ERR "error in
snd_ac97_set_rate: cidx=%d, reg=0x%x, rate=%d, err=%d\n", cidx, reg, rate, err);
else
reg_ok |= (1 << (reg -
AC97_PCM_FRONT_DAC_RATE));
}
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog