Commit 3c97c08b authored by Jon Brenner's avatar Jon Brenner Committed by Greg Kroah-Hartman

staging: iio: add TAOS tsl2x7x driver

TAOS device driver (version 9) for the tsl/tmd 2771 and 2772 device families (inc. all variants).

Update:
Removed bonus lines.
Signed-off-by: default avatarJon Brenner <jbrenner@taosinc.com>
Acked-by: Jonathan Cameron<jic23@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e17b8e48
What: /sys/bus/iio/devices/device[n]/in_illuminance0_calibrate
KernelVersion: 2.6.37
Contact: linux-iio@vger.kernel.org
Description:
This property causes an internal calibration of the als gain trim
value which is later used in calculating illuminance in lux.
What: /sys/bus/iio/devices/device[n]/in_illuminance0_calibrate
KernelVersion: 3.3-rc1
Contact: linux-iio@vger.kernel.org
Description:
Causes an internal calibration of the als gain trim
value which is later used in calculating illuminance in lux.
What: /sys/bus/iio/devices/device[n]/in_proximity0_calibrate
KernelVersion: 3.3-rc1
Contact: linux-iio@vger.kernel.org
Description:
Causes a recalculation and adjustment to the
proximity_thresh_rising_value.
...@@ -243,6 +243,8 @@ What: /sys/bus/iio/devices/iio:deviceX/in_accel_z_calibbias ...@@ -243,6 +243,8 @@ What: /sys/bus/iio/devices/iio:deviceX/in_accel_z_calibbias
What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_x_calibbias What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_x_calibbias
What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_y_calibbias What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_y_calibbias
What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_z_calibbias What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_z_calibbias
What: /sys/bus/iio/devices/iio:deviceX/in_illuminance0_calibbias
What: /sys/bus/iio/devices/iio:deviceX/in_proximity0_calibbias
KernelVersion: 2.6.35 KernelVersion: 2.6.35
Contact: linux-iio@vger.kernel.org Contact: linux-iio@vger.kernel.org
Description: Description:
...@@ -258,6 +260,8 @@ What /sys/bus/iio/devices/iio:deviceX/in_accel_z_calibscale ...@@ -258,6 +260,8 @@ What /sys/bus/iio/devices/iio:deviceX/in_accel_z_calibscale
What /sys/bus/iio/devices/iio:deviceX/in_anglvel_x_calibscale What /sys/bus/iio/devices/iio:deviceX/in_anglvel_x_calibscale
What /sys/bus/iio/devices/iio:deviceX/in_anglvel_y_calibscale What /sys/bus/iio/devices/iio:deviceX/in_anglvel_y_calibscale
What /sys/bus/iio/devices/iio:deviceX/in_anglvel_z_calibscale What /sys/bus/iio/devices/iio:deviceX/in_anglvel_z_calibscale
what /sys/bus/iio/devices/iio:deviceX/in_illuminance0_calibscale
what /sys/bus/iio/devices/iio:deviceX/in_proximity0_calibscale
KernelVersion: 2.6.35 KernelVersion: 2.6.35
Contact: linux-iio@vger.kernel.org Contact: linux-iio@vger.kernel.org
Description: Description:
...@@ -457,6 +461,10 @@ What: /sys/.../events/in_voltageY_raw_thresh_rising_value ...@@ -457,6 +461,10 @@ What: /sys/.../events/in_voltageY_raw_thresh_rising_value
What: /sys/.../events/in_voltageY_raw_thresh_falling_value What: /sys/.../events/in_voltageY_raw_thresh_falling_value
What: /sys/.../events/in_tempY_raw_thresh_rising_value What: /sys/.../events/in_tempY_raw_thresh_rising_value
What: /sys/.../events/in_tempY_raw_thresh_falling_value What: /sys/.../events/in_tempY_raw_thresh_falling_value
What: /sys/.../events/in_illuminance0_thresh_falling_value
what: /sys/.../events/in_illuminance0_thresh_rising_value
what: /sys/.../events/in_proximity0_thresh_falling_value
what: /sys/.../events/in_proximity0_thresh_rising_value
KernelVersion: 2.6.37 KernelVersion: 2.6.37
Contact: linux-iio@vger.kernel.org Contact: linux-iio@vger.kernel.org
Description: Description:
...@@ -556,6 +564,8 @@ What: /sys/.../events/in_tempY_thresh_falling_period ...@@ -556,6 +564,8 @@ What: /sys/.../events/in_tempY_thresh_falling_period
What: /sys/.../events/in_tempY_roc_rising_period What: /sys/.../events/in_tempY_roc_rising_period
What: /sys/.../events/in_tempY_roc_falling_period What: /sys/.../events/in_tempY_roc_falling_period
What: /sys/.../events/in_accel_x&y&z_mag_falling_period What: /sys/.../events/in_accel_x&y&z_mag_falling_period
What: /sys/.../events/in_intensity0_thresh_period
What: /sys/.../events/in_proximity0_thresh_period
KernelVersion: 2.6.37 KernelVersion: 2.6.37
Contact: linux-iio@vger.kernel.org Contact: linux-iio@vger.kernel.org
Description: Description:
......
...@@ -26,7 +26,7 @@ Description: ...@@ -26,7 +26,7 @@ Description:
Hardware dependent list of possible values supported for the Hardware dependent list of possible values supported for the
adc_resolution of the given sensor. adc_resolution of the given sensor.
What: /sys/bus/iio/devices/device[n]/illuminance0[_input|_raw] What: /sys/bus/iio/devices/device[n]/in_illuminance0[_input|_raw]
KernelVersion: 2.6.35 KernelVersion: 2.6.35
Contact: linux-iio@vger.kernel.org Contact: linux-iio@vger.kernel.org
Description: Description:
...@@ -45,7 +45,7 @@ Description: ...@@ -45,7 +45,7 @@ Description:
do this calculation manually by reading the infrared sensor do this calculation manually by reading the infrared sensor
value and doing the negation in sw. value and doing the negation in sw.
What: /sys/bus/iio/devices/device[n]/proximity[_input|_raw] What: /sys/bus/iio/devices/device[n]/in_proximity[_input|_raw]
KernelVersion: 2.6.37 KernelVersion: 2.6.37
Contact: linux-iio@vger.kernel.org Contact: linux-iio@vger.kernel.org
Description: Description:
...@@ -63,23 +63,22 @@ Description: ...@@ -63,23 +63,22 @@ Description:
and if expressed in SI units, should include _input. If this and if expressed in SI units, should include _input. If this
value is not in SI units, then it should include _raw. value is not in SI units, then it should include _raw.
What: /sys/bus/iio/devices/device[n]/illuminance0_target What: /sys/bus/iio/devices/device[n]/in_illuminance0_target
KernelVersion: 2.6.37 KernelVersion: 2.6.37
Contact: linux-iio@vger.kernel.org Contact: linux-iio@vger.kernel.org
Description: Description:
This property gets/sets the last known external This property gets/sets the last known external
lux measurement used in/for calibration. lux measurement used in/for calibration.
What: /sys/bus/iio/devices/device[n]/illuminance0_integration_time What: /sys/bus/iio/devices/device[n]/in_illuminance0_integration_time
KernelVersion: 2.6.37 KernelVersion: 2.6.37
Contact: linux-iio@vger.kernel.org Contact: linux-iio@vger.kernel.org
Description: Description:
This property gets/sets the sensors ADC analog integration time. This property gets/sets the sensors ADC analog integration time.
What: /sys/bus/iio/devices/device[n]/illuminance0_calibscale What: /sys/bus/iio/devices/device[n]/in_illuminance0_lux_table
KernelVersion: 2.6.37 KernelVersion: 2.6.37
Contact: linux-iio@vger.kernel.org Contact: linux-iio@vger.kernel.org
Description: Description:
Hardware or software applied calibration scale factor assumed This property gets/sets the table of coefficients
to account for attenuation due to industrial design (glass used in calculating illuminance in lux.
filters or aperture holes).
...@@ -42,4 +42,12 @@ config TSL2583 ...@@ -42,4 +42,12 @@ config TSL2583
Provides support for the TAOS tsl2580, tsl2581 and tsl2583 devices. Provides support for the TAOS tsl2580, tsl2581 and tsl2583 devices.
Access ALS data via iio, sysfs. Access ALS data via iio, sysfs.
config TSL2x7x
tristate "TAOS TSL/TMD2x71 and TSL/TMD2x72 Family of light and proximity sensors"
depends on I2C
help
Support for: tsl2571, tsl2671, tmd2671, tsl2771, tmd2771, tsl2572, tsl2672,
tmd2672, tsl2772, tmd2772 devices.
Provides iio_events and direct access via sysfs.
endmenu endmenu
...@@ -6,3 +6,4 @@ obj-$(CONFIG_SENSORS_TSL2563) += tsl2563.o ...@@ -6,3 +6,4 @@ obj-$(CONFIG_SENSORS_TSL2563) += tsl2563.o
obj-$(CONFIG_SENSORS_ISL29018) += isl29018.o obj-$(CONFIG_SENSORS_ISL29018) += isl29018.o
obj-$(CONFIG_SENSORS_ISL29028) += isl29028.o obj-$(CONFIG_SENSORS_ISL29028) += isl29028.o
obj-$(CONFIG_TSL2583) += tsl2583.o obj-$(CONFIG_TSL2583) += tsl2583.o
obj-$(CONFIG_TSL2x7x) += tsl2x7x_core.o
/*
* Device driver for monitoring ambient light intensity (lux)
* and proximity (prox) within the TAOS TSL2X7X family of devices.
*
* Copyright (c) 2012, TAOS Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __TSL2X7X_H
#define __TSL2X7X_H
#include <linux/pm.h>
/* Max number of segments allowable in LUX table */
#define TSL2X7X_MAX_LUX_TABLE_SIZE 9
#define MAX_DEFAULT_TABLE_BYTES (sizeof(int) * TSL2X7X_MAX_LUX_TABLE_SIZE)
struct iio_dev;
struct tsl2x7x_lux {
unsigned int ratio;
unsigned int ch0;
unsigned int ch1;
};
/**
* struct tsl2x7x_default_settings - power on defaults unless
* overridden by platform data.
* @als_time: ALS Integration time - multiple of 50mS
* @als_gain: Index into the ALS gain table.
* @als_gain_trim: default gain trim to account for
* aperture effects.
* @wait_time: Time between PRX and ALS cycles
* in 2.7 periods
* @prx_time: 5.2ms prox integration time -
* decrease in 2.7ms periods
* @prx_gain: Proximity gain index
* @prox_config: Prox configuration filters.
* @als_cal_target: Known external ALS reading for
* calibration.
* @interrupts_en: Enable/Disable - 0x00 = none, 0x10 = als,
* 0x20 = prx, 0x30 = bth
* @persistence: H/W Filters, Number of 'out of limits'
* ADC readings PRX/ALS.
* @als_thresh_low: CH0 'low' count to trigger interrupt.
* @als_thresh_high: CH0 'high' count to trigger interrupt.
* @prox_thres_low: Low threshold proximity detection.
* @prox_thres_high: High threshold proximity detection
* @prox_pulse_count: Number if proximity emitter pulses
* @prox_max_samples_cal: Used for prox cal.
*/
struct tsl2x7x_settings {
int als_time;
int als_gain;
int als_gain_trim;
int wait_time;
int prx_time;
int prox_gain;
int prox_config;
int als_cal_target;
u8 interrupts_en;
u8 persistence;
int als_thresh_low;
int als_thresh_high;
int prox_thres_low;
int prox_thres_high;
int prox_pulse_count;
int prox_max_samples_cal;
};
/**
* struct tsl2X7X_platform_data - Platform callback, glass and defaults
* @platform_power: Suspend/resume platform callback
* @power_on: Power on callback
* @power_off: Power off callback
* @platform_lux_table: Device specific glass coefficents
* @platform_default_settings: Device specific power on defaults
*
*/
struct tsl2X7X_platform_data {
int (*platform_power)(struct device *dev, pm_message_t);
int (*power_on) (struct iio_dev *indio_dev);
int (*power_off) (struct i2c_client *dev);
struct tsl2x7x_lux platform_lux_table[TSL2X7X_MAX_LUX_TABLE_SIZE];
struct tsl2x7x_settings *platform_default_settings;
};
#endif /* __TSL2X7X_H */
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment