aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/i2c/writing-clients
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/i2c/writing-clients')
-rw-r--r--Documentation/i2c/writing-clients35
1 files changed, 15 insertions, 20 deletions
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
index 91664be91ffc..e6b546dd4f7b 100644
--- a/Documentation/i2c/writing-clients
+++ b/Documentation/i2c/writing-clients
@@ -195,31 +195,28 @@ Probing classes (sensors)
195------------------------- 195-------------------------
196 196
197If you write a `sensors' driver, you use a slightly different interface. 197If you write a `sensors' driver, you use a slightly different interface.
198As well as I2C addresses, we have to cope with ISA addresses. Also, we 198Also, we use a enum of chip types. Don't forget to include `sensors.h'.
199use a enum of chip types. Don't forget to include `sensors.h'.
200 199
201The following lists are used internally. They are all lists of integers. 200The following lists are used internally. They are all lists of integers.
202 201
203 normal_i2c: filled in by the module writer. Terminated by SENSORS_I2C_END. 202 normal_i2c: filled in by the module writer. Terminated by I2C_CLIENT_END.
204 A list of I2C addresses which should normally be examined. 203 A list of I2C addresses which should normally be examined.
205 normal_isa: filled in by the module writer. Terminated by SENSORS_ISA_END. 204 probe: insmod parameter. Initialize this list with I2C_CLIENT_END values.
206 A list of ISA addresses which should normally be examined. 205 A list of pairs. The first value is a bus number (ANY_I2C_BUS for any
207 probe: insmod parameter. Initialize this list with SENSORS_I2C_END values. 206 I2C bus), the second is the address. These addresses are also probed,
208 A list of pairs. The first value is a bus number (SENSORS_ISA_BUS for 207 as if they were in the 'normal' list.
209 the ISA bus, -1 for any I2C bus), the second is the address. These 208 ignore: insmod parameter. Initialize this list with I2C_CLIENT_END values.
210 addresses are also probed, as if they were in the 'normal' list. 209 A list of pairs. The first value is a bus number (ANY_I2C_BUS for any
211 ignore: insmod parameter. Initialize this list with SENSORS_I2C_END values. 210 I2C bus), the second is the I2C address. These addresses are never
212 A list of pairs. The first value is a bus number (SENSORS_ISA_BUS for 211 probed. This parameter overrules 'normal' and 'probe', but not the
213 the ISA bus, -1 for any I2C bus), the second is the I2C address. These 212 'force' lists.
214 addresses are never probed. This parameter overrules 'normal' and
215 'probe', but not the 'force' lists.
216 213
217Also used is a list of pointers to sensors_force_data structures: 214Also used is a list of pointers to sensors_force_data structures:
218 force_data: insmod parameters. A list, ending with an element of which 215 force_data: insmod parameters. A list, ending with an element of which
219 the force field is NULL. 216 the force field is NULL.
220 Each element contains the type of chip and a list of pairs. 217 Each element contains the type of chip and a list of pairs.
221 The first value is a bus number (SENSORS_ISA_BUS for the ISA bus, 218 The first value is a bus number (ANY_I2C_BUS for any I2C bus), the
222 -1 for any I2C bus), the second is the address. 219 second is the address.
223 These are automatically translated to insmod variables of the form 220 These are automatically translated to insmod variables of the form
224 force_foo. 221 force_foo.
225 222
@@ -227,13 +224,11 @@ So we have a generic insmod variabled `force', and chip-specific variables
227`force_CHIPNAME'. 224`force_CHIPNAME'.
228 225
229Fortunately, as a module writer, you just have to define the `normal_i2c' 226Fortunately, as a module writer, you just have to define the `normal_i2c'
230and `normal_isa' parameters, and define what chip names are used. 227parameter, and define what chip names are used. The complete declaration
231The complete declaration could look like this: 228could look like this:
232 /* Scan i2c addresses 0x37, and 0x48 to 0x4f */ 229 /* Scan i2c addresses 0x37, and 0x48 to 0x4f */
233 static unsigned short normal_i2c[] = { 0x37, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 230 static unsigned short normal_i2c[] = { 0x37, 0x48, 0x49, 0x4a, 0x4b, 0x4c,
234 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; 231 0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
235 /* Scan ISA address 0x290 */
236 static unsigned int normal_isa[] = {0x0290,SENSORS_ISA_END};
237 232
238 /* Define chips foo and bar, as well as all module parameters and things */ 233 /* Define chips foo and bar, as well as all module parameters and things */
239 SENSORS_INSMOD_2(foo,bar); 234 SENSORS_INSMOD_2(foo,bar);