aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/i2c/tsl2771.h
blob: 9cb74c28174409bee33b9f15b4a37b78efdfb7ba (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
/*
 * tsl2771.h
 * TSL2771 ALS and Proximity driver
 *
 * Copyright (C) 2011 Texas Instruments
 * Author: Dan Murphy <DMurphy@ti.com>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published by
 * the Free Software Foundation.
 *
 * 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.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _LINUX_TSL2771_I2C_H
#define _LINUX_TSL2771_I2C_H

#define TSL2771_NAME	"tsl2771"

/* TSL2771 Read/Write registers */
#define TSL2771_ENABLE	0x00
#define TSL2771_ATIME	0x01
#define TSL2771_PTIME	0x02
#define TSL2771_WTIME	0x03
#define TSL2771_AILTL	0x04
#define TSL2771_AILTH	0x05
#define TSL2771_AIHTL	0x06
#define TSL2771_AIHTH	0x07
#define TSL2771_PILTL	0x08
#define TSL2771_PILTH	0x09
#define TSL2771_PIHTL	0x0a
#define TSL2771_PIHTH	0x0b
#define TSL2771_PERS	0x0c
#define TSL2771_CONFIG	0x0d
#define TSL2771_PPCOUNT	0x0e
#define TSL2771_CONTROL	0x0f

#define TSL2771_USE_ALS		(1 << 0)
#define TSL2771_USE_PROX	(1 << 1)

struct tsl2771_platform_data {
	int irq_flags;
	int flags;
	uint8_t def_enable;
	uint8_t als_adc_time;
	uint8_t prox_adc_time;
	uint8_t wait_time;
	uint8_t als_low_thresh_low_byte;
	uint8_t als_low_thresh_high_byte;
	uint8_t als_high_thresh_low_byte;
	uint8_t als_high_thresh_high_byte;
	uint8_t prox_low_thresh_low_byte;
	uint8_t prox_low_thresh_high_byte;
	uint8_t prox_high_thresh_low_byte;
	uint8_t prox_high_thresh_high_byte;
	uint8_t interrupt_persistence;
	uint8_t config;
	uint8_t prox_pulse_count;
	uint8_t gain_control;

	int glass_attn;
	int device_factor;

	void (*tsl2771_pwr_control)(int state);
};

#endif