summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/s5p-jpeg/jpeg-core.c
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz2012-02-20 11:32:25 +0100
committerMauro Carvalho Chehab2012-03-08 11:43:51 +0100
commitfb6f8c0269644a19ee5e9bd6db080b364ab28ea7 (patch)
tree5210bf97704dc69128ddc50a2f2335c4e6fd2f31 /drivers/media/video/s5p-jpeg/jpeg-core.c
parent[media] s5p-g2d: Added locking for writing control values to registers (diff)
downloadkernel-qcow2-linux-fb6f8c0269644a19ee5e9bd6db080b364ab28ea7.tar.gz
kernel-qcow2-linux-fb6f8c0269644a19ee5e9bd6db080b364ab28ea7.tar.xz
kernel-qcow2-linux-fb6f8c0269644a19ee5e9bd6db080b364ab28ea7.zip
[media] s5p-jpeg: Adapt to new controls
Adapt to new controls (subsampling). For encoding, the destination format now needs to be set to V4L2_PIX_FMT_JPEG and the subsampling (4:2:2 or 4:2:0) needs to be set using the respective control (V4L2_CID_JPEG_CHROMA_SUBSAMPLING). Required buffer size for destination image during encoding is no longer deduced from the format (which generally implied overestimation), but needs to be given from userspace in sizeimage. Not strictly related to the added controls, this patch also fixes setting the subsampling of the destination image for decoding, depending on the destination format. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/s5p-jpeg/jpeg-core.c')
-rw-r--r--drivers/media/video/s5p-jpeg/jpeg-core.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/media/video/s5p-jpeg/jpeg-core.c b/drivers/media/video/s5p-jpeg/jpeg-core.c
index c104aeb2455d..5a49c307f9c1 100644
--- a/drivers/media/video/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/video/s5p-jpeg/jpeg-core.c
@@ -32,10 +32,9 @@
static struct s5p_jpeg_fmt formats_enc[] = {
{
- .name = "YUV 4:2:0 planar, YCbCr",
- .fourcc = V4L2_PIX_FMT_YUV420,
- .depth = 12,
- .colplanes = 3,
+ .name = "JPEG JFIF",
+ .fourcc = V4L2_PIX_FMT_JPEG,
+ .colplanes = 1,
.types = MEM2MEM_CAPTURE,
},
{
@@ -43,7 +42,7 @@ static struct s5p_jpeg_fmt formats_enc[] = {
.fourcc = V4L2_PIX_FMT_YUYV,
.depth = 16,
.colplanes = 1,
- .types = MEM2MEM_CAPTURE | MEM2MEM_OUTPUT,
+ .types = MEM2MEM_OUTPUT,
},
{
.name = "RGB565",
@@ -1025,11 +1024,14 @@ static void s5p_jpeg_device_run(void *priv)
jpeg_htbl_dc(jpeg->regs, 2);
jpeg_htbl_ac(jpeg->regs, 3);
jpeg_htbl_dc(jpeg->regs, 3);
- } else {
+ } else { /* S5P_JPEG_DECODE */
jpeg_rst_int_enable(jpeg->regs, true);
jpeg_data_num_int_enable(jpeg->regs, true);
jpeg_final_mcu_num_int_enable(jpeg->regs, true);
- jpeg_outform_raw(jpeg->regs, S5P_JPEG_RAW_OUT_422);
+ if (ctx->cap_q.fmt->fourcc == V4L2_PIX_FMT_YUYV)
+ jpeg_outform_raw(jpeg->regs, S5P_JPEG_RAW_OUT_422);
+ else
+ jpeg_outform_raw(jpeg->regs, S5P_JPEG_RAW_OUT_420);
jpeg_jpgadr(jpeg->regs, src_addr);
jpeg_imgadr(jpeg->regs, dst_addr);
}
@@ -1269,6 +1271,7 @@ static irqreturn_t s5p_jpeg_irq(int irq, void *dev_id)
curr_ctx->subsampling = jpeg_get_subsampling_mode(jpeg->regs);
spin_unlock(&jpeg->slock);
+
jpeg_clear_int(jpeg->regs);
return IRQ_HANDLED;