Limit total playback channels to just 1, for ALi M5451.

The reliability of it's multi DAC / playback channels is
not that good. Enabling vchans make the bug more visible
since playback allocation will look for possible free
hardware channels first (i.e: the next DAC, the very first
has been consumed by vchan mixer) which in this case has
been proven faulty.

Reported / Tested by:	Sascha Klauder
MFC after:		3 days
This commit is contained in:
ariff 2007-11-10 04:32:50 +00:00
parent 25a65e5506
commit f76ef1b7bf

View File

@ -811,7 +811,7 @@ tr_pci_attach(device_t dev)
u_int32_t data;
struct tr_info *tr;
struct ac97_info *codec = 0;
int i;
int i, dacn;
char status[SND_STATUSLEN];
tr = malloc(sizeof(*tr), M_DEVBUF, M_WAITOK | M_ZERO);
@ -819,6 +819,25 @@ tr_pci_attach(device_t dev)
tr->rev = pci_get_revid(dev);
tr->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_t4dwave softc");
if (resource_int_value(device_get_name(dev), device_get_unit(dev),
"dac", &i) == 0) {
if (i < 1)
dacn = 1;
else if (i > TR_MAXPLAYCH)
dacn = TR_MAXPLAYCH;
else
dacn = i;
} else {
switch (tr->type) {
case ALI_PCI_ID:
dacn = 1;
break;
default:
dacn = TR_MAXPLAYCH;
break;
}
}
data = pci_read_config(dev, PCIR_COMMAND, 2);
data |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN);
pci_write_config(dev, PCIR_COMMAND, data, 2);
@ -871,9 +890,10 @@ tr_pci_attach(device_t dev)
snprintf(status, 64, "at io 0x%lx irq %ld %s",
rman_get_start(tr->reg), rman_get_start(tr->irq),PCM_KLDSTRING(snd_t4dwave));
if (pcm_register(dev, tr, TR_MAXPLAYCH, 1)) goto bad;
if (pcm_register(dev, tr, dacn, 1))
goto bad;
pcm_addchan(dev, PCMDIR_REC, &trrchan_class, tr);
for (i = 0; i < TR_MAXPLAYCH; i++)
for (i = 0; i < dacn; i++)
pcm_addchan(dev, PCMDIR_PLAY, &trpchan_class, tr);
pcm_setstatus(dev, status);