2.22. V4L2 非同步 kAPI¶
-
enum v4l2_async_match_type¶
用於識別匹配項的非同步子裝置邏輯型別
常量
V4L2_ASYNC_MATCH_TYPE_I2C匹配將檢查 I2C 介面卡 ID 和地址
V4L2_ASYNC_MATCH_TYPE_FWNODE匹配將使用韌體節點
描述
此列舉由非同步連線邏輯使用,以定義將用於匹配非同步裝置的演算法。
-
struct v4l2_async_match_desc¶
非同步連線匹配資訊
定義:
struct v4l2_async_match_desc {
enum v4l2_async_match_type type;
union {
struct fwnode_handle *fwnode;
struct {
int adapter_id;
unsigned short address;
} i2c;
};
};
成員
type將使用的匹配型別
{unnamed_union}anonymous
fwnode要匹配的
struct fwnode_handle的指標。如果 match_type 是V4L2_ASYNC_MATCH_TYPE_FWNODE,則使用。i2c嵌入式結構,包含要匹配的 I2C 引數。 match.i2c.adapter_id 和 match.i2c.address 都應匹配。如果 match_type 是
V4L2_ASYNC_MATCH_TYPE_I2C,則使用。i2c.adapter_id要匹配的 I2C 介面卡 ID。如果 match_type 是
V4L2_ASYNC_MATCH_TYPE_I2C,則使用。i2c.address要匹配的 I2C 地址。如果 match_type 是
V4L2_ASYNC_MATCH_TYPE_I2C,則使用。
-
struct v4l2_async_connection¶
子裝置連線描述符,如橋接器所知
定義:
struct v4l2_async_connection {
struct v4l2_async_match_desc match;
struct v4l2_async_notifier *notifier;
struct list_head asc_entry;
struct list_head asc_subdev_entry;
struct v4l2_subdev *sd;
};
成員
match匹配型別和每個匯流排型別匹配資料集的結構
notifier連線相關的非同步通知程式
asc_entry用於將
struct v4l2_async_connection物件新增到通知程式的 waiting_list 或 done_listasc_subdev_entrystruct v4l2_async_subdev.asc_list 列表中的條目
sd相關的子裝置
描述
當此結構用作驅動程式特定結構中的成員時,驅動程式特定結構應包含 struct v4l2_async_connection 作為其第一個成員。
-
struct v4l2_async_notifier_operations¶
非同步 V4L2 通知程式操作
定義:
struct v4l2_async_notifier_operations {
int (*bound)(struct v4l2_async_notifier *notifier,struct v4l2_subdev *subdev, struct v4l2_async_connection *asc);
int (*complete)(struct v4l2_async_notifier *notifier);
void (*unbind)(struct v4l2_async_notifier *notifier,struct v4l2_subdev *subdev, struct v4l2_async_connection *asc);
void (*destroy)(struct v4l2_async_connection *asc);
};
成員
bound子裝置已由給定的連線繫結
complete所有連線都已成功繫結。complete 回撥僅針對根通知程式執行。
unbind子裝置正在離開
destroyasc 即將被釋放
-
struct v4l2_async_notifier¶
v4l2_device 通知程式資料
定義:
struct v4l2_async_notifier {
const struct v4l2_async_notifier_operations *ops;
struct v4l2_device *v4l2_dev;
struct v4l2_subdev *sd;
struct v4l2_async_notifier *parent;
struct list_head waiting_list;
struct list_head done_list;
struct list_head notifier_entry;
};
成員
ops通知程式操作
v4l2_dev根通知程式的 v4l2_device,否則為 NULL
sd註冊通知程式的子裝置,否則為 NULL
parent父通知程式
waiting_liststruct v4l2_async_connection列表,等待其驅動程式done_liststruct v4l2_subdev列表,已探測notifier_entry全域性通知程式列表中的成員
-
struct v4l2_async_subdev_endpoint¶
子裝置的 fwnode 列表中的條目
定義:
struct v4l2_async_subdev_endpoint {
struct list_head async_subdev_endpoint_entry;
struct fwnode_handle *endpoint;
};
成員
async_subdev_endpoint_entrystruct v4l2_subdev的 async_subdev_endpoint_list 中的條目endpoint端點 fwnode,用於匹配子裝置
-
void v4l2_async_debug_init(struct dentry *debugfs_dir)¶
初始化除錯工具。
引數
struct dentry *debugfs_dir指向父 debugfs
struct dentry的指標
-
void v4l2_async_nf_init(struct v4l2_async_notifier *notifier, struct v4l2_device *v4l2_dev)¶
初始化通知程式。
引數
struct v4l2_async_notifier *notifier指向
struct v4l2_async_notifier的指標struct v4l2_device *v4l2_dev指向
struct v4l2_device的指標
描述
此函式初始化通知程式的 asc_entry。必須在使用以下方法之一將子裝置新增到通知程式之前呼叫它:v4l2_async_nf_add_fwnode_remote()、v4l2_async_nf_add_fwnode() 或 v4l2_async_nf_add_i2c()。
-
void v4l2_async_subdev_nf_init(struct v4l2_async_notifier *notifier, struct v4l2_subdev *sd)¶
初始化子裝置通知程式。
引數
struct v4l2_async_notifier *notifier指向
struct v4l2_async_notifier的指標struct v4l2_subdev *sd指向
struct v4l2_subdev的指標
描述
此函式初始化通知程式的 asc_list。必須在使用以下方法之一將子裝置新增到通知程式之前呼叫它:v4l2_async_nf_add_fwnode_remote()、v4l2_async_nf_add_fwnode() 或 v4l2_async_nf_add_i2c()。
-
v4l2_async_nf_add_fwnode¶
v4l2_async_nf_add_fwnode (notifier, fwnode, type)
分配並將 fwnode 非同步子裝置新增到通知程式的主 asc_list。
引數
notifier指向
struct v4l2_async_notifier的指標fwnode要匹配的子裝置的 fwnode 控制代碼,指向
struct fwnode_handletype驅動程式的非同步子裝置或連線結構的型別。
struct v4l2_async_connection應該是驅動程式的非同步結構的第一個成員,即兩者都從相同的記憶體地址開始。
描述
分配大小為 asc_struct_size 的 fwnode 匹配的 asc,並將其新增到通知程式的 asc_list。此函式還會獲取 fwnode 的引用,該引用稍後會在通知程式清理時釋放。
-
v4l2_async_nf_add_fwnode_remote¶
v4l2_async_nf_add_fwnode_remote (notifier, ep, type)
分配並將 fwnode 遠端非同步子裝置新增到通知程式的主 asc_list。
引數
notifier指向
struct v4l2_async_notifier的指標ep指向要匹配的遠端連線的本地端點,指向
struct fwnode_handletype驅動程式的非同步連線結構的型別。
struct v4l2_async_connection應該是驅動程式的非同步連線結構的第一個成員,即兩者都從相同的記憶體地址開始。
描述
獲取給定本地端點的遠端端點,將其設定為 fwnode 匹配,並將非同步連線新增到通知程式的 asc_list。此函式還會獲取 fwnode 的引用,該引用稍後會在通知程式清理時釋放。
這就像 v4l2_async_nf_add_fwnode(),但不同之處在於 fwnode 引用本地端點,而不是遠端端點。
-
v4l2_async_nf_add_i2c¶
v4l2_async_nf_add_i2c (notifier, adapter, address, type)
分配並將 i2c 非同步子裝置新增到通知程式的主 asc_list。
引數
notifier指向
struct v4l2_async_notifier的指標adapter要匹配的 I2C 介面卡 ID
address要匹配的連線的 I2C 地址
type驅動程式的非同步連線結構的型別。
struct v4l2_async_connection應該是驅動程式的非同步連線結構的第一個成員,即兩者都從相同的記憶體地址開始。
描述
與 v4l2_async_nf_add_fwnode() 相同,但適用於 I2C 匹配的連線。
-
int v4l2_async_subdev_endpoint_add(struct v4l2_subdev *sd, struct fwnode_handle *fwnode)¶
將端點 fwnode 新增到非同步子裝置匹配列表
引數
struct v4l2_subdev *sd子裝置
struct fwnode_handle *fwnode要匹配的端點 fwnode
描述
將 fwnode 新增到非同步子裝置的匹配列表。這允許從單個設備註冊多個非同步子裝置。
請注意,如果已將端點新增到子裝置的 fwnode 匹配列表,則呼叫 v4l2_subdev_cleanup() 作為子裝置清理的一部分。
失敗時返回錯誤,成功時返回 0。
-
struct v4l2_async_connection *v4l2_async_connection_unique(struct v4l2_subdev *sd)¶
返回子裝置的唯一
struct v4l2_async_connection
引數
struct v4l2_subdev *sd子裝置
描述
當只有一個非同步連線時,返回子裝置的非同步連線。
-
int v4l2_async_nf_register(struct v4l2_async_notifier *notifier)¶
註冊子裝置非同步通知程式
引數
struct v4l2_async_notifier *notifier指向
struct v4l2_async_notifier的指標
-
void v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier)¶
登出子裝置非同步通知程式
引數
struct v4l2_async_notifier *notifier指向
struct v4l2_async_notifier的指標
-
void v4l2_async_nf_cleanup(struct v4l2_async_notifier *notifier)¶
清理通知程式資源
引數
struct v4l2_async_notifier *notifier要清理其資源的通知程式
描述
釋放與通知程式相關的記憶體資源,包括為通知程式分配的非同步連線,但不包括通知程式本身。在呼叫 v4l2_async_nf_add_fwnode_remote()、v4l2_async_nf_add_fwnode() 或 v4l2_async_nf_add_i2c() 之後,使用者負責呼叫此函式以清理通知程式。
在其他情況下呼叫 v4l2_async_nf_cleanup() 沒有害處,只要其記憶體在分配後已清零。
-
v4l2_async_register_subdev¶
v4l2_async_register_subdev (sd)
將子設備註冊到非同步子裝置框架
引數
sd指向
struct v4l2_subdev的指標
-
int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd)¶
將感測器子設備註冊到非同步子裝置框架,並解析設定常見的感測器相關裝置
引數
struct v4l2_subdev *sd指向 struct
v4l2_subdev的指標
描述
此函式就像 v4l2_async_register_subdev() 一樣,但不同之處在於呼叫它也會使用 v4l2_async_nf_parse_fwnode_sensor() 解析韌體介面以獲取遠端引用,並註冊非同步子裝置。透過呼叫 v4l2_async_unregister_subdev() 類似地登出子裝置。
註冊後,子裝置模組將被標記為正在使用。
如果模組不再載入任何註冊嘗試,則會返回錯誤。
-
void v4l2_async_unregister_subdev(struct v4l2_subdev *sd)¶
將子裝置從非同步子裝置框架中登出
引數
struct v4l2_subdev *sd指向
struct v4l2_subdev的指標