Index: linux-2.6.15-rc2/drivers/input/keyboard/corgikbd.c
===================================================================
--- linux-2.6.15-rc2.orig/drivers/input/keyboard/corgikbd.c	2005-12-01 12:25:16.000000000 +0000
+++ linux-2.6.15-rc2/drivers/input/keyboard/corgikbd.c	2005-12-04 21:32:31.000000000 +0000
@@ -258,6 +258,23 @@
 	mod_timer(&corgikbd_data->htimer, jiffies + HINGE_SCAN_INTERVAL);
 }
 
+static struct corgikbd *corgikbd_data_ptr;
+
+void corgikbd_report_hp(int status)
+{
+	unsigned long flags;
+
+	if (!corgikbd_data_ptr)
+		return;
+
+	spin_lock_irqsave(&corgikbd_data_ptr->lock, flags);
+	input_report_switch(corgikbd_data_ptr->input, SW_2, (status != 0));
+	input_sync(corgikbd_data_ptr->input);
+	spin_unlock_irqrestore(&corgikbd_data_ptr->lock, flags);
+}
+
+EXPORT_SYMBOL_GPL(corgikbd_report_hp);
+
 #ifdef CONFIG_PM
 static int corgikbd_suspend(struct platform_device *dev, pm_message_t state)
 {
@@ -363,6 +380,8 @@
 	for (i = 0; i < CORGI_KEY_STROBE_NUM; i++)
 		pxa_gpio_mode(CORGI_GPIO_KEY_STROBE(i) | GPIO_OUT | GPIO_DFLT_HIGH);
 
+	corgikbd_data_ptr = corgikbd;
+
 	return 0;
 }
 
Index: linux-2.6.15-rc2/include/asm-arm/arch-pxa/corgi.h
===================================================================
--- linux-2.6.15-rc2.orig/include/asm-arm/arch-pxa/corgi.h	2005-11-20 03:25:03.000000000 +0000
+++ linux-2.6.15-rc2/include/asm-arm/arch-pxa/corgi.h	2005-12-04 21:30:18.000000000 +0000
@@ -106,5 +106,7 @@
 extern struct platform_device corgissp_device;
 extern struct platform_device corgifb_device;
 
+void corgikbd_report_hp(int status);
+
 #endif /* __ASM_ARCH_CORGI_H  */
 
Index: linux-2.6.15-rc2/sound/soc/pxa/corgi.c
===================================================================
--- linux-2.6.15-rc2.orig/sound/soc/pxa/corgi.c	2005-12-04 18:54:09.000000000 +0000
+++ linux-2.6.15-rc2/sound/soc/pxa/corgi.c	2005-12-04 21:37:06.000000000 +0000
@@ -24,6 +24,8 @@
 #include <linux/moduleparam.h>
 #include <linux/version.h>
 #include <linux/kernel.h>
+#include <linux/timer.h>
+#include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <sound/driver.h>
 #include <sound/core.h>
@@ -33,6 +35,7 @@
 
 #include <asm/hardware/scoop.h>
 #include <asm/arch/pxa-regs.h>
+#include <asm/arch/hardware.h>
 #include <asm/arch/corgi.h>
 //#include <asm/arch/spitz.h>
 
@@ -58,6 +61,27 @@
 #define info(format, arg...) printk(KERN_INFO PFX ": " format "\n" , ## arg)
 #define warn(format, arg...) printk(KERN_WARNING PFX ": " format "\n" , ## arg)
 
+static struct timer_list corgi_hp_timer;
+
+static irqreturn_t corgi_hp_isr(int irq, void *dev_id, struct pt_regs *fp)
+{
+	/* Delay the event slightly to debounce */
+	mod_timer(&corgi_hp_timer, jiffies + msecs_to_jiffies(500));
+
+	return IRQ_HANDLED;
+}
+
+#define READ_GPIO_BIT(x)    (GPLR(x) & GPIO_bit(x))
+
+static void corgi_hp_event(unsigned long data)
+{
+	int hp_status = (READ_GPIO_BIT(CORGI_GPIO_AK_INT) != 0);
+
+	printk("HP Status: %d\n", hp_status);
+
+	corgikbd_report_hp(hp_status);
+
+}
 
 static int corgi_startup(snd_pcm_substream_t *substream)
 {
@@ -249,9 +273,22 @@
 {
 	int ret;
 
+	pxa_gpio_mode(CORGI_GPIO_AK_INT | GPIO_IN);
+	ret = request_irq(CORGI_IRQ_GPIO_AK_INT, corgi_hp_isr, SA_INTERRUPT, "Headphone Detect", corgi_snd_device);
+	if (ret < 0) {
+		printk(KERN_ERR "Could not register corgi headphone irq.\n");
+		return ret;
+	}
+	set_irq_type(CORGI_IRQ_GPIO_AK_INT, IRQT_BOTHEDGE);
+
+	init_timer(&corgi_hp_timer);
+	corgi_hp_timer.function = corgi_hp_event;
+
 	corgi_snd_device = platform_device_alloc("soc-audio", -1);
-	if (!corgi_snd_device)
+	if (!corgi_snd_device) {
+		free_irq(CORGI_IRQ_GPIO_AK_INT, corgi_snd_device);
 		return -ENOMEM;
+	}
 
 	platform_set_drvdata(corgi_snd_device, &corgi_snd_devdata);
 	corgi_snd_devdata.dev = &corgi_snd_device->dev;
@@ -265,6 +302,8 @@
 
 static void __exit corgi_exit(void) 
 {
+	free_irq(CORGI_IRQ_GPIO_AK_INT, corgi_snd_device);
+	del_timer_sync(&corgi_hp_timer);
 	platform_device_unregister(corgi_snd_device);
 }
 
