hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/platform/ti-vpe/vpdma.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * VPDMA helper library
34 *
....@@ -6,10 +7,6 @@
67 * David Griego, <dagriego@biglakesoftware.com>
78 * Dale Farnsworth, <dale@farnsworth.org>
89 * Archit Taneja, <archit@ti.com>
9
- *
10
- * This program is free software; you can redistribute it and/or modify it
11
- * under the terms of the GNU General Public License version 2 as published by
12
- * the Free Software Foundation.
1310 */
1411
1512 #include <linux/delay.h>
....@@ -57,6 +54,11 @@
5754 [VPDMA_DATA_FMT_C420] = {
5855 .type = VPDMA_DATA_FMT_TYPE_YUV,
5956 .data_type = DATA_TYPE_C420,
57
+ .depth = 4,
58
+ },
59
+ [VPDMA_DATA_FMT_CB420] = {
60
+ .type = VPDMA_DATA_FMT_TYPE_YUV,
61
+ .data_type = DATA_TYPE_CB420,
6062 .depth = 4,
6163 },
6264 [VPDMA_DATA_FMT_YCR422] = {
....@@ -404,7 +406,7 @@
404406
405407 /*
406408 * unmap descriptor/payload DMA buffer, disabling DMA access and
407
- * allowing the main processor to acces the data
409
+ * allowing the main processor to access the data
408410 */
409411 void vpdma_unmap_desc_buf(struct vpdma_data *vpdma, struct vpdma_buf *buf)
410412 {
....@@ -448,23 +450,25 @@
448450
449451 ret = vpdma_map_desc_buf(vpdma, &abort_list.buf);
450452 if (ret)
451
- return ret;
453
+ goto free_desc;
452454 ret = vpdma_submit_descs(vpdma, &abort_list, list_num);
453455 if (ret)
454
- return ret;
456
+ goto unmap_desc;
455457
456458 while (vpdma_list_busy(vpdma, list_num) && --timeout)
457459 ;
458460
459461 if (timeout == 0) {
460462 dev_err(&vpdma->pdev->dev, "Timed out cleaning up VPDMA list\n");
461
- return -EBUSY;
463
+ ret = -EBUSY;
462464 }
463465
466
+unmap_desc:
464467 vpdma_unmap_desc_buf(vpdma, &abort_list.buf);
468
+free_desc:
465469 vpdma_free_desc_buf(&abort_list.buf);
466470
467
- return 0;
471
+ return ret;
468472 }
469473 EXPORT_SYMBOL(vpdma_list_cleanup);
470474
....@@ -501,7 +505,7 @@
501505 EXPORT_SYMBOL(vpdma_reset_desc_list);
502506
503507 /*
504
- * free the buffer allocated fot the VPDMA descriptor list, this should be
508
+ * free the buffer allocated for the VPDMA descriptor list, this should be
505509 * called when the user doesn't want to use VPDMA any more.
506510 */
507511 void vpdma_free_desc_list(struct vpdma_desc_list *list)
....@@ -760,7 +764,7 @@
760764 pr_debug("word1: line_length = %d, xfer_height = %d\n",
761765 dtd_get_line_length(dtd), dtd_get_xfer_height(dtd));
762766
763
- pr_debug("word2: start_addr = %pad\n", &dtd->start_addr);
767
+ pr_debug("word2: start_addr = %x\n", dtd->start_addr);
764768
765769 pr_debug("word3: pkt_type = %d, mode = %d, dir = %d, chan = %d, pri = %d, next_chan = %d\n",
766770 dtd_get_pkt_type(dtd),
....@@ -790,7 +794,7 @@
790794 * append an outbound data transfer descriptor to the given descriptor list,
791795 * this sets up a 'client to memory' VPDMA transfer for the given VPDMA channel
792796 *
793
- * @list: vpdma desc list to which we add this decriptor
797
+ * @list: vpdma desc list to which we add this descriptor
794798 * @width: width of the image in pixels in memory
795799 * @c_rect: compose params of output image
796800 * @fmt: vpdma data format of the buffer
....@@ -798,7 +802,7 @@
798802 * max_width: enum for maximum width of data transfer
799803 * max_height: enum for maximum height of data transfer
800804 * chan: VPDMA channel
801
- * flags: VPDMA flags to configure some descriptor fileds
805
+ * flags: VPDMA flags to configure some descriptor fields
802806 */
803807 void vpdma_add_out_dtd(struct vpdma_desc_list *list, int width,
804808 int stride, const struct v4l2_rect *c_rect,
....@@ -826,7 +830,8 @@
826830 channel = next_chan = raw_vpdma_chan;
827831
828832 if (fmt->type == VPDMA_DATA_FMT_TYPE_YUV &&
829
- fmt->data_type == DATA_TYPE_C420) {
833
+ (fmt->data_type == DATA_TYPE_C420 ||
834
+ fmt->data_type == DATA_TYPE_CB420)) {
830835 rect.height >>= 1;
831836 rect.top >>= 1;
832837 depth = 8;
....@@ -863,14 +868,14 @@
863868 * append an inbound data transfer descriptor to the given descriptor list,
864869 * this sets up a 'memory to client' VPDMA transfer for the given VPDMA channel
865870 *
866
- * @list: vpdma desc list to which we add this decriptor
871
+ * @list: vpdma desc list to which we add this descriptor
867872 * @width: width of the image in pixels in memory(not the cropped width)
868873 * @c_rect: crop params of input image
869874 * @fmt: vpdma data format of the buffer
870875 * dma_addr: dma address as seen by VPDMA
871876 * chan: VPDMA channel
872877 * field: top or bottom field info of the input image
873
- * flags: VPDMA flags to configure some descriptor fileds
878
+ * flags: VPDMA flags to configure some descriptor fields
874879 * frame_width/height: the complete width/height of the image presented to the
875880 * client (this makes sense when multiple channels are
876881 * connected to the same client, forming a larger frame)
....@@ -894,7 +899,8 @@
894899 channel = next_chan = chan_info[chan].num;
895900
896901 if (fmt->type == VPDMA_DATA_FMT_TYPE_YUV &&
897
- fmt->data_type == DATA_TYPE_C420) {
902
+ (fmt->data_type == DATA_TYPE_C420 ||
903
+ fmt->data_type == DATA_TYPE_CB420)) {
898904 rect.height >>= 1;
899905 rect.top >>= 1;
900906 depth = 8;
....@@ -1008,7 +1014,7 @@
10081014 }
10091015 EXPORT_SYMBOL(vpdma_get_list_mask);
10101016
1011
-/* clear previosuly occured list intterupts in the LIST_STAT register */
1017
+/* clear previously occurred list interrupts in the LIST_STAT register */
10121018 void vpdma_clear_list_stat(struct vpdma_data *vpdma, int irq_num,
10131019 int list_num)
10141020 {