summaryrefslogtreecommitdiff
path: root/sound/soc/tegra/tegra_soc_controls.c
diff options
context:
space:
mode:
authorChao Jiang <chaoj@nvidia.com>2011-02-09 17:57:09 +0900
committerVarun Colbert <vcolbert@nvidia.com>2011-02-10 15:42:00 -0800
commited1166865825a993c16a7dcf3f59b126c863586a (patch)
tree3e2405b0ab593c2b03c4aa290d8845107b95548e /sound/soc/tegra/tegra_soc_controls.c
parent8df80194dc456a45fc8245de57bd9b46d2cf16a8 (diff)
[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 <snikam@nvidia.com> Reviewed-by: Chao Jiang <chaoj@nvidia.com> Tested-by: Chao Jiang <chaoj@nvidia.com> Reviewed-by: Scott Peterson <speterson@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'sound/soc/tegra/tegra_soc_controls.c')
-rw-r--r--sound/soc/tegra/tegra_soc_controls.c17
1 files changed, 13 insertions, 4 deletions
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 <mach/audio.h>
-static struct tegra_audio_data *audio_data;
-static int tegra_jack_func;
-static int tegra_spk_func;
+#include <mach/audio.h>
#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;