w1_therm: Optimizing read timing by checking device resolution. Updating documentation
PATCH v3 3/5 w1_therm: Optimizing read timing by checking device resolution. Updating documentation
Patch for enhacement of w1_therm module. Added features :
- Optimized conversion time regarding to device resolution
- Dedicated sysfs entry for, resolution set/get, eeprom save/restore, and additionnal temperature entry to ease user data collect.
- Code optimization to mitigate bus traffic
The status of each device (power status and resolution if supported) is stored in a dedicated structure in the driver, so that device are not interrogated during temperature conversion process. The status is evaluated as soon as a device is connected on the bus, and re evaluated when user either set values either by get them, using the corresponding sysfs entry.
A dedicated EEPROM sysfs entry allow the user to save or restore device registers from/to device EEPROM.
Updating Documentation/ABI/testing/sysfs-driver-w1_therm accordingly with w1_therm_add_slavenew sysfs entries
--- .../ABI/testing/sysfs-driver-w1_therm | 43 + drivers/w1/slaves/w1_therm.c | 785 +++++++++++++----- drivers/w1/slaves/w1_therm.h | 168 +++- 3 files changed, 760 insertions(+), 236 deletions(-)
Documentation/ABI/testing/sysfs-driver-w1_therm +43 -0
@@ -1,3 +1,17 @@ +What: /sys/bus/w1/devices/.../eeprom +Date: Apr 2020 +Contact: Akira Shimahara <[email protected]> +Description: + (WO) writing that file will either trigger a save of the + device data to its embedded EEPROM, either restore data + embedded in device EEPROM. Be aware that devices support + limited EEPROM writing cycles (typical 50k) + * `save`: save device RAM to EEPROM + * `restore`: restore EEPROM data in device RAM +Users: any user space application which wants to communicate with + w1_term device + + What: /sys/bus/w1/devices/.../ext_power Date: Apr 2020 Contact: Akira Shimahara <[email protected]>
@@ -10,6 +24,35 @@ Users: any user space application which wants to communicate with w1_term device +What: /sys/bus/w1/devices/.../resolution +Date: Apr 2020 +Contact: Akira Shimahara <[email protected]> +Description: + (RW) get or set the device resolution (on supported devices, + if not, this entry is not present). Note that the resolution + will be changed only in device RAM, so it will be cleared when + power is lost. Trigger a `save` to EEPROM command to keep + values after power-on. Read or write are : + * `9..12`: device resolution in bit + or resolution to set in bit + * `-xx`: xx is kernel error when reading the resolution + * Anything else: do nothing +Users: any user space application which wants to communicate with + w1_term device + + +What: /sys/bus/w1/devices/.../temperature +Date: Apr 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: Apr 2020 Contact: Akira Shimahara <[email protected]>
drivers/w1/slaves/w1_therm.c +565 -220
1,025 lines not on this page · raw message
drivers/w1/slaves/w1_therm.h +152 -16
257 lines not on this page · raw message
Signature · 1 line
2.25.4
Quoted 5 lines · Akira Shimahara
Patch for enhacement of
w1_thermmodule. Added features :
- Optimized conversion time regarding to device resolution
- Dedicated sysfs entry for, resolution set/get, eeprom save/restore, and additionnal temperature entry to ease user data collect.
- Code optimization to mitigate bus traffic
When you have to list different things you did in a single patch, that's a huge sign it needs to be multiple patches. Please break this up into one-logical-change-per-patch.
thanks,
greg k-h
Quoted 8 lines · Greg KH
Quoted 6 lines · Akira Shimahara
Patch for enhacement of
w1_thermmodule. Added features :
- Optimized conversion time regarding to device resolution
- Dedicated sysfs entry for, resolution set/get, eeprom
save/restore,
and additionnal temperature entry to ease user data collect.
- Code optimization to mitigate bus traffic
Quoted 6 lines
When you have to list different things you did in a single patch, that's
a huge sign it needs to be multiple patches. Please break this up into
one-logical-change-per-patch.
I will try but this block is hard to split as everything is connected. I will separate it, but some some patches will be useless if applied without the next ones.
Quoted 3 lines
thanks,
greg k-h