I2C Bus (I2C-CORE.C)
I2c_device_probe (struct device *dev) i2c_device_remove (struct device *dev) i2c_device_shutdown (struct device *dev) static const struct Dev_pm_ops I2c_device_pm_ops = {
. Suspend = I2c_device_pm_suspend,
. Resume = I2c_device_pm_resume,
. Freeze = I2c_device_pm_freeze,
. Thaw = I2c_device_pm_thaw,
. Poweroff = I2c_device_pm_poweroff,
. Restore = I2c_device_pm_restore,
Set_runtime_pm_ops (
Pm_generic_runtime_suspend,
Pm_generic_runtime_resume,
Null
)
};
struct Bus_type I2c_bus_type = {
. Name = "I2C",
. match = I2c_device_match,
. Probe = I2c_device_probe,
. remove = I2c_device_remove,
. Shutdown = I2c_device_shutdown,
. PM = &i2c_device_pm_ops,
};
i2c_check_addr_validity (unsigned short addr) i2c_check_addr_busy (struct i2c_adapter *adapter, int addr) I2c_lock_adapter (struct i2c_adapter *adapter) i2c_trylock_adapter (struct i2c_adapter *adapter) i2c_unlock_adapter ( struct i2c_adapter *adapter) i2c_dev_set_name struct (i2c_adapter *adap,struct i2c_client *client i2c_new_) Device (struct i2c_adapter *adap, struct i2c_board_info const *info): Instantiate an I2C device i2c_sysfs_delete_ Device and I2c_sysfs_new_device:there are "New_device" and "delete_device" node that we can use to create one new I2C_CLI ent or delete it.for example:echo "I2c_example" > New_devicethere'll Be "0-0022/" directory is Createdecho "&G" T Delete_devicethe "0-0022/" directory would be removed of_i2c_register_devices (struct i2c_adapter *adap) of_ Find_i2c_device_by_node (struct Device_node *node) of_find_i2c_adapter_by_node (struct-device_node *node) i2c_ Register_adapter (struct i2c_adapter *adap) i2c_add_adapter (sTruct i2c_adapter *adapter):d Eclare I2C adapter, use dynamic bus number i2c_add_numbered_adapter (struct I2C_ Adapter *adap):d Eclare I2C adapter, use static bus Number i2c_del_adapter (struct i2c_adapter *adap): Unregister I2C A Dapter i2c_register_driver (struct module *owner, struct i2c_driver *driver): Register one I2c_driver i2c_del _driver (struct i2c_driver *driver): Unregister I2C.
I2c_use_client (struct i2c_client *client): Increments the reference count of the I2C client structure
I2c_release_client (struct i2c_client *client): Release A with the I2C client structure
struct I2c_cmd_arg {
unsigned cmd;
void *arg;
};
I2c_cmd:
I2c_clients_command:send command to adapter's every client and do the responding I2c_driver ' command interface.
I2c_init:register Bus:i2c_bus_type
I2c_exit:unregister Bus:i2c_bus_type
The functional interface to the I2C busses.
__i2c_transfer:unlocked Flavor of I2c_transfer
I2c_transfer (struct i2c_adapter *adap, struct i2c_mst *msgs, int num): Execute a single or combined I2C message
I2c_master_send (const struct i2c_client *client, char *buf, int count): Issue a single I2C message in master transmit mode
I2C_MASTER_RECV (const struct i2c_client *client, char *buf, int count): Issue a single I2C message in master receive mode, Specially there is a flag i2c_m_rd.
I2c_adapter_id:return adapter ' s Nr.
I2c_detect (struct i2c_adapter *adapter, struct i2c_driver):
I2c_check_addr_busy (struct i2c_adapter *adapter, int addr): Check if the addr have already been to one client of Adapter ' s client list.
I2c_check_addr_validity:as 0x0~0x7 and 0x78~0x7f is revered, so addr must not in those range.
I2c_new_probed_device (struct i2c_adapter *adap, struct i2c_board_info *info, unsigned short const *addr_list, int (*probe ) (struct I2c_adapter *, unsigned short addr): Try select a valid addr from address list to add a new i2c_client.
I2c_get_adapter:give Adapter ' s number to get the adapter and did moudle_get to increase its reference
I2c_put_adapter:decrease its reference
For new I2C driver added:
Use platform bus to register the device and match the driver ' s probe.
In the probe:
I2c_add_numbered_adapter (ADAP); But assign new i2c_algorithm with. Master_xfer and. Functionality
The I2C driver mainly implement the Master_xfer and supply some PM functions