summaryrefslogtreecommitdiff
path: root/include/linux/headset_sprd_sc2723.h
blob: fb8143ca4d79f72f42d61006b0f607006a331272 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * Copyright (C) 2012 Spreadtrum Communications Inc.
 *
 * 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.
 */

#ifndef __HEADSET_SPRD_SC2723_H__
#define __HEADSET_SPRD_SC2723_H__
#include <linux/switch.h>
#include <linux/input.h>
#include <linux/platform_device.h>

enum {
        BIT_HEADSET_OUT = 0,
        BIT_HEADSET_MIC = (1 << 0),
        BIT_HEADSET_NO_MIC = (1 << 1),
};

struct headset_buttons {
        int adc_min;
        int adc_max;
        int code;
        unsigned int type;	/* input event type (EV_KEY, EV_SW, EV_ABS) */
};

struct sprd_headset_platform_data {
        int gpio_switch;
        int gpio_detect;
        int gpio_button;
		int gpio_detect_mic;
        int irq_trigger_level_detect;
        int irq_trigger_level_button;
		int irq_trigger_level_detect_mic;
        int adc_threshold_3pole_detect;
        int adc_threshold_4pole_detect;
        int irq_threshold_buttont;
        int voltage_headmicbias;
        struct headset_buttons *headset_buttons;
        int nbuttons;
        int (*external_headmicbias_power_on)(int);
};

struct sprd_headset {
        int headphone;
        int type;
        int irq_detect;
        int irq_button;
		int irq_detect_mic;
        struct sprd_headset_platform_data *platform_data;
        struct switch_dev sdev;
        struct input_dev *input_dev;
        struct delayed_work work_detect;
        struct workqueue_struct *detect_work_queue;
        struct work_struct work_button;
        struct workqueue_struct *button_work_queue;
};
#endif