From c0f8658254a593b03bb27772d4ab3173c21c97e6 Mon Sep 17 00:00:00 2001 From: Josuah Demangeon Date: Sun, 28 Jul 2024 01:59:23 +0200 Subject: [PATCH] drivers: video: accept VIDEO_EP_ALL where VIDEO_EP_IN/OUT is given The current video drivers did not allow VIDEO_EP_ALL to be selected, as used by video_stream_stop(). This adds the VIDEO_EP_ALL to each video driver that filtered endpoints. Signed-off-by: Josuah Demangeon --- drivers/video/video_mcux_csi.c | 10 +++++----- drivers/video/video_mcux_mipi_csi2rx.c | 4 ++-- drivers/video/video_stm32_dcmi.c | 10 +++++----- drivers/video/video_sw_generator.c | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/video/video_mcux_csi.c b/drivers/video/video_mcux_csi.c index 2e8e4d505084ae..c63d1bf56a6c72 100644 --- a/drivers/video/video_mcux_csi.c +++ b/drivers/video/video_mcux_csi.c @@ -155,7 +155,7 @@ static int video_mcux_csi_set_fmt(const struct device *dev, enum video_endpoint_ status_t ret; struct video_format format = *fmt; - if (!bpp || ep != VIDEO_EP_OUT) { + if (bpp == 0 || (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL)) { return -EINVAL; } @@ -198,7 +198,7 @@ static int video_mcux_csi_get_fmt(const struct device *dev, enum video_endpoint_ { const struct video_mcux_csi_config *config = dev->config; - if (fmt == NULL || ep != VIDEO_EP_OUT) { + if (fmt == NULL || (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL)) { return -EINVAL; } @@ -288,7 +288,7 @@ static int video_mcux_csi_enqueue(const struct device *dev, enum video_endpoint_ unsigned int to_read; status_t ret; - if (ep != VIDEO_EP_OUT) { + if (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL) { return -EINVAL; } @@ -311,7 +311,7 @@ static int video_mcux_csi_dequeue(const struct device *dev, enum video_endpoint_ { struct video_mcux_csi_data *data = dev->data; - if (ep != VIDEO_EP_OUT) { + if (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL) { return -EINVAL; } @@ -355,7 +355,7 @@ static int video_mcux_csi_get_caps(const struct device *dev, enum video_endpoint const struct video_mcux_csi_config *config = dev->config; int err = -ENODEV; - if (ep != VIDEO_EP_OUT) { + if (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL) { return -EINVAL; } diff --git a/drivers/video/video_mcux_mipi_csi2rx.c b/drivers/video/video_mcux_mipi_csi2rx.c index 6d9dc5729edc35..2dad2b744b3a06 100644 --- a/drivers/video/video_mcux_mipi_csi2rx.c +++ b/drivers/video/video_mcux_mipi_csi2rx.c @@ -132,7 +132,7 @@ static int mipi_csi2rx_get_fmt(const struct device *dev, enum video_endpoint_id { const struct mipi_csi2rx_config *config = dev->config; - if (fmt == NULL || ep != VIDEO_EP_OUT) { + if (fmt == NULL || (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL)) { return -EINVAL; } @@ -175,7 +175,7 @@ static int mipi_csi2rx_get_caps(const struct device *dev, enum video_endpoint_id { const struct mipi_csi2rx_config *config = dev->config; - if (ep != VIDEO_EP_OUT) { + if (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL) { return -EINVAL; } diff --git a/drivers/video/video_stm32_dcmi.c b/drivers/video/video_stm32_dcmi.c index 51fb14c44db1df..140167e59fe9b6 100644 --- a/drivers/video/video_stm32_dcmi.c +++ b/drivers/video/video_stm32_dcmi.c @@ -215,7 +215,7 @@ static int video_stm32_dcmi_set_fmt(const struct device *dev, struct video_stm32_dcmi_data *data = dev->data; unsigned int bpp = video_pix_fmt_bpp(fmt->pixelformat); - if (!bpp || ep != VIDEO_EP_OUT) { + if (bpp == 0 || (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL)) { return -EINVAL; } @@ -238,7 +238,7 @@ static int video_stm32_dcmi_get_fmt(const struct device *dev, struct video_stm32_dcmi_data *data = dev->data; const struct video_stm32_dcmi_config *config = dev->config; - if ((fmt == NULL) || (ep != VIDEO_EP_OUT)) { + if (fmt == NULL || (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL)) { return -EINVAL; } @@ -310,7 +310,7 @@ static int video_stm32_dcmi_enqueue(const struct device *dev, struct video_stm32_dcmi_data *data = dev->data; const uint32_t buffer_size = data->pitch * data->height; - if (ep != VIDEO_EP_OUT) { + if (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL) { return -EINVAL; } @@ -332,7 +332,7 @@ static int video_stm32_dcmi_dequeue(const struct device *dev, { struct video_stm32_dcmi_data *data = dev->data; - if (ep != VIDEO_EP_OUT) { + if (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL) { return -EINVAL; } @@ -351,7 +351,7 @@ static int video_stm32_dcmi_get_caps(const struct device *dev, const struct video_stm32_dcmi_config *config = dev->config; int ret = -ENODEV; - if (ep != VIDEO_EP_OUT) { + if (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL) { return -EINVAL; } diff --git a/drivers/video/video_sw_generator.c b/drivers/video/video_sw_generator.c index 9b0f3e238b5f30..7c75893d176f1a 100644 --- a/drivers/video/video_sw_generator.c +++ b/drivers/video/video_sw_generator.c @@ -52,7 +52,7 @@ static int video_sw_generator_set_fmt(const struct device *dev, enum video_endpo struct video_sw_generator_data *data = dev->data; int i = 0; - if (ep != VIDEO_EP_OUT) { + if (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL) { return -EINVAL; } @@ -79,7 +79,7 @@ static int video_sw_generator_get_fmt(const struct device *dev, enum video_endpo { struct video_sw_generator_data *data = dev->data; - if (ep != VIDEO_EP_OUT) { + if (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL) { return -EINVAL; } @@ -171,7 +171,7 @@ static int video_sw_generator_enqueue(const struct device *dev, enum video_endpo { struct video_sw_generator_data *data = dev->data; - if (ep != VIDEO_EP_OUT) { + if (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL) { return -EINVAL; } @@ -185,7 +185,7 @@ static int video_sw_generator_dequeue(const struct device *dev, enum video_endpo { struct video_sw_generator_data *data = dev->data; - if (ep != VIDEO_EP_OUT) { + if (ep != VIDEO_EP_OUT && ep != VIDEO_EP_ALL) { return -EINVAL; }