summaryrefslogtreecommitdiffstats
path: root/drivers/iio/light/Makefile
diff options
context:
space:
mode:
authorLinus Walleij2016-12-18 22:56:05 +0100
committerJonathan Cameron2016-12-30 18:17:39 +0100
commit8afa505c123068bd75c4d0ca42d362942a69ef15 (patch)
treecc39625d970c3a943ee6cc688bd4e99c7469f4a7 /drivers/iio/light/Makefile
parentiio: light: add DT bindings for Capella CM3605 (diff)
downloadkernel-qcow2-linux-8afa505c123068bd75c4d0ca42d362942a69ef15.tar.gz
kernel-qcow2-linux-8afa505c123068bd75c4d0ca42d362942a69ef15.tar.xz
kernel-qcow2-linux-8afa505c123068bd75c4d0ca42d362942a69ef15.zip
iio: light: add driver for Capella CM3605
This adds a driver for the Capella Microsystems CM3605 Ambient Light Sensor and proximity sensor. This is a pretty simple entirely analog device that is interfaced with the target system using the POUT (proximity out) and AOUT (ambient light out) signals. The POUT signal is a simple high/low signal that indicates whether an object is in proximity, most typically used to detect a face in front of a mobile device. The signal requires that an infrared LED is mounted next to the device, making IR light reflect off the object in proximity and triggering the POUT signal. We grab a GPIO pin to handle the POUT signal as an interrupt line and register this as an event channel for the sensor. Since the proximity sensor requires an IR LED, we add a LED trigger named "cm3605" so that the infrared LED can just associate with this trigger to be sure it is always on when the proximity sensor needs it. The AOUT is an analog voltage between 0 and 1550 mV that indicate the LUX value in the ambient light: this is orthogonal to the proximity sensor functionality. Since this analog voltage needs to be converted into a digital value, the driver grabs an IIO channel named "aout" associated with the device. This patch created a combined ALS and proximity sensor driver. The former supports raw reads of the LUX value and the latter will generate proximity events. To integrate this properly with Linux we also add a supply regulator for the VDD pin (driving both functions) and add device tree bindings to define the RSET resistor that in turn configures the luminosity range of the ALS sensor. Since the sensor needs to be on more or less constantly, we restrict the power management to system suspend/resume: we disable the IR LED and disable the regulator for VDD on suspend and take them back up on resume. Tests: cd /sys/bus/iio/devices/iio:device1 cat in_illuminance_raw 304 (hold hand over sensor) cat in_illuminance_raw 17 iio_event_monitor cm3605 Found IIO device with name cm3605 with device number 1 (hold hand over sensor) Event: time: 2444842301447, type: proximity, channel: 0, evtype: thresh, direction: falling (remove hand over sensor) Event: time: 2445583440706, type: proximity, channel: 0, evtype: thresh, direction: rising Cc: Capella Microsystems <capellamicro@gmail.com> Cc: Kevin Tsai <ktsai@capellamicro.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/light/Makefile')
-rw-r--r--drivers/iio/light/Makefile1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iio/light/Makefile b/drivers/iio/light/Makefile
index 4de520036e6e..c13a2399e6df 100644
--- a/drivers/iio/light/Makefile
+++ b/drivers/iio/light/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_BH1780) += bh1780.o
obj-$(CONFIG_CM32181) += cm32181.o
obj-$(CONFIG_CM3232) += cm3232.o
obj-$(CONFIG_CM3323) += cm3323.o
+obj-$(CONFIG_CM3605) += cm3605.o
obj-$(CONFIG_CM36651) += cm36651.o
obj-$(CONFIG_GP2AP020A00F) += gp2ap020a00f.o
obj-$(CONFIG_HID_SENSOR_ALS) += hid-sensor-als.o