TAOS (version 9a) tsl2x7x driver change / bug fix.
Fixed - removed decimal multiplications.
Added missing 'static' declarations
Fixed _read_raw case logic to allow reading of _PROCESSED IIO_LIGHT
Replaced udelay with mdelay to accomodate eabi.
Signed-off-by: Jon Brenner <jbrenner@taosinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING) | \
IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING)),
(IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING) | \
IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING)),
+#define TSL2X7X_MIN_ITIME 3
+
/* TAOS txx2x7x Device family members */
enum {
tsl2571,
/* TAOS txx2x7x Device family members */
enum {
tsl2571,
-const u8 device_channel_config[] = {
+static const u8 device_channel_config[] = {
- udelay(3000); /* Power-on settling time */
+ mdelay(3); /* Power-on settling time */
/* NOW enable the ADC
* initialize the desired mode of operation */
/* NOW enable the ADC
* initialize the desired mode of operation */
* put device back into proper state, and unlock
* resource.
*/
* put device back into proper state, and unlock
* resource.
*/
int tsl2x7x_invoke_change(struct iio_dev *indio_dev)
{
struct tsl2X7X_chip *chip = iio_priv(indio_dev);
int tsl2x7x_invoke_change(struct iio_dev *indio_dev)
{
struct tsl2X7X_chip *chip = iio_priv(indio_dev);
int y, z;
y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1;
int y, z;
y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1;
+ z = y * TSL2X7X_MIN_ITIME;
/* Determine integration time */
y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1;
/* Determine integration time */
y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1;
+ z = y * TSL2X7X_MIN_ITIME;
filter_delay = z * (chip->tsl2x7x_settings.persistence & 0x0F);
y = (filter_delay / 1000);
z = (filter_delay % 1000);
filter_delay = z * (chip->tsl2x7x_settings.persistence & 0x0F);
y = (filter_delay / 1000);
z = (filter_delay % 1000);
result.fract /= 1000;
y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1;
result.fract /= 1000;
y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1;
+ z = y * TSL2X7X_MIN_ITIME;
filter_delay =
DIV_ROUND_UP(((result.integer * 1000) + result.fract), z);
filter_delay =
DIV_ROUND_UP(((result.integer * 1000) + result.fract), z);
/* Determine integration time */
y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.prx_time) + 1;
/* Determine integration time */
y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.prx_time) + 1;
+ z = y * TSL2X7X_MIN_ITIME;
filter_delay = z * ((chip->tsl2x7x_settings.persistence & 0xF0) >> 4);
y = (filter_delay / 1000);
z = (filter_delay % 1000);
filter_delay = z * ((chip->tsl2x7x_settings.persistence & 0xF0) >> 4);
y = (filter_delay / 1000);
z = (filter_delay % 1000);
result.fract /= 1000;
y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.prx_time) + 1;
result.fract /= 1000;
y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.prx_time) + 1;
+ z = y * TSL2X7X_MIN_ITIME;
filter_delay =
DIV_ROUND_UP(((result.integer * 1000) + result.fract), z);
filter_delay =
DIV_ROUND_UP(((result.integer * 1000) + result.fract), z);
struct tsl2X7X_chip *chip = iio_priv(indio_dev);
switch (mask) {
struct tsl2X7X_chip *chip = iio_priv(indio_dev);
switch (mask) {
- case IIO_CHAN_INFO_RAW:
+ case IIO_CHAN_INFO_PROCESSED:
switch (chan->type) {
case IIO_LIGHT:
tsl2x7x_get_lux(indio_dev);
*val = chip->als_cur_info.lux;
ret = IIO_VAL_INT;
break;
switch (chan->type) {
case IIO_LIGHT:
tsl2x7x_get_lux(indio_dev);
*val = chip->als_cur_info.lux;
ret = IIO_VAL_INT;
break;
+ default:
+ return -EINVAL;
+ break;
+ }
+ break;
+ case IIO_CHAN_INFO_RAW:
+ switch (chan->type) {
case IIO_INTENSITY:
tsl2x7x_get_lux(indio_dev);
if (chan->channel == 0)
case IIO_INTENSITY:
tsl2x7x_get_lux(indio_dev);
if (chan->channel == 0)