![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0+ */ 0002 /* 0003 * Device driver for monitoring ambient light intensity (lux) 0004 * and proximity (prox) within the TAOS TSL2772 family of devices. 0005 * 0006 * Copyright (c) 2012, TAOS Corporation. 0007 * Copyright (c) 2017-2018 Brian Masney <masneyb@onstation.org> 0008 */ 0009 0010 #ifndef __TSL2772_H 0011 #define __TSL2772_H 0012 0013 struct tsl2772_lux { 0014 unsigned int ch0; 0015 unsigned int ch1; 0016 }; 0017 0018 /* Max number of segments allowable in LUX table */ 0019 #define TSL2772_MAX_LUX_TABLE_SIZE 6 0020 /* The default LUX tables all have 3 elements. */ 0021 #define TSL2772_DEF_LUX_TABLE_SZ 3 0022 #define TSL2772_DEFAULT_TABLE_BYTES (sizeof(struct tsl2772_lux) * \ 0023 TSL2772_DEF_LUX_TABLE_SZ) 0024 0025 /* Proximity diode to use */ 0026 #define TSL2772_DIODE0 0x01 0027 #define TSL2772_DIODE1 0x02 0028 #define TSL2772_DIODE_BOTH 0x03 0029 0030 /* LED Power */ 0031 #define TSL2772_100_mA 0x00 0032 #define TSL2772_50_mA 0x01 0033 #define TSL2772_25_mA 0x02 0034 #define TSL2772_13_mA 0x03 0035 0036 /** 0037 * struct tsl2772_settings - Settings for the tsl2772 driver 0038 * @als_time: Integration time of the ALS channel ADCs in 2.73 ms 0039 * increments. Total integration time is 0040 * (256 - als_time) * 2.73. 0041 * @als_gain: Index into the tsl2772_als_gain array. 0042 * @als_gain_trim: Default gain trim to account for aperture effects. 0043 * @wait_time: Time between proximity and ALS cycles in 2.73 0044 * periods. 0045 * @prox_time: Integration time of the proximity ADC in 2.73 ms 0046 * increments. Total integration time is 0047 * (256 - prx_time) * 2.73. 0048 * @prox_gain: Index into the tsl2772_prx_gain array. 0049 * @als_prox_config: The value of the ALS / Proximity configuration 0050 * register. 0051 * @als_cal_target: Known external ALS reading for calibration. 0052 * @als_persistence: H/W Filters, Number of 'out of limits' ALS readings. 0053 * @als_interrupt_en: Enable/Disable ALS interrupts 0054 * @als_thresh_low: CH0 'low' count to trigger interrupt. 0055 * @als_thresh_high: CH0 'high' count to trigger interrupt. 0056 * @prox_persistence: H/W Filters, Number of 'out of limits' proximity 0057 * readings. 0058 * @prox_interrupt_en: Enable/Disable proximity interrupts. 0059 * @prox_thres_low: Low threshold proximity detection. 0060 * @prox_thres_high: High threshold proximity detection. 0061 * @prox_pulse_count: Number if proximity emitter pulses. 0062 * @prox_max_samples_cal: The number of samples that are taken when performing 0063 * a proximity calibration. 0064 * @prox_diode Which diode(s) to use for driving the external 0065 * LED(s) for proximity sensing. 0066 * @prox_power The amount of power to use for the external LED(s). 0067 */ 0068 struct tsl2772_settings { 0069 int als_time; 0070 int als_gain; 0071 int als_gain_trim; 0072 int wait_time; 0073 int prox_time; 0074 int prox_gain; 0075 int als_prox_config; 0076 int als_cal_target; 0077 u8 als_persistence; 0078 bool als_interrupt_en; 0079 int als_thresh_low; 0080 int als_thresh_high; 0081 u8 prox_persistence; 0082 bool prox_interrupt_en; 0083 int prox_thres_low; 0084 int prox_thres_high; 0085 int prox_pulse_count; 0086 int prox_max_samples_cal; 0087 int prox_diode; 0088 int prox_power; 0089 }; 0090 0091 /** 0092 * struct tsl2772_platform_data - Platform callback, glass and defaults 0093 * @platform_lux_table: Device specific glass coefficents 0094 * @platform_default_settings: Device specific power on defaults 0095 */ 0096 struct tsl2772_platform_data { 0097 struct tsl2772_lux platform_lux_table[TSL2772_MAX_LUX_TABLE_SIZE]; 0098 struct tsl2772_settings *platform_default_settings; 0099 }; 0100 0101 #endif /* __TSL2772_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |