aboutsummaryrefslogtreecommitdiff
path: root/include/uapi/linux/ir2e71y.h
blob: 98f7bb795f943497db23bb5a018996565b0ed97b (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
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
118
119
120
121
/* include/uapi/linux/ir2e71y.h  (Display Driver)
 *
 * Copyright (C) 2016 SHARP CORPORATION
 *
 * 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 UAPI_IR2E71Y_H
#define UAPI_IR2E71Y_H
/* ------------------------------------------------------------------------- */
/* MACROS                                                                    */
/* ------------------------------------------------------------------------- */
#define IR2E71Y_OPT_CHANGE_INT_1             (0x01)
#define IR2E71Y_OPT_CHANGE_INT_2             (0x02)

#define IR2E71Y_LUT_MBR_NUM                  (3)
#define IR2E71Y_LUT_STAGE_NUM                (16)

enum {
    IR2E71Y_PHOTO_SENSOR_TYPE_APP,
    IR2E71Y_PHOTO_SENSOR_TYPE_LUX,
    IR2E71Y_PHOTO_SENSOR_TYPE_CAMERA,
    IR2E71Y_PHOTO_SENSOR_TYPE_KEYLED,
    IR2E71Y_PHOTO_SENSOR_TYPE_DIAG,
    IR2E71Y_PHOTO_SENSOR_TYPE_SENSORHUB,
    NUM_IR2E71Y_PHOTO_SENSOR_TYPE
};

enum {
    IR2E71Y_PHOTO_SENSOR_DISABLE,
    IR2E71Y_PHOTO_SENSOR_ENABLE,
    NUM_IR2E71Y_PHOTO_SENSOR
};

enum {
    IR2E71Y_RESULT_SUCCESS,
    IR2E71Y_RESULT_FAILURE,
    IR2E71Y_RESULT_FAILURE_I2C_TMO,
    IR2E71Y_RESULT_ALS_INT_OFF,
    NUM_IR2E71Y_RESULT
};

/* ------------------------------------------------------------------------- */
/* STRUCT                                                                    */
/* ------------------------------------------------------------------------- */
struct ir2e71y_photo_sensor_val {
    unsigned short value;
    unsigned int   lux;
    int mode;
    int result;
};

struct ir2e71y_photo_sensor_power_ctl {
    int type;
    int power;
};

struct ir2e71y_photo_sensor_raw_val {
    unsigned short clear;
    unsigned short ir;
    int result;
};

struct ir2e71y_photo_sensor_trigger {
    unsigned short level;
    unsigned short side;
    unsigned short en_hi_edge;
    unsigned short en_lo_edge;
    unsigned short enable;
};

struct ir2e71y_photo_sensor_int_trigger {
    struct ir2e71y_photo_sensor_trigger trigger1;
    struct ir2e71y_photo_sensor_trigger trigger2;
    int type;
    int result;
};

struct ir2e71y_light_info {
    unsigned int lux;
    unsigned short level;
    unsigned int clear_ir_rate;
    int result;
};

struct ir2e71y_lut_data {
    unsigned short red[IR2E71Y_LUT_STAGE_NUM][IR2E71Y_LUT_MBR_NUM];
    unsigned short green[IR2E71Y_LUT_STAGE_NUM][IR2E71Y_LUT_MBR_NUM];
    unsigned short blue[IR2E71Y_LUT_STAGE_NUM][IR2E71Y_LUT_MBR_NUM];
};

struct ir2e71y_lut_info {
    unsigned short lut_status;
    struct ir2e71y_lut_data lut;
};

/* ------------------------------------------------------------------------- */
/* IOCTL                                                                     */
/* ------------------------------------------------------------------------- */
#define IR2E71Y_IOC_MAGIC 's'
#define IR2E71Y_IOCTL_GET_LUX                            _IOWR (IR2E71Y_IOC_MAGIC, 1, struct ir2e71y_photo_sensor_val)
#define IR2E71Y_IOCTL_PHOTO_SENSOR_POW_CTL               _IOW  (IR2E71Y_IOC_MAGIC, 2, struct ir2e71y_photo_sensor_power_ctl)
#define IR2E71Y_IOCTL_GET_ALS                            _IOWR (IR2E71Y_IOC_MAGIC, 3, struct ir2e71y_photo_sensor_raw_val)
#define IR2E71Y_IOCTL_SET_ALSINT                         _IOWR (IR2E71Y_IOC_MAGIC, 4, struct ir2e71y_photo_sensor_int_trigger)
#define IR2E71Y_IOCTL_GET_ALSINT                         _IOWR (IR2E71Y_IOC_MAGIC, 5, struct ir2e71y_photo_sensor_int_trigger)
#define IR2E71Y_IOCTL_GET_LIGHT_INFO                     _IOWR (IR2E71Y_IOC_MAGIC, 6, struct ir2e71y_light_info)
#define IR2E71Y_IOCTL_GET_LUT_INFO                       _IOR  (IR2E71Y_IOC_MAGIC, 7, struct ir2e71y_lut_info)

#endif /* UAPI_IR2E71Y_H */

/* ------------------------------------------------------------------------- */
/* END OF FILE                                                               */
/* ------------------------------------------------------------------------- */