xref: /linux/Documentation/w1/slaves/w1_ds2438.rst (revision bdd1a21b52557ea8f61d0a5dc2f77151b576eb70)
1Kernel driver w1_ds2438
2=======================
3
4Supported chips:
5
6  * Maxim DS2438 Smart Battery Monitor
7
8supported family codes:
9        ================        ====
10        W1_FAMILY_DS2438        0x26
11        ================        ====
12
13Author: Mariusz Bialonczyk <manio@skyboo.net>
14
15Description
16-----------
17
18The DS2438 chip provides several functions that are desirable to carry in
19a battery pack. It also has a 40 bytes of nonvolatile EEPROM.
20Because the ability of temperature, current and voltage measurement, the chip
21is also often used in weather stations and applications such as: rain gauge,
22wind speed/direction measuring, humidity sensing, etc.
23
24Current support is provided through the following sysfs files (all files
25except "iad" and "offset" are readonly):
26
27"iad"
28-----
29This file controls the 'Current A/D Control Bit' (IAD) in the
30Status/Configuration Register.
31Writing a zero value will clear the IAD bit and disables the current
32measurements.
33Writing value "1" is setting the IAD bit (enables the measurements).
34The IAD bit is enabled by default in the DS2438.
35
36When writing to sysfs file bits 2-7 are ignored, so it's safe to write ASCII.
37An I/O error is returned when there is a problem setting the new value.
38
39"page0"
40-------
41This file provides full 8 bytes of the chip Page 0 (00h).
42This page contains the most frequently accessed information of the DS2438.
43Internally when this file is read, the additional CRC byte is also obtained
44from the slave device. If it is correct, the 8 bytes page data are passed
45to userspace, otherwise an I/O error is returned.
46
47"page1"
48-------
49This file provides full 8 bytes of the chip Page 1 (01h).
50This page contains the ICA, elapsed time meter and current offset data of the DS2438.
51Internally when this file is read, the additional CRC byte is also obtained
52from the slave device. If it is correct, the 8 bytes page data are passed
53to userspace, otherwise an I/O error is returned.
54
55"offset"
56--------
57This file controls the 2-byte Offset Register of the chip.
58Writing a 2-byte value will change the Offset Register, which changes the
59current measurement done by the chip. Changing this register to the two's complement
60of the current register while forcing zero current through the load will calibrate
61the chip, canceling offset errors in the current ADC.
62
63
64"temperature"
65-------------
66Opening and reading this file initiates the CONVERT_T (temperature conversion)
67command of the chip, afterwards the temperature is read from the device
68registers and provided as an ASCII decimal value.
69
70Important: The returned value has to be divided by 256 to get a real
71temperature in degrees Celsius.
72
73"vad", "vdd"
74------------
75Opening and reading this file initiates the CONVERT_V (voltage conversion)
76command of the chip.
77
78Depending on a sysfs filename a different input for the A/D will be selected:
79
80vad:
81    general purpose A/D input (VAD)
82vdd:
83    battery input (VDD)
84
85After the voltage conversion the value is returned as decimal ASCII.
86Note: To get a volts the value has to be divided by 100.
87