Subject: Re: debugging azalia sound routing
To: Peter Seebach <seebs@plethora.net>
From: TAMURA Kent <kent@NetBSD.org>
List: current-users
Date: 10/23/2006 00:24:35
In message "debugging azalia sound routing"
on 06/10/10, Peter Seebach <seebs@plethora.net> writes:
> The macbook pro and the intel-based mac mini both use "azalia" sound hardware.
>
> Both don't make any sound under NetBSD.
>
> Both are subject to driver "fixes" for Linux, which appear to both involve
> rerouting sound, and doing something special and magical which applies only
> on the Mac hardware to control a special hardware mute feature, possibly
> related to their controls for internal vs. external speakers.
Would you open a PR for this, and test the following patch?
--
TAMURA Kent <kent_2006 at hauN.org> <kent at NetBSD.org>
Index: azalia_codec.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/azalia_codec.c,v
retrieving revision 1.24
diff -u -r1.24 azalia_codec.c
--- azalia_codec.c 23 Jul 2006 16:05:21 -0000 1.24
+++ azalia_codec.c 22 Oct 2006 15:24:04 -0000
@@ -120,6 +120,7 @@
static int cmi9880_init_dacgroup(codec_t *);
static int cmi9880_mixer_init(codec_t *);
static int stac9221_init_dacgroup(codec_t *);
+static int stac9221_mixer_init(codec_t *);
static int stac9220_mixer_init(codec_t *);
@@ -179,6 +180,7 @@
case 0x83847680:
this->name = "Sigmatel STAC9221";
this->init_dacgroup = stac9221_init_dacgroup;
+ this->mixer_init = stac9221_mixer_init;
break;
case 0x83847683:
this->name = "Sigmatel STAC9221D";
@@ -2520,6 +2522,8 @@
* Sigmatel STAC9221 and STAC9221D
* ---------------------------------------------------------------- */
+#define STAC9221_MAC 0x76808384
+
static int
stac9221_init_dacgroup(codec_t *this)
{
@@ -2538,6 +2542,31 @@
return 0;
}
+static int
+stac9221_mixer_init(codec_t *this)
+{
+ int err;
+
+ err = generic_mixer_init(this);
+ if (err)
+ return err;
+ if (this->subid == STAC9221_MAC) {
+ uint32_t data, mask, dir;
+ this->comresp(this, 0, CORB_GET_GPIO_DATA, 0, &data);
+ this->comresp(this, 0, CORB_GET_GPIO_ENABLE_MASK, 0, &mask);
+ this->comresp(this, 0, CORB_GET_GPIO_DIRECTION, 0, &dir);
+ data |= 0x3;
+ mask |= 0x3;
+ dir |= 0x3;
+ this->comresp(this, 0, 0x7e7, 0, NULL);
+ this->comresp(this, 0, CORB_SET_GPIO_ENABLE_MASK, mask, NULL);
+ this->comresp(this, 0, CORB_SET_GPIO_DIRECTION, dir, NULL);
+ DELAY(1000);
+ this->comresp(this, 0, CORB_SET_GPIO_DATA, data, NULL);
+ }
+ return 0;
+}
+
/* ----------------------------------------------------------------
* Sigmatel STAC9220
* ---------------------------------------------------------------- */