.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * VPDMA helper library |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * David Griego, <dagriego@biglakesoftware.com> |
---|
7 | 8 | * Dale Farnsworth, <dale@farnsworth.org> |
---|
8 | 9 | * 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. |
---|
13 | 10 | */ |
---|
14 | 11 | |
---|
15 | 12 | #include <linux/delay.h> |
---|
.. | .. |
---|
57 | 54 | [VPDMA_DATA_FMT_C420] = { |
---|
58 | 55 | .type = VPDMA_DATA_FMT_TYPE_YUV, |
---|
59 | 56 | .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, |
---|
60 | 62 | .depth = 4, |
---|
61 | 63 | }, |
---|
62 | 64 | [VPDMA_DATA_FMT_YCR422] = { |
---|
.. | .. |
---|
404 | 406 | |
---|
405 | 407 | /* |
---|
406 | 408 | * 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 |
---|
408 | 410 | */ |
---|
409 | 411 | void vpdma_unmap_desc_buf(struct vpdma_data *vpdma, struct vpdma_buf *buf) |
---|
410 | 412 | { |
---|
.. | .. |
---|
448 | 450 | |
---|
449 | 451 | ret = vpdma_map_desc_buf(vpdma, &abort_list.buf); |
---|
450 | 452 | if (ret) |
---|
451 | | - return ret; |
---|
| 453 | + goto free_desc; |
---|
452 | 454 | ret = vpdma_submit_descs(vpdma, &abort_list, list_num); |
---|
453 | 455 | if (ret) |
---|
454 | | - return ret; |
---|
| 456 | + goto unmap_desc; |
---|
455 | 457 | |
---|
456 | 458 | while (vpdma_list_busy(vpdma, list_num) && --timeout) |
---|
457 | 459 | ; |
---|
458 | 460 | |
---|
459 | 461 | if (timeout == 0) { |
---|
460 | 462 | dev_err(&vpdma->pdev->dev, "Timed out cleaning up VPDMA list\n"); |
---|
461 | | - return -EBUSY; |
---|
| 463 | + ret = -EBUSY; |
---|
462 | 464 | } |
---|
463 | 465 | |
---|
| 466 | +unmap_desc: |
---|
464 | 467 | vpdma_unmap_desc_buf(vpdma, &abort_list.buf); |
---|
| 468 | +free_desc: |
---|
465 | 469 | vpdma_free_desc_buf(&abort_list.buf); |
---|
466 | 470 | |
---|
467 | | - return 0; |
---|
| 471 | + return ret; |
---|
468 | 472 | } |
---|
469 | 473 | EXPORT_SYMBOL(vpdma_list_cleanup); |
---|
470 | 474 | |
---|
.. | .. |
---|
501 | 505 | EXPORT_SYMBOL(vpdma_reset_desc_list); |
---|
502 | 506 | |
---|
503 | 507 | /* |
---|
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 |
---|
505 | 509 | * called when the user doesn't want to use VPDMA any more. |
---|
506 | 510 | */ |
---|
507 | 511 | void vpdma_free_desc_list(struct vpdma_desc_list *list) |
---|
.. | .. |
---|
760 | 764 | pr_debug("word1: line_length = %d, xfer_height = %d\n", |
---|
761 | 765 | dtd_get_line_length(dtd), dtd_get_xfer_height(dtd)); |
---|
762 | 766 | |
---|
763 | | - pr_debug("word2: start_addr = %pad\n", &dtd->start_addr); |
---|
| 767 | + pr_debug("word2: start_addr = %x\n", dtd->start_addr); |
---|
764 | 768 | |
---|
765 | 769 | pr_debug("word3: pkt_type = %d, mode = %d, dir = %d, chan = %d, pri = %d, next_chan = %d\n", |
---|
766 | 770 | dtd_get_pkt_type(dtd), |
---|
.. | .. |
---|
790 | 794 | * append an outbound data transfer descriptor to the given descriptor list, |
---|
791 | 795 | * this sets up a 'client to memory' VPDMA transfer for the given VPDMA channel |
---|
792 | 796 | * |
---|
793 | | - * @list: vpdma desc list to which we add this decriptor |
---|
| 797 | + * @list: vpdma desc list to which we add this descriptor |
---|
794 | 798 | * @width: width of the image in pixels in memory |
---|
795 | 799 | * @c_rect: compose params of output image |
---|
796 | 800 | * @fmt: vpdma data format of the buffer |
---|
.. | .. |
---|
798 | 802 | * max_width: enum for maximum width of data transfer |
---|
799 | 803 | * max_height: enum for maximum height of data transfer |
---|
800 | 804 | * chan: VPDMA channel |
---|
801 | | - * flags: VPDMA flags to configure some descriptor fileds |
---|
| 805 | + * flags: VPDMA flags to configure some descriptor fields |
---|
802 | 806 | */ |
---|
803 | 807 | void vpdma_add_out_dtd(struct vpdma_desc_list *list, int width, |
---|
804 | 808 | int stride, const struct v4l2_rect *c_rect, |
---|
.. | .. |
---|
826 | 830 | channel = next_chan = raw_vpdma_chan; |
---|
827 | 831 | |
---|
828 | 832 | 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)) { |
---|
830 | 835 | rect.height >>= 1; |
---|
831 | 836 | rect.top >>= 1; |
---|
832 | 837 | depth = 8; |
---|
.. | .. |
---|
863 | 868 | * append an inbound data transfer descriptor to the given descriptor list, |
---|
864 | 869 | * this sets up a 'memory to client' VPDMA transfer for the given VPDMA channel |
---|
865 | 870 | * |
---|
866 | | - * @list: vpdma desc list to which we add this decriptor |
---|
| 871 | + * @list: vpdma desc list to which we add this descriptor |
---|
867 | 872 | * @width: width of the image in pixels in memory(not the cropped width) |
---|
868 | 873 | * @c_rect: crop params of input image |
---|
869 | 874 | * @fmt: vpdma data format of the buffer |
---|
870 | 875 | * dma_addr: dma address as seen by VPDMA |
---|
871 | 876 | * chan: VPDMA channel |
---|
872 | 877 | * 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 |
---|
874 | 879 | * frame_width/height: the complete width/height of the image presented to the |
---|
875 | 880 | * client (this makes sense when multiple channels are |
---|
876 | 881 | * connected to the same client, forming a larger frame) |
---|
.. | .. |
---|
894 | 899 | channel = next_chan = chan_info[chan].num; |
---|
895 | 900 | |
---|
896 | 901 | 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)) { |
---|
898 | 904 | rect.height >>= 1; |
---|
899 | 905 | rect.top >>= 1; |
---|
900 | 906 | depth = 8; |
---|
.. | .. |
---|
1008 | 1014 | } |
---|
1009 | 1015 | EXPORT_SYMBOL(vpdma_get_list_mask); |
---|
1010 | 1016 | |
---|
1011 | | -/* clear previosuly occured list intterupts in the LIST_STAT register */ |
---|
| 1017 | +/* clear previously occurred list interrupts in the LIST_STAT register */ |
---|
1012 | 1018 | void vpdma_clear_list_stat(struct vpdma_data *vpdma, int irq_num, |
---|
1013 | 1019 | int list_num) |
---|
1014 | 1020 | { |
---|