Skip to content

Commit 799f98d

Browse files
josuahngphibang
andcommitted
drivers: video: emul_rx/emul_imager: Explicitly set init priority
The Emul Rx needs to be initialized after the camera sensor which is generally initialized with CONFIG_VIDEO_INIT_PRIORITY. This is currently true "by chance" due to the order the linker links the object files. This linker order is not easily controlled, so use an explicit priority value to ensure this requirement. Co-authored-by: Phi Bang Nguyen <[email protected]> Signed-off-by: Josuah Demangeon <[email protected]>
1 parent 11783a5 commit 799f98d

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

drivers/video/Kconfig

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ config VIDEO_INIT_PRIORITY
2323
help
2424
System initialization priority for video drivers.
2525

26+
config VIDEO_IMAGER_INIT_PRIORITY
27+
int "Imager (image sensor) init priority"
28+
default 65
29+
help
30+
System initialization priority for imager (image sensor) drivers.
31+
The default value is there to allow other drivers to have a default
32+
init priority placed before (< 65) or after (> 65) the imagers.
33+
2634
config VIDEO_BUFFER_POOL_SZ_MAX
2735
int "Size of the largest buffer in the video pool"
2836
default 1048576

drivers/video/Kconfig.emul_rx

+12
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,15 @@ config VIDEO_EMUL_RX
88
default y
99
help
1010
Enable driver for the MIPI RX emulated DMA engine.
11+
12+
if VIDEO_EMUL_RX
13+
14+
config VIDEO_EMUL_RX_INIT_PRIORITY
15+
int "Emul Rx init priority"
16+
default 67
17+
help
18+
Initialization priority for the emulated Rx device.
19+
The default value is set to preserve the initialization dependency,
20+
placing it after the imagers (65), such as the emulated imager.
21+
22+
endif

drivers/video/video_emul_imager.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,8 @@ int emul_imager_init(const struct device *dev)
420420
}; \
421421
\
422422
DEVICE_DT_INST_DEFINE(inst, &emul_imager_init, NULL, &emul_imager_data_##inst, \
423-
&emul_imager_cfg_##inst, POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY, \
424-
&emul_imager_driver_api);
423+
&emul_imager_cfg_##inst, POST_KERNEL, \
424+
CONFIG_VIDEO_IMAGER_INIT_PRIORITY, &emul_imager_driver_api);
425425

426426
DT_INST_FOREACH_STATUS_OKAY(EMUL_IMAGER_DEFINE)
427427

drivers/video/video_emul_rx.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ int emul_rx_init(const struct device *dev)
296296
}; \
297297
\
298298
DEVICE_DT_INST_DEFINE(n, &emul_rx_init, NULL, &emul_rx_data_##n, &emul_rx_cfg_##n, \
299-
POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY, &emul_rx_driver_api);
299+
POST_KERNEL, CONFIG_VIDEO_EMUL_RX_INIT_PRIORITY, \
300+
&emul_rx_driver_api);
300301

301302
DT_INST_FOREACH_STATUS_OKAY(EMUL_RX_DEFINE)

0 commit comments

Comments
 (0)