Support for Texas Instruments OPT4060 RGBW Color sensor.
Subsystems (2)
cover Support for Texas Instruments OPT4060 RGBW Color sensor.
This patch series adds support for Texas Instruments OPT4060 RGBW Color sensor using the i2c interface.
The driver exposes both raw adc values and calculated lux values though sysfs. Integration time can be configured though sysfs as well. The OPT4060 sensor supports both rising and falling threshold interrupts. These interrupts are exposed as IIO events. The driver also implements an IIO triggered buffer with two triggers, one trigger for conversion ready interrupts and one trigger for threshold interrupts. The typical use case for this is to define a threshold and listen for the events, and at the same time enable the triggered buffer with the threshold trigger. Once the application gets the threshold event, the values from the time of the event will be available in the triggered buffer. This limits the number of interrupts between sensor and host and also the the usage of sysfs for reading values after events.
Per-Daniel Olsson (2):
dt-bindings: iio: light: Document TI OPT4060 RGBW sensor
iio: light: Add support for TI OPT4060 color sensor
.../bindings/iio/light/ti,opt4060.yaml | 65 + drivers/iio/light/Kconfig | 13 + drivers/iio/light/Makefile | 1 + drivers/iio/light/opt4060.c | 1204 +++++++++++++++++ 4 files changed, 1283 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml create mode 100644 drivers/iio/light/opt4060.c
base-commit: 7ec462100ef9142344ddbf86f2c3008b97acddbe --
2.39.5
PATCH 1/2 dt-bindings: iio: light: Document TI OPT4060 RGBW sensor
Add devicetree bindings for the OPT4060 RGBW color sensor.
--- .../bindings/iio/light/ti,opt4060.yaml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml
Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml new file +65 -0
@@ -0,0 +1,65 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/light/ti,opt4060.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Texas Instruments OPT4060 RGBW Color Sensor + +maintainers: + - Per-Daniel Olsson <[email protected]> + +description: + Texas Instrument RGBW high resolution color sensor over I2C. + https://www.ti.com/lit/gpn/opt4060 + +properties: + compatible: + enum: + - ti,opt4060 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + vdd-supply: + description: Regulator that provides power to the sensor. + +required: + - compatible + - reg + +allOf: + - if: + properties: + compatible: + contains: + const: ti,opt4060 + then: + properties: + interrupts: + maxItems: 1 + else: + properties: + interrupts: false + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + + opt4060@44 { + compatible = "ti,opt4060"; + reg = <0x44>; + vdd-supply = <&vdd_reg>; + interrupt-parent = <&gpio5>; + interrupts = <13 IRQ_TYPE_EDGE_FALLING>; + }; + }; +...
Signature · 1 line
2.39.5
Re: [PATCH 1/2] dt-bindings: iio: light: Document TI OPT4060 RGBW sensor
Quoted 3 lines · Per-Daniel Olsson
Add devicetree bindings for the OPT4060 RGBW color sensor.
Signed-off-by Per-Daniel Olsson <[email protected]>
Thank you for your patch. There is something to discuss/improve.
Quoted 10 lines
Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml new file +10
-0+ + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + vdd-supply: + description: Regulator that provides power to the sensor. +
Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml line 39
Quoted 10 lines
Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml new file +10
-0+required: + - compatible + - reg + +allOf: + - if: + properties: + compatible: + contains: + const: ti,opt4060
This allOf does not make sense.
Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml line 43
Quoted 4 lines
Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml new file +4
-0+ then: + properties: + interrupts: + maxItems: 1
You repeat the case.
Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml line 46
Quoted 3 lines
Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml new file +3
-0+ else: + properties: + interrupts: false
This cannot happen.
Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml line 57
Quoted 11 lines
Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml new file +11
-0+ +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + + opt4060@44 {
Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml line 59
Quoted 2 lines
Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml new file +2
-0+ compatible = "ti,opt4060"; + reg = <0x44>;
Best regards,
Krzysztof
PATCH 2/2 iio: light: Add support for TI OPT4060 color sensor
In reply to Per-Daniel OlssonAdd support for Texas Instruments OPT4060 RGBW Color sensor.
--- drivers/iio/light/Kconfig | 13 + drivers/iio/light/Makefile | 1 + drivers/iio/light/opt4060.c | 1204 +++++++++++++++++++++++++++++++++++ 3 files changed, 1218 insertions(+) create mode 100644 drivers/iio/light/opt4060.c
drivers/iio/light/Kconfig +13 -0
@@ -490,6 +490,19 @@ config OPT4001 If built as a dynamically linked module, it will be called opt4001. +config OPT4060 + tristate "Texas Instruments OPT4060 RGBW Color Sensor" + depends on I2C + select REGMAP_I2C + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + If you say Y or M here, you get support for Texas Instruments + OPT4060 RGBW Color Sensor. + + If built as a dynamically linked module, it will be called + opt4060. + config PA12203001 tristate "TXC PA12203001 light and proximity sensor" depends on I2C
drivers/iio/light/Makefile +1 -0
@@ -42,6 +42,7 @@ obj-$(CONFIG_MAX44009) += max44009.o obj-$(CONFIG_NOA1305) += noa1305.o obj-$(CONFIG_OPT3001) += opt3001.o obj-$(CONFIG_OPT4001) += opt4001.o +obj-$(CONFIG_OPT4060) += opt4060.o obj-$(CONFIG_PA12203001) += pa12203001.o obj-$(CONFIG_ROHM_BU27008) += rohm-bu27008.o obj-$(CONFIG_ROHM_BU27034) += rohm-bu27034.o
drivers/iio/light/opt4060.c new file +1204 -0
1,204 lines not on this page · raw message
Signature · 1 line
2.39.5