diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/iio/adc/ad_sigma_delta.h | 24 | ||||
| -rw-r--r-- | include/linux/iio/adc/stm32-dfsdm-adc.h | 2 | ||||
| -rw-r--r-- | include/linux/iio/common/cros_ec_sensors_core.h | 180 | ||||
| -rw-r--r-- | include/linux/iio/iio.h | 24 | ||||
| -rw-r--r-- | include/linux/kernel.h | 16 | ||||
| -rw-r--r-- | include/linux/platform_data/tsl2772.h | 101 |
6 files changed, 328 insertions, 19 deletions
diff --git a/include/linux/iio/adc/ad_sigma_delta.h b/include/linux/iio/adc/ad_sigma_delta.h index 1fc7abd28b0b..730ead1a46df 100644 --- a/include/linux/iio/adc/ad_sigma_delta.h +++ b/include/linux/iio/adc/ad_sigma_delta.h | |||
| @@ -127,7 +127,7 @@ void ad_sd_cleanup_buffer_and_trigger(struct iio_dev *indio_dev); | |||
| 127 | int ad_sd_validate_trigger(struct iio_dev *indio_dev, struct iio_trigger *trig); | 127 | int ad_sd_validate_trigger(struct iio_dev *indio_dev, struct iio_trigger *trig); |
| 128 | 128 | ||
| 129 | #define __AD_SD_CHANNEL(_si, _channel1, _channel2, _address, _bits, \ | 129 | #define __AD_SD_CHANNEL(_si, _channel1, _channel2, _address, _bits, \ |
| 130 | _storagebits, _shift, _extend_name, _type) \ | 130 | _storagebits, _shift, _extend_name, _type, _mask_all) \ |
| 131 | { \ | 131 | { \ |
| 132 | .type = (_type), \ | 132 | .type = (_type), \ |
| 133 | .differential = (_channel2 == -1 ? 0 : 1), \ | 133 | .differential = (_channel2 == -1 ? 0 : 1), \ |
| @@ -139,7 +139,7 @@ int ad_sd_validate_trigger(struct iio_dev *indio_dev, struct iio_trigger *trig); | |||
| 139 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ | 139 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
| 140 | BIT(IIO_CHAN_INFO_OFFSET), \ | 140 | BIT(IIO_CHAN_INFO_OFFSET), \ |
| 141 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ | 141 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ |
| 142 | .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ | 142 | .info_mask_shared_by_all = _mask_all, \ |
| 143 | .scan_index = (_si), \ | 143 | .scan_index = (_si), \ |
| 144 | .scan_type = { \ | 144 | .scan_type = { \ |
| 145 | .sign = 'u', \ | 145 | .sign = 'u', \ |
| @@ -153,25 +153,35 @@ int ad_sd_validate_trigger(struct iio_dev *indio_dev, struct iio_trigger *trig); | |||
| 153 | #define AD_SD_DIFF_CHANNEL(_si, _channel1, _channel2, _address, _bits, \ | 153 | #define AD_SD_DIFF_CHANNEL(_si, _channel1, _channel2, _address, _bits, \ |
| 154 | _storagebits, _shift) \ | 154 | _storagebits, _shift) \ |
| 155 | __AD_SD_CHANNEL(_si, _channel1, _channel2, _address, _bits, \ | 155 | __AD_SD_CHANNEL(_si, _channel1, _channel2, _address, _bits, \ |
| 156 | _storagebits, _shift, NULL, IIO_VOLTAGE) | 156 | _storagebits, _shift, NULL, IIO_VOLTAGE, \ |
| 157 | BIT(IIO_CHAN_INFO_SAMP_FREQ)) | ||
| 157 | 158 | ||
| 158 | #define AD_SD_SHORTED_CHANNEL(_si, _channel, _address, _bits, \ | 159 | #define AD_SD_SHORTED_CHANNEL(_si, _channel, _address, _bits, \ |
| 159 | _storagebits, _shift) \ | 160 | _storagebits, _shift) \ |
| 160 | __AD_SD_CHANNEL(_si, _channel, _channel, _address, _bits, \ | 161 | __AD_SD_CHANNEL(_si, _channel, _channel, _address, _bits, \ |
| 161 | _storagebits, _shift, "shorted", IIO_VOLTAGE) | 162 | _storagebits, _shift, "shorted", IIO_VOLTAGE, \ |
| 163 | BIT(IIO_CHAN_INFO_SAMP_FREQ)) | ||
| 162 | 164 | ||
| 163 | #define AD_SD_CHANNEL(_si, _channel, _address, _bits, \ | 165 | #define AD_SD_CHANNEL(_si, _channel, _address, _bits, \ |
| 164 | _storagebits, _shift) \ | 166 | _storagebits, _shift) \ |
| 165 | __AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \ | 167 | __AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \ |
| 166 | _storagebits, _shift, NULL, IIO_VOLTAGE) | 168 | _storagebits, _shift, NULL, IIO_VOLTAGE, \ |
| 169 | BIT(IIO_CHAN_INFO_SAMP_FREQ)) | ||
| 170 | |||
| 171 | #define AD_SD_CHANNEL_NO_SAMP_FREQ(_si, _channel, _address, _bits, \ | ||
| 172 | _storagebits, _shift) \ | ||
| 173 | __AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \ | ||
| 174 | _storagebits, _shift, NULL, IIO_VOLTAGE, 0) | ||
| 167 | 175 | ||
| 168 | #define AD_SD_TEMP_CHANNEL(_si, _address, _bits, _storagebits, _shift) \ | 176 | #define AD_SD_TEMP_CHANNEL(_si, _address, _bits, _storagebits, _shift) \ |
| 169 | __AD_SD_CHANNEL(_si, 0, -1, _address, _bits, \ | 177 | __AD_SD_CHANNEL(_si, 0, -1, _address, _bits, \ |
| 170 | _storagebits, _shift, NULL, IIO_TEMP) | 178 | _storagebits, _shift, NULL, IIO_TEMP, \ |
| 179 | BIT(IIO_CHAN_INFO_SAMP_FREQ)) | ||
| 171 | 180 | ||
| 172 | #define AD_SD_SUPPLY_CHANNEL(_si, _channel, _address, _bits, _storagebits, \ | 181 | #define AD_SD_SUPPLY_CHANNEL(_si, _channel, _address, _bits, _storagebits, \ |
| 173 | _shift) \ | 182 | _shift) \ |
| 174 | __AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \ | 183 | __AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \ |
| 175 | _storagebits, _shift, "supply", IIO_VOLTAGE) | 184 | _storagebits, _shift, "supply", IIO_VOLTAGE, \ |
| 185 | BIT(IIO_CHAN_INFO_SAMP_FREQ)) | ||
| 176 | 186 | ||
| 177 | #endif | 187 | #endif |
diff --git a/include/linux/iio/adc/stm32-dfsdm-adc.h b/include/linux/iio/adc/stm32-dfsdm-adc.h index e7dc7a542a4e..0da298b41737 100644 --- a/include/linux/iio/adc/stm32-dfsdm-adc.h +++ b/include/linux/iio/adc/stm32-dfsdm-adc.h | |||
| @@ -9,6 +9,8 @@ | |||
| 9 | #ifndef STM32_DFSDM_ADC_H | 9 | #ifndef STM32_DFSDM_ADC_H |
| 10 | #define STM32_DFSDM_ADC_H | 10 | #define STM32_DFSDM_ADC_H |
| 11 | 11 | ||
| 12 | #include <linux/iio/iio.h> | ||
| 13 | |||
| 12 | int stm32_dfsdm_get_buff_cb(struct iio_dev *iio_dev, | 14 | int stm32_dfsdm_get_buff_cb(struct iio_dev *iio_dev, |
| 13 | int (*cb)(const void *data, size_t size, | 15 | int (*cb)(const void *data, size_t size, |
| 14 | void *private), | 16 | void *private), |
diff --git a/include/linux/iio/common/cros_ec_sensors_core.h b/include/linux/iio/common/cros_ec_sensors_core.h new file mode 100644 index 000000000000..ce16445411ac --- /dev/null +++ b/include/linux/iio/common/cros_ec_sensors_core.h | |||
| @@ -0,0 +1,180 @@ | |||
| 1 | /* | ||
| 2 | * ChromeOS EC sensor hub | ||
| 3 | * | ||
| 4 | * Copyright (C) 2016 Google, Inc | ||
| 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 | #ifndef __CROS_EC_SENSORS_CORE_H | ||
| 17 | #define __CROS_EC_SENSORS_CORE_H | ||
| 18 | |||
| 19 | #include <linux/iio/iio.h> | ||
| 20 | #include <linux/irqreturn.h> | ||
| 21 | #include <linux/mfd/cros_ec.h> | ||
| 22 | |||
| 23 | enum { | ||
| 24 | CROS_EC_SENSOR_X, | ||
| 25 | CROS_EC_SENSOR_Y, | ||
| 26 | CROS_EC_SENSOR_Z, | ||
| 27 | CROS_EC_SENSOR_MAX_AXIS, | ||
| 28 | }; | ||
| 29 | |||
| 30 | /* EC returns sensor values using signed 16 bit registers */ | ||
| 31 | #define CROS_EC_SENSOR_BITS 16 | ||
| 32 | |||
| 33 | /* | ||
| 34 | * 4 16 bit channels are allowed. | ||
| 35 | * Good enough for current sensors, they use up to 3 16 bit vectors. | ||
| 36 | */ | ||
| 37 | #define CROS_EC_SAMPLE_SIZE (sizeof(s64) * 2) | ||
| 38 | |||
| 39 | /* Minimum sampling period to use when device is suspending */ | ||
| 40 | #define CROS_EC_MIN_SUSPEND_SAMPLING_FREQUENCY 1000 /* 1 second */ | ||
| 41 | |||
| 42 | /** | ||
| 43 | * struct cros_ec_sensors_core_state - state data for EC sensors IIO driver | ||
| 44 | * @ec: cros EC device structure | ||
| 45 | * @cmd_lock: lock used to prevent simultaneous access to the | ||
| 46 | * commands. | ||
| 47 | * @msg: cros EC command structure | ||
| 48 | * @param: motion sensor parameters structure | ||
| 49 | * @resp: motion sensor response structure | ||
| 50 | * @type: type of motion sensor | ||
| 51 | * @loc: location where the motion sensor is placed | ||
| 52 | * @calib: calibration parameters. Note that trigger | ||
| 53 | * captured data will always provide the calibrated | ||
| 54 | * data | ||
| 55 | * @samples: static array to hold data from a single capture. | ||
| 56 | * For each channel we need 2 bytes, except for | ||
| 57 | * the timestamp. The timestamp is always last and | ||
| 58 | * is always 8-byte aligned. | ||
| 59 | * @read_ec_sensors_data: function used for accessing sensors values | ||
| 60 | * @cuur_sampl_freq: current sampling period | ||
| 61 | */ | ||
| 62 | struct cros_ec_sensors_core_state { | ||
| 63 | struct cros_ec_device *ec; | ||
| 64 | struct mutex cmd_lock; | ||
| 65 | |||
| 66 | struct cros_ec_command *msg; | ||
| 67 | struct ec_params_motion_sense param; | ||
| 68 | struct ec_response_motion_sense *resp; | ||
| 69 | |||
| 70 | enum motionsensor_type type; | ||
| 71 | enum motionsensor_location loc; | ||
| 72 | |||
| 73 | s16 calib[CROS_EC_SENSOR_MAX_AXIS]; | ||
| 74 | |||
| 75 | u8 samples[CROS_EC_SAMPLE_SIZE]; | ||
| 76 | |||
| 77 | int (*read_ec_sensors_data)(struct iio_dev *indio_dev, | ||
| 78 | unsigned long scan_mask, s16 *data); | ||
| 79 | |||
| 80 | int curr_sampl_freq; | ||
| 81 | }; | ||
| 82 | |||
| 83 | /** | ||
| 84 | * cros_ec_sensors_read_lpc() - retrieve data from EC shared memory | ||
| 85 | * @indio_dev: pointer to IIO device | ||
| 86 | * @scan_mask: bitmap of the sensor indices to scan | ||
| 87 | * @data: location to store data | ||
| 88 | * | ||
| 89 | * This is the safe function for reading the EC data. It guarantees that the | ||
| 90 | * data sampled was not modified by the EC while being read. | ||
| 91 | * | ||
| 92 | * Return: 0 on success, -errno on failure. | ||
| 93 | */ | ||
| 94 | int cros_ec_sensors_read_lpc(struct iio_dev *indio_dev, unsigned long scan_mask, | ||
| 95 | s16 *data); | ||
| 96 | |||
| 97 | /** | ||
| 98 | * cros_ec_sensors_read_cmd() - retrieve data using the EC command protocol | ||
| 99 | * @indio_dev: pointer to IIO device | ||
| 100 | * @scan_mask: bitmap of the sensor indices to scan | ||
| 101 | * @data: location to store data | ||
| 102 | * | ||
| 103 | * Return: 0 on success, -errno on failure. | ||
| 104 | */ | ||
| 105 | int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev, unsigned long scan_mask, | ||
| 106 | s16 *data); | ||
| 107 | |||
| 108 | struct platform_device; | ||
| 109 | /** | ||
| 110 | * cros_ec_sensors_core_init() - basic initialization of the core structure | ||
| 111 | * @pdev: platform device created for the sensors | ||
| 112 | * @indio_dev: iio device structure of the device | ||
| 113 | * @physical_device: true if the device refers to a physical device | ||
| 114 | * | ||
| 115 | * Return: 0 on success, -errno on failure. | ||
| 116 | */ | ||
| 117 | int cros_ec_sensors_core_init(struct platform_device *pdev, | ||
| 118 | struct iio_dev *indio_dev, bool physical_device); | ||
| 119 | |||
| 120 | /** | ||
| 121 | * cros_ec_sensors_capture() - the trigger handler function | ||
| 122 | * @irq: the interrupt number. | ||
| 123 | * @p: a pointer to the poll function. | ||
| 124 | * | ||
| 125 | * On a trigger event occurring, if the pollfunc is attached then this | ||
| 126 | * handler is called as a threaded interrupt (and hence may sleep). It | ||
| 127 | * is responsible for grabbing data from the device and pushing it into | ||
| 128 | * the associated buffer. | ||
| 129 | * | ||
| 130 | * Return: IRQ_HANDLED | ||
| 131 | */ | ||
| 132 | irqreturn_t cros_ec_sensors_capture(int irq, void *p); | ||
| 133 | |||
| 134 | /** | ||
| 135 | * cros_ec_motion_send_host_cmd() - send motion sense host command | ||
| 136 | * @st: pointer to state information for device | ||
| 137 | * @opt_length: optional length to reduce the response size, useful on the data | ||
| 138 | * path. Otherwise, the maximal allowed response size is used | ||
| 139 | * | ||
| 140 | * When called, the sub-command is assumed to be set in param->cmd. | ||
| 141 | * | ||
| 142 | * Return: 0 on success, -errno on failure. | ||
| 143 | */ | ||
| 144 | int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *st, | ||
| 145 | u16 opt_length); | ||
| 146 | |||
| 147 | /** | ||
| 148 | * cros_ec_sensors_core_read() - function to request a value from the sensor | ||
| 149 | * @st: pointer to state information for device | ||
| 150 | * @chan: channel specification structure table | ||
| 151 | * @val: will contain one element making up the returned value | ||
| 152 | * @val2: will contain another element making up the returned value | ||
| 153 | * @mask: specifies which values to be requested | ||
| 154 | * | ||
| 155 | * Return: the type of value returned by the device | ||
| 156 | */ | ||
| 157 | int cros_ec_sensors_core_read(struct cros_ec_sensors_core_state *st, | ||
| 158 | struct iio_chan_spec const *chan, | ||
| 159 | int *val, int *val2, long mask); | ||
| 160 | |||
| 161 | /** | ||
| 162 | * cros_ec_sensors_core_write() - function to write a value to the sensor | ||
| 163 | * @st: pointer to state information for device | ||
| 164 | * @chan: channel specification structure table | ||
| 165 | * @val: first part of value to write | ||
| 166 | * @val2: second part of value to write | ||
| 167 | * @mask: specifies which values to write | ||
| 168 | * | ||
| 169 | * Return: the type of value returned by the device | ||
| 170 | */ | ||
| 171 | int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st, | ||
| 172 | struct iio_chan_spec const *chan, | ||
| 173 | int val, int val2, long mask); | ||
| 174 | |||
| 175 | extern const struct dev_pm_ops cros_ec_sensors_pm_ops; | ||
| 176 | |||
| 177 | /* List of extended channel specification for all sensors */ | ||
| 178 | extern const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[]; | ||
| 179 | |||
| 180 | #endif /* __CROS_EC_SENSORS_CORE_H */ | ||
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 11579fd4126e..a74cb177dc6f 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h | |||
| @@ -183,18 +183,18 @@ struct iio_event_spec { | |||
| 183 | * @address: Driver specific identifier. | 183 | * @address: Driver specific identifier. |
| 184 | * @scan_index: Monotonic index to give ordering in scans when read | 184 | * @scan_index: Monotonic index to give ordering in scans when read |
| 185 | * from a buffer. | 185 | * from a buffer. |
| 186 | * @scan_type: sign: 's' or 'u' to specify signed or unsigned | 186 | * @scan_type: struct describing the scan type |
| 187 | * realbits: Number of valid bits of data | 187 | * @scan_type.sign: 's' or 'u' to specify signed or unsigned |
| 188 | * storagebits: Realbits + padding | 188 | * @scan_type.realbits: Number of valid bits of data |
| 189 | * shift: Shift right by this before masking out | 189 | * @scan_type.storagebits: Realbits + padding |
| 190 | * realbits. | 190 | * @scan_type.shift: Shift right by this before masking out |
| 191 | * repeat: Number of times real/storage bits | 191 | * realbits. |
| 192 | * repeats. When the repeat element is | 192 | * @scan_type.repeat: Number of times real/storage bits repeats. |
| 193 | * more than 1, then the type element in | 193 | * When the repeat element is more than 1, then |
| 194 | * sysfs will show a repeat value. | 194 | * the type element in sysfs will show a repeat |
| 195 | * Otherwise, the number of repetitions is | 195 | * value. Otherwise, the number of repetitions |
| 196 | * omitted. | 196 | * is omitted. |
| 197 | * endianness: little or big endian | 197 | * @scan_type.endianness: little or big endian |
| 198 | * @info_mask_separate: What information is to be exported that is specific to | 198 | * @info_mask_separate: What information is to be exported that is specific to |
| 199 | * this channel. | 199 | * this channel. |
| 200 | * @info_mask_separate_available: What availability information is to be | 200 | * @info_mask_separate_available: What availability information is to be |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 7c4e8f1f72d8..d23123238534 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -966,6 +966,22 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } | |||
| 966 | "pointer type mismatch in container_of()"); \ | 966 | "pointer type mismatch in container_of()"); \ |
| 967 | ((type *)(__mptr - offsetof(type, member))); }) | 967 | ((type *)(__mptr - offsetof(type, member))); }) |
| 968 | 968 | ||
| 969 | /** | ||
| 970 | * container_of_safe - cast a member of a structure out to the containing structure | ||
| 971 | * @ptr: the pointer to the member. | ||
| 972 | * @type: the type of the container struct this is embedded in. | ||
| 973 | * @member: the name of the member within the struct. | ||
| 974 | * | ||
| 975 | * If IS_ERR_OR_NULL(ptr), ptr is returned unchanged. | ||
| 976 | */ | ||
| 977 | #define container_of_safe(ptr, type, member) ({ \ | ||
| 978 | void *__mptr = (void *)(ptr); \ | ||
| 979 | BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | ||
| 980 | !__same_type(*(ptr), void), \ | ||
| 981 | "pointer type mismatch in container_of()"); \ | ||
| 982 | IS_ERR_OR_NULL(__mptr) ? ERR_CAST(__mptr) : \ | ||
| 983 | ((type *)(__mptr - offsetof(type, member))); }) | ||
| 984 | |||
| 969 | /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ | 985 | /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ |
| 970 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 986 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
| 971 | # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD | 987 | # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD |
diff --git a/include/linux/platform_data/tsl2772.h b/include/linux/platform_data/tsl2772.h new file mode 100644 index 000000000000..f8ade15a35e2 --- /dev/null +++ b/include/linux/platform_data/tsl2772.h | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
| 2 | /* | ||
| 3 | * Device driver for monitoring ambient light intensity (lux) | ||
| 4 | * and proximity (prox) within the TAOS TSL2772 family of devices. | ||
| 5 | * | ||
| 6 | * Copyright (c) 2012, TAOS Corporation. | ||
| 7 | * Copyright (c) 2017-2018 Brian Masney <masneyb@onstation.org> | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef __TSL2772_H | ||
| 11 | #define __TSL2772_H | ||
| 12 | |||
| 13 | struct tsl2772_lux { | ||
| 14 | unsigned int ch0; | ||
| 15 | unsigned int ch1; | ||
| 16 | }; | ||
| 17 | |||
| 18 | /* Max number of segments allowable in LUX table */ | ||
| 19 | #define TSL2772_MAX_LUX_TABLE_SIZE 6 | ||
| 20 | /* The default LUX tables all have 3 elements. */ | ||
| 21 | #define TSL2772_DEF_LUX_TABLE_SZ 3 | ||
| 22 | #define TSL2772_DEFAULT_TABLE_BYTES (sizeof(struct tsl2772_lux) * \ | ||
| 23 | TSL2772_DEF_LUX_TABLE_SZ) | ||
| 24 | |||
| 25 | /* Proximity diode to use */ | ||
| 26 | #define TSL2772_DIODE0 0x01 | ||
| 27 | #define TSL2772_DIODE1 0x02 | ||
| 28 | #define TSL2772_DIODE_BOTH 0x03 | ||
| 29 | |||
| 30 | /* LED Power */ | ||
| 31 | #define TSL2772_100_mA 0x00 | ||
| 32 | #define TSL2772_50_mA 0x01 | ||
| 33 | #define TSL2772_25_mA 0x02 | ||
| 34 | #define TSL2772_13_mA 0x03 | ||
| 35 | |||
| 36 | /** | ||
| 37 | * struct tsl2772_settings - Settings for the tsl2772 driver | ||
| 38 | * @als_time: Integration time of the ALS channel ADCs in 2.73 ms | ||
| 39 | * increments. Total integration time is | ||
| 40 | * (256 - als_time) * 2.73. | ||
| 41 | * @als_gain: Index into the tsl2772_als_gain array. | ||
| 42 | * @als_gain_trim: Default gain trim to account for aperture effects. | ||
| 43 | * @wait_time: Time between proximity and ALS cycles in 2.73 | ||
| 44 | * periods. | ||
| 45 | * @prox_time: Integration time of the proximity ADC in 2.73 ms | ||
| 46 | * increments. Total integration time is | ||
| 47 | * (256 - prx_time) * 2.73. | ||
| 48 | * @prox_gain: Index into the tsl2772_prx_gain array. | ||
| 49 | * @als_prox_config: The value of the ALS / Proximity configuration | ||
| 50 | * register. | ||
| 51 | * @als_cal_target: Known external ALS reading for calibration. | ||
| 52 | * @als_persistence: H/W Filters, Number of 'out of limits' ALS readings. | ||
| 53 | * @als_interrupt_en: Enable/Disable ALS interrupts | ||
| 54 | * @als_thresh_low: CH0 'low' count to trigger interrupt. | ||
| 55 | * @als_thresh_high: CH0 'high' count to trigger interrupt. | ||
| 56 | * @prox_persistence: H/W Filters, Number of 'out of limits' proximity | ||
| 57 | * readings. | ||
| 58 | * @prox_interrupt_en: Enable/Disable proximity interrupts. | ||
| 59 | * @prox_thres_low: Low threshold proximity detection. | ||
| 60 | * @prox_thres_high: High threshold proximity detection. | ||
| 61 | * @prox_pulse_count: Number if proximity emitter pulses. | ||
| 62 | * @prox_max_samples_cal: The number of samples that are taken when performing | ||
| 63 | * a proximity calibration. | ||
| 64 | * @prox_diode Which diode(s) to use for driving the external | ||
| 65 | * LED(s) for proximity sensing. | ||
| 66 | * @prox_power The amount of power to use for the external LED(s). | ||
| 67 | */ | ||
| 68 | struct tsl2772_settings { | ||
| 69 | int als_time; | ||
| 70 | int als_gain; | ||
| 71 | int als_gain_trim; | ||
| 72 | int wait_time; | ||
| 73 | int prox_time; | ||
| 74 | int prox_gain; | ||
| 75 | int als_prox_config; | ||
| 76 | int als_cal_target; | ||
| 77 | u8 als_persistence; | ||
| 78 | bool als_interrupt_en; | ||
| 79 | int als_thresh_low; | ||
| 80 | int als_thresh_high; | ||
| 81 | u8 prox_persistence; | ||
| 82 | bool prox_interrupt_en; | ||
| 83 | int prox_thres_low; | ||
| 84 | int prox_thres_high; | ||
| 85 | int prox_pulse_count; | ||
| 86 | int prox_max_samples_cal; | ||
| 87 | int prox_diode; | ||
| 88 | int prox_power; | ||
| 89 | }; | ||
| 90 | |||
| 91 | /** | ||
| 92 | * struct tsl2772_platform_data - Platform callback, glass and defaults | ||
| 93 | * @platform_lux_table: Device specific glass coefficents | ||
| 94 | * @platform_default_settings: Device specific power on defaults | ||
| 95 | */ | ||
| 96 | struct tsl2772_platform_data { | ||
| 97 | struct tsl2772_lux platform_lux_table[TSL2772_MAX_LUX_TABLE_SIZE]; | ||
| 98 | struct tsl2772_settings *platform_default_settings; | ||
| 99 | }; | ||
| 100 | |||
| 101 | #endif /* __TSL2772_H */ | ||
