Commit 2bfa1869 authored by Phi Bang Nguyen's avatar Phi Bang Nguyen Committed by Fabio Baltieri
Browse files

drivers: video: dcmipp: Define video device for each pipe



Define a video device for each pipe instead for the main dcmipp device
since the pipe is the device that communicates with application
(zephyr,camera chosen node), not the dcmipp device.

This helps to enable camera controls as well.

Signed-off-by: default avatarPhi Bang Nguyen <phibang.nguyen@nxp.com>
parent ca030fbf
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -1588,6 +1588,8 @@ static void stm32_dcmipp_isr(const struct device *dev)
	HAL_DCMIPP_IRQHandler(&dcmipp->hdcmipp);
}

#define SOURCE_DEV(inst) DEVICE_DT_GET(DT_NODE_REMOTE_DEVICE(DT_INST_ENDPOINT_BY_ID(inst, 0, 0)))

#define DCMIPP_PIPE_INIT_DEFINE(node_id, inst)						\
	static struct stm32_dcmipp_pipe_data stm32_dcmipp_pipe_##node_id = {		\
		.id = DT_NODE_CHILD_IDX(node_id),					\
@@ -1598,9 +1600,9 @@ static void stm32_dcmipp_isr(const struct device *dev)
			 &stm32_dcmipp_pipe_##node_id,					\
			 &stm32_dcmipp_config_##inst,					\
			 POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY,			\
			 &stm32_dcmipp_driver_api);

#define SOURCE_DEV(inst) DEVICE_DT_GET(DT_NODE_REMOTE_DEVICE(DT_INST_ENDPOINT_BY_ID(inst, 0, 0)))
			 &stm32_dcmipp_driver_api);					\
											\
	VIDEO_DEVICE_DEFINE(dcmipp_##inst_pipe_##node_id, DEVICE_DT_GET(node_id), SOURCE_DEV(inst));

#if defined(STM32_DCMIPP_HAS_CSI)
#define STM32_DCMIPP_CSI_DT_PARAMS(inst)							\
@@ -1685,8 +1687,6 @@ static void stm32_dcmipp_isr(const struct device *dev)
		    POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY,					\
		    NULL);									\
												\
	STM32_DCMIPP_PIPES(inst)								\
												\
	VIDEO_DEVICE_DEFINE(dcmipp_##inst, DEVICE_DT_INST_GET(inst), SOURCE_DEV(inst));
	STM32_DCMIPP_PIPES(inst)

DT_INST_FOREACH_STATUS_OKAY(STM32_DCMIPP_INIT)