summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorVinod G <vinodg@nvidia.com>2011-03-28 18:58:32 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-04-26 15:54:39 -0700
commit1baaffc0ca8d70d4ea9fd39e75a578177be460a5 (patch)
tree81da4a9a6ac62d0ec2f8ff545d8a0a42028c9e44 /sound
parent1086d31ff0be88f88e81f8817a0ea0d3866adb1f (diff)
arm: tegra: Fix the gpio error for HP detection.
Fix the gpio error happened with merge code. Original-Change-Id: I25daf913bacdb9502f89e3838903f6206cf10402 Reviewed-on: http://git-master/r/24613 Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com> Tested-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com> Reviewed-by: Scott Peterson <speterson@nvidia.com> Change-Id: I885cd23c7d9673ea9285a4f34b09f35b8f265b47
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/tegra/tegra_wired_jack.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/sound/soc/tegra/tegra_wired_jack.c b/sound/soc/tegra/tegra_wired_jack.c
index 9a434fe57715..235f4893add9 100644
--- a/sound/soc/tegra/tegra_wired_jack.c
+++ b/sound/soc/tegra/tegra_wired_jack.c
@@ -143,14 +143,18 @@ static struct notifier_block wired_switch_nb = {
static int tegra_wired_jack_probe(struct platform_device *pdev)
{
int ret;
- int hp_det_n, cdc_irq;
- int en_mic_int, en_mic_ext;
- int en_spkr;
+ int hp_det_n = 0, cdc_irq = 0;
+ int en_mic_int = 0, en_mic_ext = 0;
+ int en_spkr = 0;
struct tegra_wired_jack_conf *pdata;
pdata = (struct tegra_wired_jack_conf *)pdev->dev.platform_data;
- if (!pdata || !pdata->hp_det_n || !pdata->en_spkr ||
- !pdata->cdc_irq || !pdata->en_mic_int || !pdata->en_mic_ext) {
+
+ if (!pdata || !pdata->hp_det_n
+#if defined(CONFIG_ARCH_TEGRA_2x_SOC)
+ || !pdata->cdc_irq || !pdata->en_spkr
+#endif
+ || !pdata->en_mic_int || !pdata->en_mic_ext) {
pr_err("Please set up gpio pins for jack.\n");
return -EBUSY;
}
@@ -180,26 +184,38 @@ static int tegra_wired_jack_probe(struct platform_device *pdev)
if (ret) {
pr_err("Could NOT get gpio for internal mic controlling.\n");
gpio_free(en_mic_int);
+ en_mic_int = -1;
+ }
+
+ if (en_mic_int != -1) {
+ gpio_direction_output(en_mic_int, 0);
+ gpio_export(en_mic_int, false);
}
- gpio_direction_output(en_mic_int, 0);
- gpio_export(en_mic_int, false);
ret = gpio_request(en_mic_ext, "en_mic_ext");
if (ret) {
pr_err("Could NOT get gpio for external mic controlling.\n");
gpio_free(en_mic_ext);
+ en_mic_ext = -1;
+ }
+
+ if (en_mic_ext != -1) {
+ gpio_direction_output(en_mic_ext, 0);
+ gpio_export(en_mic_ext, false);
}
- gpio_direction_output(en_mic_ext, 0);
- gpio_export(en_mic_ext, false);
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);
+ en_spkr = -1;
+ }
+
+ if (en_spkr != -1) {
+ gpio_direction_output(en_spkr, 0);
+ gpio_export(en_spkr, false);
}
- gpio_direction_output(en_spkr, 0);
- gpio_export(en_spkr, false);
if (pdata->spkr_amp_reg)
tegra_wired_jack_conf.amp_reg =