From patchwork Tue Nov 3 05:45:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Wu X-Patchwork-Id: 7539811 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7F748BF90C for ; Tue, 3 Nov 2015 05:48:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3B73207C5 for ; Tue, 3 Nov 2015 05:48:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0540207C9 for ; Tue, 3 Nov 2015 05:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752042AbbKCFkZ (ORCPT ); Tue, 3 Nov 2015 00:40:25 -0500 Received: from nasmtp01.atmel.com ([192.199.1.246]:43109 "EHLO DVREDG02.corp.atmel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751512AbbKCFkY (ORCPT ); Tue, 3 Nov 2015 00:40:24 -0500 Received: from apsmtp01.atmel.com (10.168.254.30) by DVREDG02.corp.atmel.com (10.42.103.31) with Microsoft SMTP Server (TLS) id 14.3.235.1; Mon, 2 Nov 2015 22:40:21 -0700 Received: from melon.corp.atmel.com (10.168.254.13) by apsmtp01.corp.atmel.com (10.168.254.30) with Microsoft SMTP Server id 14.3.235.1; Tue, 3 Nov 2015 13:39:41 +0800 From: Josh Wu To: Linux Media Mailing List , , Guennadi Liakhovetski CC: Laurent Pinchart , Josh Wu , Mauro Carvalho Chehab , Subject: [PATCH v2 4/5] media: atmel-isi: setup YCC_SWAP correctly when using preview path Date: Tue, 3 Nov 2015 13:45:11 +0800 Message-ID: <1446529512-19109-5-git-send-email-josh.wu@atmel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446529512-19109-1-git-send-email-josh.wu@atmel.com> References: <1446529512-19109-1-git-send-email-josh.wu@atmel.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 The preview path only can convert UYVY format to RGB data. To make preview path work correctly, we need to set up YCC_SWAP according to sensor output and convert them to UYVY. Signed-off-by: Josh Wu --- Changes in v2: - remove cfg2_yuv_swap for rgb format - correct the comment style drivers/media/platform/soc_camera/atmel-isi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index ae82068..826d04e 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -117,6 +117,20 @@ static u32 setup_cfg2_yuv_swap(struct atmel_isi *isi, case MEDIA_BUS_FMT_YVYU8_2X8: return ISI_CFG2_YCC_SWAP_MODE_1; } + } else if (xlate->host_fmt->fourcc == V4L2_PIX_FMT_RGB565) { + /* + * Preview path is enabled, it will convert UYVY to RGB format. + * But if sensor output format is not UYVY, we need to set + * YCC_SWAP_MODE to convert it as UYVY. + */ + switch (xlate->code) { + case MEDIA_BUS_FMT_VYUY8_2X8: + return ISI_CFG2_YCC_SWAP_MODE_1; + case MEDIA_BUS_FMT_YUYV8_2X8: + return ISI_CFG2_YCC_SWAP_MODE_2; + case MEDIA_BUS_FMT_YVYU8_2X8: + return ISI_CFG2_YCC_SWAP_MODE_3; + } } /*