From ed1166865825a993c16a7dcf3f59b126c863586a Mon Sep 17 00:00:00 2001 From: Chao Jiang Date: Wed, 9 Feb 2011 17:57:09 +0900 Subject: [tegra ALSA] Added headphone jack detection Headphone jack detection is enabled with this patch. The jack will be reported via /sys/class/switch interface to user space. fixes bug 766757 Change-Id: I58908e7de1025b17cdf37079d5650aa5f503dcdd Reviewed-on: http://git-master/r/18707 Reviewed-by: Sachin Nikam Reviewed-by: Chao Jiang Tested-by: Chao Jiang Reviewed-by: Scott Peterson Reviewed-by: Bharat Nihalani --- sound/soc/tegra/tegra_soc_controls.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'sound/soc/tegra/tegra_soc_controls.c') diff --git a/sound/soc/tegra/tegra_soc_controls.c b/sound/soc/tegra/tegra_soc_controls.c index f73e80df751f..e076cf93b672 100644 --- a/sound/soc/tegra/tegra_soc_controls.c +++ b/sound/soc/tegra/tegra_soc_controls.c @@ -20,11 +20,8 @@ #include "tegra_soc.h" -#include -static struct tegra_audio_data *audio_data; -static int tegra_jack_func; -static int tegra_spk_func; +#include #define TEGRA_HP 0 #define TEGRA_MIC 1 @@ -34,6 +31,10 @@ static int tegra_spk_func; #define TEGRA_SPK_ON 0 #define TEGRA_SPK_OFF 1 +static struct tegra_audio_data *audio_data; +static int tegra_jack_func; +static int tegra_spk_func; + static void tegra_ext_control(struct snd_soc_codec *codec) { /* set up jack connection */ @@ -427,6 +428,11 @@ int tegra_controls_init(struct snd_soc_codec *codec) if (err < 0) goto fail; + /* Add jack detection */ + err = tegra_jack_init(codec); + if (err < 0) + goto fail; + /* Default to HP output */ tegra_jack_func = TEGRA_HP; tegra_spk_func = TEGRA_SPK_ON; @@ -436,6 +442,7 @@ int tegra_controls_init(struct snd_soc_codec *codec) } return 0; + fail: if (audio_data) { kfree(audio_data); @@ -446,6 +453,8 @@ fail: void tegra_controls_exit(void) { + tegra_jack_exit(); + if (audio_data) { kfree(audio_data); audio_data = 0; -- cgit v1.2.3