]> git.ipfire.org Git - thirdparty/linux.git/commit
hwmon: (sht4x): add heater support
authorAntoni Pokusinski <apokusinski01@gmail.com>
Mon, 30 Sep 2024 20:53:47 +0000 (22:53 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 10 Nov 2024 22:48:07 +0000 (14:48 -0800)
commit0eed6fc3d2b9eef8074dc799176e0c1e78a3cc3f
tree502ba950b64eaef8ed8495d73c997cefc4f7e5ca
parent83cca55a63344f0d43102badc0e77e715180153f
hwmon: (sht4x): add heater support

Add support for manipulating the internal heater of sht4x devices.
Enabling the heater removes condensed water from the sensor surface
which disturbs the relative humidity measurements.

The heater can operate at three heating levels (20, 110 or 200
milliwatts). Also, two heating durations may be selected (0.1 or 1s).
Once the heating time elapses the heater is automatically switched off.

Changes since v3:
* struct sht4x_data: add heating_complete timestamp
* struct sht4x_data: add data_pending flag
* heater_enable_store: return -EINVAL if input != 1
* heater_enable_store: check for data->heating_complete and update it
* heater_enable_store: set data_pending flag after heating request
* sht4x_read_values: msleep if heating in progress
* sht4x_read_values: dont send measurement request if data_pending
* heater_enable attr: make it RW
* Documentation: update info about heater_enable attr

Changes since v2:
* heater_enable_store: remove unnecessary if
* Documentation: remove incorrect info about turning off the heater
* be more specific in the patch description

Changes since v1:
* explain the use case of the new attributes set
* heater_enable attr: make it write-only
* heater_enable_store: define cmd as u8 instead of u8*
* heater_enable_store: remove unreachable data path
* heater_enable_store: remove unnecessary lock
* heater_enable_store: call i2c_master_send only if status==true
* define attributes as DEVICE_ATTR_* instead of SENSOR_DEVICE_ATTR_*

Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
Message-ID: <20240930205346.2147-1-apokusinski01@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Documentation/hwmon/sht4x.rst
drivers/hwmon/sht4x.c