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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/vmalloc.h>
#include <linux/platform_device.h>
#include <linux/miscdevice.h>
#include <linux/wait.h>
#include <linux/spinlock.h>
#include <linux/ctype.h>
#include <linux/semaphore.h>
#include <linux/uaccess.h>
#include <asm/io.h>
#include <linux/workqueue.h>
#include <linux/switch.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/kdev_t.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/uaccess.h>
#include <linux/kthread.h>
#include <linux/input.h>
#include <linux/wakelock.h>
#include <linux/time.h>
#include <linux/string.h>
#include <mach/mt_typedefs.h>
#include <mach/mt_reg_base.h>
#include <mach/irqs.h>
#include <mach/reg_accdet.h>
#include <accdet_custom.h>
#include <accdet_custom_def.h>
/*----------------------------------------------------------------------
IOCTL
----------------------------------------------------------------------*/
#define ACCDET_DEVNAME "accdet"
#define ACCDET_IOC_MAGIC 'A'
#define ACCDET_INIT _IO(ACCDET_IOC_MAGIC,0)
#define SET_CALL_STATE _IO(ACCDET_IOC_MAGIC,1)
#define GET_BUTTON_STATUS _IO(ACCDET_IOC_MAGIC,2)
/*define for phone call state*/
#define CALL_IDLE 0
#define CALL_RINGING 1
#define CALL_ACTIVE 2
#define KEY_CALL KEY_SEND
#define KEY_ENDCALL KEY_HANGEUL
#define ACCDET_TIME_OUT 0x61A80 //400us
/****************************************************
globle ACCDET variables
****************************************************/
enum accdet_report_state
{
NO_DEVICE =0,
HEADSET_MIC = 1,
HEADSET_NO_MIC = 2,
//HEADSET_ILEGAL = 3,
//DOUBLE_CHECK_TV = 4
};
enum accdet_status
{
PLUG_OUT = 0,
MIC_BIAS = 1,
//DOUBLE_CHECK = 2,
HOOK_SWITCH = 2,
//MIC_BIAS_ILLEGAL =3,
//TV_OUT = 5,
STAND_BY =4
};
char *accdet_status_string[5]=
{
"Plug_out",
"Headset_plug_in",
//"Double_check",
"Hook_switch",
//"Tvout_plug_in",
"Stand_by"
};
char *accdet_report_string[4]=
{
"No_device",
"Headset_mic",
"Headset_no_mic",
//"HEADSET_illegal",
// "Double_check"
};
enum hook_switch_result
{
DO_NOTHING =0,
ANSWER_CALL = 1,
REJECT_CALL = 2
};
/*
typedef enum
{
TVOUT_STATUS_OK = 0,
TVOUT_STATUS_ALREADY_SET,
TVOUT_STATUS_ERROR,
} TVOUT_STATUS;
*/
|