[PATCH] i2c: SMBus PEC support rewrite, 2 of 3
[linux-2.6/cjktty.git] / include / linux / i2c.h
blob78c64f7b31050c4633a1d847d6ec7bee640d20b3
1 /* ------------------------------------------------------------------------- */
2 /* */
3 /* i2c.h - definitions for the i2c-bus interface */
4 /* */
5 /* ------------------------------------------------------------------------- */
6 /* Copyright (C) 1995-2000 Simon G. Vogl
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
21 /* ------------------------------------------------------------------------- */
23 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
24 Frodo Looijaard <frodol@dds.nl> */
26 #ifndef _LINUX_I2C_H
27 #define _LINUX_I2C_H
29 #include <linux/module.h>
30 #include <linux/types.h>
31 #include <linux/i2c-id.h>
32 #include <linux/device.h> /* for struct device */
33 #include <asm/semaphore.h>
35 /* --- For i2c-isa ---------------------------------------------------- */
37 extern void i2c_adapter_dev_release(struct device *dev);
38 extern struct device_driver i2c_adapter_driver;
39 extern struct class i2c_adapter_class;
40 extern struct bus_type i2c_bus_type;
42 /* --- General options ------------------------------------------------ */
44 struct i2c_msg;
45 struct i2c_algorithm;
46 struct i2c_adapter;
47 struct i2c_client;
48 struct i2c_driver;
49 union i2c_smbus_data;
52 * The master routines are the ones normally used to transmit data to devices
53 * on a bus (or read from them). Apart from two basic transfer functions to
54 * transmit one message at a time, a more complex version can be used to
55 * transmit an arbitrary number of messages without interruption.
57 extern int i2c_master_send(struct i2c_client *,const char* ,int);
58 extern int i2c_master_recv(struct i2c_client *,char* ,int);
60 /* Transfer num messages.
62 extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num);
65 * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
66 * This is not tested/implemented yet and will change in the future.
68 extern int i2c_slave_send(struct i2c_client *,char*,int);
69 extern int i2c_slave_recv(struct i2c_client *,char*,int);
73 /* This is the very generalized SMBus access routine. You probably do not
74 want to use this, though; one of the functions below may be much easier,
75 and probably just as fast.
76 Note that we use i2c_adapter here, because you do not need a specific
77 smbus adapter to call this function. */
78 extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr,
79 unsigned short flags,
80 char read_write, u8 command, int size,
81 union i2c_smbus_data * data);
83 /* Now follow the 'nice' access routines. These also document the calling
84 conventions of smbus_access. */
86 extern s32 i2c_smbus_write_quick(struct i2c_client * client, u8 value);
87 extern s32 i2c_smbus_read_byte(struct i2c_client * client);
88 extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value);
89 extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command);
90 extern s32 i2c_smbus_write_byte_data(struct i2c_client * client,
91 u8 command, u8 value);
92 extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command);
93 extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
94 u8 command, u16 value);
95 extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
96 u8 command, u8 length,
97 u8 *values);
98 /* Returns the number of read bytes */
99 extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
100 u8 command, u8 *values);
103 * A driver is capable of handling one or more physical devices present on
104 * I2C adapters. This information is used to inform the driver of adapter
105 * events.
108 struct i2c_driver {
109 struct module *owner;
110 char name[32];
111 int id;
112 unsigned int class;
113 unsigned int flags; /* div., see below */
115 /* Notifies the driver that a new bus has appeared. This routine
116 * can be used by the driver to test if the bus meets its conditions
117 * & seek for the presence of the chip(s) it supports. If found, it
118 * registers the client(s) that are on the bus to the i2c admin. via
119 * i2c_attach_client.
121 int (*attach_adapter)(struct i2c_adapter *);
122 int (*detach_adapter)(struct i2c_adapter *);
124 /* tells the driver that a client is about to be deleted & gives it
125 * the chance to remove its private data. Also, if the client struct
126 * has been dynamically allocated by the driver in the function above,
127 * it must be freed here.
129 int (*detach_client)(struct i2c_client *);
131 /* a ioctl like command that can be used to perform specific functions
132 * with the device.
134 int (*command)(struct i2c_client *client,unsigned int cmd, void *arg);
136 struct device_driver driver;
137 struct list_head list;
139 #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
141 #define I2C_NAME_SIZE 50
144 * i2c_client identifies a single device (i.e. chip) that is connected to an
145 * i2c bus. The behaviour is defined by the routines of the driver. This
146 * function is mainly used for lookup & other admin. functions.
148 struct i2c_client {
149 unsigned int flags; /* div., see below */
150 unsigned short addr; /* chip address - NOTE: 7bit */
151 /* addresses are stored in the */
152 /* _LOWER_ 7 bits */
153 struct i2c_adapter *adapter; /* the adapter we sit on */
154 struct i2c_driver *driver; /* and our access routines */
155 int usage_count; /* How many accesses currently */
156 /* to the client */
157 struct device dev; /* the device structure */
158 struct list_head list;
159 char name[I2C_NAME_SIZE];
160 struct completion released;
162 #define to_i2c_client(d) container_of(d, struct i2c_client, dev)
164 static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
166 return to_i2c_client(container_of(kobj, struct device, kobj));
169 static inline void *i2c_get_clientdata (struct i2c_client *dev)
171 return dev_get_drvdata (&dev->dev);
174 static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
176 dev_set_drvdata (&dev->dev, data);
180 * The following structs are for those who like to implement new bus drivers:
181 * i2c_algorithm is the interface to a class of hardware solutions which can
182 * be addressed using the same bus algorithms - i.e. bit-banging or the PCF8584
183 * to name two of the most common.
185 struct i2c_algorithm {
186 /* If an adapter algorithm can't do I2C-level access, set master_xfer
187 to NULL. If an adapter algorithm can do SMBus access, set
188 smbus_xfer. If set to NULL, the SMBus protocol is simulated
189 using common I2C messages */
190 int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs,
191 int num);
192 int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
193 unsigned short flags, char read_write,
194 u8 command, int size, union i2c_smbus_data * data);
196 /* --- these optional/future use for some adapter types.*/
197 int (*slave_send)(struct i2c_adapter *,char*,int);
198 int (*slave_recv)(struct i2c_adapter *,char*,int);
200 /* --- ioctl like call to set div. parameters. */
201 int (*algo_control)(struct i2c_adapter *, unsigned int, unsigned long);
203 /* To determine what the adapter supports */
204 u32 (*functionality) (struct i2c_adapter *);
208 * i2c_adapter is the structure used to identify a physical i2c bus along
209 * with the access algorithms necessary to access it.
211 struct i2c_adapter {
212 struct module *owner;
213 unsigned int id;
214 unsigned int class;
215 struct i2c_algorithm *algo;/* the algorithm to access the bus */
216 void *algo_data;
218 /* --- administration stuff. */
219 int (*client_register)(struct i2c_client *);
220 int (*client_unregister)(struct i2c_client *);
222 /* data fields that are valid for all devices */
223 struct semaphore bus_lock;
224 struct semaphore clist_lock;
226 int timeout;
227 int retries;
228 struct device dev; /* the adapter device */
229 struct class_device class_dev; /* the class device */
231 int nr;
232 struct list_head clients;
233 struct list_head list;
234 char name[I2C_NAME_SIZE];
235 struct completion dev_released;
236 struct completion class_dev_released;
238 #define dev_to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
239 #define class_dev_to_i2c_adapter(d) container_of(d, struct i2c_adapter, class_dev)
241 static inline void *i2c_get_adapdata (struct i2c_adapter *dev)
243 return dev_get_drvdata (&dev->dev);
246 static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
248 dev_set_drvdata (&dev->dev, data);
251 /*flags for the driver struct: */
252 #define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */
253 #if 0
254 /* this flag is gone -- there is a (optional) driver->detach_adapter
255 * callback now which can be used instead */
256 # define I2C_DF_DUMMY 0x02
257 #endif
259 /*flags for the client struct: */
260 #define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */
261 #define I2C_CLIENT_ALLOW_MULTIPLE_USE 0x02 /* Allow multiple access-locks */
262 /* on an i2c_client */
263 #define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */
264 #define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */
265 /* Must equal I2C_M_TEN below */
267 /* i2c adapter classes (bitmask) */
268 #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
269 #define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */
270 #define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */
271 #define I2C_CLASS_DDC (1<<3) /* i2c-matroxfb ? */
272 #define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */
273 #define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */
274 #define I2C_CLASS_SOUND (1<<6) /* sound devices */
275 #define I2C_CLASS_ALL (UINT_MAX) /* all of the above */
277 /* i2c_client_address_data is the struct for holding default client
278 * addresses for a driver and for the parameters supplied on the
279 * command line
281 struct i2c_client_address_data {
282 unsigned short *normal_i2c;
283 unsigned short *probe;
284 unsigned short *ignore;
285 unsigned short **forces;
288 /* Internal numbers to terminate lists */
289 #define I2C_CLIENT_END 0xfffeU
291 /* The numbers to use to set I2C bus address */
292 #define ANY_I2C_BUS 0xffff
293 #define ANY_I2C_ISA_BUS 9191
296 /* ----- functions exported by i2c.o */
298 /* administration...
300 extern int i2c_add_adapter(struct i2c_adapter *);
301 extern int i2c_del_adapter(struct i2c_adapter *);
303 extern int i2c_add_driver(struct i2c_driver *);
304 extern int i2c_del_driver(struct i2c_driver *);
306 extern int i2c_attach_client(struct i2c_client *);
307 extern int i2c_detach_client(struct i2c_client *);
309 /* New function: This is to get an i2c_client-struct for controlling the
310 client either by using i2c_control-function or having the
311 client-module export functions that can be used with the i2c_client
312 -struct. */
313 extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id,
314 struct i2c_client *prev);
316 /* Should be used with new function
317 extern struct i2c_client *i2c_get_client(int,int,struct i2c_client *);
318 to make sure that client-struct is valid and that it is okay to access
319 the i2c-client.
320 returns -EACCES if client doesn't allow use (default)
321 returns -EBUSY if client doesn't allow multiple use (default) and
322 usage_count >0 */
323 extern int i2c_use_client(struct i2c_client *);
324 extern int i2c_release_client(struct i2c_client *);
326 /* call the i2c_client->command() of all attached clients with
327 * the given arguments */
328 extern void i2c_clients_command(struct i2c_adapter *adap,
329 unsigned int cmd, void *arg);
331 /* returns -EBUSY if address has been taken, 0 if not. Note that the only
332 other place at which this is called is within i2c_attach_client; so
333 you can cheat by simply not registering. Not recommended, of course! */
334 extern int i2c_check_addr (struct i2c_adapter *adapter, int addr);
336 /* Detect function. It iterates over all possible addresses itself.
337 * It will only call found_proc if some client is connected at the
338 * specific address (unless a 'force' matched);
340 extern int i2c_probe(struct i2c_adapter *adapter,
341 struct i2c_client_address_data *address_data,
342 int (*found_proc) (struct i2c_adapter *, int, int));
344 /* An ioctl like call to set div. parameters of the adapter.
346 extern int i2c_control(struct i2c_client *,unsigned int, unsigned long);
348 extern struct i2c_adapter* i2c_get_adapter(int id);
349 extern void i2c_put_adapter(struct i2c_adapter *adap);
352 /* Return the functionality mask */
353 static inline u32 i2c_get_functionality(struct i2c_adapter *adap)
355 return adap->algo->functionality(adap);
358 /* Return 1 if adapter supports everything we need, 0 if not. */
359 static inline int i2c_check_functionality(struct i2c_adapter *adap, u32 func)
361 return (func & i2c_get_functionality(adap)) == func;
364 /* Return id number for a specific adapter */
365 static inline int i2c_adapter_id(struct i2c_adapter *adap)
367 return adap->nr;
371 * I2C Message - used for pure i2c transaction, also from /dev interface
373 struct i2c_msg {
374 __u16 addr; /* slave address */
375 __u16 flags;
376 #define I2C_M_TEN 0x10 /* we have a ten bit chip address */
377 #define I2C_M_RD 0x01
378 #define I2C_M_NOSTART 0x4000
379 #define I2C_M_REV_DIR_ADDR 0x2000
380 #define I2C_M_IGNORE_NAK 0x1000
381 #define I2C_M_NO_RD_ACK 0x0800
382 __u16 len; /* msg length */
383 __u8 *buf; /* pointer to msg data */
386 /* To determine what functionality is present */
388 #define I2C_FUNC_I2C 0x00000001
389 #define I2C_FUNC_10BIT_ADDR 0x00000002
390 #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */
391 #define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */
392 #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
393 #define I2C_FUNC_SMBUS_QUICK 0x00010000
394 #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
395 #define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000
396 #define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000
397 #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000
398 #define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000
399 #define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000
400 #define I2C_FUNC_SMBUS_PROC_CALL 0x00800000
401 #define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000
402 #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
403 #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */
404 #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */
405 #define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */
406 #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2 0x20000000 /* w/ 2-byte reg. addr. */
408 #define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \
409 I2C_FUNC_SMBUS_WRITE_BYTE)
410 #define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \
411 I2C_FUNC_SMBUS_WRITE_BYTE_DATA)
412 #define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \
413 I2C_FUNC_SMBUS_WRITE_WORD_DATA)
414 #define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \
415 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)
416 #define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \
417 I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)
418 #define I2C_FUNC_SMBUS_I2C_BLOCK_2 (I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \
419 I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2)
421 #define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \
422 I2C_FUNC_SMBUS_BYTE | \
423 I2C_FUNC_SMBUS_BYTE_DATA | \
424 I2C_FUNC_SMBUS_WORD_DATA | \
425 I2C_FUNC_SMBUS_PROC_CALL | \
426 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
427 I2C_FUNC_SMBUS_I2C_BLOCK)
430 * Data for SMBus Messages
432 #define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */
433 union i2c_smbus_data {
434 __u8 byte;
435 __u16 word;
436 __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */
437 /* and one more for user-space compatibility */
440 /* smbus_access read or write markers */
441 #define I2C_SMBUS_READ 1
442 #define I2C_SMBUS_WRITE 0
444 /* SMBus transaction types (size parameter in the above functions)
445 Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */
446 #define I2C_SMBUS_QUICK 0
447 #define I2C_SMBUS_BYTE 1
448 #define I2C_SMBUS_BYTE_DATA 2
449 #define I2C_SMBUS_WORD_DATA 3
450 #define I2C_SMBUS_PROC_CALL 4
451 #define I2C_SMBUS_BLOCK_DATA 5
452 #define I2C_SMBUS_I2C_BLOCK_DATA 6
453 #define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */
454 #define I2C_SMBUS_BLOCK_DATA_PEC 8 /* SMBus 2.0 */
455 #define I2C_SMBUS_PROC_CALL_PEC 9 /* SMBus 2.0 */
456 #define I2C_SMBUS_BLOCK_PROC_CALL_PEC 10 /* SMBus 2.0 */
457 #define I2C_SMBUS_WORD_DATA_PEC 11 /* SMBus 2.0 */
460 /* ----- commands for the ioctl like i2c_command call:
461 * note that additional calls are defined in the algorithm and hw
462 * dependent layers - these can be listed here, or see the
463 * corresponding header files.
465 /* -> bit-adapter specific ioctls */
466 #define I2C_RETRIES 0x0701 /* number of times a device address */
467 /* should be polled when not */
468 /* acknowledging */
469 #define I2C_TIMEOUT 0x0702 /* set timeout - call with int */
472 /* this is for i2c-dev.c */
473 #define I2C_SLAVE 0x0703 /* Change slave address */
474 /* Attn.: Slave address is 7 or 10 bits */
475 #define I2C_SLAVE_FORCE 0x0706 /* Change slave address */
476 /* Attn.: Slave address is 7 or 10 bits */
477 /* This changes the address, even if it */
478 /* is already taken! */
479 #define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
481 #define I2C_FUNCS 0x0705 /* Get the adapter functionality */
482 #define I2C_RDWR 0x0707 /* Combined R/W transfer (one stop only)*/
483 #define I2C_PEC 0x0708 /* != 0 for SMBus PEC */
485 #define I2C_SMBUS 0x0720 /* SMBus-level access */
487 /* ----- I2C-DEV: char device interface stuff ------------------------- */
489 #define I2C_MAJOR 89 /* Device major number */
491 /* These defines are used for probing i2c client addresses */
492 /* The length of the option lists */
493 #define I2C_CLIENT_MAX_OPTS 48
495 /* Default fill of many variables */
496 #define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
497 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
498 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
499 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
500 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
501 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
502 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
503 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
504 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
505 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
506 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
507 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
508 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
509 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
510 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
511 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END}
513 /* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the
514 module header */
516 #define I2C_CLIENT_MODULE_PARM(var,desc) \
517 static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \
518 static unsigned int var##_num; \
519 module_param_array(var, short, &var##_num, 0); \
520 MODULE_PARM_DESC(var,desc)
522 #define I2C_CLIENT_MODULE_PARM_FORCE(name) \
523 I2C_CLIENT_MODULE_PARM(force_##name, \
524 "List of adapter,address pairs which are " \
525 "unquestionably assumed to contain a `" \
526 # name "' chip")
529 #define I2C_CLIENT_INSMOD_COMMON \
530 I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \
531 "additionally"); \
532 I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \
533 "scan"); \
534 static struct i2c_client_address_data addr_data = { \
535 .normal_i2c = normal_i2c, \
536 .probe = probe, \
537 .ignore = ignore, \
538 .forces = forces, \
541 /* These are the ones you want to use in your own drivers. Pick the one
542 which matches the number of devices the driver differenciates between. */
543 #define I2C_CLIENT_INSMOD \
544 I2C_CLIENT_MODULE_PARM(force, \
545 "List of adapter,address pairs to boldly assume " \
546 "to be present"); \
547 static unsigned short *forces[] = { \
548 force, \
549 NULL \
550 }; \
551 I2C_CLIENT_INSMOD_COMMON
553 #define I2C_CLIENT_INSMOD_1(chip1) \
554 enum chips { any_chip, chip1 }; \
555 I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
556 "boldly assume to be present"); \
557 I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
558 static unsigned short *forces[] = { force, force_##chip1, NULL }; \
559 I2C_CLIENT_INSMOD_COMMON
561 #define I2C_CLIENT_INSMOD_2(chip1, chip2) \
562 enum chips { any_chip, chip1, chip2 }; \
563 I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
564 "boldly assume to be present"); \
565 I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
566 I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
567 static unsigned short *forces[] = { force, force_##chip1, \
568 force_##chip2, NULL }; \
569 I2C_CLIENT_INSMOD_COMMON
571 #define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
572 enum chips { any_chip, chip1, chip2, chip3 }; \
573 I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
574 "boldly assume to be present"); \
575 I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
576 I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
577 I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
578 static unsigned short *forces[] = { force, force_##chip1, \
579 force_##chip2, force_##chip3, \
580 NULL }; \
581 I2C_CLIENT_INSMOD_COMMON
583 #define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \
584 enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
585 I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
586 "boldly assume to be present"); \
587 I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
588 I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
589 I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
590 I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
591 static unsigned short *forces[] = { force, force_##chip1, \
592 force_##chip2, force_##chip3, \
593 force_##chip4, NULL}; \
594 I2C_CLIENT_INSMOD_COMMON
596 #define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \
597 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \
598 I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
599 "boldly assume to be present"); \
600 I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
601 I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
602 I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
603 I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
604 I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
605 static unsigned short *forces[] = { force, force_##chip1, \
606 force_##chip2, force_##chip3, \
607 force_##chip4, force_##chip5, \
608 NULL }; \
609 I2C_CLIENT_INSMOD_COMMON
611 #define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \
612 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \
613 I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
614 "boldly assume to be present"); \
615 I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
616 I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
617 I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
618 I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
619 I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
620 I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
621 static unsigned short *forces[] = { force, force_##chip1, \
622 force_##chip2, force_##chip3, \
623 force_##chip4, force_##chip5, \
624 force_##chip6, NULL }; \
625 I2C_CLIENT_INSMOD_COMMON
627 #define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \
628 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
629 chip7 }; \
630 I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
631 "boldly assume to be present"); \
632 I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
633 I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
634 I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
635 I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
636 I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
637 I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
638 I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
639 static unsigned short *forces[] = { force, force_##chip1, \
640 force_##chip2, force_##chip3, \
641 force_##chip4, force_##chip5, \
642 force_##chip6, force_##chip7, \
643 NULL }; \
644 I2C_CLIENT_INSMOD_COMMON
646 #define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \
647 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
648 chip7, chip8 }; \
649 I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
650 "boldly assume to be present"); \
651 I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
652 I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
653 I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
654 I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
655 I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
656 I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
657 I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
658 I2C_CLIENT_MODULE_PARM_FORCE(chip8); \
659 static unsigned short *forces[] = { force, force_##chip1, \
660 force_##chip2, force_##chip3, \
661 force_##chip4, force_##chip5, \
662 force_##chip6, force_##chip7, \
663 force_##chip8, NULL }; \
664 I2C_CLIENT_INSMOD_COMMON
666 #endif /* _LINUX_I2C_H */