OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [LINUX_2_4_26_OR32/] [linux/] [linux-2.4/] [include/] [linux/] [i2c.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/* ------------------------------------------------------------------------- */
2
/*                                                                           */
3
/* i2c.h - definitions for the i2c-bus interface                             */
4
/*                                                                           */
5
/* ------------------------------------------------------------------------- */
6
/*   Copyright (C) 1995-2000 Simon G. Vogl
7
 
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.
12
 
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.
17
 
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
/* ------------------------------------------------------------------------- */
22
 
23
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
24
   Frodo Looijaard <frodol@dds.nl> */
25
 
26
/* $Id: i2c.h,v 1.1.1.1 2004-04-15 02:35:16 phoenix Exp $ */
27
 
28
#ifndef I2C_H
29
#define I2C_H
30
 
31
#define I2C_DATE "20010830"
32
#define I2C_VERSION "2.6.1"
33
 
34
#include <linux/i2c-id.h>       /* id values of adapters et. al.        */
35
#include <linux/types.h>
36
 
37
 
38
struct i2c_msg;
39
 
40
 
41
#ifdef __KERNEL__
42
 
43
/* --- Includes and compatibility declarations ------------------------ */
44
 
45
#include <asm/semaphore.h>
46
#include <linux/config.h>
47
 
48
/* --- General options ------------------------------------------------ */
49
 
50
#define I2C_ALGO_MAX    4               /* control memory consumption   */
51
#define I2C_ADAP_MAX    16
52
#define I2C_DRIVER_MAX  16
53
#define I2C_CLIENT_MAX  32
54
#define I2C_DUMMY_MAX 4
55
 
56
struct i2c_algorithm;
57
struct i2c_adapter;
58
struct i2c_client;
59
struct i2c_driver;
60
struct i2c_client_address_data;
61
union i2c_smbus_data;
62
 
63
 
64
/*
65
 * The master routines are the ones normally used to transmit data to devices
66
 * on a bus (or read from them). Apart from two basic transfer functions to
67
 * transmit one message at a time, a more complex version can be used to
68
 * transmit an arbitrary number of messages without interruption.
69
 */
70
extern int i2c_master_send(struct i2c_client *,const char* ,int);
71
extern int i2c_master_recv(struct i2c_client *,char* ,int);
72
 
73
/* Transfer num messages.
74
 */
75
extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],int num);
76
 
77
/*
78
 * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
79
 * This is not tested/implemented yet and will change in the future.
80
 */
81
extern int i2c_slave_send(struct i2c_client *,char*,int);
82
extern int i2c_slave_recv(struct i2c_client *,char*,int);
83
 
84
 
85
 
86
/* This is the very generalized SMBus access routine. You probably do not
87
   want to use this, though; one of the functions below may be much easier,
88
   and probably just as fast.
89
   Note that we use i2c_adapter here, because you do not need a specific
90
   smbus adapter to call this function. */
91
extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr,
92
                           unsigned short flags,
93
                           char read_write, u8 command, int size,
94
                           union i2c_smbus_data * data);
95
 
96
/* Now follow the 'nice' access routines. These also document the calling
97
   conventions of smbus_access. */
98
 
99
extern s32 i2c_smbus_write_quick(struct i2c_client * client, u8 value);
100
extern s32 i2c_smbus_read_byte(struct i2c_client * client);
101
extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value);
102
extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command);
103
extern s32 i2c_smbus_write_byte_data(struct i2c_client * client,
104
                                     u8 command, u8 value);
105
extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command);
106
extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
107
                                     u8 command, u16 value);
108
extern s32 i2c_smbus_process_call(struct i2c_client * client,
109
                                  u8 command, u16 value);
110
/* Returns the number of read bytes */
111
extern s32 i2c_smbus_read_block_data(struct i2c_client * client,
112
                                     u8 command, u8 *values);
113
extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
114
                                      u8 command, u8 length,
115
                                      u8 *values);
116
extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
117
                                          u8 command, u8 length,
118
                                          u8 *values);
119
 
120
 
121
/*
122
 * A driver is capable of handling one or more physical devices present on
123
 * I2C adapters. This information is used to inform the driver of adapter
124
 * events.
125
 */
126
 
127
struct i2c_driver {
128
        char name[32];
129
        int id;
130
        unsigned int flags;             /* div., see below              */
131
 
132
        /* Notifies the driver that a new bus has appeared. This routine
133
         * can be used by the driver to test if the bus meets its conditions
134
         * & seek for the presence of the chip(s) it supports. If found, it
135
         * registers the client(s) that are on the bus to the i2c admin. via
136
         * i2c_attach_client.
137
         */
138
        int (*attach_adapter)(struct i2c_adapter *);
139
 
140
        /* tells the driver that a client is about to be deleted & gives it
141
         * the chance to remove its private data. Also, if the client struct
142
         * has been dynamically allocated by the driver in the function above,
143
         * it must be freed here.
144
         */
145
        int (*detach_client)(struct i2c_client *);
146
 
147
        /* a ioctl like command that can be used to perform specific functions
148
         * with the device.
149
         */
150
        int (*command)(struct i2c_client *client,unsigned int cmd, void *arg);
151
 
152
        /* These two are mainly used for bookkeeping & dynamic unloading of
153
         * kernel modules. inc_use tells the driver that a client is being
154
         * used by another module & that it should increase its ref. counter.
155
         * dec_use is the inverse operation.
156
         * NB: Make sure you have no circular dependencies, or else you get a
157
         * deadlock when trying to unload the modules.
158
        * You should use the i2c_{inc,dec}_use_client functions instead of
159
        * calling this function directly.
160
         */
161
        void (*inc_use)(struct i2c_client *client);
162
        void (*dec_use)(struct i2c_client *client);
163
};
164
 
165
/*
166
 * i2c_client identifies a single device (i.e. chip) that is connected to an
167
 * i2c bus. The behaviour is defined by the routines of the driver. This
168
 * function is mainly used for lookup & other admin. functions.
169
 */
170
struct i2c_client {
171
        char name[32];
172
        int id;
173
        unsigned int flags;             /* div., see below              */
174
        unsigned int addr;              /* chip address - NOTE: 7bit    */
175
                                        /* addresses are stored in the  */
176
                                        /* _LOWER_ 7 bits of this char  */
177
        /* addr: unsigned int to make lm_sensors i2c-isa adapter work
178
          more cleanly. It does not take any more memory space, due to
179
          alignment considerations */
180
        struct i2c_adapter *adapter;    /* the adapter we sit on        */
181
        struct i2c_driver *driver;      /* and our access routines      */
182
        void *data;                     /* for the clients              */
183
        int usage_count;                /* How many accesses currently  */
184
                                        /* to the client                */
185
};
186
 
187
 
188
/*
189
 * The following structs are for those who like to implement new bus drivers:
190
 * i2c_algorithm is the interface to a class of hardware solutions which can
191
 * be addressed using the same bus algorithms - i.e. bit-banging or the PCF8584
192
 * to name two of the most common.
193
 */
194
struct i2c_algorithm {
195
        char name[32];                          /* textual description  */
196
        unsigned int id;
197
 
198
        /* If an adapter algorithm can't to I2C-level access, set master_xfer
199
           to NULL. If an adapter algorithm can do SMBus access, set
200
           smbus_xfer. If set to NULL, the SMBus protocol is simulated
201
           using common I2C messages */
202
        int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg msgs[],
203
                           int num);
204
        int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
205
                           unsigned short flags, char read_write,
206
                           u8 command, int size, union i2c_smbus_data * data);
207
 
208
        /* --- these optional/future use for some adapter types.*/
209
        int (*slave_send)(struct i2c_adapter *,char*,int);
210
        int (*slave_recv)(struct i2c_adapter *,char*,int);
211
 
212
        /* --- ioctl like call to set div. parameters. */
213
        int (*algo_control)(struct i2c_adapter *, unsigned int, unsigned long);
214
 
215
        /* To determine what the adapter supports */
216
        u32 (*functionality) (struct i2c_adapter *);
217
};
218
 
219
/*
220
 * i2c_adapter is the structure used to identify a physical i2c bus along
221
 * with the access algorithms necessary to access it.
222
 */
223
struct i2c_adapter {
224
        char name[32];  /* some useful name to identify the adapter     */
225
        unsigned int id;/* == is algo->id | hwdep.struct->id,           */
226
                        /* for registered values see below              */
227
        struct i2c_algorithm *algo;/* the algorithm to access the bus   */
228
        void *algo_data;
229
 
230
        /* --- These may be NULL, but should increase the module use count */
231
        void (*inc_use)(struct i2c_adapter *);
232
        void (*dec_use)(struct i2c_adapter *);
233
 
234
        /* --- administration stuff. */
235
        int (*client_register)(struct i2c_client *);
236
        int (*client_unregister)(struct i2c_client *);
237
 
238
        void *data;     /* private data for the adapter                 */
239
                        /* some data fields that are used by all types  */
240
                        /* these data fields are readonly to the public */
241
                        /* and can be set via the i2c_ioctl call        */
242
 
243
                        /* data fields that are valid for all devices   */
244
        struct semaphore lock;
245
        unsigned int flags;/* flags specifying div. data                */
246
 
247
        struct i2c_client *clients[I2C_CLIENT_MAX];
248
        int client_count;
249
 
250
        int timeout;
251
        int retries;
252
 
253
#ifdef CONFIG_PROC_FS 
254
        /* No need to set this when you initialize the adapter          */
255
        int inode;
256
#endif /* def CONFIG_PROC_FS */
257
};
258
 
259
/*flags for the driver struct: */
260
#define I2C_DF_NOTIFY   0x01            /* notify on bus (de/a)ttaches  */
261
#define I2C_DF_DUMMY    0x02            /* do not connect any clients */
262
 
263
/*flags for the client struct: */
264
#define I2C_CLIENT_ALLOW_USE            0x01    /* Client allows access */
265
#define I2C_CLIENT_ALLOW_MULTIPLE_USE   0x02    /* Allow multiple access-locks */
266
                                                /* on an i2c_client */
267
 
268
/* i2c_client_address_data is the struct for holding default client
269
 * addresses for a driver and for the parameters supplied on the
270
 * command line
271
 */
272
struct i2c_client_address_data {
273
        unsigned short *normal_i2c;
274
        unsigned short *normal_i2c_range;
275
        unsigned short *probe;
276
        unsigned short *probe_range;
277
        unsigned short *ignore;
278
        unsigned short *ignore_range;
279
        unsigned short *force;
280
};
281
 
282
/* Internal numbers to terminate lists */
283
#define I2C_CLIENT_END 0xfffe
284
 
285
/* The numbers to use to set I2C bus address */
286
#define ANY_I2C_BUS 0xffff
287
 
288
/* The length of the option lists */
289
#define I2C_CLIENT_MAX_OPTS 48
290
 
291
 
292
/* ----- functions exported by i2c.o */
293
 
294
/* administration...
295
 */
296
extern int i2c_add_adapter(struct i2c_adapter *);
297
extern int i2c_del_adapter(struct i2c_adapter *);
298
 
299
extern int i2c_add_driver(struct i2c_driver *);
300
extern int i2c_del_driver(struct i2c_driver *);
301
 
302
extern int i2c_attach_client(struct i2c_client *);
303
extern int i2c_detach_client(struct i2c_client *);
304
 
305
/* Only call these if you grab a resource that makes unloading the
306
   client and the adapter it is on completely impossible. Like when a
307
   /proc directory is entered. */
308
extern void i2c_inc_use_client(struct i2c_client *);
309
extern void i2c_dec_use_client(struct i2c_client *);
310
 
311
/* New function: This is to get an i2c_client-struct for controlling the
312
   client either by using i2c_control-function or having the
313
   client-module export functions that can be used with the i2c_client
314
   -struct. */
315
extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id,
316
                                        struct i2c_client *prev);
317
 
318
/* Should be used with new function
319
   extern struct i2c_client *i2c_get_client(int,int,struct i2c_client *);
320
   to make sure that client-struct is valid and that it is okay to access
321
   the i2c-client.
322
   returns -EACCES if client doesn't allow use (default)
323
   returns -EBUSY if client doesn't allow multiple use (default) and
324
   usage_count >0 */
325
extern int i2c_use_client(struct i2c_client *);
326
extern int i2c_release_client(struct i2c_client *);
327
 
328
/* returns -EBUSY if address has been taken, 0 if not. Note that the only
329
   other place at which this is called is within i2c_attach_client; so
330
   you can cheat by simply not registering. Not recommended, of course! */
331
extern int i2c_check_addr (struct i2c_adapter *adapter, int addr);
332
 
333
/* Detect function. It iterates over all possible addresses itself.
334
 * It will only call found_proc if some client is connected at the
335
 * specific address (unless a 'force' matched);
336
 */
337
typedef int i2c_client_found_addr_proc (struct i2c_adapter *adapter,
338
                                     int addr, unsigned short flags,int kind);
339
 
340
extern int i2c_probe(struct i2c_adapter *adapter,
341
                struct i2c_client_address_data *address_data,
342
                i2c_client_found_addr_proc *found_proc);
343
 
344
/* An ioctl like call to set div. parameters of the adapter.
345
 */
346
extern int i2c_control(struct i2c_client *,unsigned int, unsigned long);
347
 
348
/* This call returns a unique low identifier for each registered adapter,
349
 * or -1 if the adapter was not registered.
350
 */
351
extern int i2c_adapter_id(struct i2c_adapter *adap);
352
 
353
 
354
 
355
/* Return the functionality mask */
356
extern u32 i2c_get_functionality (struct i2c_adapter *adap);
357
 
358
/* Return 1 if adapter supports everything we need, 0 if not. */
359
extern int i2c_check_functionality (struct i2c_adapter *adap, u32 func);
360
 
361
#endif /* __KERNEL__ */
362
 
363
/*
364
 * I2C Message - used for pure i2c transaction, also from /dev interface
365
 */
366
struct i2c_msg {
367
        __u16 addr;     /* slave address                        */
368
        __u16 flags;
369
#define I2C_M_TEN       0x10    /* we have a ten bit chip address       */
370
#define I2C_M_RD        0x01
371
#define I2C_M_NOSTART   0x4000
372
#define I2C_M_REV_DIR_ADDR      0x2000
373
        __u16 len;              /* msg length                           */
374
        __u8 *buf;              /* pointer to msg data                  */
375
};
376
 
377
/* To determine what functionality is present */
378
 
379
#define I2C_FUNC_I2C                    0x00000001
380
#define I2C_FUNC_10BIT_ADDR             0x00000002
381
#define I2C_FUNC_PROTOCOL_MANGLING      0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART} */
382
#define I2C_FUNC_SMBUS_QUICK            0x00010000 
383
#define I2C_FUNC_SMBUS_READ_BYTE        0x00020000 
384
#define I2C_FUNC_SMBUS_WRITE_BYTE       0x00040000 
385
#define I2C_FUNC_SMBUS_READ_BYTE_DATA   0x00080000 
386
#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA  0x00100000 
387
#define I2C_FUNC_SMBUS_READ_WORD_DATA   0x00200000 
388
#define I2C_FUNC_SMBUS_WRITE_WORD_DATA  0x00400000 
389
#define I2C_FUNC_SMBUS_PROC_CALL        0x00800000 
390
#define I2C_FUNC_SMBUS_READ_BLOCK_DATA  0x01000000 
391
#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 
392
#define I2C_FUNC_SMBUS_READ_I2C_BLOCK   0x04000000 /* New I2C-like block */
393
#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK  0x08000000 /* transfer */
394
 
395
#define I2C_FUNC_SMBUS_BYTE I2C_FUNC_SMBUS_READ_BYTE | \
396
                            I2C_FUNC_SMBUS_WRITE_BYTE
397
#define I2C_FUNC_SMBUS_BYTE_DATA I2C_FUNC_SMBUS_READ_BYTE_DATA | \
398
                                 I2C_FUNC_SMBUS_WRITE_BYTE_DATA
399
#define I2C_FUNC_SMBUS_WORD_DATA I2C_FUNC_SMBUS_READ_WORD_DATA | \
400
                                 I2C_FUNC_SMBUS_WRITE_WORD_DATA
401
#define I2C_FUNC_SMBUS_BLOCK_DATA I2C_FUNC_SMBUS_READ_BLOCK_DATA | \
402
                                  I2C_FUNC_SMBUS_WRITE_BLOCK_DATA
403
#define I2C_FUNC_SMBUS_I2C_BLOCK I2C_FUNC_SMBUS_READ_I2C_BLOCK | \
404
                                  I2C_FUNC_SMBUS_WRITE_I2C_BLOCK
405
 
406
#define I2C_FUNC_SMBUS_EMUL I2C_FUNC_SMBUS_QUICK | \
407
                            I2C_FUNC_SMBUS_BYTE | \
408
                            I2C_FUNC_SMBUS_BYTE_DATA | \
409
                            I2C_FUNC_SMBUS_WORD_DATA | \
410
                            I2C_FUNC_SMBUS_PROC_CALL | \
411
                            I2C_FUNC_SMBUS_WRITE_BLOCK_DATA
412
 
413
/*
414
 * Data for SMBus Messages
415
 */
416
#define I2C_SMBUS_BLOCK_MAX     32      /* As specified in SMBus standard */    
417
#define I2C_SMBUS_I2C_BLOCK_MAX 32      /* Not specified but we use same structure */
418
union i2c_smbus_data {
419
        __u8 byte;
420
        __u16 word;
421
        __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */
422
                          /* one more for read length in block process call */
423
};
424
 
425
/* smbus_access read or write markers */
426
#define I2C_SMBUS_READ  1
427
#define I2C_SMBUS_WRITE 0
428
 
429
/* SMBus transaction types (size parameter in the above functions)
430
   Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */
431
#define I2C_SMBUS_QUICK             0
432
#define I2C_SMBUS_BYTE              1
433
#define I2C_SMBUS_BYTE_DATA         2 
434
#define I2C_SMBUS_WORD_DATA         3
435
#define I2C_SMBUS_PROC_CALL         4
436
#define I2C_SMBUS_BLOCK_DATA        5
437
#define I2C_SMBUS_I2C_BLOCK_DATA    6
438
 
439
 
440
/* ----- commands for the ioctl like i2c_command call:
441
 * note that additional calls are defined in the algorithm and hw
442
 *      dependent layers - these can be listed here, or see the
443
 *      corresponding header files.
444
 */
445
                                /* -> bit-adapter specific ioctls       */
446
#define I2C_RETRIES     0x0701  /* number of times a device address      */
447
                                /* should be polled when not            */
448
                                /* acknowledging                        */
449
#define I2C_TIMEOUT     0x0702  /* set timeout - call with int          */
450
 
451
 
452
/* this is for i2c-dev.c        */
453
#define I2C_SLAVE       0x0703  /* Change slave address                 */
454
                                /* Attn.: Slave address is 7 or 10 bits */
455
#define I2C_SLAVE_FORCE 0x0706  /* Change slave address                 */
456
                                /* Attn.: Slave address is 7 or 10 bits */
457
                                /* This changes the address, even if it */
458
                                /* is already taken!                    */
459
#define I2C_TENBIT      0x0704  /* 0 for 7 bit addrs, != 0 for 10 bit   */
460
 
461
#define I2C_FUNCS       0x0705  /* Get the adapter functionality */
462
#define I2C_RDWR        0x0707  /* Combined R/W transfer (one stop only)*/
463
#if 0
464
#define I2C_ACK_TEST    0x0710  /* See if a slave is at a specific address */
465
#endif
466
 
467
#define I2C_SMBUS       0x0720  /* SMBus-level access */
468
 
469
/* ... algo-bit.c recognizes */
470
#define I2C_UDELAY      0x0705  /* set delay in microsecs between each  */
471
                                /* written byte (except address)        */
472
#define I2C_MDELAY      0x0706  /* millisec delay between written bytes */
473
 
474
/* ----- I2C-DEV: char device interface stuff ------------------------- */
475
 
476
#define I2C_MAJOR       89              /* Device major number          */
477
 
478
#ifdef __KERNEL__
479
 
480
#  ifndef NULL
481
#    define NULL ( (void *) 0 )
482
#  endif
483
 
484
#  ifndef ENODEV
485
#    include <asm/errno.h>
486
#  endif
487
 
488
/* These defines are used for probing i2c client addresses */
489
/* Default fill of many variables */
490
#define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
491
                          I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
492
                          I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
493
                          I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
494
                          I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
495
                          I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
496
                          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
 
507
/* This is ugly. We need to evaluate I2C_CLIENT_MAX_OPTS before it is
508
   stringified */
509
#define I2C_CLIENT_MODPARM_AUX1(x) "1-" #x "h"
510
#define I2C_CLIENT_MODPARM_AUX(x) I2C_CLIENT_MODPARM_AUX1(x)
511
#define I2C_CLIENT_MODPARM I2C_CLIENT_MODPARM_AUX(I2C_CLIENT_MAX_OPTS)
512
 
513
/* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the
514
   module header */
515
 
516
#define I2C_CLIENT_MODULE_PARM(var,desc) \
517
  static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \
518
  MODULE_PARM(var,I2C_CLIENT_MODPARM); \
519
  MODULE_PARM_DESC(var,desc)
520
 
521
/* This is the one you want to use in your own modules */
522
#define I2C_CLIENT_INSMOD \
523
  I2C_CLIENT_MODULE_PARM(probe, \
524
                      "List of adapter,address pairs to scan additionally"); \
525
  I2C_CLIENT_MODULE_PARM(probe_range, \
526
                      "List of adapter,start-addr,end-addr triples to scan " \
527
                      "additionally"); \
528
  I2C_CLIENT_MODULE_PARM(ignore, \
529
                      "List of adapter,address pairs not to scan"); \
530
  I2C_CLIENT_MODULE_PARM(ignore_range, \
531
                      "List of adapter,start-addr,end-addr triples not to " \
532
                      "scan"); \
533
  I2C_CLIENT_MODULE_PARM(force, \
534
                      "List of adapter,address pairs to boldly assume " \
535
                      "to be present"); \
536
  static struct i2c_client_address_data addr_data = \
537
                                       {normal_i2c, normal_i2c_range, \
538
                                        probe, probe_range, \
539
                                        ignore, ignore_range, \
540
                                        force}
541
 
542
/* Detect whether we are on the isa bus. If this returns true, all i2c
543
   access will fail! */
544
#define i2c_is_isa_client(clientptr) \
545
        ((clientptr)->adapter->algo->id == I2C_ALGO_ISA)
546
#define i2c_is_isa_adapter(adapptr) \
547
        ((adapptr)->algo->id == I2C_ALGO_ISA)
548
 
549
#endif /* def __KERNEL__ */
550
#endif /* I2C_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.