* [PATCH 2/2] dt-bindings: hwmon: Add description for sensor HTU31
2025-01-23 20:25 [PATCH 0/2] Add driver for HTU31 Andrei Lalaev
@ 2025-01-23 20:25 ` Andrei Lalaev
2025-01-24 8:26 ` Krzysztof Kozlowski
0 siblings, 1 reply; 12+ messages in thread
From: Andrei Lalaev @ 2025-01-23 20:25 UTC (permalink / raw)
To: jdelvare, linux, conor+dt, krzk+dt, robh
Cc: andrey.lalaev, linux-hwmon, devicetree, linux-kernel
Add trivial binding for HTU31 Temperature and Humidity sensor.
Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
---
Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index 6bdcd055e763..294e8f9bfb4a 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -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
--
2.48.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] dt-bindings: hwmon: Add description for sensor HTU31
2025-01-23 20:25 ` [PATCH 2/2] dt-bindings: hwmon: Add description for sensor HTU31 Andrei Lalaev
@ 2025-01-24 8:26 ` Krzysztof Kozlowski
0 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-24 8:26 UTC (permalink / raw)
To: Andrei Lalaev
Cc: jdelvare, linux, conor+dt, krzk+dt, robh, linux-hwmon, devicetree,
linux-kernel
On Thu, Jan 23, 2025 at 09:25:07PM +0100, Andrei Lalaev wrote:
> Add trivial binding for HTU31 Temperature and Humidity sensor.
>
> Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
> ---
> Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
> 1 file changed, 2 insertions(+)
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
<form letter>
This is an automated instruction, just in case, because many review tags
are being ignored. If you know the process, you can skip it (please do
not feel offended by me posting it here - no bad intentions intended).
If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new
versions of patchset, under or above your Signed-off-by tag, unless
patch changed significantly (e.g. new properties added to the DT
bindings). Tag is "received", when provided in a message replied to you
on the mailing list. Tools like b4 can help here. However, there's no
need to repost patches *only* to add the tags. The upstream maintainer
will do that for tags received on the version they apply.
https://elixir.bootlin.com/linux/v6.12-rc3/source/Documentation/process/submitting-patches.rst#L577
</form letter>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 0/2] Add driver for HTU31
@ 2025-01-26 14:40 Andrei Lalaev
2025-01-26 14:40 ` [PATCH 1/2] hwmon: add " Andrei Lalaev
2025-01-26 14:40 ` [PATCH 2/2] dt-bindings: hwmon: Add description for sensor HTU31 Andrei Lalaev
0 siblings, 2 replies; 12+ messages in thread
From: Andrei Lalaev @ 2025-01-26 14:40 UTC (permalink / raw)
To: jdelvare, linux, conor+dt, robh, krzk, christophe.jaillet
Cc: linux-hwmon, linux-kernel, devicetree, andrey.lalaev
This patch series adds support for HTU31 humidity and temperature
sensor.
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/20250123202528.223966-1-andrey.lalaev@gmail.com/#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 | 38 ++
Documentation/hwmon/index.rst | 1 +
MAINTAINERS | 6 +
drivers/hwmon/Kconfig | 11 +
drivers/hwmon/Makefile | 1 +
drivers/hwmon/htu31.c | 345 ++++++++++++++++++
7 files changed, 404 insertions(+)
create mode 100644 Documentation/hwmon/htu31.rst
create mode 100644 drivers/hwmon/htu31.c
--
2.48.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/2] hwmon: add driver for HTU31
2025-01-26 14:40 [PATCH v2 0/2] Add driver for HTU31 Andrei Lalaev
@ 2025-01-26 14:40 ` Andrei Lalaev
2025-01-26 14:59 ` Guenter Roeck
2025-01-26 14:40 ` [PATCH 2/2] dt-bindings: hwmon: Add description for sensor HTU31 Andrei Lalaev
1 sibling, 1 reply; 12+ messages in thread
From: Andrei Lalaev @ 2025-01-26 14:40 UTC (permalink / raw)
To: jdelvare, linux, conor+dt, robh, krzk, christophe.jaillet
Cc: linux-hwmon, linux-kernel, devicetree, andrey.lalaev
Add base support for HTU31 temperature and humidity sensor.
Besides temperature and humidity values, the driver also exports a 24-bit
serial number and heater control to sysfs.
Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
---
Documentation/hwmon/htu31.rst | 38 ++++
Documentation/hwmon/index.rst | 1 +
MAINTAINERS | 6 +
drivers/hwmon/Kconfig | 11 ++
drivers/hwmon/Makefile | 1 +
drivers/hwmon/htu31.c | 345 ++++++++++++++++++++++++++++++++++
6 files changed, 402 insertions(+)
create mode 100644 Documentation/hwmon/htu31.rst
create mode 100644 drivers/hwmon/htu31.c
diff --git a/Documentation/hwmon/htu31.rst b/Documentation/hwmon/htu31.rst
new file mode 100644
index 000000000000..a7a960e215ec
--- /dev/null
+++ b/Documentation/hwmon/htu31.rst
@@ -0,0 +1,38 @@
+.. 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 <andrey.lalaev@gmail.com>
+
+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
+serial_number: serial number
+heater_enable: heater control
+=================== =================
diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst
index 874f8fd26325..86f6f5e46b59 100644
--- a/Documentation/hwmon/index.rst
+++ b/Documentation/hwmon/index.rst
@@ -85,6 +85,7 @@ Hardware Monitoring Kernel Drivers
hih6130
hp-wmi-sensors
hs3001
+ htu31
ibmaem
ibm-cffps
ibmpowernv
diff --git a/MAINTAINERS b/MAINTAINERS
index 8e047e20fbd8..2550a41f8b50 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10643,6 +10643,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 <andrey.lalaev@gmail.com>
+L: linux-hwmon@vger.kernel.org
+S: Maintained
+F: drivers/hwmon/htu31.c
+
HUAWEI ETHERNET DRIVER
M: Cai Huoqing <cai.huoqing@linux.dev>
L: netdev@vger.kernel.org
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 4cbaba15d86e..e123e06ba352 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -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
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index b7ef0f0562d3..02465d959d14 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -199,6 +199,7 @@ obj-$(CONFIG_SENSORS_SCH5636) += sch5636.o
obj-$(CONFIG_SENSORS_SFCTEMP) += sfctemp.o
obj-$(CONFIG_SENSORS_SG2042_MCU) += sg2042-mcu.o
obj-$(CONFIG_SENSORS_SL28CPLD) += sl28cpld-hwmon.o
+obj-$(CONFIG_SENSORS_HTU31) += htu31.o
obj-$(CONFIG_SENSORS_SHT15) += sht15.o
obj-$(CONFIG_SENSORS_SHT21) += sht21.o
obj-$(CONFIG_SENSORS_SHT3x) += sht3x.o
diff --git a/drivers/hwmon/htu31.c b/drivers/hwmon/htu31.c
new file mode 100644
index 000000000000..4036030e68a6
--- /dev/null
+++ b/drivers/hwmon/htu31.c
@@ -0,0 +1,345 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * The driver for Measurement Specialties HTU31 Temperature and Humidity sensor.
+ *
+ * Copyright (C) 2025
+ * Author: Andrei Lalaev <andrey.lalaev@gmail.com>
+ */
+
+#include <linux/array_size.h>
+#include <linux/cleanup.h>
+#include <linux/crc8.h>
+#include <linux/delay.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+#include <linux/i2c.h>
+#include <linux/init.h>
+#include <linux/module.h>
+
+#define HTU31_READ_TEMP_HUM_CMD 0x00
+#define HTU31_READ_SERIAL_CMD 0x0a
+#define HTU31_CONVERSION_CMD 0x5e
+#define HTU31_HEATER_OFF_CMD 0x02
+#define HTU31_HEATER_ON_CMD 0x04
+
+#define HTU31_TEMP_HUM_LEN 6
+
+/* Conversion time for the highest resolution */
+#define HTU31_HUMIDITY_CONV_TIME 10000 /* us */
+#define HTU31_TEMPERATURE_CONV_TIME 15000 /* us */
+
+#define HTU31_SERIAL_NUMBER_LEN 3
+#define HTU31_SERIAL_NUMBER_CRC_LEN 1
+#define HTU31_SERIAL_NUMBER_CRC_OFFSET 3
+
+#define HTU31_CRC8_INIT_VAL 0
+#define HTU31_CRC8_POLYNOMIAL 0x31
+DECLARE_CRC8_TABLE(htu31_crc8_table);
+
+/**
+ * struct htu31_data - all the data required to operate a HTU31 chip
+ * @client: the i2c client associated with the HTU31
+ * @lock: a mutex to prevent parallel access to the data
+ * @wait_time: the time needed by sensor to convert values
+ * @temperature: the latest temperature value in millidegrees
+ * @humidity: the latest relative humidity value in millipercent
+ * @serial_number: the serial number of the sensor
+ * @heater_enable: the internal state of the heater
+ */
+struct htu31_data {
+ struct i2c_client *client;
+ struct mutex lock; /* Used to protect against parallel data updates */
+ long wait_time;
+ long temperature;
+ long humidity;
+ u8 serial_number[HTU31_SERIAL_NUMBER_LEN];
+ bool heater_enable;
+};
+
+static long htu31_temp_to_millicelsius(u16 val)
+{
+ return -40000 + DIV_ROUND_CLOSEST_ULL(165000ULL * val, 65535);
+}
+
+static long htu31_relative_humidity(u16 val)
+{
+ return DIV_ROUND_CLOSEST_ULL(100000ULL * val, 65535);
+}
+
+static int htu31_data_fetch_command(struct htu31_data *data)
+{
+ struct i2c_client *client = data->client;
+ u8 conversion_on = HTU31_CONVERSION_CMD;
+ u8 read_data_cmd = HTU31_READ_TEMP_HUM_CMD;
+ u8 t_h_buf[HTU31_TEMP_HUM_LEN] = {};
+ struct i2c_msg msgs[] = {
+ {
+ .addr = client->addr,
+ .flags = 0,
+ .len = 1,
+ .buf = &read_data_cmd,
+ },
+ {
+ .addr = client->addr,
+ .flags = I2C_M_RD,
+ .len = sizeof(t_h_buf),
+ .buf = t_h_buf,
+ },
+ };
+ int ret;
+ u8 crc;
+
+ guard(mutex)(&data->lock);
+
+ ret = i2c_master_send(client, &conversion_on, 1);
+ if (ret != 1) {
+ ret = ret < 0 ? ret : -EIO;
+ dev_err(&client->dev,
+ "Conversion command is failed. Error code: %d\n", ret);
+ return ret;
+ }
+
+ fsleep(data->wait_time);
+
+ ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
+ if (ret != ARRAY_SIZE(msgs)) {
+ ret = ret < 0 ? ret : -EIO;
+ dev_err(&client->dev,
+ "T&H command is failed. Error code: %d\n", ret);
+ return ret;
+ }
+
+ crc = crc8(htu31_crc8_table, &t_h_buf[0], 2, HTU31_CRC8_INIT_VAL);
+ if (crc != t_h_buf[2]) {
+ dev_err(&client->dev, "Temperature CRC mismatch\n");
+ return -EIO;
+ }
+
+ crc = crc8(htu31_crc8_table, &t_h_buf[3], 2, HTU31_CRC8_INIT_VAL);
+ if (crc != t_h_buf[5]) {
+ dev_err(&client->dev, "Humidity CRC mismatch\n");
+ return -EIO;
+ }
+
+ data->temperature = htu31_temp_to_millicelsius(be16_to_cpup((__be16 *)&t_h_buf[0]));
+ data->humidity = htu31_relative_humidity(be16_to_cpup((__be16 *)&t_h_buf[3]));
+
+ return 0;
+}
+
+static umode_t htu31_is_visible(const void *data, enum hwmon_sensor_types type,
+ u32 attr, int channel)
+{
+ switch (type) {
+ case hwmon_temp:
+ case hwmon_humidity:
+ return 0444;
+ default:
+ return 0;
+ }
+}
+
+static int htu31_read(struct device *dev, enum hwmon_sensor_types type,
+ u32 attr, int channel, long *val)
+{
+ struct htu31_data *data = dev_get_drvdata(dev);
+ int ret;
+
+ ret = htu31_data_fetch_command(data);
+ if (ret < 0)
+ return ret;
+
+ switch (type) {
+ case hwmon_temp:
+ if (attr != hwmon_temp_input)
+ return -EINVAL;
+
+ *val = data->temperature;
+ break;
+ case hwmon_humidity:
+ if (attr != hwmon_humidity_input)
+ return -EINVAL;
+
+ *val = data->humidity;
+ break;
+ default:
+ return -EOPNOTSUPP;
+ }
+
+ return 0;
+}
+
+static int htu31_read_serial_number(struct htu31_data *data)
+{
+ struct i2c_client *client = data->client;
+ u8 read_sn_cmd = HTU31_READ_SERIAL_CMD;
+ u8 sn_buf[HTU31_SERIAL_NUMBER_LEN + HTU31_SERIAL_NUMBER_CRC_LEN];
+ struct i2c_msg msgs[] = {
+ {
+ .addr = client->addr,
+ .flags = 0,
+ .len = 1,
+ .buf = &read_sn_cmd,
+ },
+ {
+ .addr = client->addr,
+ .flags = I2C_M_RD,
+ .len = sizeof(sn_buf),
+ .buf = sn_buf,
+ },
+ };
+ int ret;
+ u8 crc;
+
+ ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
+ if (ret < 0)
+ return ret;
+
+ crc = crc8(htu31_crc8_table, sn_buf, HTU31_SERIAL_NUMBER_LEN, HTU31_CRC8_INIT_VAL);
+ if (crc != sn_buf[HTU31_SERIAL_NUMBER_CRC_OFFSET]) {
+ dev_err(&client->dev, "Serial number CRC mismatch\n");
+ return -EIO;
+ }
+
+ memcpy(data->serial_number, sn_buf, HTU31_SERIAL_NUMBER_LEN);
+
+ return 0;
+}
+
+static ssize_t heater_enable_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct htu31_data *data = dev_get_drvdata(dev);
+
+ return sysfs_emit(buf, "%d\n", data->heater_enable);
+}
+
+static ssize_t heater_enable_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf,
+ size_t count)
+{
+ struct htu31_data *data = dev_get_drvdata(dev);
+ u8 heater_cmd;
+ bool status;
+ int ret;
+
+ ret = kstrtobool(buf, &status);
+ if (ret)
+ return ret;
+
+ heater_cmd = status ? HTU31_HEATER_ON_CMD : HTU31_HEATER_OFF_CMD;
+
+ guard(mutex)(&data->lock);
+
+ ret = i2c_master_send(data->client, &heater_cmd, 1);
+ if (ret < 0)
+ return ret;
+
+ data->heater_enable = status;
+
+ return count;
+}
+
+static DEVICE_ATTR_RW(heater_enable);
+
+static ssize_t serial_number_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct htu31_data *data = dev_get_drvdata(dev);
+
+ return sysfs_emit(buf, "%X%X%X\n", data->serial_number[0],
+ data->serial_number[1],
+ data->serial_number[2]);
+}
+
+static DEVICE_ATTR_RO(serial_number);
+
+static struct attribute *htu31_attrs[] = {
+ &dev_attr_heater_enable.attr,
+ &dev_attr_serial_number.attr,
+ NULL
+};
+
+ATTRIBUTE_GROUPS(htu31);
+
+static const struct hwmon_channel_info * const htu31_info[] = {
+ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
+ HWMON_CHANNEL_INFO(humidity, HWMON_H_INPUT),
+ NULL
+};
+
+static const struct hwmon_ops htu31_hwmon_ops = {
+ .is_visible = htu31_is_visible,
+ .read = htu31_read,
+};
+
+static const struct hwmon_chip_info htu31_chip_info = {
+ .info = htu31_info,
+ .ops = &htu31_hwmon_ops,
+};
+
+static int htu31_probe(struct i2c_client *client)
+{
+ struct device *dev = &client->dev;
+ struct device *hwmon_dev;
+ struct htu31_data *data;
+ int ret;
+
+ data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+
+ data->client = client;
+ data->wait_time = HTU31_TEMPERATURE_CONV_TIME + HTU31_HUMIDITY_CONV_TIME;
+
+ ret = devm_mutex_init(dev, &data->lock);
+ if (ret)
+ return ret;
+
+ crc8_populate_msb(htu31_crc8_table, HTU31_CRC8_POLYNOMIAL);
+
+ ret = htu31_read_serial_number(data);
+ if (ret) {
+ dev_err(dev, "Failed to read serial number\n");
+ return ret;
+ }
+
+ hwmon_dev = devm_hwmon_device_register_with_info(dev,
+ client->name,
+ data,
+ &htu31_chip_info,
+ htu31_groups);
+
+ return PTR_ERR_OR_ZERO(hwmon_dev);
+}
+
+static const struct i2c_device_id htu31_id[] = {
+ { "htu31" },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, htu31_id);
+
+#if IS_ENABLED(CONFIG_OF)
+static const struct of_device_id htu31_of_match[] = {
+ { .compatible = "meas,htu31" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, htu31_of_match);
+#endif
+
+static struct i2c_driver htu31_driver = {
+ .driver = {
+ .name = "htu31",
+ .of_match_table = of_match_ptr(htu31_of_match),
+ },
+ .probe = htu31_probe,
+ .id_table = htu31_id,
+};
+module_i2c_driver(htu31_driver);
+
+MODULE_AUTHOR("Andrei Lalaev <andrey.lalaev@gmail.com>");
+MODULE_DESCRIPTION("HTU31 Temperature and Humidity sensor driver");
+MODULE_LICENSE("GPL");
--
2.48.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/2] dt-bindings: hwmon: Add description for sensor HTU31
2025-01-26 14:40 [PATCH v2 0/2] Add driver for HTU31 Andrei Lalaev
2025-01-26 14:40 ` [PATCH 1/2] hwmon: add " Andrei Lalaev
@ 2025-01-26 14:40 ` Andrei Lalaev
2025-01-27 7:07 ` Krzysztof Kozlowski
1 sibling, 1 reply; 12+ messages in thread
From: Andrei Lalaev @ 2025-01-26 14:40 UTC (permalink / raw)
To: jdelvare, linux, conor+dt, robh, krzk, christophe.jaillet
Cc: linux-hwmon, linux-kernel, devicetree, andrey.lalaev,
Krzysztof Kozlowski
Add trivial binding for HTU31 Temperature and Humidity sensor.
Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index 6bdcd055e763..294e8f9bfb4a 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -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
--
2.48.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] hwmon: add driver for HTU31
2025-01-26 14:40 ` [PATCH 1/2] hwmon: add " Andrei Lalaev
@ 2025-01-26 14:59 ` Guenter Roeck
2025-01-26 19:16 ` Andrei Lalaev
0 siblings, 1 reply; 12+ messages in thread
From: Guenter Roeck @ 2025-01-26 14:59 UTC (permalink / raw)
To: Andrei Lalaev, jdelvare, conor+dt, robh, krzk, christophe.jaillet
Cc: linux-hwmon, linux-kernel, devicetree
On 1/26/25 06:40, Andrei Lalaev wrote:
> Add base support for HTU31 temperature and humidity sensor.
>
> Besides temperature and humidity values, the driver also exports a 24-bit
> serial number and heater control to sysfs.
>
> Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
> ---
...
> +
> +static struct attribute *htu31_attrs[] = {
> + &dev_attr_heater_enable.attr,
> + &dev_attr_serial_number.attr,
I'll accept the heater enable attribute as sysfs attribute,
but the serial number is most definitely not a hardware monitoring
attribute. Please expose is through debugfs.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] hwmon: add driver for HTU31
2025-01-26 14:59 ` Guenter Roeck
@ 2025-01-26 19:16 ` Andrei Lalaev
2025-01-26 19:36 ` Guenter Roeck
0 siblings, 1 reply; 12+ messages in thread
From: Andrei Lalaev @ 2025-01-26 19:16 UTC (permalink / raw)
To: Guenter Roeck, jdelvare, conor+dt, robh, krzk, christophe.jaillet
Cc: linux-hwmon, linux-kernel, devicetree
On 26.01.2025 15:59, Guenter Roeck wrote:
> On 1/26/25 06:40, Andrei Lalaev wrote:
>> Add base support for HTU31 temperature and humidity sensor.
>>
>> Besides temperature and humidity values, the driver also exports a 24-bit
>> serial number and heater control to sysfs.
>>
>> Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
>> ---
> ...
>> +
>> +static struct attribute *htu31_attrs[] = {
>> + &dev_attr_heater_enable.attr,
>> + &dev_attr_serial_number.attr,
>
> I'll accept the heater enable attribute as sysfs attribute,
> but the serial number is most definitely not a hardware monitoring
> attribute. Please expose is through debugfs.
It makes sense. Will be moved to debugfs in v3.
Thank you!
Best regards,
Andrei Lalaev
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] hwmon: add driver for HTU31
2025-01-26 19:16 ` Andrei Lalaev
@ 2025-01-26 19:36 ` Guenter Roeck
0 siblings, 0 replies; 12+ messages in thread
From: Guenter Roeck @ 2025-01-26 19:36 UTC (permalink / raw)
To: Andrei Lalaev, jdelvare, conor+dt, robh, krzk, christophe.jaillet
Cc: linux-hwmon, linux-kernel, devicetree
On 1/26/25 11:16, Andrei Lalaev wrote:
> On 26.01.2025 15:59, Guenter Roeck wrote:
>> On 1/26/25 06:40, Andrei Lalaev wrote:
>>> Add base support for HTU31 temperature and humidity sensor.
>>>
>>> Besides temperature and humidity values, the driver also exports a 24-bit
>>> serial number and heater control to sysfs.
>>>
>>> Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
>>> ---
>> ...
>>> +
>>> +static struct attribute *htu31_attrs[] = {
>>> + &dev_attr_heater_enable.attr,
>>> + &dev_attr_serial_number.attr,
>>
>> I'll accept the heater enable attribute as sysfs attribute,
>> but the serial number is most definitely not a hardware monitoring
>> attribute. Please expose is through debugfs.
>
> It makes sense. Will be moved to debugfs in v3.
>
Note that there is now a ->debugfs pointer in struct i2c_client.
You can use that pointer to attach debugfs files, and there is no
need to remove the files in the remove function.
Guenter
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] dt-bindings: hwmon: Add description for sensor HTU31
2025-01-26 14:40 ` [PATCH 2/2] dt-bindings: hwmon: Add description for sensor HTU31 Andrei Lalaev
@ 2025-01-27 7:07 ` Krzysztof Kozlowski
2025-01-27 19:21 ` Andrei Lalaev
0 siblings, 1 reply; 12+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-27 7:07 UTC (permalink / raw)
To: Andrei Lalaev
Cc: jdelvare, linux, conor+dt, robh, christophe.jaillet, linux-hwmon,
linux-kernel, devicetree
On Sun, Jan 26, 2025 at 03:40:56PM +0100, Andrei Lalaev wrote:
> Add trivial binding for HTU31 Temperature and Humidity sensor.
>
> Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
> Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
> 1 file changed, 2 insertions(+)
>
Please version your patchsets correctly. `git format-patch -v2` or b4.
This is not v1 and you could not get my ack on v1.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] dt-bindings: hwmon: Add description for sensor HTU31
2025-01-27 7:07 ` Krzysztof Kozlowski
@ 2025-01-27 19:21 ` Andrei Lalaev
2025-01-27 19:39 ` Krzysztof Kozlowski
0 siblings, 1 reply; 12+ messages in thread
From: Andrei Lalaev @ 2025-01-27 19:21 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: jdelvare, linux, conor+dt, robh, christophe.jaillet, linux-hwmon,
linux-kernel, devicetree
On 27.01.2025 08:07, Krzysztof Kozlowski wrote:
> On Sun, Jan 26, 2025 at 03:40:56PM +0100, Andrei Lalaev wrote:
>> Add trivial binding for HTU31 Temperature and Humidity sensor.
>>
>> Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
>> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> ---
>> Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>
> Please version your patchsets correctly. `git format-patch -v2` or b4.
>
> This is not v1 and you could not get my ack on v1.
>
Oh, my bad, sorry, I manually edited the cover letter and forgot about patches' subjects :/
Should I resend v2 with normal versioning, or would you prefer me to go straight to v3?
Best regards,
Andrei Lalaev
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] dt-bindings: hwmon: Add description for sensor HTU31
2025-01-27 19:21 ` Andrei Lalaev
@ 2025-01-27 19:39 ` Krzysztof Kozlowski
2025-01-27 20:14 ` Guenter Roeck
0 siblings, 1 reply; 12+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-27 19:39 UTC (permalink / raw)
To: Andrei Lalaev
Cc: jdelvare, linux, conor+dt, robh, christophe.jaillet, linux-hwmon,
linux-kernel, devicetree
On 27/01/2025 20:21, Andrei Lalaev wrote:
> On 27.01.2025 08:07, Krzysztof Kozlowski wrote:
>> On Sun, Jan 26, 2025 at 03:40:56PM +0100, Andrei Lalaev wrote:
>>> Add trivial binding for HTU31 Temperature and Humidity sensor.
>>>
>>> Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
>>> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>> ---
>>> Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>
>> Please version your patchsets correctly. `git format-patch -v2` or b4.
>>
>> This is not v1 and you could not get my ack on v1.
>>
>
> Oh, my bad, sorry, I manually edited the cover letter and forgot about patches' subjects :/
>
> Should I resend v2 with normal versioning, or would you prefer me to go straight to v3?
Tools might work fine with it, so no need to resend, unless Guenter
asks. But if you send v3 for any reason, be sure to mark all of the patches.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] dt-bindings: hwmon: Add description for sensor HTU31
2025-01-27 19:39 ` Krzysztof Kozlowski
@ 2025-01-27 20:14 ` Guenter Roeck
0 siblings, 0 replies; 12+ messages in thread
From: Guenter Roeck @ 2025-01-27 20:14 UTC (permalink / raw)
To: Krzysztof Kozlowski, Andrei Lalaev
Cc: jdelvare, conor+dt, robh, christophe.jaillet, linux-hwmon,
linux-kernel, devicetree
On 1/27/25 11:39, Krzysztof Kozlowski wrote:
> On 27/01/2025 20:21, Andrei Lalaev wrote:
>> On 27.01.2025 08:07, Krzysztof Kozlowski wrote:
>>> On Sun, Jan 26, 2025 at 03:40:56PM +0100, Andrei Lalaev wrote:
>>>> Add trivial binding for HTU31 Temperature and Humidity sensor.
>>>>
>>>> Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
>>>> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>>> ---
>>>> Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
>>>> 1 file changed, 2 insertions(+)
>>>>
>>>
>>> Please version your patchsets correctly. `git format-patch -v2` or b4.
>>>
>>> This is not v1 and you could not get my ack on v1.
>>>
>>
>> Oh, my bad, sorry, I manually edited the cover letter and forgot about patches' subjects :/
>>
>> Should I resend v2 with normal versioning, or would you prefer me to go straight to v3?
>
> Tools might work fine with it, so no need to resend, unless Guenter
> asks. But if you send v3 for any reason, be sure to mark all of the patches.
>
Please no resend just to add version numbers to the patches.
Guenter
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-01-27 20:14 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-26 14:40 [PATCH v2 0/2] Add driver for HTU31 Andrei Lalaev
2025-01-26 14:40 ` [PATCH 1/2] hwmon: add " Andrei Lalaev
2025-01-26 14:59 ` Guenter Roeck
2025-01-26 19:16 ` Andrei Lalaev
2025-01-26 19:36 ` Guenter Roeck
2025-01-26 14:40 ` [PATCH 2/2] dt-bindings: hwmon: Add description for sensor HTU31 Andrei Lalaev
2025-01-27 7:07 ` Krzysztof Kozlowski
2025-01-27 19:21 ` Andrei Lalaev
2025-01-27 19:39 ` Krzysztof Kozlowski
2025-01-27 20:14 ` Guenter Roeck
-- strict thread matches above, loose matches on Subject: below --
2025-01-23 20:25 [PATCH 0/2] Add driver for HTU31 Andrei Lalaev
2025-01-23 20:25 ` [PATCH 2/2] dt-bindings: hwmon: Add description for sensor HTU31 Andrei Lalaev
2025-01-24 8:26 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).