root/include/linux/platform_data/tsl2772.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   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 */

/* [<][>][^][v][top][bottom][index][help] */