diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index b02680b224..488ad6c80c 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -15,7 +15,7 @@ if VIDEO config VIDEO_INIT_PRIORITY int "Video initialization priority" - default 90 + default 60 help System initialization priority for video drivers. diff --git a/drivers/video/mt9m114.c b/drivers/video/mt9m114.c index 4591543130..9429f7adfb 100644 --- a/drivers/video/mt9m114.c +++ b/drivers/video/mt9m114.c @@ -409,6 +409,6 @@ static int mt9m114_init_0(const struct device *dev) DEVICE_DT_INST_DEFINE(0, &mt9m114_init_0, NULL, &mt9m114_data_0, &mt9m114_cfg_0, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, + POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY, &mt9m114_driver_api); #endif diff --git a/drivers/video/ov7725.c b/drivers/video/ov7725.c index d1705e9e42..865ddc1353 100644 --- a/drivers/video/ov7725.c +++ b/drivers/video/ov7725.c @@ -645,5 +645,5 @@ static int ov7725_init_0(const struct device *dev) DEVICE_DT_INST_DEFINE(0, &ov7725_init_0, NULL, &ov7725_data_0, &ov7725_cfg_0, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, + POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY, &ov7725_driver_api); diff --git a/drivers/video/video_mcux_csi.c b/drivers/video/video_mcux_csi.c index 63660852ae..9eeef38cea 100644 --- a/drivers/video/video_mcux_csi.c +++ b/drivers/video/video_mcux_csi.c @@ -369,8 +369,10 @@ static int video_mcux_csi_init(const struct device *dev) CSI_GetDefaultConfig(&data->csi_config); - /* check if there is any sensor device (video ctrl device) */ - if (!device_is_ready(config->sensor_dev)) { + /* check if there is any sensor device (video ctrl device) + * the device is not yet initialized so we only check if it exists + */ + if (config->sensor_dev == NULL) { return -ENODEV; } @@ -440,9 +442,14 @@ static int video_mcux_csi_init_0(const struct device *dev) return video_mcux_csi_init(dev); } +/* CONFIG_KERNEL_INIT_PRIORITY_DEVICE is used to make sure the + * CSI peripheral is initialized before the camera, which is + * necessary since the clock to the camera is provided by the + * CSI peripheral. + */ DEVICE_DT_INST_DEFINE(0, &video_mcux_csi_init_0, NULL, &video_mcux_csi_data_0, &video_mcux_csi_config_0, - POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY, + POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &video_mcux_csi_driver_api); #endif