Loading include/linux/i2c.h +55 −60 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ struct property_entry; * transmit an arbitrary number of messages without interruption. * @count must be be less than 64k since msg.len is u16. */ extern int i2c_transfer_buffer_flags(const struct i2c_client *client, int i2c_transfer_buffer_flags(const struct i2c_client *client, char *buf, int count, u16 flags); /** Loading Loading @@ -115,11 +115,9 @@ static inline int i2c_master_send_dmasafe(const struct i2c_client *client, /* Transfer num messages. */ extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); /* Unlocked flavor */ extern int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); /* This is the very generalized SMBus access routine. You probably do not want to use this, though; one of the functions below may be much easier, Loading @@ -138,15 +136,13 @@ s32 __i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, /* Now follow the 'nice' access routines. These also document the calling conventions of i2c_smbus_xfer. */ extern s32 i2c_smbus_read_byte(const struct i2c_client *client); extern s32 i2c_smbus_write_byte(const struct i2c_client *client, u8 value); extern s32 i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command); extern s32 i2c_smbus_write_byte_data(const struct i2c_client *client, s32 i2c_smbus_read_byte(const struct i2c_client *client); s32 i2c_smbus_write_byte(const struct i2c_client *client, u8 value); s32 i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command); s32 i2c_smbus_write_byte_data(const struct i2c_client *client, u8 command, u8 value); extern s32 i2c_smbus_read_word_data(const struct i2c_client *client, u8 command); extern s32 i2c_smbus_write_word_data(const struct i2c_client *client, s32 i2c_smbus_read_word_data(const struct i2c_client *client, u8 command); s32 i2c_smbus_write_word_data(const struct i2c_client *client, u8 command, u16 value); static inline s32 Loading @@ -165,19 +161,18 @@ i2c_smbus_write_word_swapped(const struct i2c_client *client, } /* Returns the number of read bytes */ extern s32 i2c_smbus_read_block_data(const struct i2c_client *client, s32 i2c_smbus_read_block_data(const struct i2c_client *client, u8 command, u8 *values); extern s32 i2c_smbus_write_block_data(const struct i2c_client *client, s32 i2c_smbus_write_block_data(const struct i2c_client *client, u8 command, u8 length, const u8 *values); /* Returns the number of read bytes */ extern s32 i2c_smbus_read_i2c_block_data(const struct i2c_client *client, s32 i2c_smbus_read_i2c_block_data(const struct i2c_client *client, u8 command, u8 length, u8 *values); extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client, s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client, u8 command, u8 length, const u8 *values); s32 i2c_smbus_read_i2c_block_data_or_emulated(const struct i2c_client *client, u8 command, u8 length, const u8 *values); extern s32 i2c_smbus_read_i2c_block_data_or_emulated(const struct i2c_client *client, u8 command, u8 length, u8 *values); u8 *values); int i2c_get_device_id(const struct i2c_client *client, struct i2c_device_identity *id); #endif /* I2C */ Loading Loading @@ -337,9 +332,9 @@ struct i2c_client { }; #define to_i2c_client(d) container_of(d, struct i2c_client, dev) extern struct i2c_client *i2c_verify_client(struct device *dev); extern struct i2c_adapter *i2c_verify_adapter(struct device *dev); extern const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, struct i2c_client *i2c_verify_client(struct device *dev); struct i2c_adapter *i2c_verify_adapter(struct device *dev); const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, const struct i2c_client *client); static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj) Loading Loading @@ -369,9 +364,9 @@ enum i2c_slave_event { I2C_SLAVE_STOP, }; extern int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb); extern int i2c_slave_unregister(struct i2c_client *client); extern bool i2c_detect_slave_mode(struct device *dev); int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb); int i2c_slave_unregister(struct i2c_client *client); bool i2c_detect_slave_mode(struct device *dev); static inline int i2c_slave_event(struct i2c_client *client, enum i2c_slave_event event, u8 *val) Loading Loading @@ -440,10 +435,10 @@ struct i2c_board_info { * with integrated I2C, a config eeprom, sensors, and a codec that's * used in conjunction with the primary hardware. */ extern struct i2c_client * struct i2c_client * i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info); extern struct i2c_client * struct i2c_client * i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *info); /* If you don't know the exact address of an I2C device, use this variant Loading @@ -452,33 +447,33 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf * it must return 1 on successful probe, 0 otherwise. If it is not provided, * a default probing method is used. */ extern struct i2c_client * struct i2c_client * i2c_new_scanned_device(struct i2c_adapter *adap, struct i2c_board_info *info, unsigned short const *addr_list, int (*probe)(struct i2c_adapter *adap, unsigned short addr)); extern struct i2c_client * struct i2c_client * i2c_new_probed_device(struct i2c_adapter *adap, struct i2c_board_info *info, unsigned short const *addr_list, int (*probe)(struct i2c_adapter *adap, unsigned short addr)); /* Common custom probe functions */ extern int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr); int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr); extern struct i2c_client * struct i2c_client * i2c_new_dummy_device(struct i2c_adapter *adapter, u16 address); extern struct i2c_client * struct i2c_client * devm_i2c_new_dummy_device(struct device *dev, struct i2c_adapter *adap, u16 address); extern struct i2c_client * struct i2c_client * i2c_new_ancillary_device(struct i2c_client *client, const char *name, u16 default_addr); extern void i2c_unregister_device(struct i2c_client *client); void i2c_unregister_device(struct i2c_client *client); #endif /* I2C */ /* Mainboard arch_initcall() code should register all its I2C devices. Loading @@ -486,7 +481,7 @@ extern void i2c_unregister_device(struct i2c_client *client); * Modules for add-on boards must use other calls. */ #ifdef CONFIG_I2C_BOARDINFO extern int int i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n); #else Loading Loading @@ -840,12 +835,12 @@ static inline void i2c_mark_adapter_resumed(struct i2c_adapter *adap) /* administration... */ #if IS_ENABLED(CONFIG_I2C) extern int i2c_add_adapter(struct i2c_adapter *adap); extern void i2c_del_adapter(struct i2c_adapter *adap); extern int i2c_add_numbered_adapter(struct i2c_adapter *adap); int i2c_add_adapter(struct i2c_adapter *adap); void i2c_del_adapter(struct i2c_adapter *adap); int i2c_add_numbered_adapter(struct i2c_adapter *adap); extern int i2c_register_driver(struct module *owner, struct i2c_driver *driver); extern void i2c_del_driver(struct i2c_driver *driver); int i2c_register_driver(struct module *owner, struct i2c_driver *driver); void i2c_del_driver(struct i2c_driver *driver); /* use a define to avoid include chaining to get THIS_MODULE */ #define i2c_add_driver(driver) \ Loading @@ -858,12 +853,12 @@ static inline bool i2c_client_has_driver(struct i2c_client *client) /* call the i2c_client->command() of all attached clients with * the given arguments */ extern void i2c_clients_command(struct i2c_adapter *adap, void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg); extern struct i2c_adapter *i2c_get_adapter(int nr); extern void i2c_put_adapter(struct i2c_adapter *adap); extern unsigned int i2c_adapter_depth(struct i2c_adapter *adapter); struct i2c_adapter *i2c_get_adapter(int nr); void i2c_put_adapter(struct i2c_adapter *adap); unsigned int i2c_adapter_depth(struct i2c_adapter *adapter); void i2c_parse_fw_timings(struct device *dev, struct i2c_timings *t, bool use_defaults); Loading Loading @@ -935,15 +930,15 @@ int i2c_handle_smbus_host_notify(struct i2c_adapter *adap, unsigned short addr); #if IS_ENABLED(CONFIG_OF) /* must call put_device() when done with returned i2c_client device */ extern struct i2c_client *of_find_i2c_device_by_node(struct device_node *node); struct i2c_client *of_find_i2c_device_by_node(struct device_node *node); /* must call put_device() when done with returned i2c_adapter device */ extern struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node); struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node); /* must call i2c_put_adapter() when done with returned i2c_adapter device */ struct i2c_adapter *of_get_i2c_adapter_by_node(struct device_node *node); extern const struct of_device_id const struct of_device_id *i2c_of_match_device(const struct of_device_id *matches, struct i2c_client *client); Loading Loading
include/linux/i2c.h +55 −60 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ struct property_entry; * transmit an arbitrary number of messages without interruption. * @count must be be less than 64k since msg.len is u16. */ extern int i2c_transfer_buffer_flags(const struct i2c_client *client, int i2c_transfer_buffer_flags(const struct i2c_client *client, char *buf, int count, u16 flags); /** Loading Loading @@ -115,11 +115,9 @@ static inline int i2c_master_send_dmasafe(const struct i2c_client *client, /* Transfer num messages. */ extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); /* Unlocked flavor */ extern int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); /* This is the very generalized SMBus access routine. You probably do not want to use this, though; one of the functions below may be much easier, Loading @@ -138,15 +136,13 @@ s32 __i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, /* Now follow the 'nice' access routines. These also document the calling conventions of i2c_smbus_xfer. */ extern s32 i2c_smbus_read_byte(const struct i2c_client *client); extern s32 i2c_smbus_write_byte(const struct i2c_client *client, u8 value); extern s32 i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command); extern s32 i2c_smbus_write_byte_data(const struct i2c_client *client, s32 i2c_smbus_read_byte(const struct i2c_client *client); s32 i2c_smbus_write_byte(const struct i2c_client *client, u8 value); s32 i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command); s32 i2c_smbus_write_byte_data(const struct i2c_client *client, u8 command, u8 value); extern s32 i2c_smbus_read_word_data(const struct i2c_client *client, u8 command); extern s32 i2c_smbus_write_word_data(const struct i2c_client *client, s32 i2c_smbus_read_word_data(const struct i2c_client *client, u8 command); s32 i2c_smbus_write_word_data(const struct i2c_client *client, u8 command, u16 value); static inline s32 Loading @@ -165,19 +161,18 @@ i2c_smbus_write_word_swapped(const struct i2c_client *client, } /* Returns the number of read bytes */ extern s32 i2c_smbus_read_block_data(const struct i2c_client *client, s32 i2c_smbus_read_block_data(const struct i2c_client *client, u8 command, u8 *values); extern s32 i2c_smbus_write_block_data(const struct i2c_client *client, s32 i2c_smbus_write_block_data(const struct i2c_client *client, u8 command, u8 length, const u8 *values); /* Returns the number of read bytes */ extern s32 i2c_smbus_read_i2c_block_data(const struct i2c_client *client, s32 i2c_smbus_read_i2c_block_data(const struct i2c_client *client, u8 command, u8 length, u8 *values); extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client, s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client, u8 command, u8 length, const u8 *values); s32 i2c_smbus_read_i2c_block_data_or_emulated(const struct i2c_client *client, u8 command, u8 length, const u8 *values); extern s32 i2c_smbus_read_i2c_block_data_or_emulated(const struct i2c_client *client, u8 command, u8 length, u8 *values); u8 *values); int i2c_get_device_id(const struct i2c_client *client, struct i2c_device_identity *id); #endif /* I2C */ Loading Loading @@ -337,9 +332,9 @@ struct i2c_client { }; #define to_i2c_client(d) container_of(d, struct i2c_client, dev) extern struct i2c_client *i2c_verify_client(struct device *dev); extern struct i2c_adapter *i2c_verify_adapter(struct device *dev); extern const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, struct i2c_client *i2c_verify_client(struct device *dev); struct i2c_adapter *i2c_verify_adapter(struct device *dev); const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, const struct i2c_client *client); static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj) Loading Loading @@ -369,9 +364,9 @@ enum i2c_slave_event { I2C_SLAVE_STOP, }; extern int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb); extern int i2c_slave_unregister(struct i2c_client *client); extern bool i2c_detect_slave_mode(struct device *dev); int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb); int i2c_slave_unregister(struct i2c_client *client); bool i2c_detect_slave_mode(struct device *dev); static inline int i2c_slave_event(struct i2c_client *client, enum i2c_slave_event event, u8 *val) Loading Loading @@ -440,10 +435,10 @@ struct i2c_board_info { * with integrated I2C, a config eeprom, sensors, and a codec that's * used in conjunction with the primary hardware. */ extern struct i2c_client * struct i2c_client * i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info); extern struct i2c_client * struct i2c_client * i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *info); /* If you don't know the exact address of an I2C device, use this variant Loading @@ -452,33 +447,33 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf * it must return 1 on successful probe, 0 otherwise. If it is not provided, * a default probing method is used. */ extern struct i2c_client * struct i2c_client * i2c_new_scanned_device(struct i2c_adapter *adap, struct i2c_board_info *info, unsigned short const *addr_list, int (*probe)(struct i2c_adapter *adap, unsigned short addr)); extern struct i2c_client * struct i2c_client * i2c_new_probed_device(struct i2c_adapter *adap, struct i2c_board_info *info, unsigned short const *addr_list, int (*probe)(struct i2c_adapter *adap, unsigned short addr)); /* Common custom probe functions */ extern int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr); int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr); extern struct i2c_client * struct i2c_client * i2c_new_dummy_device(struct i2c_adapter *adapter, u16 address); extern struct i2c_client * struct i2c_client * devm_i2c_new_dummy_device(struct device *dev, struct i2c_adapter *adap, u16 address); extern struct i2c_client * struct i2c_client * i2c_new_ancillary_device(struct i2c_client *client, const char *name, u16 default_addr); extern void i2c_unregister_device(struct i2c_client *client); void i2c_unregister_device(struct i2c_client *client); #endif /* I2C */ /* Mainboard arch_initcall() code should register all its I2C devices. Loading @@ -486,7 +481,7 @@ extern void i2c_unregister_device(struct i2c_client *client); * Modules for add-on boards must use other calls. */ #ifdef CONFIG_I2C_BOARDINFO extern int int i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n); #else Loading Loading @@ -840,12 +835,12 @@ static inline void i2c_mark_adapter_resumed(struct i2c_adapter *adap) /* administration... */ #if IS_ENABLED(CONFIG_I2C) extern int i2c_add_adapter(struct i2c_adapter *adap); extern void i2c_del_adapter(struct i2c_adapter *adap); extern int i2c_add_numbered_adapter(struct i2c_adapter *adap); int i2c_add_adapter(struct i2c_adapter *adap); void i2c_del_adapter(struct i2c_adapter *adap); int i2c_add_numbered_adapter(struct i2c_adapter *adap); extern int i2c_register_driver(struct module *owner, struct i2c_driver *driver); extern void i2c_del_driver(struct i2c_driver *driver); int i2c_register_driver(struct module *owner, struct i2c_driver *driver); void i2c_del_driver(struct i2c_driver *driver); /* use a define to avoid include chaining to get THIS_MODULE */ #define i2c_add_driver(driver) \ Loading @@ -858,12 +853,12 @@ static inline bool i2c_client_has_driver(struct i2c_client *client) /* call the i2c_client->command() of all attached clients with * the given arguments */ extern void i2c_clients_command(struct i2c_adapter *adap, void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg); extern struct i2c_adapter *i2c_get_adapter(int nr); extern void i2c_put_adapter(struct i2c_adapter *adap); extern unsigned int i2c_adapter_depth(struct i2c_adapter *adapter); struct i2c_adapter *i2c_get_adapter(int nr); void i2c_put_adapter(struct i2c_adapter *adap); unsigned int i2c_adapter_depth(struct i2c_adapter *adapter); void i2c_parse_fw_timings(struct device *dev, struct i2c_timings *t, bool use_defaults); Loading Loading @@ -935,15 +930,15 @@ int i2c_handle_smbus_host_notify(struct i2c_adapter *adap, unsigned short addr); #if IS_ENABLED(CONFIG_OF) /* must call put_device() when done with returned i2c_client device */ extern struct i2c_client *of_find_i2c_device_by_node(struct device_node *node); struct i2c_client *of_find_i2c_device_by_node(struct device_node *node); /* must call put_device() when done with returned i2c_adapter device */ extern struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node); struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node); /* must call i2c_put_adapter() when done with returned i2c_adapter device */ struct i2c_adapter *of_get_i2c_adapter_by_node(struct device_node *node); extern const struct of_device_id const struct of_device_id *i2c_of_match_device(const struct of_device_id *matches, struct i2c_client *client); Loading