hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd. */
 
#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <media/videobuf2-core.h>
#include <media/videobuf2-vmalloc.h>    /* for ISP params */
#include <media/v4l2-event.h>
#include <linux/rk-preisp.h>
#include "dev.h"
#include "isp_params.h"
#include "isp_params_v1x.h"
#include "isp_params_v2x.h"
#include "isp_params_v21.h"
#include "isp_params_v3x.h"
#include "isp_params_v32.h"
#include "regs.h"
 
#define PARAMS_NAME DRIVER_NAME "-input-params"
#define RKISP_ISP_PARAMS_REQ_BUFS_MIN    2
#define RKISP_ISP_PARAMS_REQ_BUFS_MAX    8
 
static int rkisp_params_enum_fmt_meta_out(struct file *file, void *priv,
                     struct v4l2_fmtdesc *f)
{
   struct video_device *video = video_devdata(file);
   struct rkisp_isp_params_vdev *params_vdev = video_get_drvdata(video);
 
   if (f->index > 0 || f->type != video->queue->type)
       return -EINVAL;
 
   f->pixelformat = params_vdev->vdev_fmt.fmt.meta.dataformat;
 
   return 0;
}
 
static int rkisp_params_g_fmt_meta_out(struct file *file, void *fh,
                      struct v4l2_format *f)
{
   struct video_device *video = video_devdata(file);
   struct rkisp_isp_params_vdev *params_vdev = video_get_drvdata(video);
   struct v4l2_meta_format *meta = &f->fmt.meta;
 
   if (f->type != video->queue->type)
       return -EINVAL;
 
   memset(meta, 0, sizeof(*meta));
   meta->dataformat = params_vdev->vdev_fmt.fmt.meta.dataformat;
   meta->buffersize = params_vdev->vdev_fmt.fmt.meta.buffersize;
 
   return 0;
}
 
static int rkisp_params_querycap(struct file *file,
                void *priv, struct v4l2_capability *cap)
{
   struct video_device *vdev = video_devdata(file);
   struct rkisp_isp_params_vdev *params_vdev = video_get_drvdata(vdev);
 
   snprintf(cap->driver, sizeof(cap->driver),
        "%s_v%d", DRIVER_NAME,
        params_vdev->dev->isp_ver >> 4);
   strlcpy(cap->card, vdev->name, sizeof(cap->card));
   strlcpy(cap->bus_info, "platform: " DRIVER_NAME, sizeof(cap->bus_info));
   cap->version = RKISP_DRIVER_VERSION;
   return 0;
}
 
static int rkisp_params_subs_evt(struct v4l2_fh *fh,
                const struct v4l2_event_subscription *sub)
{
   struct rkisp_isp_params_vdev *params_vdev = video_get_drvdata(fh->vdev);
 
   if (sub->id != 0)
       return -EINVAL;
 
   switch (sub->type) {
   case CIFISP_V4L2_EVENT_STREAM_START:
   case CIFISP_V4L2_EVENT_STREAM_STOP:
       params_vdev->is_subs_evt = true;
       return v4l2_event_subscribe(fh, sub, 0, NULL);
   default:
       return -EINVAL;
   }
}
 
static int rkisp_params_unsubs_evt(struct v4l2_fh *fh,
                  const struct v4l2_event_subscription *sub)
{
   struct rkisp_isp_params_vdev *params_vdev = video_get_drvdata(fh->vdev);
 
   params_vdev->is_subs_evt = false;
   return v4l2_event_unsubscribe(fh, sub);
}
 
/* ISP params video device IOCTLs */
static const struct v4l2_ioctl_ops rkisp_params_ioctl = {
   .vidioc_reqbufs = vb2_ioctl_reqbufs,
   .vidioc_querybuf = vb2_ioctl_querybuf,
   .vidioc_create_bufs = vb2_ioctl_create_bufs,
   .vidioc_qbuf = vb2_ioctl_qbuf,
   .vidioc_dqbuf = vb2_ioctl_dqbuf,
   .vidioc_prepare_buf = vb2_ioctl_prepare_buf,
   .vidioc_expbuf = vb2_ioctl_expbuf,
   .vidioc_streamon = vb2_ioctl_streamon,
   .vidioc_streamoff = vb2_ioctl_streamoff,
   .vidioc_enum_fmt_meta_out = rkisp_params_enum_fmt_meta_out,
   .vidioc_g_fmt_meta_out = rkisp_params_g_fmt_meta_out,
   .vidioc_s_fmt_meta_out = rkisp_params_g_fmt_meta_out,
   .vidioc_try_fmt_meta_out = rkisp_params_g_fmt_meta_out,
   .vidioc_querycap = rkisp_params_querycap,
   .vidioc_subscribe_event = rkisp_params_subs_evt,
   .vidioc_unsubscribe_event = rkisp_params_unsubs_evt,
};
 
static int rkisp_params_vb2_queue_setup(struct vb2_queue *vq,
                   unsigned int *num_buffers,
                   unsigned int *num_planes,
                   unsigned int sizes[],
                   struct device *alloc_ctxs[])
{
   struct rkisp_isp_params_vdev *params_vdev = vq->drv_priv;
 
   *num_buffers = clamp_t(u32, *num_buffers,
                  RKISP_ISP_PARAMS_REQ_BUFS_MIN,
                  RKISP_ISP_PARAMS_REQ_BUFS_MAX);
 
   *num_planes = 1;
   params_vdev->ops->get_param_size(params_vdev, sizes);
 
   INIT_LIST_HEAD(&params_vdev->params);
 
   if (params_vdev->first_cfg_params) {
       params_vdev->first_cfg_params = false;
       return 0;
   }
 
   params_vdev->first_params = true;
 
   return 0;
}
 
static void rkisp_params_vb2_buf_queue(struct vb2_buffer *vb)
{
   struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
   struct rkisp_buffer *params_buf = to_rkisp_buffer(vbuf);
   struct vb2_queue *vq = vb->vb2_queue;
   struct rkisp_isp_params_vdev *params_vdev = vq->drv_priv;
   struct rkisp_device *dev = params_vdev->dev;
   void *first_param;
   unsigned long flags;
   unsigned int cur_frame_id = -1;
 
   cur_frame_id = atomic_read(&dev->isp_sdev.frm_sync_seq) - 1;
   if (params_vdev->first_params) {
       first_param = vb2_plane_vaddr(vb, 0);
       params_vdev->ops->save_first_param(params_vdev, first_param);
       params_vdev->is_first_cfg = true;
       vbuf->sequence = cur_frame_id;
       vb2_buffer_done(&params_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
       params_vdev->first_params = false;
       wake_up(&params_vdev->dev->sync_onoff);
       if (dev->is_first_double) {
           dev_info(dev->dev, "first params for fast\n");
           dev->is_first_double = false;
           dev->sw_rd_cnt = 0;
           if (dev->hw_dev->unite == ISP_UNITE_ONE) {
               dev->unite_index = ISP_UNITE_LEFT;
               dev->sw_rd_cnt += dev->hw_dev->is_multi_overflow ? 3 : 1;
           }
           params_vdev->rdbk_times = dev->sw_rd_cnt + 1;
           rkisp_trigger_read_back(dev, false, false, false);
       }
       dev_info(dev->dev, "first params buf queue\n");
       return;
   }
 
   if (dev->procfs.mode &
       (RKISP_PROCFS_FIL_AIQ | RKISP_PROCFS_FIL_SW)) {
       vb2_buffer_done(&params_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
       return;
   }
 
   params_buf->vaddr[0] = vb2_plane_vaddr(vb, 0);
   spin_lock_irqsave(&params_vdev->config_lock, flags);
   list_add_tail(&params_buf->queue, &params_vdev->params);
   spin_unlock_irqrestore(&params_vdev->config_lock, flags);
 
   if (params_vdev->dev->is_first_double) {
       struct isp32_isp_params_cfg *params = params_buf->vaddr[0];
       struct rkisp_buffer *buf;
 
       if (!(params->module_cfg_update & ISP32_MODULE_RTT_FST))
           return;
       spin_lock_irqsave(&params_vdev->config_lock, flags);
       while (!list_empty(&params_vdev->params)) {
           buf = list_first_entry(&params_vdev->params,
                          struct rkisp_buffer, queue);
           if (buf == params_buf)
               break;
           list_del(&buf->queue);
           vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
       }
       spin_unlock_irqrestore(&params_vdev->config_lock, flags);
       dev_info(params_vdev->dev->dev,
            "first params:%d for rtt resume\n", params->frame_id);
       params_vdev->dev->is_first_double = false;
       rkisp_trigger_read_back(params_vdev->dev, false, false, false);
   }
}
 
static void rkisp_params_vb2_stop_streaming(struct vb2_queue *vq)
{
   struct rkisp_isp_params_vdev *params_vdev = vq->drv_priv;
   struct rkisp_device *dev = params_vdev->dev;
   struct rkisp_buffer *buf;
   unsigned long flags;
 
   /* stop params input firstly */
   spin_lock_irqsave(&params_vdev->config_lock, flags);
   params_vdev->streamon = false;
   wake_up(&dev->sync_onoff);
   while (!list_empty(&params_vdev->params)) {
       buf = list_first_entry(&params_vdev->params,
                      struct rkisp_buffer, queue);
       list_del(&buf->queue);
       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
   }
   if (params_vdev->cur_buf) {
       buf = params_vdev->cur_buf;
       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
       params_vdev->cur_buf = NULL;
   }
   spin_unlock_irqrestore(&params_vdev->config_lock, flags);
 
   if (dev->is_pre_on) {
       params_vdev->first_cfg_params = true;
       return;
   }
   rkisp_params_disable_isp(params_vdev);
   /* clean module params */
   params_vdev->ops->clear_first_param(params_vdev);
   params_vdev->rdbk_times = 0;
}
 
static int
rkisp_params_vb2_start_streaming(struct vb2_queue *queue, unsigned int count)
{
   struct rkisp_isp_params_vdev *params_vdev = queue->drv_priv;
   unsigned long flags;
 
   params_vdev->hdrtmo_en = false;
   params_vdev->afaemode_en = false;
   params_vdev->cur_buf = NULL;
   spin_lock_irqsave(&params_vdev->config_lock, flags);
   params_vdev->streamon = true;
   spin_unlock_irqrestore(&params_vdev->config_lock, flags);
 
   return 0;
}
 
static struct vb2_ops rkisp_params_vb2_ops = {
   .queue_setup = rkisp_params_vb2_queue_setup,
   .wait_prepare = vb2_ops_wait_prepare,
   .wait_finish = vb2_ops_wait_finish,
   .buf_queue = rkisp_params_vb2_buf_queue,
   .start_streaming = rkisp_params_vb2_start_streaming,
   .stop_streaming = rkisp_params_vb2_stop_streaming,
 
};
 
static int rkisp_params_fh_open(struct file *filp)
{
   struct rkisp_isp_params_vdev *params = video_drvdata(filp);
   int ret;
 
   if (!params->dev->is_probe_end)
       return -EINVAL;
 
   ret = v4l2_fh_open(filp);
   if (!ret) {
       ret = v4l2_pipeline_pm_get(&params->vnode.vdev.entity);
       if (ret < 0)
           vb2_fop_release(filp);
   }
 
   return ret;
}
 
static int rkisp_params_fop_release(struct file *file)
{
   struct rkisp_isp_params_vdev *params = video_drvdata(file);
   int ret;
 
   ret = vb2_fop_release(file);
   if (!ret)
       v4l2_pipeline_pm_put(&params->vnode.vdev.entity);
   return ret;
}
 
static __poll_t rkisp_params_fop_poll(struct file *file, poll_table *wait)
{
   struct video_device *vdev = video_devdata(file);
 
   /* buf done or subscribe event */
   if (vdev->queue->owner == file->private_data)
       return vb2_fop_poll(file, wait);
   else
       return v4l2_ctrl_poll(file, wait);
}
 
struct v4l2_file_operations rkisp_params_fops = {
   .mmap = vb2_fop_mmap,
   .unlocked_ioctl = video_ioctl2,
   .poll = rkisp_params_fop_poll,
   .open = rkisp_params_fh_open,
   .release = rkisp_params_fop_release
};
 
static int
rkisp_params_init_vb2_queue(struct vb2_queue *q,
               struct rkisp_isp_params_vdev *params_vdev)
{
   q->type = V4L2_BUF_TYPE_META_OUTPUT;
   q->io_modes = VB2_MMAP | VB2_USERPTR;
   q->drv_priv = params_vdev;
   q->ops = &rkisp_params_vb2_ops;
   q->mem_ops = &vb2_vmalloc_memops;
   q->buf_struct_size = sizeof(struct rkisp_buffer);
   q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
   q->lock = &params_vdev->dev->iqlock;
   q->dev = params_vdev->dev->dev;
 
   return vb2_queue_init(q);
}
 
static int rkisp_init_params_vdev(struct rkisp_isp_params_vdev *params_vdev)
{
   int ret;
 
   if (params_vdev->dev->isp_ver <= ISP_V13)
       ret = rkisp_init_params_vdev_v1x(params_vdev);
   else if (params_vdev->dev->isp_ver == ISP_V21)
       ret = rkisp_init_params_vdev_v21(params_vdev);
   else if (params_vdev->dev->isp_ver == ISP_V20)
       ret = rkisp_init_params_vdev_v2x(params_vdev);
   else if (params_vdev->dev->isp_ver == ISP_V30)
       ret = rkisp_init_params_vdev_v3x(params_vdev);
   else
       ret = rkisp_init_params_vdev_v32(params_vdev);
 
   params_vdev->vdev_fmt.fmt.meta.dataformat =
       V4L2_META_FMT_RK_ISP1_PARAMS;
   if (params_vdev->ops && params_vdev->ops->get_param_size)
       params_vdev->ops->get_param_size(params_vdev,
           &params_vdev->vdev_fmt.fmt.meta.buffersize);
   return ret;
}
 
static void rkisp_uninit_params_vdev(struct rkisp_isp_params_vdev *params_vdev)
{
   if (params_vdev->dev->isp_ver <= ISP_V13)
       rkisp_uninit_params_vdev_v1x(params_vdev);
   else if (params_vdev->dev->isp_ver == ISP_V21)
       rkisp_uninit_params_vdev_v21(params_vdev);
   else if (params_vdev->dev->isp_ver == ISP_V20)
       rkisp_uninit_params_vdev_v2x(params_vdev);
   else if (params_vdev->dev->isp_ver == ISP_V30)
       rkisp_uninit_params_vdev_v3x(params_vdev);
   else
       rkisp_uninit_params_vdev_v32(params_vdev);
}
 
void rkisp_params_cfg(struct rkisp_isp_params_vdev *params_vdev, u32 frame_id)
{
   if (params_vdev->ops->param_cfg)
       params_vdev->ops->param_cfg(params_vdev, frame_id, RKISP_PARAMS_IMD);
}
 
void rkisp_params_cfgsram(struct rkisp_isp_params_vdev *params_vdev, bool is_check)
{
   if (is_check) {
       if (params_vdev->dev->procfs.mode & RKISP_PROCFS_FIL_SW)
           return;
 
       /* multi device to switch sram config */
       if (params_vdev->dev->hw_dev->is_single)
           return;
   }
   if (params_vdev->ops->param_cfgsram)
       params_vdev->ops->param_cfgsram(params_vdev);
}
 
void rkisp_params_isr(struct rkisp_isp_params_vdev *params_vdev,
             u32 isp_mis)
{
   params_vdev->ops->isr_hdl(params_vdev, isp_mis);
}
 
/* Not called when the camera active, thus not isr protection. */
void rkisp_params_first_cfg(struct rkisp_isp_params_vdev *params_vdev,
               struct ispsd_in_fmt *in_fmt,
               enum v4l2_quantization quantization)
{
   struct rkisp_device *dev = params_vdev->dev;
 
   if (!params_vdev->is_first_cfg)
       return;
   params_vdev->is_first_cfg = false;
   params_vdev->quantization = quantization;
   params_vdev->raw_type = in_fmt->bayer_pat;
   params_vdev->in_mbus_code = in_fmt->mbus_code;
   params_vdev->ops->first_cfg(params_vdev);
   /* update selfpath range if it output rgb format */
   if (params_vdev->quantization != quantization) {
       struct rkisp_stream *stream = &dev->cap_dev.stream[RKISP_STREAM_SP];
       u32 mask = CIF_MI_SP_Y_FULL_YUV2RGB | CIF_MI_SP_CBCR_FULL_YUV2RGB;
 
       quantization = params_vdev->quantization;
       if (stream->streaming &&
           stream->out_isp_fmt.fmt_type == FMT_RGB)
           rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL, mask,
                        quantization == V4L2_QUANTIZATION_FULL_RANGE ?
                        mask : 0, false);
       dev->isp_sdev.quantization = quantization;
   }
}
 
/* Not called when the camera active, thus not isr protection. */
void rkisp_params_disable_isp(struct rkisp_isp_params_vdev *params_vdev)
{
   if (params_vdev->ops->disable_isp)
       params_vdev->ops->disable_isp(params_vdev);
}
 
void rkisp_params_get_meshbuf_inf(struct rkisp_isp_params_vdev *params_vdev,
                 void *meshbuf)
{
   if (params_vdev->ops->get_meshbuf_inf)
       params_vdev->ops->get_meshbuf_inf(params_vdev, meshbuf);
}
 
int rkisp_params_set_meshbuf_size(struct rkisp_isp_params_vdev *params_vdev,
                 void *meshsize)
{
   if (params_vdev->ops->set_meshbuf_size)
       return params_vdev->ops->set_meshbuf_size(params_vdev,
                             meshsize);
   else
       return -EINVAL;
}
 
void rkisp_params_meshbuf_free(struct rkisp_isp_params_vdev *params_vdev, u64 id)
{
   /* isp working no to free buf */
   if (params_vdev->ops->free_meshbuf &&
       !(params_vdev->dev->isp_state & ISP_START))
       params_vdev->ops->free_meshbuf(params_vdev, id);
}
 
void rkisp_params_stream_stop(struct rkisp_isp_params_vdev *params_vdev)
{
   /* isp stop to free buf */
   if (params_vdev->ops->stream_stop)
       params_vdev->ops->stream_stop(params_vdev);
   if (params_vdev->ops->fop_release)
       params_vdev->ops->fop_release(params_vdev);
   params_vdev->first_cfg_params = false;
}
 
bool rkisp_params_check_bigmode(struct rkisp_isp_params_vdev *params_vdev)
{
   if (params_vdev->ops->check_bigmode)
       return params_vdev->ops->check_bigmode(params_vdev);
 
   return 0;
}
 
int rkisp_params_info2ddr_cfg(struct rkisp_isp_params_vdev *params_vdev,
                  void *arg)
{
   int ret = -EINVAL;
 
   if (params_vdev->ops->info2ddr_cfg)
       ret = params_vdev->ops->info2ddr_cfg(params_vdev, arg);
 
   return ret;
}
 
int rkisp_register_params_vdev(struct rkisp_isp_params_vdev *params_vdev,
               struct v4l2_device *v4l2_dev,
               struct rkisp_device *dev)
{
   int ret;
   struct rkisp_vdev_node *node = &params_vdev->vnode;
   struct video_device *vdev = &node->vdev;
   struct media_entity *source, *sink;
 
   params_vdev->dev = dev;
   params_vdev->is_subs_evt = false;
   spin_lock_init(&params_vdev->config_lock);
 
   strlcpy(vdev->name, PARAMS_NAME, sizeof(vdev->name));
 
   vdev->ioctl_ops = &rkisp_params_ioctl;
   vdev->fops = &rkisp_params_fops;
   vdev->release = video_device_release_empty;
   /*
    * Provide a mutex to v4l2 core. It will be used
    * to protect all fops and v4l2 ioctls.
    */
   vdev->lock = &dev->iqlock;
   vdev->v4l2_dev = v4l2_dev;
   vdev->queue = &node->buf_queue;
   vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_META_OUTPUT;
   vdev->vfl_dir = VFL_DIR_TX;
   rkisp_params_init_vb2_queue(vdev->queue, params_vdev);
   ret = rkisp_init_params_vdev(params_vdev);
   if (ret < 0)
       goto err_release_queue;
   video_set_drvdata(vdev, params_vdev);
 
   node->pad.flags = MEDIA_PAD_FL_SOURCE;
   ret = media_entity_pads_init(&vdev->entity, 1, &node->pad);
   if (ret < 0)
       goto err_release_queue;
   ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
   if (ret < 0) {
       dev_err(&vdev->dev,
           "could not register Video for Linux device\n");
       goto err_cleanup_media_entity;
   }
 
   source = &params_vdev->vnode.vdev.entity;
   sink = &params_vdev->dev->isp_sdev.sd.entity;
   ret = media_create_pad_link(source, 0, sink,
       RKISP_ISP_PAD_SINK_PARAMS, MEDIA_LNK_FL_ENABLED);
   if (ret < 0)
       goto err_unregister_video;
 
   return 0;
 
err_unregister_video:
   video_unregister_device(vdev);
err_cleanup_media_entity:
   media_entity_cleanup(&vdev->entity);
err_release_queue:
   vb2_queue_release(vdev->queue);
   rkisp_uninit_params_vdev(params_vdev);
   return ret;
}
 
void rkisp_unregister_params_vdev(struct rkisp_isp_params_vdev *params_vdev)
{
   struct rkisp_vdev_node *node = &params_vdev->vnode;
   struct video_device *vdev = &node->vdev;
 
   video_unregister_device(vdev);
   media_entity_cleanup(&vdev->entity);
   vb2_queue_release(vdev->queue);
   rkisp_uninit_params_vdev(params_vdev);
}