Linux IIO development
 help / color / mirror / Atom feed
* [PATCH 0/2] iio: proximity: Add ST STHS34PF80 driver
@ 2026-12-03  0:50 Donggeun Yoo
  2026-12-03  0:50 ` [PATCH 1/2] dt-bindings: iio: proximity: Add ST STHS34PF80 infrared sensor Donggeun Yoo
  2026-12-03  0:50 ` [PATCH 2/2] iio: proximity: Add driver for ST STHS34PF80 Donggeun Yoo
  0 siblings, 2 replies; 3+ messages in thread
From: Donggeun Yoo @ 2026-12-03  0:50 UTC (permalink / raw)
  To: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
	devicetree, linux-kernel, 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+.

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
-- 
2.53.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] dt-bindings: iio: proximity: Add ST STHS34PF80 infrared sensor
  2026-12-03  0:50 [PATCH 0/2] iio: proximity: Add ST STHS34PF80 driver Donggeun Yoo
@ 2026-12-03  0:50 ` Donggeun Yoo
  2026-12-03  0:50 ` [PATCH 2/2] iio: proximity: Add driver for ST STHS34PF80 Donggeun Yoo
  1 sibling, 0 replies; 3+ messages in thread
From: Donggeun Yoo @ 2026-12-03  0:50 UTC (permalink / raw)
  To: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
	devicetree, linux-kernel, Donggeun Yoo

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
Assisted-by: LLM
Signed-off-by: Donggeun Yoo <donggeunyoo.kernel@gmail.com>
---
 .../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

diff --git a/Documentation/devicetree/bindings/iio/proximity/st,sths34pf80.yaml b/Documentation/devicetree/bindings/iio/proximity/st,sths34pf80.yaml
new file mode 100644
index 0000000000000..a46bc65960421
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/proximity/st,sths34pf80.yaml
@@ -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 <donggeunyoo.kernel@gmail.com>
+
+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>;
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 02015eaec312d..09318d3f9670e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -26594,6 +26594,12 @@ S:	Maintained
 F:	Documentation/hwmon/stef48h28.rst
 F:	drivers/hwmon/pmbus/stef48h28.c
 
+ST STHS34PF80 IIO DRIVER
+M:	Donggeun Yoo <donggeunyoo.kernel@gmail.com>
+L:	linux-iio@vger.kernel.org
+S:	Maintained
+F:	Documentation/devicetree/bindings/iio/proximity/st,sths34pf80.yaml
+
 ST STM32 FIREWALL
 M:	Gatien Chevallier <gatien.chevallier@foss.st.com>
 S:	Maintained
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] iio: proximity: Add driver for ST STHS34PF80
  2026-12-03  0:50 [PATCH 0/2] iio: proximity: Add ST STHS34PF80 driver Donggeun Yoo
  2026-12-03  0:50 ` [PATCH 1/2] dt-bindings: iio: proximity: Add ST STHS34PF80 infrared sensor Donggeun Yoo
@ 2026-12-03  0:50 ` Donggeun Yoo
  1 sibling, 0 replies; 3+ messages in thread
From: Donggeun Yoo @ 2026-12-03  0:50 UTC (permalink / raw)
  To: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
	devicetree, linux-kernel, Donggeun Yoo

Add 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
Assisted-by: LLM
Signed-off-by: Donggeun Yoo <donggeunyoo.kernel@gmail.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 09318d3f9670e..a40638a609975 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -26599,6 +26599,7 @@ M:	Donggeun Yoo <donggeunyoo.kernel@gmail.com>
 L:	linux-iio@vger.kernel.org
 S:	Maintained
 F:	Documentation/devicetree/bindings/iio/proximity/st,sths34pf80.yaml
+F:	drivers/iio/proximity/sths34pf80.c
 
 ST STM32 FIREWALL
 M:	Gatien Chevallier <gatien.chevallier@foss.st.com>
diff --git a/drivers/iio/proximity/Kconfig b/drivers/iio/proximity/Kconfig
index d16458ea4b0fd..5fb7db5d20d52 100644
--- a/drivers/iio/proximity/Kconfig
+++ b/drivers/iio/proximity/Kconfig
@@ -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
diff --git a/drivers/iio/proximity/Makefile b/drivers/iio/proximity/Makefile
index 43741115a9218..a1a5e89f52f50 100644
--- a/drivers/iio/proximity/Makefile
+++ b/drivers/iio/proximity/Makefile
@@ -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
diff --git a/drivers/iio/proximity/sths34pf80.c b/drivers/iio/proximity/sths34pf80.c
new file mode 100644
index 0000000000000..a32e0c920a0c9
--- /dev/null
+++ b/drivers/iio/proximity/sths34pf80.c
@@ -0,0 +1,369 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * STMicroelectronics STHS34PF80 presence and motion sensor driver
+ *
+ * Copyright (c) 2026 Donggeun Yoo <donggeunyoo.kernel@gmail.com>
+ *
+ * Datasheet: https://www.st.com/resource/en/datasheet/sths34pf80.pdf
+ * Application note: https://www.st.com/resource/en/application_note/an5867-sths34pf80-lowpower-highsensitivity-infrared-ir-sensor-for-presence-and-motion-detection-stmicroelectronics.pdf
+ */
+
+#include <linux/array_size.h>
+#include <linux/bitfield.h>
+#include <linux/bits.h>
+#include <linux/cleanup.h>
+#include <linux/delay.h>
+#include <linux/dev_printk.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/math.h>
+#include <linux/math64.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/overflow.h>
+#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+#include <linux/time.h>
+#include <linux/types.h>
+#include <linux/units.h>
+
+#include <asm/byteorder.h>
+
+#include <linux/iio/iio.h>
+
+#define STHS34PF80_REG_WHO_AM_I		0x0f
+#define STHS34PF80_WHO_AM_I_VAL		0xd3
+
+#define STHS34PF80_REG_SENS_DATA	0x1d
+
+#define STHS34PF80_REG_CTRL1		0x20
+#define STHS34PF80_CTRL1_BDU		BIT(4)
+#define STHS34PF80_CTRL1_ODR		GENMASK(3, 0)
+#define STHS34PF80_CTRL1_ODR_POWER_DOWN	0
+
+#define STHS34PF80_REG_CTRL2		0x21
+#define STHS34PF80_CTRL2_BOOT		BIT(7)
+#define STHS34PF80_CTRL2_ONE_SHOT	BIT(0)
+
+#define STHS34PF80_REG_STATUS		0x23
+#define STHS34PF80_REG_TOBJECT_L	0x26
+#define STHS34PF80_REG_TAMBIENT_L	0x28
+#define STHS34PF80_REG_TAMB_SHOCK_H	0x3f
+
+/* The boot procedure takes 2.5ms (AN5867 section 5) */
+#define STHS34PF80_BOOT_TIME_US		2500
+
+/* One-shot conversion takes 5.5ms to 252ms (AN5867 Table 6) */
+#define STHS34PF80_ONE_SHOT_POLL_US	(2 * USEC_PER_MSEC)
+#define STHS34PF80_ONE_SHOT_TIMEOUT_US	(300 * USEC_PER_MSEC)
+
+/* SENS_DATA to sensitivity in LSB/degC (AN5867 4.5.1) */
+#define STHS34PF80_SENS_STEP		16
+#define STHS34PF80_SENS_BASE		2048
+
+#define STHS34PF80_TAMBIENT_LSB_PER_DEG	100
+
+/* 0 degC and the sensitivity calibration point, 24 degC (AN5867 4.5.1) */
+#define STHS34PF80_ZERO_CELSIUS_CK	(-ABSOLUTE_ZERO_MILLICELSIUS * \
+					 STHS34PF80_TAMBIENT_LSB_PER_DEG / \
+					 MILLIDEGREE_PER_DEGREE)
+#define STHS34PF80_SENS_CAL_TEMP_CK	(STHS34PF80_ZERO_CELSIUS_CK + \
+					 24 * STHS34PF80_TAMBIENT_LSB_PER_DEG)
+
+struct sths34pf80_data {
+	struct regmap *regmap;
+	/* Serializes access to the device */
+	struct mutex lock;
+	unsigned int sensitivity;
+};
+
+static bool sths34pf80_volatile_reg(struct device *dev, unsigned int reg)
+{
+	switch (reg) {
+	case STHS34PF80_REG_CTRL2:
+	case STHS34PF80_REG_STATUS ... STHS34PF80_REG_TAMB_SHOCK_H:
+		return true;
+	default:
+		return false;
+	}
+}
+
+static bool sths34pf80_writeable_reg(struct device *dev, unsigned int reg)
+{
+	switch (reg) {
+	case STHS34PF80_REG_CTRL1:
+	case STHS34PF80_REG_CTRL2:
+		return true;
+	default:
+		return false;
+	}
+}
+
+static const struct regmap_config sths34pf80_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+	.max_register = STHS34PF80_REG_TAMB_SHOCK_H,
+	.writeable_reg = sths34pf80_writeable_reg,
+	.volatile_reg = sths34pf80_volatile_reg,
+	.cache_type = REGCACHE_MAPLE,
+};
+
+static const struct iio_chan_spec sths34pf80_channels[] = {
+	{
+		.type = IIO_TEMP,
+		.modified = 1,
+		.channel2 = IIO_MOD_TEMP_AMBIENT,
+		.address = STHS34PF80_REG_TAMBIENT_L,
+		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
+				      BIT(IIO_CHAN_INFO_SCALE),
+	},
+	{
+		.type = IIO_TEMP,
+		.modified = 1,
+		.channel2 = IIO_MOD_TEMP_OBJECT,
+		.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
+	},
+};
+
+static int sths34pf80_one_shot(struct sths34pf80_data *data)
+{
+	struct regmap *map = data->regmap;
+	unsigned int ctrl2;
+	int ret;
+
+	ret = regmap_set_bits(map, STHS34PF80_REG_CTRL2,
+			      STHS34PF80_CTRL2_ONE_SHOT);
+	if (ret)
+		return ret;
+
+	return regmap_read_poll_timeout(map, STHS34PF80_REG_CTRL2, ctrl2,
+					!(ctrl2 & STHS34PF80_CTRL2_ONE_SHOT),
+					STHS34PF80_ONE_SHOT_POLL_US,
+					STHS34PF80_ONE_SHOT_TIMEOUT_US);
+}
+
+static int sths34pf80_read_s16(struct sths34pf80_data *data, unsigned int reg,
+			       int *val)
+{
+	struct regmap *map = data->regmap;
+	__le16 raw;
+	int ret;
+
+	ret = regmap_bulk_read(map, reg, &raw, sizeof(raw));
+	if (ret)
+		return ret;
+
+	*val = (s16)le16_to_cpu(raw);
+
+	return 0;
+}
+
+static int sths34pf80_read_channel(struct sths34pf80_data *data,
+				   unsigned int reg, int *val)
+{
+	int ret;
+
+	guard(mutex)(&data->lock);
+
+	ret = sths34pf80_one_shot(data);
+	if (ret)
+		return ret;
+
+	return sths34pf80_read_s16(data, reg, val);
+}
+
+/*
+ * TOBJECT = sigma * (T_obj^4 - T_amb^4) and SENS = 4 * sigma * T_cal^3
+ * (AN5867 4.5.1), solved for T_obj in centikelvin.
+ */
+static int sths34pf80_calc_object_temp(struct sths34pf80_data *data,
+				       int tobject, int tambient, int *val)
+{
+	s64 tamb = tambient + STHS34PF80_ZERO_CELSIUS_CK;
+	u64 cal = STHS34PF80_SENS_CAL_TEMP_CK;
+	u64 tamb4, tobj4, scale;
+	s64 delta;
+	int tobj;
+
+	tamb4 = tamb * tamb;
+	tamb4 *= tamb4;
+
+	scale = div_u64(4 * cal * cal * cal * STHS34PF80_TAMBIENT_LSB_PER_DEG,
+			data->sensitivity);
+
+	if (check_mul_overflow(tobject, scale, &delta) ||
+	    check_add_overflow(tamb4, delta, &tobj4))
+		return -ERANGE;
+
+	tobj = int_sqrt64(int_sqrt64(tobj4));
+	*val = (tobj - STHS34PF80_ZERO_CELSIUS_CK) *
+	       (MILLIDEGREE_PER_DEGREE / STHS34PF80_TAMBIENT_LSB_PER_DEG);
+
+	return 0;
+}
+
+static int sths34pf80_read_object(struct sths34pf80_data *data, int *val)
+{
+	struct regmap *map = data->regmap;
+	int tobject, tambient;
+	/* TOBJECT and TAMBIENT are adjacent */
+	__le16 raw[2];
+	int ret;
+
+	guard(mutex)(&data->lock);
+
+	ret = sths34pf80_one_shot(data);
+	if (ret)
+		return ret;
+
+	ret = regmap_bulk_read(map, STHS34PF80_REG_TOBJECT_L, raw, sizeof(raw));
+	if (ret)
+		return ret;
+
+	tobject = (s16)le16_to_cpu(raw[0]);
+	tambient = (s16)le16_to_cpu(raw[1]);
+
+	return sths34pf80_calc_object_temp(data, tobject, tambient, val);
+}
+
+static int sths34pf80_read_raw(struct iio_dev *indio_dev,
+			       struct iio_chan_spec const *chan,
+			       int *val, int *val2, long mask)
+{
+	struct sths34pf80_data *data = iio_priv(indio_dev);
+	int ret;
+
+	switch (mask) {
+	case IIO_CHAN_INFO_RAW: {
+		IIO_DEV_ACQUIRE_DIRECT_MODE(indio_dev, claim);
+		if (IIO_DEV_ACQUIRE_FAILED(claim))
+			return -EBUSY;
+
+		ret = sths34pf80_read_channel(data, chan->address, val);
+		if (ret)
+			return ret;
+
+		return IIO_VAL_INT;
+	}
+	case IIO_CHAN_INFO_PROCESSED: {
+		IIO_DEV_ACQUIRE_DIRECT_MODE(indio_dev, claim);
+		if (IIO_DEV_ACQUIRE_FAILED(claim))
+			return -EBUSY;
+
+		ret = sths34pf80_read_object(data, val);
+		if (ret)
+			return ret;
+
+		return IIO_VAL_INT;
+	}
+	case IIO_CHAN_INFO_SCALE:
+		*val = MILLIDEGREE_PER_DEGREE / STHS34PF80_TAMBIENT_LSB_PER_DEG;
+		return IIO_VAL_INT;
+	default:
+		return -EINVAL;
+	}
+}
+
+static const struct iio_info sths34pf80_info = {
+	.read_raw = sths34pf80_read_raw,
+};
+
+static int sths34pf80_probe(struct i2c_client *client)
+{
+	struct device *dev = &client->dev;
+	struct sths34pf80_data *data;
+	struct iio_dev *indio_dev;
+	unsigned int sens_data;
+	struct regmap *regmap;
+	unsigned int whoami;
+	int ret;
+
+	indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
+	if (!indio_dev)
+		return -ENOMEM;
+
+	data = iio_priv(indio_dev);
+
+	ret = devm_mutex_init(dev, &data->lock);
+	if (ret)
+		return ret;
+
+	ret = devm_regulator_get_enable(dev, "vdd");
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to enable vdd\n");
+
+	fsleep(STHS34PF80_BOOT_TIME_US);
+
+	regmap = devm_regmap_init_i2c(client, &sths34pf80_regmap_config);
+	if (IS_ERR(regmap))
+		return dev_err_probe(dev, PTR_ERR(regmap),
+				     "Failed to init regmap\n");
+
+	data->regmap = regmap;
+
+	ret = regmap_read(regmap, STHS34PF80_REG_WHO_AM_I, &whoami);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to read WHO_AM_I\n");
+
+	if (whoami != STHS34PF80_WHO_AM_I_VAL)
+		dev_info(dev, "Unknown WHO_AM_I: 0x%02x\n", whoami);
+
+	ret = regmap_write(regmap, STHS34PF80_REG_CTRL2, STHS34PF80_CTRL2_BOOT);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to reboot\n");
+
+	fsleep(STHS34PF80_BOOT_TIME_US);
+
+	ret = regmap_update_bits(regmap, STHS34PF80_REG_CTRL1,
+				 STHS34PF80_CTRL1_BDU | STHS34PF80_CTRL1_ODR,
+				 STHS34PF80_CTRL1_BDU |
+				 FIELD_PREP(STHS34PF80_CTRL1_ODR,
+					    STHS34PF80_CTRL1_ODR_POWER_DOWN));
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to set CTRL1\n");
+
+	ret = regmap_read(regmap, STHS34PF80_REG_SENS_DATA, &sens_data);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to read SENS_DATA\n");
+
+	data->sensitivity = (s8)sens_data * STHS34PF80_SENS_STEP +
+			    STHS34PF80_SENS_BASE;
+	if (!data->sensitivity)
+		return dev_err_probe(dev, -EINVAL, "Invalid sensitivity\n");
+
+	dev_dbg(dev, "Sensitivity: %u LSB/degC\n", data->sensitivity);
+
+	indio_dev->name = "sths34pf80";
+	indio_dev->info = &sths34pf80_info;
+	indio_dev->modes = INDIO_DIRECT_MODE;
+	indio_dev->channels = sths34pf80_channels;
+	indio_dev->num_channels = ARRAY_SIZE(sths34pf80_channels);
+
+	return devm_iio_device_register(dev, indio_dev);
+}
+
+static const struct of_device_id sths34pf80_of_match[] = {
+	{ .compatible = "st,sths34pf80" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, sths34pf80_of_match);
+
+static const struct i2c_device_id sths34pf80_id[] = {
+	{ .name = "sths34pf80" },
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, sths34pf80_id);
+
+static struct i2c_driver sths34pf80_driver = {
+	.driver = {
+		.name = "sths34pf80",
+		.of_match_table = sths34pf80_of_match,
+	},
+	.probe = sths34pf80_probe,
+	.id_table = sths34pf80_id,
+};
+module_i2c_driver(sths34pf80_driver);
+
+MODULE_AUTHOR("Donggeun Yoo <donggeunyoo.kernel@gmail.com>");
+MODULE_DESCRIPTION("STMicroelectronics STHS34PF80 presence and motion sensor driver");
+MODULE_LICENSE("GPL");
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-03  0:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03  0:50 [PATCH 0/2] iio: proximity: Add ST STHS34PF80 driver Donggeun Yoo
2026-12-03  0:50 ` [PATCH 1/2] dt-bindings: iio: proximity: Add ST STHS34PF80 infrared sensor Donggeun Yoo
2026-12-03  0:50 ` [PATCH 2/2] iio: proximity: Add driver for ST STHS34PF80 Donggeun Yoo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox