From patchwork Fri Jul 25 14:20:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 4623461 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 70478C0338 for ; Fri, 25 Jul 2014 14:21:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C3C722020F for ; Fri, 25 Jul 2014 14:21:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8DABC2020A for ; Fri, 25 Jul 2014 14:21:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932489AbaGYOVg (ORCPT ); Fri, 25 Jul 2014 10:21:36 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:61205 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932241AbaGYOVf (ORCPT ); Fri, 25 Jul 2014 10:21:35 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9900GSRUJY9M80@mailout2.samsung.com>; Fri, 25 Jul 2014 23:21:34 +0900 (KST) X-AuditID: cbfee61b-f79f86d00000144c-fd-53d267eee8f3 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id E9.8F.05196.EE762D35; Fri, 25 Jul 2014 23:21:34 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N99004WBUIW3L00@mmp2.samsung.com>; Fri, 25 Jul 2014 23:21:34 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org, j.anaszewski@samsung.com, Sylwester Nawrocki Subject: [PATCH v3 8/9] s5p-jpeg: add chroma subsampling adjustment for Exynos3250 Date: Fri, 25 Jul 2014 16:20:52 +0200 Message-id: <1406298053-30184-9-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1406298053-30184-1-git-send-email-s.nawrocki@samsung.com> References: <1406298053-30184-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMJMWRmVeSWpSXmKPExsVy+t9jQd136ZeCDSb8Fbbovfqc0aJnw1ZW ixnn9zFZHH7TzurA4tG3ZRWjx+dNcgFMUVw2Kak5mWWpRfp2CVwZvw6+ZylYJlax68tRlgbG OUJdjBwcEgImEnMfVXcxcgKZYhIX7q1n62Lk4hASmM4o8WtFKyOE08Ek0dd6igmkik3AUKL3 aB8jiC0iIC/xpPcGG4jNLJAn8fXTc7AaYYEQiZYzE5lBbBYBVYn1vS/B4rwCbhLL9t5lh1is IDFnkg2IySngLnFomhVIhRBQxeqlb5kmMPIuYGRYxSiaWpBcUJyUnmukV5yYW1yal66XnJ+7 iREcFM+kdzCuarA4xCjAwajEw9tRfzFYiDWxrLgy9xCjBAezkgivUfylYCHelMTKqtSi/Pii 0pzU4kOM0hwsSuK8B1utA4UE0hNLUrNTUwtSi2CyTBycUg2MmSfZzS0r2zhtRV8Y+/j8/7nS 72esqG6d3WrleWoT5160+5BubTHxhLVI1h+Ho5snMTGt+H+vYbaF/0ldF9Mv0qJuM/c1JFl2 HjTV7/w+b7VveMxi53si1sZyjnvvKzr8fD3ztdC7ST+sN4rKvH2dl8pSdPeaYJjPcsYV12P2 uCXH9BSHG/MrsRRnJBpqMRcVJwIA5CuhjgYCAAA= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jacek Anaszewski Take into account limitations specific to the Exynos3250 SoC, regarding setting the chroma subsampling control's value. Signed-off-by: Jacek Anaszewski Signed-off-by: Sylwester Nawrocki --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 59 +++++++++++++++++---------- 1 file changed, 38 insertions(+), 21 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index eb13fdf..e66acbc 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -1603,36 +1603,53 @@ static int s5p_jpeg_g_volatile_ctrl(struct v4l2_ctrl *ctrl) return 0; } -static int s5p_jpeg_try_ctrl(struct v4l2_ctrl *ctrl) +static int s5p_jpeg_adjust_subs_ctrl(struct s5p_jpeg_ctx *ctx, int *ctrl_val) { - struct s5p_jpeg_ctx *ctx = ctrl_to_ctx(ctrl); - unsigned long flags; - int ret = 0; - - spin_lock_irqsave(&ctx->jpeg->slock, flags); - - if (ctrl->id == V4L2_CID_JPEG_CHROMA_SUBSAMPLING) { - if (ctx->jpeg->variant->version == SJPEG_S5P) - goto error_free; + switch (ctx->jpeg->variant->version) { + case SJPEG_S5P: + return 0; + case SJPEG_EXYNOS3250: + /* + * The exynos3250 device can produce JPEG image only + * of 4:4:4 subsampling when given RGB32 source image. + */ + if (ctx->out_q.fmt->fourcc == V4L2_PIX_FMT_RGB32) + *ctrl_val = 0; + break; + case SJPEG_EXYNOS4: /* * The exynos4x12 device requires input raw image fourcc * to be V4L2_PIX_FMT_GREY if gray jpeg format * is to be set. */ if (ctx->out_q.fmt->fourcc != V4L2_PIX_FMT_GREY && - ctrl->val == V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY) { - ret = -EINVAL; - goto error_free; - } - /* - * The exynos4x12 device requires resulting jpeg subsampling - * not to be lower than the input raw image subsampling. - */ - if (ctx->out_q.fmt->subsampling > ctrl->val) - ctrl->val = ctx->out_q.fmt->subsampling; + *ctrl_val == V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY) + return -EINVAL; + break; } -error_free: + /* + * The exynos4x12 and exynos3250 devices require resulting + * jpeg subsampling not to be lower than the input raw image + * subsampling. + */ + if (ctx->out_q.fmt->subsampling > *ctrl_val) + *ctrl_val = ctx->out_q.fmt->subsampling; + + return 0; +} + +static int s5p_jpeg_try_ctrl(struct v4l2_ctrl *ctrl) +{ + struct s5p_jpeg_ctx *ctx = ctrl_to_ctx(ctrl); + unsigned long flags; + int ret = 0; + + spin_lock_irqsave(&ctx->jpeg->slock, flags); + + if (ctrl->id == V4L2_CID_JPEG_CHROMA_SUBSAMPLING) + ret = s5p_jpeg_adjust_subs_ctrl(ctx, &ctrl->val); + spin_unlock_irqrestore(&ctx->jpeg->slock, flags); return ret; }