forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/media/platform/omap3isp/ispccdc.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * ispccdc.c
34 *
....@@ -8,10 +9,6 @@
89 *
910 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
1011 * Sakari Ailus <sakari.ailus@iki.fi>
11
- *
12
- * This program is free software; you can redistribute it and/or modify
13
- * it under the terms of the GNU General Public License version 2 as
14
- * published by the Free Software Foundation.
1512 */
1613
1714 #include <linux/module.h>
....@@ -1315,6 +1312,10 @@
13151312 {
13161313 struct isp_device *isp = to_isp_device(ccdc);
13171314
1315
+ /* Avoid restarting the CCDC when streaming is stopping. */
1316
+ if (enable && ccdc->stopping & CCDC_STOP_REQUEST)
1317
+ return;
1318
+
13181319 isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_PCR,
13191320 ISPCCDC_PCR_EN, enable ? ISPCCDC_PCR_EN : 0);
13201321
....@@ -1594,7 +1595,7 @@
15941595 return 0;
15951596
15961597 /* We're in continuous mode, and memory writes were disabled due to a
1597
- * buffer underrun. Reenable them now that we have a buffer. The buffer
1598
+ * buffer underrun. Re-enable them now that we have a buffer. The buffer
15981599 * address has been set in ccdc_video_queue.
15991600 */
16001601 if (ccdc->state == ISP_PIPELINE_STREAM_CONTINUOUS && ccdc->underrun) {
....@@ -1609,6 +1610,11 @@
16091610 omap3isp_pipeline_cancel_stream(pipe);
16101611 return 0;
16111612 }
1613
+
1614
+ /* Don't restart CCDC if we're just about to stop streaming. */
1615
+ if (ccdc->state == ISP_PIPELINE_STREAM_CONTINUOUS &&
1616
+ ccdc->stopping & CCDC_STOP_REQUEST)
1617
+ return 0;
16121618
16131619 if (!ccdc_has_all_fields(ccdc))
16141620 return 1;
....@@ -1664,15 +1670,14 @@
16641670 spin_unlock_irqrestore(&ccdc->lock, flags);
16651671 }
16661672
1667
- if (ccdc->output & CCDC_OUTPUT_MEMORY)
1668
- restart = ccdc_isr_buffer(ccdc);
1669
-
16701673 spin_lock_irqsave(&ccdc->lock, flags);
1671
-
16721674 if (ccdc_handle_stopping(ccdc, CCDC_EVENT_VD0)) {
16731675 spin_unlock_irqrestore(&ccdc->lock, flags);
16741676 return;
16751677 }
1678
+
1679
+ if (ccdc->output & CCDC_OUTPUT_MEMORY)
1680
+ restart = ccdc_isr_buffer(ccdc);
16761681
16771682 if (!ccdc->shadow_update)
16781683 ccdc_apply_controls(ccdc);
....@@ -1712,7 +1717,7 @@
17121717 * data to memory the CCDC and LSC are stopped immediately but
17131718 * without change the CCDC stopping state machine. The CCDC
17141719 * stopping state machine should be used only when user request
1715
- * for stopping is received (SINGLESHOT is an exeption).
1720
+ * for stopping is received (SINGLESHOT is an exception).
17161721 */
17171722 switch (ccdc->state) {
17181723 case ISP_PIPELINE_STREAM_SINGLESHOT:
....@@ -2642,7 +2647,7 @@
26422647
26432648 v4l2_subdev_init(sd, &ccdc_v4l2_ops);
26442649 sd->internal_ops = &ccdc_v4l2_internal_ops;
2645
- strlcpy(sd->name, "OMAP3 ISP CCDC", sizeof(sd->name));
2650
+ strscpy(sd->name, "OMAP3 ISP CCDC", sizeof(sd->name));
26462651 sd->grp_id = 1 << 16; /* group ID for isp subdevs */
26472652 v4l2_set_subdevdata(sd, ccdc);
26482653 sd->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE;