Add driver for HTU31
Subsystems (4)
Andrei Lalaev
maintainerv3 cover Add driver for HTU31
This patch series adds support for HTU31 humidity and temperature sensor.
Changes in v3:
- move serial number attribute to debugfs
- fix the position of entry in Makefile to keep alphabetical order
- fix the patch versioning
Changes in v2:
- replace DIV_ROUND_CLOSEST with DIV_ROUND_CLOSEST_ULL to prevent possible overflow
- drop mutex locking from htu31_read_serial_number, as the function is only called from probe
- add description of the private data structure
- fix the issues pointed by Christophe
- add an entry to MAINTAINERS file
- add Krzysztof's ACK to dt-bindings patch
v1: https://lore.kernel.org/all/[email protected]/#t
Andrei Lalaev (2):
hwmon: add driver for HTU31
dt-bindings: hwmon: Add description for sensor HTU31
.../devicetree/bindings/trivial-devices.yaml | 2 + Documentation/hwmon/htu31.rst | 37 ++ Documentation/hwmon/index.rst | 1 + MAINTAINERS | 6 + drivers/hwmon/Kconfig | 11 + drivers/hwmon/Makefile | 1 + drivers/hwmon/htu31.c | 351 ++++++++++++++++++ 7 files changed, 409 insertions(+) create mode 100644 Documentation/hwmon/htu31.rst create mode 100644 drivers/hwmon/htu31.c
Signature · 1 line
2.48.1
Andrei Lalaev
maintainerPATCH RESEND v3 1/2 hwmon: add driver for HTU31
Add base support for HTU31 temperature and humidity sensor.
Besides temperature and humidity values, the driver also exports a 24-bit heater control to sysfs and serial number to debugfs.
--- Documentation/hwmon/htu31.rst | 37 ++++ Documentation/hwmon/index.rst | 1 + MAINTAINERS | 6 + drivers/hwmon/Kconfig | 11 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/htu31.c | 351 ++++++++++++++++++++++++++++++++++ 6 files changed, 407 insertions(+) create mode 100644 Documentation/hwmon/htu31.rst create mode 100644 drivers/hwmon/htu31.c
Documentation/hwmon/htu31.rst new file +37 -0
@@ -0,0 +1,37 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +Kernel driver HTU31 +==================== + +Supported chips: + + * Measurement Specialties HTU31 + + Prefix: 'htu31' + + Addresses scanned: - + + Datasheet: Publicly available from https://www.te.com/en/product-CAT-HSC0007.html + +Author: + + - Andrei Lalaev <[email protected]> + +Description +----------- + +HTU31 is a humidity and temperature sensor. + +Supported temperature range is from -40 to 125 degrees Celsius. + +Communication with the device is performed via I2C protocol. Sensor's default address +is 0x40. + +sysfs-Interface +--------------- + +=================== ================= +temp1_input: temperature input +humidity1_input: humidity input +heater_enable: heater control +=================== =================
Documentation/hwmon/index.rst +1 -0
@@ -85,6 +85,7 @@ Hardware Monitoring Kernel Drivers hih6130 hp-wmi-sensors hs3001 + htu31 ibmaem ibm-cffps ibmpowernv
MAINTAINERS +6 -0
@@ -10667,6 +10667,12 @@ W: http://www.st.com/ F: Documentation/devicetree/bindings/iio/humidity/st,hts221.yaml F: drivers/iio/humidity/hts221* +HTU31 Hardware Temperature and Humidity Sensor +M: Andrei Lalaev <[email protected]> +L: [email protected] +S: Maintained +F: drivers/hwmon/htu31.c + HUAWEI ETHERNET DRIVER M: Cai Huoqing <[email protected]> L: [email protected]
drivers/hwmon/Kconfig +11 -0
@@ -789,6 +789,17 @@ config SENSORS_HS3001 This driver can also be built as a module. If so, the module will be called hs3001. +config SENSORS_HTU31 + tristate "Measurement Specialties HTU31 humidity and temperature sensor" + depends on I2C + select CRC8 + help + If you say yes here you get support for the HTU31 humidity + and temperature sensors. + + This driver can also be built as a module. If so, the module + will be called htu31. + config SENSORS_IBMAEM tristate "IBM Active Energy Manager temperature/power sensors and control" select IPMI_SI
drivers/hwmon/Makefile +1 -0
@@ -91,6 +91,7 @@ obj-$(CONFIG_SENSORS_GPIO_FAN) += gpio-fan.o obj-$(CONFIG_SENSORS_GXP_FAN_CTRL) += gxp-fan-ctrl.o obj-$(CONFIG_SENSORS_HIH6130) += hih6130.o obj-$(CONFIG_SENSORS_HS3001) += hs3001.o +obj-$(CONFIG_SENSORS_HTU31) += htu31.o obj-$(CONFIG_SENSORS_ULTRA45) += ultra45_env.o obj-$(CONFIG_SENSORS_I5500) += i5500_temp.o obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o
drivers/hwmon/htu31.c new file +351 -0
351 lines not on this page · raw message
Signature · 1 line
2.48.1
Re: [PATCH RESEND v3 1/2] hwmon: add driver for HTU31
Quoted 6 lines · Andrei Lalaev
Add base support for HTU31 temperature and humidity sensor.
Besides temperature and humidity values, the driver also exports a 24-bit heater control to sysfs and serial number to debugfs.
Signed-off-by Andrei Lalaev <[email protected]>
Applied, after fixing:
CHECK: Alignment should match open parenthesis
#493: FILE: drivers/hwmon/htu31.c:254:
+ seq_printf(seq_file, "%X%X%X\n", data->serial_number[0],
+ data->serial_number[1],
Guenter
Andrei Lalaev
maintainerPATCH RESEND v3 2/2 dt-bindings: hwmon: Add description for sensor HTU31
In reply to Andrei LalaevAdd trivial binding for HTU31 Temperature and Humidity sensor.
--- Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
@@ -189,6 +189,8 @@ properties: - mcube,mc3230 # Measurement Specialities I2C temperature and humidity sensor - meas,htu21 + # Measurement Specialities I2C temperature and humidity sensor + - meas,htu31 # Measurement Specialities I2C pressure and temperature sensor - meas,ms5637 # Measurement Specialities I2C pressure and temperature sensor
Signature · 1 line
2.48.1
Re: [PATCH RESEND v3 2/2] dt-bindings: hwmon: Add description for sensor HTU31
Quoted 4 lines · Andrei Lalaev
Add trivial binding for HTU31 Temperature and Humidity sensor.
Signed-off-by Andrei Lalaev <[email protected]>
Applied.
Thanks,
Guenter