Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp822687ybm; Wed, 27 May 2020 08:50:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrZ93xkc+HKjclSNLYS7lD+Sl4m+508ewYw4b8jgaxd7ZGmeVpn9CN75sBm4Ruibd8PN1K X-Received: by 2002:a17:906:6d18:: with SMTP id m24mr6455380ejr.519.1590594637826; Wed, 27 May 2020 08:50:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590594637; cv=none; d=google.com; s=arc-20160816; b=wtiQycrPX7P2NsWbJ7WKPQ7Da7HPFW5CNGlejErhUVx9eWopNAv1O70LKWUja8jLRm r/908qb1KzGycXChDmi4DsB8SeClNi2QXGxST4C4XSf2MaoLw21VCBJUHYNw442R5f1P JHA+Mo0siVgEwR79WvqWRNHrbsga+2KtEpetfa+3YoaF23sugdnpQac93dhBSPJdubqs Ra97JM3M+qxZS8c8lE1lFNk6D9V7cSleRWTH9spUBPKSIMyI+srqOc6k8vSa7KOJj87u ZUItaNPJmzbpNkBxCiby/RX5TpXS0UkhetH9hNwgMKhMjmqBW1ut4jnqsRtA4RuznC0v ldGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=s+htvkb8a7MBL2GWgQImAx2nr2OsllfXi3/qGLJN89I=; b=fKd877Q9Z18brk9Z7l5TROBjCAPQVWZ5o/prA/JU6NW5YCkSg7wbh7eGQFIccZNLEE olEbNrSvX/XYbZxuCUG7BpckXtiftoZ82TzGCaa4oHMnW7AWYvtjk15kIsYHVUYPkdum DG0zUqGxjNRRGrey1sHGcaSnooZIz09bFNYJp61aCakg0BkVD7miIpPkVlK2tZG98bMT UrPZlKCg5aNIw72ixZPSvamfq57d48RAFUvisnMzxbSmp1X4SQCBiTYpzaEOt6+TD5/P dRHsDgLthK0mrTc4YN6n6S5uMhTBCTP3J2ONu7dEU899+ANjmg846vf3s7Toilq3gHQK t05A== ARC-Authentication-Results: i=1; mx.google.com; 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 s23si1872182edq.488.2020.05.27.08.50.14; Wed, 27 May 2020 08:50:37 -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; 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 S1729478AbgE0MRa (ORCPT + 99 others); Wed, 27 May 2020 08:17:30 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:5558 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727798AbgE0MR2 (ORCPT ); Wed, 27 May 2020 08:17:28 -0400 X-IronPort-AV: E=Sophos;i="5.73,441,1583161200"; d="scan'208";a="47942591" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 27 May 2020 21:17:27 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 5B61142BA9F4; Wed, 27 May 2020 21:17:26 +0900 (JST) From: Lad Prabhakar 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, Lad Prabhakar Subject: [PATCH v5 2/3] media: rcar-vin: Add support for MEDIA_BUS_FMT_SRGGB8_1X8 format Date: Wed, 27 May 2020 13:16:49 +0100 Message-Id: <1590581810-19317-3-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1590581810-19317-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <1590581810-19317-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for MEDIA_BUS_FMT_SRGGB8_1X8 format in rcar-vin by setting format type to RAW8 in VNMC register and appropriately setting the bpp and bytesperline to enable V4L2_PIX_FMT_SRGGB8. Signed-off-by: Lad Prabhakar Reviewed-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-dma.c | 15 ++++++++++++++- drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 2b26204910fd..a5dbb90c5210 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -85,6 +85,7 @@ #define VNMC_INF_YUV8_BT601 (1 << 16) #define VNMC_INF_YUV10_BT656 (2 << 16) #define VNMC_INF_YUV10_BT601 (3 << 16) +#define VNMC_INF_RAW8 (4 << 16) #define VNMC_INF_YUV16 (5 << 16) #define VNMC_INF_RGB888 (6 << 16) #define VNMC_VUP (1 << 10) @@ -587,13 +588,19 @@ void rvin_crop_scale_comp(struct rvin_dev *vin) rvin_write(vin, vin->crop.top, VNSLPRC_REG); rvin_write(vin, vin->crop.top + vin->crop.height - 1, VNELPRC_REG); - /* TODO: Add support for the UDS scaler. */ if (vin->info->model != RCAR_GEN3) rvin_crop_scale_comp_gen2(vin); fmt = rvin_format_from_pixel(vin, vin->format.pixelformat); stride = vin->format.bytesperline / fmt->bpp; + + /* For RAW8 format bpp is 1, but the hardware process RAW8 + * format in 2 pixel unit hence configure VNIS_REG as stride / 2. + */ + if (vin->format.pixelformat == V4L2_PIX_FMT_SRGGB8) + stride /= 2; + rvin_write(vin, stride, VNIS_REG); } @@ -676,6 +683,9 @@ static int rvin_setup(struct rvin_dev *vin) input_is_yuv = true; break; + case MEDIA_BUS_FMT_SRGGB8_1X8: + vnmc |= VNMC_INF_RAW8; + break; default: break; } @@ -737,6 +747,9 @@ static int rvin_setup(struct rvin_dev *vin) case V4L2_PIX_FMT_ABGR32: dmr = VNDMR_A8BIT(vin->alpha) | VNDMR_EXRGB | VNDMR_DTMD_ARGB; break; + case V4L2_PIX_FMT_SRGGB8: + dmr = 0; + break; default: vin_err(vin, "Invalid pixelformat (0x%x)\n", vin->format.pixelformat); diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index d3b6a992b4a2..0e066bba747e 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -66,6 +66,10 @@ static const struct rvin_video_format rvin_formats[] = { .fourcc = V4L2_PIX_FMT_ABGR32, .bpp = 4, }, + { + .fourcc = V4L2_PIX_FMT_SRGGB8, + .bpp = 1, + }, }; const struct rvin_video_format *rvin_format_from_pixel(struct rvin_dev *vin, -- 2.17.1