aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhoony.yu <hoony.yu@samsung.com>2010-09-16 06:56:39 +0900
committerArve Hjønnevåg <arve@android.com>2011-11-17 17:46:03 -0800
commitf05d6ffca2473400a1f3397a7a1769fc0c6102c7 (patch)
tree1775dec158494b20e6c1c32c42609d6228ace4ce
parent029cae7aae3cdb2566df49de1b9df9dd04733877 (diff)
downloadkernel_samsung_crespo-f05d6ffca2473400a1f3397a7a1769fc0c6102c7.zip
kernel_samsung_crespo-f05d6ffca2473400a1f3397a7a1769fc0c6102c7.tar.gz
kernel_samsung_crespo-f05d6ffca2473400a1f3397a7a1769fc0c6102c7.tar.bz2
S5PC11X: FIMC: Update fimc driver.
- change number of buffers to 3 from 2 for video quality. - change number of context to 1 from 2 for stability. - bug patch : request buffer bug in case of MMAP option. register setting bug overlay first frame bug Change-Id: Ia9fed6fa170dfa038317e4759f91434aa57b7fdc Signed-off-by: hoony.yu <hoony.yu@samsung.com>
-rw-r--r--drivers/media/video/samsung/fimc/fimc.h8
-rw-r--r--drivers/media/video/samsung/fimc/fimc_dev.c6
-rw-r--r--drivers/media/video/samsung/fimc/fimc_output.c43
-rw-r--r--drivers/media/video/samsung/fimc/fimc_regs.c4
4 files changed, 24 insertions, 37 deletions
diff --git a/drivers/media/video/samsung/fimc/fimc.h b/drivers/media/video/samsung/fimc/fimc.h
index fa8f2fe..ab641f3 100644
--- a/drivers/media/video/samsung/fimc/fimc.h
+++ b/drivers/media/video/samsung/fimc/fimc.h
@@ -35,9 +35,9 @@
#define FIMC_SUBDEVS 3
#define FIMC_MAXCAMS 5 /* added 1 because of WriteBack */
#define FIMC_PHYBUFS 4
-#define FIMC_OUTBUFS 2
+#define FIMC_OUTBUFS 3
#define FIMC_INQUEUES 10
-#define FIMC_MAX_CTXS 2
+#define FIMC_MAX_CTXS 1
#define FIMC_TPID 3
#define FIMC_CAPBUFS 16
#define FIMC_ONESHOT_TIMEOUT 200
@@ -58,6 +58,9 @@
#define FIMC_FHD_WIDTH 1920
#define FIMC_FHD_HEIGHT 1080
+#define FIMC_MMAP_IDX -1
+#define FIMC_USERPTR_IDX -2
+
#define FIMC_HCLK 0
#define FIMC_SCLK 1
#if defined(CONFIG_VIDEO_FIMC_FIFO)
@@ -272,6 +275,7 @@ enum s3cfb_mem_owner_t {
DMA_MEM_FIMD = 1,
DMA_MEM_OTHER = 2,
};
+
#define S3CFB_WIN_OFF_ALL _IO('F', 202)
#define S3CFB_WIN_POSITION _IOW('F', 203, struct s3cfb_user_window)
#define S3CFB_GET_LCD_WIDTH _IOR('F', 302, int)
diff --git a/drivers/media/video/samsung/fimc/fimc_dev.c b/drivers/media/video/samsung/fimc/fimc_dev.c
index 1cef449..cc7adb4 100644
--- a/drivers/media/video/samsung/fimc/fimc_dev.c
+++ b/drivers/media/video/samsung/fimc/fimc_dev.c
@@ -519,7 +519,7 @@ static void fimc_mmap_open(struct vm_area_struct *vma)
{
struct fimc_global *dev = fimc_dev;
int pri_data = (int)vma->vm_private_data;
- u32 id = pri_data / 0x10;
+ u32 id = pri_data / 0x100;
u32 ctx = (pri_data - (id * 0x100)) / 0x10;
u32 idx = pri_data % 0x10;
@@ -620,11 +620,11 @@ static inline int fimc_mmap_out(struct file *filp, struct vm_area_struct *vma)
struct fimc_control *ctrl = prv_data->ctrl;
int ctx_id = prv_data->ctx_id;
int idx = ctrl->out->ctx[ctx_id].overlay.req_idx;
- int ret = 0;
+ int ret = -1;
if (idx >= 0)
ret = fimc_mmap_out_dst(filp, vma, idx);
- else
+ else if (idx == FIMC_MMAP_IDX)
ret = fimc_mmap_out_src(filp, vma);
return ret;
diff --git a/drivers/media/video/samsung/fimc/fimc_output.c b/drivers/media/video/samsung/fimc/fimc_output.c
index 9611ced..426a82a 100644
--- a/drivers/media/video/samsung/fimc/fimc_output.c
+++ b/drivers/media/video/samsung/fimc/fimc_output.c
@@ -191,25 +191,21 @@ int fimc_outdev_stop_streaming(struct fimc_control *ctrl, struct fimc_ctx *ctx)
ctx->status = FIMC_STREAMOFF;
else
ctx->status = FIMC_READY_OFF;
-
- fimc_outdev_stop_dma(ctrl, ctx);
break;
case FIMC_OVLY_NONE_SINGLE_BUF: /* fall through */
case FIMC_OVLY_NONE_MULTI_BUF:
+ if (ctx->status == FIMC_STREAMON_IDLE)
+ ctx->status = FIMC_STREAMOFF;
+ else
+ ctx->status = FIMC_READY_OFF;
ret = wait_event_timeout(ctrl->wq,
- (ctx->status == FIMC_STREAMOFF || ctx->status == FIMC_STREAMON_IDLE),
- FIMC_ONESHOT_TIMEOUT);
+ (ctx->status == FIMC_STREAMOFF),
+ FIMC_ONESHOT_TIMEOUT);
if (ret == 0) {
fimc_dump_context(ctrl, ctx);
fimc_err("fail %s: %d\n", __func__, ctx->ctx_num);
}
- if (ctx->status == FIMC_STREAMON_IDLE)
- ctx->status = FIMC_STREAMOFF;
- else
- ctx->status = FIMC_READY_OFF;
-
-
break;
default:
break;
@@ -291,13 +287,6 @@ int fimc_outdev_resume_dma(struct fimc_control *ctrl, struct fimc_ctx *ctx)
return -EINVAL;
}
- ret = s3cfb_direct_ioctl(ctrl->id, S3CFB_SET_WIN_ON,
- (unsigned long)NULL);
- if (ret < 0) {
- fimc_err("direct_ioctl(S3CFB_SET_WIN_ON) fail\n");
- return -EINVAL;
- }
-
ctrl->fb.is_enable = 1;
return 0;
@@ -1447,7 +1436,7 @@ int fimc_start_fifo(struct fimc_control *ctrl, struct fimc_ctx *ctx)
ret = s3cfb_direct_ioctl(id,
S3CFB_SET_WIN_PATH, DATA_PATH_IPC);
if (ret < 0) {
- fimc_err("direct_ioctl(S3CFB_SET_WIN_MEM) fail\n");
+ fimc_err("direct_ioctl(S3CFB_SET_WIN_PATH) fail\n");
return -EINVAL;
}
@@ -1584,8 +1573,12 @@ int fimc_reqbufs_output(void *fh, struct v4l2_requestbuffers *b)
/* initialize source buffers */
if (b->memory == V4L2_MEMORY_MMAP) {
ret = fimc_outdev_set_src_buf(ctrl, ctx);
+ ctx->overlay.req_idx = FIMC_MMAP_IDX;
if (ret)
return ret;
+ } else if (b->memory == V4L2_MEMORY_USERPTR) {
+ if (mode == FIMC_OVLY_DMA_AUTO)
+ ctx->overlay.req_idx = FIMC_USERPTR_IDX;
}
ctx->is_requested = 1;
}
@@ -1610,7 +1603,7 @@ int fimc_querybuf_output(void *fh, struct v4l2_buffer *b)
return -EBUSY;
}
- if (b->index > ctx->buf_num) {
+ if (b->index >= ctx->buf_num) {
fimc_err("The index is out of bounds. You requested %d buffers."
"But requested index is %d\n", ctx->buf_num, b->index);
return -EINVAL;
@@ -2381,7 +2374,7 @@ int fimc_qbuf_output(void *fh, struct v4l2_buffer *b)
ctx = &ctrl->out->ctx[ctx_id];
fimc_info2("ctx(%d) queued idx = %d\n", ctx->ctx_num, b->index);
- if (b->index > ctx->buf_num) {
+ if (b->index >= ctx->buf_num) {
fimc_err("The index is out of bounds. "
"You requested %d buffers. "
"But you set the index as %d\n",
@@ -2532,16 +2525,6 @@ int fimc_g_fmt_vid_out(struct file *filp, void *fh, struct v4l2_format *f)
ctrl->out->idxs.active.idx = -1;
ctrl->out->idxs.next.ctx = -1;
ctrl->out->idxs.next.idx = -1;
- } else {
- ctx = &ctrl->out->ctx[ctx_id];
- ctx->ctx_num = ctx_id;
- ctx->overlay.mode = FIMC_OVLY_NOT_FIXED;
- ctx->status = FIMC_STREAMOFF;
-
- for (j = 0; j < FIMC_OUTBUFS; j++) {
- ctx->inq[j] = -1;
- ctx->outq[j] = -1;
- }
}
f->fmt.pix = ctrl->out->ctx[ctx_id].pix;
diff --git a/drivers/media/video/samsung/fimc/fimc_regs.c b/drivers/media/video/samsung/fimc/fimc_regs.c
index 828475e..de4776b 100644
--- a/drivers/media/video/samsung/fimc/fimc_regs.c
+++ b/drivers/media/video/samsung/fimc/fimc_regs.c
@@ -837,7 +837,7 @@ int fimc43_hwset_scaler(struct fimc_control *ctrl, struct fimc_scaler *sc)
cfg_ext &= ~S3C_CIEXTEN_MAINHORRATIO_EXT_MASK;
cfg_ext &= ~S3C_CIEXTEN_MAINVERRATIO_EXT_MASK;
- cfg_ext |= S3C_CIEXTEN_MAINHORRATIO_EXT(sc->main_vratio);
+ cfg_ext |= S3C_CIEXTEN_MAINHORRATIO_EXT(sc->main_hratio);
cfg_ext |= S3C_CIEXTEN_MAINVERRATIO_EXT(sc->main_vratio);
writel(cfg_ext, ctrl->regs + S3C_CIEXTEN);
@@ -878,7 +878,7 @@ int fimc50_hwset_scaler(struct fimc_control *ctrl, struct fimc_scaler *sc)
cfg_ext &= ~S3C_CIEXTEN_MAINHORRATIO_EXT_MASK;
cfg_ext &= ~S3C_CIEXTEN_MAINVERRATIO_EXT_MASK;
- cfg_ext |= S3C_CIEXTEN_MAINHORRATIO_EXT(sc->main_vratio);
+ cfg_ext |= S3C_CIEXTEN_MAINHORRATIO_EXT(sc->main_hratio);
cfg_ext |= S3C_CIEXTEN_MAINVERRATIO_EXT(sc->main_vratio);
writel(cfg_ext, ctrl->regs + S3C_CIEXTEN);