summaryrefslogtreecommitdiff
path: root/include/linux/i2c.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <greg@kroah.com>2003-05-06 20:56:29 -0700
committerGreg Kroah-Hartman <greg@kroah.com>2003-05-06 20:56:29 -0700
commit66731c779fd100e15efacea9a8704d7dd345f0e4 (patch)
tree8778bfbdc42880977cc96b5fd06cbb33712a7596 /include/linux/i2c.h
parent83c0aee51be739d0189167c8d81e4a0a47a3e5be (diff)
parentc2769b50d1a63028dfc07d26fc8f2cbeac5227d1 (diff)
Merge kroah.com:/home/greg/linux/BK/bleed-2.5
into kroah.com:/home/greg/linux/BK/gregkh-2.5
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r--include/linux/i2c.h40
1 files changed, 28 insertions, 12 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index c506e41b9303..6876a6705bb8 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -39,12 +39,6 @@
/* --- General options ------------------------------------------------ */
-#define I2C_ALGO_MAX 4 /* control memory consumption */
-#define I2C_ADAP_MAX 16
-#define I2C_DRIVER_MAX 16
-#define I2C_CLIENT_MAX 32
-#define I2C_DUMMY_MAX 4
-
struct i2c_msg;
struct i2c_algorithm;
struct i2c_adapter;
@@ -131,6 +125,7 @@ struct i2c_driver {
* i2c_attach_client.
*/
int (*attach_adapter)(struct i2c_adapter *);
+ int (*detach_adapter)(struct i2c_adapter *);
/* tells the driver that a client is about to be deleted & gives it
* the chance to remove its private data. Also, if the client struct
@@ -145,6 +140,7 @@ struct i2c_driver {
int (*command)(struct i2c_client *client,unsigned int cmd, void *arg);
struct device_driver driver;
+ struct list_head list;
};
#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
@@ -169,6 +165,7 @@ struct i2c_client {
int usage_count; /* How many accesses currently */
/* to the client */
struct device dev; /* the device structure */
+ struct list_head list;
};
#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
@@ -228,6 +225,7 @@ struct i2c_adapter {
struct module *owner;
unsigned int id;/* == is algo->id | hwdep.struct->id, */
/* for registered values see below */
+ unsigned int class;
struct i2c_algorithm *algo;/* the algorithm to access the bus */
void *algo_data;
@@ -236,12 +234,10 @@ struct i2c_adapter {
int (*client_unregister)(struct i2c_client *);
/* data fields that are valid for all devices */
- struct semaphore bus;
- struct semaphore list;
+ struct semaphore bus_lock;
+ struct semaphore clist_lock;
unsigned int flags;/* flags specifying div. data */
- struct i2c_client *clients[I2C_CLIENT_MAX];
-
int timeout;
int retries;
struct device dev; /* the adapter device */
@@ -250,6 +246,10 @@ struct i2c_adapter {
/* No need to set this when you initialize the adapter */
int inode;
#endif /* def CONFIG_PROC_FS */
+
+ int nr;
+ struct list_head clients;
+ struct list_head list;
};
#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
@@ -265,7 +265,11 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
/*flags for the driver struct: */
#define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */
-#define I2C_DF_DUMMY 0x02 /* do not connect any clients */
+#if 0
+/* this flag is gone -- there is a (optional) driver->detach_adapter
+ * callback now which can be used instead */
+# define I2C_DF_DUMMY 0x02
+#endif
/*flags for the client struct: */
#define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */
@@ -275,6 +279,12 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */
/* Must equal I2C_M_TEN below */
+/* i2c adapter classes (bitmask) */
+#define I2C_ADAP_CLASS_SMBUS (1<<0) /* lm_sensors, ... */
+#define I2C_ADAP_CLASS_TV_ANALOG (1<<1) /* bttv + friends */
+#define I2C_ADAP_CLASS_TV_DIGINAL (1<<2) /* dbv cards */
+#define I2C_ADAP_CLASS_DDC (1<<3) /* i2c-matroxfb ? */
+
/* i2c_client_address_data is the struct for holding default client
* addresses for a driver and for the parameters supplied on the
* command line
@@ -331,6 +341,11 @@ extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id,
extern int i2c_use_client(struct i2c_client *);
extern int i2c_release_client(struct i2c_client *);
+/* call the i2c_client->command() of all attached clients with
+ * the given arguments */
+extern void i2c_clients_command(struct i2c_adapter *adap,
+ unsigned int cmd, void *arg);
+
/* returns -EBUSY if address has been taken, 0 if not. Note that the only
other place at which this is called is within i2c_attach_client; so
you can cheat by simply not registering. Not recommended, of course! */
@@ -352,7 +367,8 @@ extern int i2c_control(struct i2c_client *,unsigned int, unsigned long);
* or -1 if the adapter was not registered.
*/
extern int i2c_adapter_id(struct i2c_adapter *adap);
-
+extern struct i2c_adapter* i2c_get_adapter(int id);
+extern void i2c_put_adapter(struct i2c_adapter *adap);
/* Return the functionality mask */