Skip to contentSkip to conversation

w1_therm: optimizing temperature read timings

PATCH Superseded Akira Shimahara 1 participant 1 message May 10, 2020 W1 dallas's 1-wire bus

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 7/9 w1_therm: optimizing temperature read timings

Optimizing temperature reading by reducing waiting conversion time according to device resolution settings, as per device specification. This is device dependent as not all the devices supports resolution setting, so it has been added in device family structures.

The process to read the temperature on the device has been adapted in a new function 'convert_t()', which replace the former 'read_therm()', is introduce to deal with this timing. Strong pull up is also applied during the required time, according to device power status needs and 'strong_pullup' module parameter.

'temperature_from_RAM()' function is introduced to get the correct temperature computation (device dependent) from device RAM data.

An new sysfs entry has been added to ouptut only temperature. The old entry w1_slave has been kept for compatibility, without changing its output format.

Updating Documentation/ABI/testing/sysfs-driver-w1_therm accordingly.

---
Changes in v5:
- All patch serie in one .c file
- Correcting some comments
- adding <linux/string.h> include

 .../ABI/testing/sysfs-driver-w1_therm         |  12 +
 drivers/w1/slaves/w1_therm.c                  | 278 ++++++++++++------
 2 files changed, 195 insertions(+), 95 deletions(-)
Documentation/ABI/testing/sysfs-driver-w1_therm +12 -0
index 8b7ee89..6ffd3e3 100644
@@ -41,6 +41,18 @@ Users:		any user space application which wants to communicate with
 		w1_term device
 
 
+What:		/sys/bus/w1/devices/.../temperature
+Date:		May 2020
+Contact:	Akira Shimahara <[email protected]>
+Description:
+		(RO) return the temperature in 1/1000 degC.
+		Note that the conversion duration depend on the resolution (if
+		device support this feature). It takes 94ms in 9bits
+		resolution, 750ms for 12bits.
+Users:		any user space application which wants to communicate with
+		w1_term device
+
+
 What:		/sys/bus/w1/devices/.../w1_slave
 Date:		May 2020
 Contact:	Akira Shimahara <[email protected]>
drivers/w1/slaves/w1_therm.c +183 -95

436 lines not on this page · raw message

Signature · 1 line
2.26.2