From patchwork Fri Sep 24 12:43:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nikita Yushchenko X-Patchwork-Id: 12515213 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 X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EC4DC433FE for ; Fri, 24 Sep 2021 12:44:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF9EF61242 for ; Fri, 24 Sep 2021 12:44:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343760AbhIXMqG (ORCPT ); Fri, 24 Sep 2021 08:46:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343765AbhIXMqB (ORCPT ); Fri, 24 Sep 2021 08:46:01 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37FDFC0613D3 for ; Fri, 24 Sep 2021 05:44:27 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id y26so452359lfa.11 for ; Fri, 24 Sep 2021 05:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4SH01R4UDbpzsZN06ben0KINDaSwIp1BbvQxp2nm2/8=; b=DWYLB7LLuHrQ4AlVw9RILzREmVIi26O/N+wD49YjLAC06D8X3+1H81eGOAjuogTmMa 1Kgh0vPwtXHoGazJ3LDH1yHhtVN/afScINETDCMBLoZwE41d/G0htuP0+PPfkQOpo6H3 /OZPlGRSs0pdyU79ig8FFWyjWGx+vXoDU99cDlJYOA4+4zIh/X6NYQrjF3ylxGHJ52Gy cyS8RzSg3lPtGpaZFHrMQKSnBPxXRDRmkpguJ63K9M4iwAw/XR8CV4Gj0FncMGVxFOks 2uQibfNBixU4r3GmH8hta7yibVmWcSYJbjPHE+XoRtaF1DMcGtV0R9a7Q3BlMJW8zdSL ZK4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4SH01R4UDbpzsZN06ben0KINDaSwIp1BbvQxp2nm2/8=; b=nnpyPztGcmhyvaNRprO+FYinmjYDHqVQX5gbhNgiMweHf/byQ40HDiLUOERxS3F1xv oOmHn6Uv5aU3FvwtjZcnjTGp6zVArpfImAUaf6OMfWcL6DMDjdYe258rbUUNSCvZqIFk RmV8LoYP46gP0hkT0H8wsTeumUB/TvbldpWo0+HCWrOSJqeBB8+5Z2QaBdGFTF139OV3 bccAXqwOA147ZuL3ObVfgMBGovfysHZCjJUs6PGDQp+hSPZa1PeDF/X33FJvrmqTZyNI iARc7XepTHAr0WvHHcw0ekzDehXlTNEBE639Gg0UWyCkNRN+qiPtRNt2eDJK/55ofBu0 kTiQ== X-Gm-Message-State: AOAM532Nc8706qEYS0sz6XrgCZ9etcJDJkP9PXcGl1Vi+Q28J38kwiuR jOIWKh6lgIzsIFiF6WC7KerYTg== X-Google-Smtp-Source: ABdhPJy2dYwh7NjFnfNcBe7E7qiksBX17nrHZH5BgOqdkUVYgQKDRpJbDF4u1d1YWulSJ7Qz1Gqo4A== X-Received: by 2002:a2e:7f04:: with SMTP id a4mr11514596ljd.308.1632487465519; Fri, 24 Sep 2021 05:44:25 -0700 (PDT) Received: from cobook.home (nikaet.starlink.ru. [94.141.168.29]) by smtp.gmail.com with ESMTPSA id d23sm746793lfs.125.2021.09.24.05.44.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 05:44:25 -0700 (PDT) From: Nikita Yushchenko To: =?utf-8?q?Niklas_S=C3=B6derlund?= , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Barinov , Nikita Yushchenko Subject: [PATCH v2] media: rcar-vin: add GREY format Date: Fri, 24 Sep 2021 15:43:17 +0300 Message-Id: <20210924124315.26164-1-nikita.yoush@cogentembedded.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Vladimir Barinov This adds support for MEDIA_BUS_FMT_Y8_1X8 input and V4L2_PIX_FMT_GREY output format. Signed-off-by: Vladimir Barinov Signed-off-by: Nikita Yushchenko Reviewed-by: Niklas Söderlund --- Changes from v1: - fix coding style issue drivers/media/platform/rcar-vin/rcar-dma.c | 15 +++++++++++++++ drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index f5f722ab1d4e..4d0d95cf4c5f 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -114,6 +114,7 @@ /* Video n Data Mode Register bits */ #define VNDMR_A8BIT(n) (((n) & 0xff) << 24) #define VNDMR_A8BIT_MASK (0xff << 24) +#define VNDMR_YMODE_Y8 (1 << 12) #define VNDMR_EXRGB (1 << 8) #define VNDMR_BPSM (1 << 4) #define VNDMR_ABIT (1 << 2) @@ -603,6 +604,7 @@ void rvin_crop_scale_comp(struct rvin_dev *vin) case V4L2_PIX_FMT_SGBRG8: case V4L2_PIX_FMT_SGRBG8: case V4L2_PIX_FMT_SRGGB8: + case V4L2_PIX_FMT_GREY: stride /= 2; break; default: @@ -695,6 +697,7 @@ static int rvin_setup(struct rvin_dev *vin) case MEDIA_BUS_FMT_SGBRG8_1X8: case MEDIA_BUS_FMT_SGRBG8_1X8: case MEDIA_BUS_FMT_SRGGB8_1X8: + case MEDIA_BUS_FMT_Y8_1X8: vnmc |= VNMC_INF_RAW8; break; default: @@ -774,6 +777,14 @@ static int rvin_setup(struct rvin_dev *vin) case V4L2_PIX_FMT_SRGGB8: dmr = 0; break; + case V4L2_PIX_FMT_GREY: + if (input_is_yuv) { + dmr = VNDMR_DTMD_YCSEP | VNDMR_YMODE_Y8; + output_is_yuv = true; + } else { + dmr = 0; + } + break; default: vin_err(vin, "Invalid pixelformat (0x%x)\n", vin->format.pixelformat); @@ -1145,6 +1156,10 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd, if (vin->format.pixelformat != V4L2_PIX_FMT_SRGGB8) return -EPIPE; break; + case MEDIA_BUS_FMT_Y8_1X8: + if (vin->format.pixelformat != V4L2_PIX_FMT_GREY) + return -EPIPE; + break; default: return -EPIPE; } diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 0d141155f0e3..bdeff51bf768 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -82,6 +82,10 @@ static const struct rvin_video_format rvin_formats[] = { .fourcc = V4L2_PIX_FMT_SRGGB8, .bpp = 1, }, + { + .fourcc = V4L2_PIX_FMT_GREY, + .bpp = 1, + }, }; const struct rvin_video_format *rvin_format_from_pixel(struct rvin_dev *vin,