Skip to contentSkip to conversation

iio: light: add support for APDS9660 sensor

PATCH Superseded Matt Ranostay 2 participants 5 messages Jul 20, 2015 – Aug 2, 2015 2 messages not in the archive

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover iio: light: add support for APDS9660 sensor

This patchset adds support for the APDS9960 ALS + proximity + gesture sensor.

Included support for the various adjustable settings and controls:
* Falling and rising ALS + proximity thresholds events
* Gain controls
* ALS time integration

Changes from v3:
* Added interrupt client mode document reference in DT bindings
* Add missing dep for CONFIG_REGMAP_I2C in respective Kconfig
* Changed from iio_trigger_poll_chained() to irq_work queue
* Changed channel masks to prevent channels that can't be polled from having sysfs entries
* Renamed regmap_field declarations with apds9660_* prefix
* Added available channel masks and removed unneeded buffer copy in poll function
* Remove unneeded default regmap values in apds9960_reg_defaults
* Clear interrupts from ALS and proximity sensor seperately to avoid race condition
* Changed max threshold values to a macro define, and prevent values less than 0
* Avoid needlessly checking the APDS9960_REG_GFLVL value until we read all the FIFO from the count value. Note this can save up to 32 superfluous i2c reads per gesture engine entry

Matt Ranostay (2):
iio: light: DT binding docs for APDS9960 driver
iio: light: add APDS9960 ALS + promixity driver

 .../ABI/testing/sysfs-bus-iio-light-apds9960       |    7 +
 .../devicetree/bindings/iio/light/apds9960.txt     |   22 +
 drivers/iio/light/Kconfig                          |   13 +
 drivers/iio/light/Makefile                         |    1 +
 drivers/iio/light/apds9960.c                       | 1191 ++++++++++++++++++++
 5 files changed, 1234 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-light-apds9960
 create mode 100644 Documentation/devicetree/bindings/iio/light/apds9960.txt
 create mode 100644 drivers/iio/light/apds9960.c
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

PATCH v4 1/2 iio: light: DT binding docs for APDS9960 driver

In reply to a message not in the archive

Document compatible string, and required DT properties for APDS9960 chipset driver.

---
 .../devicetree/bindings/iio/light/apds9960.txt     | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/light/apds9960.txt
Documentation/devicetree/bindings/iio/light/apds9960.txt new file +22 -0
new file mode 100644
index 0000000..174b709
@@ -0,0 +1,22 @@
+* Avago APDS9960 gesture/RGB/ALS/proximity sensor
+
+http://www.avagotech.com/docs/AV02-4191EN
+
+Required properties:
+
+  - compatible: must be "avago,apds9960"
+  - reg: the I2c address of the sensor
+  - interrupt-parent: should be the phandle for the interrupt controller
+  - interrupts : the sole interrupt generated by the device
+
+  Refer to interrupt-controller/interrupts.txt for generic interrupt client
+  node bindings.
+
+Example:
+
+apds9960@39 {
+	compatible = "avago,apds9960";
+	reg = <0x39>;
+	interrupt-parent = <&gpio1>;
+	interrupts = <16 1>;
+};
Signature · 1 line
1.9.1
#3 lore raw

PATCH v4 2/2 iio: light: add APDS9960 ALS + promixity driver

In reply to a message not in the archive

APDS9960 is a combination of ALS, proximity, and gesture sensors.

This patch adds support for these functions along with gain control, integration time, and event thresholds.

---
 .../ABI/testing/sysfs-bus-iio-light-apds9960       |    7 +
 drivers/iio/light/Kconfig                          |   13 +
 drivers/iio/light/Makefile                         |    1 +
 drivers/iio/light/apds9960.c                       | 1188 ++++++++++++++++++++
 4 files changed, 1209 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-light-apds9960
 create mode 100644 drivers/iio/light/apds9960.c
Documentation/ABI/testing/sysfs-bus-iio-light-apds9960 new file +7 -0
new file mode 100644
index 0000000..8c86f21
@@ -0,0 +1,7 @@
+What:		/sys/bus/iio/devices/triggerX/name = "apds9960-gestureX"
+KernelVersion:	4.2
+Contact:	Matt Ranostay <[email protected]>
+Description:
+		The APDS9960 kernel module provides a trigger which enables
+		the gesture engine that pushes motion data to the buffer when
+		it becomes available.
drivers/iio/light/Kconfig +13 -0
index b37e18d..13195b0 100644
@@ -50,6 +50,19 @@ config APDS9300
 	 To compile this driver as a module, choose M here: the
 	 module will be called apds9300.
 
+config APDS9960
+	tristate "Avago APDS9960 gesture/RGB/ALS/proximity sensor"
+	select REGMAP_I2C
+	select IIO_BUFFER
+	select IIO_TRIGGERED_BUFFER
+	depends on I2C
+	help
+	  Say Y here to build I2C interface support for the Avago
+	  APDS9960 gesture/RGB/ALS/proximity sensor.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called apds9960
+
 config BH1750
 	tristate "ROHM BH1750 ambient light sensor"
 	depends on I2C
drivers/iio/light/Makefile +1 -0
index adf9723..852a7c9 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_ACPI_ALS)		+= acpi-als.o
 obj-$(CONFIG_ADJD_S311)		+= adjd_s311.o
 obj-$(CONFIG_AL3320A)		+= al3320a.o
 obj-$(CONFIG_APDS9300)		+= apds9300.o
+obj-$(CONFIG_APDS9960)		+= apds9960.o
 obj-$(CONFIG_BH1750)		+= bh1750.o
 obj-$(CONFIG_CM32181)		+= cm32181.o
 obj-$(CONFIG_CM3232)		+= cm3232.o
drivers/iio/light/apds9960.c new file +1188 -0

1,188 lines not on this page · raw message

Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
In reply to a message not in the archive

Jonathan,

Does this solve the issues in v3 minus the apds9960_regfield_init() cleanup?

Thanks,

Matt

Quoted 43 lines · Matt Ranostay

This patchset adds support for the APDS9960 ALS + proximity + gesture sensor.

Included support for the various adjustable settings and controls:
* Falling and rising ALS + proximity thresholds events
* Gain controls
* ALS time integration

Changes from v3:
* Added interrupt client mode document reference in DT bindings
* Add missing dep for CONFIG_REGMAP_I2C in respective Kconfig
* Changed from iio_trigger_poll_chained() to irq_work queue
* Changed channel masks to prevent channels that can't be polled from having sysfs entries
* Renamed regmap_field declarations with apds9660_* prefix
* Added available channel masks and removed unneeded buffer copy in poll function
* Remove unneeded default regmap values in apds9960_reg_defaults
* Clear interrupts from ALS and proximity sensor seperately to avoid race condition
* Changed max threshold values to a macro define, and prevent values less than 0
* Avoid needlessly checking the APDS9960_REG_GFLVL value until we read all the FIFO from the count value. Note this can save up to 32 superfluous i2c reads per gesture engine entry

Matt Ranostay (2):
iio: light: DT binding docs for APDS9960 driver
iio: light: add APDS9960 ALS + promixity driver

 .../ABI/testing/sysfs-bus-iio-light-apds9960       |    7 +
 .../devicetree/bindings/iio/light/apds9960.txt     |   22 +
 drivers/iio/light/Kconfig                          |   13 +
 drivers/iio/light/Makefile                         |    1 +
 drivers/iio/light/apds9960.c                       | 1191 ++++++++++++++++++++
 5 files changed, 1234 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-light-apds9960
 create mode 100644 Documentation/devicetree/bindings/iio/light/apds9960.txt
 create mode 100644 drivers/iio/light/apds9960.c

--
1.9.1

#6 lore raw
In reply to a message not in the archive
Quoted 9 lines · Matt Ranostay

Jonathan,

Does this solve the issues in v3 minus the apds9960_regfield_init() cleanup?

Thanks,

Matt

Sorry, was on holiday last week. Catching up now.

Quoted 49 lines · Matt Ranostay
Quoted 40 lines

This patchset adds support for the APDS9960 ALS + proximity + gesture sensor.

Included support for the various adjustable settings and controls:
* Falling and rising ALS + proximity thresholds events
* Gain controls
* ALS time integration

Changes from v3:
* Added interrupt client mode document reference in DT bindings
* Add missing dep for CONFIG_REGMAP_I2C in respective Kconfig
* Changed from iio_trigger_poll_chained() to irq_work queue
* Changed channel masks to prevent channels that can't be polled from having sysfs entries
* Renamed regmap_field declarations with apds9660_* prefix
* Added available channel masks and removed unneeded buffer copy in poll function
* Remove unneeded default regmap values in apds9960_reg_defaults
* Clear interrupts from ALS and proximity sensor seperately to avoid race condition
* Changed max threshold values to a macro define, and prevent values less than 0
* Avoid needlessly checking the APDS9960_REG_GFLVL value until we read all the FIFO from the count value. Note this can save up to 32 superfluous i2c reads per gesture engine entry

Matt Ranostay (2):
iio: light: DT binding docs for APDS9960 driver
iio: light: add APDS9960 ALS + promixity driver

 .../ABI/testing/sysfs-bus-iio-light-apds9960       |    7 +
 .../devicetree/bindings/iio/light/apds9960.txt     |   22 +
 drivers/iio/light/Kconfig                          |   13 +
 drivers/iio/light/Makefile                         |    1 +
 drivers/iio/light/apds9960.c                       | 1191 ++++++++++++++++++++
 5 files changed, 1234 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-light-apds9960
 create mode 100644 Documentation/devicetree/bindings/iio/light/apds9960.txt
 create mode 100644 drivers/iio/light/apds9960.c
Quoted 3 lines

--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html