snd-aoa: headphone detection fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>

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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux