aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/linux/linux-omap-psp-2.6.32/omap3-touchbook/0010-Touch-Book-turn-on-off-the-class-D-amplifier-dependi.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/linux/linux-omap-psp-2.6.32/omap3-touchbook/0010-Touch-Book-turn-on-off-the-class-D-amplifier-dependi.patch')
-rw-r--r--recipes/linux/linux-omap-psp-2.6.32/omap3-touchbook/0010-Touch-Book-turn-on-off-the-class-D-amplifier-dependi.patch95
1 files changed, 95 insertions, 0 deletions
diff --git a/recipes/linux/linux-omap-psp-2.6.32/omap3-touchbook/0010-Touch-Book-turn-on-off-the-class-D-amplifier-dependi.patch b/recipes/linux/linux-omap-psp-2.6.32/omap3-touchbook/0010-Touch-Book-turn-on-off-the-class-D-amplifier-dependi.patch
new file mode 100644
index 0000000000..67d2b18907
--- /dev/null
+++ b/recipes/linux/linux-omap-psp-2.6.32/omap3-touchbook/0010-Touch-Book-turn-on-off-the-class-D-amplifier-dependi.patch
@@ -0,0 +1,95 @@
+From 98b1f1df855ead7eec5f8c9032736046752e5593 Mon Sep 17 00:00:00 2001
+From: Tim Yamin <plasm@roo.me.uk>
+Date: Wed, 29 Apr 2009 17:30:25 -0700
+Subject: [PATCH 10/14] Touch Book: turn on/off the class D amplifier depending on whether the headphones are plugged into the jack or not.
+
+Signed-off-by: Tim Yamin <plasm@roo.me.uk>
+---
+ sound/soc/omap/omap3beagle.c | 45 ++++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 45 insertions(+), 0 deletions(-)
+
+diff --git a/sound/soc/omap/omap3beagle.c b/sound/soc/omap/omap3beagle.c
+index 248b789..8b2d9e4 100644
+--- a/sound/soc/omap/omap3beagle.c
++++ b/sound/soc/omap/omap3beagle.c
+@@ -20,7 +20,10 @@
+ */
+
+ #include <linux/clk.h>
++#include <linux/irq.h>
++#include <linux/interrupt.h>
+ #include <linux/platform_device.h>
++
+ #include <sound/core.h>
+ #include <sound/pcm.h>
+ #include <sound/soc.h>
+@@ -35,6 +38,9 @@
+ #include "omap-pcm.h"
+ #include "../codecs/twl4030.h"
+
++#define TB_HEADPHONE_GPIO 56
++#define TB_HEADPHONE_IRQ OMAP_GPIO_IRQ(TB_HEADPHONE_GPIO)
++
+ static int omap3beagle_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params)
+ {
+@@ -113,6 +119,33 @@ static struct snd_soc_device omap3beagle_snd_devdata = {
+
+ static struct platform_device *omap3beagle_snd_device;
+
++static void jack_work_func(struct work_struct *wq)
++{
++ struct snd_soc_device *socdev = platform_get_drvdata(omap3beagle_snd_device);
++ struct snd_soc_codec *codec = socdev->card->codec;
++
++ snd_soc_dapm_sync(codec);
++}
++DECLARE_WORK(jack_work, jack_work_func);
++
++static irqreturn_t touchbook_headphone_event(int irq, void *snd)
++{
++ int status = gpio_get_value(TB_HEADPHONE_GPIO);
++ struct snd_soc_device *socdev = platform_get_drvdata(omap3beagle_snd_device);
++ struct snd_soc_codec *codec = socdev->card->codec;
++
++ if(status) {
++ snd_soc_dapm_disable_pin(codec, "HFL");
++ snd_soc_dapm_disable_pin(codec, "HFR");
++ } else {
++ snd_soc_dapm_enable_pin(codec, "HFL");
++ snd_soc_dapm_enable_pin(codec, "HFR");
++ }
++
++ schedule_work(&jack_work);
++ return IRQ_HANDLED;
++}
++
+ static int __init omap3beagle_soc_init(void)
+ {
+ int ret;
+@@ -133,10 +166,22 @@ static int __init omap3beagle_soc_init(void)
+ omap3beagle_snd_devdata.dev = &omap3beagle_snd_device->dev;
+ *(unsigned int *)omap3beagle_dai.cpu_dai->private_data = 1; /* McBSP2 */
+
++ /* Touch Book -- headphone jack sensor */
++ omap_set_gpio_debounce(TB_HEADPHONE_GPIO, 1);
++ omap_set_gpio_debounce_time(TB_HEADPHONE_GPIO, 0xff);
++
++ ret = request_irq(TB_HEADPHONE_IRQ, touchbook_headphone_event, IRQF_TRIGGER_RISING |
++ IRQF_TRIGGER_FALLING, "touchbook_headphone", omap3beagle_snd_device);
++ if (ret < 0)
++ goto err1;
++
+ ret = platform_device_add(omap3beagle_snd_device);
+ if (ret)
+ goto err1;
+
++ /* Detect headphone status */
++ touchbook_headphone_event(0, omap3beagle_snd_device);
++
+ return 0;
+
+ err1:
+--
+1.6.6.1
+