aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/i2c.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r--include/linux/i2c.h92
1 files changed, 3 insertions, 89 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 419ab546b26..02fc617782e 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -110,7 +110,7 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
110 * @driver: Device driver model driver 110 * @driver: Device driver model driver
111 * @id_table: List of I2C devices supported by this driver 111 * @id_table: List of I2C devices supported by this driver
112 * @detect: Callback for device detection 112 * @detect: Callback for device detection
113 * @address_data: The I2C addresses to probe (for detect) 113 * @address_list: The I2C addresses to probe (for detect)
114 * @clients: List of detected clients we created (for i2c-core use only) 114 * @clients: List of detected clients we created (for i2c-core use only)
115 * 115 *
116 * The driver.owner field should be set to the module owner of this driver. 116 * The driver.owner field should be set to the module owner of this driver.
@@ -161,8 +161,8 @@ struct i2c_driver {
161 const struct i2c_device_id *id_table; 161 const struct i2c_device_id *id_table;
162 162
163 /* Device detection callback for automatic device creation */ 163 /* Device detection callback for automatic device creation */
164 int (*detect)(struct i2c_client *, int kind, struct i2c_board_info *); 164 int (*detect)(struct i2c_client *, struct i2c_board_info *);
165 const struct i2c_client_address_data *address_data; 165 const unsigned short *address_list;
166 struct list_head clients; 166 struct list_head clients;
167}; 167};
168#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) 168#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
@@ -391,14 +391,6 @@ static inline void i2c_unlock_adapter(struct i2c_adapter *adapter)
391#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ 391#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
392#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ 392#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */
393 393
394/* i2c_client_address_data is the struct for holding default client
395 * addresses for a driver and for the parameters supplied on the
396 * command line
397 */
398struct i2c_client_address_data {
399 const unsigned short *normal_i2c;
400};
401
402/* Internal numbers to terminate lists */ 394/* Internal numbers to terminate lists */
403#define I2C_CLIENT_END 0xfffeU 395#define I2C_CLIENT_END 0xfffeU
404 396
@@ -576,82 +568,4 @@ union i2c_smbus_data {
576#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ 568#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */
577#define I2C_SMBUS_I2C_BLOCK_DATA 8 569#define I2C_SMBUS_I2C_BLOCK_DATA 8
578 570
579
580#ifdef __KERNEL__
581
582/* These defines are used for probing i2c client addresses */
583/* The length of the option lists */
584#define I2C_CLIENT_MAX_OPTS 48
585
586/* Default fill of many variables */
587#define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
588 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
589 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
590 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
591 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
592 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
593 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
594 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
595 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
596 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
597 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
598 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
599 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
600 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
601 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
602 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END}
603
604/* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the
605 module header */
606
607#define I2C_CLIENT_MODULE_PARM(var,desc) \
608 static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \
609 static unsigned int var##_num; \
610 module_param_array(var, short, &var##_num, 0); \
611 MODULE_PARM_DESC(var, desc)
612
613#define I2C_CLIENT_INSMOD_COMMON \
614static const struct i2c_client_address_data addr_data = { \
615 .normal_i2c = normal_i2c, \
616}
617
618/* These are the ones you want to use in your own drivers. Pick the one
619 which matches the number of devices the driver differenciates between. */
620#define I2C_CLIENT_INSMOD \
621I2C_CLIENT_INSMOD_COMMON
622
623#define I2C_CLIENT_INSMOD_1(chip1) \
624enum chips { any_chip, chip1 }; \
625I2C_CLIENT_INSMOD_COMMON
626
627#define I2C_CLIENT_INSMOD_2(chip1, chip2) \
628enum chips { any_chip, chip1, chip2 }; \
629I2C_CLIENT_INSMOD_COMMON
630
631#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
632enum chips { any_chip, chip1, chip2, chip3 }; \
633I2C_CLIENT_INSMOD_COMMON
634
635#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \
636enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
637I2C_CLIENT_INSMOD_COMMON
638
639#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \
640enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \
641I2C_CLIENT_INSMOD_COMMON
642
643#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \
644enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \
645I2C_CLIENT_INSMOD_COMMON
646
647#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \
648enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
649 chip7 }; \
650I2C_CLIENT_INSMOD_COMMON
651
652#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \
653enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
654 chip7, chip8 }; \
655I2C_CLIENT_INSMOD_COMMON
656#endif /* __KERNEL__ */
657#endif /* _LINUX_I2C_H */ 571#endif /* _LINUX_I2C_H */