From patchwork Tue Oct 1 14:09:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818063 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 EBD761C6F46; Tue, 1 Oct 2024 14:09:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791780; cv=none; b=Qfe9A6+bosgBiWR4Y4Jcj5fsK+qSpSY0dntIuc7xCs4TyeDZfFEbofnQVGbu3ALToxvNfS4Ptf11ilemieQdpfA3sQqun7YyUQ7ipRvSqVFg8zrLFkiLJqqDxs/1njRKttg3kvGg4FNLFRiyXdEXE8TbYlHtvteHBn148tPcFnc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791780; c=relaxed/simple; bh=vhQNxQEiZziPlVYVNr7hvuLE9kKYD2yWi41dPJSaC/Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OAzAeNexLB97WZcg9xgN0eQuSzLmqk6uLljXT+8th0q77RDk/MyX1qugLuiHY9ez1wtWUQnleCUcGhVfKG4Lia3gN1TnYQiDNMaTkaJ+ubsc2fQEZv8BDrrJ15xr030aYHuXoJJwcgc990x8hYszRqxLBixTqGmHTF6SLQU4kSY= 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=hclKxNO8; arc=none smtp.client-ip=209.85.218.53 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="hclKxNO8" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a8a6d1766a7so23426366b.3; Tue, 01 Oct 2024 07:09:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791777; x=1728396577; 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=jP23dmPDc7uchDdpz9d4iXAGP0Fl5jTlXHnPXF10UuU=; b=hclKxNO8efn2xrmmkjqDs8pKVVSMl1z84I7fQIP1MyttHowRsVi/yGbj4M7iYlBzfk uyz1Mqle/6dhl1RXF9eZDAv5cfwbz+LV1pVTHh+u8D6n8CuefUPrkb4krVP41h5dsafV +a70c94yDr9g2aHLK2/yK4MD9UAd4CIjIWl2gqcf9AB+3ftNNNeRlutNcuaqEXv7pVVT UDGUg1K+onOM76TY0tixgGrpcrNc94TE7MGRtCrWzuuKE7iteSo4D8KnV8xgdpft1n5p wMoWvSTtGKKEnbeQ5JG/W5L5flDE33uTIqovNj15MlnvHV84KM9Sa+EUXhVr+ykI5a6y qHFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791777; x=1728396577; 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=jP23dmPDc7uchDdpz9d4iXAGP0Fl5jTlXHnPXF10UuU=; b=Qd0gNzTixiOtKnQzVy/9c/ilGI/i0gP/1XdCuv/1IQkmGpk/nytBJzoT/g6CWgl7ka Za2iT1KH3bHnlvLWuGQYpoddaTLTTTWh5cdABrru3hxLe/qqQ69I1NXKJOv8ZfBOLbQh 5izvCrKxj8ECb1K4+UbUnwQKf8i3B/mUVf5X7KLFVpKsS1401t7tCoXWU1rPCoIJXTIb PyYEcmz+73gorPh2Tz+B3CC7vEecJhbKkdIw0hYhlLZSTyfg2GJa90jKs+LL/4SzFSJI 6byfhTKnsgaX3+ssPajdH+vD/Ox7JDUI4trw11lgrQjo/jD5TNJIMKvmTELagkWoe43U DSng== X-Forwarded-Encrypted: i=1; AJvYcCXFyF7nQisPX/GR6Fv4c5Wd7A/KQFAD9SkK+wLVE2V2DygmzcixMJoNWNuKa37vRLXYLLVSavD6LtXHFFA=@vger.kernel.org, AJvYcCXKSc1mqoCvD/jWEYQmZL4ui6wZ699OI/37h95ZhwD1PZofWC7S9O0zrWtGPBVmo58vBt4QX5LGNInAGpxE/uQ93nk=@vger.kernel.org X-Gm-Message-State: AOJu0YxgG4ubpUZuUQkpGEKSd+IvVn2pTt3Nxx4kKAMaNjFodidwdBc3 h2mWx4OK7o+kv8BgKZVDD3MUAaEPfKcapbJN7j25nWdvjW7UADY6QGseBA== X-Google-Smtp-Source: AGHT+IHLHpzkxgRr5Lk9SQADo56gHqRczXItY9/v6x+FHIIZJqgVHmeP2xYFrFjpEKpNr5r5jmDxrg== X-Received: by 2002:a17:907:7e8c:b0:a86:9fbd:5168 with SMTP id a640c23a62f3a-a93c48f8877mr1653122966b.10.1727791776931; Tue, 01 Oct 2024 07:09:36 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:36 -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 Subject: [PATCH v3 01/17] media: rzg2l-cru: Use RZG2L_CRU_IP_SINK/SOURCE enum entries Date: Tue, 1 Oct 2024 15:09:03 +0100 Message-ID: <20241001140919.206139-2-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Use enum values (`RZG2L_CRU_IP_SINK` and `RZG2L_CRU_IP_SOURCE`) instead of hardcoded array indices. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - Updated subject line - Collected RB tag v1->v2 - New patch --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index ac8ebae4ed07..9f0ea1de50da 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -217,8 +217,8 @@ int rzg2l_cru_ip_subdev_register(struct rzg2l_cru_dev *cru) ip->subdev.entity.function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER; ip->subdev.entity.ops = &rzg2l_cru_ip_entity_ops; - ip->pads[0].flags = MEDIA_PAD_FL_SINK; - ip->pads[1].flags = MEDIA_PAD_FL_SOURCE; + ip->pads[RZG2L_CRU_IP_SINK].flags = MEDIA_PAD_FL_SINK; + ip->pads[RZG2L_CRU_IP_SOURCE].flags = MEDIA_PAD_FL_SOURCE; ret = media_entity_pads_init(&ip->subdev.entity, 2, ip->pads); if (ret) From patchwork Tue Oct 1 14:09:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818064 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 5F5221C6F6D; Tue, 1 Oct 2024 14:09:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791783; cv=none; b=LNDY338mG1V1FCicB7kXIyRXCsgXKrlZWQaKq6GUELg1CXhs8jyVlivG8idd6XCe+5upejQAQ+rTWHZgSDEF+YfUCkVZ6G5wV0ZMR9IzgQxw15OfdIQ8o2ywZe8APkYanJvYVM7Zis5eQSS7qWlviMpSuaXA674huCtpUx34axw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791783; c=relaxed/simple; bh=17XOngcZ2uXGlh65ZO1mcJYxR1kSWX99gHpZSQNi+ro=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n+4UDs04R9KhypjfUj3tw73YiRvQ/8ImocjsxZW2cRQkT9rJwcK1j9eFAqUCy+cwahTlmPDmynqTaSw3a5CSXK/6c2aep7JWZWuNZpMQVzCfrRSV9qKAFO2c6jc7PBPO6N+tMi2N9FiwUk094+BepQBKWoEOQpEdeNEDoHDlGAo= 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=YjzRbZdI; arc=none smtp.client-ip=209.85.218.46 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="YjzRbZdI" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a8d43657255so57132066b.0; Tue, 01 Oct 2024 07:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791779; x=1728396579; 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=j4o3ygLjGHGZxajheOBKFoAIXpSBd6wFmLueJRnOZSo=; b=YjzRbZdIM1mGFcSalGXsaUQ1VQU0qTtLLJWLhIDRzMJhz7E5UhBI5EpC7GO9uoXSkh cMvaGcY9aTaDDVulTs2vKwVwqvtMr5M3iYnlQHxThiqrihHCAyqyP0Ll0ZL1TGA+rxW4 ZF13eoWE09lOACJAvx5vH9aP4RFBRG42bDQYYyv7dGCrjk2ajLacijdoHChN36mwA28w sr1MHbFZVfP2pJmDt4mnDMzNwt8ta4r1PEylCpzcMm+cV8LLpaNNplNw1A7gh1q50RqI 6lSEn5EfafdLpt5WMj1C4OG76nkW2DupD8szwFuu57yJO332nXY8RkVI3/xCvLZyk0yQ VrWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791779; x=1728396579; 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=j4o3ygLjGHGZxajheOBKFoAIXpSBd6wFmLueJRnOZSo=; b=wcwtaE0SVZAm9MPSj5qR72MDl3EFckBI1o5LfW15xy/iyoUSuOia+ZjsJxpYRS0s3v 8Os6Yo+RKgtjSBMtq9An8zDKC3Eke8cw+uihnwiSX+mAFiFrb1ut9JwjoyoIm9/yDdK2 ENnaMKwxt8xUz9qQjkwEhV/Np0MgdvIX4NfrYgLCiX+yOAM7k7+eJQkFtP4ZOiYz66HB fccqYqmjlNpxO8BidAei/NRW2uu203dX5+eN5LSE7g2wo+BzhGaztxnFEnjbNnMwTJjW tg0Jgp708QRau7qISBDZjhFCNtpcM1Vt1K/OsmAhyG+DwSk3Q2MgofqIQBgt9r5J5wH+ lAoA== X-Forwarded-Encrypted: i=1; AJvYcCU9tAOJUjs1pJlXZ4Uy66HooDerV4zKGxgkV1+ZvCiN0XfEmOVl8DF8lprzI75MnZr1nUVB1i/kb8haOYo/9SvQi7w=@vger.kernel.org, AJvYcCUiYmYmc/VH44YSLwFPm0iqksqXq/0IAVB25WxQQIjCVXHcFG8660U/MdSAALI/vXP2udTLGr4zgXj7IvI=@vger.kernel.org X-Gm-Message-State: AOJu0Yx1za/S0qUwJqJoEhvNNEUIqlasDnnCagEdr4r8h4i3yCUegW7E 6TAQjuavgUuel417HOEJAnTuNdAnMsz4bbA+09fgeMxp7NKw8G5W X-Google-Smtp-Source: AGHT+IGxO8XElrrFKkSpquWw6huInLzB8f5GrfUqgAB8sQJzXpeJKAeRzZTGQuYJSEbIl7uJtpMU5Q== X-Received: by 2002:a17:907:7e8a:b0:a8a:8dd1:b2d1 with SMTP id a640c23a62f3a-a93c4aa4640mr1272893366b.55.1727791779224; Tue, 01 Oct 2024 07:09:39 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:37 -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 Subject: [PATCH v3 02/17] media: rzg2l-cru: Mark sink and source pad with MUST_CONNECT flag Date: Tue, 1 Oct 2024 15:09:04 +0100 Message-ID: <20241001140919.206139-3-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Mark the sink and source pad with the MEDIA_PAD_FL_MUST_CONNECT flag to ensure pipeline validation fails if it is not connected. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - Updated subject line and commit message - Added MUST_CONNECT flag for source pad - Collected RB tag v1->v2 - New patch --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c | 2 +- drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c index 19e0ba9596c9..69cd45b26951 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c @@ -209,7 +209,7 @@ static int rzg2l_cru_media_init(struct rzg2l_cru_dev *cru) const struct of_device_id *match; int ret; - cru->pad.flags = MEDIA_PAD_FL_SINK; + cru->pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT; ret = media_entity_pads_init(&cru->vdev.entity, 1, &cru->pad); if (ret) return ret; diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index 9f0ea1de50da..700d8b704689 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -217,8 +217,10 @@ int rzg2l_cru_ip_subdev_register(struct rzg2l_cru_dev *cru) ip->subdev.entity.function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER; ip->subdev.entity.ops = &rzg2l_cru_ip_entity_ops; - ip->pads[RZG2L_CRU_IP_SINK].flags = MEDIA_PAD_FL_SINK; - ip->pads[RZG2L_CRU_IP_SOURCE].flags = MEDIA_PAD_FL_SOURCE; + ip->pads[RZG2L_CRU_IP_SINK].flags = MEDIA_PAD_FL_SINK | + MEDIA_PAD_FL_MUST_CONNECT; + ip->pads[RZG2L_CRU_IP_SOURCE].flags = MEDIA_PAD_FL_SOURCE | + MEDIA_PAD_FL_MUST_CONNECT; ret = media_entity_pads_init(&ip->subdev.entity, 2, ip->pads); if (ret) From patchwork Tue Oct 1 14:09:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818065 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (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 178061C6F78; Tue, 1 Oct 2024 14:09:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791783; cv=none; b=nC1P9LqABcT/H5NVf59HdiabgaBQYBqhgZ3+xx8IOyxNcUpfH0IRGtnjL2AmdFYbAgAP3ieRZSO7AVa37IX60X8gBP1Gg4AWmBDa/QL34EHWWgMv7ZnBjWnJzvGmnWuHpQWN72lvqqYqCJcaJfOEaAgCXcjNUW3xOqkmb+8fWD0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791783; c=relaxed/simple; bh=i638chX4bzpdrjrtX+G7IudMVW3kXRsVe+5mbVnrsDc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SOWN85w2rnw1ObP5stsGQrwhkCaLPewT9ymNrPGr2kCqADLD6Qj9yySMvANTTvJ3HW4vwm2n2fIBfVUNAVzTbbZ2Bc0w6QtEUQagU6kPLEyh+yxmKdIhmJWuxMGEAI3cf/niIqAkvzUwQeEjTbCLDRRJxEeGDpEbasXRZQ39t14= 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=Hvg2tBxb; arc=none smtp.client-ip=209.85.218.49 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="Hvg2tBxb" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a8d56155f51so715805466b.2; Tue, 01 Oct 2024 07:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791780; x=1728396580; 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=iMYCeT1AvyrWAGQYfjzize1dyUeK7Njlfbuu15Mx25c=; b=Hvg2tBxb5uQTrnMeie3LijXSEWSrPCt1wdDRMWlLlMIpLhYfw/koRs2FZOcIFpoqw5 RJp/Kp08jD5VgLyXneNBQFeLPmhWjtDKFwfWIN9em6ZX1Hz0FRqsVS+iRdDtG+sBC9gB 1ycrgFh4KzjgmfVrTSHIAyVQk4H1HvyHDVp5ELNVxLsL/F/O3vFxp61qnQeHLtmSdSrr LSqkpFX6X4vIdfJxUQCdrg0YMqRC8BbLlqu6FyxV0RQn51POlbNHiE4RmvKwS+yzAmJB tnKyaGL4Rre5bfTFfuINbKOuPpNnopySUA3/G9SFLgwGP9aAQMYcqqtq3zuvn5JiY+mk tESA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791780; x=1728396580; 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=iMYCeT1AvyrWAGQYfjzize1dyUeK7Njlfbuu15Mx25c=; b=Xbrc6hvrlIvCee6ebaY81+XabJM2E0L+hup+yKUawBmufZV09ug2aUBHvgWMiXjxPU 4Ok/nNhWIoghuMcZ0dvA1GfcG5mNo2ZJH5zfliWvFPSo15xQDyFMfIlU8KzfZi9H5cVQ 6+CkyOnk6jWjvKVmXCWK/wT9IflrmkIzCETNbLDvwotqJpdU6X4Mjmean+WAsU8CFgy4 yn4ggusIX18cAdiGiOJXTauMJolZbaf4hmHctpA6a0v9BySeQzKTmRnHXAxOYkZQAFiR l03+qiItq7k3KajP9GjcLpyZRl5MbHvNOphszswUFdoM38I/1/2a8/MAx3H9lMBpYS3m gk5w== X-Forwarded-Encrypted: i=1; AJvYcCVBrwPkXVbBhzpuaAVgPH6XDCYWp4yoWP1LxzC5UPHfNmXHlY+5nTzjmu185YeIY9vkaw/3MVx+6euCimc=@vger.kernel.org, AJvYcCXopAxFscNZ4hx7+3zSFhiENtKeMQrHr4gZ5YsIb1kGlQ3Eo+RFb6xHDGvyNBQnz1CDu/b86ZVd7EETCLF+mRyM4Fo=@vger.kernel.org X-Gm-Message-State: AOJu0Yyyydygk/0Y5PdjCIzHPJX4IwWmfjWqNarVulUXYj2yV7KO2OMt 8a+N5HY2APvF1FqgXhNbvIsmQCi1TapKgHlrE7hSkUPW2sHauisB X-Google-Smtp-Source: AGHT+IGl4J1n/+IxJ+EK+VfOfS//lCvGkYN21hBBR14/fibuWFgzqpZj1S0Wivm3Ea2QX1VwNUcwfQ== X-Received: by 2002:a17:906:478c:b0:a8a:86a9:d6e2 with SMTP id a640c23a62f3a-a93c497029bmr1738501266b.37.1727791780346; Tue, 01 Oct 2024 07:09:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:39 -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 Subject: [PATCH v3 03/17] media: rzg2l-cru: csi2: Mark sink and source pad with MUST_CONNECT flag Date: Tue, 1 Oct 2024 15:09:05 +0100 Message-ID: <20241001140919.206139-4-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Mark the sink and source pad with the MEDIA_PAD_FL_MUST_CONNECT flag to ensure pipeline validation fails if it is not connected. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - Updated subject line and commit message - Collected RB tag v1->v2 - New patch --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c index c7fdee347ac8..2f4c87ede8bf 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c @@ -795,13 +795,15 @@ static int rzg2l_csi2_probe(struct platform_device *pdev) csi2->subdev.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE; csi2->subdev.entity.ops = &rzg2l_csi2_entity_ops; - csi2->pads[RZG2L_CSI2_SINK].flags = MEDIA_PAD_FL_SINK; + csi2->pads[RZG2L_CSI2_SINK].flags = MEDIA_PAD_FL_SINK | + MEDIA_PAD_FL_MUST_CONNECT; /* * TODO: RZ/G2L CSI2 supports 4 virtual channels, as virtual * channels should be implemented by streams API which is under * development lets hardcode to VC0 for now. */ - csi2->pads[RZG2L_CSI2_SOURCE].flags = MEDIA_PAD_FL_SOURCE; + csi2->pads[RZG2L_CSI2_SOURCE].flags = MEDIA_PAD_FL_SOURCE | + MEDIA_PAD_FL_MUST_CONNECT; ret = media_entity_pads_init(&csi2->subdev.entity, 2, csi2->pads); if (ret) goto error_pm; From patchwork Tue Oct 1 14:09:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818066 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (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 BB20C1C7B7B; Tue, 1 Oct 2024 14:09:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791785; cv=none; b=a7ps8raWpwp0BNHsI0VEXeDdjiEX3UTf8Y6AkIPJFDkvutKY+5S2Cx93tvAy8BXz7MJpyxPZZQbcxvnzEaOzE5eTseVsUN93mF10BD8x5/XTffG1fUGrYiYovR4BIlEnVR7gEl6JQUttb0IkT6d5mymGctw3NNv84ZdOWrbnq8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791785; c=relaxed/simple; bh=IC/LZfAnrhCzteBL/JVZfCR5DtHkL8XMZU5DAXdQQQg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZhEn+9QF9SiB3s/roRNvKPbVNVe5SiBIEzSozijwJSh6PPjAoQX+qrtllGPXwjFcUQoMxUEw7MQg0SgJstqUAcRsgqSgfQ5wvv1r2dyx4ZziSJblDF+ZGjhIzAA8sBp50PoSKhFvEyXaueWaIOFMBw1Gh/UCp3FjjP8/Ye9waC4= 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=XT8ACy6x; arc=none smtp.client-ip=209.85.218.54 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="XT8ACy6x" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a7a843bef98so811037866b.2; Tue, 01 Oct 2024 07:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791782; x=1728396582; 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=l09FKGIUDUQUQ1PCZi8BYukjjtT4r5+g6zu1hVrAAhs=; b=XT8ACy6x1jjmZRUjr6eSCx61qm7PJ2kg8Jhs+O2hrk9LEDzfJW8ehthnsLXVeJ8xEJ WiBq9dpaRiwf3LKTJrASFK29Hhm/P3JICvbUxcHOnmYRV1KsDK1Y1Mbklzt4O9/960IS MPFb/IYnZCIXvtfo0DTl1nDh5/ln8jBKa3HuQcEI6Q3AHl5cJyuU/iYZPBULEVW9wW6h uoy+uuratjZ89r9vCofIEua2eydDoAvN33Ct4cZrapUGbY6G/wrTS4H+r35vp9gWw4Mz +nVDSFOwpzIduRwyt2HNBsriMMOnKUcuf/fXWgdORnb0vs6WxcBX1fA3X4mmZISbwDJB XEIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791782; x=1728396582; 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=l09FKGIUDUQUQ1PCZi8BYukjjtT4r5+g6zu1hVrAAhs=; b=sKW4/XPoIR2YeNxWWnZZH/Ve4jO8ZzLZLxyYxWXkVXw/Ioa5hKpq1rQux15pdMWhnp TaTDf1pjeuXtbzaGJHOxCraCNMEmo5B4PTdphnp+nfapvQukIJXVRBnUp9ER1hkbtNd2 aZAHr1i5w2UqNwgYd2sIxyOrYjiocNX66WTZYOy6nVFbH3L86NIY4Xy6qrX19urWNjzH UcI72VFqDqIdDiM68vttr9FO+hKh9JR2BU3jJAEWE+g0mcAue2Mh234zCrsg+eLrgjtT u6YG7coMTXXGUL64tz/l3rVQXDYJiNJ0kpngJ3GWNOm9ou2CpnFcO4vKJAjQmboWM3VV iXOA== X-Forwarded-Encrypted: i=1; AJvYcCUsgzYbOTwRQ3peBfa7XQGAZwdvCVtQjbn5qneB8uHhJyML4JWM8buqCrgpv+Qpd/fwwUbGUSmgU5LjeqW9OBDXV44=@vger.kernel.org, AJvYcCVmOx6+Hf97hu+H2j0uH4E59VhYmIlm60zruY/ZbYbgkkKDArwLUhwI6POF3NcOR/7ydbPtOVynbv5/N5Q=@vger.kernel.org X-Gm-Message-State: AOJu0YzfgaIMWoXJayWgSCg8jrqZbpohFFOuVT60QzScyImZz/LZ+80L caJmpb5h/CAckTB4ELSMrdSKTMjKwUhNbRVyRhSbJLZ8usQ4eRf0 X-Google-Smtp-Source: AGHT+IFezicmYgzToP8hqKWoeXBkFMT2g++0/EQCS/K6bAMJjfNxNI5L3xMdiIzec/sHoZYhHRw8iQ== X-Received: by 2002:a17:907:eac:b0:a86:7199:af37 with SMTP id a640c23a62f3a-a93c4aca8d9mr1931386466b.58.1727791781794; Tue, 01 Oct 2024 07:09:41 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:40 -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 Subject: [PATCH v3 04/17] media: rzg2l-cru: csi2: Use ARRAY_SIZE() in media_entity_pads_init() Date: Tue, 1 Oct 2024 15:09:06 +0100 Message-ID: <20241001140919.206139-5-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar The media_entity_pads_init() function was previously hardcoded to use a magic number for the number of pads. Replace the magic number with the ARRAY_SIZE() macro to determine the number of pads dynamically. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - Updated subject line and commit message - Used ARRAY_SIZE() instead of NR_OF_RZG2L_CSI2_PAD - Collected RB tag v1->v2 - New patch --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c index 2f4c87ede8bf..abacf53b944c 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c @@ -804,7 +804,8 @@ static int rzg2l_csi2_probe(struct platform_device *pdev) */ csi2->pads[RZG2L_CSI2_SOURCE].flags = MEDIA_PAD_FL_SOURCE | MEDIA_PAD_FL_MUST_CONNECT; - ret = media_entity_pads_init(&csi2->subdev.entity, 2, csi2->pads); + ret = media_entity_pads_init(&csi2->subdev.entity, ARRAY_SIZE(csi2->pads), + csi2->pads); if (ret) goto error_pm; From patchwork Tue Oct 1 14:09:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818067 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 17BF31C7B9B; Tue, 1 Oct 2024 14:09:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791786; cv=none; b=cHTC6zRnrsvFKoGx+fvbprkMxdFdz1C5NdvnwaPBoY9wOQkeVLarH5f77VQ+v/jKmbEhMr32UzFyNDSREyYME5g8HNdAjsWh8ggl36PkEDAJVfdmkITV/wukboEFhLQd+lSwonXWdMI3j/4XA8Gns5mWLjC/LDJ9wL6oamxnw/4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791786; c=relaxed/simple; bh=DZ2oDmuwI7hYxiKfPRUwRYrBIbzfhMpyhql1cNQ2+nc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S7IUIJo37ls8X+B7m18qT6vidaYEPl7raaWGo1uSJdavw5AaCeZGtG/XSqiVmFaXqQCX0LHIg/b6QShLLktXIt8MWKs8RC+06AIlRRLSscRgStaaXw6oE5on9vC44Mw/So2ekjU7bFSOORX2PWAYWTaSOiAbzEXnWCfjZuR5068= 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=QwY/xclO; arc=none smtp.client-ip=209.85.218.52 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="QwY/xclO" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a8d100e9ce0so561472966b.2; Tue, 01 Oct 2024 07:09:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791783; x=1728396583; 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=muRK2X87JJfmoVnt459RleLccdudc3zUouvnu3+u/Og=; b=QwY/xclOduNPC5CXaojh2XY6MZY7Dhmw1gdKW5mD2+D22jG2NEdN6KSt6UNvLpHPUj qERWD3jeBPRJRmMCvBi3nR56t6uxvbDh8OHyTqhYkPLKsqE0uoXQMje7OHgKE07w37TP EhCS0XL8m1MSN/Qa1Kc5qyZmgs1BmXT/C2noGUrKKWJRIl5naTqIYjSZchJ6Uy8xbVS+ FENn/BCd6lEd/IyF1vvjHGFuHRFozDpySl52TkpUZQb1pGZitlzgvh8n48oBeZMb1UK9 e8MnOzZchn8L2pVYxlbneb0ZUtravN+Uc1ChIYhrReYBOPfGkdnFL7nyGWWsh67tvD+U yXpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791783; x=1728396583; 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=muRK2X87JJfmoVnt459RleLccdudc3zUouvnu3+u/Og=; b=QUMQ6D4LPiB0LAZUjWNkXwowLjV04amVid/ZGzX4mDwLGzkNCkKuZvAGrn0E8V+lAG rki3CxmPZedXUcYrVHPAzclZzhRRJ2c7PZcY6ET+wWzSZnmcf77V3On6td8oyYnQn0XQ 8P0W2k9LtruMTJBzesuNqD6+S/hecVx6i8m0ncEitXmvdPSICRe1l4wUVpBaDu3W2QaA bO5PvXX2X8PFCM4OonZHguxyqU0Pm+JcmwsdnS6vug0iVDFWtFPB1CVLgOtzGhIaHnJL xu0svVyKMSQPKNkHWWA4SmjtkAkHOtv/5Z6Z+NWfg95HDLf/G+yRl70PrdW7w1LjroJT foMA== X-Forwarded-Encrypted: i=1; AJvYcCU48C2O2Q+8AAPMYaJxaNkp0zrojZvIlRhjLIF4HpTlsylqOCaRz7t+NweUUlscu8qVQGt1JxbUSAJqO6k=@vger.kernel.org, AJvYcCWNlupl8W7Hl0h0G52Q9XK4DMVvZW0r0BMW9jhl+ze+2hU/HgcqWRhBhySPZszA+W8xJzIfyyqr+q3rykwspmBS3/Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yz6ClH+9HIDnx/ptaO28rolAieEUWYxxZG3rkhElFMQUdLgyZYi RU5R1m+SFIlkPzUqJIucGN5IyWnJSlg38a/BXuSuikyE7GgOl+gh X-Google-Smtp-Source: AGHT+IHVnv0suj9V1OXSgJyN+Zj+xbbE6DlB5uRgtFOQbjJdiW+PI22Bbr0HyA9cHoyvX+iWBAZLEQ== X-Received: by 2002:a17:907:7203:b0:a86:8e3d:86e2 with SMTP id a640c23a62f3a-a93c48f6d4dmr1892253466b.11.1727791783111; Tue, 01 Oct 2024 07:09:43 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:42 -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 05/17] media: rzg2l-cru: csi2: Implement .get_frame_desc() Date: Tue, 1 Oct 2024 15:09:07 +0100 Message-ID: <20241001140919.206139-6-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar The RZ/G2L CRU requires information about which VCx to process data from, among the four available VCs. To obtain this information, the .get_frame_desc() routine is implemented. This routine, in turn, calls .get_frame_desc() on the remote sensor connected to the CSI2 bridge. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - Updated subject line v1->v2 - Collected RB tag --- .../platform/renesas/rzg2l-cru/rzg2l-csi2.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c index abacf53b944c..3fd0be6a3b65 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c @@ -582,6 +582,25 @@ static int rzg2l_csi2_enum_frame_size(struct v4l2_subdev *sd, return 0; } +static int rzg2l_csi2_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, + struct v4l2_mbus_frame_desc *fd) +{ + struct rzg2l_csi2 *csi2 = sd_to_csi2(sd); + struct media_pad *remote_pad; + + if (!csi2->remote_source) + return -ENODEV; + + remote_pad = media_pad_remote_pad_unique(&csi2->pads[RZG2L_CSI2_SINK]); + if (IS_ERR(remote_pad)) { + dev_err(csi2->dev, "can't get source pad of %s (%ld)\n", + csi2->remote_source->name, PTR_ERR(remote_pad)); + return PTR_ERR(remote_pad); + } + return v4l2_subdev_call(csi2->remote_source, pad, get_frame_desc, + remote_pad->index, fd); +} + static const struct v4l2_subdev_video_ops rzg2l_csi2_video_ops = { .s_stream = rzg2l_csi2_s_stream, .pre_streamon = rzg2l_csi2_pre_streamon, @@ -593,6 +612,7 @@ static const struct v4l2_subdev_pad_ops rzg2l_csi2_pad_ops = { .enum_frame_size = rzg2l_csi2_enum_frame_size, .set_fmt = rzg2l_csi2_set_format, .get_fmt = v4l2_subdev_get_fmt, + .get_frame_desc = rzg2l_csi2_get_frame_desc, }; static const struct v4l2_subdev_ops rzg2l_csi2_subdev_ops = { From patchwork Tue Oct 1 14:09:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818068 X-Patchwork-Delegate: kieran@bingham.xyz 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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 +enum rzg2l_csi2_pads { + RZG2L_CRU_IP_SINK = 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_formats[] = { { .code = MEDIA_BUS_FMT_UYVY8_1X16, .datatype = 0x1e, .bpp = 16 }, }; -enum rzg2l_csi2_pads { - RZG2L_CRU_IP_SINK = 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/drivers/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); } +static int rzg2l_cru_get_virtual_channel(struct rzg2l_cru_dev *cru) +{ + struct v4l2_mbus_frame_desc fd = { }; + struct media_pad *remote_pad; + int ret; + + remote_pad = media_pad_remote_pad_unique(&cru->ip.pads[RZG2L_CRU_IP_SINK]); + ret = v4l2_subdev_call(cru->ip.remote, pad, get_frame_desc, remote_pad->index, &fd); + if (ret < 0 && ret != -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 == -ENOIOCTLCMD) + return 0; + + if (fd.type != V4L2_MBUS_FRAME_DESC_TYPE_CSI2) { + dev_err(cru->dev, "get_frame_desc returned invalid bus type %d\n", fd.type); + 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 = rzg2l_cru_ip_get_src_fmt(cru); unsigned long flags; int ret; + ret = rzg2l_cru_get_virtual_channel(cru); + if (ret < 0) + return ret; + cru->csi.channel = ret; + spin_lock_irqsave(&cru->qlock, flags); /* Select a video input */ From patchwork Tue Oct 1 14:09:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818069 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (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 4B6B41C6F78; Tue, 1 Oct 2024 14:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791789; cv=none; b=K1OKvK9o22vKkGom6Aqq+XsSW+fn+R8J/mOy5nwtShfEl2ZGw3hnvl8EQAZ7RdmP/24LUHStSdq465zI/mwcUX3RVLHPs4T+mwuNtN+F4zvQR3emcqZtyCbTDDo13y2fsW/ThpHMqXN8ZKiVcjqwwJiYgyQANVuBcwulE+Jhzuk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791789; c=relaxed/simple; bh=cvqrPU5OTC8zbfImMPZ7mExotQB/ObnIKlVx6ZeVb1k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TqJVSDamQHdkkTghsnR8H5nBIiIR/jZ1KMuS/5iz8hl7eke3rKK4EJ4fH5r4q+4e2mPSl0yZxUCsBozPd1Y0QZTsw9dp1bQI0/xngWTABy7GgEq1ZQz0mMbaF6UWY+ZPhl22h4PPHI+4EM1W5+6+YzaEiM+K5Zmtv9ZALZWrgJY= 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=nkpVpGZz; arc=none smtp.client-ip=209.85.218.44 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="nkpVpGZz" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a8d446adf6eso58934166b.2; Tue, 01 Oct 2024 07:09:47 -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=nkSD3jPZKaudZBN97A8tmazlp8/g3UW7C7H7/xfun7s=; b=nkpVpGZzXlz5kgTYSbLqowRJTdkbrY+uEHlo/cjYD22je1sh5G0vRyr1hbxpNRy/Qi B0lUb/3mXZ7kM5yCfUMOQP2/AblQJxkTOpTFHXpTxfttk1wIekl3qBPsocPhVCjZvkcs cWVpoPm4jovB5UeshE45vy729S0P+zDm+x2psTV96mH5bHrJ3UOCmoxvwdo05lzOjsDZ nO62PHZOkKo3lkJwF8OKtjK5ZNkXkdQOEp38UW/d2q7ec4EI7+ZriGvLGT2ly5KeI8tG UD5/nGiQs4wor0lY+/jlhR3sU+osSJjfJVRJeT3Z+5nFYqKXxbTxP9yulJvQcYF9sD6g UqIA== 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=nkSD3jPZKaudZBN97A8tmazlp8/g3UW7C7H7/xfun7s=; b=ffIrJbH4BJ/pERCLb1VznTo7cY1vfrWFbWDgt0eEQsBQDmQM3GPXr9pW9pXuu67s6l XKUWAo1MKmHghXdWpQeGYPhsynEJc7krm7yPPsrf1Kv3MqskDAXfeSpUzIIi9CqHxZjq tlxyzpDRETpZFzUyZQzCPEx1IngoClj7RPjtmODTZrT3RIK9QDfKptOeWDaBaurAdBIq xWfQ9xtU1qQJ6PCn62kWJ9GjPUTx5CSpq+9SYO8VcS/GAvq9nkcdHzCt7W67jZ9tGcWg 09jmIX2RjN3EPJYb5ebZJEEuFZ8Zwt00Dmv1Xo/DTJv9NeksF2P89c4+ANXtoNDRR4mb B+qg== X-Forwarded-Encrypted: i=1; AJvYcCVZnK41siaOhrzCNqAO6odkFwRVqLSamsDvuejUsT95hKi2E8YFiU03g/l2iE7KjFhfE0y3y9cb/o1BcD9w4D47qao=@vger.kernel.org, AJvYcCWLJEqIkeZCmTfGGhlxBB5C2AH3mzMPUsw4Rwfw8l4VaY9U8twb6BbR+xp3Jq/vGMk/agVJQyFdRnFAICM=@vger.kernel.org X-Gm-Message-State: AOJu0Yzi6SEu0Kq7lMAB3T29jzjzuLsCbQme/SI/J2TF2Hi2B++zx1Nz Ds7cJegH/zz8VZq85qDDEouSGqjk6HWaC6V+Rwqh8sT2FaVXhbqi X-Google-Smtp-Source: AGHT+IGEQjI1UCxy4qdcMtP5RUdzj3xESv22ABqrWJ22tgW9Tauvqr+RfvSBIDaW8p/oDHZuCLjpgg== X-Received: by 2002:a17:907:1ca2:b0:a8a:86f8:4eed with SMTP id a640c23a62f3a-a93c48e8e1fmr1851900566b.10.1727791785289; Tue, 01 Oct 2024 07:09:45 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:44 -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 Subject: [PATCH v3 07/17] media: rzg2l-cru: Remove `channel` member from `struct rzg2l_cru_csi` Date: Tue, 1 Oct 2024 15:09:09 +0100 Message-ID: <20241001140919.206139-8-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Remove the CSI virtual channel number from `struct rzg2l_cru_csi`. Instead, pass the CSI virtual channel number as an argument to `rzg2l_cru_csi2_setup()`. Suggested-by: Laurent Pinchart Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - Updated subject line - Collected RB tag v1->v2 - New patch --- .../media/platform/renesas/rzg2l-cru/rzg2l-core.c | 1 - .../media/platform/renesas/rzg2l-cru/rzg2l-cru.h | 1 - .../media/platform/renesas/rzg2l-cru/rzg2l-video.c | 14 ++++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c index 69cd45b26951..b21a66e2ce5c 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c @@ -72,7 +72,6 @@ static int rzg2l_cru_group_notify_complete(struct v4l2_async_notifier *notifier) source->name, sink->name); return ret; } - cru->csi.channel = 0; cru->ip.remote = cru->csi.subdev; /* Create media device link between CRU IP <-> CRU OUTPUT */ diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h index 8fbd45c43763..4fe24bdde5b2 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h @@ -53,7 +53,6 @@ enum rzg2l_cru_dma_state { struct rzg2l_cru_csi { struct v4l2_async_connection *asd; struct v4l2_subdev *subdev; - u32 channel; }; struct rzg2l_cru_ip { diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index 7cd33eb1939c..9ab7ef33c9da 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -301,7 +301,7 @@ static void rzg2l_cru_initialize_axi(struct rzg2l_cru_dev *cru) } static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru, bool *input_is_yuv, - struct v4l2_mbus_framefmt *ip_sd_fmt) + struct v4l2_mbus_framefmt *ip_sd_fmt, u8 csi_vc) { u32 icnmc; @@ -319,19 +319,20 @@ static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru, bool *input_is_yuv, icnmc |= (rzg2l_cru_read(cru, ICnMC) & ~ICnMC_INF_MASK); /* Set virtual channel CSI2 */ - icnmc |= ICnMC_VCSEL(cru->csi.channel); + icnmc |= ICnMC_VCSEL(csi_vc); rzg2l_cru_write(cru, ICnMC, icnmc); } static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru, - struct v4l2_mbus_framefmt *ip_sd_fmt) + struct v4l2_mbus_framefmt *ip_sd_fmt, + u8 csi_vc) { bool output_is_yuv = false; bool input_is_yuv = false; u32 icndmr; - rzg2l_cru_csi2_setup(cru, &input_is_yuv, ip_sd_fmt); + rzg2l_cru_csi2_setup(cru, &input_is_yuv, ip_sd_fmt, csi_vc); /* Output format */ switch (cru->format.pixelformat) { @@ -466,12 +467,13 @@ int rzg2l_cru_start_image_processing(struct rzg2l_cru_dev *cru) { struct v4l2_mbus_framefmt *fmt = rzg2l_cru_ip_get_src_fmt(cru); unsigned long flags; + u8 csi_vc; int ret; ret = rzg2l_cru_get_virtual_channel(cru); if (ret < 0) return ret; - cru->csi.channel = ret; + csi_vc = ret; spin_lock_irqsave(&cru->qlock, flags); @@ -489,7 +491,7 @@ int rzg2l_cru_start_image_processing(struct rzg2l_cru_dev *cru) rzg2l_cru_initialize_axi(cru); /* Initialize image convert */ - ret = rzg2l_cru_initialize_image_conv(cru, fmt); + ret = rzg2l_cru_initialize_image_conv(cru, fmt, csi_vc); if (ret) { spin_unlock_irqrestore(&cru->qlock, flags); return ret; From patchwork Tue Oct 1 14:09:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818070 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (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 25F471C9B69; Tue, 1 Oct 2024 14:09:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791789; cv=none; b=ZurYK+TlIsV9g+N0FQSz+SY6tZDblzz0VC2FJMT2Wg+/ZgiElqjhx/YjWqqjZPtViVYRgsa+JoiTvBMOQu4qFtit7uHnmCI0ijXWAvGEUZyCZEGGCI6PNLHzClzfXUcNkaJL8sMxAhltYChwHqLpvwTubfL0XjW7NN+3rKAih7g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791789; c=relaxed/simple; bh=c9vX15A31VpiTtvs4AN6ElEuVWXO4KreviWo3f3fyf4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tIB8faC0lsFvyACYF62Wp4lPP5nrRX81u8unkXxEsWzFX0GAn9wOcv6oYylefnZN/myLCF6ya+N5oTRy0d4u4W2WprWaclrK+sw3uKQ5oHKECDhfDzaezX+mqYkTUqmmh9tU5663kA6pUDEe4gMF1/ORzGb5P1rbREuHjfRSv+Y= 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=RoXYj9bt; arc=none smtp.client-ip=209.85.218.49 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="RoXYj9bt" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a8ce5db8668so969775766b.1; Tue, 01 Oct 2024 07:09:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791786; x=1728396586; 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=lx1ETSedcsd+vrLUvhKjry54pz5h22KPwWnuNfi33ow=; b=RoXYj9btb95jz1wsM4TTHjZ4jJSrSjt2aUunC13AOwEluzv7cJmdZYsAZeuJhxb6sn GksqlIbFC5L9hCYU6s3ECtbBJW4APWwepinAmWIynzsJ4zB0aqtCddq2Eac48zdcsjuq XlJW1GdWUuKtAHdH0kSgv6gCu/f39iozgojAS/ioFZmS4j07uPW0bpg7/Hgfa3TcqU2n PSkr2nv3qH+Gqx0KTMr6qjmBA5kHg1GjhLi90sVcB45H3KTmSI9W50X2DVxxQ6YJEXvt yAxrKNRrOyfxyi48VJnTxc1hWBKujksTg7Uk6HA8zNLG1HuYZIhBWgWG1vVT41RRiCDW h+VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791786; x=1728396586; 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=lx1ETSedcsd+vrLUvhKjry54pz5h22KPwWnuNfi33ow=; b=B0gURfq/fGseD6QzLY0AwFml9c2mbgy9gwzCXF8nRzrJY0SfUilCk1oCYaPpuqkNDq C47p3lZALm0W9tsH3yV/omB5DgSXh5iAoKPCZdZzuJsYC6LKjLFgsgfVpLh+nitA9Z+U Olea4Y32FWE1cH/8sxry+Fn+b06NiXYedT9a5DI0sEpJ3sDIwIoJbJC6R5tfXoJMZDBF Q38h79CdUfSZXZkrKLyk3IlVOjQYn1VrsNb89GDwxX2AqmNX6dV7Jv6nh2vjPoDC5tzC IE7Js9joXQAARXoKwfJWBL81sSt0cahgtOAIbhrzp3HrM89VQBbe+NdSvOC/O9SAJA9C /5nQ== X-Forwarded-Encrypted: i=1; AJvYcCWBTJTgcgOdy4mZ0h4uRahG3ULBzdobWgSRG87Mmp5rYODB7KICVS3/xdoSb+Dm/kkenPjXmDsaxxM+YBw=@vger.kernel.org, AJvYcCXweJZda6R2ZFlnZfJsbmFXRNYlz4Okz77YkMS5LXS5qkQ+/8b/lIKIx30Tkvz+05Fg0DqU0UjVLZbg8Bp0Wj07cNk=@vger.kernel.org X-Gm-Message-State: AOJu0Yyvmy/zPVDsAdpZb4KpgMWSt5L7vALjJdjAPtaR4cmOPexKoD3y 7jiOCO0HSjr7OTkOHNeH+xRxnIFnc+6k8zEHMJ+ict5iTZ8hdi9Xps1ZFw== X-Google-Smtp-Source: AGHT+IHRkRap/WN1EUUjdTpE9GrXX8eFr9QFl1DVJqFAtMSKFX9sfxcYkTvl/I0NQY10TQBukhzS9w== X-Received: by 2002:a17:906:fe47:b0:a91:158a:a900 with SMTP id a640c23a62f3a-a93c4a988e5mr2030139866b.58.1727791786383; Tue, 01 Oct 2024 07:09:46 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:45 -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 Subject: [PATCH v3 08/17] media: rzg2l-cru: Use MIPI CSI-2 data types for ICnMC_INF definitions Date: Tue, 1 Oct 2024 15:09:10 +0100 Message-ID: <20241001140919.206139-9-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar The INF field in the ICnMC register accepts data type codes as specified in the MIPI CSI-2 v2.1 specification. This patch introduces the `ICnMC_INF()` macro to use the MIPI CSI-2 data types, which are available in the `media/mipi-csi2.h` header. Suggested-by: Laurent Pinchart Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - Updated subject line - Collected RB tag v1->v2 - New patch --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index 9ab7ef33c9da..de88c0fab961 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -77,8 +78,7 @@ /* CRU Image Processing Main Control Register */ #define ICnMC 0x208 #define ICnMC_CSCTHR BIT(5) -#define ICnMC_INF_YUV8_422 (0x1e << 16) -#define ICnMC_INF_USER (0x30 << 16) +#define ICnMC_INF(x) ((x) << 16) #define ICnMC_VCSEL(x) ((x) << 22) #define ICnMC_INF_MASK GENMASK(21, 16) @@ -307,12 +307,12 @@ static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru, bool *input_is_yuv, switch (ip_sd_fmt->code) { case MEDIA_BUS_FMT_UYVY8_1X16: - icnmc = ICnMC_INF_YUV8_422; + icnmc = ICnMC_INF(MIPI_CSI2_DT_YUV422_8B); *input_is_yuv = true; break; default: *input_is_yuv = false; - icnmc = ICnMC_INF_USER; + icnmc = ICnMC_INF(MIPI_CSI2_DT_USER_DEFINED(0)); break; } From patchwork Tue Oct 1 14:09:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818071 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (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 88A6F1C9B92; Tue, 1 Oct 2024 14:09:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791791; cv=none; b=Y2GSvuPMnqZvY6GcGFi+QLhYBM8ykVSf6ViBBpLorOq9zuNofdJyFpL/B+3PE3/YImCvbv6WCN9qvzbJ9APwQrvfG7kFi+IHLp0Uf34YjzfCJDYbswsFUCloiFCFZ/Vvrpa0AIxuaSWYRQN7C7EqWJD+qHZnK7EP1TIj7uHpeS8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791791; c=relaxed/simple; bh=PPbqMcSNUPuSBOLc6T+pUKnDNoIUABoAuYPB4BZEcIE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z1x5SJ/drCk9xWkGMUKKBDy8eboBogq62Re520DJUr81GGKJwcptJ7V6QsP0iDWg+4HowQtkmIYT50JdJv3GDeJFlTQwws/uvN58gZvS69908PTS/Bc+MxRmINImCU2nwpWc9yMguf8itbTJb/aczqoux5MGTKJ4PFBgo1fzodU= 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=Q4ubNpUk; arc=none smtp.client-ip=209.85.218.48 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="Q4ubNpUk" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a8d6ac24a3bso1038338666b.1; Tue, 01 Oct 2024 07:09:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791788; x=1728396588; 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=KY0ON9RWZF20+0WmEC/baBuWRUFD1qrfNbARxLa3h4M=; b=Q4ubNpUkNm4SQsrtWpmnEzg5MKRwpmtMtmjYnlCTaNzbKQM9cwYDzm6fAbSoMZa9nU xrElQJ1JdPvv50PN8ebcsfIyG3jsXnLga/wL0nc4iXm2feyRsy9kdjh/1+jGYxhaJvqL R6NO3XsQMR2fWo+pz+mogLghjKrMeZaJSXE7/bBdLk48tFW4PoysFNbL4wt/O+s6Pzq7 AQxmQ+XbqcDBbDw17eC9yDniYVMEpgl2KSqx+q3bdfzM0s8FNrR36kyVZEVVO5BP2KmH a/us2Aurnwtivuy8AHnXpAu2hqIDXP6UmVQ7i4/Fo+VPB2lUeEFVAqGykNtnBgB5XCdd ghPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791788; x=1728396588; 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=KY0ON9RWZF20+0WmEC/baBuWRUFD1qrfNbARxLa3h4M=; b=p4qbtvzX+/Fg/1fpFE2jj0V07QnWw7XFNTIcCzhreRlkFZ/Ggekue07uym8DwLa7+8 9LbLcPX5bMXUuv4GFRv6VPbKT6Dqp3U/n9O2J3JxcfUXM6Gid33gGnQGuMaluQ1WUr+m JYNnh7eXEAVvx7p4VbXEK9u6UDxcDe9fZLfdNfMkpLrKSStyPni6naDhYyY/qcWYhGGA xxL1LPnz0RAsj3GFDeGjfoqZ3VlDBbE452EBV1wu5fBulxuA3SZ6xoMlTrp5uVKCcYjy 4Pl9p5s5ETUET9k/9PMl7Hz84EST08JaUALbE7hIc/eI7af7e/kfpxhCGI3hMMSpK6wb 3WiQ== X-Forwarded-Encrypted: i=1; AJvYcCVDie25lSzIYCRieE/CjQ1D9JVfJMKijDjbOm2oY5RbRgxV74L1Qf3ZICwzC23+v9VjRwPU9pEzjWm0YgQ=@vger.kernel.org, AJvYcCWHxWDdjjlwBQ//b9K6CFXMeAsAKoHyD9Jisxyk68T6KzZKtMFpZJJfjbPuAoFlg73UVncrr3zbZb/BOlWVg+jEBKg=@vger.kernel.org X-Gm-Message-State: AOJu0YxAesj+xUyaFoIej/7OK0odQ4Xr08Z3Q7cS9bxNIJpjpyg/VwlF ajNis6ja+qnreVwVSPShPEacPwETts2bIKaKHph+YcMTSUOoB8oQ X-Google-Smtp-Source: AGHT+IG4E5/3Xdvm2ASE6P6UBPVu+jPpWZNAjOa3Ww0oECZU721QCIiSxTvJzpIMIGDLniD3loN5fA== X-Received: by 2002:a17:907:7216:b0:a8d:3fb6:33df with SMTP id a640c23a62f3a-a967bf0855cmr356347366b.8.1727791787709; Tue, 01 Oct 2024 07:09:47 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:46 -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 Subject: [PATCH v3 09/17] media: rzg2l-cru: Remove unused fields from rzg2l_cru_ip_format struct Date: Tue, 1 Oct 2024 15:09:11 +0100 Message-ID: <20241001140919.206139-10-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Simplified the `rzg2l_cru_ip_format` struct by removing the unused `datatype` and `bpp` fields from the structure in `rzg2l-ip.c`. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - Updated subject line - Collected RB tag v1->v2 - New patch --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index aee7d4ba70b0..7b006a0bfaae 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -10,12 +10,10 @@ struct rzg2l_cru_ip_format { u32 code; - unsigned int datatype; - unsigned int bpp; }; static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { - { .code = MEDIA_BUS_FMT_UYVY8_1X16, .datatype = 0x1e, .bpp = 16 }, + { .code = MEDIA_BUS_FMT_UYVY8_1X16, }, }; static const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned int code) From patchwork Tue Oct 1 14:09:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818072 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 AB4F31C9DDA; Tue, 1 Oct 2024 14:09:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791792; cv=none; b=hbohQ20qXvnbSfIEcEgxfkxsXnWZgksfDxFfg9if0fZLv9pnmiX/siA8+GgjXP9GYQjtSaUm6TGmShIsbvl3ddRL2VUAp2wRlmWUJXSfNErfubVwaM3ifpwic92T2c+OkeNP+IJT2JkD4qnhH8DxePybbE+Zq2VBVk/GKNzRHdI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791792; c=relaxed/simple; bh=FDCqAhigboXh+lvBCMW8Lr8WpJWigvwF/AQc5NA+uFw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aiame4Y3q4NoDjAsVFUmhyj6a4IaiIx03yfilyH7WqtAPOSfZxBG+6N2EmIgccVjRo/bTusC/kpWg4O8qs28xIX3UT7QclSKcTe8epSa2PoYZMotg7ZtRPwt2PkUBtjWw2LM2au3uaspJv7VAoI+vaUxytIjR7LQWbfWQZ5m+zY= 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=jJt+pIVI; arc=none smtp.client-ip=209.85.218.50 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="jJt+pIVI" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a8d6d0fe021so967729566b.1; Tue, 01 Oct 2024 07:09:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791789; x=1728396589; 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=UTbLXk38akqgbpAuRjhASLHWWMVER3Vvkn5beqqlMhc=; b=jJt+pIVIqsY9ZeQoTvGmAxlD42fbCnAj1VYuhxbxKt4257HDadjDn7IxC/RmVgeIfi 9LoL2pbYkGllEvo4mA5OXTCMbBsDiVD+vffPKMPgJ+QMG5gOP5SYvsSTzy3C39WgoyNd Gxu6zgom7YpO92w86h80/mbAypgCXD5zj/0hbjZiX1HREHfmGR2C7M5YPxdNus6AY6/L vJrHxVVoZPcfZQRQY0q0ZdE0yew4Ou1O9qKXJfhwwFKFMWTx05yIaH34YSl0tDHh7i07 PMfwOwluZQC1Xog/qOkrQZ8dLqpVtPtxsLkjiDZ5A8lTu/b1JdwodkdPvZ5rNoyoRHQB axcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791789; x=1728396589; 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=UTbLXk38akqgbpAuRjhASLHWWMVER3Vvkn5beqqlMhc=; b=gGKeqJK2H1vMYrQ/H853HBsxfcf42Li/YE5H3JrYCmBavrnkeDMrAa+KiX0mdOcuAD qZcl9EspYfjH6gMrUmJOHzKA1OvVVMeWGd5S4/6akng8w3vJ+cOVUynPBo3A99OL+X7T w/qhv0tIdpqk9w4Pv0mLfHRdlEr4fxHoyd2kHwUv25+AxXf8wGtrvLoeA3Z+J4axnGiy 7l/PhvwHF93mBJOlGBgyTZOqbr4hK2AxXKeO6+qFichMlMCP+ybph/r0kgEJHG+L5aE3 +CvyWA9VOUOMRg3bUm4yc8ASK+dDVpULllx0rsdoWAaXEiBF7f4lFQYB4lZ+sGye9d3r 9Ndw== X-Forwarded-Encrypted: i=1; AJvYcCUqW0gjFypY3HJJObWhCyaF3cw/8U/e4MWEEmwMpia87lyhap1DzqCmSBPuhalBfm8PaC6X2gxFabFGW0vIbfmsuBQ=@vger.kernel.org, AJvYcCWnzA+9HSex/RblVeTKfEda2cObZDmgdMBReFtG8BgQfIvPJ0olvz0tnNwO5ZouYGOCaweonNLiyDzvJ8I=@vger.kernel.org X-Gm-Message-State: AOJu0Yyzh4s6dEhqRDaO7LmUyoexHyA5pZu+IQ+UbG1NnkfPbsOLlp2K dQAIxjNMQXYhiTMAIGHAO6UpxV289RuK9Pkg942IRQHevzi5RwwC5MywkQ== X-Google-Smtp-Source: AGHT+IGDHW0f25ZYiuUxImZ4VW1qBbJsVC3zLnNMPmL4QuBV/JQVZjA2Nqz9tMPrd1mId7Y1bf5byQ== X-Received: by 2002:a17:907:6d15:b0:a91:158c:8057 with SMTP id a640c23a62f3a-a93c4aeb8bbmr1728682466b.54.1727791788840; Tue, 01 Oct 2024 07:09:48 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:48 -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 Subject: [PATCH v3 10/17] media: rzg2l-cru: Simplify handling of supported formats Date: Tue, 1 Oct 2024 15:09:12 +0100 Message-ID: <20241001140919.206139-11-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Refactor the handling of supported formats in the RZ/G2L CRU driver by moving the `rzg2l_cru_ip_format` struct to the common header to allow reuse across multiple files and adding pixelformat and bpp members to it. This change centralizes format handling, making it easier to manage and extend. - Moved the `rzg2l_cru_ip_format` struct to `rzg2l-cru.h` for better accessibility. - Added format, datatype and bpp members to `rzg2l_cru_ip_format` struct - Dropped rzg2l_cru_formats - Introduced helper functions `rzg2l_cru_ip_code_to_fmt()`, `rzg2l_cru_ip_format_to_fmt()`, and `rzg2l_cru_ip_index_to_fmt()` to streamline format lookups. - Refactored the `rzg2l_cru_csi2_setup` and format alignment functions to utilize the new helpers. Suggested-by: Laurent Pinchart Signed-off-by: Lad Prabhakar --- v2->v3 - Updated subject line and commit message - Implemented rzg2l_cru_ip_format_to_fmt() and rzg2l_cru_ip_index_to_fmt() - Dropped checking fmt in rzg2l_cru_initialize_image_conv() v1->v2 - New patch --- .../platform/renesas/rzg2l-cru/rzg2l-cru.h | 20 +++++- .../platform/renesas/rzg2l-cru/rzg2l-ip.c | 35 ++++++++-- .../platform/renesas/rzg2l-cru/rzg2l-video.c | 67 ++++++------------- 3 files changed, 68 insertions(+), 54 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h index 4fe24bdde5b2..39296a59b3da 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h @@ -62,6 +62,20 @@ struct rzg2l_cru_ip { struct v4l2_subdev *remote; }; +/** + * struct rzg2l_cru_ip_format - CRU IP format + * @code: Media bus code + * @format: 4CC format identifier (V4L2_PIX_FMT_*) + * @datatype: MIPI CSI2 data type + * @bpp: bytes per pixel + */ +struct rzg2l_cru_ip_format { + u32 code; + u32 format; + u32 datatype; + u8 bpp; +}; + /** * struct rzg2l_cru_dev - Renesas CRU device structure * @dev: (OF) device @@ -144,10 +158,12 @@ int rzg2l_cru_video_register(struct rzg2l_cru_dev *cru); void rzg2l_cru_video_unregister(struct rzg2l_cru_dev *cru); irqreturn_t rzg2l_cru_irq(int irq, void *data); -const struct v4l2_format_info *rzg2l_cru_format_from_pixel(u32 format); - int rzg2l_cru_ip_subdev_register(struct rzg2l_cru_dev *cru); void rzg2l_cru_ip_subdev_unregister(struct rzg2l_cru_dev *cru); struct v4l2_mbus_framefmt *rzg2l_cru_ip_get_src_fmt(struct rzg2l_cru_dev *cru); +const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned int code); +const struct rzg2l_cru_ip_format *rzg2l_cru_ip_format_to_fmt(u32 format); +const struct rzg2l_cru_ip_format *rzg2l_cru_ip_index_to_fmt(u32 index); + #endif diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index 7b006a0bfaae..12aac9d6cb4b 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -6,17 +6,21 @@ */ #include -#include "rzg2l-cru.h" -struct rzg2l_cru_ip_format { - u32 code; -}; +#include + +#include "rzg2l-cru.h" static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { - { .code = MEDIA_BUS_FMT_UYVY8_1X16, }, + { + .code = MEDIA_BUS_FMT_UYVY8_1X16, + .format = V4L2_PIX_FMT_UYVY, + .datatype = MIPI_CSI2_DT_YUV422_8B, + .bpp = 2, + }, }; -static const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned int code) +const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned int code) { unsigned int i; @@ -27,6 +31,25 @@ static const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned int c return NULL; } +const struct rzg2l_cru_ip_format *rzg2l_cru_ip_format_to_fmt(u32 format) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(rzg2l_cru_ip_formats); i++) + if (rzg2l_cru_ip_formats[i].format == format) + return &rzg2l_cru_ip_formats[i]; + + return NULL; +} + +const struct rzg2l_cru_ip_format *rzg2l_cru_ip_index_to_fmt(u32 index) +{ + if (index >= ARRAY_SIZE(rzg2l_cru_ip_formats)) + return NULL; + + return &rzg2l_cru_ip_formats[index]; +} + struct v4l2_mbus_framefmt *rzg2l_cru_ip_get_src_fmt(struct rzg2l_cru_dev *cru) { struct v4l2_subdev_state *state; diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index de88c0fab961..ceb9012c9d70 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -300,21 +300,10 @@ static void rzg2l_cru_initialize_axi(struct rzg2l_cru_dev *cru) rzg2l_cru_write(cru, AMnAXIATTR, amnaxiattr); } -static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru, bool *input_is_yuv, - struct v4l2_mbus_framefmt *ip_sd_fmt, u8 csi_vc) +static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru, u8 csi_vc, + u32 csi2_datatype) { - u32 icnmc; - - switch (ip_sd_fmt->code) { - case MEDIA_BUS_FMT_UYVY8_1X16: - icnmc = ICnMC_INF(MIPI_CSI2_DT_YUV422_8B); - *input_is_yuv = true; - break; - default: - *input_is_yuv = false; - icnmc = ICnMC_INF(MIPI_CSI2_DT_USER_DEFINED(0)); - break; - } + u32 icnmc = ICnMC_INF(csi2_datatype); icnmc |= (rzg2l_cru_read(cru, ICnMC) & ~ICnMC_INF_MASK); @@ -328,17 +317,20 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru, struct v4l2_mbus_framefmt *ip_sd_fmt, u8 csi_vc) { - bool output_is_yuv = false; - bool input_is_yuv = false; + const struct v4l2_format_info *src_finfo, *dst_finfo; + const struct rzg2l_cru_ip_format *cru_ip_fmt; u32 icndmr; - rzg2l_cru_csi2_setup(cru, &input_is_yuv, ip_sd_fmt, csi_vc); + cru_ip_fmt = rzg2l_cru_ip_code_to_fmt(ip_sd_fmt->code); + rzg2l_cru_csi2_setup(cru, csi_vc, cru_ip_fmt->datatype); + + src_finfo = v4l2_format_info(cru_ip_fmt->format); + dst_finfo = v4l2_format_info(cru->format.pixelformat); /* Output format */ switch (cru->format.pixelformat) { case V4L2_PIX_FMT_UYVY: icndmr = ICnDMR_YCMODE_UYVY; - output_is_yuv = true; break; default: dev_err(cru->dev, "Invalid pixelformat (0x%x)\n", @@ -347,7 +339,7 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru, } /* If input and output use same colorspace, do bypass mode */ - if (output_is_yuv == input_is_yuv) + if (v4l2_is_format_yuv(src_finfo) && v4l2_is_format_yuv(dst_finfo)) rzg2l_cru_write(cru, ICnMC, rzg2l_cru_read(cru, ICnMC) | ICnMC_CSCTHR); else @@ -810,35 +802,15 @@ int rzg2l_cru_dma_register(struct rzg2l_cru_dev *cru) /* ----------------------------------------------------------------------------- * V4L2 stuff */ - -static const struct v4l2_format_info rzg2l_cru_formats[] = { - { - .format = V4L2_PIX_FMT_UYVY, - .bpp[0] = 2, - }, -}; - -const struct v4l2_format_info *rzg2l_cru_format_from_pixel(u32 format) -{ - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(rzg2l_cru_formats); i++) - if (rzg2l_cru_formats[i].format == format) - return rzg2l_cru_formats + i; - - return NULL; -} - static u32 rzg2l_cru_format_bytesperline(struct v4l2_pix_format *pix) { - const struct v4l2_format_info *fmt; - - fmt = rzg2l_cru_format_from_pixel(pix->pixelformat); + const struct rzg2l_cru_ip_format *fmt; + fmt = rzg2l_cru_ip_format_to_fmt(pix->pixelformat); if (WARN_ON(!fmt)) - return -EINVAL; + return 0; - return pix->width * fmt->bpp[0]; + return pix->width * fmt->bpp; } static u32 rzg2l_cru_format_sizeimage(struct v4l2_pix_format *pix) @@ -849,7 +821,7 @@ static u32 rzg2l_cru_format_sizeimage(struct v4l2_pix_format *pix) static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru, struct v4l2_pix_format *pix) { - if (!rzg2l_cru_format_from_pixel(pix->pixelformat)) + if (!rzg2l_cru_ip_format_to_fmt(pix->pixelformat)) pix->pixelformat = RZG2L_CRU_DEFAULT_FORMAT; switch (pix->field) { @@ -941,10 +913,13 @@ static int rzg2l_cru_g_fmt_vid_cap(struct file *file, void *priv, static int rzg2l_cru_enum_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - if (f->index >= ARRAY_SIZE(rzg2l_cru_formats)) + const struct rzg2l_cru_ip_format *fmt; + + fmt = rzg2l_cru_ip_index_to_fmt(f->index); + if (!fmt) return -EINVAL; - f->pixelformat = rzg2l_cru_formats[f->index].format; + f->pixelformat = fmt->format; return 0; } From patchwork Tue Oct 1 14:09:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818073 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 C35E41C9EA0; Tue, 1 Oct 2024 14:09:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791793; cv=none; b=lnUmmU9qaEyAGOSFCrLgiTjoZiwoAU4nR+EgeAIFHiWDD/XzTV9r+5lIK6G7CE4/Q/BOMalhqvbq/jeKH1mTvfsrDzbikZvn3FvWVWU6BCOwiVvF0wTh0akA0s0qODRh3HH5QOG946jdoGlTVuzETzg47Ucb2Yh3Oxp3DSWW9T0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791793; c=relaxed/simple; bh=KEBZJUpiys9cL8RQIC6/B2MZs7EWcYD7qibyXCPYu/E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rUQ8tJD6X+qnt02RsRNvQYN4bD2tHCTwrVzuZT4qTPALtEQ1EbBMbQdEtGvnQ/Y5hN0lJ679HPcD/uQnTy6xexop4M9E2OSmUSdpRHBZjVvvTFlaiFqlEzEZx3szw830Gcvea9q5BdjYMxdLfc6Ydx2CrCHNNsezBBMKV1WZizg= 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=dlI0cOuO; arc=none smtp.client-ip=209.85.218.46 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="dlI0cOuO" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a8ce5db8668so969786166b.1; Tue, 01 Oct 2024 07:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791790; x=1728396590; 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=yzRk5+hYxvHVtQznvUYLKHmK+AJzn5GCHjzzzcvFJhI=; b=dlI0cOuOUxNpAHVYIQ5NFLeClrU93jbFUFopvCFTrtzrHlSerPeLcndWjpR99FlFFp xLIxTxS9WAcGBqrpbJ89Sic9Jfo4V7/7+WWBw61WZzPhudgbV7SD1KksQANbyJuJsb73 +OT1NdieV66+3ImdGAFORHmI85uI1yPf0fB0T9DMtFRJG2lF2RjTWgX3VhOZB9XKt5DP nc0Ye80mYzNtyKTzXdsYm+8EEt11Ux7j67L+GZY49FcGopEV1+JdJqaPo+lYj46pXCIn k4xiHVSamQIR6H8CN6PT/E4QfSwBj0U/tW22e4Gn367hJPE/aiYw34kqYiIXDwl7AohU HfnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791790; x=1728396590; 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=yzRk5+hYxvHVtQznvUYLKHmK+AJzn5GCHjzzzcvFJhI=; b=bYG3s+csf/oIjY9fGD4QHcl0EZ9DdwlIFTRC5AbfPGQomQfw7C2jVNx8FdqYFjw5xM YZUp6f8cCa8/bgmY5r1pCLP1gKsWYov+8nstmHhOtRnItp6oDiLZvLOCcYEOfOehT9K1 WdxqqxFMCBZIcHVQ0p5cHA/YCxUMKW/WUrtBASlRPugQoXfIm5V+GV/kChcj0IghzTcP WiZLf3T1dyqmuHAaBVzowdhdB+JARCBsIwAXI3BU2b7nzIMxuose+qwlRW8pQyYltg0o vsVdC84A07UB/lElyE8MeAVFG9QLS4DrAS+9MDFNcxoRPRwLY+82yAgAvSVFMO9h7v4r hiDQ== X-Forwarded-Encrypted: i=1; AJvYcCWhSlXN04uxf5bpweI64gqSV9peNlBoq6/0g9YahmEBiie33U49qEDBubyhtgDkQUb2h9L7qHzLeEhPQAY=@vger.kernel.org, AJvYcCXoT/IU8xaQXWmZNhwQp2XSymO2luUI3+g5sP8TsLJhJi5KHz1PP23vHwk/ds9NxkMDASHBMngs+zvIbDvy5/IANXg=@vger.kernel.org X-Gm-Message-State: AOJu0YywCEcS6XCe1TBflZXTqZGcGK+YFx3zUV1v/3QVdf23ABv82/El qRyH4fYJI6ISDt+a0wKyf/Fylht6LUWhsDmJGrtdlhOXUe0FRVeT X-Google-Smtp-Source: AGHT+IF/P+PIlJQeQjeVqILk1Bl3m4/Rqshb/H0SAk0JzAFjGDfLr8vA02ZPObzJ+ChdVvaxi/BTmw== X-Received: by 2002:a17:907:6d1a:b0:a86:a41c:29b with SMTP id a640c23a62f3a-a93c48e80bdmr1829503666b.8.1727791789903; Tue, 01 Oct 2024 07:09:49 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:49 -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 Subject: [PATCH v3 11/17] media: rzg2l-cru: Use `rzg2l_cru_ip_formats` array in enum_frame_size Date: Tue, 1 Oct 2024 15:09:13 +0100 Message-ID: <20241001140919.206139-12-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Use the `rzg2l_cru_ip_formats` array in `rzg2l_cru_ip_enum_frame_size()` to validate the format code. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - Updated subject line and commit message - Dropped fse->index check - Collected RB tag v1->v2 - New patch --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index 12aac9d6cb4b..6ce077ab42e2 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -165,7 +165,7 @@ static int rzg2l_cru_ip_enum_frame_size(struct v4l2_subdev *sd, if (fse->index != 0) return -EINVAL; - if (fse->code != MEDIA_BUS_FMT_UYVY8_1X16) + if (!rzg2l_cru_ip_code_to_fmt(fse->code)) return -EINVAL; fse->min_width = RZG2L_CRU_MIN_INPUT_WIDTH; From patchwork Tue Oct 1 14:09:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818075 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 19CC91CB30A; Tue, 1 Oct 2024 14:09:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791795; cv=none; b=Z7Ni7KL2NWoSLKo8TDWRSJ7vmDvzqtoJD1h0KpdOqFzxyDXyoAEaYIc5OPK76Gfx/PeTa5DqlsAxa5oXyg+UTDLmZ3Oyc3l0XYKdrvvx/NvZHi2/k/HYyVjCVXaeEXvxkBYNlpz+6F56zyALKJZSxlEMggC/iT08/tCoro49WV0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791795; c=relaxed/simple; bh=evPL6jyF2BS8feV+jWK11x1gxcWi86McPDObsxXJbB0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XdE0UAvf8f6nEyqQCxDxmw1MDjNzgTUq39YeFM5cVnAqLBbt8Q+C5edUaHbl4rIoXZ+M4t+Xa8Q7L4Q68E69VxoDl3GaKfqYseMitcK4lTnkbb6HVIbkjhqFExEvVQyMNmjlFJhOLP33iDxh8ze5F3Y+LAS/YBmoYtzEP5cdpfY= 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=WrWc7kGb; arc=none smtp.client-ip=209.85.218.45 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="WrWc7kGb" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a8d6ac24a3bso1038353666b.1; Tue, 01 Oct 2024 07:09:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791792; x=1728396592; 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=pvT6BvGeyDrFDQpFtVyrCYvyK949r2xvbxa68QlOZZU=; b=WrWc7kGbHoJTSG0f1SCZBZAnB8ltMf1iyKrOJ84ePfcNBEiSFfFfnQEWxpmweOi8FB a+A4o38NEXPDRsljdPgGJ91aqPdyXgkQye324VJU0AqMdAa1ZO/PaEje+Oi88VK+YyQu 8jKA7Ez0YpdwCt6J0za7PzWd1HpBiZOQNAOQkF3P22czbhAENccOtys071/5tk2Jme09 FsI3jarnaUv/whuGqflJm6QUCcCO7slaU7GBMpBTsAJjdmi6lLukN6NdXfURhUrxrVSl ilDYBJ8kIPnTsoDKtNiwJPLNCg3qJKwerd7Q6pU0zjPZdVhL5c1Kydrwp3BZPw86JlAZ QaEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791792; x=1728396592; 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=pvT6BvGeyDrFDQpFtVyrCYvyK949r2xvbxa68QlOZZU=; b=iaJt1zWfLDanFswiOZRMZ1zY6BucTJrKhzFN7ho+s/iw5R/aG+P2JPYtmJ14rgyW9i fIoEFMO776nAABlgftm68OQnkKxEO/d1+UnD2jrrlvIlEVPZxAGXOYG9z6FEBuTly9fY pbsaobnSdxdzRHpFF4WGxtXmYNoB/GCyBJCtPli5es6WmSq81q5/yV6kBM6MWw8ZDZRa 3Ffzm1DZU/F53jtrxOVxTi6w3OsZjKkp4BoJuVi4ERP5Y80GxQyCcIKji3P4dcunpzN4 jhGCxcWwiIsW3kjERcCdux2b8RkSwlDLtplSs6DjHuCdCrxEPsQcFM1Oy16GwM8ULZqr Lrnw== X-Forwarded-Encrypted: i=1; AJvYcCW7fIXBh3xtfjxS0lar0bKjLiCgUFHI3Y8rO1loG2fUJjLnwWKOvGggc+Sgrs96+D/NxEvQfoGaNlgBCnY=@vger.kernel.org, AJvYcCWMGgntP98cCETW3T/QF/hzyP3OVSGcHHWiHjXCBqRqzle+Mk8Wsk8up8ARp0YVUzFkaVYnoJ7ZZ1/3PSLml39I4ys=@vger.kernel.org X-Gm-Message-State: AOJu0YwXBxqaN4PpmGQDL0RZ6+S2OOm2kcDGrQIgvIjFF5NWgk8zRxLL 2z8kCMCEj9369o+PjtrMtrXHexpuM3uwTFuwgW3ECAUcCrd2zMOjWpkohA== X-Google-Smtp-Source: AGHT+IGZYInbdbNc/IayUv1EsYZlQn5qfguSM/LIovw3lbVdcY3p7ZPaogDFKAPgsilVsXWan6bgcg== X-Received: by 2002:a17:907:9454:b0:a77:ab9e:9202 with SMTP id a640c23a62f3a-a967be75e1fmr405570766b.4.1727791790866; Tue, 01 Oct 2024 07:09:50 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:50 -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 Subject: [PATCH v3 12/17] media: rzg2l-cru: csi2: Remove unused field from rzg2l_csi2_format Date: Tue, 1 Oct 2024 15:09:14 +0100 Message-ID: <20241001140919.206139-13-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Remove the unused `datatype` field from the `rzg2l_csi2_format` struct and update the `rzg2l_csi2_formats[]` array to reflect the updated structure. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - Updated subject line - Collected RB tag v1->v2 - New patch --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c index 3fd0be6a3b65..7b76d495cfe4 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c @@ -183,12 +183,11 @@ static const struct rzg2l_csi2_timings rzg2l_csi2_global_timings[] = { struct rzg2l_csi2_format { u32 code; - unsigned int datatype; unsigned int bpp; }; static const struct rzg2l_csi2_format rzg2l_csi2_formats[] = { - { .code = MEDIA_BUS_FMT_UYVY8_1X16, .datatype = 0x1e, .bpp = 16 }, + { .code = MEDIA_BUS_FMT_UYVY8_1X16, .bpp = 16 }, }; static inline struct rzg2l_csi2 *sd_to_csi2(struct v4l2_subdev *sd) From patchwork Tue Oct 1 14:09:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818074 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 B8D791CB300; Tue, 1 Oct 2024 14:09:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791795; cv=none; b=cCItbsO5AbTzthG/CGoNE0sAPooS56lj+jpcRN5EA8wBS3ps98c87HQ2RaZzNbxKNHLLQPsCXt0IjbPQO9pdcHEpBdlhtLe/AezW9zJJM8bnHEOyqyMiUlUYaDNyp5nr/277ppEqN0TaUzTQblnAlUR5nWf34cbSr1P0l3sSvjA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791795; c=relaxed/simple; bh=XoOVZDO7znVruwyD03vDwesLbcSXHzVPwLK7idCjKmE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lut9wOZ6iyNfim+qdEcmX8pJld6I+7Ap7DTNJCnmfvSWuvDN/AvnZaSVZLu1uy9AiJhgshBpovgCaYEJQlmeX0HdJt7shWeU9R6y3aBMLq2zD9CONfq2bRPeh8wLpJbp5HFCpiheIXN9UATmJsgLNl5pS342wxsMZKZy3qo9Dw0= 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=FAO4TUG3; arc=none smtp.client-ip=209.85.218.45 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="FAO4TUG3" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a8d60e23b33so829891166b.0; Tue, 01 Oct 2024 07:09:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791792; x=1728396592; 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=sFYIxN4CxKm/Cp2pLpSx+moRo34CdiHzwbCQCWScWnc=; b=FAO4TUG3wkMqhTmfx/NEVc8HzaZVNhRZe4CkNjC9GHYumXh22/D/vKrUJYx2EkRyu8 cpv7AgzQGM+fsOnAVazEbte5bS3DASvptHkr+DG6bZAogDUjsbsSTNjAN+5HNNJ7Zw4x 6zzNnJEn/WuEm7ECgGHeqFwIBa/HGM8fRq4NdQGvSYVl5X7A47FgVQRft7HYha+jQJNy 5PwqP/XEHRLdcLKayC/I4oqT+ghNdGDZw2zOum0UZI7qMFlFuVMT4jOznLLohTOkVqpi +FwwtPcL9MG+kuY3p3w8uEVPt+2Ei0lQc4quiJbxz3AqeYhILk1/hPOc8RYkxXioKKtD k59A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791792; x=1728396592; 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=sFYIxN4CxKm/Cp2pLpSx+moRo34CdiHzwbCQCWScWnc=; b=hjMCdb4wOMKDNLzdmtbQI+LFA7xTGHbFZ3gO/Wzl7jZjT1RwZ/nJ8dSSp+Q5Lmeont L+GI4ipd3+aRvIVC7JF+/9GcrZTj60EO+vh1qYFs30Jx3fBGTnY3ssOuoDLlLoRnv4sq 4ITt6604hgzi78Hbysb9oW2RNr+N/m6DrNkc7SkjG0jxKWuck8GhDxgeuzqitFSMXa6E 5dbhmHVCfnxfYW0Gp45fBoedjg1dvwe5k1T/J44kKw+c01/0FvSzixP8PAT1JsLmavGk hRyHzmvlpWlOZibpM+52pzhrh9HO2CUiD/y666Awr2YsQ4sdCQWHHkgFYGiiQ/EfUqAX gxfw== X-Forwarded-Encrypted: i=1; AJvYcCUwFSRw1CpRcyEFUK5sPIk1HI3BcpUa2CgRVTzdXAXuk9rbBuqAW7x3hNpQnXaDnXR8VujL/BRYUBFPI99fUQKty0E=@vger.kernel.org, AJvYcCX+2opGxqbVw//eC0X/YBIoz4KlCOcK07tL0sL0yIkybaawmIS1jubYW1znPJOEiE2SmtcVCKxqvwfczEw=@vger.kernel.org X-Gm-Message-State: AOJu0Yx9QEELySdnj5yeKoMmQyiFGwZAwPC9CBzrUJyr9lz/szf9s9g/ CBHdCdL+3XWjB5UgBwJdyFwyW8enjhcfMPcywheldYSjDfpDvPhS X-Google-Smtp-Source: AGHT+IHaBjCiI4qrEkOT4hdu2rBQfaNg26yNAHf+wt3raC5GYtvCm2gGlSCu45/fvFK16P3a5fDQ2Q== X-Received: by 2002:a17:906:dc92:b0:a8a:926a:d02a with SMTP id a640c23a62f3a-a93c4adebfcmr1456576766b.49.1727791791788; Tue, 01 Oct 2024 07:09:51 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:51 -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 Subject: [PATCH v3 13/17] media: rzg2l-cru: video: Implement .link_validate() callback Date: Tue, 1 Oct 2024 15:09:15 +0100 Message-ID: <20241001140919.206139-14-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Implement the `.link_validate()` callback for the video node and move the format checking into this function. This change allows the removal of `rzg2l_cru_mc_validate_format()`. Suggested-by: Laurent Pinchart Signed-off-by: Lad Prabhakar --- v2->v3 - New patch --- .../platform/renesas/rzg2l-cru/rzg2l-video.c | 99 ++++++++++--------- 1 file changed, 55 insertions(+), 44 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index ceb9012c9d70..c6c82b9b130a 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -189,46 +189,6 @@ static void rzg2l_cru_buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&cru->qlock, flags); } -static int rzg2l_cru_mc_validate_format(struct rzg2l_cru_dev *cru, - struct v4l2_subdev *sd, - struct media_pad *pad) -{ - struct v4l2_subdev_format fmt = { - .which = V4L2_SUBDEV_FORMAT_ACTIVE, - }; - - fmt.pad = pad->index; - if (v4l2_subdev_call_state_active(sd, pad, get_fmt, &fmt)) - return -EPIPE; - - switch (fmt.format.code) { - case MEDIA_BUS_FMT_UYVY8_1X16: - break; - default: - return -EPIPE; - } - - switch (fmt.format.field) { - case V4L2_FIELD_TOP: - case V4L2_FIELD_BOTTOM: - case V4L2_FIELD_NONE: - case V4L2_FIELD_INTERLACED_TB: - case V4L2_FIELD_INTERLACED_BT: - case V4L2_FIELD_INTERLACED: - case V4L2_FIELD_SEQ_TB: - case V4L2_FIELD_SEQ_BT: - break; - default: - return -EPIPE; - } - - if (fmt.format.width != cru->format.width || - fmt.format.height != cru->format.height) - return -EPIPE; - - return 0; -} - static void rzg2l_cru_set_slot_addr(struct rzg2l_cru_dev *cru, int slot, dma_addr_t addr) { @@ -531,10 +491,6 @@ static int rzg2l_cru_set_stream(struct rzg2l_cru_dev *cru, int on) return stream_off_ret; } - ret = rzg2l_cru_mc_validate_format(cru, sd, pad); - if (ret) - return ret; - pipe = media_entity_pipeline(&sd->entity) ? : &cru->vdev.pipe; ret = video_device_pipeline_start(&cru->vdev, pipe); if (ret) @@ -995,6 +951,60 @@ static const struct v4l2_file_operations rzg2l_cru_fops = { .read = vb2_fop_read, }; +/* ----------------------------------------------------------------------------- + * Media entity operations + */ + +static int rzg2l_cru_video_link_validate(struct media_link *link) +{ + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct v4l2_subdev *subdev; + struct media_entity *entity; + struct rzg2l_cru_dev *cru; + struct media_pad *remote; + int ret; + + entity = link->sink->entity; + remote = link->source; + + subdev = media_entity_to_v4l2_subdev(remote->entity); + fmt.pad = remote->index; + ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt); + if (ret < 0) + return ret == -ENOIOCTLCMD ? -EINVAL : ret; + + if (!rzg2l_cru_ip_code_to_fmt(fmt.format.code)) + return -EPIPE; + + switch (fmt.format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + break; + default: + return -EPIPE; + } + + cru = container_of(media_entity_to_video_device(entity), + struct rzg2l_cru_dev, vdev); + if (fmt.format.width != cru->format.width || + fmt.format.height != cru->format.height) + return -EPIPE; + + return 0; +} + +static const struct media_entity_operations rzg2l_cru_video_media_ops = { + .link_validate = rzg2l_cru_video_link_validate, +}; + static void rzg2l_cru_v4l2_init(struct rzg2l_cru_dev *cru) { struct video_device *vdev = &cru->vdev; @@ -1006,6 +1016,7 @@ static void rzg2l_cru_v4l2_init(struct rzg2l_cru_dev *cru) vdev->lock = &cru->lock; vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; vdev->device_caps |= V4L2_CAP_IO_MC; + vdev->entity.ops = &rzg2l_cru_video_media_ops; vdev->fops = &rzg2l_cru_fops; vdev->ioctl_ops = &rzg2l_cru_ioctl_ops; From patchwork Tue Oct 1 14:09:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818076 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (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 0F1091CB316; Tue, 1 Oct 2024 14:09:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791796; cv=none; b=oaquWCzY4p/fx5ValALO17gbQrNeehSn/C2SNj+5wzGAb4fxM2t2kBHvaShyQejdEP7lgnNmBaaEBJpZBf/eQGTMj/beM9kQ4W7TLzKz+ZZV+KeJRuFurM8JG6GG0Kel80M1I4NvW5nPcpLB5BRZdIX3DdMeVEg5WgRg8c2gs3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791796; c=relaxed/simple; bh=SJTRTbWmnZwCGFQVnRVMdb5VwjnbG13f5ZKT+nULsnc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HqQ86rlFVKXTjYjK9aCAhbN8VZVlLkc6UqgWu1B2RZELsWcv+UP5/SNvNROE4RBnLrXbmtTf+yFKEsjx4KTVD9ViCR0k1l4ojC0zUfbsqKJbHI0FWPKrHGg69LNAs5Hx81eXao3fOtqgeKIHlfjlC7xomDhXqf59ikThvvcU7d8= 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=nan77YaG; arc=none smtp.client-ip=209.85.218.48 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="nan77YaG" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a8b155b5e9eso24950466b.1; Tue, 01 Oct 2024 07:09:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791793; x=1728396593; 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=+ZRYacs3XWBh6ijJlsVrmfu6VX8ZiHszX4t2XbLm/zs=; b=nan77YaGgYYJD9rTJQRg+1Ir7lp7Ckhcy6BOynnF/IebMAkFFs/DxPqg9gnhTygqjj MC0sFU78iwl4TkxVcFDSLQ5qkloyHynL4PtlbmH2iVgG9VydOM8FvvzUw2Ra7EAF01XK TZ6QgZZzaLpcsZuGIAQp5eBPcA/jH9AXH60lY6oUpg1yd/uE5aETbBFrKRX96rlpU8kw 7GAYx9RVqb2GhfBf/kxlWh0d+nhZ1kbbm3j5/CIPMJ9A9648przJu4sVeJEAYWLvg2P2 fA0xiBiHbc5NqZDhRmLQPC0obuWW2XhxX0x4y9u8JiFEcf+qKLeq/J1725GEId5EVie9 lLgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791793; x=1728396593; 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=+ZRYacs3XWBh6ijJlsVrmfu6VX8ZiHszX4t2XbLm/zs=; b=VaDnC81UN1fuAn4uFQ65RVtXGZBYKQ+6XK0vG9oZEevQJyT9KkXP3TQSuEqhYx3d9B iI1t21yKnOvbX8yHUclMNgv7/7YIxdKiab/+38hmnI+oQILcn80qdAmadLrjelkCx33S 6oQ8Njuwk02R+/Ygfh1bNlS50p50fjtqO79U3hqS6Ibmr5f0Y02QoQNcwwjSXOQ6g9U2 V/ueM0LTV+5Td4kMS1CVod/BZxy+wN51j4/eD88NRgFn5nufgXZpE4yQLVVqVeH3ULFR MXPbVjrg3MPzrdSDUTRDthXu+J/PA7YV928FiY8zBu5QRmldEGk6zN15HUmuf39kYsSn V0UA== X-Forwarded-Encrypted: i=1; AJvYcCW/5RjaT8YVnRiyAdPZp1d5sP/DZY3elh1JeUePbB3h7cYCUai7tnRzQpMhgBomikyb+K4P2L0e8GbDKYs=@vger.kernel.org, AJvYcCWijXE/Oi8VscBttudlTzDP7tqM0Rqx8obQdA8HQOF56XejFKMFQ5b3xpW2yIT2Z2E6fn1DiYLug/2UyY57p0Uj4g4=@vger.kernel.org X-Gm-Message-State: AOJu0YyNA9EXj2ZFJulVTU7Q7iopfxfVWR7XH4BaZDe/+nL0GDgj2qhy md4dSmn+Bm7RbLUCMGxKreuFq+3Tv0X31CUj6tYpoe1hA53WeI4x X-Google-Smtp-Source: AGHT+IEVk8duLih4owN395mdfx7XArQbxUcycbZDoXF/Ag6slvaT0vtMYIelFqwVakFGFrA5l0ug3A== X-Received: by 2002:a17:907:6e9e:b0:a8d:5184:d94b with SMTP id a640c23a62f3a-a93c4ae8f11mr1812482166b.49.1727791793177; Tue, 01 Oct 2024 07:09:53 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:52 -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 Subject: [PATCH v3 14/17] media: rzg2l-cru: csi2: Use rzg2l_csi2_formats array in enum_frame_size Date: Tue, 1 Oct 2024 15:09:16 +0100 Message-ID: <20241001140919.206139-15-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Make use of `rzg2l_csi2_formats` array in rzg2l_csi2_enum_frame_size() to validate if the `fse->code` is supported. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - Updated subject line - Dropped fse->index check - Collected RB tag v1->v2 - New patch --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c index 7b76d495cfe4..e21142d3b67d 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c @@ -573,6 +573,9 @@ static int rzg2l_csi2_enum_frame_size(struct v4l2_subdev *sd, if (fse->index != 0) return -EINVAL; + if (!rzg2l_csi2_code_to_fmt(fse->code)) + return -EINVAL; + fse->min_width = RZG2L_CSI2_MIN_WIDTH; fse->min_height = RZG2L_CSI2_MIN_HEIGHT; fse->max_width = RZG2L_CSI2_MAX_WIDTH; From patchwork Tue Oct 1 14:09:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818077 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 7B8EA1CB510; Tue, 1 Oct 2024 14:09:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791798; cv=none; b=nsgb0MNiuA6vnF6/3lTGmgG2VLor+N9bjCIlELWOgoa/ZisVCVzZbJKOjYHpMskO6kwQzVgeV3tNgtXpnwfCr8SCRSSj/vVM7PNFKrW0vIZT8g7P4UUE0PYc2mYzIfuBGnRkJg+haWsZ8sEJkwO+tJnaiqbiqaHYFvGhxo6lD1c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791798; c=relaxed/simple; bh=C4zMQItZW/qfKIMM58l6qtq4Ef/XWpUnTtAiWDuuJng=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uAZRjX4+CVvNUcKchHh+rmaMVagdxqq8ajjg0DAFAtwGNEuWO/mHvIVAD8GH2Io4zMIJLMegtMh6oQpLad8WB8iKww6/sATD2cTPoHUgjm5PK5ZTRkr1oUCysFRs8W3NZXidhAIEum2C6Sj3OGypVypEqIBQpKvCcwKKPKP+AT8= 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=SufO6YGy; arc=none smtp.client-ip=209.85.208.179 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="SufO6YGy" Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2fad6de2590so21798851fa.0; Tue, 01 Oct 2024 07:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791795; x=1728396595; 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=FGUiaBEa3nzPljGE4aZ+kRrga+d/t1Ch2ngCb/UDkDs=; b=SufO6YGys3RmVxxV5vRFsBpby/Rc4Fx1HZcDxjWFow8XxOXApXAJ1EdH9lLPAR/6Wr k4/jvCls40BQ8SrwONNN7WMI/O9seVlXKve4RmMlGj9O6vw6DGIolK0DYL5mQoAYaBjS CIqoHwXXZjUyxWZMG8Mmr6s64LalKS4vDLpS2dwSqYdJu1rv3mJpaOXJjMsi3ZFIbxZM lzW/a43LmZv3J3Pfek0XgVWVYqPrWtV2zYgVNHV3ZxeaWc90GL3+k1cO9H3tz8yItfMR s9T8GFLXt4G/kCjLthRjCFZsGZKHU7EAVD8CT6jUL4JqFh0jMoX7HjLS5rtL/JelVisR icLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791795; x=1728396595; 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=FGUiaBEa3nzPljGE4aZ+kRrga+d/t1Ch2ngCb/UDkDs=; b=lAHejeXFDT9fifl/5u+ads0Kd9deYLjX5KCVOrHnfllPo0cau9Vm77MWYY254a+Btw oGDZPXDhEVvCS0gur8HpWhvvM9k9vOJEwGr7dkIkh5wT22VBx1b48WRMIo/HeVVn5IgR QasksIEJGXLFdl75Mw172EcdjarP1qS2IwbVCtNUOE14AGCdLs8XVKgdErc2fT+PbG2B EtLidx0v9WPmmZNSwj74YPdVfZL1JcSc6DMJ51U4VlYBJEP8V1HZTfzWB3Oxj5x2f7J9 iMrUfwRjbCn4TVdBjNboBQ68QO1uEx/OR6g/ygu5BPPutthHNEyfzwi0cbX2vlm4cSL8 jhgg== X-Forwarded-Encrypted: i=1; AJvYcCUYdH4aq3ol340vJqmfYOW5rsNyQF5s8qZmvda8Xaf5E1ciH6iiZfkGii7pzev7RpMIDiCR8sFvkGG/zChuTts/vPk=@vger.kernel.org, AJvYcCWc1jekarH3FyAipEn0a/PFNXLv2dcySIWYJROAbpPvsu5hvX9MYh11uJgK1kiTL2lu42J68uRnX8sKFxw=@vger.kernel.org X-Gm-Message-State: AOJu0YygTkLpKDcDdMCSl2WsRrWE4h9QnSIYy2o/X6fh8VqS9xN42zhu SLepJYONMuo22dLlrZBPi7xP9+Z7+zCILrGZO+zO9eldU4vqAVno X-Google-Smtp-Source: AGHT+IGUmBDHw2VGaxPSQ/ZD2Zyr1xQxy3o5T1VzZR29CXqpxiiDrj0Nd83h5T2+AZe3pqYNKI2iBw== X-Received: by 2002:a2e:bc1c:0:b0:2fa:bd56:98c5 with SMTP id 38308e7fff4ca-2fabd569ad2mr92334061fa.33.1727791794218; Tue, 01 Oct 2024 07:09:54 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:53 -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 Subject: [PATCH v3 15/17] media: rzg2l-cru: Refactor ICnDMR register configuration Date: Tue, 1 Oct 2024 15:09:17 +0100 Message-ID: <20241001140919.206139-16-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Refactor the ICnDMR register configuration in `rzg2l_cru_initialize_image_conv()` by adding a new member `icndmr` in the `rzg2l_cru_ip_format` structure. Suggested-by: Laurent Pinchart Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - Updated subject line and commit message - Re-used rzg2l_cru_ip_format_to_fmt() to fetch icndmr details - Collected RB tag v1->v2 - New patch --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h | 4 ++++ drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 1 + drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 10 ++++------ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h index 39296a59b3da..51206373b7fe 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h @@ -31,6 +31,8 @@ #define RZG2L_CRU_MIN_INPUT_HEIGHT 240 #define RZG2L_CRU_MAX_INPUT_HEIGHT 4095 +#define ICnDMR_YCMODE_UYVY (1 << 4) + enum rzg2l_csi2_pads { RZG2L_CRU_IP_SINK = 0, RZG2L_CRU_IP_SOURCE, @@ -68,12 +70,14 @@ struct rzg2l_cru_ip { * @format: 4CC format identifier (V4L2_PIX_FMT_*) * @datatype: MIPI CSI2 data type * @bpp: bytes per pixel + * @icndmr: ICnDMR register value */ struct rzg2l_cru_ip_format { u32 code; u32 format; u32 datatype; u8 bpp; + u32 icndmr; }; /** diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index 6ce077ab42e2..f14ac949cc64 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -17,6 +17,7 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { .format = V4L2_PIX_FMT_UYVY, .datatype = MIPI_CSI2_DT_YUV422_8B, .bpp = 2, + .icndmr = ICnDMR_YCMODE_UYVY, }, }; diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index c6c82b9b130a..c3d10b001b7c 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -88,7 +88,6 @@ /* CRU Data Output Mode Register */ #define ICnDMR 0x26c -#define ICnDMR_YCMODE_UYVY (1 << 4) #define RZG2L_TIMEOUT_MS 100 #define RZG2L_RETRIES 10 @@ -278,6 +277,7 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru, u8 csi_vc) { const struct v4l2_format_info *src_finfo, *dst_finfo; + const struct rzg2l_cru_ip_format *cru_video_fmt; const struct rzg2l_cru_ip_format *cru_ip_fmt; u32 icndmr; @@ -288,15 +288,13 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru, dst_finfo = v4l2_format_info(cru->format.pixelformat); /* Output format */ - switch (cru->format.pixelformat) { - case V4L2_PIX_FMT_UYVY: - icndmr = ICnDMR_YCMODE_UYVY; - break; - default: + cru_video_fmt = rzg2l_cru_ip_format_to_fmt(cru->format.pixelformat); + if (!cru_video_fmt) { dev_err(cru->dev, "Invalid pixelformat (0x%x)\n", cru->format.pixelformat); return -EINVAL; } + icndmr = cru_video_fmt->icndmr; /* If input and output use same colorspace, do bypass mode */ if (v4l2_is_format_yuv(src_finfo) && v4l2_is_format_yuv(dst_finfo)) From patchwork Tue Oct 1 14:09:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818078 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 0F84F1C6F66; Tue, 1 Oct 2024 14:09:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791798; cv=none; b=caw3iggitfcyYBymfGWxqCnl2c9rROV67l51O6+BxCgDCXQQ2uZRh4puP24J2ybtiXCGld5RBlY6Gjkt5T4fsLHMc5cKf0l9eQhh7MSMoq/L12uB32urv3Y/UHEy03UzkyotaWkH+Q0+0RJiLvhy48YxdB3gCiZqUJY12q/GJLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791798; c=relaxed/simple; bh=DXHAPbsDj/cwzlGpSaxnBgeGyc2inqFhC5IxtJKQ9BQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GJfPPtvJHCGO60pRcWO65wa6pqV0tyYM0lc2wUxJUlGDE0tCczF+bduTZaTvpWgL2eowlSVDpElsh0Txn9JmZDwfBGlTLK//nVPjIL3x/Vu56bz0sjz7QSo2wgSOreOiYeh+0MuSS6/rwRZwLtpB6/4IgVl+75xBejX594/qA9E= 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=Py02r7KE; arc=none smtp.client-ip=209.85.218.53 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="Py02r7KE" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a8b155b5e9eso24957166b.1; Tue, 01 Oct 2024 07:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791795; x=1728396595; 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=qo8MBtYtUDbvTQNmhyCFYaBep+Kwt548CvVsfmRtKkw=; b=Py02r7KEevTxd1PpB68OytPmnMfTIgCyeBar3MKwsvypNpXv6WyA492rH/VPJqwoAQ 7yhSpTUOXHKVY2ChSesrMizuqFd/jTj9OSAELocqyZAgN+WPladOJL7+DbpG2LaBd+b2 rmBzqVuCykzUZxABtXSbrmpKD2USslYGPObudnK4apLRoc1Yac+sT7+X9U0Td4RnJUCY dnagwvGC0UAtiUHVPQ8+V1sp3QgPunSvv5Q+8/YjoPH33bXmtOOC5qUjXCX1N0Gc+yne thhDw92sMfch35nSmF907ptwfbrJpcj/uxBfNjJJCYR4pXhKImjuuRjjSwCAVI9jwD7Y bswg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791795; x=1728396595; 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=qo8MBtYtUDbvTQNmhyCFYaBep+Kwt548CvVsfmRtKkw=; b=vTA/dI+GDTeAolFF+tss4wurDzq9uhGzykNoL1j5W8MM6yzEQXp+qhv/mQ8WCYNZ7n xf0wk4E2Z/d0HSCJhHp3pPY/pvA8ptgEsZveszAyds6B4vGRLBBeDWNwzS94Pb5cvONS z1b5zH7aBNcyxJ3smOd0Ty1NILz0VJVV6B+sZYgowBaYbMxoV73np9F5NnjZeNF+tBt2 NM5/CtLqVEtlOm1I0D0fZV7UDaC+YVN9KA9kQVgJnAZCD6DMaxSrwcMwYtGWyKUb8f18 LLC/ssII/FHVp/zrU2gaO1+wMlWQGITIoeLKLT5Zuk1HMqowQjwNr8Mt1TdFYU2pvR5h Dw6Q== X-Forwarded-Encrypted: i=1; AJvYcCVGxzl0akri82Ji7xfpvVZtS1UKOTsdEAgmt4CEr8JP6w/jHw78XChVbeUp8U4NcE8N8yWyJqti/z4oHJg=@vger.kernel.org, AJvYcCX1Q6Whl3TYHWC7Oyd/HjjRecrPUUC6dsam6o2R6fXLf/9IHX7wS19Q1GrkqbdnokEvFBmqkVfN4xtSHPg1fLSD/UU=@vger.kernel.org X-Gm-Message-State: AOJu0YwL/KmAC2rQKlLhOztOFna7LmWN3V8hK+4uYDJoNDHc3z12w6ao zxF7iLEUJRyAmrisP0Sny/wqwFQDNuPyjbf+3wH27BhEpZB6+qfk X-Google-Smtp-Source: AGHT+IEuetukOcYWO9V/MStpK5GipVWB5EOmhPOChI+zos5mMngpYLsEy2QB+wCWh9VrnoEf+YOY/A== X-Received: by 2002:a17:907:9341:b0:a8d:4e26:c9b9 with SMTP id a640c23a62f3a-a93c49218abmr1631032166b.17.1727791795261; Tue, 01 Oct 2024 07:09:55 -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.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:54 -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 Subject: [PATCH v3 16/17] media: rzg2l-cru: Add support to capture 8bit raw sRGB Date: Tue, 1 Oct 2024 15:09:18 +0100 Message-ID: <20241001140919.206139-17-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Add support to capture 8bit Bayer formats. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - Updated subject line - Collected RB tag v1->v2 - Used the simplified version of format handling --- .../platform/renesas/rzg2l-cru/rzg2l-csi2.c | 4 +++ .../platform/renesas/rzg2l-cru/rzg2l-ip.c | 28 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c index e21142d3b67d..84230926875a 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c @@ -188,6 +188,10 @@ struct rzg2l_csi2_format { static const struct rzg2l_csi2_format rzg2l_csi2_formats[] = { { .code = MEDIA_BUS_FMT_UYVY8_1X16, .bpp = 16 }, + { .code = MEDIA_BUS_FMT_SBGGR8_1X8, .bpp = 8, }, + { .code = MEDIA_BUS_FMT_SGBRG8_1X8, .bpp = 8, }, + { .code = MEDIA_BUS_FMT_SGRBG8_1X8, .bpp = 8, }, + { .code = MEDIA_BUS_FMT_SRGGB8_1X8, .bpp = 8, }, }; static inline struct rzg2l_csi2 *sd_to_csi2(struct v4l2_subdev *sd) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index f14ac949cc64..7e3f725eeece 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -19,6 +19,34 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { .bpp = 2, .icndmr = ICnDMR_YCMODE_UYVY, }, + { + .code = MEDIA_BUS_FMT_SBGGR8_1X8, + .format = V4L2_PIX_FMT_SBGGR8, + .datatype = MIPI_CSI2_DT_RAW8, + .bpp = 1, + .icndmr = 0, + }, + { + .code = MEDIA_BUS_FMT_SGBRG8_1X8, + .format = V4L2_PIX_FMT_SGBRG8, + .datatype = MIPI_CSI2_DT_RAW8, + .bpp = 1, + .icndmr = 0, + }, + { + .code = MEDIA_BUS_FMT_SGRBG8_1X8, + .format = V4L2_PIX_FMT_SGRBG8, + .datatype = MIPI_CSI2_DT_RAW8, + .bpp = 1, + .icndmr = 0, + }, + { + .code = MEDIA_BUS_FMT_SRGGB8_1X8, + .format = V4L2_PIX_FMT_SRGGB8, + .datatype = MIPI_CSI2_DT_RAW8, + .bpp = 1, + .icndmr = 0, + }, }; const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned int code) From patchwork Tue Oct 1 14:09:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13818079 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 94E481CBE8A; Tue, 1 Oct 2024 14:09:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791800; cv=none; b=HlIEB3cZnn+QfCA9v8iH71AVAkWMSoOh07pzpyN0e8XBIye0d/gXi5/2Sj7C6VKBnVxY8ZiwwJnjZJBBkpAZPMQPhGJCDA32okhck3kIDOlJSdFHaKHci8cN05sAhurSrz/hutr/miiLm4+X0kjpzERcAYCCq42egD+l4aZEi+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727791800; c=relaxed/simple; bh=VY91vW/qC6MJTXVGzHNIgCf1mq1jUFKjewgTdlz4O8A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kfeDvUw/4MLPU/nM3+XgouwhJE0W8djDOY2olvz4LNmp9vgnpe3qJLtZnYKDU1dQIHr9RJPJUZK8eib1Ka8RVrhpom/7WJRzF7a0N87hwhvwzjWsShWYAb8OPk9SilEUmSegXBhTbl1QiE7tS2w7TUuE9Dughi6OFyqTZJbWgbI= 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=lijWMfAI; arc=none smtp.client-ip=209.85.218.50 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="lijWMfAI" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a93b2070e0cso674327966b.3; Tue, 01 Oct 2024 07:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727791797; x=1728396597; 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=tEOzuVCWMUdGlzBesvO8nBRO0Iupuq39zvRd6ja3B6U=; b=lijWMfAI49IaTFg4HKr0uwOFrtS2CNv+fySQ5+LV9a5CfNmO3rbSoLmJ+vn5W1rCjR 7Mhr6Tqih5T0pYBbS+mkoOMS2R1NoN/3Pwo0Iwp2yc9YjPWmQr84ONYerHWjLfyy+JKo TqflngFFTQWq2xbJhiSTRDmMbWVZvUAPJypSg30L8UY1LpLjbiYaB/zVBPwgb9VKs3d5 +qUc1tiD6Ly13tHt79ymlSAyoK0+PFF2FYfAjmtXDJlM+hodgwHDflr6Qnxv+elMHs99 Frt9tb9MmnUUowcOBfxyULdeFk2C/CXuvflmZ828mY3ddTMLo/4cHtdTzGBbFovfxQR0 9OAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791797; x=1728396597; 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=tEOzuVCWMUdGlzBesvO8nBRO0Iupuq39zvRd6ja3B6U=; b=Hwi2F7Xii9Qz7iJyzIqbVYaCh/1+6EFqg449d8xDYHEKSgS0lSpAPKBUiFfkRGmdBl s7NirpvaWR34R1he8TMkQOsbkbobX2YqbAn+/ShAVuWWfSekjzXwoZ5yCT9WxUFTUMi9 bObdf0we8W/mGSCbL8slNPjG5oosTNxAULgtfvt4UI6ijCpeGJ6rNXXx/vkfqACJ2IQr /FTQwoprSju1UIwxKNje+ScUmXivvWCQlGvsyfRgZC+we5gxCtrLwp07UfeasTKRecpI aDAfaGKUIfiXXY79/qrmQ/1OJFGRy97U0pF+8KYcS5+l9HYUbNH88hHQwIo1vNlDF/KO JVjw== X-Forwarded-Encrypted: i=1; AJvYcCUQeLl2J56Ywo0N8s+MPb4vU9YZz5VCoqBBRLwXLrIQC/I2kmRd0P2y2XLTIgj7Jx6VtPdfHxYH71SWCoY=@vger.kernel.org, AJvYcCWHW6D0AOweOpoC+rQWC3NBOnGWCeRkJvlXLWNqrNtjkrsopHIuTRJ/BujMbrJiWD1m/mWRcB3xDt3q0sGMQRjede8=@vger.kernel.org X-Gm-Message-State: AOJu0YweoggMgwz5vmy5lrE0aMMr3dU4aYv/yrRWFiAGKD+co3k5n003 GqpNfgzAvHiyILJW8qu0rGd5b6ise18SLc8rLEGMPlMou000WW3F X-Google-Smtp-Source: AGHT+IGD5XwMQGufA+hBlEEu8kdEe7bkLLmIhLCjRvsQ4yUNdPPf9Cz3ZFuNrk2j+NlI1cLmGhTnuQ== X-Received: by 2002:a17:907:9812:b0:a91:1634:9e92 with SMTP id a640c23a62f3a-a93c4919832mr1616220666b.21.1727791796741; Tue, 01 Oct 2024 07:09:56 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 07:09:55 -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 Subject: [PATCH v3 17/17] media: rzg2l-cru: Move register definitions to a separate file Date: Tue, 1 Oct 2024 15:09:19 +0100 Message-ID: <20241001140919.206139-18-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Move the RZ/G2L CRU register definitions from `rzg2l-video.c` to a dedicated header file, `rzg2l-cru-regs.h`. Separating these definitions into their own file improves the readability of the code. Suggested-by: Laurent Pinchart Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v2->v3 - New patch --- .../renesas/rzg2l-cru/rzg2l-cru-regs.h | 79 +++++++++++++++++++ .../platform/renesas/rzg2l-cru/rzg2l-video.c | 69 +--------------- 2 files changed, 80 insertions(+), 68 deletions(-) create mode 100644 drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru-regs.h diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru-regs.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru-regs.h new file mode 100644 index 000000000000..458f7452e5d3 --- /dev/null +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru-regs.h @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * rzg2l-cru-regs.h--RZ/G2L (and alike SoCs) CRU Registers Definitions + * + * Copyright (C) 2024 Renesas Electronics Corp. + */ + +#ifndef __RZG2L_CRU_REGS_H__ +#define __RZG2L_CRU_REGS_H__ + +/* HW CRU Registers Definition */ + +/* CRU Control Register */ +#define CRUnCTRL 0x0 +#define CRUnCTRL_VINSEL(x) ((x) << 0) + +/* CRU Interrupt Enable Register */ +#define CRUnIE 0x4 +#define CRUnIE_EFE BIT(17) + +/* CRU Interrupt Status Register */ +#define CRUnINTS 0x8 +#define CRUnINTS_SFS BIT(16) + +/* CRU Reset Register */ +#define CRUnRST 0xc +#define CRUnRST_VRESETN BIT(0) + +/* Memory Bank Base Address (Lower) Register for CRU Image Data */ +#define AMnMBxADDRL(x) (0x100 + ((x) * 8)) + +/* Memory Bank Base Address (Higher) Register for CRU Image Data */ +#define AMnMBxADDRH(x) (0x104 + ((x) * 8)) + +/* Memory Bank Enable Register for CRU Image Data */ +#define AMnMBVALID 0x148 +#define AMnMBVALID_MBVALID(x) GENMASK(x, 0) + +/* Memory Bank Status Register for CRU Image Data */ +#define AMnMBS 0x14c +#define AMnMBS_MBSTS 0x7 + +/* AXI Master Transfer Setting Register for CRU Image Data */ +#define AMnAXIATTR 0x158 +#define AMnAXIATTR_AXILEN_MASK GENMASK(3, 0) +#define AMnAXIATTR_AXILEN (0xf) + +/* AXI Master FIFO Pointer Register for CRU Image Data */ +#define AMnFIFOPNTR 0x168 +#define AMnFIFOPNTR_FIFOWPNTR GENMASK(7, 0) +#define AMnFIFOPNTR_FIFORPNTR_Y GENMASK(23, 16) + +/* AXI Master Transfer Stop Register for CRU Image Data */ +#define AMnAXISTP 0x174 +#define AMnAXISTP_AXI_STOP BIT(0) + +/* AXI Master Transfer Stop Status Register for CRU Image Data */ +#define AMnAXISTPACK 0x178 +#define AMnAXISTPACK_AXI_STOP_ACK BIT(0) + +/* CRU Image Processing Enable Register */ +#define ICnEN 0x200 +#define ICnEN_ICEN BIT(0) + +/* CRU Image Processing Main Control Register */ +#define ICnMC 0x208 +#define ICnMC_CSCTHR BIT(5) +#define ICnMC_INF(x) ((x) << 16) +#define ICnMC_VCSEL(x) ((x) << 22) +#define ICnMC_INF_MASK GENMASK(21, 16) + +/* CRU Module Status Register */ +#define ICnMS 0x254 +#define ICnMS_IA BIT(2) + +/* CRU Data Output Mode Register */ +#define ICnDMR 0x26c + +#endif /* __RZG2L_CRU_REGS_H__ */ diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index c3d10b001b7c..d7c82c7b9044 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -20,74 +20,7 @@ #include #include "rzg2l-cru.h" - -/* HW CRU Registers Definition */ - -/* CRU Control Register */ -#define CRUnCTRL 0x0 -#define CRUnCTRL_VINSEL(x) ((x) << 0) - -/* CRU Interrupt Enable Register */ -#define CRUnIE 0x4 -#define CRUnIE_EFE BIT(17) - -/* CRU Interrupt Status Register */ -#define CRUnINTS 0x8 -#define CRUnINTS_SFS BIT(16) - -/* CRU Reset Register */ -#define CRUnRST 0xc -#define CRUnRST_VRESETN BIT(0) - -/* Memory Bank Base Address (Lower) Register for CRU Image Data */ -#define AMnMBxADDRL(x) (0x100 + ((x) * 8)) - -/* Memory Bank Base Address (Higher) Register for CRU Image Data */ -#define AMnMBxADDRH(x) (0x104 + ((x) * 8)) - -/* Memory Bank Enable Register for CRU Image Data */ -#define AMnMBVALID 0x148 -#define AMnMBVALID_MBVALID(x) GENMASK(x, 0) - -/* Memory Bank Status Register for CRU Image Data */ -#define AMnMBS 0x14c -#define AMnMBS_MBSTS 0x7 - -/* AXI Master Transfer Setting Register for CRU Image Data */ -#define AMnAXIATTR 0x158 -#define AMnAXIATTR_AXILEN_MASK GENMASK(3, 0) -#define AMnAXIATTR_AXILEN (0xf) - -/* AXI Master FIFO Pointer Register for CRU Image Data */ -#define AMnFIFOPNTR 0x168 -#define AMnFIFOPNTR_FIFOWPNTR GENMASK(7, 0) -#define AMnFIFOPNTR_FIFORPNTR_Y GENMASK(23, 16) - -/* AXI Master Transfer Stop Register for CRU Image Data */ -#define AMnAXISTP 0x174 -#define AMnAXISTP_AXI_STOP BIT(0) - -/* AXI Master Transfer Stop Status Register for CRU Image Data */ -#define AMnAXISTPACK 0x178 -#define AMnAXISTPACK_AXI_STOP_ACK BIT(0) - -/* CRU Image Processing Enable Register */ -#define ICnEN 0x200 -#define ICnEN_ICEN BIT(0) - -/* CRU Image Processing Main Control Register */ -#define ICnMC 0x208 -#define ICnMC_CSCTHR BIT(5) -#define ICnMC_INF(x) ((x) << 16) -#define ICnMC_VCSEL(x) ((x) << 22) -#define ICnMC_INF_MASK GENMASK(21, 16) - -/* CRU Module Status Register */ -#define ICnMS 0x254 -#define ICnMS_IA BIT(2) - -/* CRU Data Output Mode Register */ -#define ICnDMR 0x26c +#include "rzg2l-cru-regs.h" #define RZG2L_TIMEOUT_MS 100 #define RZG2L_RETRIES 10