diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
| commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
| tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /include/linux/cm3217.h | |
| parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) | |
Diffstat (limited to 'include/linux/cm3217.h')
| -rw-r--r-- | include/linux/cm3217.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/include/linux/cm3217.h b/include/linux/cm3217.h new file mode 100644 index 00000000000..29c72b58f8e --- /dev/null +++ b/include/linux/cm3217.h | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | /* include/linux/cm3217.h | ||
| 2 | * | ||
| 3 | * Copyright (C) 2011 Capella Microsystems Inc. | ||
| 4 | * Author: Frank Hsieh <pengyueh@gmail.com> | ||
| 5 | * | ||
| 6 | * This software is licensed under the terms of the GNU General Public | ||
| 7 | * License version 2, as published by the Free Software Foundation, and | ||
| 8 | * may be copied, distributed, and modified under those terms. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef __LINUX_CM3217_H | ||
| 18 | #define __LINUX_CM3217_H | ||
| 19 | |||
| 20 | #define CM3217_I2C_NAME "cm3217" | ||
| 21 | |||
| 22 | #define ALS_W_CMD1_addr (0x20 >> 1) | ||
| 23 | #define ALS_W_CMD2_addr (0x22 >> 1) | ||
| 24 | #define ALS_R_MSB_addr (0x21 >> 1) | ||
| 25 | #define ALS_R_LSB_addr (0x23 >> 1) | ||
| 26 | |||
| 27 | #define ALS_CALIBRATED 0x6E93 | ||
| 28 | |||
| 29 | /* cm3217 */ | ||
| 30 | |||
| 31 | /* for ALS command 20h */ | ||
| 32 | #define CM3217_ALS_BIT5_Default_1 (1 << 5) | ||
| 33 | #define CM3217_ALS_IT_HALF_T (0 << 2) | ||
| 34 | #define CM3217_ALS_IT_1_T (1 << 2) | ||
| 35 | #define CM3217_ALS_IT_2_T (2 << 2) | ||
| 36 | #define CM3217_ALS_IT_4_T (4 << 2) | ||
| 37 | #define CM3217_ALS_WDM_DEFAULT_1 (1 << 1) | ||
| 38 | #define CM3217_ALS_SD (1 << 0) | ||
| 39 | |||
| 40 | /* for ALS command 22h */ | ||
| 41 | #define CM3217_ALS_IT_800ms (0 << 5) | ||
| 42 | #define CM3217_ALS_IT_400ms (1 << 5) | ||
| 43 | #define CM3217_ALS_IT_266ms (2 << 5) | ||
| 44 | #define CM3217_ALS_IT_200ms (3 << 5) | ||
| 45 | #define CM3217_ALS_IT_130ms (4 << 5) | ||
| 46 | #define CM3217_ALS_IT_100ms (5 << 5) | ||
| 47 | #define CM3217_ALS_IT_80ms (6 << 5) | ||
| 48 | #define CM3217_ALS_IT_66ms (7 << 5) | ||
| 49 | |||
| 50 | struct cm3217_platform_data { | ||
| 51 | uint16_t levels[10]; | ||
| 52 | uint16_t golden_adc; | ||
| 53 | int (*power) (int, uint8_t); /* power to the chip */ | ||
| 54 | uint16_t ALS_slave_address; | ||
| 55 | }; | ||
| 56 | |||
| 57 | #define LS_PWR_ON (1 << 0) | ||
| 58 | |||
| 59 | #endif | ||
