* Realtek ALC885: Use generic_mixer_autoinit/init_widget

* generic_mixer_create_virtual: if the front l/r DAC doesn't have a volume
  capability, enumerate all peer widgets and search for a volume mixer
  there.
This commit is contained in:
jmcneill 2009-02-23 02:34:57 +00:00
parent 102a4f0ad3
commit 34c593f760
1 changed files with 35 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: azalia_codec.c,v 1.74 2009/01/27 08:23:00 markd Exp $ */
/* $NetBSD: azalia_codec.c,v 1.75 2009/02/23 02:34:57 jmcneill Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: azalia_codec.c,v 1.74 2009/01/27 08:23:00 markd Exp $");
__KERNEL_RCSID(0, "$NetBSD: azalia_codec.c,v 1.75 2009/02/23 02:34:57 jmcneill Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -240,6 +240,8 @@ azalia_codec_init_vtbl(codec_t *this)
case 0x10ec0885:
this->name = "Realtek ALC885";
this->init_dacgroup = alc885_init_dacgroup;
this->mixer_init = generic_mixer_autoinit;
this->init_widget = generic_mixer_init_widget;
break;
case 0x10ec0888:
this->name = "Realtek ALC888";
@ -1353,6 +1355,37 @@ generic_mixer_create_virtual(codec_t *this)
}
}
if (mdac == -1) {
/*
* no volume mixer found on the DAC; enumerate peer widgets
* and try to find a volume mixer on them
*/
widget_t *w;
int j;
FOR_EACH_WIDGET(this, i) {
w = &this->w[i];
for (j = 0; j < w->nconnections; j++)
if (w->connections[j] == cgdac->conv[0])
break;
if (j == w->nconnections)
continue;
for (j = 0; j < this->nmixers; j++) {
if (this->mixers[j].devinfo.type !=
AUDIO_MIXER_VALUE)
continue;
if (this->mixers[j].nid == w->nid) {
mdac = mmaster = j;
break;
}
}
if (mdac == -1)
break;
}
}
if (mdac >= 0) {
err = generic_mixer_ensure_capacity(this, this->nmixers + 1);
if (err)