]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: iio: tsl2x7x_core: fix proximity treshold
authorMario Schuknecht <mario.schuknecht@dresearch-fe.de>
Tue, 27 May 2014 06:19:00 +0000 (07:19 +0100)
committerJonathan Cameron <jic23@kernel.org>
Mon, 2 Jun 2014 17:49:18 +0000 (18:49 +0100)
Consider high byte of proximity min and max treshold in function
'tsl2x7x_chip_on'. So far, the high byte was not set.

Cc: Stable@vger.kernel.org
Signed-off-by: Mario Schuknecht <mario.schuknecht@dresearch-fe.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/light/tsl2x7x_core.c

index 9e0f2a9c73ae8d5b05c7a16d57c4b2027f91314d..ab338e3ddd054b4deffac880fe374ba455a792e3 100644 (file)
@@ -667,9 +667,13 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev)
        chip->tsl2x7x_config[TSL2X7X_PRX_COUNT] =
                        chip->tsl2x7x_settings.prox_pulse_count;
        chip->tsl2x7x_config[TSL2X7X_PRX_MINTHRESHLO] =
-       chip->tsl2x7x_settings.prox_thres_low;
+                       (chip->tsl2x7x_settings.prox_thres_low) & 0xFF;
+       chip->tsl2x7x_config[TSL2X7X_PRX_MINTHRESHHI] =
+                       (chip->tsl2x7x_settings.prox_thres_low >> 8) & 0xFF;
        chip->tsl2x7x_config[TSL2X7X_PRX_MAXTHRESHLO] =
-                       chip->tsl2x7x_settings.prox_thres_high;
+                       (chip->tsl2x7x_settings.prox_thres_high) & 0xFF;
+       chip->tsl2x7x_config[TSL2X7X_PRX_MAXTHRESHHI] =
+                       (chip->tsl2x7x_settings.prox_thres_high >> 8) & 0xFF;
 
        /* and make sure we're not already on */
        if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) {