From patchwork Thu Feb 26 07:57:53 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lopez Cruz, Misael" X-Patchwork-Id: 8899 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1Q7uxUK030118 for ; Thu, 26 Feb 2009 07:58:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752126AbZBZH6J (ORCPT ); Thu, 26 Feb 2009 02:58:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752198AbZBZH6J (ORCPT ); Thu, 26 Feb 2009 02:58:09 -0500 Received: from comal.ext.ti.com ([198.47.26.152]:51318 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752126AbZBZH6I convert rfc822-to-8bit (ORCPT ); Thu, 26 Feb 2009 02:58:08 -0500 Received: from dlep95.itg.ti.com ([157.170.170.107]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id n1Q7vxYx009442; Thu, 26 Feb 2009 01:58:04 -0600 Received: from dlee75.ent.ti.com (localhost [127.0.0.1]) by dlep95.itg.ti.com (8.13.8/8.13.8) with ESMTP id n1Q7vx2K002831; Thu, 26 Feb 2009 01:57:59 -0600 (CST) Received: from dlee07.ent.ti.com ([157.170.170.80]) by dlee75.ent.ti.com ([157.170.170.72]) with mapi; Thu, 26 Feb 2009 01:57:59 -0600 From: "Lopez Cruz, Misael" To: "alsa-devel@alsa-project.org" CC: "linux-omap@vger.kernel.org" Date: Thu, 26 Feb 2009 01:57:53 -0600 Subject: [PATCH 3/3] ASoC: Add headset jack detection for SDP3430 machine driver Thread-Topic: [PATCH 3/3] ASoC: Add headset jack detection for SDP3430 machine driver Thread-Index: AcmX5+2bHzEMrpflRxW3H8AMQ26XmQ== Message-ID: <2C7D3DF36ADFFC479B44490D912B616705EC8B1C05@dlee07.ent.ti.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Add headset jack detection for SDP3430 boards using SoC jack reporting interface. Headset detection on SDP3430 board is achieved through TWL4030 GPIO_2 pin. Signed-off-by: Misael Lopez Cruz --- sound/soc/omap/sdp3430.c | 31 ++++++++++++++++++++++++++++++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c index 7a996d9..7695675 100644 --- a/sound/soc/omap/sdp3430.c +++ b/sound/soc/omap/sdp3430.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -141,6 +142,18 @@ static int sdp3430_twl4030_init(struct snd_soc_codec *codec) return ret; } +/* Jack detection */ +struct snd_soc_jack *sdp3430_jack; + +struct snd_soc_jack_pin sdp3430_jack_pins[] = { + { + .pin = "Headset Jack", + .mask = SND_JACK_HEADSET, + .invert = 0, + .gpio = (OMAP_MAX_GPIO_LINES + 2), + }, +}; + /* Digital audio interface glue - connects codec <--> CPU */ static struct snd_soc_dai_link sdp3430_dai = { .name = "TWL4030", @@ -191,7 +204,23 @@ static int __init sdp3430_soc_init(void) if (ret) goto err1; - return 0; + /* Jack detection */ + sdp3430_jack = kzalloc(sizeof(struct snd_soc_jack), GFP_KERNEL); + if (!sdp3430_jack) { + printk(KERN_ERR "SDP3430 SoC Jack allocation failed\n"); + return -ENOMEM; + } + + snd_soc_jack_new(&snd_soc_sdp3430, "SDP3430 SoC Jack", + SND_JACK_HEADSET, sdp3430_jack); + if (ret) + return ret; + + ret = snd_soc_jack_add_pins(sdp3430_jack, + ARRAY_SIZE(sdp3430_jack_pins), + sdp3430_jack_pins); + + return ret; err1: printk(KERN_ERR "Unable to add platform device\n");