lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 13 Jun 2013 20:20:51 +0200
From:	Andi Shyti <andi@...zian.org>
To:	arnd@...db.de, gregkh@...uxfoundation.org
Cc:	linux-kernel@...r.kernel.org, pc@...f.org, oatilla@...il.com,
	andi@...zian.org
Subject: [PATCH 17/19] bh1770glc: Implemented switch for interrupt operation

From: Onur Atilla <oatilla@...il.com>

The als_int_enable switch decides whether the sensor interrupt
signal is triggered by both proximity and the ambient light
sensors or only by the proximity sensor.

The low and high threshold values are set to their minimum and
maximum in order to disable ALS interrupt.

If als_int_enable is set to 0, then the INT output signal of the
sensor will not be used by the ALS, but only by the proximity
sensor.

The interrupt setting can be changed during runtime by defining
new threshold values for the ambient light sensor.

Signed-off-by: Onur Atilla <oatilla@...il.com>
Signed-off-by: Andi Shyti <andi@...zian.org>
---
 drivers/misc/bh1770glc.c      |   10 ++++++++++
 include/linux/i2c/bh1770glc.h |    1 +
 2 files changed, 11 insertions(+)

diff --git a/drivers/misc/bh1770glc.c b/drivers/misc/bh1770glc.c
index 383cefe..526cdb6 100644
--- a/drivers/misc/bh1770glc.c
+++ b/drivers/misc/bh1770glc.c
@@ -1280,6 +1280,16 @@ static int bh1770_probe(struct i2c_client *client,
 	chip->lux_threshold_lo	= BH1770_LUX_DEF_THRES;
 	chip->lux_threshold_hi	= BH1770_LUX_DEF_THRES;
 
+	/* Modify the ALS threshold values
+	 * only if ALS interrupt is disabled by the platform data.
+	 * Setting the low threshold and the high threshold to the
+	 * lowest and highest values, respectively, disables the IRQ for ALS.
+	 */
+	if (chip->pdata->als_int_enable == 0) {
+		chip->lux_threshold_lo	= 0;
+		chip->lux_threshold_hi	= BH1770_LUX_RANGE;
+	}
+
 	if (chip->pdata->glass_attenuation == 0)
 		chip->lux_ga = BH1770_NEUTRAL_GA;
 	else
diff --git a/include/linux/i2c/bh1770glc.h b/include/linux/i2c/bh1770glc.h
index aaf0906..6fb4488 100644
--- a/include/linux/i2c/bh1770glc.h
+++ b/include/linux/i2c/bh1770glc.h
@@ -53,6 +53,7 @@ struct bh1770_platform_data {
 	u8 prox_hysteresis;
 	u8 prox_min_thresh_BH1770;
 	u8 prox_min_thresh_SFH7770;
+	u8 als_int_enable;
 	int (*setup_resources)(void);
 	int (*release_resources)(void);
 };
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ