hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/platform/qcom/camss/camss-vfe.c
....@@ -37,9 +37,9 @@
3737 /* VFE halt timeout */
3838 #define VFE_HALT_TIMEOUT_MS 100
3939 /* Max number of frame drop updates per frame */
40
-#define VFE_FRAME_DROP_UPDATES 5
41
-/* Frame drop value. NOTE: VAL + UPDATES should not exceed 31 */
42
-#define VFE_FRAME_DROP_VAL 20
40
+#define VFE_FRAME_DROP_UPDATES 2
41
+/* Frame drop value. VAL + UPDATES - 1 should not exceed 31 */
42
+#define VFE_FRAME_DROP_VAL 30
4343
4444 #define VFE_NEXT_SOF_MS 500
4545
....@@ -659,13 +659,26 @@
659659 struct vfe_device *vfe = to_vfe(line);
660660 struct vfe_output *output = &line->output;
661661 const struct vfe_hw_ops *ops = vfe->ops;
662
+ struct media_entity *sensor;
662663 unsigned long flags;
664
+ unsigned int frame_skip = 0;
663665 unsigned int i;
664666 u16 ub_size;
665667
666668 ub_size = ops->get_ub_size(vfe->id);
667669 if (!ub_size)
668670 return -EINVAL;
671
+
672
+ sensor = camss_find_sensor(&line->subdev.entity);
673
+ if (sensor) {
674
+ struct v4l2_subdev *subdev =
675
+ media_entity_to_v4l2_subdev(sensor);
676
+
677
+ v4l2_subdev_call(subdev, sensor, g_skip_frames, &frame_skip);
678
+ /* Max frame skip is 29 frames */
679
+ if (frame_skip > VFE_FRAME_DROP_VAL - 1)
680
+ frame_skip = VFE_FRAME_DROP_VAL - 1;
681
+ }
669682
670683 spin_lock_irqsave(&vfe->output_lock, flags);
671684
....@@ -695,10 +708,10 @@
695708
696709 switch (output->state) {
697710 case VFE_OUTPUT_SINGLE:
698
- vfe_output_frame_drop(vfe, output, 1);
711
+ vfe_output_frame_drop(vfe, output, 1 << frame_skip);
699712 break;
700713 case VFE_OUTPUT_CONTINUOUS:
701
- vfe_output_frame_drop(vfe, output, 3);
714
+ vfe_output_frame_drop(vfe, output, 3 << frame_skip);
702715 break;
703716 default:
704717 vfe_output_frame_drop(vfe, output, 0);
....@@ -1252,12 +1265,12 @@
12521265
12531266 ret = vfe_set_clock_rates(vfe);
12541267 if (ret < 0)
1255
- goto error_clocks;
1268
+ goto error_pm_runtime_get;
12561269
12571270 ret = camss_enable_clocks(vfe->nclocks, vfe->clock,
12581271 vfe->camss->dev);
12591272 if (ret < 0)
1260
- goto error_clocks;
1273
+ goto error_pm_runtime_get;
12611274
12621275 ret = vfe_reset(vfe);
12631276 if (ret < 0)
....@@ -1269,7 +1282,7 @@
12691282 } else {
12701283 ret = vfe_check_clock_rates(vfe);
12711284 if (ret < 0)
1272
- goto error_clocks;
1285
+ goto error_pm_runtime_get;
12731286 }
12741287 vfe->power_count++;
12751288
....@@ -1280,10 +1293,8 @@
12801293 error_reset:
12811294 camss_disable_clocks(vfe->nclocks, vfe->clock);
12821295
1283
-error_clocks:
1284
- pm_runtime_put_sync(vfe->camss->dev);
1285
-
12861296 error_pm_runtime_get:
1297
+ pm_runtime_put_sync(vfe->camss->dev);
12871298 camss_pm_domain_off(vfe->camss, vfe->id);
12881299
12891300 error_pm_domain:
....@@ -2193,14 +2204,6 @@
21932204 .queue_buffer = vfe_queue_buffer,
21942205 .flush_buffers = vfe_flush_buffers,
21952206 };
2196
-
2197
-void msm_vfe_stop_streaming(struct vfe_device *vfe)
2198
-{
2199
- int i;
2200
-
2201
- for (i = 0; i < ARRAY_SIZE(vfe->line); i++)
2202
- msm_video_stop_streaming(&vfe->line[i].video_out);
2203
-}
22042207
22052208 /*
22062209 * msm_vfe_register_entities - Register subdev node for VFE module