NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/44670: audio output doesn't work on my MacBook1,1
The following reply was made to PR kern/44670; it has been noted by GNATS.
From: Taylor R Campbell <campbell+netbsd%mumble.net@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: kern/44670: audio output doesn't work on my MacBook1,1
Date: Thu, 3 Mar 2011 21:13:53 +0000
By parroting the Linux driver, I have been able to get audio to work,
sort of. It seems a bit crackly, which I don't remember before in the
recording of Beethoven's Appassionata which I'm using to test it.
I hacked up hdaudio.c so that `hdaudioctl set' wouldn't immediately
trigger a lockdebug panic, cargo-culted gpio stuff from the Linux
driver, and then used `hdaudioctl set' to set the pin configuration to
what I found in the Linux driver.
Obviously this is totally mega-kludgerific, and I have no idea what
I'm doing, so I don't know what the right thing is, but maybe someone
who does know what he's doing can derive from this kludgerosity a
proper fix.
Pin configuration:
nid config
10 0x0121e21f
11 0x400000ff
12 0x9017e110
13 0xf00000fd
14 0x400000fe
15 0x0181e020
16 0x1145e030
17 0x11c5e240
21 0x400000fc
27 0x400000fb
Patch:
Index: hdafg.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/hdaudio/hdafg.c,v
retrieving revision 1.2
diff -p -u -r1.2 hdafg.c
--- hdafg.c 12 Feb 2011 15:15:34 -0000 1.2
+++ hdafg.c 3 Mar 2011 21:07:24 -0000
@@ -2970,13 +2970,27 @@ hdafg_commit(struct hdafg_softc *sc)
}
#endif
+ /* [TRC 20110303: XXX Horrible hack for my MacBook1,1.] */
+ gdata = 0x03 | hdaudio_command(sc->sc_codec, sc->sc_nid,
+ CORB_GET_GPIO_DATA, 0);
+ gmask = 0x03 | hdaudio_command(sc->sc_codec, sc->sc_nid,
+ CORB_GET_GPIO_ENABLE_MASK, 0);
+ gdir = 0x03 | hdaudio_command(sc->sc_codec, sc->sc_nid,
+ CORB_GET_GPIO_DIRECTION, 0);
+ commitgpio = 1;
+
if (commitgpio) {
hda_trace(sc, "GPIO commit: data=%08X mask=%08X dir=%08X\n",
gdata, gmask, gdir);
+ /* [TRC 20110303: XXX Super-secret magic 0x7e7 stolen
+ * from Linux.] */
+ hdaudio_command(sc->sc_codec, sc->sc_nid, 0x7e7, 0);
hdaudio_command(sc->sc_codec, sc->sc_nid,
CORB_SET_GPIO_ENABLE_MASK, gmask);
hdaudio_command(sc->sc_codec, sc->sc_nid,
CORB_SET_GPIO_DIRECTION, gdir);
+ /* [TRC 20110303: XXX Cargo-culted from Linux.] */
+ hda_delay(1000);
hdaudio_command(sc->sc_codec, sc->sc_nid,
CORB_SET_GPIO_DATA, gdata);
}
Index: hdaudio.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/hdaudio/hdaudio.c,v
retrieving revision 1.11
diff -p -u -r1.11 hdaudio.c
--- hdaudio.c 13 Feb 2011 17:49:12 -0000 1.11
+++ hdaudio.c 3 Mar 2011 21:07:24 -0000
@@ -1034,6 +1034,7 @@ void
hdaudio_stream_disestablish(struct hdaudio_stream *st)
{
struct hdaudio_softc *sc = st->st_host;
+ struct hdaudio_dma dma;
KASSERT(sc->sc_stream_mask & (1 << st->st_shift));
@@ -1041,8 +1042,12 @@ hdaudio_stream_disestablish(struct hdaud
sc->sc_stream_mask &= ~(1 << st->st_shift);
st->st_intr = NULL;
st->st_cookie = NULL;
- hdaudio_dma_free(sc, &st->st_bdl);
+ dma = st->st_bdl;
+ st->st_bdl.dma_valid = false;
mutex_exit(&sc->sc_stream_mtx);
+
+ /* Can't bus_dmamem_unmap while holding a mutex. */
+ hdaudio_dma_free(sc, &dma);
}
/*
Home |
Main Index |
Thread Index |
Old Index