From nobody Thu Nov 28 14:54:24 2024 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C7A11C8FC9; Tue, 1 Oct 2024 14:09:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791788; cv=none; b=mNVRS4DCJ4H3bPL0mm7NT1bthTHC8IF/m4zBoF/od/CUULkQjU3+GKSeDYVbh/UKuDaMsgzfymQum1dygqwWBtX6ieTEUoFJp1N9nR5Jr05GVDRE+t+LQ210Xs6p8YrqqmolibjcD2d6QFzJm79ECd+QioawjCjsdndKmffdG3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791788; c=relaxed/simple; bh=KQ4QalhK3wpJRxnxOQjibUYOzGHpyIlf0E5mu9OcT94=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EIMw8ZSSGiGYj8pX4a7P64X7HBLDqrjtNXOolSnGRe7fgHMIuvtqrpLSdNJlILuAxPtgkkxuKgtOhtoVfZBn386mCSWYJLie0EqSFTwD4NdOxxZrFZx+ny0N1c2MJa/5A1uRzvpVW6zWGUTkvksDT2a9ZH85ukITZ1KxuGgqLwo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kWjwcPrC; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kWjwcPrC" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a90188ae58eso710924066b.1; Tue, 01 Oct 2024 07:09:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791785; x=1728396585; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=boeqnJLmUzhRxfK8aueqwDu2CJTbHkxzx4cEwsCpLvk=; b=kWjwcPrCddMi/BOytETBC8HVb32i6Wt70U3yllqRBxIWbXtIPWGRjYSVI3Wrs1YLNf To/xk33VkCtZ+LiCz+deak4ngy6mJq6j5HMoHg0fkmJk149ytbLz1gNKkMzA489QDwWs sDHmgAObjcDVQ9PzYAPTFcAAeIfypCD6qu/8mWaQP+gRHO3OLmqWgaShZyxWYombCVKL iCx8n5BcNGXgDBIHYKpk3A0BRljw7qMMkGeqFRZbCJS7uJ2N/le3oZh0DrGPIYH2B6OK lYf8+6Fe2CeEKYJ52Dr74frcjfkebgspO5nQESyw2DOmEnDI1XOVeoJtfbB4WDs2gmz1 D3gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791785; x=1728396585; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=boeqnJLmUzhRxfK8aueqwDu2CJTbHkxzx4cEwsCpLvk=; b=HHgCbgFKo2WtJH5CG/NY/oJQqVltU2fKH9pBwL2pw4w8v6xIJpN2J++TTHvsQJ1aDA UxE8qcU8HGjWqQFmfE4Mq7qBz7JfjbAFX/HcIkoX6r80ii/2NP1PqlLuAO+Dl5eJgifV b9TQTQKOub1kygRxqMO8Q/a2pPV4Mz84Tpr9lCE5lrz4ctgIUdzzeGq0CFbh6NyTe1O9 8NxAnVAgK7+i/bGJieLlXbHBOYak9blB2euLP0CouxOdE1UdkaZvJe4VWV0zFugpLHHu yB0w7jr0Ya9M0N/h718+evFDO285KipUC43Oo7FUBASu4TDW/2gETtxINnZtZnrLu+Gd 5YrQ== X-Forwarded-Encrypted: i=1; AJvYcCUKajhzrCcKbykXnY4CoxUlfp4qtfGuX7mjrLtN4HpJUWEfOF0rFTJGZ0debrnnlppU5nyjmJaDggO2oVw=@vger.kernel.org, AJvYcCVgmamlMCd4OwXPmN6sJ+mrfNO+XJTsjaJj1pXZdq2YTmQJ5YlzCtWVAsjq7QFM1+TsKIAggB61NrBsreu697ciTLU=@vger.kernel.org X-Gm-Message-State: AOJu0YzKDEnmcI/vAJ3ed4iQd6+cJf9Xm4PxCJeIUWcrUfgtXtwf48a/ +iNs22WSOup0votHByqBtXlgZVdWwzo/AEPieemJvctsqFZDjRQ/ X-Google-Smtp-Source: AGHT+IHM+YcI3JUJ7OhJuS3/lrXoocpKzgQqVNBM+xpqIUUr8AE7YD1cMIgqOhhQ4Y5vLatYFWVZtA== X-Received: by 2002:a17:907:948f:b0:a91:a5f:c9ce with SMTP id a640c23a62f3a-a93c4c26890mr1596755866b.62.1727791784357; Tue, 01 Oct 2024 07:09:44 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:2595:4364:d152:dff3]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c2776de0sm723532966b.2.2024.10.01.07.09.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:43 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Laurent Pinchart , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar , Laurent Pinchart Subject: [PATCH v3 06/17] media: rzg2l-cru: Retrieve virtual channel information Date: Tue, 1 Oct 2024 15:09:08 +0100 Message-ID: <20241001140919.206139-7-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241001140919.206139-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241001140919.206139-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar The RZ/G2L CRU needs to configure the ICnMC.VCSEL bits to specify which virtual channel should be processed from the four available VCs. To retrieve this information from the connected subdevice, the .get_frame_desc() function is called. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - Updated subject line v1->v2 - Collected RB tag --- .../platform/renesas/rzg2l-cru/rzg2l-cru.h | 5 +++ .../platform/renesas/rzg2l-cru/rzg2l-ip.c | 5 --- .../platform/renesas/rzg2l-cru/rzg2l-video.c | 34 +++++++++++++++++++ 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers= /media/platform/renesas/rzg2l-cru/rzg2l-cru.h index 174760239548..8fbd45c43763 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h @@ -31,6 +31,11 @@ #define RZG2L_CRU_MIN_INPUT_HEIGHT 240 #define RZG2L_CRU_MAX_INPUT_HEIGHT 4095 =20 +enum rzg2l_csi2_pads { + RZG2L_CRU_IP_SINK =3D 0, + RZG2L_CRU_IP_SOURCE, +}; + /** * enum rzg2l_cru_dma_state - DMA states * @RZG2L_CRU_DMA_STOPPED: No operation in progress diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/= media/platform/renesas/rzg2l-cru/rzg2l-ip.c index 700d8b704689..aee7d4ba70b0 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -18,11 +18,6 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_for= mats[] =3D { { .code =3D MEDIA_BUS_FMT_UYVY8_1X16, .datatype =3D 0x1e, .bpp =3D 16 }, }; =20 -enum rzg2l_csi2_pads { - RZG2L_CRU_IP_SINK =3D 0, - RZG2L_CRU_IP_SOURCE, -}; - static const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned= int code) { unsigned int i; diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drive= rs/media/platform/renesas/rzg2l-cru/rzg2l-video.c index bbf4674f888d..7cd33eb1939c 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -433,12 +433,46 @@ void rzg2l_cru_stop_image_processing(struct rzg2l_cru= _dev *cru) spin_unlock_irqrestore(&cru->qlock, flags); } =20 +static int rzg2l_cru_get_virtual_channel(struct rzg2l_cru_dev *cru) +{ + struct v4l2_mbus_frame_desc fd =3D { }; + struct media_pad *remote_pad; + int ret; + + remote_pad =3D media_pad_remote_pad_unique(&cru->ip.pads[RZG2L_CRU_IP_SIN= K]); + ret =3D v4l2_subdev_call(cru->ip.remote, pad, get_frame_desc, remote_pad-= >index, &fd); + if (ret < 0 && ret !=3D -ENOIOCTLCMD) { + dev_err(cru->dev, "get_frame_desc failed on IP remote subdev\n"); + return ret; + } + /* If remote subdev does not implement .get_frame_desc default to VC0. */ + if (ret =3D=3D -ENOIOCTLCMD) + return 0; + + if (fd.type !=3D V4L2_MBUS_FRAME_DESC_TYPE_CSI2) { + dev_err(cru->dev, "get_frame_desc returned invalid bus type %d\n", fd.ty= pe); + return -EINVAL; + } + + if (!fd.num_entries) { + dev_err(cru->dev, "get_frame_desc returned zero entries\n"); + return -EINVAL; + } + + return fd.entry[0].bus.csi2.vc; +} + int rzg2l_cru_start_image_processing(struct rzg2l_cru_dev *cru) { struct v4l2_mbus_framefmt *fmt =3D rzg2l_cru_ip_get_src_fmt(cru); unsigned long flags; int ret; =20 + ret =3D rzg2l_cru_get_virtual_channel(cru); + if (ret < 0) + return ret; + cru->csi.channel =3D ret; + spin_lock_irqsave(&cru->qlock, flags); =20 /* Select a video input */ --=20 2.43.0