Skip to contentSkip to conversation

hwmon: (ina3221) Add averaging mode support

PATCH Applied Nicolin Chen 2 participants 2 messages Apr 16, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hwmon: (ina3221) Add averaging mode support

The CONFIG register has a 3-bit averaging mode field for users to setup the number of samples that are collected and averaged together. This is very useful to filter noise from sensor data.

This patch adds a 'samples' sysfs node using hwmon_chip_samples of hwmon core, and updates wait time calculation by taking this samples value into account.

---
Changelog
v1->v2:
* Implemented "samples" through hwmon_chip_info
* Used find_closest()

 Documentation/hwmon/ina3221 |  3 ++
 drivers/hwmon/ina3221.c     | 67 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 69 insertions(+), 1 deletion(-)
Documentation/hwmon/ina3221 +3 -0
index 4b82cbfb551c..ed3f22769d4b 100644
@@ -35,3 +35,6 @@ curr[123]_max           Warning alert current(mA) setting, activates the
                           average is above this value.
 curr[123]_max_alarm     Warning alert current limit exceeded
 in[456]_input           Shunt voltage(uV) for channels 1, 2, and 3 respectively
+samples                 Number of samples using in the averaging mode.
+                          Supports the list of number of samples:
+                          1, 4, 16, 64, 128, 256, 512, 1024
drivers/hwmon/ina3221.c +66 -1

131 lines not on this page · raw message

Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 9 lines · Nicolin Chen

The CONFIG register has a 3-bit averaging mode field for users to setup the number of samples that are collected and averaged together. This is very useful to filter noise from sensor data.

This patch adds a 'samples' sysfs node using hwmon_chip_samples of hwmon core, and updates wait time calculation by taking this samples value into account.

Applied to hwmon-next.

Thanks,
Guenter