1 ========================================= 2 Introduction to the 1-wire (w1) subsystem 3 ========================================= 4 5 The 1-wire bus is a simple master-slave bus th 6 signal wire (plus ground, so two wires). 7 8 Devices communicate on the bus by pulling the 9 drain output and by sampling the logic level o 10 11 The w1 subsystem provides the framework for ma 12 communication with slaves. 13 14 All w1 slave devices must be connected to a w1 15 16 Example w1 master devices: 17 18 - DS9490 usb device 19 - W1-over-GPIO 20 - DS2482 (i2c to w1 bridge) 21 - Emulated devices, such as a RS232 conver 22 23 24 What does the w1 subsystem do? 25 ------------------------------ 26 27 When a w1 master driver registers with the w1 28 29 - sysfs entries for that w1 master are create 30 - the w1 bus is periodically searched for new 31 32 When a device is found on the bus, w1 core tri 33 and check if it is loaded. If so, the family d 34 If there is no driver for the family, default 35 almost any kind of operations. Each logical op 36 in nature, which can contain several (two or o 37 Let's see how one can read EEPROM context: 38 1. one must write control buffer, i.e. buffer 39 and two byte address. At this step bus is rese 40 is selected using either W1_SKIP_ROM or W1_MAT 41 Then provided control buffer is being written 42 2. reading. This will issue reading eeprom res 43 44 It is possible that between 1. and 2. w1 maste 45 and slave device will be even removed, but in 46 be read, since no device was selected. 47 48 49 W1 device families 50 ------------------ 51 52 Slave devices are handled by a driver written 53 54 A family driver populates a struct w1_family_o 55 registers with the w1 subsystem. 56 57 Current family drivers: 58 59 w1_therm 60 - (ds18?20 thermal sensor family driver) 61 provides temperature reading function whic 62 of the above w1_family_ops structure. 63 64 w1_smem 65 - driver for simple 64bit memory cell provid 66 67 You can call above methods by reading appropri 68 69 70 What does a w1 master driver need to implement 71 ---------------------------------------------- 72 73 The driver for w1 bus master must provide at m 74 75 Emulated devices must provide the ability to s 76 (write_bit) and sample the signal level (read_ 77 78 Devices that support the 1-wire natively must 79 sample a bit (touch_bit) and reset the bus (re 80 81 Most hardware provides higher-level functions 82 See struct w1_bus_master definition in w1.h fo 83 84 85 w1 master sysfs interface 86 ------------------------- 87 88 ========================= ==================== 89 <xx-xxxxxxxxxxxx> A directory for a fo 90 family-serial 91 bus (standard) symlink t 92 driver (standard) symlink t 93 w1_master_add (rw) manually regist 94 w1_master_attempts (ro) the number of t 95 w1_master_max_slave_count (rw) maximum number 96 w1_master_name (ro) the name of the 97 w1_master_pullup (rw) 5V strong pullu 98 w1_master_remove (rw) manually remove 99 w1_master_search (rw) the number of s 100 -1=continual (defaul 101 w1_master_slave_count (ro) the number of s 102 w1_master_slaves (ro) the names of th 103 w1_master_timeout (ro) the delay in se 104 w1_master_timeout_us (ro) the delay in mi 105 ========================= ==================== 106 107 If you have a w1 bus that never changes (you d 108 you can set the module parameter search_count 109 for an initially small number of bus searches. 110 set to zero, then manually add the slave devic 111 w1_master_add device file. The w1_master_add 112 generally only make sense when searching is di 113 redetect manually removed devices that are pre 114 added devices that aren't on the bus. 115 116 Bus searches occur at an interval, specified a 117 timeout_us module parameters (either of which 118 w1_master_search remains greater than 0 or is 119 decrements w1_master_search by 1 (down to 0) a 120 w1_master_attempts by 1. 121 122 w1 slave sysfs interface 123 ------------------------ 124 125 =================== ========================== 126 bus (standard) symlink to the 127 driver (standard) symlink to the 128 name the device name, usually t 129 w1_slave (optional) a binary file w 130 family driver 131 rw (optional) created for sla 132 appropriate family driver. 133 =================== ==========================
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.