Flemmard | 4d9dbc7 | 2014-01-29 10:06:14 +0100 | [diff] [blame] | 1 | /* include/linux/isl29029.h |
| 2 | * |
| 3 | * Copyright (C) 2010 HTC, Inc. |
| 4 | * |
| 5 | * This software is licensed under the terms of the GNU General Public |
| 6 | * License version 2, as published by the Free Software Foundation, and |
| 7 | * may be copied, distributed, and modified under those terms. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | #ifndef __ISL29029_H |
| 17 | #define __ISL29029_H |
| 18 | |
| 19 | #define ISL29029_I2C_NAME "isl29029" |
| 20 | |
| 21 | #define ISL29029_CHIPID 0x00 |
| 22 | #define ISL29029_CONFIGURE 0x01 |
| 23 | #define ISL29029_INTERRUPT 0x02 |
| 24 | #define ISL29029_PROX_LT 0x03 |
| 25 | #define ISL29828_PROX_HT 0x04 |
| 26 | #define ISL29029_LS_TH1 0x05 |
| 27 | #define ISL29029_LS_TH2 0x06 |
| 28 | #define ISL29029_LS_TH3 0x07 |
| 29 | #define ISL29029_PROX_DATA 0x08 |
| 30 | #define ISL29029_LS_DATA1 0x09 |
| 31 | #define ISL29029_LS_DATA2 0x0A |
| 32 | #define ISL29029_TEST1 0x0E |
| 33 | #define ISL29029_TEST2 0x0F |
| 34 | |
| 35 | #define ISL29029_PROX_EN (1 << 7) |
| 36 | #define ISL29029_PROX_DR (1 << 3) |
| 37 | #define ISL29029_ALS_EN (1 << 2) |
| 38 | #define ISL29029_INT_PROX_FLAG (1 << 7) |
| 39 | #define ISL29029_INT_ALS_FLAG (1 << 3) |
| 40 | #define ISL29029_INT_ALS_PRST (2 << 1) |
| 41 | |
| 42 | #define ALS_CALIBRATED 0x6DA5 |
| 43 | #define PS_CALIBRATED 0x5053 |
| 44 | |
| 45 | extern unsigned int ps_kparam1; |
| 46 | extern unsigned int ps_kparam2; |
| 47 | |
| 48 | struct isl29029_platform_data { |
| 49 | int intr; |
| 50 | uint16_t levels[10]; |
| 51 | uint16_t golden_adc; |
| 52 | int (*power)(int, uint8_t); /* power to the chip */ |
| 53 | int (*calibrate_func)(int, int, int, int, int*, int*); |
| 54 | uint8_t lt; |
| 55 | uint8_t ht; |
| 56 | uint8_t debounce; |
| 57 | uint8_t *mapping_table; |
| 58 | uint8_t mapping_size; |
| 59 | uint8_t enable_polling_ignore; |
| 60 | uint8_t default_config_reg; |
| 61 | }; |
| 62 | |
| 63 | #endif |