Skip to content

Commit

Permalink
drivers: video: accept VIDEO_EP_ALL where VIDEO_EP_IN/OUT is given
Browse files Browse the repository at this point in the history
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 <me@josuah.net>
  • Loading branch information
josuah authored and nashif committed Aug 24, 2024
1 parent 9eb258c commit c0f8658
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions drivers/video/video_mcux_csi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/video/video_mcux_mipi_csi2rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
10 changes: 5 additions & 5 deletions drivers/video/video_stm32_dcmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions drivers/video/video_sw_generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit c0f8658

Please sign in to comment.