Source
x
MODULE_DESCRIPTION("Lite-On LTR501 ambient light and proximity sensor driver");
/*
* ltr501.c - Support for Lite-On LTR501 ambient light and proximity sensor
*
* Copyright 2014 Peter Meerwald <pmeerw@pmeerw.net>
*
* This file is subject to the terms and conditions of version 2 of
* the GNU General Public License. See the file COPYING in the main
* directory of this archive for more details.
*
* 7-bit I2C slave address 0x23
*
* TODO: IR LED characteristics
*/
/* ALS operation mode, SW reset */
/* PS operation mode */
/* measurement rate*/
/* ALS integ time, measurement rate*/
/* 16-bit, little endian */
/* 16-bit, little endian */
/* 16-bit, little endian */
/* output mode, polarity, mode */
/* 11 bit, ps upper threshold */
/* 11 bit, ps lower threshold */
/* 16 bit, ALS upper threshold */
/* 16 bit, ALS lower threshold */
/* ps thresh, als thresh */
static const int int_time_mapping[] = {100000, 50000, 200000, 400000};
static const struct reg_field reg_field_it =
REG_FIELD(LTR501_ALS_MEAS_RATE, 3, 4);
static const struct reg_field reg_field_als_intr =
REG_FIELD(LTR501_INTR, 1, 1);
static const struct reg_field reg_field_ps_intr =
REG_FIELD(LTR501_INTR, 0, 0);
static const struct reg_field reg_field_als_rate =
REG_FIELD(LTR501_ALS_MEAS_RATE, 0, 2);
static const struct reg_field reg_field_ps_rate =
REG_FIELD(LTR501_PS_MEAS_RATE, 0, 3);
static const struct reg_field reg_field_als_prst =
REG_FIELD(LTR501_INTR_PRST, 0, 3);
static const struct reg_field reg_field_ps_prst =
REG_FIELD(LTR501_INTR_PRST, 4, 7);
struct ltr501_samp_table {
int freq_val; /* repetition frequency in micro HZ*/
int time_val; /* repetition rate in micro seconds */
};