diff options
-rw-r--r-- | drivers/media/platform/coda/Makefile | 2 | ||||
-rw-r--r-- | drivers/media/platform/coda/coda-bit.c | 48 | ||||
-rw-r--r-- | drivers/media/platform/coda/coda-common.c | 74 | ||||
-rw-r--r-- | drivers/media/platform/coda/coda-gdi.c | 150 | ||||
-rw-r--r-- | drivers/media/platform/coda/coda.h | 11 | ||||
-rw-r--r-- | drivers/media/platform/coda/coda_regs.h | 6 |
6 files changed, 221 insertions, 70 deletions
diff --git a/drivers/media/platform/coda/Makefile b/drivers/media/platform/coda/Makefile index 834e504bf085..9342ac57b230 100644 --- a/drivers/media/platform/coda/Makefile +++ b/drivers/media/platform/coda/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | ccflags-y += -I$(src) | 1 | ccflags-y += -I$(src) |
2 | 2 | ||
3 | coda-objs := coda-common.o coda-bit.o coda-h264.o coda-jpeg.o | 3 | coda-objs := coda-common.o coda-bit.o coda-gdi.o coda-h264.o coda-jpeg.o |
4 | 4 | ||
5 | obj-$(CONFIG_VIDEO_CODA) += coda.o | 5 | obj-$(CONFIG_VIDEO_CODA) += coda.o |
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c index 46c70547fc12..3d434a4ed537 100644 --- a/drivers/media/platform/coda/coda-bit.c +++ b/drivers/media/platform/coda/coda-bit.c | |||
@@ -340,7 +340,6 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx, | |||
340 | { | 340 | { |
341 | struct coda_dev *dev = ctx->dev; | 341 | struct coda_dev *dev = ctx->dev; |
342 | int width, height; | 342 | int width, height; |
343 | dma_addr_t paddr; | ||
344 | int ysize; | 343 | int ysize; |
345 | int ret; | 344 | int ret; |
346 | int i; | 345 | int i; |
@@ -360,7 +359,10 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx, | |||
360 | size_t size; | 359 | size_t size; |
361 | char *name; | 360 | char *name; |
362 | 361 | ||
363 | size = ysize + ysize / 2; | 362 | if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP) |
363 | size = round_up(ysize, 4096) + ysize / 2; | ||
364 | else | ||
365 | size = ysize + ysize / 2; | ||
364 | if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 && | 366 | if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 && |
365 | dev->devtype->product != CODA_DX6) | 367 | dev->devtype->product != CODA_DX6) |
366 | size += ysize / 4; | 368 | size += ysize / 4; |
@@ -376,11 +378,23 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx, | |||
376 | 378 | ||
377 | /* Register frame buffers in the parameter buffer */ | 379 | /* Register frame buffers in the parameter buffer */ |
378 | for (i = 0; i < ctx->num_internal_frames; i++) { | 380 | for (i = 0; i < ctx->num_internal_frames; i++) { |
379 | paddr = ctx->internal_frames[i].paddr; | 381 | u32 y, cb, cr; |
382 | |||
380 | /* Start addresses of Y, Cb, Cr planes */ | 383 | /* Start addresses of Y, Cb, Cr planes */ |
381 | coda_parabuf_write(ctx, i * 3 + 0, paddr); | 384 | y = ctx->internal_frames[i].paddr; |
382 | coda_parabuf_write(ctx, i * 3 + 1, paddr + ysize); | 385 | cb = y + ysize; |
383 | coda_parabuf_write(ctx, i * 3 + 2, paddr + ysize + ysize / 4); | 386 | cr = y + ysize + ysize/4; |
387 | if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP) { | ||
388 | cb = round_up(cb, 4096); | ||
389 | cr = 0; | ||
390 | /* Packed 20-bit MSB of base addresses */ | ||
391 | /* YYYYYCCC, CCyyyyyc, cccc.... */ | ||
392 | y = (y & 0xfffff000) | cb >> 20; | ||
393 | cb = (cb & 0x000ff000) << 12; | ||
394 | } | ||
395 | coda_parabuf_write(ctx, i * 3 + 0, y); | ||
396 | coda_parabuf_write(ctx, i * 3 + 1, cb); | ||
397 | coda_parabuf_write(ctx, i * 3 + 2, cr); | ||
384 | 398 | ||
385 | /* mvcol buffer for h.264 */ | 399 | /* mvcol buffer for h.264 */ |
386 | if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 && | 400 | if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 && |
@@ -725,9 +739,15 @@ static void coda9_set_frame_cache(struct coda_ctx *ctx, u32 fourcc) | |||
725 | { | 739 | { |
726 | u32 cache_size, cache_config; | 740 | u32 cache_size, cache_config; |
727 | 741 | ||
728 | /* Luma 2x0 page, 2x6 cache, chroma 2x0 page, 2x4 cache size */ | 742 | if (ctx->tiled_map_type == GDI_LINEAR_FRAME_MAP) { |
729 | cache_size = 0x20262024; | 743 | /* Luma 2x0 page, 2x6 cache, chroma 2x0 page, 2x4 cache size */ |
730 | cache_config = 2 << CODA9_CACHE_PAGEMERGE_OFFSET; | 744 | cache_size = 0x20262024; |
745 | cache_config = 2 << CODA9_CACHE_PAGEMERGE_OFFSET; | ||
746 | } else { | ||
747 | /* Luma 0x2 page, 4x4 cache, chroma 0x2 page, 4x3 cache size */ | ||
748 | cache_size = 0x02440243; | ||
749 | cache_config = 1 << CODA9_CACHE_PAGEMERGE_OFFSET; | ||
750 | } | ||
731 | coda_write(ctx->dev, cache_size, CODA9_CMD_SET_FRAME_CACHE_SIZE); | 751 | coda_write(ctx->dev, cache_size, CODA9_CMD_SET_FRAME_CACHE_SIZE); |
732 | if (fourcc == V4L2_PIX_FMT_NV12) { | 752 | if (fourcc == V4L2_PIX_FMT_NV12) { |
733 | cache_config |= 32 << CODA9_CACHE_LUMA_BUFFER_SIZE_OFFSET | | 753 | cache_config |= 32 << CODA9_CACHE_LUMA_BUFFER_SIZE_OFFSET | |
@@ -818,9 +838,12 @@ static int coda_start_encoding(struct coda_ctx *ctx) | |||
818 | break; | 838 | break; |
819 | } | 839 | } |
820 | 840 | ||
821 | ctx->frame_mem_ctrl &= ~CODA_FRAME_CHROMA_INTERLEAVE; | 841 | ctx->frame_mem_ctrl &= ~(CODA_FRAME_CHROMA_INTERLEAVE | (0x3 << 9) | |
842 | CODA9_FRAME_TILED2LINEAR); | ||
822 | if (q_data_src->fourcc == V4L2_PIX_FMT_NV12) | 843 | if (q_data_src->fourcc == V4L2_PIX_FMT_NV12) |
823 | ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE; | 844 | ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE; |
845 | if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP) | ||
846 | ctx->frame_mem_ctrl |= (0x3 << 9) | CODA9_FRAME_TILED2LINEAR; | ||
824 | coda_write(dev, ctx->frame_mem_ctrl, CODA_REG_BIT_FRAME_MEM_CTRL); | 847 | coda_write(dev, ctx->frame_mem_ctrl, CODA_REG_BIT_FRAME_MEM_CTRL); |
825 | 848 | ||
826 | if (dev->devtype->product == CODA_DX6) { | 849 | if (dev->devtype->product == CODA_DX6) { |
@@ -1497,9 +1520,12 @@ static int __coda_start_decoding(struct coda_ctx *ctx) | |||
1497 | /* Update coda bitstream read and write pointers from kfifo */ | 1520 | /* Update coda bitstream read and write pointers from kfifo */ |
1498 | coda_kfifo_sync_to_device_full(ctx); | 1521 | coda_kfifo_sync_to_device_full(ctx); |
1499 | 1522 | ||
1500 | ctx->frame_mem_ctrl &= ~CODA_FRAME_CHROMA_INTERLEAVE; | 1523 | ctx->frame_mem_ctrl &= ~(CODA_FRAME_CHROMA_INTERLEAVE | (0x3 << 9) | |
1524 | CODA9_FRAME_TILED2LINEAR); | ||
1501 | if (dst_fourcc == V4L2_PIX_FMT_NV12) | 1525 | if (dst_fourcc == V4L2_PIX_FMT_NV12) |
1502 | ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE; | 1526 | ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE; |
1527 | if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP) | ||
1528 | ctx->frame_mem_ctrl |= (0x3 << 9) | CODA9_FRAME_TILED2LINEAR; | ||
1503 | coda_write(dev, ctx->frame_mem_ctrl, CODA_REG_BIT_FRAME_MEM_CTRL); | 1529 | coda_write(dev, ctx->frame_mem_ctrl, CODA_REG_BIT_FRAME_MEM_CTRL); |
1504 | 1530 | ||
1505 | ctx->display_idx = -1; | 1531 | ctx->display_idx = -1; |
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c index a7cab14d10c9..d62b82846037 100644 --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c | |||
@@ -62,6 +62,10 @@ int coda_debug; | |||
62 | module_param(coda_debug, int, 0644); | 62 | module_param(coda_debug, int, 0644); |
63 | MODULE_PARM_DESC(coda_debug, "Debug level (0-2)"); | 63 | MODULE_PARM_DESC(coda_debug, "Debug level (0-2)"); |
64 | 64 | ||
65 | static int disable_tiling; | ||
66 | module_param(disable_tiling, int, 0644); | ||
67 | MODULE_PARM_DESC(disable_tiling, "Disable tiled frame buffers"); | ||
68 | |||
65 | void coda_write(struct coda_dev *dev, u32 data, u32 reg) | 69 | void coda_write(struct coda_dev *dev, u32 data, u32 reg) |
66 | { | 70 | { |
67 | v4l2_dbg(2, coda_debug, &dev->v4l2_dev, | 71 | v4l2_dbg(2, coda_debug, &dev->v4l2_dev, |
@@ -585,6 +589,22 @@ static int coda_s_fmt(struct coda_ctx *ctx, struct v4l2_format *f) | |||
585 | q_data->rect.width = f->fmt.pix.width; | 589 | q_data->rect.width = f->fmt.pix.width; |
586 | q_data->rect.height = f->fmt.pix.height; | 590 | q_data->rect.height = f->fmt.pix.height; |
587 | 591 | ||
592 | switch (f->fmt.pix.pixelformat) { | ||
593 | case V4L2_PIX_FMT_NV12: | ||
594 | if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { | ||
595 | ctx->tiled_map_type = GDI_TILED_FRAME_MB_RASTER_MAP; | ||
596 | if (!disable_tiling) | ||
597 | break; | ||
598 | } | ||
599 | /* else fall through */ | ||
600 | case V4L2_PIX_FMT_YUV420: | ||
601 | case V4L2_PIX_FMT_YVU420: | ||
602 | ctx->tiled_map_type = GDI_LINEAR_FRAME_MAP; | ||
603 | break; | ||
604 | default: | ||
605 | break; | ||
606 | } | ||
607 | |||
588 | v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, | 608 | v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, |
589 | "Setting format for type %d, wxh: %dx%d, fmt: %d\n", | 609 | "Setting format for type %d, wxh: %dx%d, fmt: %d\n", |
590 | f->type, q_data->width, q_data->height, q_data->fourcc); | 610 | f->type, q_data->width, q_data->height, q_data->fourcc); |
@@ -916,27 +936,6 @@ static const struct v4l2_ioctl_ops coda_ioctl_ops = { | |||
916 | .vidioc_unsubscribe_event = v4l2_event_unsubscribe, | 936 | .vidioc_unsubscribe_event = v4l2_event_unsubscribe, |
917 | }; | 937 | }; |
918 | 938 | ||
919 | void coda_set_gdi_regs(struct coda_ctx *ctx) | ||
920 | { | ||
921 | struct gdi_tiled_map *tiled_map = &ctx->tiled_map; | ||
922 | struct coda_dev *dev = ctx->dev; | ||
923 | int i; | ||
924 | |||
925 | for (i = 0; i < 16; i++) | ||
926 | coda_write(dev, tiled_map->xy2ca_map[i], | ||
927 | CODA9_GDI_XY2_CAS_0 + 4 * i); | ||
928 | for (i = 0; i < 4; i++) | ||
929 | coda_write(dev, tiled_map->xy2ba_map[i], | ||
930 | CODA9_GDI_XY2_BA_0 + 4 * i); | ||
931 | for (i = 0; i < 16; i++) | ||
932 | coda_write(dev, tiled_map->xy2ra_map[i], | ||
933 | CODA9_GDI_XY2_RAS_0 + 4 * i); | ||
934 | coda_write(dev, tiled_map->xy2rbc_config, CODA9_GDI_XY2_RBC_CONFIG); | ||
935 | for (i = 0; i < 32; i++) | ||
936 | coda_write(dev, tiled_map->rbc2axi_map[i], | ||
937 | CODA9_GDI_RBC2_AXI_0 + 4 * i); | ||
938 | } | ||
939 | |||
940 | /* | 939 | /* |
941 | * Mem-to-mem operations. | 940 | * Mem-to-mem operations. |
942 | */ | 941 | */ |
@@ -1084,32 +1083,6 @@ static const struct v4l2_m2m_ops coda_m2m_ops = { | |||
1084 | .unlock = coda_unlock, | 1083 | .unlock = coda_unlock, |
1085 | }; | 1084 | }; |
1086 | 1085 | ||
1087 | static void coda_set_tiled_map_type(struct coda_ctx *ctx, int tiled_map_type) | ||
1088 | { | ||
1089 | struct gdi_tiled_map *tiled_map = &ctx->tiled_map; | ||
1090 | int luma_map, chro_map, i; | ||
1091 | |||
1092 | memset(tiled_map, 0, sizeof(*tiled_map)); | ||
1093 | |||
1094 | luma_map = 64; | ||
1095 | chro_map = 64; | ||
1096 | tiled_map->map_type = tiled_map_type; | ||
1097 | for (i = 0; i < 16; i++) | ||
1098 | tiled_map->xy2ca_map[i] = luma_map << 8 | chro_map; | ||
1099 | for (i = 0; i < 4; i++) | ||
1100 | tiled_map->xy2ba_map[i] = luma_map << 8 | chro_map; | ||
1101 | for (i = 0; i < 16; i++) | ||
1102 | tiled_map->xy2ra_map[i] = luma_map << 8 | chro_map; | ||
1103 | |||
1104 | if (tiled_map_type == GDI_LINEAR_FRAME_MAP) { | ||
1105 | tiled_map->xy2rbc_config = 0; | ||
1106 | } else { | ||
1107 | dev_err(&ctx->dev->plat_dev->dev, "invalid map type: %d\n", | ||
1108 | tiled_map_type); | ||
1109 | return; | ||
1110 | } | ||
1111 | } | ||
1112 | |||
1113 | static void set_default_params(struct coda_ctx *ctx) | 1086 | static void set_default_params(struct coda_ctx *ctx) |
1114 | { | 1087 | { |
1115 | unsigned int max_w, max_h, usize, csize; | 1088 | unsigned int max_w, max_h, usize, csize; |
@@ -1148,8 +1121,11 @@ static void set_default_params(struct coda_ctx *ctx) | |||
1148 | ctx->q_data[V4L2_M2M_DST].rect.width = max_w; | 1121 | ctx->q_data[V4L2_M2M_DST].rect.width = max_w; |
1149 | ctx->q_data[V4L2_M2M_DST].rect.height = max_h; | 1122 | ctx->q_data[V4L2_M2M_DST].rect.height = max_h; |
1150 | 1123 | ||
1151 | if (ctx->dev->devtype->product == CODA_960) | 1124 | /* |
1152 | coda_set_tiled_map_type(ctx, GDI_LINEAR_FRAME_MAP); | 1125 | * Since the RBC2AXI logic only supports a single chroma plane, |
1126 | * macroblock tiling only works for to NV12 pixel format. | ||
1127 | */ | ||
1128 | ctx->tiled_map_type = GDI_LINEAR_FRAME_MAP; | ||
1153 | } | 1129 | } |
1154 | 1130 | ||
1155 | /* | 1131 | /* |
diff --git a/drivers/media/platform/coda/coda-gdi.c b/drivers/media/platform/coda/coda-gdi.c new file mode 100644 index 000000000000..aaa7afc6870f --- /dev/null +++ b/drivers/media/platform/coda/coda-gdi.c | |||
@@ -0,0 +1,150 @@ | |||
1 | /* | ||
2 | * Coda multi-standard codec IP | ||
3 | * | ||
4 | * Copyright (C) 2014 Philipp Zabel, Pengutronix | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/bitops.h> | ||
13 | #include "coda.h" | ||
14 | |||
15 | #define XY2_INVERT BIT(7) | ||
16 | #define XY2_ZERO BIT(6) | ||
17 | #define XY2_TB_XOR BIT(5) | ||
18 | #define XY2_XYSEL BIT(4) | ||
19 | #define XY2_Y (1 << 4) | ||
20 | #define XY2_X (0 << 4) | ||
21 | |||
22 | #define XY2(luma_sel, luma_bit, chroma_sel, chroma_bit) \ | ||
23 | (((XY2_##luma_sel) | (luma_bit)) << 8 | \ | ||
24 | (XY2_##chroma_sel) | (chroma_bit)) | ||
25 | |||
26 | static const u16 xy2ca_zero_map[16] = { | ||
27 | XY2(ZERO, 0, ZERO, 0), | ||
28 | XY2(ZERO, 0, ZERO, 0), | ||
29 | XY2(ZERO, 0, ZERO, 0), | ||
30 | XY2(ZERO, 0, ZERO, 0), | ||
31 | XY2(ZERO, 0, ZERO, 0), | ||
32 | XY2(ZERO, 0, ZERO, 0), | ||
33 | XY2(ZERO, 0, ZERO, 0), | ||
34 | XY2(ZERO, 0, ZERO, 0), | ||
35 | XY2(ZERO, 0, ZERO, 0), | ||
36 | XY2(ZERO, 0, ZERO, 0), | ||
37 | XY2(ZERO, 0, ZERO, 0), | ||
38 | XY2(ZERO, 0, ZERO, 0), | ||
39 | XY2(ZERO, 0, ZERO, 0), | ||
40 | XY2(ZERO, 0, ZERO, 0), | ||
41 | XY2(ZERO, 0, ZERO, 0), | ||
42 | XY2(ZERO, 0, ZERO, 0), | ||
43 | }; | ||
44 | |||
45 | static const u16 xy2ca_tiled_map[16] = { | ||
46 | XY2(Y, 0, Y, 0), | ||
47 | XY2(Y, 1, Y, 1), | ||
48 | XY2(Y, 2, Y, 2), | ||
49 | XY2(Y, 3, X, 3), | ||
50 | XY2(X, 3, ZERO, 0), | ||
51 | XY2(ZERO, 0, ZERO, 0), | ||
52 | XY2(ZERO, 0, ZERO, 0), | ||
53 | XY2(ZERO, 0, ZERO, 0), | ||
54 | XY2(ZERO, 0, ZERO, 0), | ||
55 | XY2(ZERO, 0, ZERO, 0), | ||
56 | XY2(ZERO, 0, ZERO, 0), | ||
57 | XY2(ZERO, 0, ZERO, 0), | ||
58 | XY2(ZERO, 0, ZERO, 0), | ||
59 | XY2(ZERO, 0, ZERO, 0), | ||
60 | XY2(ZERO, 0, ZERO, 0), | ||
61 | XY2(ZERO, 0, ZERO, 0), | ||
62 | }; | ||
63 | |||
64 | /* | ||
65 | * RA[15:0], CA[15:8] are hardwired to contain the 24-bit macroblock | ||
66 | * start offset (macroblock size is 16x16 for luma, 16x8 for chroma). | ||
67 | * Bits CA[4:0] are set using XY2CA above. BA[3:0] seems to be unused. | ||
68 | */ | ||
69 | |||
70 | #define RBC_CA (0 << 4) | ||
71 | #define RBC_BA (1 << 4) | ||
72 | #define RBC_RA (2 << 4) | ||
73 | #define RBC_ZERO (3 << 4) | ||
74 | |||
75 | #define RBC(luma_sel, luma_bit, chroma_sel, chroma_bit) \ | ||
76 | (((RBC_##luma_sel) | (luma_bit)) << 6 | \ | ||
77 | (RBC_##chroma_sel) | (chroma_bit)) | ||
78 | |||
79 | static const u16 rbc2axi_tiled_map[32] = { | ||
80 | RBC(ZERO, 0, ZERO, 0), | ||
81 | RBC(ZERO, 0, ZERO, 0), | ||
82 | RBC(ZERO, 0, ZERO, 0), | ||
83 | RBC(CA, 0, CA, 0), | ||
84 | RBC(CA, 1, CA, 1), | ||
85 | RBC(CA, 2, CA, 2), | ||
86 | RBC(CA, 3, CA, 3), | ||
87 | RBC(CA, 4, CA, 8), | ||
88 | RBC(CA, 8, CA, 9), | ||
89 | RBC(CA, 9, CA, 10), | ||
90 | RBC(CA, 10, CA, 11), | ||
91 | RBC(CA, 11, CA, 12), | ||
92 | RBC(CA, 12, CA, 13), | ||
93 | RBC(CA, 13, CA, 14), | ||
94 | RBC(CA, 14, CA, 15), | ||
95 | RBC(CA, 15, RA, 0), | ||
96 | RBC(RA, 0, RA, 1), | ||
97 | RBC(RA, 1, RA, 2), | ||
98 | RBC(RA, 2, RA, 3), | ||
99 | RBC(RA, 3, RA, 4), | ||
100 | RBC(RA, 4, RA, 5), | ||
101 | RBC(RA, 5, RA, 6), | ||
102 | RBC(RA, 6, RA, 7), | ||
103 | RBC(RA, 7, RA, 8), | ||
104 | RBC(RA, 8, RA, 9), | ||
105 | RBC(RA, 9, RA, 10), | ||
106 | RBC(RA, 10, RA, 11), | ||
107 | RBC(RA, 11, RA, 12), | ||
108 | RBC(RA, 12, RA, 13), | ||
109 | RBC(RA, 13, RA, 14), | ||
110 | RBC(RA, 14, RA, 15), | ||
111 | RBC(RA, 15, ZERO, 0), | ||
112 | }; | ||
113 | |||
114 | void coda_set_gdi_regs(struct coda_ctx *ctx) | ||
115 | { | ||
116 | struct coda_dev *dev = ctx->dev; | ||
117 | const u16 *xy2ca_map; | ||
118 | u32 xy2rbc_config; | ||
119 | int i; | ||
120 | |||
121 | switch (ctx->tiled_map_type) { | ||
122 | case GDI_LINEAR_FRAME_MAP: | ||
123 | default: | ||
124 | xy2ca_map = xy2ca_zero_map; | ||
125 | xy2rbc_config = 0; | ||
126 | break; | ||
127 | case GDI_TILED_FRAME_MB_RASTER_MAP: | ||
128 | xy2ca_map = xy2ca_tiled_map; | ||
129 | xy2rbc_config = CODA9_XY2RBC_TILED_MAP | | ||
130 | CODA9_XY2RBC_CA_INC_HOR | | ||
131 | (16 - 1) << 12 | (8 - 1) << 4; | ||
132 | break; | ||
133 | } | ||
134 | |||
135 | for (i = 0; i < 16; i++) | ||
136 | coda_write(dev, xy2ca_map[i], | ||
137 | CODA9_GDI_XY2_CAS_0 + 4 * i); | ||
138 | for (i = 0; i < 4; i++) | ||
139 | coda_write(dev, XY2(ZERO, 0, ZERO, 0), | ||
140 | CODA9_GDI_XY2_BA_0 + 4 * i); | ||
141 | for (i = 0; i < 16; i++) | ||
142 | coda_write(dev, XY2(ZERO, 0, ZERO, 0), | ||
143 | CODA9_GDI_XY2_RAS_0 + 4 * i); | ||
144 | coda_write(dev, xy2rbc_config, CODA9_GDI_XY2_RBC_CONFIG); | ||
145 | if (xy2rbc_config) { | ||
146 | for (i = 0; i < 32; i++) | ||
147 | coda_write(dev, rbc2axi_tiled_map[i], | ||
148 | CODA9_GDI_RBC2_AXI_0 + 4 * i); | ||
149 | } | ||
150 | } | ||
diff --git a/drivers/media/platform/coda/coda.h b/drivers/media/platform/coda/coda.h index 26c9c4bb6e4a..59b2af9c7749 100644 --- a/drivers/media/platform/coda/coda.h +++ b/drivers/media/platform/coda/coda.h | |||
@@ -167,15 +167,8 @@ struct coda_iram_info { | |||
167 | phys_addr_t next_paddr; | 167 | phys_addr_t next_paddr; |
168 | }; | 168 | }; |
169 | 169 | ||
170 | struct gdi_tiled_map { | ||
171 | int xy2ca_map[16]; | ||
172 | int xy2ba_map[16]; | ||
173 | int xy2ra_map[16]; | ||
174 | int rbc2axi_map[32]; | ||
175 | int xy2rbc_config; | ||
176 | int map_type; | ||
177 | #define GDI_LINEAR_FRAME_MAP 0 | 170 | #define GDI_LINEAR_FRAME_MAP 0 |
178 | }; | 171 | #define GDI_TILED_FRAME_MB_RASTER_MAP 1 |
179 | 172 | ||
180 | struct coda_ctx; | 173 | struct coda_ctx; |
181 | 174 | ||
@@ -236,7 +229,7 @@ struct coda_ctx { | |||
236 | int idx; | 229 | int idx; |
237 | int reg_idx; | 230 | int reg_idx; |
238 | struct coda_iram_info iram_info; | 231 | struct coda_iram_info iram_info; |
239 | struct gdi_tiled_map tiled_map; | 232 | int tiled_map_type; |
240 | u32 bit_stream_param; | 233 | u32 bit_stream_param; |
241 | u32 frm_dis_flg; | 234 | u32 frm_dis_flg; |
242 | u32 frame_mem_ctrl; | 235 | u32 frame_mem_ctrl; |
diff --git a/drivers/media/platform/coda/coda_regs.h b/drivers/media/platform/coda/coda_regs.h index 00e4f5160c1f..3490602fa6e1 100644 --- a/drivers/media/platform/coda/coda_regs.h +++ b/drivers/media/platform/coda/coda_regs.h | |||
@@ -51,6 +51,7 @@ | |||
51 | #define CODA7_STREAM_SEL_64BITS_ENDIAN (1 << 1) | 51 | #define CODA7_STREAM_SEL_64BITS_ENDIAN (1 << 1) |
52 | #define CODA_STREAM_ENDIAN_SELECT (1 << 0) | 52 | #define CODA_STREAM_ENDIAN_SELECT (1 << 0) |
53 | #define CODA_REG_BIT_FRAME_MEM_CTRL 0x110 | 53 | #define CODA_REG_BIT_FRAME_MEM_CTRL 0x110 |
54 | #define CODA9_FRAME_TILED2LINEAR (1 << 11) | ||
54 | #define CODA_FRAME_CHROMA_INTERLEAVE (1 << 2) | 55 | #define CODA_FRAME_CHROMA_INTERLEAVE (1 << 2) |
55 | #define CODA_IMAGE_ENDIAN_SELECT (1 << 0) | 56 | #define CODA_IMAGE_ENDIAN_SELECT (1 << 0) |
56 | #define CODA_REG_BIT_BIT_STREAM_PARAM 0x114 | 57 | #define CODA_REG_BIT_BIT_STREAM_PARAM 0x114 |
@@ -452,7 +453,12 @@ | |||
452 | #define CODA9_GDI_XY2_RAS_F (CODA9_GDMA_BASE + 0x88c) | 453 | #define CODA9_GDI_XY2_RAS_F (CODA9_GDMA_BASE + 0x88c) |
453 | 454 | ||
454 | #define CODA9_GDI_XY2_RBC_CONFIG (CODA9_GDMA_BASE + 0x890) | 455 | #define CODA9_GDI_XY2_RBC_CONFIG (CODA9_GDMA_BASE + 0x890) |
456 | #define CODA9_XY2RBC_SEPARATE_MAP BIT(19) | ||
457 | #define CODA9_XY2RBC_TOP_BOT_SPLIT BIT(18) | ||
458 | #define CODA9_XY2RBC_TILED_MAP BIT(17) | ||
459 | #define CODA9_XY2RBC_CA_INC_HOR BIT(16) | ||
455 | #define CODA9_GDI_RBC2_AXI_0 (CODA9_GDMA_BASE + 0x8a0) | 460 | #define CODA9_GDI_RBC2_AXI_0 (CODA9_GDMA_BASE + 0x8a0) |
456 | #define CODA9_GDI_RBC2_AXI_1F (CODA9_GDMA_BASE + 0x91c) | 461 | #define CODA9_GDI_RBC2_AXI_1F (CODA9_GDMA_BASE + 0x91c) |
462 | #define CODA9_GDI_TILEDBUF_BASE (CODA9_GDMA_BASE + 0x920) | ||
457 | 463 | ||
458 | #endif | 464 | #endif |