Skip to content

Commit f305207

Browse files
committed
drivers: video: Add video_buf_type
M2M devices like ISPs or PxP have two separate buffer queues, i.e. incomming and outcomming queues. For each API, the driver needs to distinguish on which queue it needs to take action. Add video buffer type to support this kind of devices. - get_caps(), set/get_format(), enqueue()/dequeue(): the buffer type is embeded in the video_caps, video_format and video_buffer structs - video_stream_start/stop() : buffer type needs is sent as a parameter Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
1 parent b2e201e commit f305207

File tree

20 files changed

+78
-38
lines changed

20 files changed

+78
-38
lines changed

doc/releases/migration-guide-4.2.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,12 @@ Video
503503

504504
* video_endpoint_id enum has been dropped. It is no longer a parameter in any video API.
505505

506+
* video_buf_type enum has been added. It is a required parameter in the following video APIs:
507+
508+
``set_stream``
509+
``video_stream_start``
510+
``video_stream_stop``
511+
506512
Other subsystems
507513
****************
508514

drivers/video/gc2145.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ static int gc2145_get_fmt(const struct device *dev, struct video_format *fmt)
10931093
return 0;
10941094
}
10951095

1096-
static int gc2145_set_stream(const struct device *dev, bool enable)
1096+
static int gc2145_set_stream(const struct device *dev, bool enable, enum video_buf_type type)
10971097
{
10981098
const struct gc2145_config *cfg = dev->config;
10991099

drivers/video/mt9m114.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ static int mt9m114_get_fmt(const struct device *dev, struct video_format *fmt)
458458
return 0;
459459
}
460460

461-
static int mt9m114_set_stream(const struct device *dev, bool enable)
461+
static int mt9m114_set_stream(const struct device *dev, bool enable, enum video_buf_type type)
462462
{
463463
return enable ? mt9m114_set_state(dev, MT9M114_SYS_STATE_START_STREAMING)
464464
: mt9m114_set_state(dev, MT9M114_SYS_STATE_ENTER_SUSPEND);

drivers/video/ov2640.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ static int ov2640_get_fmt(const struct device *dev, struct video_format *fmt)
880880
return 0;
881881
}
882882

883-
static int ov2640_set_stream(const struct device *dev, bool enable)
883+
static int ov2640_set_stream(const struct device *dev, bool enable, enum video_buf_type type)
884884
{
885885
return 0;
886886
}

drivers/video/ov5640.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ static int ov5640_get_caps(const struct device *dev, struct video_caps *caps)
922922
return 0;
923923
}
924924

925-
static int ov5640_set_stream(const struct device *dev, bool enable)
925+
static int ov5640_set_stream(const struct device *dev, bool enable, enum video_buf_type type)
926926
{
927927
const struct ov5640_config *cfg = dev->config;
928928

drivers/video/ov7670.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ static int ov7670_init(const struct device *dev)
573573
return ov7670_init_controls(dev);
574574
}
575575

576-
static int ov7670_set_stream(const struct device *dev, bool enable)
576+
static int ov7670_set_stream(const struct device *dev, bool enable, enum video_buf_type type)
577577
{
578578
return 0;
579579
}

drivers/video/ov7725.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ static int ov7725_get_fmt(const struct device *dev, struct video_format *fmt)
515515
return 0;
516516
}
517517

518-
static int ov7725_set_stream(const struct device *dev, bool enable)
518+
static int ov7725_set_stream(const struct device *dev, bool enable, enum video_buf_type type)
519519
{
520520
return 0;
521521
}

drivers/video/video_emul_imager.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ static int emul_imager_get_caps(const struct device *dev, struct video_caps *cap
318318
return 0;
319319
}
320320

321-
static int emul_imager_set_stream(const struct device *dev, bool enable)
321+
static int emul_imager_set_stream(const struct device *dev, bool enable, enum video_buf_type type)
322322
{
323323
return emul_imager_write_reg(dev, EMUL_IMAGER_REG_CTRL, enable ? 1 : 0);
324324
}

drivers/video/video_emul_rx.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,13 @@ static int emul_rx_get_caps(const struct device *dev, struct video_caps *caps)
8686
return video_get_caps(cfg->source_dev, caps);
8787
}
8888

89-
static int emul_rx_set_stream(const struct device *dev, bool enable)
89+
static int emul_rx_set_stream(const struct device *dev, bool enable, enum video_buf_type type)
9090
{
9191
const struct emul_rx_config *cfg = dev->config;
9292

9393
/* A real hardware driver would first start / stop its own peripheral */
94-
return enable ? video_stream_start(cfg->source_dev) : video_stream_stop(cfg->source_dev);
94+
return enable ? video_stream_start(cfg->source_dev, type)
95+
: video_stream_stop(cfg->source_dev, type);
9596
}
9697

9798
static void emul_rx_worker(struct k_work *work)

drivers/video/video_esp32_dvp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void video_esp32_dma_rx_done(const struct device *dev, void *user_data, uint32_t
136136
video_esp32_reload_dma(data);
137137
}
138138

139-
static int video_esp32_set_stream(const struct device *dev, bool enable)
139+
static int video_esp32_set_stream(const struct device *dev, bool enable, enum video_buf_type type)
140140
{
141141
const struct video_esp32_config *cfg = dev->config;
142142
struct video_esp32_data *data = dev->data;
@@ -149,7 +149,7 @@ static int video_esp32_set_stream(const struct device *dev, bool enable)
149149
if (!enable) {
150150
LOG_DBG("Stop streaming");
151151

152-
if (video_stream_stop(cfg->source_dev)) {
152+
if (video_stream_stop(cfg->source_dev, type)) {
153153
return -EIO;
154154
}
155155

@@ -233,7 +233,7 @@ static int video_esp32_set_stream(const struct device *dev, bool enable)
233233

234234
cam_hal_start_streaming(&data->hal);
235235

236-
if (video_stream_start(cfg->source_dev)) {
236+
if (video_stream_start(cfg->source_dev, type)) {
237237
return -EIO;
238238
}
239239
data->is_streaming = true;

0 commit comments

Comments
 (0)