Subject: snd-aoa: new apple sound driver

From: Johannes Berg <[email-masked]>
Date: Tue, 28 Mar 2006 14:10:26 +0200

Hi,

I think I accomplished most of the things I wanted to accomplish now :)

snd-aoa is now split into a core module and snd-aoa-fabric-layout,
snd-aoa-codec-onyx. I'm going to write a snd-aoa-codec-tas3004 soon, so
that I can use the new code here on both of my machines.

What's left to do? (in order of importance to me)

Locking. There are no locks at all and it still works! Locking shouldn't
be too hard, most things are implicitly serialised anyway, but there
definitely must be some locking. I'll revisit that, but probably not in
the next two weeks. Other sets of eyes always welcome.

GPIO stuff. Currently, the only GPIO I touch is the amp-mute one to turn
on the internal speakers. This is done in the onyx codec module which
obviously isn't the right place for it. This should be moved into the
layout fabric module which draws on some common gpio code to program the
GPIOs. Then it creates controls alsa for amp-mute etc. instead of
unconditionally turning it on, and also registers the interrupts for
headhpone detection etc.

Clock setting. I'm clueless as to programming keylargo in linux. Thing
is, I need to stop the clock to the i2s cell before reprogramming it's
serial format register, and this requires access to the FCR registers.
But I don't know how to get at them best. Need help here. Clock setting
also includes running the i2s cell in slave mode so we can have digital
input. The infrastructure for slave mode isn't too established yet, but
it should be easy to fit it over what is currently there in
soundbus.h/i2sbus.

Modalias situtation. I played some tricks: i2sbus depends on soundbus
but announces its willingness to be bound to the i2s OF thing that macio
exports on its bus, so i2sbus is loaded automatically. i2sbus creates
some soundbus devices that have a name based on the layout ID if
possible, which should in turn auto-load snd-aoa-fabric-layout which
declares its willingness to be bound to such devices. This doesn't
happen during boot, even though modprobe `cat ...../modalias` works just
fine. No idea, need help from someone versed with hotplugging.
But hey, it's already much much closer than snd-powermac ever was ;)

Recording. There's code to record sound, but it doesn't do anything on
my machine. I have no idea why.

Suspend. I have a plan for it, so before thinking about it you may want
to look at some old revisions of my code where a huge comment about
suspend is buried in soundbus.h (I removed it again because it wasn't
quite right any more, but still has the essence of what I intend to do).

Onyx digital output. Currently, onyx always declares that the digital
output is usable even if it is turned off, leading to a restriction in
the output formats you can play. Note that due to 'clock switching'
above, you can only play 44.1KHz currently anyway. But Onyx should make
that depend on the status of the control, and then lock the control if a
bitrate was chosen that isn't compatible with the digital output.

Make i2sbus compatible with old machines. I wrote i2sbus for new
machines only, it relies a lot on stuff that older machines may not have
in the device tree. So someone who has older machines should look into
it and give me patches.

Now, that said, it's actually working fine for just playing sound on the
internal speakers now :)
The GPIO stuff should be a fairly low-hanging fruit so if someone wants
to take it...

johannes