forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/drivers/media/platform/rockchip/isp/dev.c
....@@ -63,6 +63,14 @@
6363 module_param_named(monitor, rkisp_monitor, bool, 0644);
6464 MODULE_PARM_DESC(monitor, "rkisp abnormal restart monitor");
6565
66
+bool rkisp_irq_dbg;
67
+module_param_named(irq_dbg, rkisp_irq_dbg, bool, 0644);
68
+MODULE_PARM_DESC(irq_dbg, "rkisp interrupt runtime");
69
+
70
+static bool rkisp_rdbk_auto;
71
+module_param_named(rdbk_auto, rkisp_rdbk_auto, bool, 0644);
72
+MODULE_PARM_DESC(irq_dbg, "rkisp and vicap auto readback mode");
73
+
6674 static bool rkisp_clk_dbg;
6775 module_param_named(clk_dbg, rkisp_clk_dbg, bool, 0644);
6876 MODULE_PARM_DESC(clk_dbg, "rkisp clk set by user");
....@@ -78,6 +86,10 @@
7886 static unsigned int rkisp_wait_line;
7987 module_param_named(wait_line, rkisp_wait_line, uint, 0644);
8088 MODULE_PARM_DESC(wait_line, "rkisp wait line to buf done early");
89
+
90
+static unsigned int rkisp_wrap_line;
91
+module_param_named(wrap_line, rkisp_wrap_line, uint, 0644);
92
+MODULE_PARM_DESC(wrap_line, "rkisp wrap line for mpp");
8193
8294 static DEFINE_MUTEX(rkisp_dev_mutex);
8395 static LIST_HEAD(rkisp_device_list);
....@@ -126,7 +138,7 @@
126138 p->num_subdevs = 0;
127139 memset(p->subdevs, 0, sizeof(p->subdevs));
128140
129
- if (!(dev->isp_inp & (INP_CSI | INP_DVP | INP_LVDS)))
141
+ if (!(dev->isp_inp & (INP_CSI | INP_DVP | INP_LVDS | INP_CIF)))
130142 return 0;
131143
132144 while (1) {
....@@ -164,21 +176,35 @@
164176 {
165177 struct rkisp_device *dev = container_of(p, struct rkisp_device, pipe);
166178 struct rkisp_hw_dev *hw_dev = dev->hw_dev;
167
- u32 w = hw_dev->max_in.w ? hw_dev->max_in.w : dev->isp_sdev.in_frm.width;
168179 struct v4l2_subdev *sd;
169180 struct v4l2_ctrl *ctrl;
170
- u64 data_rate;
171
- int i;
181
+ u64 data_rate = 0;
182
+ int i, fps;
172183
173
- if (dev->isp_inp & (INP_RAWRD0 | INP_RAWRD1 | INP_RAWRD2 | INP_CIF)) {
174
- for (i = 0; i < hw_dev->num_clk_rate_tbl; i++) {
175
- if (w <= hw_dev->clk_rate_tbl[i].refer_data)
176
- break;
184
+ hw_dev->isp_size[dev->dev_id].is_on = true;
185
+ if (hw_dev->is_runing) {
186
+ if (dev->isp_ver >= ISP_V30 && !rkisp_clk_dbg)
187
+ hw_dev->is_dvfs = true;
188
+ return 0;
189
+ }
190
+
191
+ if (dev->isp_inp & (INP_RAWRD0 | INP_RAWRD1 | INP_RAWRD2) ||
192
+ (dev->is_pre_on && hw_dev->dev_num > 1)) {
193
+ if (dev->isp_ver < ISP_V30 || dev->is_pre_on) {
194
+ /* isp with mipi no support dvfs, calculate max data rate */
195
+ for (i = 0; i < hw_dev->dev_num; i++) {
196
+ fps = hw_dev->isp_size[i].fps;
197
+ if (!fps)
198
+ fps = 30;
199
+ data_rate += (fps * hw_dev->isp_size[i].size);
200
+ }
201
+ } else {
202
+ i = dev->dev_id;
203
+ fps = hw_dev->isp_size[i].fps;
204
+ if (!fps)
205
+ fps = 30;
206
+ data_rate = fps * hw_dev->isp_size[i].size;
177207 }
178
- if (!hw_dev->is_single)
179
- i++;
180
- if (i > hw_dev->num_clk_rate_tbl - 1)
181
- i = hw_dev->num_clk_rate_tbl - 1;
182208 goto end;
183209 }
184210
....@@ -187,11 +213,12 @@
187213 return 0;
188214 }
189215
190
- /* find the subdev of active sensor */
216
+ /* find the subdev of active sensor or vicap itf */
191217 sd = p->subdevs[0];
192218 for (i = 0; i < p->num_subdevs; i++) {
193219 sd = p->subdevs[i];
194
- if (sd->entity.function == MEDIA_ENT_F_CAM_SENSOR)
220
+ if (sd->entity.function == MEDIA_ENT_F_CAM_SENSOR ||
221
+ sd->entity.function == MEDIA_ENT_F_PROC_VIDEO_COMPOSER)
195222 break;
196223 }
197224
....@@ -210,6 +237,7 @@
210237 data_rate = v4l2_ctrl_g_ctrl_int64(ctrl) *
211238 dev->isp_sdev.in_fmt.bus_width;
212239 data_rate >>= 3;
240
+end:
213241 do_div(data_rate, 1000 * 1000);
214242
215243 /* increase 25% margin */
....@@ -221,10 +249,15 @@
221249 break;
222250 if (i == hw_dev->num_clk_rate_tbl)
223251 i--;
224
-end:
252
+
225253 /* set isp clock rate */
226254 rkisp_set_clk_rate(hw_dev->clks[0], hw_dev->clk_rate_tbl[i].clk_rate * 1000000UL);
227
- dev_dbg(hw_dev->dev, "set isp clk = %luHz\n", clk_get_rate(hw_dev->clks[0]));
255
+ if (hw_dev->is_unite)
256
+ rkisp_set_clk_rate(hw_dev->clks[5], hw_dev->clk_rate_tbl[i].clk_rate * 1000000UL);
257
+ /* aclk equal to core clk */
258
+ if (dev->isp_ver == ISP_V32)
259
+ rkisp_set_clk_rate(hw_dev->clks[1], hw_dev->clk_rate_tbl[i].clk_rate * 1000000UL);
260
+ dev_info(hw_dev->dev, "set isp clk = %luHz\n", clk_get_rate(hw_dev->clks[0]));
228261
229262 return 0;
230263 }
....@@ -259,8 +292,15 @@
259292
260293 static int rkisp_pipeline_close(struct rkisp_pipeline *p)
261294 {
262
- atomic_dec(&p->power_cnt);
295
+ struct rkisp_device *dev = container_of(p, struct rkisp_device, pipe);
263296
297
+ if (atomic_dec_return(&p->power_cnt))
298
+ return 0;
299
+
300
+ rkisp_rx_buf_pool_free(dev);
301
+ dev->hw_dev->isp_size[dev->dev_id].is_on = false;
302
+ if (dev->hw_dev->is_runing && (dev->isp_ver >= ISP_V30) && !rkisp_clk_dbg)
303
+ dev->hw_dev->is_dvfs = true;
264304 return 0;
265305 }
266306
....@@ -281,9 +321,14 @@
281321 if (dev->vs_irq >= 0)
282322 enable_irq(dev->vs_irq);
283323 rockchip_set_system_status(SYS_STATUS_ISP);
284
- v4l2_subdev_call(&dev->isp_sdev.sd, video, s_stream, true);
324
+ ret = v4l2_subdev_call(&dev->isp_sdev.sd, video, s_stream, true);
325
+ if (ret < 0)
326
+ goto err;
285327 /* phy -> sensor */
286328 for (i = 0; i < p->num_subdevs; ++i) {
329
+ if ((dev->vicap_in.merge_num > 1) &&
330
+ (p->subdevs[i]->entity.function == MEDIA_ENT_F_CAM_SENSOR))
331
+ continue;
287332 ret = v4l2_subdev_call(p->subdevs[i], video, s_stream, on);
288333 if (on && ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV)
289334 goto err_stream_off;
....@@ -296,8 +341,12 @@
296341 complete(&dev->hw_dev->monitor.cmpl);
297342 }
298343 /* sensor -> phy */
299
- for (i = p->num_subdevs - 1; i >= 0; --i)
344
+ for (i = p->num_subdevs - 1; i >= 0; --i) {
345
+ if ((dev->vicap_in.merge_num > 1) &&
346
+ (p->subdevs[i]->entity.function == MEDIA_ENT_F_CAM_SENSOR))
347
+ continue;
300348 v4l2_subdev_call(p->subdevs[i], video, s_stream, on);
349
+ }
301350 if (dev->vs_irq >= 0)
302351 disable_irq(dev->vs_irq);
303352 v4l2_subdev_call(&dev->isp_sdev.sd, video, s_stream, false);
....@@ -310,7 +359,9 @@
310359 for (--i; i >= 0; --i)
311360 v4l2_subdev_call(p->subdevs[i], video, s_stream, false);
312361 v4l2_subdev_call(&dev->isp_sdev.sd, video, s_stream, false);
362
+err:
313363 rockchip_clear_system_status(SYS_STATUS_ISP);
364
+ atomic_dec_return(&p->stream_cnt);
314365 return ret;
315366 }
316367
....@@ -326,7 +377,7 @@
326377 for (s = 0; s < dev->num_sensors; ++s) {
327378 struct rkisp_sensor_info *sensor = &dev->sensors[s];
328379 u32 type = sensor->sd->entity.function;
329
- bool en = s ? 0 : MEDIA_LNK_FL_ENABLED;
380
+ bool en = s ? 0 : true;
330381
331382 for (pad = 0; pad < sensor->sd->entity.num_pads; pad++)
332383 if (sensor->sd->entity.pads[pad].flags & MEDIA_PAD_FL_SOURCE)
....@@ -348,8 +399,8 @@
348399 ret = media_create_pad_link(&sensor->sd->entity, pad,
349400 &dev->isp_sdev.sd.entity, RKISP_ISP_PAD_SINK, en);
350401 } else {
351
- v4l2_subdev_call(sensor->sd, video,
352
- g_mbus_config, &sensor->mbus);
402
+ v4l2_subdev_call(sensor->sd, pad,
403
+ get_mbus_config, 0, &sensor->mbus);
353404 if (sensor->mbus.type == V4L2_MBUS_CCP2) {
354405 /* mipi-phy lvds link -> isp */
355406 dev->isp_inp = INP_LVDS;
....@@ -372,16 +423,27 @@
372423 return ret;
373424 }
374425
375
-static int _set_pipeline_default_fmt(struct rkisp_device *dev)
426
+static int _set_pipeline_default_fmt(struct rkisp_device *dev, bool is_init)
376427 {
377428 struct v4l2_subdev *isp;
378429 struct v4l2_subdev_format fmt;
379430 struct v4l2_subdev_selection sel;
380
- u32 width, height, code;
431
+ u32 i, width, height, code;
381432
433
+ memset(&sel, 0, sizeof(sel));
434
+ memset(&fmt, 0, sizeof(fmt));
382435 isp = &dev->isp_sdev.sd;
383436
384
- fmt = dev->active_sensor->fmt[0];
437
+ if (dev->active_sensor) {
438
+ fmt = dev->active_sensor->fmt[0];
439
+ if (!is_init &&
440
+ fmt.format.code == dev->isp_sdev.in_frm.code &&
441
+ fmt.format.width == dev->isp_sdev.in_frm.width &&
442
+ fmt.format.height == dev->isp_sdev.in_frm.height)
443
+ return 0;
444
+ } else {
445
+ fmt.format = dev->isp_sdev.in_frm;
446
+ }
385447 code = fmt.format.code;
386448 fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
387449 fmt.pad = RKISP_ISP_PAD_SINK;
....@@ -417,7 +479,7 @@
417479 rkisp_set_stream_def_fmt(dev, RKISP_STREAM_SP,
418480 width, height, V4L2_PIX_FMT_NV12);
419481 if ((dev->isp_ver == ISP_V20 || dev->isp_ver == ISP_V21) &&
420
- dev->isp_inp == INP_CSI) {
482
+ dev->isp_inp == INP_CSI && dev->active_sensor) {
421483 width = dev->active_sensor->fmt[1].format.width;
422484 height = dev->active_sensor->fmt[1].format.height;
423485 code = dev->active_sensor->fmt[1].format.code;
....@@ -437,12 +499,49 @@
437499 width, height, rkisp_mbus_pixelcode_to_v4l2(code));
438500 }
439501
440
- if (dev->isp_ver == ISP_V20 && dev->isp_inp == INP_CSI) {
502
+ if (dev->isp_ver == ISP_V20 &&
503
+ dev->isp_inp == INP_CSI && dev->active_sensor) {
441504 width = dev->active_sensor->fmt[2].format.width;
442505 height = dev->active_sensor->fmt[2].format.height;
443506 code = dev->active_sensor->fmt[2].format.code;
444507 rkisp_set_stream_def_fmt(dev, RKISP_STREAM_DMATX1,
445508 width, height, rkisp_mbus_pixelcode_to_v4l2(code));
509
+ }
510
+
511
+ if (dev->isp_ver == ISP_V30) {
512
+ struct v4l2_pix_format_mplane pixm = {
513
+ .width = width,
514
+ .height = height,
515
+ .pixelformat = rkisp_mbus_pixelcode_to_v4l2(code),
516
+ };
517
+
518
+ for (i = RKISP_STREAM_RAWRD0; i <= RKISP_STREAM_RAWRD2; i++)
519
+ rkisp_dmarx_set_fmt(&dev->dmarx_dev.stream[i], pixm);
520
+ rkisp_set_stream_def_fmt(dev, RKISP_STREAM_FBC,
521
+ width, height, V4L2_PIX_FMT_FBC0);
522
+#ifdef RKISP_STREAM_BP_EN
523
+ rkisp_set_stream_def_fmt(dev, RKISP_STREAM_BP,
524
+ width, height, V4L2_PIX_FMT_NV12);
525
+#endif
526
+ }
527
+
528
+ if (dev->isp_ver == ISP_V32 || dev->isp_ver == ISP_V32_L) {
529
+ struct v4l2_pix_format_mplane pixm = {
530
+ .width = width,
531
+ .height = height,
532
+ .pixelformat = rkisp_mbus_pixelcode_to_v4l2(code),
533
+ };
534
+
535
+ rkisp_dmarx_set_fmt(&dev->dmarx_dev.stream[RKISP_STREAM_RAWRD0], pixm);
536
+ rkisp_dmarx_set_fmt(&dev->dmarx_dev.stream[RKISP_STREAM_RAWRD2], pixm);
537
+ if (dev->isp_ver == ISP_V32) {
538
+ rkisp_set_stream_def_fmt(dev, RKISP_STREAM_BP,
539
+ width, height, V4L2_PIX_FMT_NV12);
540
+ rkisp_set_stream_def_fmt(dev, RKISP_STREAM_MPDS,
541
+ width / 4, height / 4, V4L2_PIX_FMT_NV12);
542
+ rkisp_set_stream_def_fmt(dev, RKISP_STREAM_BPDS,
543
+ width / 4, height / 4, V4L2_PIX_FMT_NV12);
544
+ }
446545 }
447546 return 0;
448547 }
....@@ -462,13 +561,16 @@
462561 if (ret < 0)
463562 goto unlock;
464563
465
- ret = rkisp_update_sensor_info(dev);
466
- if (ret < 0) {
467
- v4l2_err(&dev->v4l2_dev, "update sensor failed\n");
468
- goto unlock;
564
+ if (dev->isp_inp) {
565
+ ret = rkisp_update_sensor_info(dev);
566
+ if (ret < 0) {
567
+ v4l2_err(&dev->v4l2_dev, "update sensor failed\n");
568
+ goto unlock;
569
+ }
570
+ dev->is_hw_link = true;
469571 }
470572
471
- ret = _set_pipeline_default_fmt(dev);
573
+ ret = _set_pipeline_default_fmt(dev, true);
472574 if (ret < 0)
473575 goto unlock;
474576
....@@ -476,6 +578,8 @@
476578
477579 unlock:
478580 mutex_unlock(&dev->media_dev.graph_mutex);
581
+ if (!ret && dev->is_thunderboot)
582
+ schedule_work(&dev->cap_dev.fast_work);
479583 return ret;
480584 }
481585
....@@ -527,9 +631,28 @@
527631 return 0;
528632 }
529633
634
+static void subdev_notifier_unbind(struct v4l2_async_notifier *notifier,
635
+ struct v4l2_subdev *subdev,
636
+ struct v4l2_async_subdev *asd)
637
+{
638
+ struct rkisp_device *isp_dev = container_of(notifier, struct rkisp_device, notifier);
639
+ struct rkisp_isp_subdev *isp_sdev = &isp_dev->isp_sdev;
640
+ struct v4l2_subdev *isp_sd = &isp_sdev->sd;
641
+ int i;
642
+
643
+ for (i = 0; i < isp_dev->num_sensors; i++) {
644
+ if (isp_dev->sensors[i].sd == subdev) {
645
+ media_entity_call(&isp_sd->entity, link_setup,
646
+ isp_sd->entity.pads, subdev->entity.pads, 0);
647
+ isp_dev->sensors[i].sd = NULL;
648
+ }
649
+ }
650
+}
651
+
530652 static const struct v4l2_async_notifier_operations subdev_notifier_ops = {
531653 .bound = subdev_notifier_bound,
532654 .complete = subdev_notifier_complete,
655
+ .unbind = subdev_notifier_unbind,
533656 };
534657
535658 static int isp_subdev_notifier(struct rkisp_device *isp_dev)
....@@ -538,14 +661,13 @@
538661 struct device *dev = isp_dev->dev;
539662 int ret;
540663
664
+ v4l2_async_notifier_init(ntf);
665
+
541666 ret = v4l2_async_notifier_parse_fwnode_endpoints(
542667 dev, ntf, sizeof(struct rkisp_async_subdev),
543668 rkisp_fwnode_parse);
544669 if (ret < 0)
545670 return ret;
546
-
547
- if (!ntf->num_subdevs)
548
- return -ENODEV; /* no endpoint */
549671
550672 ntf->ops = &subdev_notifier_ops;
551673
....@@ -594,10 +716,6 @@
594716 if (ret < 0) {
595717 v4l2_err(&dev->v4l2_dev,
596718 "Failed to register subdev notifier(%d)\n", ret);
597
- /* maybe use dmarx to input image */
598
- ret = v4l2_device_register_subdev_nodes(&dev->v4l2_dev);
599
- if (ret == 0)
600
- return 0;
601719 goto err_unreg_luma_vdev;
602720 }
603721
....@@ -694,12 +812,8 @@
694812 sizeof(struct rkisp_thunderboot_resmem_head),
695813 DMA_BIDIRECTIONAL);
696814 ret = dma_mapping_error(dev, isp_dev->resmem_addr);
697
-
698815 isp_dev->is_thunderboot = true;
699
- atomic_inc(&isp_dev->hw_dev->tb_ref);
700
-
701
- dev_info(dev, "Allocated reserved memory, paddr: 0x%x\n",
702
- (u32)isp_dev->resmem_pa);
816
+ dev_info(dev, "Allocated reserved memory, paddr: 0x%x\n", (u32)isp_dev->resmem_pa);
703817 return ret;
704818 }
705819
....@@ -708,41 +822,49 @@
708822 struct device *dev = &pdev->dev;
709823 struct v4l2_device *v4l2_dev;
710824 struct rkisp_device *isp_dev;
711
- int i, ret;
825
+ int i, ret, mult = 1;
712826
713
- sprintf(rkisp_version, "v%02x.%02x.%02x",
714
- RKISP_DRIVER_VERSION >> 16,
715
- (RKISP_DRIVER_VERSION & 0xff00) >> 8,
716
- RKISP_DRIVER_VERSION & 0x00ff);
827
+ snprintf(rkisp_version, sizeof(rkisp_version),
828
+ "v%02x.%02x.%02x",
829
+ RKISP_DRIVER_VERSION >> 16,
830
+ (RKISP_DRIVER_VERSION & 0xff00) >> 8,
831
+ RKISP_DRIVER_VERSION & 0x00ff);
717832
718833 dev_info(dev, "rkisp driver version: %s\n", rkisp_version);
719834
720835 isp_dev = devm_kzalloc(dev, sizeof(*isp_dev), GFP_KERNEL);
721836 if (!isp_dev)
722837 return -ENOMEM;
723
- isp_dev->sw_base_addr = devm_kzalloc(dev, RKISP_ISP_SW_MAX_SIZE, GFP_KERNEL);
724
- if (!isp_dev->sw_base_addr)
725
- return -ENOMEM;
726838
727839 dev_set_drvdata(dev, isp_dev);
728840 isp_dev->dev = dev;
841
+ ret = rkisp_attach_hw(isp_dev);
842
+ if (ret)
843
+ return ret;
844
+
845
+ if (isp_dev->hw_dev->is_unite)
846
+ mult = 2;
847
+ isp_dev->sw_base_addr = devm_kzalloc(dev, RKISP_ISP_SW_MAX_SIZE * mult, GFP_KERNEL);
848
+ if (!isp_dev->sw_base_addr)
849
+ return -ENOMEM;
729850
730851 ret = rkisp_vs_irq_parse(dev);
731852 if (ret)
732853 return ret;
733854
734
- ret = rkisp_attach_hw(isp_dev);
855
+ snprintf(isp_dev->media_dev.model, sizeof(isp_dev->media_dev.model),
856
+ "%s%d", DRIVER_NAME, isp_dev->dev_id);
857
+ if (!isp_dev->hw_dev->is_unite)
858
+ strscpy(isp_dev->name, dev_name(dev), sizeof(isp_dev->name));
859
+ else
860
+ snprintf(isp_dev->name, sizeof(isp_dev->name),
861
+ "%s%d", "rkisp-unite", isp_dev->dev_id);
862
+ strscpy(isp_dev->media_dev.driver_name, isp_dev->name,
863
+ sizeof(isp_dev->media_dev.driver_name));
864
+
865
+ ret = rkisp_get_reserved_mem(isp_dev);
735866 if (ret)
736867 return ret;
737
-
738
- sprintf(isp_dev->media_dev.model, "%s%d",
739
- DRIVER_NAME, isp_dev->dev_id);
740
-
741
- if (isp_dev->hw_dev->is_thunderboot) {
742
- ret = rkisp_get_reserved_mem(isp_dev);
743
- if (ret)
744
- return ret;
745
- }
746868
747869 mutex_init(&isp_dev->apilock);
748870 mutex_init(&isp_dev->iqlock);
....@@ -761,9 +883,6 @@
761883 }
762884 }
763885
764
- strscpy(isp_dev->name, dev_name(dev), sizeof(isp_dev->name));
765
- strscpy(isp_dev->media_dev.driver_name, isp_dev->name,
766
- sizeof(isp_dev->media_dev.driver_name));
767886 isp_dev->media_dev.dev = dev;
768887 isp_dev->media_dev.ops = &rkisp_media_ops;
769888
....@@ -786,11 +905,13 @@
786905 goto err_unreg_v4l2_dev;
787906 }
788907
908
+ pm_runtime_enable(dev);
789909 /* create & register platefom subdev (from of_node) */
790910 ret = rkisp_register_platform_subdevs(isp_dev);
791
- if (ret < 0)
911
+ if (ret < 0) {
912
+ v4l2_err(v4l2_dev, "Failed to register platform subdevs:%d\n", ret);
792913 goto err_unreg_media_dev;
793
-
914
+ }
794915 rkisp_wait_line = 0;
795916 of_property_read_u32(dev->of_node, "wait-line", &rkisp_wait_line);
796917
....@@ -799,10 +920,7 @@
799920 mutex_lock(&rkisp_dev_mutex);
800921 list_add_tail(&isp_dev->list, &rkisp_device_list);
801922 mutex_unlock(&rkisp_dev_mutex);
802
-
803
- pm_runtime_enable(dev);
804
- if (isp_dev->hw_dev->is_thunderboot && isp_dev->is_thunderboot)
805
- pm_runtime_get_noresume(isp_dev->hw_dev->dev);
923
+ isp_dev->is_probe_end = true;
806924 return 0;
807925
808926 err_unreg_media_dev:
....@@ -816,11 +934,17 @@
816934 {
817935 struct rkisp_device *isp_dev = platform_get_drvdata(pdev);
818936
937
+ isp_dev->is_hw_link = false;
938
+ isp_dev->hw_dev->isp[isp_dev->dev_id] = NULL;
939
+
819940 pm_runtime_disable(&pdev->dev);
820941
821942 rkisp_proc_cleanup(isp_dev);
822943 media_device_unregister(&isp_dev->media_dev);
944
+ v4l2_async_notifier_unregister(&isp_dev->notifier);
945
+ v4l2_async_notifier_cleanup(&isp_dev->notifier);
823946 v4l2_device_unregister(&isp_dev->v4l2_dev);
947
+ v4l2_ctrl_handler_free(&isp_dev->ctrl_handler);
824948 rkisp_unregister_luma_vdev(&isp_dev->luma_vdev);
825949 rkisp_unregister_params_vdev(&isp_dev->params_vdev);
826950 rkisp_unregister_stats_vdev(&isp_dev->stats_vdev);
....@@ -849,7 +973,14 @@
849973 struct rkisp_device *isp_dev = dev_get_drvdata(dev);
850974 int ret;
851975
976
+ /* power on to config default format from sensor */
977
+ if (isp_dev->isp_inp & (INP_CSI | INP_DVP | INP_LVDS | INP_CIF) &&
978
+ rkisp_update_sensor_info(isp_dev) >= 0)
979
+ _set_pipeline_default_fmt(isp_dev, false);
980
+
852981 isp_dev->cap_dev.wait_line = rkisp_wait_line;
982
+ isp_dev->cap_dev.wrap_line = rkisp_wrap_line;
983
+ isp_dev->is_rdbk_auto = rkisp_rdbk_auto;
853984 mutex_lock(&isp_dev->hw_dev->dev_lock);
854985 ret = pm_runtime_get_sync(isp_dev->hw_dev->dev);
855986 mutex_unlock(&isp_dev->hw_dev->dev_lock);
....@@ -894,3 +1025,4 @@
8941025 MODULE_AUTHOR("Rockchip Camera/ISP team");
8951026 MODULE_DESCRIPTION("Rockchip ISP platform driver");
8961027 MODULE_LICENSE("Dual BSD/GPL");
1028
+MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver);