Skip to contentSkip to conversation

RFC: [PATCH Upated]: snd-pmac-gpio interfaces for snd-powermac

PATCH Ben Collins 3 participants 4 messages Jan 19, 2006 – Mar 17, 2006 Sound

lore
Share & tools
lore
#0 lore raw

This corrects a problem in the tumbler and toonie conversion. Also fixes a small naming change requested by BenH in snd-pmac-gpio.c

sound/ppc/Makefile +2 -1
diff -urN linux-2.6/sound/ppc/Makefile linux-source-2.6.15-2.6.15/sound/ppc/Makefile
@@ -3,7 +3,8 @@
 # Copyright (c) 2001 by Jaroslav Kysela <[email protected]>
 #
 
-snd-powermac-objs := powermac.o pmac.o awacs.o burgundy.o daca.o tumbler.o toonie.o keywest.o beep.o
+snd-powermac-objs := powermac.o pmac.o awacs.o burgundy.o daca.o tumbler.o \
+	toonie.o keywest.o beep.o snd-pmac-gpio.o
 
 # Toplevel Module Dependency
 obj-$(CONFIG_SND_POWERMAC) += snd-powermac.o
sound/ppc/snd-pmac-gpio.c +248 -0

248 lines not on this page · raw message

sound/ppc/snd-pmac-gpio.h +63 -0

63 lines not on this page · raw message

sound/ppc/toonie.c +64 -156

334 lines not on this page · raw message

sound/ppc/tumbler.c +85 -264

516 lines not on this page · raw message

#1 lore raw

Hi,

I have no idea if this is the latest version of this patch, but I couldn't find any more recent one...

A few of comments inlined below.

sound/ppc/snd-pmac-gpio.c line 41

Quoted 7 lines
sound/ppc/snd-pmac-gpio.c +7 -0
+static struct pmf_function *get_audio_pfunc(const char *name, const char *altname)
+{
+	struct device_node *np;
+	struct pmf_function *pfunc = NULL;
+
+	if (! (np = find_devices("i2s-a")))
+		return NULL;

Can we have this function take an explicit device parameter instead? As it is now, it can only handle the i2s-a soundcard, while the latest powermacs have two sound cards (codecs?): i2s-a and i2s-c.

Quoted 4 lines
sound/ppc/snd-pmac-gpio.c +4 -0
+int snd_pmac_get_gpio(const char *name, const char *altname,
+                            snd_pmac_gpio_t *gp)
+{
+        memset(gp, 0, sizeof(*gp));

sound/ppc/snd-pmac-gpio.c line 132

Quoted 10 lines
sound/ppc/snd-pmac-gpio.c +10 -0
+
+	gp->name = name;
+	gp->altname = altname;
+
+        /* Platform functions are prefered */
+        if ((gp->pfunc = get_audio_pfunc(name, altname)))
+                return 0;
+
+	/* Else, fallback to direct gpio */
+	return get_audio_gpio(name, altname, gp);

Maybe there ought to be a way to disable the fallback when we're on newer chips? I don't grok the sound architecture well enough yet to tell.

sound/ppc/snd-pmac-gpio.c line 143

Quoted 5 lines
sound/ppc/snd-pmac-gpio.c +5 -0
+			/* XXX: pmf_unregister_irq_client doesn't use its
+			 * first two arguments. We only need to send it
+			 * the irq_client. WATCH FOR THIS CHANGING!
+			 */
+			pmf_unregister_irq_client(NULL, NULL, &gp->irq_client);

Heh, so I'm looking at an old version of this patch. The current pmf_unregister_irq_client makes this explicit and only takes one parameter :)

Quoted 4 lines
sound/ppc/snd-pmac-gpio.c +4 -0
+int snd_pmac_request_irq(snd_pmac_gpio_t *gp, void (*handler)(void *),
+			 void *data)
+{
+	int ret = -ENODEV;

sound/ppc/snd-pmac-gpio.c line 234

Quoted 10 lines
sound/ppc/snd-pmac-gpio.c +10 -0
+	struct device_node *np;
+
+	gp->irq_client.handler = handler;
+	gp->irq_client.data = data;
+	gp->irq_client.owner = NULL;
+
+	if (gp->pfunc) {
+		gp->irq_client.owner = THIS_MODULE;
+
+		if ((np = find_devices("i2s-a"))) {

same comment here as the first one -- the powermac needs to be able to access i2s-c through this too, I think.

johannes

#2 lore raw
Quoted 3 lines · Johannes Berg

Maybe there ought to be a way to disable the fallback when we're on newer chips? I don't grok the sound architecture well enough yet to tell.

I think we should only use the pfuncs on k2 (ppc64) or when the macio node contains the include-k2-support property. At least, I +think+ that's what darwin is doing.

#3 lore raw
Quoted 3 lines · Benjamin Herrenschmidt

I think we should only use the pfuncs on k2 (ppc64) or when the macio node contains the include-k2-support property. At least, I +think+ that's what darwin is doing.

According to the comments, yes :)

Been reading through their sources -- damn it's convoluted :(

johannes