import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / barometer / BMP180 / bmp180.h
1 /* BOSCH Pressure Sensor Driver
2 *
3 * This software is licensed under the terms of the GNU General Public
4 * License version 2, as published by the Free Software Foundation, and
5 * may be copied, distributed, and modified under those terms.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14 #ifndef BOSCH_BARO_H
15 #define BOSCH_BARO_H
16
17 #include <linux/ioctl.h>
18 /*****************************************************
19 | sensor | chip id | 7-bit i2c address |
20 -----------------------------------------------------|
21 | bmp180 | 0x55 | 0x77 |
22 *****************************************************/
23
24 /* apply low pass filter on output */
25 /*#define CONFIG_BMP_LOWPASS*/
26 /*#define CONFIG_ID_TEMPERATURE*/
27 /*#define CONFIG_I2C_BASIC_FUNCTION*/
28
29 #define BMP_DRIVER_VERSION "V1.2"
30
31 #define BMP_DEV_NAME "bmp180"
32
33 #define C_MAX_FIR_LENGTH (32)
34 #define MAX_SENSOR_NAME (32)
35 #define BMP_DATA_NUM 1
36 #define BMP_PRESSURE 0
37 #define BMP_BUFSIZE 128
38
39 /* common definition */
40 #define BMP_GET_BITSLICE(regvar, bitname)\
41 ((regvar & bitname##__MSK) >> bitname##__POS)
42
43 #define BMP_SET_BITSLICE(regvar, bitname, val)\
44 ((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK))
45
46
47 #define BMP_CHIP_ID_REG 0xD0
48
49 /*********************************[BMP180]*************************************/
50 /* chip id */
51 #define BMP180_CHIP_ID 0x55
52
53 /* i2c address */
54 #define BMP180_I2C_ADDRESS 0x77
55
56 /* calibration data */
57 #define BMP180_CALIBRATION_DATA_START 0xAA
58 #define BMP180_CALIBRATION_DATA_LENGTH 11 /* 16 bit values */
59
60 /* oversampling */
61 #define BMP180_OVERSAMPLING_1X 0x00
62 #define BMP180_OVERSAMPLING_2X 0x01
63 #define BMP180_OVERSAMPLING_4X 0x02
64 #define BMP180_OVERSAMPLING_8X 0x03
65
66 #define BMP180_CTRLMEAS_REG 0xF4 /* Ctrl Measure Register */
67
68 #define BMP180_CTRLMEAS_REG_OSRSP__POS 6
69 #define BMP180_CTRLMEAS_REG_OSRSP__MSK 0xC0
70 #define BMP180_CTRLMEAS_REG_OSRSP__LEN 2
71 #define BMP180_CTRLMEAS_REG_OSRSP__REG BMP180_CTRLMEAS_REG
72
73 /* data */
74 #define BMP180_TEMP_MEASUREMENT 0x2E
75 #define BMP180_PRESSURE_MEASUREMENT 0x34
76 #define BMP180_TEMP_CONVERSION_TIME (5 + 5)
77 #define BMP180_CONVERSION_REGISTER_MSB 0xF6
78
79 #define BMP180_CTRLMEAS_REG_MC__POS 0
80 #define BMP180_CTRLMEAS_REG_MC__MSK 0x3F
81 #define BMP180_CTRLMEAS_REG_MC__LEN 6
82 #define BMP180_CTRLMEAS_REG_MC__REG BMP180_CTRLMEAS_REG
83
84 #endif/* BOSCH_BARO_H */