From patchwork Sun Jan 24 16:13:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Kaneko X-Patchwork-Id: 8100751 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@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 ECC38BEEE5 for ; Sun, 24 Jan 2016 16:13:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 011B020395 for ; Sun, 24 Jan 2016 16:13:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 049E520389 for ; Sun, 24 Jan 2016 16:13:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754208AbcAXQNl (ORCPT ); Sun, 24 Jan 2016 11:13:41 -0500 Received: from mail-pa0-f66.google.com ([209.85.220.66]:36310 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752592AbcAXQNk (ORCPT ); Sun, 24 Jan 2016 11:13:40 -0500 Received: by mail-pa0-f66.google.com with SMTP id a20so5505627pag.3; Sun, 24 Jan 2016 08:13:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=SkgBEdNNm8tTvZ4oqiFe6xT8fd17WuBFkRLzMz7py4E=; b=irVk5aJZHjTFJv+WJDVBQ2tigNS83HWpn2yjV6djUcIB0acOyHV8OzymVmt3cEaroL OrQ3GF/D/HR4bLAKZCXCM/O5X0JB6W9I3Ngl48eijPxe05Q4B/A4trgZhEj+1BkBx0ha M2JPlLCfDIr3LGJNClSGmltDMqJRMfTj23eTzdTX1vt3FUn7whym1AB03FZ7S3ExIHbB yrNGxf3fA9lUeFoMo7Hw1OqYQnRk82f4diNTShMs25AZkFRhYl5e2m9D5Da/L8+IL2GV QHpunNA/3ybOrH4vPlNjhq3tEys6AUb/3MvW011rFA7ETi59vJCiO+mLt/UbtdceozSZ FWZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=SkgBEdNNm8tTvZ4oqiFe6xT8fd17WuBFkRLzMz7py4E=; b=K/7wyRhIpJw9IfN7GyA8G2vuQiMTO/apl+tbUW99brhT8RtRm+Oy4rUIYPFydO4RzL bBuwj/Lge8DmesIKGJgWUs5BaP12qwMMZ9E6tRtPo1M0lJg40UNth/ROkk286POwzSLt QUYU4r5JvO/kZXCDol6fFSY/WT9q1qCmC3pBvZ0ETKsk36s/XkvUHjVgLlQE9uWl5dk8 kX8lD7biTfbrqtbonc1XLkJvRHRtfW2mmgenEKkhpJwju7TqoV3owziSX8G6f2fAbuwD T8RESt/tDRZMpAjLVDpk7gk4k7kZsgsAdog19AK95nOfhtpB3hqDkJfOVLC0mRke05e/ mLaA== X-Gm-Message-State: AG10YOR2+rV8reo9ZvOlEtxh82xm1XXYd4dXfeWLSU45O7BaX+NxPgClps2szRuO6i67Rg== X-Received: by 10.66.252.198 with SMTP id zu6mr19697930pac.107.1453652020314; Sun, 24 Jan 2016 08:13:40 -0800 (PST) Received: from localhost.localdomain (KD118152108246.ppp-bb.dion.ne.jp. [118.152.108.246]) by smtp.gmail.com with ESMTPSA id o81sm22529152pfi.92.2016.01.24.08.13.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 24 Jan 2016 08:13:39 -0800 (PST) From: Yoshihiro Kaneko To: linux-media@vger.kernel.org Cc: Guennadi Liakhovetski , Simon Horman , Magnus Damm , linux-sh@vger.kernel.org Subject: [PATCH v5] media: soc_camera: rcar_vin: Add ARGB8888 caputre format support Date: Mon, 25 Jan 2016 01:13:29 +0900 Message-Id: <1453652009-4291-1-git-send-email-ykaneko0929@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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: Koji Matsuoka This patch adds ARGB8888 capture format support for R-Car Gen3. Signed-off-by: Koji Matsuoka Signed-off-by: Yoshihiro Kaneko --- This patch is based on the for-4.6-1 branch of Guennadi's v4l-dvb tree. v5 [Yoshihiro Kaneko] * As suggested by Guennadi Liakhovetski rcar_vin_setup(): - add a common error handler instead of a falling through to the default case. * compile tested only v4 [Yoshihiro Kaneko] * As suggested by Sergei Shtylyov - revised an error message. v3 [Yoshihiro Kaneko] * rebased to for-4.6-1 branch of Guennadi's tree. v2 [Yoshihiro Kaneko] * As suggested by Sergei Shtylyov - fix the coding style of the braces. drivers/media/platform/soc_camera/rcar_vin.c | 39 +++++++++++++++++++++------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c index dc75a80..3b8edf4 100644 --- a/drivers/media/platform/soc_camera/rcar_vin.c +++ b/drivers/media/platform/soc_camera/rcar_vin.c @@ -124,7 +124,7 @@ #define VNDMR_EXRGB (1 << 8) #define VNDMR_BPSM (1 << 4) #define VNDMR_DTMD_YCSEP (1 << 1) -#define VNDMR_DTMD_ARGB1555 (1 << 0) +#define VNDMR_DTMD_ARGB (1 << 0) /* Video n Data Mode Register 2 bits */ #define VNDMR2_VPS (1 << 30) @@ -643,21 +643,26 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv) output_is_yuv = true; break; case V4L2_PIX_FMT_RGB555X: - dmr = VNDMR_DTMD_ARGB1555; + dmr = VNDMR_DTMD_ARGB; break; case V4L2_PIX_FMT_RGB565: dmr = 0; break; case V4L2_PIX_FMT_RGB32: - if (priv->chip == RCAR_GEN2 || priv->chip == RCAR_H1 || - priv->chip == RCAR_E1) { - dmr = VNDMR_EXRGB; - break; - } + if (priv->chip != RCAR_GEN2 && priv->chip != RCAR_H1 && + priv->chip != RCAR_E1) + goto e_format; + + dmr = VNDMR_EXRGB; + break; + case V4L2_PIX_FMT_ARGB32: + if (priv->chip != RCAR_GEN3) + goto e_format; + + dmr = VNDMR_EXRGB | VNDMR_DTMD_ARGB; + break; default: - dev_warn(icd->parent, "Invalid fourcc format (0x%x)\n", - icd->current_fmt->host_fmt->fourcc); - return -EINVAL; + goto e_format; } /* Always update on field change */ @@ -679,6 +684,11 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv) iowrite32(vnmc | VNMC_ME, priv->base + VNMC_REG); return 0; + +e_format: + dev_warn(icd->parent, "Invalid fourcc format (0x%x)\n", + icd->current_fmt->host_fmt->fourcc); + return -EINVAL; } static void rcar_vin_capture(struct rcar_vin_priv *priv) @@ -1304,6 +1314,14 @@ static const struct soc_mbus_pixelfmt rcar_vin_formats[] = { .order = SOC_MBUS_ORDER_LE, .layout = SOC_MBUS_LAYOUT_PACKED, }, + { + .fourcc = V4L2_PIX_FMT_ARGB32, + .name = "ARGB8888", + .bits_per_sample = 32, + .packing = SOC_MBUS_PACKING_NONE, + .order = SOC_MBUS_ORDER_LE, + .layout = SOC_MBUS_LAYOUT_PACKED, + }, }; static int rcar_vin_get_formats(struct soc_camera_device *icd, unsigned int idx, @@ -1611,6 +1629,7 @@ static int rcar_vin_set_fmt(struct soc_camera_device *icd, case V4L2_PIX_FMT_RGB32: can_scale = priv->chip != RCAR_E1; break; + case V4L2_PIX_FMT_ARGB32: case V4L2_PIX_FMT_UYVY: case V4L2_PIX_FMT_YUYV: case V4L2_PIX_FMT_RGB565: