diff options
Diffstat (limited to 'sound/soc/tegra/tegra_wired_jack.c')
-rw-r--r-- | sound/soc/tegra/tegra_wired_jack.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sound/soc/tegra/tegra_wired_jack.c b/sound/soc/tegra/tegra_wired_jack.c index 7967caefce33..10fb237ce64a 100644 --- a/sound/soc/tegra/tegra_wired_jack.c +++ b/sound/soc/tegra/tegra_wired_jack.c @@ -19,6 +19,7 @@ */ #include <linux/types.h> +#include <linux/gpio.h> #include <linux/switch.h> #include <linux/notifier.h> #include <sound/jack.h> @@ -29,6 +30,10 @@ #define HEAD_DET_GPIO 0 +struct wired_jack_conf tegra_wired_jack_conf = { + -1, -1, -1, -1 +}; + /* jack */ static struct snd_soc_jack *tegra_wired_jack; @@ -97,10 +102,11 @@ static int tegra_wired_jack_probe(struct platform_device *pdev) { int ret; int hp_det_n; + int en_spkr; struct tegra_wired_jack_conf *pdata; pdata = (struct tegra_wired_jack_conf *)pdev->dev.platform_data; - if (!pdata || !pdata->hp_det_n) { + if (!pdata || !pdata->hp_det_n || !pdata->en_spkr) { pr_err("Please set up gpio pins for jack.\n"); return -EBUSY; } @@ -119,6 +125,19 @@ static int tegra_wired_jack_probe(struct platform_device *pdev) return ret; } + en_spkr = pdata->en_spkr; + ret = gpio_request(en_spkr, "en_spkr"); + if (ret) { + pr_err("Could NOT set up gpio pin for amplifier.\n"); + gpio_free(en_spkr); + } + gpio_direction_output(en_spkr, 0); + gpio_export(en_spkr, false); + + /* restore configuration of these pins */ + tegra_wired_jack_conf.hp_det_n = hp_det_n; + tegra_wired_jack_conf.en_spkr = en_spkr; + return 0; } |