Documentation/w1/slaves/w1_therm.rst

Source file repositories/reference/linux-study-clean/Documentation/w1/slaves/w1_therm.rst

File Facts

System
Linux kernel
Corpus path
Documentation/w1/slaves/w1_therm.rst
Extension
.rst
Size
7136 bytes
Lines
145
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

======================
Kernel driver w1_therm
======================

Supported chips:

  * Maxim ds18*20 based temperature sensors.
  * Maxim ds1825 based temperature sensors.
  * GXCAS GX20MH01 temperature sensor.
  * Maxim MAX31850 thermoelement interface.

Author: Evgeniy Polyakov <johnpol@2ka.mipt.ru>


Description
-----------

w1_therm provides basic temperature conversion for ds18*20, ds28ea00, GX20MH01
and MAX31850 devices.

Supported family codes:

====================	====
W1_THERM_DS18S20	0x10
W1_THERM_DS1822		0x22
W1_THERM_DS18B20	0x28
W1_THERM_DS1825		0x3B
W1_THERM_DS28EA00	0x42
====================	====

Support is provided through the sysfs entry ``w1_slave``. Each open and
read sequence will initiate a temperature conversion, then provide two
lines of ASCII output. The first line contains the nine hex bytes
read along with a calculated crc value and YES or NO if it matched.
If the crc matched the returned values are retained. The second line
displays the retained values along with a temperature in millidegrees
Centigrade after t=.

Alternatively, temperature can be read using ``temperature`` sysfs, it
returns only the temperature in millidegrees Centigrade.

A bulk read of all devices on the bus could be done writing ``trigger``
to ``therm_bulk_read`` entry at w1_bus_master level. This will
send the convert command to all devices on the bus, and if parasite
powered devices are detected on the bus (and strong pullup is enabled
in the module), it will drive the line high during the longer conversion
time required by parasited powered device on the line. Reading
``therm_bulk_read`` will return 0 if no bulk conversion pending,
-1 if at least one sensor still in conversion, 1 if conversion is complete
but at least one sensor value has not been read yet. Result temperature is
then accessed by reading the ``temperature`` entry of each device, which
may return empty if conversion is still in progress. Note that if a bulk
read is sent but one sensor is not read immediately, the next access to
``temperature`` on this device will return the temperature measured at the
time of issue of the bulk read command (not the current temperature).

A strong pullup will be applied during the conversion if required.

``conv_time`` is used to get current conversion time (read), and
adjust it (write). A temperature conversion time depends on the device type and
its current resolution. Default conversion time is set by the driver according
to the device datasheet. A conversion time for many original device clones
deviate from datasheet specs. There are three options: 1) manually set the
correct conversion time by writing a value in milliseconds to ``conv_time``; 2)
auto measure and set a conversion time by writing ``1`` to
``conv_time``; 3) use ``features`` to enable poll for conversion
completion. Options 2, 3 can't be used in parasite power mode. To get back to
the default conversion time write ``0`` to ``conv_time``.

Writing a resolution value (in bits) to ``w1_slave`` will change the

Annotation

Implementation Notes