Skip to contentSkip to conversation

pmac: sound support for latest laptops

PATCH In review Benjamin Herrenschmidt 4 participants 10 messages Apr 10, 2005 – Apr 14, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pmac: sound support for latest laptops

Hi !

This patch hacks the current Alsa snd-powermac driver to add support for recent machine models with the tas3004 chip, that is basically new laptop models. The Mac Mini is _NOT_ yet supported by this patch (soon soon ...). The G5s (iMac or Desktop) will need the rewritten sound driver on which I'm working on (I _might_ get a hack for analog only on some G5s on the current driver, but no promise).

sound/ppc/pmac.c +21 -7
diff -urN linux-2.6.12-rc2/sound/ppc/pmac.c linux-2.6.12-rc2+snd/sound/ppc/pmac.c
@@ -881,7 +881,8 @@
 {
 	struct device_node *sound;
 	unsigned int *prop, l;
-
+	u32 layout_id = 0;
+	
 	if (_machine != _MACH_Pmac)
 		return -ENODEV;
 
@@ -929,6 +930,9 @@
 	prop = (unsigned int *) get_property(sound, "sub-frame", NULL);
 	if (prop && *prop < 16)
 		chip->subframe = *prop;
+	prop = (unsigned int *) get_property(sound, "layout-id", NULL);
+	if (prop)
+		layout_id = *prop;
 	/* This should be verified on older screamers */
 	if (device_is_compatible(sound, "screamer")) {
 		chip->model = PMAC_SCREAMER;
@@ -961,12 +965,22 @@
 		chip->freq_table = tumbler_freqs;
 		chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */
 	}
-	if (device_is_compatible(sound, "AOAKeylargo")) {
-		/* Seems to support the stock AWACS frequencies, but has
-		   a snapper mixer */
-		chip->model = PMAC_SNAPPER;
-		// chip->can_byte_swap = 0; /* FIXME: check this */
-		chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */
+	if (device_is_compatible(sound, "AOAKeylargo") ||
+	    device_is_compatible(sound, "AOAbase")) {
+		/* For now, only support very basic TAS3004 based machines with
+		 * single frequency until proper i2s control is implemented
+		 */
+		switch(layout_id) {
+		case 0x48:
+		case 0x46:
+		case 0x33:
+		case 0x29:
+			chip->num_freqs = ARRAY_SIZE(tumbler_freqs);
+			chip->model = PMAC_SNAPPER;
+			chip->can_byte_swap = 0; /* FIXME: check this */
+			chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */
+			break;
+		}
 	}
 	prop = (unsigned int *)get_property(sound, "device-id", NULL);
 	if (prop)
sound/ppc/tumbler.c +34 -14

105 lines not on this page · raw message

#1 lore raw
Quoted 5 lines · Benjamin Herrenschmidt

Hi !

This patch hacks the current Alsa snd-powermac driver to add support for recent machine models with the tas3004 chip, that is basically new laptop models.

It's working here (pbook 12" post-feb05) superb!.

Thanks (once again) :=) Ben!

Antonio Corbi.

#2 lore raw
In reply to Benjamin Herrenschmidt

At Sun, 10 Apr 2005 16:16:32 +1000,

Quoted 9 lines · Benjamin Herrenschmidt

Hi !

This patch hacks the current Alsa snd-powermac driver to add support for recent machine models with the tas3004 chip, that is basically new laptop models. The Mac Mini is _NOT_ yet supported by this patch (soon soon ...). The G5s (iMac or Desktop) will need the rewritten sound driver on which I'm working on (I _might_ get a hack for analog only on some G5s on the current driver, but no promise).

Thanks. I applied this to ALSA tree (together with your another patch for tumbler).

Takashi

#3 lore raw
In reply to Benjamin Herrenschmidt

Hi,

Quoted 8 lines

This patch hacks the current Alsa snd-powermac driver to add support for recent machine models with the tas3004 chip, that is basically new laptop models. The Mac Mini is _NOT_ yet supported by this patch (soon soon ...). The G5s (iMac or Desktop) will need the rewritten sound driver on which I'm working on (I _might_ get a hack for analog only on some G5s on the current driver, but no promise).

That's cool. I do have one slight problem with it though: When I turn down the Master mixer and up PCM it sounds badly overmodulated. I can keep PCM at about 75% and turn up master, and all is fine. Would it make sense to limit the PCM mixer to about 75% of its current limits, or how does that actually work in the hardware?

johannes

#4 lore raw

At Mon, 11 Apr 2005 17:07:29 +0200,

Quoted 11 lines · Johannes Berg

Hi,

Quoted 8 lines

This patch hacks the current Alsa snd-powermac driver to add support for recent machine models with the tas3004 chip, that is basically new laptop models. The Mac Mini is _NOT_ yet supported by this patch (soon soon ...). The G5s (iMac or Desktop) will need the rewritten sound driver on which I'm working on (I _might_ get a hack for analog only on some G5s on the current driver, but no promise).

Quoted 5 lines

That's cool. I do have one slight problem with it though: When I turn down the Master mixer and up PCM it sounds badly overmodulated. I can keep PCM at about 75% and turn up master, and all is fine. Would it make sense to limit the PCM mixer to about 75% of its current limits, or how does that actually work in the hardware?

This sounds like a problem sometimes seen in devices with a codec that amplifies (+dB) over a certain level. Some ac97 codecs have the same problem, too.

Takashi

#5 lore raw
In reply to Johannes Berg
Quoted 10 lines · Johannes Berg

Hi,

Quoted 8 lines

This patch hacks the current Alsa snd-powermac driver to add support for recent machine models with the tas3004 chip, that is basically new laptop models. The Mac Mini is _NOT_ yet supported by this patch (soon soon ...). The G5s (iMac or Desktop) will need the rewritten sound driver on which I'm working on (I _might_ get a hack for analog only on some G5s on the current driver, but no promise).

Quoted 5 lines

That's cool. I do have one slight problem with it though: When I turn down the Master mixer and up PCM it sounds badly overmodulated. I can keep PCM at about 75% and turn up master, and all is fine. Would it make sense to limit the PCM mixer to about 75% of its current limits, or how does that actually work in the hardware?

Well, the driver will let you do the setting you want, even if it's wrong :) You should indeed keep PCM at about 75% and use the master.

There is also an issue with bad quality speakers used by Apple. OS X has a built-in software DSP that does equalisation & filtering in the kernel driver, and they have specific settings for it for various machine model speakers. Obviously, we don't have such thing.

Ben.

#6 lore raw
In reply to Benjamin Herrenschmidt

Hi,

Quoted 3 lines

This patch hacks the current Alsa snd-powermac driver to add support for recent machine models with the tas3004 chip, that is basically new laptop models.

So this works, but is incompatible with gstreamer. I took it with a rhythmbox/gstreamer developer and he said that it's a driver issue. A gstreamer log is here:
http://johannes.sipsolutions.net/files/rhythmbox-alsa-debug
(produced by GST_DEBUG=alsa*:5 rhythmbox 2>&1 | tee logfile)

He also asked me to try

$ gst-launch-0.8 sinesrc ! alsasink device=hw:0

which yields:
RUNNING pipeline ...
ERROR: pipeline doesn't want to play.

So the conclusion was:
"set_periods_near ioctl does something weird"

Any ideas?

johannes

#7 lore raw
Quoted 15 lines · Johannes Berg

Hi,

Quoted 3 lines

This patch hacks the current Alsa snd-powermac driver to add support for recent machine models with the tas3004 chip, that is basically new laptop models.

So this works, but is incompatible with gstreamer. I took it with a rhythmbox/gstreamer developer and he said that it's a driver issue. A gstreamer log is here:
http://johannes.sipsolutions.net/files/rhythmbox-alsa-debug
(produced by GST_DEBUG=alsa*:5 rhythmbox 2>&1 | tee logfile)

He also asked me to try

$ gst-launch-0.8 sinesrc ! alsasink device=hw:0
Quoted 8 lines

which yields:
RUNNING pipeline ...
ERROR: pipeline doesn't want to play.

So the conclusion was:
"set_periods_near ioctl does something weird"

Any ideas?

I don't know, this is definitely not a problem with the platform specific part of the driver, which is what I've been dealin with lately. You may find a better answer with the Alsa folks regarding the actual PCM implementation.

#8 lore raw
Quoted 4 lines · Benjamin Herrenschmidt

I don't know, this is definitely not a problem with the platform specific part of the driver, which is what I've been dealin with lately. You may find a better answer with the Alsa folks regarding the actual PCM implementation.

Ok. In the meantime, a workaround has been committed to the gstreamer CVS (because, as he put it "but since there's lots of kernel modules and every new one might have such an issue again i'd like to have a workaround")

johannes

#9 lore raw
In reply to Benjamin Herrenschmidt

At Thu, 14 Apr 2005 23:15:14 +1000,

Quoted 24 lines · Benjamin Herrenschmidt
Quoted 22 lines · Johannes Berg

Hi,

Quoted 3 lines

This patch hacks the current Alsa snd-powermac driver to add support for recent machine models with the tas3004 chip, that is basically new laptop models.

So this works, but is incompatible with gstreamer. I took it with a rhythmbox/gstreamer developer and he said that it's a driver issue. A gstreamer log is here:
http://johannes.sipsolutions.net/files/rhythmbox-alsa-debug
(produced by GST_DEBUG=alsa*:5 rhythmbox 2>&1 | tee logfile)

He also asked me to try

$ gst-launch-0.8 sinesrc ! alsasink device=hw:0

which yields:
RUNNING pipeline ...
ERROR: pipeline doesn't want to play.

So the conclusion was:
"set_periods_near ioctl does something weird"

Quoted 6 lines
Quoted 1 line

Any ideas?

I don't know, this is definitely not a problem with the platform specific part of the driver, which is what I've been dealin with lately. You may find a better answer with the Alsa folks regarding the actual PCM implementation.

Could you try the very latest CVS alsa-lib?
(Maybe you'll need to wait until tomorrow for sync with anon tree.)

In the latest version, alsa-lib will show verbose messages to stderr when $LIBASOUND_DEBUG is set.

Takashi