iio: gp2ap020a00f: Add a driver for the device
PATCH v7 1/1 iio: gp2ap020a00f: Add a driver for the device
Add a new driver for the ambient light/proximity sensor device. The driver exposes three channels: light_clear light_ir and proximity. It also supports triggered buffer, high and low ambient light threshold event and proximity detection events.
---
This driver supports:
- reading channels in 'one shot' mode through read_raw callback,
- four events - rising and falling ambient light events and rising and falling proximity roc events.
- triggers for all the three channels (triggers can't be enabled simultaneosly with proximity detection event)
This is a follow-up of the previous series. The patch with DT bindings documentation [1] for the driver has been already acked [2]. This patch includes following improvements:
- increased buffer size for light channels to allow for storing 24-bit wide light channel data
- introduced the function gp2ap020a00f_write_event_threshold for writing the threshold registers with the value scaled accordingly to the current lux mode
- improved gp2ap020a00f_adjust_lux_mode function, so that it also updates threshold registers with the scaled threshold value
- fixed lux mode switching in the event and trigger handlers
[1] - http://www.spinics.net/lists/linux-iio/msg09768.html
[2] - http://www.spinics.net/lists/linux-iio/msg09772.html
Thanks,
Jacek Anaszewski
drivers/iio/light/Kconfig | 12 + drivers/iio/light/Makefile | 1 + drivers/iio/light/gp2ap020a00f.c | 1615 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 1628 insertions(+), 0 deletions(-) create mode 100644 drivers/iio/light/gp2ap020a00f.c
drivers/iio/light/Kconfig +12 -0
@@ -27,6 +27,18 @@ config APDS9300 To compile this driver as a module, choose M here: the module will be called apds9300. +config GP2AP020A00F + tristate "Sharp GP2AP020A00F Proximity/ALS sensor" + depends on I2C + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say Y here if you have a Sharp GP2AP020A00F proximity/als combo-chip + hooked to an I2C bus. + + To compile this driver as a module, choose M here: the + module will be called gp2ap020a00f. + config HID_SENSOR_ALS depends on HID_SENSOR_HUB select IIO_BUFFER
drivers/iio/light/Makefile +1 -0
@@ -5,6 +5,7 @@ # When adding new entries keep the list in alphabetical order obj-$(CONFIG_ADJD_S311) += adjd_s311.o obj-$(CONFIG_APDS9300) += apds9300.o +obj-$(CONFIG_GP2AP020A00F) += gp2ap020a00f.o obj-$(CONFIG_HID_SENSOR_ALS) += hid-sensor-als.o obj-$(CONFIG_SENSORS_LM3533) += lm3533-als.o obj-$(CONFIG_SENSORS_TSL2563) += tsl2563.o
drivers/iio/light/gp2ap020a00f.c new file +1615 -0
1,615 lines not on this page · raw message
Signature · 1 line
1.7.5.4