aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/w1/w1.c30
-rw-r--r--drivers/w1/w1.h136
-rw-r--r--drivers/w1/w1_family.c8
-rw-r--r--drivers/w1/w1_family.h13
-rw-r--r--drivers/w1/w1_int.c8
-rw-r--r--drivers/w1/w1_io.c102
-rw-r--r--drivers/w1/w1_netlink.h6
7 files changed, 209 insertions, 94 deletions
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 53846c7f24ff..9eb816b2ea5e 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -50,8 +50,21 @@ int w1_max_slave_count = 64;
50int w1_max_slave_ttl = 10; 50int w1_max_slave_ttl = 10;
51 51
52module_param_named(timeout, w1_timeout, int, 0); 52module_param_named(timeout, w1_timeout, int, 0);
53MODULE_PARM_DESC(timeout, "time in seconds between automatic slave searches");
54/* A search stops when w1_max_slave_count devices have been found in that
55 * search. The next search will start over and detect the same set of devices
56 * on a static 1-wire bus. Memory is not allocated based on this number, just
57 * on the number of devices known to the kernel. Having a high number does not
58 * consume additional resources. As a special case, if there is only one
59 * device on the network and w1_max_slave_count is set to 1, the device id can
60 * be read directly skipping the normal slower search process.
61 */
53module_param_named(max_slave_count, w1_max_slave_count, int, 0); 62module_param_named(max_slave_count, w1_max_slave_count, int, 0);
63MODULE_PARM_DESC(max_slave_count,
64 "maximum number of slaves detected in a search");
54module_param_named(slave_ttl, w1_max_slave_ttl, int, 0); 65module_param_named(slave_ttl, w1_max_slave_ttl, int, 0);
66MODULE_PARM_DESC(slave_ttl,
67 "Number of searches not seeing a slave before it will be removed");
55 68
56DEFINE_MUTEX(w1_mlock); 69DEFINE_MUTEX(w1_mlock);
57LIST_HEAD(w1_masters); 70LIST_HEAD(w1_masters);
@@ -920,7 +933,12 @@ void w1_slave_found(struct w1_master *dev, u64 rn)
920} 933}
921 934
922/** 935/**
923 * Performs a ROM Search & registers any devices found. 936 * w1_search() - Performs a ROM Search & registers any devices found.
937 * @dev: The master device to search
938 * @search_type: W1_SEARCH to search all devices, or W1_ALARM_SEARCH
939 * to return only devices in the alarmed state
940 * @cb: Function to call when a device is found
941 *
924 * The 1-wire search is a simple binary tree search. 942 * The 1-wire search is a simple binary tree search.
925 * For each bit of the address, we read two bits and write one bit. 943 * For each bit of the address, we read two bits and write one bit.
926 * The bit written will put to sleep all devies that don't match that bit. 944 * The bit written will put to sleep all devies that don't match that bit.
@@ -930,8 +948,6 @@ void w1_slave_found(struct w1_master *dev, u64 rn)
930 * 948 *
931 * See "Application note 187 1-wire search algorithm" at www.maxim-ic.com 949 * See "Application note 187 1-wire search algorithm" at www.maxim-ic.com
932 * 950 *
933 * @dev The master device to search
934 * @cb Function to call when a device is found
935 */ 951 */
936void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb) 952void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb)
937{ 953{
@@ -990,7 +1006,7 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
990 else 1006 else
991 search_bit = ((last_rn >> i) & 0x1); 1007 search_bit = ((last_rn >> i) & 0x1);
992 1008
993 /** Read two bits and write one bit */ 1009 /* Read two bits and write one bit */
994 triplet_ret = w1_triplet(dev, search_bit); 1010 triplet_ret = w1_triplet(dev, search_bit);
995 1011
996 /* quit if no device responded */ 1012 /* quit if no device responded */
@@ -1074,6 +1090,12 @@ static void w1_search_process(struct w1_master *dev, u8 search_type)
1074 w1_search_process_cb(dev, search_type, w1_slave_found); 1090 w1_search_process_cb(dev, search_type, w1_slave_found);
1075} 1091}
1076 1092
1093/**
1094 * w1_process_callbacks() - execute each dev->async_list callback entry
1095 * @dev: w1_master device
1096 *
1097 * Return: 1 if there were commands to executed 0 otherwise
1098 */
1077int w1_process_callbacks(struct w1_master *dev) 1099int w1_process_callbacks(struct w1_master *dev)
1078{ 1100{
1079 int ret = 0; 1101 int ret = 0;
diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h
index 0eb50502f63f..734dab7fc687 100644
--- a/drivers/w1/w1.h
+++ b/drivers/w1/w1.h
@@ -22,6 +22,13 @@
22#ifndef __W1_H 22#ifndef __W1_H
23#define __W1_H 23#define __W1_H
24 24
25/**
26 * struct w1_reg_num - broken out slave device id
27 *
28 * @family: identifies the type of device
29 * @id: along with family is the unique device id
30 * @crc: checksum of the other bytes
31 */
25struct w1_reg_num 32struct w1_reg_num
26{ 33{
27#if defined(__LITTLE_ENDIAN_BITFIELD) 34#if defined(__LITTLE_ENDIAN_BITFIELD)
@@ -60,6 +67,22 @@ struct w1_reg_num
60#define W1_SLAVE_ACTIVE 0 67#define W1_SLAVE_ACTIVE 0
61#define W1_SLAVE_DETACH 1 68#define W1_SLAVE_DETACH 1
62 69
70/**
71 * struct w1_slave - holds a single slave device on the bus
72 *
73 * @owner: Points to the one wire "wire" kernel module.
74 * @name: Device id is ascii.
75 * @w1_slave_entry: data for the linked list
76 * @reg_num: the slave id in binary
77 * @refcnt: reference count, delete when 0
78 * @flags: bit flags for W1_SLAVE_ACTIVE W1_SLAVE_DETACH
79 * @ttl: decrement per search this slave isn't found, deatch at 0
80 * @master: bus which this slave is on
81 * @family: module for device family type
82 * @family_data: pointer for use by the family module
83 * @dev: kernel device identifier
84 *
85 */
63struct w1_slave 86struct w1_slave
64{ 87{
65 struct module *owner; 88 struct module *owner;
@@ -80,77 +103,74 @@ typedef void (*w1_slave_found_callback)(struct w1_master *, u64);
80 103
81 104
82/** 105/**
106 * struct w1_bus_master - operations available on a bus master
107 *
108 * @data: the first parameter in all the functions below
109 *
110 * @read_bit: Sample the line level @return the level read (0 or 1)
111 *
112 * @write_bit: Sets the line level
113 *
114 * @touch_bit: the lowest-level function for devices that really support the
115 * 1-wire protocol.
116 * touch_bit(0) = write-0 cycle
117 * touch_bit(1) = write-1 / read cycle
118 * @return the bit read (0 or 1)
119 *
120 * @read_byte: Reads a bytes. Same as 8 touch_bit(1) calls.
121 * @return the byte read
122 *
123 * @write_byte: Writes a byte. Same as 8 touch_bit(x) calls.
124 *
125 * @read_block: Same as a series of read_byte() calls
126 * @return the number of bytes read
127 *
128 * @write_block: Same as a series of write_byte() calls
129 *
130 * @triplet: Combines two reads and a smart write for ROM searches
131 * @return bit0=Id bit1=comp_id bit2=dir_taken
132 *
133 * @reset_bus: long write-0 with a read for the presence pulse detection
134 * @return -1=Error, 0=Device present, 1=No device present
135 *
136 * @set_pullup: Put out a strong pull-up pulse of the specified duration.
137 * @return -1=Error, 0=completed
138 *
139 * @search: Really nice hardware can handles the different types of ROM search
140 * w1_master* is passed to the slave found callback.
141 * u8 is search_type, W1_SEARCH or W1_ALARM_SEARCH
142 *
83 * Note: read_bit and write_bit are very low level functions and should only 143 * Note: read_bit and write_bit are very low level functions and should only
84 * be used with hardware that doesn't really support 1-wire operations, 144 * be used with hardware that doesn't really support 1-wire operations,
85 * like a parallel/serial port. 145 * like a parallel/serial port.
86 * Either define read_bit and write_bit OR define, at minimum, touch_bit and 146 * Either define read_bit and write_bit OR define, at minimum, touch_bit and
87 * reset_bus. 147 * reset_bus.
148 *
88 */ 149 */
89struct w1_bus_master 150struct w1_bus_master
90{ 151{
91 /** the first parameter in all the functions below */
92 void *data; 152 void *data;
93 153
94 /**
95 * Sample the line level
96 * @return the level read (0 or 1)
97 */
98 u8 (*read_bit)(void *); 154 u8 (*read_bit)(void *);
99 155
100 /** Sets the line level */
101 void (*write_bit)(void *, u8); 156 void (*write_bit)(void *, u8);
102 157
103 /**
104 * touch_bit is the lowest-level function for devices that really
105 * support the 1-wire protocol.
106 * touch_bit(0) = write-0 cycle
107 * touch_bit(1) = write-1 / read cycle
108 * @return the bit read (0 or 1)
109 */
110 u8 (*touch_bit)(void *, u8); 158 u8 (*touch_bit)(void *, u8);
111 159
112 /**
113 * Reads a bytes. Same as 8 touch_bit(1) calls.
114 * @return the byte read
115 */
116 u8 (*read_byte)(void *); 160 u8 (*read_byte)(void *);
117 161
118 /**
119 * Writes a byte. Same as 8 touch_bit(x) calls.
120 */
121 void (*write_byte)(void *, u8); 162 void (*write_byte)(void *, u8);
122 163
123 /**
124 * Same as a series of read_byte() calls
125 * @return the number of bytes read
126 */
127 u8 (*read_block)(void *, u8 *, int); 164 u8 (*read_block)(void *, u8 *, int);
128 165
129 /** Same as a series of write_byte() calls */
130 void (*write_block)(void *, const u8 *, int); 166 void (*write_block)(void *, const u8 *, int);
131 167
132 /**
133 * Combines two reads and a smart write for ROM searches
134 * @return bit0=Id bit1=comp_id bit2=dir_taken
135 */
136 u8 (*triplet)(void *, u8); 168 u8 (*triplet)(void *, u8);
137 169
138 /**
139 * long write-0 with a read for the presence pulse detection
140 * @return -1=Error, 0=Device present, 1=No device present
141 */
142 u8 (*reset_bus)(void *); 170 u8 (*reset_bus)(void *);
143 171
144 /**
145 * Put out a strong pull-up pulse of the specified duration.
146 * @return -1=Error, 0=completed
147 */
148 u8 (*set_pullup)(void *, int); 172 u8 (*set_pullup)(void *, int);
149 173
150 /** Really nice hardware can handles the different types of ROM search
151 * w1_master* is passed to the slave found callback.
152 * u8 is search_type, W1_SEARCH or W1_ALARM_SEARCH
153 */
154 void (*search)(void *, struct w1_master *, 174 void (*search)(void *, struct w1_master *,
155 u8, w1_slave_found_callback); 175 u8, w1_slave_found_callback);
156}; 176};
@@ -165,6 +185,37 @@ enum w1_master_flags {
165 W1_WARN_MAX_COUNT = 1, 185 W1_WARN_MAX_COUNT = 1,
166}; 186};
167 187
188/**
189 * struct w1_master - one per bus master
190 * @w1_master_entry: master linked list
191 * @owner: module owner
192 * @name: dynamically allocate bus name
193 * @list_mutex: protect slist and async_list
194 * @slist: linked list of slaves
195 * @async_list: linked list of netlink commands to execute
196 * @max_slave_count: maximum number of slaves to search for at a time
197 * @slave_count: current number of slaves known
198 * @attempts: number of searches ran
199 * @slave_ttl: number of searches before a slave is timed out
200 * @initialized: prevent init/removal race conditions
201 * @id: w1 bus number
202 * @search_count: number of automatic searches to run, -1 unlimited
203 * @search_id: allows continuing a search
204 * @refcnt: reference count
205 * @priv: private data storage
206 * @priv_size: size allocated
207 * @enable_pullup: allows a strong pullup
208 * @pullup_duration: time for the next strong pullup
209 * @flags: one of w1_master_flags
210 * @thread: thread for bus search and netlink commands
211 * @mutex: protect most of w1_master
212 * @bus_mutex: pretect concurrent bus access
213 * @driver: sysfs driver
214 * @dev: sysfs device
215 * @bus_master: io operations available
216 * @seq: sequence number used for netlink broadcasts
217 * @portid: destination for the current netlink command
218 */
168struct w1_master 219struct w1_master
169{ 220{
170 struct list_head w1_master_entry; 221 struct list_head w1_master_entry;
@@ -173,7 +224,7 @@ struct w1_master
173 /* list_mutex protects just slist and async_list so slaves can be 224 /* list_mutex protects just slist and async_list so slaves can be
174 * searched for and async commands added while the master has 225 * searched for and async commands added while the master has
175 * w1_master.mutex locked and is operating on the bus. 226 * w1_master.mutex locked and is operating on the bus.
176 * lock order w1_mlock, w1_master.mutex, w1_master_list_mutex 227 * lock order w1_mlock, w1_master.mutex, w1_master.list_mutex
177 */ 228 */
178 struct mutex list_mutex; 229 struct mutex list_mutex;
179 struct list_head slist; 230 struct list_head slist;
@@ -290,7 +341,6 @@ extern int w1_max_slave_ttl;
290extern struct list_head w1_masters; 341extern struct list_head w1_masters;
291extern struct mutex w1_mlock; 342extern struct mutex w1_mlock;
292 343
293/* returns 1 if there were commands to executed 0 otherwise */
294extern int w1_process_callbacks(struct w1_master *dev); 344extern int w1_process_callbacks(struct w1_master *dev);
295extern int w1_process(void *); 345extern int w1_process(void *);
296 346
diff --git a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c
index e9309778ee72..3bff6b37b472 100644
--- a/drivers/w1/w1_family.c
+++ b/drivers/w1/w1_family.c
@@ -31,6 +31,10 @@
31DEFINE_SPINLOCK(w1_flock); 31DEFINE_SPINLOCK(w1_flock);
32static LIST_HEAD(w1_families); 32static LIST_HEAD(w1_families);
33 33
34/**
35 * w1_register_family() - register a device family driver
36 * @newf: family to register
37 */
34int w1_register_family(struct w1_family *newf) 38int w1_register_family(struct w1_family *newf)
35{ 39{
36 struct list_head *ent, *n; 40 struct list_head *ent, *n;
@@ -59,6 +63,10 @@ int w1_register_family(struct w1_family *newf)
59 return ret; 63 return ret;
60} 64}
61 65
66/**
67 * w1_unregister_family() - unregister a device family driver
68 * @fent: family to unregister
69 */
62void w1_unregister_family(struct w1_family *fent) 70void w1_unregister_family(struct w1_family *fent)
63{ 71{
64 struct list_head *ent, *n; 72 struct list_head *ent, *n;
diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h
index 4ad0e81b6404..26ca1343055b 100644
--- a/drivers/w1/w1_family.h
+++ b/drivers/w1/w1_family.h
@@ -48,6 +48,12 @@
48 48
49struct w1_slave; 49struct w1_slave;
50 50
51/**
52 * struct w1_family_ops - operations for a family type
53 * @add_slave: add_slave
54 * @remove_slave: remove_slave
55 * @groups: sysfs group
56 */
51struct w1_family_ops 57struct w1_family_ops
52{ 58{
53 int (* add_slave)(struct w1_slave *); 59 int (* add_slave)(struct w1_slave *);
@@ -55,6 +61,13 @@ struct w1_family_ops
55 const struct attribute_group **groups; 61 const struct attribute_group **groups;
56}; 62};
57 63
64/**
65 * struct w1_family - reference counted family structure.
66 * @family_entry: family linked list
67 * @fid: 8 bit family identifier
68 * @fops: operations for this family
69 * @refcnt: reference counter
70 */
58struct w1_family 71struct w1_family
59{ 72{
60 struct list_head family_entry; 73 struct list_head family_entry;
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
index 66b2caae48f3..9b084db739c7 100644
--- a/drivers/w1/w1_int.c
+++ b/drivers/w1/w1_int.c
@@ -105,6 +105,10 @@ static void w1_free_dev(struct w1_master *dev)
105 device_unregister(&dev->dev); 105 device_unregister(&dev->dev);
106} 106}
107 107
108/**
109 * w1_add_master_device() - registers a new master device
110 * @master: master bus device to register
111 */
108int w1_add_master_device(struct w1_bus_master *master) 112int w1_add_master_device(struct w1_bus_master *master)
109{ 113{
110 struct w1_master *dev, *entry; 114 struct w1_master *dev, *entry;
@@ -227,6 +231,10 @@ void __w1_remove_master_device(struct w1_master *dev)
227 w1_free_dev(dev); 231 w1_free_dev(dev);
228} 232}
229 233
234/**
235 * w1_remove_master_device() - unregister a master device
236 * @bm: master bus device to remove
237 */
230void w1_remove_master_device(struct w1_bus_master *bm) 238void w1_remove_master_device(struct w1_bus_master *bm)
231{ 239{
232 struct w1_master *dev, *found = NULL; 240 struct w1_master *dev, *found = NULL;
diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c
index e10acc237733..282092421cc9 100644
--- a/drivers/w1/w1_io.c
+++ b/drivers/w1/w1_io.c
@@ -62,7 +62,9 @@ static void w1_write_bit(struct w1_master *dev, int bit);
62static u8 w1_read_bit(struct w1_master *dev); 62static u8 w1_read_bit(struct w1_master *dev);
63 63
64/** 64/**
65 * Generates a write-0 or write-1 cycle and samples the level. 65 * w1_touch_bit() - Generates a write-0 or write-1 cycle and samples the level.
66 * @dev: the master device
67 * @bit: 0 - write a 0, 1 - write a 0 read the level
66 */ 68 */
67static u8 w1_touch_bit(struct w1_master *dev, int bit) 69static u8 w1_touch_bit(struct w1_master *dev, int bit)
68{ 70{
@@ -77,7 +79,10 @@ static u8 w1_touch_bit(struct w1_master *dev, int bit)
77} 79}
78 80
79/** 81/**
80 * Generates a write-0 or write-1 cycle. 82 * w1_write_bit() - Generates a write-0 or write-1 cycle.
83 * @dev: the master device
84 * @bit: bit to write
85 *
81 * Only call if dev->bus_master->touch_bit is NULL 86 * Only call if dev->bus_master->touch_bit is NULL
82 */ 87 */
83static void w1_write_bit(struct w1_master *dev, int bit) 88static void w1_write_bit(struct w1_master *dev, int bit)
@@ -102,11 +107,12 @@ static void w1_write_bit(struct w1_master *dev, int bit)
102} 107}
103 108
104/** 109/**
110 * w1_pre_write() - pre-write operations
111 * @dev: the master device
112 *
105 * Pre-write operation, currently only supporting strong pullups. 113 * Pre-write operation, currently only supporting strong pullups.
106 * Program the hardware for a strong pullup, if one has been requested and 114 * Program the hardware for a strong pullup, if one has been requested and
107 * the hardware supports it. 115 * the hardware supports it.
108 *
109 * @param dev the master device
110 */ 116 */
111static void w1_pre_write(struct w1_master *dev) 117static void w1_pre_write(struct w1_master *dev)
112{ 118{
@@ -118,11 +124,12 @@ static void w1_pre_write(struct w1_master *dev)
118} 124}
119 125
120/** 126/**
127 * w1_post_write() - post-write options
128 * @dev: the master device
129 *
121 * Post-write operation, currently only supporting strong pullups. 130 * Post-write operation, currently only supporting strong pullups.
122 * If a strong pullup was requested, clear it if the hardware supports 131 * If a strong pullup was requested, clear it if the hardware supports
123 * them, or execute the delay otherwise, in either case clear the request. 132 * them, or execute the delay otherwise, in either case clear the request.
124 *
125 * @param dev the master device
126 */ 133 */
127static void w1_post_write(struct w1_master *dev) 134static void w1_post_write(struct w1_master *dev)
128{ 135{
@@ -136,10 +143,9 @@ static void w1_post_write(struct w1_master *dev)
136} 143}
137 144
138/** 145/**
139 * Writes 8 bits. 146 * w1_write_8() - Writes 8 bits.
140 * 147 * @dev: the master device
141 * @param dev the master device 148 * @byte: the byte to write
142 * @param byte the byte to write
143 */ 149 */
144void w1_write_8(struct w1_master *dev, u8 byte) 150void w1_write_8(struct w1_master *dev, u8 byte)
145{ 151{
@@ -161,7 +167,9 @@ EXPORT_SYMBOL_GPL(w1_write_8);
161 167
162 168
163/** 169/**
164 * Generates a write-1 cycle and samples the level. 170 * w1_read_bit() - Generates a write-1 cycle and samples the level.
171 * @dev: the master device
172 *
165 * Only call if dev->bus_master->touch_bit is NULL 173 * Only call if dev->bus_master->touch_bit is NULL
166 */ 174 */
167static u8 w1_read_bit(struct w1_master *dev) 175static u8 w1_read_bit(struct w1_master *dev)
@@ -185,16 +193,17 @@ static u8 w1_read_bit(struct w1_master *dev)
185} 193}
186 194
187/** 195/**
188 * Does a triplet - used for searching ROM addresses. 196 * w1_triplet() - * Does a triplet - used for searching ROM addresses.
197 * @dev: the master device
198 * @bdir: the bit to write if both id_bit and comp_bit are 0
199 *
189 * Return bits: 200 * Return bits:
190 * bit 0 = id_bit 201 * bit 0 = id_bit
191 * bit 1 = comp_bit 202 * bit 1 = comp_bit
192 * bit 2 = dir_taken 203 * bit 2 = dir_taken
193 * If both bits 0 & 1 are set, the search should be restarted. 204 * If both bits 0 & 1 are set, the search should be restarted.
194 * 205 *
195 * @param dev the master device 206 * Return: bit fields - see above
196 * @param bdir the bit to write if both id_bit and comp_bit are 0
197 * @return bit fields - see above
198 */ 207 */
199u8 w1_triplet(struct w1_master *dev, int bdir) 208u8 w1_triplet(struct w1_master *dev, int bdir)
200{ 209{
@@ -226,10 +235,10 @@ u8 w1_triplet(struct w1_master *dev, int bdir)
226} 235}
227 236
228/** 237/**
229 * Reads 8 bits. 238 * w1_read_8() - Reads 8 bits.
239 * @dev: the master device
230 * 240 *
231 * @param dev the master device 241 * Return: the byte read
232 * @return the byte read
233 */ 242 */
234u8 w1_read_8(struct w1_master *dev) 243u8 w1_read_8(struct w1_master *dev)
235{ 244{
@@ -247,11 +256,10 @@ u8 w1_read_8(struct w1_master *dev)
247EXPORT_SYMBOL_GPL(w1_read_8); 256EXPORT_SYMBOL_GPL(w1_read_8);
248 257
249/** 258/**
250 * Writes a series of bytes. 259 * w1_write_block() - Writes a series of bytes.
251 * 260 * @dev: the master device
252 * @param dev the master device 261 * @buf: pointer to the data to write
253 * @param buf pointer to the data to write 262 * @len: the number of bytes to write
254 * @param len the number of bytes to write
255 */ 263 */
256void w1_write_block(struct w1_master *dev, const u8 *buf, int len) 264void w1_write_block(struct w1_master *dev, const u8 *buf, int len)
257{ 265{
@@ -269,11 +277,10 @@ void w1_write_block(struct w1_master *dev, const u8 *buf, int len)
269EXPORT_SYMBOL_GPL(w1_write_block); 277EXPORT_SYMBOL_GPL(w1_write_block);
270 278
271/** 279/**
272 * Touches a series of bytes. 280 * w1_touch_block() - Touches a series of bytes.
273 * 281 * @dev: the master device
274 * @param dev the master device 282 * @buf: pointer to the data to write
275 * @param buf pointer to the data to write 283 * @len: the number of bytes to write
276 * @param len the number of bytes to write
277 */ 284 */
278void w1_touch_block(struct w1_master *dev, u8 *buf, int len) 285void w1_touch_block(struct w1_master *dev, u8 *buf, int len)
279{ 286{
@@ -294,12 +301,11 @@ void w1_touch_block(struct w1_master *dev, u8 *buf, int len)
294EXPORT_SYMBOL_GPL(w1_touch_block); 301EXPORT_SYMBOL_GPL(w1_touch_block);
295 302
296/** 303/**
297 * Reads a series of bytes. 304 * w1_read_block() - Reads a series of bytes.
298 * 305 * @dev: the master device
299 * @param dev the master device 306 * @buf: pointer to the buffer to fill
300 * @param buf pointer to the buffer to fill 307 * @len: the number of bytes to read
301 * @param len the number of bytes to read 308 * Return: the number of bytes read
302 * @return the number of bytes read
303 */ 309 */
304u8 w1_read_block(struct w1_master *dev, u8 *buf, int len) 310u8 w1_read_block(struct w1_master *dev, u8 *buf, int len)
305{ 311{
@@ -319,10 +325,9 @@ u8 w1_read_block(struct w1_master *dev, u8 *buf, int len)
319EXPORT_SYMBOL_GPL(w1_read_block); 325EXPORT_SYMBOL_GPL(w1_read_block);
320 326
321/** 327/**
322 * Issues a reset bus sequence. 328 * w1_reset_bus() - Issues a reset bus sequence.
323 * 329 * @dev: the master device
324 * @param dev The bus master pointer 330 * Return: 0=Device present, 1=No device present or error
325 * @return 0=Device present, 1=No device present or error
326 */ 331 */
327int w1_reset_bus(struct w1_master *dev) 332int w1_reset_bus(struct w1_master *dev)
328{ 333{
@@ -383,12 +388,15 @@ void w1_search_devices(struct w1_master *dev, u8 search_type, w1_slave_found_cal
383} 388}
384 389
385/** 390/**
391 * w1_reset_select_slave() - reset and select a slave
392 * @sl: the slave to select
393 *
386 * Resets the bus and then selects the slave by sending either a skip rom 394 * Resets the bus and then selects the slave by sending either a skip rom
387 * or a rom match. 395 * or a rom match. A skip rom is issued if there is only one device
396 * registered on the bus.
388 * The w1 master lock must be held. 397 * The w1 master lock must be held.
389 * 398 *
390 * @param sl the slave to select 399 * Return: 0=success, anything else=error
391 * @return 0=success, anything else=error
392 */ 400 */
393int w1_reset_select_slave(struct w1_slave *sl) 401int w1_reset_select_slave(struct w1_slave *sl)
394{ 402{
@@ -409,6 +417,9 @@ int w1_reset_select_slave(struct w1_slave *sl)
409EXPORT_SYMBOL_GPL(w1_reset_select_slave); 417EXPORT_SYMBOL_GPL(w1_reset_select_slave);
410 418
411/** 419/**
420 * w1_reset_resume_command() - resume instead of another match ROM
421 * @dev: the master device
422 *
412 * When the workflow with a slave amongst many requires several 423 * When the workflow with a slave amongst many requires several
413 * successive commands a reset between each, this function is similar 424 * successive commands a reset between each, this function is similar
414 * to doing a reset then a match ROM for the last matched ROM. The 425 * to doing a reset then a match ROM for the last matched ROM. The
@@ -420,8 +431,6 @@ EXPORT_SYMBOL_GPL(w1_reset_select_slave);
420 * doesn't work of course, but the resume command is the next best thing. 431 * doesn't work of course, but the resume command is the next best thing.
421 * 432 *
422 * The w1 master lock must be held. 433 * The w1 master lock must be held.
423 *
424 * @param dev the master device
425 */ 434 */
426int w1_reset_resume_command(struct w1_master *dev) 435int w1_reset_resume_command(struct w1_master *dev)
427{ 436{
@@ -435,6 +444,10 @@ int w1_reset_resume_command(struct w1_master *dev)
435EXPORT_SYMBOL_GPL(w1_reset_resume_command); 444EXPORT_SYMBOL_GPL(w1_reset_resume_command);
436 445
437/** 446/**
447 * w1_next_pullup() - register for a strong pullup
448 * @dev: the master device
449 * @delay: time in milliseconds
450 *
438 * Put out a strong pull-up of the specified duration after the next write 451 * Put out a strong pull-up of the specified duration after the next write
439 * operation. Not all hardware supports strong pullups. Hardware that 452 * operation. Not all hardware supports strong pullups. Hardware that
440 * doesn't support strong pullups will sleep for the given time after the 453 * doesn't support strong pullups will sleep for the given time after the
@@ -442,8 +455,7 @@ EXPORT_SYMBOL_GPL(w1_reset_resume_command);
442 * the next write, specifying zero will clear a previous request. 455 * the next write, specifying zero will clear a previous request.
443 * The w1 master lock must be held. 456 * The w1 master lock must be held.
444 * 457 *
445 * @param delay time in milliseconds 458 * Return: 0=success, anything else=error
446 * @return 0=success, anything else=error
447 */ 459 */
448void w1_next_pullup(struct w1_master *dev, int delay) 460void w1_next_pullup(struct w1_master *dev, int delay)
449{ 461{
diff --git a/drivers/w1/w1_netlink.h b/drivers/w1/w1_netlink.h
index ea9f3e453621..1e9504e67650 100644
--- a/drivers/w1/w1_netlink.h
+++ b/drivers/w1/w1_netlink.h
@@ -27,7 +27,8 @@
27 27
28#include "w1.h" 28#include "w1.h"
29 29
30/** enum w1_netlink_message_types - message type 30/**
31 * enum w1_netlink_message_types - message type
31 * 32 *
32 * @W1_SLAVE_ADD: notification that a slave device was added 33 * @W1_SLAVE_ADD: notification that a slave device was added
33 * @W1_SLAVE_REMOVE: notification that a slave device was removed 34 * @W1_SLAVE_REMOVE: notification that a slave device was removed
@@ -63,7 +64,8 @@ struct w1_netlink_msg
63 __u8 data[0]; 64 __u8 data[0];
64}; 65};
65 66
66/** enum w1_commands - commands available for master or slave operations 67/**
68 * enum w1_commands - commands available for master or slave operations
67 * @W1_CMD_READ: read len bytes 69 * @W1_CMD_READ: read len bytes
68 * @W1_CMD_WRITE: write len bytes 70 * @W1_CMD_WRITE: write len bytes
69 * @W1_CMD_SEARCH: initiate a standard search, returns only the slave 71 * @W1_CMD_SEARCH: initiate a standard search, returns only the slave