HDA sound driver mod for thinkpad x60s

Andrea Bittau a.bittau at cs.ucl.ac.uk
Wed Jun 7 07:57:36 UTC 2006


On Tue, Jun 06, 2006 at 11:15:55PM -0400, Wesley Morgan wrote:
> pcm0: node 2 type 0 cap d0401
> pcm0: Cap d0401 sf 0 st 0
> pcm0: node 5 type 0 cap 40211
> pcm0: Cap 40211 sf e01e0 st 5

You have two audio outputs [even IBM does].  Node ID 5 looks most promising
because it states its stream format and type.  Thus, in the vanilla driver, you
should change:
sorbo_conf_output(sc, 0, 3);
to
sorbo_conf_output(sc, 0, 5);

> pcm0: node 9 type 4 cap 400301
> pcm0: nid 9 entries 2 list a05 cur 0 ctr 0 cap 10 s 0

Node ID 9 is a PIN which is connected to node id 5 [your audio output].  This
looks really promising.  In the driver, you should change:
sorbo_set_amp(sc, 0, 5,
to
sorbo_set_amp(sc, 0, 9,
[two places, initial conf, and mixer.]

> pcm0: node 11 type 3 cap 300105
> pcm0: node 13 type 4 cap 400181
> pcm0: nid 13 entries 1 list b cur 0 ctr 0 cap 3f s 7fffffff
> pcm0: node 14 type 4 cap 400181
> pcm0: nid 14 entries 1 list b cur 0 ctr 0 cap 3f s 7fffffff
> pcm0: node 15 type 4 cap 400181
> pcm0: nid 15 entries 1 list b cur 0 ctr 0 cap 37 s 7fffffff
> pcm0: node 16 type 4 cap 400181
> pcm0: nid 16 entries 1 list b cur 0 ctr 0 cap 1737 s 7fffffff
> pcm0: node 17 type 4 cap 400104
> pcm0: nid 17 entries 1 list 13 cur 0 ctr 0 cap 10 s 0
> pcm0: node 19 type 2 cap 200100

Most of your other PINs, of which one of them could be the correct one, are
connected to node id 0xb [11].  This is the big difference with IBM.  In IBM's
case, they are connected to audio output directly [by default].  In your case,
most of your pins seem to be connected to node 11, an audio selector.  [One of
them is connected to node 19, a mixer, but lets hope that is not the pin we are
after.]

A selector will get a bunch of inputs and spit one out.  Useful debug
information would be "what is node id 11 connected to".  Somewhere in the code,
perhaps before attach2(), add this:
static void
sorbo_print_conn(struct hdac_softc *sc, int cad, int nid)
{
	int rc;
	uint32_t l, p;

        rc = hdac_command_sendone_internal(sc,         
        HDA_CMD_GET_PARAMETER(cad, nid, HDA_PARAM_CONN_LIST_LENGTH), cad);

        if (rc) {
                l = hdac_command_sendone_internal(sc,
                     HDA_CMD_GET_CONN_LIST_ENTRY(cad, nid, 0), cad);

                p = hdac_command_sendone_internal(sc,
                     HDA_CMD_GET_CONN_SELECT_CONTROL(cad, nid), cad);

		printf("nid %d list %x current %x\n", nid, l, p);
        }

}

then in attach2, add:
sorbo_print_conn(sc, 0, 11);

This will tell you what the selector is connected to.  Hopefully it's current
selection is 5.

Next, selectors may have amplifiers.  Adding [in attach2] a
sorbo_set_amp(sc, 0, 11, 40); // 40 is the gain.  63 is max
shouldn't harm.
Also, amplify all pins... so do something like:
sorbo_set_amp(sc, 0, 9, 40);
sorbo_set_amp(sc, 0, 13, 40);
... [all type 4]
sorbo_set_amp(sc, 0, 17, 40);

Anyway, this driver mod was really meant for x60s only... as it's badly written
[a weekend hack].  Perhaps we should meet up on irc or something if you really
want to get it working.  I wish someone on an x60 could try it to at least
"prove" that it works [or doesn't =P].


More information about the freebsd-mobile mailing list