From patchwork Fri Feb 28 16:50:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 11412861 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 174CD13A4 for ; Fri, 28 Feb 2020 16:50:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB309246A0 for ; Fri, 28 Feb 2020 16:50:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OCYRuizE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726947AbgB1QuS (ORCPT ); Fri, 28 Feb 2020 11:50:18 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40141 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725877AbgB1QuS (ORCPT ); Fri, 28 Feb 2020 11:50:18 -0500 Received: by mail-wr1-f67.google.com with SMTP id r17so3700119wrj.7; Fri, 28 Feb 2020 08:50:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uYDEPkQwfnUjgPnuuoScpuqFDu5JOLaJrAD58Hc9G7M=; b=OCYRuizE3lNV5LfCdbqRbcZToo/GEaDbb8IJk7GvatwGCUzowHV3jpGK7MWfeTJHQV 5Ka11XAOJDRz3n13LiLjtoMbOKcK3HycLmmN25/RGnsYbOju1uhxf/XqfpW3GzPAI6Rz u2aEiewkBkI21A9i7guw+mdzPKt1iSy7RsZtbMZCYQIG3KW10PnWWKLQ+Snmj0B1DlnD BF47ytLJGwIXMwAdbRGdIw0SUjxh4ecNTrnRVxUs3jeKpTcdaKE4/ALa1mc0kWjTo3F4 lsmte4Oss0fq8o6xmJbfNWgW3f5c8vST916aPr8ly4/qqgNZ4f4K0hvMcmmTkWr3uyuv ci+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uYDEPkQwfnUjgPnuuoScpuqFDu5JOLaJrAD58Hc9G7M=; b=MOvSRMLv6H8NcjhaA7kH4h91OED/2mDW12jA2un5t3+VP84dW89IVjnJCjVm4zamd4 eCo9UgP7znIMXta/NQ3VwhA8tCK+elmZlGSk/UQVOk+lIbnTRsbe1ZemkXqZMp4W8Hwp sAVW2BRWKkAaVH0j9hybFadc+x2DPi5SQOkF85cmxBs3omQX/+kPs5Ihu7zZvEDe1Y5T +TGWBx2FyOXaBAMVzZDecEmawkQY2NG1Mzi7qQw9mTiHLZgv8MD0SIDrkRlzun5ICAux u4LcQNb7uVX7HL3yJKcVpg8yqlAMbxt/8dD9PoQ01hdjtGwIwPeCGbzxnW3Lp/s9fmyq MocA== X-Gm-Message-State: APjAAAXljOAS92ob9nxux+H6hq30RNgvP8+6OWA/g6fZXR7mugQcevAJ AXQbrhYMQlXnEcauLuylopY= X-Google-Smtp-Source: APXvYqxou3okKCY78l/xXF0q4ljsGL5Ukzt7MiTypHyHS1lCEQFEyXTDMTV+CY8JI4XEkrNV/riuIQ== X-Received: by 2002:a5d:4b82:: with SMTP id b2mr5617141wrt.102.1582908616341; Fri, 28 Feb 2020 08:50:16 -0800 (PST) Received: from prasmi.home ([2a00:23c8:2510:d000:3855:fd13:6b76:a11b]) by smtp.gmail.com with ESMTPSA id h2sm13263408wrt.45.2020.02.28.08.50.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 08:50:15 -0800 (PST) From: Lad Prabhakar X-Google-Original-From: Lad Prabhakar To: Mauro Carvalho Chehab , Niklas Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Lad Prabhakar Subject: [PATCH 1/2] media: rcar-csi2: Fix registering camera endpoint to VIN Date: Fri, 28 Feb 2020 16:50:10 +0000 Message-Id: <20200228165011.17898-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200228165011.17898-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20200228165011.17898-1-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org CSI2 registers camera/sensor as v4l2 async sub device with fwnode is remote endpoint and the camera/sensor register itself as v4l2 sub device with fwnode is remote device as a result the match.fwnode should be fwnode_graph_get_remote_port_parent and not fwnode_graph_get_remote_endpoint. This patch makes use of v4l2 helper function v4l2_async_notifier_add_fwnode_remote_subdev() which uses fwnode_graph_get_remote_port_parent as match.fwnode fixing the issue of registering camera endpoint to the driver. Signed-off-by: Lad Prabhakar Nacked-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-csi2.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c index faa9fb23a2e9..5b04e4768eb1 100644 --- a/drivers/media/platform/rcar-vin/rcar-csi2.c +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c @@ -833,20 +833,18 @@ static int rcsi2_parse_dt(struct rcar_csi2 *priv) return ret; } - priv->asd.match.fwnode = - fwnode_graph_get_remote_endpoint(of_fwnode_handle(ep)); - priv->asd.match_type = V4L2_ASYNC_MATCH_FWNODE; - - of_node_put(ep); - v4l2_async_notifier_init(&priv->notifier); - ret = v4l2_async_notifier_add_subdev(&priv->notifier, &priv->asd); + ret = v4l2_async_notifier_add_fwnode_remote_subdev(&priv->notifier, + of_fwnode_handle(ep), + &priv->asd); if (ret) { - fwnode_handle_put(priv->asd.match.fwnode); + of_node_put(ep); return ret; } + of_node_put(ep); + priv->notifier.ops = &rcar_csi2_notify_ops; dev_dbg(priv->dev, "Found '%pOF'\n", From patchwork Fri Feb 28 16:50:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 11412865 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0371C14B7 for ; Fri, 28 Feb 2020 16:50:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D6FA6246A0 for ; Fri, 28 Feb 2020 16:50:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M7o1rhsK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726816AbgB1QuV (ORCPT ); Fri, 28 Feb 2020 11:50:21 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:53927 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726961AbgB1QuV (ORCPT ); Fri, 28 Feb 2020 11:50:21 -0500 Received: by mail-wm1-f67.google.com with SMTP id f15so3877701wml.3; Fri, 28 Feb 2020 08:50:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mJfep6qc886uMsHNXGk5tdCaaGsgVZaFquG8wUujrTU=; b=M7o1rhsKRaoCUa6UfX/eBXACh55wtTqyZLZ9mEwBsBGISJXKo7Udn31O/aMXoHBFrJ +nWtGdpR2UCD5BT4cgxPGWkmSjTKIWbi0dzxYgdJJCIOUJYXGpBUuOW/a/JD1ghd9ZJ4 fTzKvURpInk/axfmapQpQjKuLYHEaCItxdjXxaFv+9YApQN1gREbAJ9fdta904aeB6kd o9iyowDOrMPkZhalz2OZ2nnTpY0bvYk5vSZHHJW/CNz6U+2EAJ18XyczIwyxbUj0s9jq c/kz8K/i7KwSDeAAx2qoJVUYpgQD3OfQhJb8Bssf3Dv01ISOt/IaDa0X9y1z+osv4o+e lflA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mJfep6qc886uMsHNXGk5tdCaaGsgVZaFquG8wUujrTU=; b=FmDBj4KRVi/vYjkfyiXJcV1w+VteDkqnKmm3HaqLAylC3PSKOevxhmHU+SD+5j9VUC d8m7VBQw7mMtPI4qNDL30MlAzXj01+SrzQCSZhxH7GGqtmML6ye9KTXmI6o56JIrd48n EWOhEWKDfoluZNg2ec6G4SsR4IZDzw1x/yVmm/p8OrifU+axWFd1J/5Jnr3idF4BlJpD iSnTi6fobvCdGlqcs/ou2iAl6wK3s8axpNkty4huIhsKtA/QVuFbcAC2GVfb6pTkLB8h NgA+RwQocRJtQCEGCzss8LoxUAWazLzojrpS1fhCAc03HTfVjSt/qIf1kJgl5UKmy2Hj zSVw== X-Gm-Message-State: APjAAAUYqZD5CZA7SLEYAQ8X2r8/QbA3gQvi+h+f/HElos9S1+t5pHBa +Hx2D+QpbXGSnRQJHWp0Ilw= X-Google-Smtp-Source: APXvYqysdmqkNy66Xr05Ml5WtI6Ku5rfT+oBrLozxXln9ZSQ9aRy2MFfskf2BZexP7XjsL6GUsAT3Q== X-Received: by 2002:a7b:c5cd:: with SMTP id n13mr5565466wmk.172.1582908618166; Fri, 28 Feb 2020 08:50:18 -0800 (PST) Received: from prasmi.home ([2a00:23c8:2510:d000:3855:fd13:6b76:a11b]) by smtp.gmail.com with ESMTPSA id h2sm13263408wrt.45.2020.02.28.08.50.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 08:50:17 -0800 (PST) From: Lad Prabhakar X-Google-Original-From: Lad Prabhakar To: Mauro Carvalho Chehab , Niklas Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Lad Prabhakar Subject: [PATCH 2/2] media: rcar-vin: Add support for SRGGB8_1X8 Date: Fri, 28 Feb 2020 16:50:11 +0000 Message-Id: <20200228165011.17898-3-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200228165011.17898-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20200228165011.17898-1-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Most of the RZ/G2x boards can support capturing frames in SRGGB8_1X8 format, add support for this with a runtime check that the running hardware supports it. Signed-off-by: Lad Prabhakar --- drivers/media/platform/rcar-vin/rcar-core.c | 1 + drivers/media/platform/rcar-vin/rcar-csi2.c | 1 + drivers/media/platform/rcar-vin/rcar-dma.c | 14 ++++++++++++-- drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 ++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index 7440c8965d27..76daf2fe5bcd 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -469,6 +469,7 @@ static int rvin_parallel_subdevice_attach(struct rvin_dev *vin, case MEDIA_BUS_FMT_UYVY8_2X8: case MEDIA_BUS_FMT_UYVY10_2X10: case MEDIA_BUS_FMT_RGB888_1X24: + case MEDIA_BUS_FMT_SRGGB8_1X8: vin->mbus_code = code.code; vin_dbg(vin, "Found media bus format for %s: %d\n", subdev->name, vin->mbus_code); diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c index 5b04e4768eb1..97e4886f63f0 100644 --- a/drivers/media/platform/rcar-vin/rcar-csi2.c +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c @@ -320,6 +320,7 @@ static const struct rcar_csi2_format rcar_csi2_formats[] = { { .code = MEDIA_BUS_FMT_YUYV8_1X16, .datatype = 0x1e, .bpp = 16 }, { .code = MEDIA_BUS_FMT_UYVY8_2X8, .datatype = 0x1e, .bpp = 16 }, { .code = MEDIA_BUS_FMT_YUYV10_2X10, .datatype = 0x1e, .bpp = 20 }, + { .code = MEDIA_BUS_FMT_SRGGB8_1X8, .datatype = 0x2a, .bpp = 8 }, }; static const struct rcar_csi2_format *rcsi2_code_to_fmt(unsigned int code) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 1a30cd036371..63709b4bbf7a 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,15 @@ 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; + if (vin->format.pixelformat == V4L2_PIX_FMT_SRGGB8) + stride = ALIGN(vin->format.bytesperline / 2, 0x10); + else + stride = vin->format.bytesperline / fmt->bpp; rvin_write(vin, stride, VNIS_REG); } @@ -676,6 +679,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 +743,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); @@ -1110,6 +1119,7 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd, case MEDIA_BUS_FMT_UYVY8_2X8: case MEDIA_BUS_FMT_UYVY10_2X10: case MEDIA_BUS_FMT_RGB888_1X24: + case MEDIA_BUS_FMT_SRGGB8_1X8: vin->mbus_code = fmt.format.code; break; default: diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index b12b3f88836a..d56cf85ba065 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,