diff options
Diffstat (limited to 'Documentation/i2c')
-rw-r--r-- | Documentation/i2c/porting-clients | 7 | ||||
-rw-r--r-- | Documentation/i2c/writing-clients | 35 |
2 files changed, 19 insertions, 23 deletions
diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients index a7adbdd9ea8a..105c6186b912 100644 --- a/Documentation/i2c/porting-clients +++ b/Documentation/i2c/porting-clients | |||
@@ -29,8 +29,8 @@ Technical changes: | |||
29 | Please respect this inclusion order. Some extra headers may be | 29 | Please respect this inclusion order. Some extra headers may be |
30 | required for a given driver (e.g. "lm75.h"). | 30 | required for a given driver (e.g. "lm75.h"). |
31 | 31 | ||
32 | * [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, SENSORS_ISA_END | 32 | * [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, ISA addresses |
33 | becomes I2C_CLIENT_ISA_END. | 33 | are no more handled by the i2c core. |
34 | 34 | ||
35 | * [Client data] Get rid of sysctl_id. Try using standard names for | 35 | * [Client data] Get rid of sysctl_id. Try using standard names for |
36 | register values (for example, temp_os becomes temp_max). You're | 36 | register values (for example, temp_os becomes temp_max). You're |
@@ -72,7 +72,8 @@ Technical changes: | |||
72 | name string, which will be filled with a lowercase, short string | 72 | name string, which will be filled with a lowercase, short string |
73 | (typically the driver name, e.g. "lm75"). | 73 | (typically the driver name, e.g. "lm75"). |
74 | In i2c-only drivers, drop the i2c_is_isa_adapter check, it's | 74 | In i2c-only drivers, drop the i2c_is_isa_adapter check, it's |
75 | useless. | 75 | useless. Same for isa-only drivers, as the test would always be |
76 | true. Only hybrid drivers (which are quite rare) still need it. | ||
76 | The errorN labels are reduced to the number needed. If that number | 77 | The errorN labels are reduced to the number needed. If that number |
77 | is 2 (i2c-only drivers), it is advised that the labels are named | 78 | is 2 (i2c-only drivers), it is advised that the labels are named |
78 | exit and exit_free. For i2c+isa drivers, labels should be named | 79 | exit and exit_free. For i2c+isa drivers, labels should be named |
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 | ||
197 | If you write a `sensors' driver, you use a slightly different interface. | 197 | If you write a `sensors' driver, you use a slightly different interface. |
198 | As well as I2C addresses, we have to cope with ISA addresses. Also, we | 198 | Also, we use a enum of chip types. Don't forget to include `sensors.h'. |
199 | use a enum of chip types. Don't forget to include `sensors.h'. | ||
200 | 199 | ||
201 | The following lists are used internally. They are all lists of integers. | 200 | The 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 | ||
217 | Also used is a list of pointers to sensors_force_data structures: | 214 | Also 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 | ||
229 | Fortunately, as a module writer, you just have to define the `normal_i2c' | 226 | Fortunately, as a module writer, you just have to define the `normal_i2c' |
230 | and `normal_isa' parameters, and define what chip names are used. | 227 | parameter, and define what chip names are used. The complete declaration |
231 | The complete declaration could look like this: | 228 | could 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); |