iio: proximity: Add ST STHS34PF80 driver
Subsystems (2)
cover iio: proximity: Add ST STHS34PF80 driver
This series adds support for the STMicroelectronics STHS34PF80, an infrared sensor for presence and motion detection.
Patch 1 adds the devicetree binding.
Patch 2 adds the IIO driver, which exposes the ambient temperature and the object temperature over I2C.
Presence and motion detection, the interrupt, buffered capture and SPI are not supported yet.
Tested on a Radxa ROCK 5B+.
Donggeun Yoo (2):
dt-bindings: iio: proximity: Add ST STHS34PF80 infrared sensor
iio: proximity: Add driver for ST STHS34PF80
.../bindings/iio/proximity/st,sths34pf80.yaml | 86 ++++ MAINTAINERS | 7 + drivers/iio/proximity/Kconfig | 11 + drivers/iio/proximity/Makefile | 1 + drivers/iio/proximity/sths34pf80.c | 369 ++++++++++++++++++ 5 files changed, 474 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/proximity/st,sths34pf80.yaml create mode 100644 drivers/iio/proximity/sths34pf80.c
base-commit: 92c9d64c0cf749c8369403a32630562f0e855a6c
Signature · 1 line
2.53.0
PATCH 1/2 dt-bindings: iio: proximity: Add ST STHS34PF80 infrared sensor
The STHS34PF80 is an infrared sensor for presence and motion detection. It has an I2C and a 3-wire SPI interface, an optional interrupt output and a single supply, vdd.
Datasheet: https://www.st.com/resource/en/datasheet/sths34pf80.pdf
--- .../bindings/iio/proximity/st,sths34pf80.yaml | 86 +++++++++++++++++++ MAINTAINERS | 6 ++ 2 files changed, 92 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/proximity/st,sths34pf80.yaml
Documentation/devicetree/bindings/iio/proximity/st,sths34pf80.yaml new file +86 -0
@@ -0,0 +1,86 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/proximity/st,sths34pf80.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: STMicroelectronics STHS34PF80 infrared presence and motion sensor + +maintainers: + - Donggeun Yoo <[email protected]> + +description: | + The STHS34PF80 is an infrared sensor that measures the IR radiation + emitted by objects in its field of view. Embedded algorithms detect + presence, motion and ambient temperature shock and can signal them on + an interrupt pin. The device has an I2C interface and a 3-wire SPI + interface. + + Datasheet: https://www.st.com/resource/en/datasheet/sths34pf80.pdf + +properties: + compatible: + const: st,sths34pf80 + + reg: + maxItems: 1 + + drive-open-drain: + type: boolean + description: + The interrupt line will be configured as open drain, which is useful if + several sensors share the same interrupt line. + + interrupts: + maxItems: 1 + + spi-3wire: true + + spi-max-frequency: + maximum: 10000000 + + vdd-supply: true + +required: + - compatible + - reg + - vdd-supply + +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + proximity@5a { + compatible = "st,sths34pf80"; + reg = <0x5a>; + interrupt-parent = <&gpio0>; + interrupts = <0 IRQ_TYPE_EDGE_RISING>; + vdd-supply = <&vdd>; + }; + }; + - | + #include <dt-bindings/interrupt-controller/irq.h> + + spi { + #address-cells = <1>; + #size-cells = <0>; + + proximity@0 { + compatible = "st,sths34pf80"; + reg = <0>; + interrupt-parent = <&gpio0>; + interrupts = <0 IRQ_TYPE_EDGE_RISING>; + spi-3wire; + spi-max-frequency = <10000000>; + vdd-supply = <&vdd>; + }; + };
MAINTAINERS +6 -0
@@ -26594,6 +26594,12 @@ S: Maintained F: Documentation/hwmon/stef48h28.rst F: drivers/hwmon/pmbus/stef48h28.c +ST STHS34PF80 IIO DRIVER +M: Donggeun Yoo <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/iio/proximity/st,sths34pf80.yaml + ST STM32 FIREWALL M: Gatien Chevallier <[email protected]> S: Maintained
Signature · 1 line
2.53.0
PATCH 2/2 iio: proximity: Add driver for ST STHS34PF80
In reply to Donggeun YooAdd a driver for the STMicroelectronics STHS34PF80, an infrared sensor for presence and motion detection, connected over I2C.
Each read triggers a one-shot measurement. The driver exposes the ambient temperature and the object temperature. The object temperature is not linear in the raw readings. The driver computes it from the raw object and ambient readings and the sensitivity stored in the device, as described in AN5867, and reports it as a processed value.
Presence and motion detection, the interrupt, buffered capture and SPI are not supported yet.
Datasheet: https://www.st.com/resource/en/datasheet/sths34pf80.pdf
--- MAINTAINERS | 1 + drivers/iio/proximity/Kconfig | 11 + drivers/iio/proximity/Makefile | 1 + drivers/iio/proximity/sths34pf80.c | 369 +++++++++++++++++++++++++++++ 4 files changed, 382 insertions(+) create mode 100644 drivers/iio/proximity/sths34pf80.c
MAINTAINERS +1 -0
@@ -26599,6 +26599,7 @@ M: Donggeun Yoo <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/iio/proximity/st,sths34pf80.yaml +F: drivers/iio/proximity/sths34pf80.c ST STM32 FIREWALL M: Gatien Chevallier <[email protected]>
drivers/iio/proximity/Kconfig +11 -0
@@ -149,6 +149,17 @@ config SRF04 To compile this driver as a module, choose M here: the module will be called srf04. +config STHS34PF80 + tristate "STMicroelectronics STHS34PF80 infrared sensor" + depends on I2C + select REGMAP_I2C + help + Say Y here to build a driver for the STMicroelectronics STHS34PF80 + infrared presence and motion sensor. + + To compile this driver as a module, choose M here: the module will be + called sths34pf80. + config SX_COMMON tristate help
drivers/iio/proximity/Makefile +1 -0
@@ -16,6 +16,7 @@ obj-$(CONFIG_PING) += ping.o obj-$(CONFIG_RFD77402) += rfd77402.o obj-$(CONFIG_SRF04) += srf04.o obj-$(CONFIG_SRF08) += srf08.o +obj-$(CONFIG_STHS34PF80) += sths34pf80.o obj-$(CONFIG_SX9310) += sx9310.o obj-$(CONFIG_SX9324) += sx9324.o obj-$(CONFIG_SX9360) += sx9360.o
drivers/iio/proximity/sths34pf80.c new file +369 -0
369 lines not on this page · raw message
Signature · 1 line
2.53.0
Quoted 11 lines · Donggeun Yoo
This series adds support for the STMicroelectronics STHS34PF80, an infrared sensor for presence and motion detection.
Patch 1 adds the devicetree binding.
Patch 2 adds the IIO driver, which exposes the ambient temperature and the object temperature over I2C.Presence and motion detection, the interrupt, buffered capture and SPI are not supported yet.
Tested on a Radxa ROCK 5B+.
Why a brand new driver?
Signature · 2 lines
With Best Regards, Andy Shevchenko