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