diff options
author | Akira Shimahara <akira215corp@gmail.com> | 2020-05-11 22:37:08 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-05-15 16:28:59 +0200 |
commit | 308bdb94de0c1abe7eac5193f58638b8aeaddf4b (patch) | |
tree | 27d4bc995e5d5b85c9e71d04d8b2365cef13820d /Documentation | |
parent | b7bb6ca17a90f47c2fe2848531b5bbaf27a65ba7 (diff) | |
download | linux-stable-308bdb94de0c1abe7eac5193f58638b8aeaddf4b.tar.gz linux-stable-308bdb94de0c1abe7eac5193f58638b8aeaddf4b.tar.bz2 linux-stable-308bdb94de0c1abe7eac5193f58638b8aeaddf4b.zip |
w1_therm: adding resolution sysfs entry
Adding resolution sysfs entry (RW) to get or set the device resolution
Write values are managed as follow:
* '9..12': resolution to set in bit
* Anything else: do nothing
Read values are :
* '9..12': device resolution in bit
* '-xx': xx is kernel error when reading the resolution
Only supported devices will show the sysfs entry. A new family has been
created for DS18S20 devices as they do not implement resolution feature.
The resolution of each device is check when the device is
discover by the bus master, in 'w1_therm_add_slave(struct w1_slave *)'.
The status is stored in the device structure w1_therm_family_data so
that the driver always knows the resolution of each device, which could
be used later to determine the required conversion duration (resolution
dependent).
The resolution is re evaluate each time a user read or write the sysfs
entry.
To avoid looping through the w1_therm_families at run time, the pointer
'specific_functions' is set up to the correct 'w1_therm_family_converter'
when the slave is added (which mean when it is discovered by the master).
This initialization is done by a helper function
'device_family(struct w1_slave *sl)', and a dedicated macro
'SLAVE_SPECIFIC_FUNC(sl)' allow the access to the specific function of the
slave device.
'read_scratchpad' and 'write_scratchpad' are the hardware functions to
access the device RAM, as per protocol specification.
It cancel the former 'precision' functions, which was only set and never
read (so not stored in the device struct).
Updating Documentation/ABI/testing/sysfs-driver-w1_therm accordingly.
Signed-off-by: Akira Shimahara <akira215corp@gmail.com>
Link: https://lore.kernel.org/r/20200511203708.410649-1-akira215corp@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/ABI/testing/sysfs-driver-w1_therm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-driver-w1_therm b/Documentation/ABI/testing/sysfs-driver-w1_therm index 99d73eeee3db..7ed95e9e0b64 100644 --- a/Documentation/ABI/testing/sysfs-driver-w1_therm +++ b/Documentation/ABI/testing/sysfs-driver-w1_therm @@ -10,6 +10,23 @@ Users: any user space application which wants to communicate with w1_term device +What: /sys/bus/w1/devices/.../resolution +Date: May 2020 +Contact: Akira Shimahara <akira215corp@gmail.com> +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/.../w1_slave Date: May 2020 Contact: Akira Shimahara <akira215corp@gmail.com> |