summaryrefslogtreecommitdiffstats
path: root/sound/ppc/beep.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-04-16 15:24:32 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:24:32 -0700
commit7bbd827750e630003896c96d0212962276ee5d91 (patch)
tree71bb72cddbb08f9de68b2c7c05b4f5c03e8ed0bd /sound/ppc/beep.c
parentb20af5f59797796d28b701f5d337e47c8a142eb2 (diff)
downloadlinux-7bbd827750e630003896c96d0212962276ee5d91.tar.gz
linux-7bbd827750e630003896c96d0212962276ee5d91.tar.bz2
linux-7bbd827750e630003896c96d0212962276ee5d91.zip
[PATCH] ppc64: very basic desktop g5 sound support
This patch hacks the current PowerMac Alsa driver to add some basic support of analog sound output to some desktop G5s. It has severe limitations though: - Only 44100Khz 16 bits - Only work on G5 models using a TAS3004 analog code, that is early single CPU desktops and all dual CPU desktops at this date, but none of the more recent ones like iMac G5. - It does analog only, no digital/SPDIF support at all, no native AC3 support Better support would require a complete rewrite of the driver (which I am working on, but don't hold your breath), to properly support the diversity of apple sound HW setup, including dual codecs, several i2s busses, all the new codecs used in the new machines, proper clock switching with digital, etc etc etc... This patch applies on top of the other PowerMac sound patches I posted in the past couple of days (new powerbook support and sleep fixes). Note: This is a FAQ entry for PowerMac sound support with TI codecs: They have a feature called "DRC" which is automatically enabled for the internal speaker (at least when auto mute control is enabled) which will cause your sound to fade out to nothing after half a second of playback if you don't set a proper "DRC Range" in the mixer. So if you have a problem like that, check alsamixer and raise your DRC Range to something reasonable. Note2: This patch will also add auto-mute of the speaker when line-out jack is used on some earlier desktop G4s (and on the G5) in addition to the headphone jack. If that behaviour isn't what you want, just disable auto-muting and use the manual mute controls in alsamixer. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'sound/ppc/beep.c')
-rw-r--r--sound/ppc/beep.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c
index c23f601a37f9..31ea7a4c069f 100644
--- a/sound/ppc/beep.c
+++ b/sound/ppc/beep.c
@@ -24,6 +24,8 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/input.h>
+#include <linux/pci.h>
+#include <linux/dma-mapping.h>
#include <sound/core.h>
#include <sound/control.h>
#include "pmac.h"
@@ -35,7 +37,7 @@ struct snd_pmac_beep {
int hz;
int nsamples;
short *buf; /* allocated wave buffer */
- unsigned long addr; /* physical address of buffer */
+ dma_addr_t addr; /* physical address of buffer */
struct input_dev dev;
};
@@ -217,12 +219,8 @@ int __init snd_pmac_attach_beep(pmac_t *chip)
return -ENOMEM;
memset(beep, 0, sizeof(*beep));
- beep->buf = (short *) kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL);
- if (! beep->buf) {
- kfree(beep);
- return -ENOMEM;
- }
- beep->addr = virt_to_bus(beep->buf);
+ beep->buf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4,
+ &beep->addr, GFP_KERNEL);
beep->dev.evbit[0] = BIT(EV_SND);
beep->dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
@@ -255,7 +253,8 @@ void snd_pmac_detach_beep(pmac_t *chip)
{
if (chip->beep) {
input_unregister_device(&chip->beep->dev);
- kfree(chip->beep->buf);
+ dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4,
+ chip->beep->buf, chip->beep->addr);
kfree(chip->beep);
chip->beep = NULL;
}