Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1708235pxb; Fri, 24 Sep 2021 10:07:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGrgruIwa6tggHKzRVk+daSOn8xDxlVgUvvb0+ti4yKxPBRCicSoszk+p7zKqqSvjkSB/n X-Received: by 2002:a6b:fe05:: with SMTP id x5mr9666268ioh.26.1632503267518; Fri, 24 Sep 2021 10:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632503267; cv=none; d=google.com; s=arc-20160816; b=aBr3wyg5ReICsC5C3SPe/STlo/g3UGjQW6Uq/N9O7dhCZJbIT4rlGbw8DuTiMjO/zm N4JZZsnE1WaTFhr+K8bJWBz9le7Y6gltZRyOM2Sco5afvJijyFwgpk3PquPKWOOkA5yX 1NKH/6dBTT3RC26ByLVaCc8jMcvwLZAeuMavUX9D1cZixyCfWUieLBzYzjbYe8iUWuGs MDSv0Ern2rbn4gsoMAKNkiq7g0I6k3aDrx3zmyy7TYHLSA3UjsMaKU+3IfzEbK6iJytV FlR+CepkYRujCkcoZVIzOghEmmx00cCd8WJctQ4bXUb2poOVRCGm0Uow5KhHFT7g34wJ ShIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4SH01R4UDbpzsZN06ben0KINDaSwIp1BbvQxp2nm2/8=; b=lIO3sbEO/7NMmWF80PAR7yJatg721Z0srM939gyYUHHB+bMxEGtbXNG3HPYZfha871 I52XPiB+Bzly9mk8IkNNnRrKjJ4dlMha5eq4lMSi43P2ZzImPUvpwcBurtPF4HrrBzla W0zjPHRlrQGBkcNkEG7MwEqOfmEA1TPT8qFUepb38XVXAlUJ3m8FbVZMs8qgPqwlgv60 U2OUPqxKjnLmcOSdCypp+1IMnpxJsgisP7UtVgZr5eC4w8czkGaVSobezM4dI18/e4vE EvxkdTTsEP4tMS45NboylwgT9Hp22ovrnjUx+AWq3MQaHSG7uIA5WEHqTYDvzHnC2oPr lqCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cogentembedded-com.20210112.gappssmtp.com header.s=20210112 header.b=DWYLB7LL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t2si11161861iol.64.2021.09.24.10.07.33; Fri, 24 Sep 2021 10:07:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cogentembedded-com.20210112.gappssmtp.com header.s=20210112 header.b=DWYLB7LL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343836AbhIXMqN (ORCPT + 99 others); Fri, 24 Sep 2021 08:46:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343769AbhIXMqB (ORCPT ); Fri, 24 Sep 2021 08:46:01 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97441C061757 for ; Fri, 24 Sep 2021 05:44:28 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id u18so38694113lfd.12 for ; Fri, 24 Sep 2021 05:44:28 -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=MYCLQmOq1ZLvwMFrKWpUCs5kf85mnyY6s9Vnb28AL/UTyzVE682x1lJbXQ79bP+GEY nm+CsxbsKA+CeXwAAROPnkar8/lSJ8G0tuvzYFKEHyUGVQkxyXI7C7EWsvuA28sKAZFS lR0TLJSIIcWPooUuTjV+RX8YChLxo1NNN0ZwIgzyyF2/SRDGVsr7/I48YCwVwwkLJXTi PPAV5QtGhk/L/wHvZ7Uu//bu9QlMpMWW2+QoY8EkmXihkKuRI9GxDoGXpSPUrp3iIqzS +sizUPMbT52MVmKXNVdMhL81O8rkgt6yWAmOcuowzg/8vaF2Ss7WW6kCraHnf+98B0CB Uq/A== X-Gm-Message-State: AOAM532CXcKbxscn1w1DSfAotXs2A+/14xusPRB/UAcJ91hGLZimeePE pQs934ghXzyZNrnc2XxuushTRw== 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=20S=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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- 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, -- 2.30.2