aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-exynos/grande-jack.c
blob: 99cb0fe65000f85c740c3f96b0b57cc90fe04a61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* arch/arm/mach-exynos/grande-jack.c
 *
 * Copyright (C) 2012 Samsung Electronics Co, Ltd
 *
 * Based on mach-exynos/mach-grande.c
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <mach/gpio-midas.h>
#include <linux/input.h>
#include <linux/platform_device.h>
#include <linux/sec_jack.h>

static void sec_set_jack_micbias(bool on)
{
	gpio_set_value(GPIO_MIC_BIAS_EN, on);
}

static struct sec_jack_platform_data sec_jack_data = {
	.set_micbias_state = sec_set_jack_micbias,
};

static struct platform_device sec_device_jack = {
	.name = "sec_jack",
	.id = 1,		/* will be used also for gpio_event id */
	.dev.platform_data = &sec_jack_data,
};
void __init grande_jack_init(void)
{
	/* Ear Microphone BIAS */
	int err;
	err = gpio_request(GPIO_MIC_BIAS_EN, "EAR MIC");
	if (err) {
		pr_err(KERN_ERR "GPIO_MIC_BIAS_EN GPIO set error!\n");
		return;
	}
	gpio_direction_output(GPIO_MIC_BIAS_EN, 1);
	gpio_set_value(GPIO_MIC_BIAS_EN, 0);
	gpio_free(GPIO_MIC_BIAS_EN);

	platform_device_register(&sec_device_jack);
}