summaryrefslogtreecommitdiff
path: root/drivers/media/platform/s5p-jpeg/jpeg-core.c
diff options
context:
space:
mode:
authorJacek Anaszewski <j.anaszewski@samsung.com>2013-12-18 11:14:00 -0300
committerChanho Park <chanho61.park@samsung.com>2014-11-18 12:01:11 +0900
commit63dc6e6c2b41d38ede684441310a71f03ca92086 (patch)
tree7145fd3b6f75fb3c667d45c0e3b7ef9435e23ab0 /drivers/media/platform/s5p-jpeg/jpeg-core.c
parentf8bc9fdc5e8afaf23450304f8578343f03c23e5c (diff)
downloadlinux-3.10-63dc6e6c2b41d38ede684441310a71f03ca92086.tar.gz
linux-3.10-63dc6e6c2b41d38ede684441310a71f03ca92086.tar.bz2
linux-3.10-63dc6e6c2b41d38ede684441310a71f03ca92086.zip
[media] s5p-jpeg: Adjust g_volatile_ctrl callback to Exynos4x12 needs
Whereas S5PC210 device produces decoded JPEG subsampling values that map on V4L2_JPEG_CHROMA_SUBSAMPLNG values, the Exynos4x12 device doesn't. This patch adds helper function s5p_jpeg_to_user_subsampling, which performs suitable translation. Change-Id: Ide93376b0fd413cb769a562ebe727ee706391dff Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform/s5p-jpeg/jpeg-core.c')
-rw-r--r--drivers/media/platform/s5p-jpeg/jpeg-core.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 6d90195f70d..6accecdb822 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -451,6 +451,13 @@ static int s5p_jpeg_adjust_fourcc_to_subsampling(
return 0;
}
+static int exynos4x12_decoded_subsampling[] = {
+ V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY,
+ V4L2_JPEG_CHROMA_SUBSAMPLING_444,
+ V4L2_JPEG_CHROMA_SUBSAMPLING_422,
+ V4L2_JPEG_CHROMA_SUBSAMPLING_420,
+};
+
static inline struct s5p_jpeg_ctx *ctrl_to_ctx(struct v4l2_ctrl *c)
{
return container_of(c->handler, struct s5p_jpeg_ctx, ctrl_handler);
@@ -461,6 +468,21 @@ static inline struct s5p_jpeg_ctx *fh_to_ctx(struct v4l2_fh *fh)
return container_of(fh, struct s5p_jpeg_ctx, fh);
}
+static int s5p_jpeg_to_user_subsampling(struct s5p_jpeg_ctx *ctx)
+{
+ WARN_ON(ctx->subsampling > 3);
+
+ if (ctx->jpeg->variant->version == SJPEG_S5P) {
+ if (ctx->subsampling > 2)
+ return V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY;
+ return ctx->subsampling;
+ } else {
+ if (ctx->subsampling > 2)
+ return V4L2_JPEG_CHROMA_SUBSAMPLING_420;
+ return exynos4x12_decoded_subsampling[ctx->subsampling];
+ }
+}
+
static inline void s5p_jpeg_set_qtbl(void __iomem *regs,
const unsigned char *qtbl,
unsigned long tab, int len)
@@ -1200,12 +1222,7 @@ static int s5p_jpeg_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
switch (ctrl->id) {
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
spin_lock_irqsave(&jpeg->slock, flags);
-
- WARN_ON(ctx->subsampling > S5P_SUBSAMPLING_MODE_GRAY);
- if (ctx->subsampling > 2)
- ctrl->val = V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY;
- else
- ctrl->val = ctx->subsampling;
+ ctrl->val = s5p_jpeg_to_user_subsampling(ctx);
spin_unlock_irqrestore(&jpeg->slock, flags);
break;
}