學習資料:https://deepinout.com/camx-kmd/camera-kmd-camsync-v4l2-driver-model-intro.html
僅用於個人學習,侵聯刪
KMD Camera ISP子系統入口介面及檔案
驅動檔案入口:drivers/camera_init.c
整個camera KMD驅動的入口介面:module_init(camera_init);
重要資料結構:
struct camera_submodule_component { int (*init)(void); void (*exit)(void); }; struct camera_submodule { char *name; // 模組名稱 uint num_component; // 元件個數,比如camera_base元件包括了camera sync、crm等模組 const struct camera_submodule_component *component; // 元件函式,包含init和exit函式 }; static const struct camera_submodule_component camera_base[] = { {&cam_req_mgr_init, &cam_req_mgr_exit}, {&cam_sync_init, &cam_sync_exit}, {&cam_smmu_init_module, &cam_smmu_exit_module}, {&cam_cpas_dev_init_module, &cam_cpas_dev_exit_module}, {&cam_cdm_intf_init_module, &cam_cdm_intf_exit_module}, {&cam_hw_cdm_init_module, &cam_hw_cdm_exit_module}, }; static const struct camera_submodule submodule_table[] = { { .name = "Camera BASE", .num_component = ARRAY_SIZE(camera_base), .component = camera_base, }, { .name = "Camera TFE", .num_component = ARRAY_SIZE(camera_tfe), .component = camera_tfe, }, { .name = "Camera ISP", .num_component = ARRAY_SIZE(camera_isp), .component = camera_isp, }, { .name = "Camera SENSOR", .num_component = ARRAY_SIZE(camera_sensor), .component = camera_sensor }, { .name = "Camera ICP", .num_component = ARRAY_SIZE(camera_icp), .component = camera_icp, }, { .name = "Camera OPE", .num_component = ARRAY_SIZE(camera_ope), .component = camera_ope, }, { .name = "Camera JPEG", .num_component = ARRAY_SIZE(camera_jpeg), .component = camera_jpeg, }, { .name = "Camera FD", .num_component = ARRAY_SIZE(camera_fd), .component = camera_fd, }, { .name = "Camera LRME", .num_component = ARRAY_SIZE(camera_lrme), .component = camera_lrme, }, { .name = "Camera CRE", .num_component = ARRAY_SIZE(camera_cre), .component = camera_cre, }, { .name = "Camera CUSTOM", .num_component = ARRAY_SIZE(camera_custom), .component = camera_custom, }, { .name = "Camera Presil", .num_component = ARRAY_SIZE(camera_presil), .component = camera_presil, } };
CRM為master裝置:
static struct platform_driver *const cam_component_platform_drivers[] = { /* BASE */ &cam_sync_driver, &cam_smmu_driver, &cam_cpas_driver, &cam_cdm_intf_driver, &cam_hw_cdm_driver, #ifdef CONFIG_SPECTRA_TFE &cam_csid_ppi100_driver, &cam_tfe_driver, &cam_tfe_csid_driver, #endif #ifdef CONFIG_SPECTRA_ISP &cam_ife_csid_driver, &cam_ife_csid_lite_driver, &cam_vfe_driver, &cam_sfe_driver, &isp_driver, ... ... };
cam_sync為component裝置:
CRM為master裝置,cam_sync、cam_smmu等裝置均為component裝置