Commit 2bf299cd authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab

[media] coda: simplify frame memory control register handling

Since the firmware newer writes to FRAME_MEM_CTRL, we can initialize it once
per context (incidentally, we already do write it in coda_hw_init) and never
have to read it back.
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarKamil Debski <k.debski@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 59ebc2e4
...@@ -729,10 +729,7 @@ static int coda_start_encoding(struct coda_ctx *ctx) ...@@ -729,10 +729,7 @@ static int coda_start_encoding(struct coda_ctx *ctx)
break; break;
} }
value = coda_read(dev, CODA_REG_BIT_FRAME_MEM_CTRL); coda_write(dev, ctx->frame_mem_ctrl, CODA_REG_BIT_FRAME_MEM_CTRL);
value &= ~(1 << 2 | 0x7 << 9);
ctx->frame_mem_ctrl = value;
coda_write(dev, value, CODA_REG_BIT_FRAME_MEM_CTRL);
if (dev->devtype->product == CODA_DX6) { if (dev->devtype->product == CODA_DX6) {
/* Configure the coda */ /* Configure the coda */
...@@ -741,6 +738,7 @@ static int coda_start_encoding(struct coda_ctx *ctx) ...@@ -741,6 +738,7 @@ static int coda_start_encoding(struct coda_ctx *ctx)
} }
/* Could set rotation here if needed */ /* Could set rotation here if needed */
value = 0;
switch (dev->devtype->product) { switch (dev->devtype->product) {
case CODA_DX6: case CODA_DX6:
value = (q_data_src->width & CODADX6_PICWIDTH_MASK) value = (q_data_src->width & CODADX6_PICWIDTH_MASK)
...@@ -1296,6 +1294,8 @@ static int __coda_start_decoding(struct coda_ctx *ctx) ...@@ -1296,6 +1294,8 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
/* Update coda bitstream read and write pointers from kfifo */ /* Update coda bitstream read and write pointers from kfifo */
coda_kfifo_sync_to_device_full(ctx); coda_kfifo_sync_to_device_full(ctx);
coda_write(dev, ctx->frame_mem_ctrl, CODA_REG_BIT_FRAME_MEM_CTRL);
ctx->display_idx = -1; ctx->display_idx = -1;
ctx->frm_dis_flg = 0; ctx->frm_dis_flg = 0;
coda_write(dev, 0, CODA_REG_BIT_FRM_DIS_FLG(ctx->reg_idx)); coda_write(dev, 0, CODA_REG_BIT_FRM_DIS_FLG(ctx->reg_idx));
......
...@@ -1423,8 +1423,10 @@ static int coda_open(struct file *file, enum coda_inst_type inst_type, ...@@ -1423,8 +1423,10 @@ static int coda_open(struct file *file, enum coda_inst_type inst_type,
ctx->dev = dev; ctx->dev = dev;
ctx->idx = idx; ctx->idx = idx;
switch (dev->devtype->product) { switch (dev->devtype->product) {
case CODA_7541:
case CODA_960: case CODA_960:
ctx->frame_mem_ctrl = 1 << 12;
/* fallthrough */
case CODA_7541:
ctx->reg_idx = 0; ctx->reg_idx = 0;
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment