From patchwork Tue Nov 19 14:27:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 3202571 Return-Path: X-Original-To: patchwork-linux-media@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 14B3AC045B for ; Tue, 19 Nov 2013 14:28:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E2CB720121 for ; Tue, 19 Nov 2013 14:28:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 38F6920306 for ; Tue, 19 Nov 2013 14:28:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752801Ab3KSO2S (ORCPT ); Tue, 19 Nov 2013 09:28:18 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:55643 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752847Ab3KSO2P (ORCPT ); Tue, 19 Nov 2013 09:28:15 -0500 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MWI00CHXLJ0NL90@mailout3.samsung.com> for linux-media@vger.kernel.org; Tue, 19 Nov 2013 23:28:14 +0900 (KST) X-AuditID: cbfee61b-b7fd56d000001fc6-8c-528b757e7225 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id B6.56.08134.E757B825; Tue, 19 Nov 2013 23:28:14 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MWI00IBKLHFEGB0@mmp1.samsung.com>; Tue, 19 Nov 2013 23:28:14 +0900 (KST) From: Jacek Anaszewski To: linux-media@vger.kernel.org Cc: kyungmin.park@samsung.com, s.nawrocki@samsung.com, sw0312.kim@samsung.com, Jacek Anaszewski Subject: [PATCH 16/16] s5p-jpeg: Adjust g_volatile_ctrl callback to Exynos4x12 needs Date: Tue, 19 Nov 2013 15:27:08 +0100 Message-id: <1384871228-6648-17-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1384871228-6648-1-git-send-email-j.anaszewski@samsung.com> References: <1384871228-6648-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFJMWRmVeSWpSXmKPExsVy+t9jAd260u4gg867Jha9V58zWpxtesNu 0bNhK6vF4TftrBYzJr9kc2D16NuyitHj8ya5AKYoLpuU1JzMstQifbsErowVD18zF1wXrtg7 4w1rA+MhgS5GTg4JAROJpxevs0DYYhIX7q1n62Lk4hASWMQoMb3tKAuE084k8ePEJiaQKjYB Q4mfL16D2SIC8hJPem+wgdjMAjUSU7beYAexhQXCJBqaTrGC2CwCqhLHb08Cq+EV8JC4+P4f UA0H0DYFiTmTbEDCnEDhKQu3g7UKCbhLnN94kn0CI+8CRoZVjKKpBckFxUnpuUZ6xYm5xaV5 6XrJ+bmbGMEh8kx6B+OqBotDjAIcjEo8vBPcu4KEWBPLiitzDzFKcDArifA25ncHCfGmJFZW pRblxxeV5qQWH2KU5mBREuc92GodKCSQnliSmp2aWpBaBJNl4uCUamDUs6n6E/juQ0qc0c+P 7NPi5l38aBLT8kNjd8MRfpWmiBrNvXEMKoGlL9pfvxNN2Lzwz9RXJ1R/Blad8xWq8l47+2Cd X0y4pMXUGzZyCoyy4srGHnFLvFdJt35hF3ZJ38bemajt+lqy0dXh5ZMdL0zDlmYunzb7/xap C3vnHbKQ8rgvcG5DyD0lluKMREMt5qLiRAAzQtQSDQIAAA== 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 decoded_subsampling_to_v4l2, which performs HW -> V4L2 translation. Signed-off-by: Jacek Anaszewski Signed-off-by: Kyungmin Park --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 36 ++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 3605470..90d2f69 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -358,6 +358,13 @@ static const unsigned char hactblg0[162] = { 0xf9, 0xfa }; +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); @@ -368,6 +375,28 @@ static inline struct s5p_jpeg_ctx *fh_to_ctx(struct v4l2_fh *fh) return container_of(fh, struct s5p_jpeg_ctx, fh); } +static inline int decoded_subsampling_to_v4l2(struct s5p_jpeg_ctx *ctx) +{ + int subsampling; + + WARN_ON(ctx->subsampling > 3); + + if (ctx->jpeg->variant->version == SJPEG_S5P) { + if (ctx->subsampling > 2) + subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY; + else + subsampling = ctx->subsampling; + } else { + if (ctx->subsampling > 2) + subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_420; + else + subsampling = + exynos4x12_decoded_subsampling[ctx->subsampling]; + } + + return subsampling; +} + static inline void s5p_jpeg_set_qtbl(void __iomem *regs, const unsigned char *qtbl, unsigned long tab, int len) @@ -1159,12 +1188,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 = decoded_subsampling_to_v4l2(ctx); spin_unlock_irqrestore(&jpeg->slock, flags); break; }