From patchwork Sat Feb 11 20:57:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13137204 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4902AC636CC for ; Sat, 11 Feb 2023 20:57:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229668AbjBKU5k (ORCPT ); Sat, 11 Feb 2023 15:57:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbjBKU5j (ORCPT ); Sat, 11 Feb 2023 15:57:39 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ADFC1448C for ; Sat, 11 Feb 2023 12:57:38 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id bg5-20020a05600c3c8500b003e00c739ce4so6366746wmb.5 for ; Sat, 11 Feb 2023 12:57:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=1dUEr9eXoMzbYbCBQ2hq4AC5F7Kd/oMpb0hpij4vvQM=; b=a0JQo3aYXVyztb7HQZ98PLUwN4ku+afRvomMN5g+LOmC66BiC4Bkq7gY2/5LaZPCwV qqBLgTbKoKdaxl91S8vBUEmCJ+/T9lH0/l6h6c+aOkxoePFkP3kIOx/E41/ZfP+Bquon /cGXkVYoiadSqzVSS6mNIRsdhbvgvNQF0S59i9PwADyJlyqsJbEYHvYlpWIne5FJeQNi RdL6rJf3WI9eu3S7XjaPJhgHYCUk4KRd9v+UhDCesiQBqesBUMtZ0aqqjwnpCCk500dy GuHji54KHmnt71bFsp+BAwsTRP7vfm7jUdxYx3PJlT8YpMljuyfZCOQgCWCfloko5PPk o/3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1dUEr9eXoMzbYbCBQ2hq4AC5F7Kd/oMpb0hpij4vvQM=; b=ynC6p+jRU02QuoxS0vpe0l3XO/+1tq5ZziGWSyoApwVzRzjZG2gQvFKb6m9UJ8ztWb ONw5Ipfik4Pv+yssIdEvtFklYi3NpRxFwXFK25wB8017L/5ZgML11F0/rPnflZt7a2eQ i1T13gfZRbI3LxuHtndDVlIs873VywdKuHd6Hqp4bLc0qsbtbH0fLI7y7luEtV9OpJWi OlEolOYvutDJ9aCC9CFhmuV93VWamULornO7n6Q1XUWXAUKf4xjyDxv2zE50rytEj6j6 Ew1iHw5lNbkMOSMy65TvBh8p7o2pGPsICG6HO1RTkBDAFNzEpS+52XwfsH4wkdgii1Xw WKBw== X-Gm-Message-State: AO0yUKXv2nclmRdB9YZfOojrlTvYwHb9zidTcRasUGEZ5feeblOx0xTf g1cnIVSHyLQLWq/KHS1JAzv5Dw/kMbHYl1Ife4U= X-Google-Smtp-Source: AK7set/OFb7Gf2/iCgzjEdsyOMm1Hu7JXruMNd/x3hTEETALA+SFIL6aby+oKNHlZYqb/8BcyGkD4w== X-Received: by 2002:a05:600c:a68f:b0:3da:db4:6105 with SMTP id ip15-20020a05600ca68f00b003da0db46105mr15970788wmb.37.1676149056868; Sat, 11 Feb 2023 12:57:36 -0800 (PST) Received: from sleipner.berto.se (p54ac5802.dip0.t-ipconnect.de. [84.172.88.2]) by smtp.googlemail.com with ESMTPSA id n6-20020a7bcbc6000000b003dfe57f6f61sm8438522wmi.33.2023.02.11.12.57.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Feb 2023 12:57:36 -0800 (PST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: linux-renesas-soc@vger.kernel.org Cc: linux-media@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [RFT/PATCH] media: rcar-vin: Add support for RAW10 on V3U Date: Sat, 11 Feb 2023 21:57:14 +0100 Message-Id: <20230211205714.494998-1-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The R-Car V3U SoC is capable of capturing RAW10. Add support for it using the V4L2_PIX_FMT_Y10 pixel format, which I think is the correct format to express RAW10 unpacked to users. Signed-off-by: Niklas Söderlund --- Hi Renesas BSP team, I don't have a RAW10 capable device, could you please test this patch and provide a Tested-by tag? Kind Regards Niklas --- drivers/media/platform/renesas/rcar-vin/rcar-core.c | 1 + drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 12 ++++++++++++ drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c | 8 ++++++++ drivers/media/platform/renesas/rcar-vin/rcar-vin.h | 2 ++ 4 files changed, 23 insertions(+) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c index 5e53d6b7036c..061e83578d5d 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c @@ -1299,6 +1299,7 @@ static const struct rvin_info rcar_info_r8a779a0 = { .use_mc = true, .use_isp = true, .nv12 = true, + .raw10 = true, .max_width = 4096, .max_height = 4096, }; diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c index 2a77353f10b5..4935dbecc68d 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c @@ -123,7 +123,9 @@ /* Video n Data Mode Register bits */ #define VNDMR_A8BIT(n) (((n) & 0xff) << 24) #define VNDMR_A8BIT_MASK (0xff << 24) +#define VNDMR_RMODE_RAW10 (2 << 19) #define VNDMR_YMODE_Y8 (1 << 12) +#define VNDMR_YC_THR (1 << 11) #define VNDMR_EXRGB (1 << 8) #define VNDMR_BPSM (1 << 4) #define VNDMR_ABIT (1 << 2) @@ -780,6 +782,9 @@ static int rvin_setup(struct rvin_dev *vin) case MEDIA_BUS_FMT_Y8_1X8: vnmc |= VNMC_INF_RAW8; break; + case MEDIA_BUS_FMT_Y10_1X10: + vnmc |= VNMC_INF_RGB666; + break; default: break; } @@ -888,6 +893,9 @@ static int rvin_setup(struct rvin_dev *vin) dmr = 0; } break; + case V4L2_PIX_FMT_Y10: + dmr = VNDMR_RMODE_RAW10 | VNDMR_YC_THR; + break; default: vin_err(vin, "Invalid pixelformat (0x%x)\n", vin->format.pixelformat); @@ -1270,6 +1278,10 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd, if (vin->format.pixelformat != V4L2_PIX_FMT_GREY) return -EPIPE; break; + case MEDIA_BUS_FMT_Y10_1X10: + if (vin->format.pixelformat != V4L2_PIX_FMT_Y10) + return -EPIPE; + break; default: return -EPIPE; } diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c b/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c index 073f70c6ac68..c9be192cb4e5 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c @@ -86,6 +86,10 @@ static const struct rvin_video_format rvin_formats[] = { .fourcc = V4L2_PIX_FMT_GREY, .bpp = 1, }, + { + .fourcc = V4L2_PIX_FMT_Y10, + .bpp = 4, + }, }; const struct rvin_video_format *rvin_format_from_pixel(struct rvin_dev *vin, @@ -106,6 +110,10 @@ const struct rvin_video_format *rvin_format_from_pixel(struct rvin_dev *vin, if (!vin->info->nv12 || !(BIT(vin->id) & 0x3333)) return NULL; break; + case V4L2_PIX_FMT_Y10: + if (!vin->info->raw10) + return NULL; + break; default: break; } diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-vin.h b/drivers/media/platform/renesas/rcar-vin/rcar-vin.h index cb206d3976dd..921e35d9dfe0 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/renesas/rcar-vin/rcar-vin.h @@ -152,6 +152,7 @@ struct rvin_group_route { * @use_mc: use media controller instead of controlling subdevice * @use_isp: the VIN is connected to the ISP and not to the CSI-2 * @nv12: support outputing NV12 pixel format + * @raw10: support outputing RAW10 pixel format * @max_width: max input width the VIN supports * @max_height: max input height the VIN supports * @routes: list of possible routes from the CSI-2 recivers to @@ -163,6 +164,7 @@ struct rvin_info { bool use_mc; bool use_isp; bool nv12; + bool raw10; unsigned int max_width; unsigned int max_height;