i2c buss(i2c-core.c)
2015-12-31 15:53
411 查看
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_client or delete it.for example:echo "i2c_example 34" > new_devicethere will be "0-0022/" directory be createdecho "34" > delete_devicethe "0-0022/" directory will 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):declare i2c adapter, use dynamic bus number i2c_add_numbered_adapter(struct i2c_adapter *adap):declare
i2c adapter, use static bus number i2c_del_adapter(struct i2c_adapter *adap): unregister I2C adapter i2c_register_driver(struct module *owner, struct i2c_driver *driver): register one i2c_driver i2c_del_driver(struct i2c_driver *driver): unregister I2C driver.
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 use of 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's 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 *driver):
i2c_check_addr_busy(struct i2c_adapter *adapter, int addr): check if the addr have already been assigned 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 do 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 be assigned
the i2c driver mainly implement the master_xfer and supply some PM functions
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_client or delete it.for example:echo "i2c_example 34" > new_devicethere will be "0-0022/" directory be createdecho "34" > delete_devicethe "0-0022/" directory will 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):declare i2c adapter, use dynamic bus number i2c_add_numbered_adapter(struct i2c_adapter *adap):declare
i2c adapter, use static bus number i2c_del_adapter(struct i2c_adapter *adap): unregister I2C adapter i2c_register_driver(struct module *owner, struct i2c_driver *driver): register one i2c_driver i2c_del_driver(struct i2c_driver *driver): unregister I2C driver.
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 use of 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's 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 *driver):
i2c_check_addr_busy(struct i2c_adapter *adapter, int addr): check if the addr have already been assigned 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 do 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 be assigned
the i2c driver mainly implement the master_xfer and supply some PM functions
相关文章推荐
- synergy 使用教程· 多台电脑共享键盘和鼠标
- 解决Zxing解析本地图片二维码,识别率低,识别不出来的问题!
- Loader框架
- Cyapi使用心得
- C# String类常用的方法的使用
- IOSFramework打包。
- javascript进击(一)简介
- Oracle分析函数
- ISO/IEC 9899:2011 条款6.8.1——标签语句
- Android进阶_XML解析pull解析,使用反射
- 【MFC】容器类的使用
- Spring MVC
- PLSQL编写函数--例子
- Android的性能优化方法
- gwt调用iframe的方法和变量
- Git使用Tips
- VirtualBox安装后影响另一个应用程序的启动
- 大数据高效复制的处理案例分析总结
- 【WIN10】Segoe MDL2 Assets
- ASP.NET MVC 表单提交多层子级实体集合数据到控制器中