From patchwork Thu Jan 14 13:30:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 8031911 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E5F739F6FA for ; Thu, 14 Jan 2016 13:30:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1996E20439 for ; Thu, 14 Jan 2016 13:30:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 199062042C for ; Thu, 14 Jan 2016 13:30:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754240AbcANNae (ORCPT ); Thu, 14 Jan 2016 08:30:34 -0500 Received: from smtp-3.sys.kth.se ([130.237.48.192]:39795 "EHLO smtp-3.sys.kth.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754135AbcANNad (ORCPT ); Thu, 14 Jan 2016 08:30:33 -0500 Received: from smtp-3.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-3.sys.kth.se (Postfix) with ESMTP id B34272971; Thu, 14 Jan 2016 14:30:31 +0100 (CET) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-3.sys.kth.se ([127.0.0.1]) by smtp-3.sys.kth.se (smtp-3.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id hvpm9hGEsYh7; Thu, 14 Jan 2016 14:30:30 +0100 (CET) X-KTH-Auth: niso [89.233.230.99] X-KTH-mail-from: niklas.soderlund+renesas@ragnatech.se Received: from bismarck.berto.se (dynamic.0.6.79d1f80.14cc20ac3a53.cust.bredband2.com [89.233.230.99]) by smtp-3.sys.kth.se (Postfix) with ESMTPSA id 9CC6F251E; Thu, 14 Jan 2016 14:30:30 +0100 (CET) From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: linux-sh@vger.kernel.org Cc: laurent.pinchart+renesas@ideasonboard.com, =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [RFC 3/5] [media] rcar-vin: add array of supported formats Date: Thu, 14 Jan 2016 14:30:14 +0100 Message-Id: <1452778216-31978-4-git-send-email-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1452778216-31978-1-git-send-email-niklas.soderlund+renesas@ragnatech.se> References: <1452778216-31978-1-git-send-email-niklas.soderlund+renesas@ragnatech.se> 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.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 Lift over the video formats and helper from the soc_camera driver. --- drivers/media/platform/rcar-vin.c | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/drivers/media/platform/rcar-vin.c b/drivers/media/platform/rcar-vin.c index 06616d4..a062287 100644 --- a/drivers/media/platform/rcar-vin.c +++ b/drivers/media/platform/rcar-vin.c @@ -34,6 +34,12 @@ enum chip_id { RCAR_E1, }; +struct rcar_vin_format { + const char *description; + u32 fourcc; + u8 bpp; +}; + struct rcar_vin { void __iomem *base; @@ -181,6 +187,59 @@ static irqreturn_t rcar_vin_irq(int irq, void *dev_id) } /* ----------------------------------------------------------------------------- + * Video formats + */ + +static const struct rcar_vin_format rcar_vin_formats[] = { + { + .description = "NV16", + .fourcc = V4L2_PIX_FMT_NV16, + .bpp = 8, + }, + { + .description = "YUYV", + .fourcc = V4L2_PIX_FMT_YUYV, + .bpp = 16, + }, + { + .description = "UYVY", + .fourcc = V4L2_PIX_FMT_UYVY, + .bpp = 16, + }, + { + .description = "RGB565", + .fourcc = V4L2_PIX_FMT_RGB565, + .bpp = 16, + }, + { + .description = "ARGB1555", + .fourcc = V4L2_PIX_FMT_RGB555X, + .bpp = 16, + }, + { + .description = "RGB888", + .fourcc = V4L2_PIX_FMT_RGB32, + .bpp = 32, + }, +}; + + + +const struct rcar_vin_format *rcar_vin_get_format_by_fourcc(u32 fourcc) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(rcar_vin_formats); ++i) { + const struct rcar_vin_format *format = &rcar_vin_formats[i]; + + if (format->fourcc == fourcc) + return format; + } + + return ERR_PTR(-EINVAL); +} + +/* ----------------------------------------------------------------------------- * Platform Device Driver */