From patchwork Wed Dec 18 14:49:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 3370461 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9A2949F32E for ; Wed, 18 Dec 2013 14:50:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B3F6205DC for ; Wed, 18 Dec 2013 14:50:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BBDCC205E8 for ; Wed, 18 Dec 2013 14:50:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755061Ab3LROuP (ORCPT ); Wed, 18 Dec 2013 09:50:15 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:45818 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755051Ab3LROuN (ORCPT ); Wed, 18 Dec 2013 09:50:13 -0500 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MY0001SCBVONY70@mailout3.samsung.com> for linux-media@vger.kernel.org; Wed, 18 Dec 2013 23:50:12 +0900 (KST) X-AuditID: cbfee61a-b7f7e6d000005936-22-52b1b624764d Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id AF.15.22838.426B1B25; Wed, 18 Dec 2013 23:50:12 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MY0003L3BUWKB40@mmp2.samsung.com>; Wed, 18 Dec 2013 23:50:12 +0900 (KST) From: Jacek Anaszewski To: linux-media@vger.kernel.org Cc: kyungmin.park@samsung.com, s.nawrocki@samsung.com, Jacek Anaszewski Subject: [PATCH v3 8/8] s5p-jpeg: Adjust g_volatile_ctrl callback to Exynos4x12 needs Date: Wed, 18 Dec 2013 15:49:35 +0100 Message-id: <1387378175-23399-9-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1387378175-23399-1-git-send-email-j.anaszewski@samsung.com> References: <1387378175-23399-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrCJMWRmVeSWpSXmKPExsVy+t9jQV2VbRuDDJb2ylr0Xn3OaHG26Q27 Rc+GrawWh9+0szqwePRtWcXo8XmTXABTFJdNSmpOZllqkb5dAlfGrK41jAWvhCr+bpzD2MD4 j7+LkZNDQsBE4s+ZHlYIW0ziwr31bF2MXBxCAtMZJQ7u/88E4bQzSfz/NZsdpIpNwFDi54vX TCC2iIC8xJPeG2wgNrNAisTVH0/BbGGBcImeGZMYQWwWAVWJWUe/ANkcHLwCHhKLfniBmBIC ChJzJtmAVHAKeEq8/zsFrFoIqOLvuw2MExh5FzAyrGIUTS1ILihOSs811CtOzC0uzUvXS87P 3cQIDotnUjsYVzZYHGIU4GBU4uH18NoYJMSaWFZcmXuIUYKDWUmEV2grUIg3JbGyKrUoP76o NCe1+BCjNAeLkjjvgVbrQCGB9MSS1OzU1ILUIpgsEwenVAOj58V6y5lXN1Qu5NY9Uy7zepVv wFRX/Qlp9u8+tX1ufB7X29HQdtAuJ8Zgi77nhmxGZpsJHRPfZlyraw66WvGr6Mqm66t+lukp JFV/UfQ4KWB+56SO2XftN718m62ijbQz5rXGb5gn+kC4kv9L1dtrjzOexfj5+F55lK8y/byi 5YNl3X7PepiVWIozEg21mIuKEwGSUm5BBwIAAA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.4 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 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. Signed-off-by: Jacek Anaszewski Signed-off-by: Kyungmin Park --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 29 +++++++++++++++++++++------ 1 file 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 c46c9af..a009bd9 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; }