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
|
/* include/linux/input/proximity.h (proximitySensor Driver)
*
* Copyright (C) 2016 SHARP CORPORATION All rights reserved.
*
* 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.
*
*/
/*
* Definitions for GP2AP030A00F chip.
*/
/* ------------------------------------------------------------------------- */
/* SHARP PROXIMITY SENSOR DRIVER FOR KERNEL MODE */
/* ------------------------------------------------------------------------- */
#ifndef PROXIMITY_H
#define PROXIMITY_H
/* ------------------------------------------------------------------------- */
/* INCLUDE FILES */
/* ------------------------------------------------------------------------- */
#include <linux/ioctl.h>
/* ------------------------------------------------------------------------- */
/* MACROS */
/* ------------------------------------------------------------------------- */
#define PROX_DRIVER_NAME "gp2a-prox"
#define SH_PROXIMITY_RESULT_FAILURE -1
#define SH_PROXIMITY_RESULT_SUCCESS 0
#define SH_PROXIMITY_NEAR 0
#define SH_PROXIMITY_FAR 7
#define SH_PROXIMITY_ENABLE 1
#define SH_PROXIMITY_DISABLE 0
/* GP2AP030A00F register address */
#define GP2AP030_REG_COMMAND1 0x00
#define GP2AP030_REG_COMMAND2 0x01
#define GP2AP030_REG_COMMAND3 0x02
#define GP2AP030_REG_COMMAND4 0x03
#define GP2AP030_REG_LT_LSB 0x08
#define GP2AP030_REG_LT_MSB 0x09
#define GP2AP030_REG_HT_LSB 0x0A
#define GP2AP030_REG_HT_MSB 0x0B
#define GP2AP030_REG_D2_LSB 0x10
#define GP2AP030_REG_D2_MSB 0x11
/* IOCTLs for GP2AP030A00F */
#define GP2AP030IO 0xA2
#define ECS_IOCTL_ENABLE _IO(GP2AP030IO, 0x01)
#define ECS_IOCTL_DISABLE _IO(GP2AP030IO, 0x02)
#define ECS_IOCTL_SET_CYCLE _IOW(GP2AP030IO, 0x03, short)
#define ECS_IOCTL_GET_VO_DATA _IOR(GP2AP030IO, 0x04, char)
#define ECS_IOCTL_LT_THRESHOLD_WRITE _IOW(GP2AP030IO, 0x05, unsigned short)
#define ECS_IOCTL_HT_THRESHOLD_WRITE _IOW(GP2AP030IO, 0x06, unsigned short)
#define ECS_IOCTL_GET_D2_DATA _IOR(GP2AP030IO, 0x07, unsigned short)
/* ------------------------------------------------------------------------- */
/* PROTOTYPES */
/* ------------------------------------------------------------------------- */
int PROX_recovery_end_func(void);
int PROX_recovery_start_func(void);
#endif /* PROXIMITY_H */
/* ------------------------------------------------------------------------- */
/* END OF FILE */
/* ------------------------------------------------------------------------- */
|