All of lore.kernel.org
 help / color / mirror / Atom feed
* snd-aoa: headphone detection fix
@ 2006-06-27 10:00 Paul Collins
  2006-06-27 12:41 ` Takashi Iwai
  2006-06-27 17:43 ` Johannes Berg
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Collins @ 2006-06-27 10:00 UTC (permalink / raw)
  To: johannes; +Cc: alsa-devel

Hi Johannes,

I took a look at tumbler.c and after it requests the headphone or
lineout detection IRQ it sets a bit in the associated GPIO register.
I added some code to snd-aoa to do something similar and now I get
interrupts both on plug and unplug.  Three each time, in fact.
(I don't remember if this used to happen with snd-powermac.)

I also set the same bit in the linein-detect register on the
assumption that it is handled in the same way.  I have only been able
to test headphone detection here on my PowerBook5,4 though.

Signed-off-by: Paul Collins <paul@ondioline.org>

diff --git a/sound/aoa/core/snd-aoa-gpio-feature.c b/sound/aoa/core/snd-aoa-gpio-feature.c
index 2c6eb77..fa0606e 100644
--- a/sound/aoa/core/snd-aoa-gpio-feature.c
+++ b/sound/aoa/core/snd-aoa-gpio-feature.c
@@ -289,6 +289,7 @@ static int ftr_set_notify(struct gpio_ru
 	struct gpio_notification *notif;
 	notify_func_t old;
 	int irq;
+	int gpio = -1;
 	char *name;
 	int err = -EBUSY;
 
@@ -297,16 +298,19 @@ static int ftr_set_notify(struct gpio_ru
 		notif = &rt->headphone_notify;
 		name = "headphone-detect";
 		irq = headphone_detect_irq;
+		gpio = headphone_detect_gpio;
 		break;
 	case AOA_NOTIFY_LINE_IN:
 		notif = &rt->line_in_notify;
 		name = "linein-detect";
 		irq = linein_detect_irq;
+		gpio = linein_detect_gpio;
 		break;
 	case AOA_NOTIFY_LINE_OUT:
 		notif = &rt->line_out_notify;
 		name = "lineout-detect";
 		irq = lineout_detect_irq;
+		gpio = lineout_detect_gpio;
 		break;
 	default:
 		return -EINVAL;
@@ -337,6 +341,14 @@ static int ftr_set_notify(struct gpio_ru
 		err = request_irq(irq, ftr_handle_notify_irq, 0, name, notif);
 		if (err)
 			goto out_unlock;
+
+		/* Activate status interrupts. */
+		if (gpio > -1) {
+			int v;
+			v = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, gpio, 0);
+			v |= 0x80;
+			pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, gpio, v);
+		}
 	}
 
 	notif->notify = notify;

-- 
Paul Collins
Melbourne, Australia

Dag vijandelijk luchtschip de huismeester is dood

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-06-27 17:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-27 10:00 snd-aoa: headphone detection fix Paul Collins
2006-06-27 12:41 ` Takashi Iwai
2006-06-27 17:43 ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.