From patchwork Mon Oct 7 18:48:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 833488 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 E891F1DDC1A; Mon, 7 Oct 2024 18:48:50 +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=1728326933; cv=none; b=eBu9mLWnTeuabajcvs1a3e7qwMf+qjTPzwgJPFCmuASD+ukgVeUWkc6rMrctn36eA0QsZHkIKbYq66d11q6Prequp8YcnAtGRAcusfbVk5EZUD2biCxxpmnPoF8+UASNWPM9Nbr65f8Ku8UrSPCwg14MT6YjJyZlzjD8xVVl79s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326933; c=relaxed/simple; bh=T8keBBIKmh+gQilFeSMtnLq1tChWN51TvIxv5AmsMX0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SPw3Z9wY+1mWu5rsnICD5SfznB/luLdsnk+qvjOUnM0WqC73zJ5HGj/O48DdPnnWIIfQP7mgDL8OCuzDr01dlddBTDKlAZv73HD4/5C8WDjVLNcPZtagSTNBShccY5Rl5sWIl2AYzzjYmF8RWphyxarvIOA/ouHcgTnM2Yz4KXc= 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=F5xL7hSg; 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="F5xL7hSg" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a9957588566so173725066b.3; Mon, 07 Oct 2024 11:48:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326929; x=1728931729; 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=39t/gj4BnzJio6PIx0Gz5cXfMhkF8u41aLRktL+ki3g=; b=F5xL7hSgsuut7yJp4VXnNAr/TXVQPidPLJqAxvUxvdorxCDTBYZUJ7qTFyAVWbYxYp axMWA70yQmdGGGxaDx6ndpEGUblFiV0mmP8iI0hR+bd0Io9twGwo21rZp+S9ViUuNGwm BZwFQDk1M1mK6lgRogQFyTgHTh38vZFDCyXUlk+W5nNUtU1MOsk9rcTncTMDx8Z3OOni V44HPzgk/tuGE4lfgLWUoETnqv32PasdF4H5UfAgw8vLmCIOJchw1nBcykHThYFtKsbX t3Y/zge98p4vw+7PpsQWyCB71epGOSuCdEzGUS0KwLs7uGGpPsVBHv3CbHLCsP1dkEeY 6Bew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326929; x=1728931729; 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=39t/gj4BnzJio6PIx0Gz5cXfMhkF8u41aLRktL+ki3g=; b=RS6sWKMpePIghF5K4vySRG0NeQr54WPWXjiDqAtRvyGMjeC9ziGLssISopCD7EmFVX CakMiI23hRSXF7KJMs/6Z+NoP78jRgNwiB+5QIRwMxdz0qMyBQa2qsRDa1EQhWbEIKAG Ra8ATOMi5GLELZTXKFEnXXhRvm5zLWroV9538tfWzkVxUPL6LaKPlOjwhKQeCD0cnxGr LhJGGp9dg/yI7yIncgPcfrfGTeW+zz/v6OeQfzYNGHRzBARn5Z6ljSrFq1d63VUR+Ey4 pFMeWaj25Z93qsicJcN9qXv10xcOKdqOH836g4QFzj/JghP5mlpdS0n+sPYgM422BCcq hMYQ== X-Forwarded-Encrypted: i=1; AJvYcCV9UKWFZSZVRNRjSN10YBDt+j7Zs2x0uAWl9YwihI4ivhx/Oa0sUa47BVloNcBMIWZxVClmbZVU6yQJiVg=@vger.kernel.org, AJvYcCVHinVu/hHLG3t1Eul12lFley3joCxSWuD/4xLbFrjxqWtqefmTGM3K920fLMPU8w2YoNAec/xTW4bIOC+dNhhby0w=@vger.kernel.org X-Gm-Message-State: AOJu0YxXfphH5WMmrn2bOEY8ERXlKE2jYkqiqhIpzx1Avnc/swRkrUEZ 0eWhZMgoTTXXmYLImMwSiTVeX54fjovSxIJ4xHtfFJ7UO2nLjXzN X-Google-Smtp-Source: AGHT+IFZZo+Axi3b3AUPuTX/ooCFGfkMLdiOnPYX99kpySZ+RbhYjhajstp72jrw06HefNACIOuUgg== X-Received: by 2002:a17:906:f599:b0:a99:42e7:21f with SMTP id a640c23a62f3a-a9942e73d6fmr840286966b.37.1728326929164; Mon, 07 Oct 2024 11:48:49 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:f429:642d:d66a:1085]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9953d48594sm180102766b.176.2024.10.07.11.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:48: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 v4 02/17] media: rzg2l-cru: Mark sink and source pad with MUST_CONNECT flag Date: Mon, 7 Oct 2024 19:48:24 +0100 Message-ID: <20241007184839.190519-3-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@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 --- 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 Mon Oct 7 18:48:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 833487 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (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 6DFF51DE3C4; Mon, 7 Oct 2024 18:48:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326935; cv=none; b=dV1OAWCs2HqlPYpx0kiqJJkmnmBNPiFPNCzOl1RQ9pmvzeuW1Wq7cWMECrG7YmYhU6a60Z/Xb4AVf3/nBY8PQFPclBGHbnvVhgZPtoBf4RGrZqUk2yKMEM9IuaeTAp6L2E/kNK0AnnFLBllIJQSp39PtjKqlTuRL/qqhvu/StGQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326935; c=relaxed/simple; bh=EqMgQ7qYiKXRyYfaLbrU8JB9/SiOPCFQH5V8Wh0MYjg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZG7YIKJKjkemXyEK3x0+12oAev+HOARKxp4R8VfQ9VXUBeODwYsOoGRso8r3H8QQXIJILUY8vCs5IMX80J7prIOWk+pwLf8sp5/NYcS1hmR0A7b4GTFdXrGsZjcJFFVXEh8TCMzF95rEFsPKErip2x9TlSOmPgATpOmDLkjhVn4= 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=ZEnJB23o; arc=none smtp.client-ip=209.85.218.41 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="ZEnJB23o" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a99422c796eso303548266b.3; Mon, 07 Oct 2024 11:48:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326932; x=1728931732; 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=LMIpghf6+FEz2yCIvJrjByNXfmRyRcuz+y+EE9o6Ajs=; b=ZEnJB23olItIxnPcLxSEAFkOYrR/TrblPVah+xlN8nzKkOFTshJ+pzAjxJne4vfQoD pQJk/4Ur5Ued6pTmaqaLVUoAV5hVS7wL8sqfGnzQbKDNxHJ4vtVNqtSpVoSHWnYf/TM/ 0ZnlweUm54oe9rTfPL/2AgWzQJmdRjuzzFs/eCGZ+OFQfRXbQMF5HZ9VuLQeCsvX8cyG An8mmsQPxlRXa3KMW8tFvlv21Y3o5cBwTSop0HOPqfuJoDLq3xcKsooN6L/8t1PStc8L tr+9QgAbLHrSD4A7bhv5lB/OARu+ws2rmADdlj6TlmqIYSpXp+SGTAKsS+jMQxtdpSWF PNRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326932; x=1728931732; 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=LMIpghf6+FEz2yCIvJrjByNXfmRyRcuz+y+EE9o6Ajs=; b=Y+cUvWmNlaY6ojF2FfwCgBj3cPUZYb6QKVogDRGll7ggPWSqWTqHt/bAQc34dKRj8G Krjxew5iUTjIUo4GGFVZGZxJWjd01AYgz2pSBsljNM2lcvbZO3dS67m1eiD/okQKabnV jg8dzxcssG6ejFuUBFNm/b9AIGjXgP5y4fzP+j5Ou/LGXIMqqJfg8Rd+41MGXQppPdkN dMpjdkUbEClc1BblrXqKflC8l/EO94eKDr/0SRXKi+JKjUZ86IRMDpUI3DEejq74Db// bz3So6GUyJwbiMn1AMAhFvLcp7jRLFnPkazMwPoaHXCFPwxrBaqmCeUxcDeKcKrgRWNm d2Tw== X-Forwarded-Encrypted: i=1; AJvYcCU3ijIRoKtddWFyXHoZIlpwpq6+x5aQ9IeLmDP6QWa/fCeAmFArTIP7OL00TR0oWI/rKEsEAQKSdmUTtMk2DyUo+RQ=@vger.kernel.org, AJvYcCXdPiQ43CVDsoPUqjcSTL+ju71eaItevF5JS06mFZoSMH/KYiPVvVfXqMqUNjEymLLR7Bp7QXdkbD4UEyU=@vger.kernel.org X-Gm-Message-State: AOJu0Yx809OSRcP7XDdOJiU8C/ibxnGcachrR0isPq52Y74JYeJLkaX0 SL96/dVGN2FGo6BKiVWqzXdzkucha0U67GgVB0vpkkLeymQ2qeTY X-Google-Smtp-Source: AGHT+IEowsX72R4MAwQkyk82QxJTcoez/ZeJov6/yeRD/sKv6u2uxhTezHbhs6u/j0fqGqQellwjFw== X-Received: by 2002:a17:907:3183:b0:a8d:29b7:ecf3 with SMTP id a640c23a62f3a-a991bce3fbcmr1460233166b.13.1728326931601; Mon, 07 Oct 2024 11:48:51 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:f429:642d:d66a:1085]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9953d48594sm180102766b.176.2024.10.07.11.48.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:48: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 v4 04/17] media: rzg2l-cru: csi2: Use ARRAY_SIZE() in media_entity_pads_init() Date: Mon, 7 Oct 2024 19:48:26 +0100 Message-ID: <20241007184839.190519-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@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 --- 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 Mon Oct 7 18:48:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 833486 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 622F91DE4FF; Mon, 7 Oct 2024 18:48:56 +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=1728326938; cv=none; b=VnCGkZwmG1bGe9BK3cmUTVWW+8C6rgGhO7hgpjCJBWYfynlX5+KHPGUWJYmlj5BJMJ4Coy1wj/R/PLHejqqn+P6lV1X1KO53t0lpOOwe8A1VbdoKZ76PStiUjg23rmNYzTAa7Ydrr8tVhnahzHerkNc3ZAUcA41CWcZFK0vvJ/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326938; c=relaxed/simple; bh=riQB/ps7KNocNV/AUMqu2fP1J1RbHtnimUeTAOvwnFI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=R8sPLEwXq0nYDqI9QEGRRarqQCbeasYOEw8cJ6TM5VVoS6dWxll8HkLpLq+Q/d5N8LBQnrGwnoHLwlF74fAHEo7MG0SrMP7tMMceBS9mNbnvdZjNxvNCm+K11LmsfSYIHEQo8CSp4AG/U2FgQ50XlCZbNUcJfopDV/EHQYpBGSI= 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=hYyiS4Ic; 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="hYyiS4Ic" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a993302fa02so296665566b.0; Mon, 07 Oct 2024 11:48:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326935; x=1728931735; 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=ZPJcAbqbEoGBWHFkHsMcRX6T1qK9wGSCrUFWEpC9TBk=; b=hYyiS4Ic2wGmcW6anw1WbpNGouBk/F6hDJM7KI6LictmddTW+x20ut8Di94hILr5N/ bL/mHpZzN7Q3PeFV/sKuVEv5fRgB8Lk/SimvmWm7lN6e2yc9uToG7xdZLQRusaEjStPe AqALPHUe3fW90MPZY7G9PN/xQwgQHSGcABxxqSItdC6ZOFc3OP+gRz+iujkozdBSCeMt FMMKPtRlfRCx8jNom52yZTdKcBk/JJA7xNbVdT0CIXr9Sc3GTBcuZIII4xaejLNvYuRt aXnFe3kCcUF0nwKSVihQo9iqNVctK9+zURv86SjihF1/UyhjcOUEH6lPG1PFFnETpCuT SqIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326935; x=1728931735; 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=ZPJcAbqbEoGBWHFkHsMcRX6T1qK9wGSCrUFWEpC9TBk=; b=LKpx9r7liIYmwpi/LUmI+S2mIMR43cJ9dJuwKzrOaKiah0sBp9K6u4Pm5qHFDxUE7Y D91qDJncUKO3eSaf5hA7dE8LXG+pnUTrib7esFtVY6I/NMSGn1ug2cRag3biGKrXsLF0 W0gLhdBGtvjEEymFx1hJ+v5zNfwg1ZNlLVFRcrT1y69SPFqQ6Xx0iRq9pBejKLXWYiMz oNE95OPVKuxOeHpA48Cdpda9dbr+eQ1ZtG1GEZvn2bf3xvfnTwHZmEkYv7NGiKUFEDp9 pS1t7mz7jrE7aWsikDNLw487QPtFH4//1Zmg5Y+Nnm5WapgUnvt8694+kHfjXRh7Ya9y 89BA== X-Forwarded-Encrypted: i=1; AJvYcCUg+iaB+wq8dabBMbXHypOE7jCwGltT5A1y3RKKTS1s8BJtzwZKGnqdJzsU75b0NEpjmYt2XXhCoZwjZbVOx2ch6jk=@vger.kernel.org, AJvYcCXC7Ny+PQBh5WNMzdE7KC7rEOBoGPnsQSF8Jnb4J58hvOEGT9Ps4dknxckuX1MZX62HTvKM0Wd/9EuKo/0=@vger.kernel.org X-Gm-Message-State: AOJu0YxY6y2nOHKOvMgIiGWqpF5RhXlLg18qY3TJc4oqOJ+w0f6fpcYD bicvUOjHE+mM1085RiQoC2ebaMXjm0rmDP1srH6jR+An5nBG0ubej9AwAQ== X-Google-Smtp-Source: AGHT+IE4mqA1SJnJGSK52seX2mcpG1qGXYEwMr3ZgZh1f8UXb2TJKUZr14Myqrxu+Beq00OoaEbdRw== X-Received: by 2002:a17:906:dc91:b0:a99:4780:1af with SMTP id a640c23a62f3a-a9947803f37mr703686666b.31.1728326934370; Mon, 07 Oct 2024 11:48:54 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:f429:642d:d66a:1085]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9953d48594sm180102766b.176.2024.10.07.11.48.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:48: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 , Laurent Pinchart Subject: [PATCH v4 06/17] media: rzg2l-cru: Retrieve virtual channel information Date: Mon, 7 Oct 2024 19:48:28 +0100 Message-ID: <20241007184839.190519-7-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@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 --- .../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 Mon Oct 7 18:48:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 833485 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (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 D8F961DED66; Mon, 7 Oct 2024 18:48:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326941; cv=none; b=mmLNcGd39yS773kh9ge3TETDyXtWu8tcPxraZYEfqpmdUMYpPpMzwiubvly4P18N9aKT9uPY3E9R4b2xWekRHKCo5bYNnrl2/x5He5qITyHg6xi3G3/dZFwtUCUfD69UnWJ6vbZJ7StvIC/p2B3VKHmkBQxVWCqd3/JyOnU+Z7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326941; c=relaxed/simple; bh=C1qUYYuRnWzN0Zz7CliMFvIfZZC42AzyLPIVnw9T4s4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kURhk0zlcnBszICNsDr44zoDl3GTg1Ajf+Js/OCD7dER9wPac3TiSctz6VuahcDRoD/tMusP22yK/o11oOp3W1FPmbSPj57Vnd59+kS7EGSHb7F74BLrKkUwZxOYJuZk7r85rGgbT+dboNIDcYTnUpHjUtrO/mAjEvcOsvqR3Vg= 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=DnUyPTIG; arc=none smtp.client-ip=209.85.218.47 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="DnUyPTIG" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a9952ea05c5so196339466b.2; Mon, 07 Oct 2024 11:48:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326938; x=1728931738; 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=WL+Bmul59N0MJqBB8bgrzNdSKYlWKVm6sYmTP9eyLfQ=; b=DnUyPTIGsc7Z3pxrUU6TiBcmhLsRb4bDmr2+qEMG1qbn7pXsapjbMhHNr9iWl0A1sw 2hQ1NZPTX2BNRLoZNCZ2wuFV3rWlzLJaIdQPbpdYHzeH2firE3EcIK5k9QfeqhgolIu1 IZqnh+HQrxILUB1Z8eZEfqblm2V9PBbXh2qTVKIc66Zcmob+00gzbbu0jiTKet+17F9t wC2cojgB3tvA1UaYL8W8ctLhc0A9cAV7Ufl0/li6jyUQVNsyDUdopJkYWW4Fk2TJxGVR 7Ho1IsMLPCulDQUZYPtnuXYMfiK0S3fQGpsNvMx329qxsUq8ykHdte22J4XtVvQFsqCl qa9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326938; x=1728931738; 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=WL+Bmul59N0MJqBB8bgrzNdSKYlWKVm6sYmTP9eyLfQ=; b=B/ugPeeMwvlvIVtZtXefzsdSvfxeToAGNdD6p0WRpdnJI3yh3yuZmwIMrExjvhoUC2 1bKnJgRErQkhivbZQ/Vn4YldTsQmAVm5ppr7sdx/QBPYUrmVtygF48R0AogYUb0xR5Jf I2yd/7iQpeo2apzozZbaNhq4HZAr4yPih6aNzTUtZ0jmbCwnKVRkssTWQQkPWitL+3SO ENNrL76MkYWT3rD6fF8h51qWzzie/35FgDeBowj5CBthxA8GgUnF8UsZlkuzndEZvv3a jjQIBxXHA4Mvb6Zl3eQMJKimZ88GiVqgdnXght7a9a/drslksBgFYUmHUQVOgJuXKXY3 PPAw== X-Forwarded-Encrypted: i=1; AJvYcCUsstBIhxVfHjXAWXcMfsE/QpOCWRRbv091Gp7km/oswQjv53u9iWi/mZvhiya7TcRAHlfaUF5RBzHmIexgtvxI2Ko=@vger.kernel.org, AJvYcCX4jyT8kW6Mv1SwTzy6mTq3NsvVpEigsF4+n9wTHOQhvdTB/iOMhcm6zYXXM8OSaSamtSdBzXbpsyDLZy8=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2a5cuXoFykcF7fPT8G/uicsMypGHD82g/vo9rw7uWNPsMcjxi kRzPD1c5WXSBOVWFQqs4oSmSVrCTiaMnCvL1LLPGnYy4ib1FlGU2 X-Google-Smtp-Source: AGHT+IGoGPCc2haTehShacwfXhr0S8R4aW3Lrk5v1QOoP1i5oKHQdY9yIasewRpq4rSrFgRJ12C3tQ== X-Received: by 2002:a17:906:7303:b0:a99:22e:9658 with SMTP id a640c23a62f3a-a991c031334mr1424195766b.40.1728326938105; Mon, 07 Oct 2024 11:48:58 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:f429:642d:d66a:1085]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9953d48594sm180102766b.176.2024.10.07.11.48.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:48:56 -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 v4 08/17] media: rzg2l-cru: Use MIPI CSI-2 data types for ICnMC_INF definitions Date: Mon, 7 Oct 2024 19:48:30 +0100 Message-ID: <20241007184839.190519-9-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@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 --- 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 Mon Oct 7 18:48:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 833484 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.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 DC57D1DEFF2; Mon, 7 Oct 2024 18:49:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326945; cv=none; b=mNCf3M6Lu6itxmM/CKY4tBRl60RnrmqPaanxaO7xs5ECWMILR18q21qdfCgJyYStDBmUGfwJ37S6io4pZCuR09Tv7IEHU3/YDqzKnYsI00he+XqN3f1axssQhBGUUcurkuE7WYVaQbr74/oUvHFu/+uZ90fxbULvn3vtjn0gQcg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326945; c=relaxed/simple; bh=488+LUtpmZFyb0j7et6+0vpPmSYwAsojtYgsemh5mrQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q9WDUwgF/urpcZhkiULBQLq2gpM24YeMO+MNFgrGQojc94spduBbK9t0qRrstEKiIV5w1tKb65igGV2/Zjm6ppGto1YPKBQqMf1V4ijkoSRxs/IuUD/ME4Vf1fvOx2l6N0/Gcbj8D1hzlR5t58UYBWNHm18bEnNSsc4WXgegbUo= 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=IERbQSUi; arc=none smtp.client-ip=209.85.208.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="IERbQSUi" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-5c882864d3aso5407030a12.2; Mon, 07 Oct 2024 11:49:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326942; x=1728931742; 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=/udlwEixqqFqQfbWVud6W35aJwXwj+rVRaObdZr/hWU=; b=IERbQSUiPZ+l3h7OOjucCU6M5NFri08vM7qHdY0GUJJVqNa4QusnK8CcNwmoiy62AP nQokL8xCPzerC2vU3ld5GSDTjaR23UUN8u7OwsC91aaMPcYWt9zTWDDA/d+6gs5MdNih OCD/tbZLX3mAVyuLny2gNC8vNvHpny9806GUt4w8Kq0ynla8kfZLGNdrEJ/8SmmdKMZ9 T66vjOv8IpV65nRxRnvvz+WYJFqrQSoHP7l4bk6Y3OfKf6MEsaEHDpxtJC2ENK5nqQOi IRyZBV1ymRgDWmJCDsTqCerGnZs+4MAThRCKLqcN9Om5vZHDAzbxMvl9aG8VLK1Fs3Ig amRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326942; x=1728931742; 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=/udlwEixqqFqQfbWVud6W35aJwXwj+rVRaObdZr/hWU=; b=og1p8tZPBXJ9RemaPJ4ZTAacFelzAAg9nZYYRiEBnCSvloEY9V06Am7cEBixoC7c3J DnzwMRxxNDnkHQ6MkVqWAa/JQqnz6YGP/FeGpOh1cy9p8zZSRm6d2VQYCrD3ILHnLHJn GA2b+Pd9vrRK4CnLWBgWEdBuSSuTUrrELzQKVlH1gBXjUvO1A10lcsY8lWdjIoErLmt5 R3YELOLf1uXdENW1sD0+In0lp4frW4yHdP+1zTzqJLdQnhhzmmPNVLzgEXOi+s31PTxH qia7Tc4n0tlk8ul6SIJokTf9PQgL+YkeVWEK4Tuq/IRFkmE6NeUdc89qzlIv8ngcLeW9 BxTg== X-Forwarded-Encrypted: i=1; AJvYcCVm4bfdOe8ed3MZpkGIDE5mR5iKzBYr3mytnqwNDAJpnjL+cKM7Y6CPIOuDo7mT3N7JByWVmttmTxEoyRdVKSp1dYw=@vger.kernel.org, AJvYcCX30kAW9ANWftLP8InzIjh1Kg2v99EJdkBYn3Udn8k+1e0CaxWeH+tqB53pJF6hErZX3EGugj8T4N3c4k8=@vger.kernel.org X-Gm-Message-State: AOJu0YzfAbDUG7R5+pOL4aQCQzuAYp5zF6/BTfM8zat4Q83kYec5Cx1K QVG0Z//TICIxTHpJcPQ0aPCMxiMpsrzEoq772wnvvPsLqsa6Q7OB X-Google-Smtp-Source: AGHT+IF11cOjb1tj8XDeaXhFGlkiLXEqRUCRLK2emjWbVg0XG6DJQZy2SpklgkqZ4zUgkwELdkgW1A== X-Received: by 2002:a17:907:728f:b0:a99:409a:ee6d with SMTP id a640c23a62f3a-a99409af37cmr788413966b.16.1728326941895; Mon, 07 Oct 2024 11:49:01 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:f429:642d:d66a:1085]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9953d48594sm180102766b.176.2024.10.07.11.49.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:49:01 -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 v4 10/17] media: rzg2l-cru: Simplify handling of supported formats Date: Mon, 7 Oct 2024 19:48:32 +0100 Message-ID: <20241007184839.190519-11-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@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 --- .../platform/renesas/rzg2l-cru/rzg2l-cru.h | 20 +++++- .../platform/renesas/rzg2l-cru/rzg2l-ip.c | 36 ++++++++-- .../platform/renesas/rzg2l-cru/rzg2l-video.c | 67 ++++++------------- 3 files changed, 69 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..fde6f4781cfb 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,26 @@ 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 Mon Oct 7 18:48:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 833483 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.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 365191DF26E; Mon, 7 Oct 2024 18:49:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326948; cv=none; b=MZK/ueIKieNq56vmSbbFy33NlK68DNsiDk2Vv9mjM3N2C/Bahrc83LloREWvsrzlwXEbaxFpM43K+XgPxR1x0EbTD0TiaB6yMYt4B4OIDY3j0gYAmnM7QksGbUuI8hUY9ItTglos7BFjE01i88ehiRoH/6KeWNPkTw43PGJdUb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326948; c=relaxed/simple; bh=BK/nuBnleo0GMpERs+3xSBfnWAQP2PkPNF09ALoxB68=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EzZ1borxtInyQbX5CzUfhtkCi8A1t/xzoofW9SaAJIbwNzcNJcbWm/YB15VUP94/V1KCHZclr7IoC8SiTZYQTPhPAaaSVlZ3vy9dkr128v/hMWHVPTFX4SezCewAieJFHc5b9ho2h/scbBksU0rIlFWernrIytlW2FnJiZP6Rwk= 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=GAu4MYdl; arc=none smtp.client-ip=209.85.208.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="GAu4MYdl" Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-5c8844f0ccaso6572771a12.0; Mon, 07 Oct 2024 11:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326946; x=1728931746; 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=pVADDJD/udDduyc0qzmtsHFliZ+t+L+Lt159xgWI2tA=; b=GAu4MYdl8wBdV+8UvTiF7uZYdYMAYuZNJOjS2cdpWRi69Rfdhb8+sCNYO+fYhZisMu S+K4CqLqGmngKVhj8XU/PmfIVwk5QZUtQj5UbjlEceqT9VmxnbMVOBLCRNo1W8k4fND1 WwqdYdAhaJqNyJGqTyuEg+FOwR4SPpkaMAfUmzQDuI6IGsi0Z4+FLjTNCoZvRvtVhG9k gkFzRqzVV48N09M5uZTFlmGMmoJN+zPOPZrjSZrUWBCpHNG7c8ywqnWjNylgdvsvgyl6 hAbu8mfmxiaW8BZVY5eDuNpSv0xM8Z4VIgUTR3ltovIExPIIQIvBjovanqLFtpecc4hZ oR7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326946; x=1728931746; 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=pVADDJD/udDduyc0qzmtsHFliZ+t+L+Lt159xgWI2tA=; b=CnCWADFkY4KFOW4ffbWihZd9M/AC74SMkZagfXr3d4bz7fvpeP9vTawQ/4KO/ulcki IOstfNp29+mmz3JFSHFs7rtA1bCe04wDFqSp9hBTs+QUQIPh/pdbD/yBhW7sAQd5ZYdn 0Hamt91RzJyj6jC5HXFTtgytpCPCbcuxz/dmNP1MxRnI0DktQhsIWQCXaJqATY0WhKQv P2iG/LMaq3BUSB0tWtJJnnMkXyU+Iidr7x2SVDgLxcgWwa9JIVySKyH4JsZo13T5tHEn TbYbzDwKNE0UqhTka19VWIWfAJwss9LQ8mpYjN4yhNYwuG3DFJsST3H23R3zNX48n4IU evhQ== X-Forwarded-Encrypted: i=1; AJvYcCUAIgVnqwZ19nrs3w8sAa4EB4JUOv+Tqy9B+nNWaHRSqWS8vcQwoL1sqK30dDzyZsCU5MAMUEJ+vQrIyOs=@vger.kernel.org, AJvYcCVkcEfN9YX51vUDe9dOZWxbU0NzWgP7S9hhwKK5PEgBVlS+FvPrOrrfyRkV60jrS5JVeDMzK7Mugb1wzt5pph3i8PM=@vger.kernel.org X-Gm-Message-State: AOJu0Yy7NbkPhyoC3L+r8p7xlDZ8gMFD9RPiCWF+yt7ZM2epl3YtGDIe rskosYQgKpUQJapQhz0jNnJtb57R8olBkZj0+q5PeMSfF3Z9wSKT X-Google-Smtp-Source: AGHT+IGKLM4G7WyikQKuEzaTE/T5nEbBP7do9Gf+rgLPXe2Kq4Y0QiKaXxSklQMdrll6rx5p12uIbA== X-Received: by 2002:a17:906:da89:b0:a8a:837c:ebd4 with SMTP id a640c23a62f3a-a991bd71c4emr1428063566b.27.1728326945440; Mon, 07 Oct 2024 11:49:05 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:f429:642d:d66a:1085]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9953d48594sm180102766b.176.2024.10.07.11.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:49:04 -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 v4 12/17] media: rzg2l-cru: csi2: Remove unused field from rzg2l_csi2_format Date: Mon, 7 Oct 2024 19:48:34 +0100 Message-ID: <20241007184839.190519-13-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@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 --- 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 Mon Oct 7 18:48:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 833482 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.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 822421DF73F; Mon, 7 Oct 2024 18:49:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326951; cv=none; b=MH+Xm1ae7ZzU5Fbr01XNACHU2j7uoEAoKAuQPl0XXB5/f9S4zmTYGJ+G/FgJv4vbuIJGQ7Yigm9A+L9jKMTi1P7gFgUz+JnExQkDL1F8ZmbvaPi0LcSO/h3Njgz0hDXRU4ppbnAsevimuya37/PBohNiwn9BpK+YQ5csuEens54= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326951; c=relaxed/simple; bh=RsSdZNrx3Rc7LnOARDgr5Ae2+j/EXAx9YIy2cRRGl+I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sjTw2az2IcA/3Ov8wAukF0OZBJxXXiGFFEWgIzUDJ4/yzyjvjoX534GRlkp6STUsN3ICI0imObH1PRWaawxO07OnO2OsNfWcI2vIaRIdej2GSOovsYuH/eSEtfwh4ZEZnDeSUHRpqSvjR/Jwkt8m7aL2+A1x0IOn1ZcPKY9iH90= 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=cbdmg4Sv; arc=none smtp.client-ip=209.85.208.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="cbdmg4Sv" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5c5bca6603aso6091180a12.1; Mon, 07 Oct 2024 11:49:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326948; x=1728931748; 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=08FAam47UPSI6H+mP70G73QMJj9mpHg1g0p/c3RuM3o=; b=cbdmg4Svy27v5+3STVQoT81l0Amfr18wIAE2TD4OcY4zPFiA/UJsExV2ZOUR/5EdJp YqtrMXmFpPsj2T1VwzNJWp7iQNUa2CfZjkGy+3gnjnmkJpg5+lSYdYCCxMvI+gl9cLTc bcyqWdtjEmg5b0I873W7lyaozdPfWs9/2gMtT1/fGcEJ24j0iHR9OyHSGRkZajF/bWKe xmN3cjBH8ylws9AJcVE5BBZBsL8HRGwEwIg9l/FTq+z4eWM9LO+uCR17CDhN+0lZhT+G kIAaMjqFKJ9YQaM9OqZPZ7/AC70fQHNYj79WXrDIJdLm38+WuPRpU4tPOtN3d26yJNzS 9UbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326948; x=1728931748; 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=08FAam47UPSI6H+mP70G73QMJj9mpHg1g0p/c3RuM3o=; b=YhsSRud6QAyRzavvmAn8E1JEZ/8sE1DveAdrRSSQUkhIJnF/0ZlX6wbmcBu8yOSmgH 3nh84fuNprlzf4Wlxl+gCfzlvziIhTx24R+SgWC5Cogl0oUjX9ByMTaeYzmRbt0QKVrC xAWqFVYUQXHlhWexv0xmfq2CMthRSfqT4BK6U+1JI2KOJspu90CbM1xmWT7emdeCU6TD SCqgQf6tMQT9+8sgsadE6ajKEaXl2QCwfnyFcta3kHbB1fMcRGRX6PG6DEOTFic8OZU4 vhusuaPRkaSFgblfbQuPKvMsSfarCLR4E/7tFT4TMjV9z44u3J6fJ9jfzmtcge83DSu3 14VA== X-Forwarded-Encrypted: i=1; AJvYcCW9cEic3dL2DU+T8NZHIwrfNGaV6+t77dVKc1y95W0tGFZh5yDkylRZGTlaLvvU9h/v850Bf6vMPbBByQAkW8BqwCQ=@vger.kernel.org, AJvYcCXZwURCZUHPasRrgnu/sOKpAQOe+19ua1sM5sYTuTlbuwablX4ji00Sh7XvVJahjxCf8R7Po7Qt6uJDE5c=@vger.kernel.org X-Gm-Message-State: AOJu0Yynhbon+M0yLDC+KqHKLluwsiY9sDJYzyaJsuMMRQSdCwkpv+TK 6k5wXvVprYQmkD5SqfUpwt1S4s8PUI6hYLoOH9Z5rGT7zDv7MKwj X-Google-Smtp-Source: AGHT+IHg2+Nth1CMVfZ4r1VYzlkXTkDPoovOxUkEI8i+SAlaEmpH+/WZFFteM2Mnj4QL9pXThm4qdQ== X-Received: by 2002:a17:907:25c1:b0:a91:15dc:31ab with SMTP id a640c23a62f3a-a991c06c9e2mr1123521966b.53.1728326947758; Mon, 07 Oct 2024 11:49:07 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:f429:642d:d66a:1085]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9953d48594sm180102766b.176.2024.10.07.11.49.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:49:07 -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 v4 14/17] media: rzg2l-cru: csi2: Use rzg2l_csi2_formats array in enum_frame_size Date: Mon, 7 Oct 2024 19:48:36 +0100 Message-ID: <20241007184839.190519-15-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@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 --- 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 Mon Oct 7 18:48:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 833481 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 3DDA01DE2CF; Mon, 7 Oct 2024 18:49:11 +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=1728326954; cv=none; b=kTsI4YC6K7jEQ7TeSx2r+/Vm8JiCrdg6ze3waI7tx14inTCq5oWuT58qSh66NhaKQAuonc9hzQKzgblnx3zuWmmoEPpNtjmoZNNyTRHvtIP4K/iNop4PbCThd0hUjK2zvIRC4EdSDGNBhx0K8yCWF2e3KYitQn8OElx5HpGDHOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326954; c=relaxed/simple; bh=74HnUwgStXV2S/0djHYPe5cHNilDGV2N11glgUpAaJk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OdtO5uxE+DvDiki2zsaEu6vzmztevZjo1/CYWWtHqJDdLuVLJ+oigd1S14bTrrLswGECgPphKUh0a5BVDRn4sVchSWWJyd4Gpu6bNJ9WqFUBrZeEshN+ZfO6zo0hpG7aeldKq9v+xSS6kP7KpdK0eexQOFH4GY6g3IdWCvIWVzo= 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=ExbbmM03; 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="ExbbmM03" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a8a7596b7dfso825345666b.0; Mon, 07 Oct 2024 11:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326950; x=1728931750; 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=4SdC8NARTpJGb0nXuSPzHlKh8nAUqNB9+p6zjHGsAME=; b=ExbbmM03fz5G8pN3/iKGMnBE7BoKt0YoJ6RKxCUFPI8WgLP9ytiflzryZPMaIcSZRW dLwjCapqSO0R3MMS2LmzTZAwNP9hEaPQ8koHNuZuJRxwwsennHHeMm+EDyobdvujLjzo 4PG8KC9h9Z5R4Fkqrk/QLa0cjvY4XGXvWZgnOv4MCa8Dpf2M5EFcmBpjx/H968Fz79UC v6TRzauIwferwRQkQ6ZNoMD9V2ZV0JxgOPpuYunQpkVhiZWr+UYv/3yPViZoCDNGdQzt q9Q8SdW9mpiDIDTiGJTgN2UJdnpDjs/mmgU59/le8tUa9I2ZAbVcX2hdN1Nazq7tBI9i 0l7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326950; x=1728931750; 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=4SdC8NARTpJGb0nXuSPzHlKh8nAUqNB9+p6zjHGsAME=; b=XL0Q1S6hhR8kzOM5VMThR0sodLJfrAgKi+4MF8cHjGXACANcEf3fG4NjnNxlZ/bVlu Kv+S/8PMiEikGB9tHUiIZCDkzNgxURrUhRNBK9GIawBBS5V8M/JXj2rVjMT4vHW5DV+W UEQi/GDwI6RWUnas8RHAoEIxxS8t+/arjSG+r4daoPlWSFsmSAigKLp6O2wlCls9oHOr mPY1iTF+Qkfl9uqW2Jk65zBclj0MOcpBZZK+0V1A08epu2+MjozMtvMxt1c1G+mEXU8R BvCUoNsEEZs7FEn9CFIo4SeHNn/BN1m3HidpRTK1n8BNCmMaz48+B+G7SHqxeXCbEcWY dz/g== X-Forwarded-Encrypted: i=1; AJvYcCVOlIQVGxL8bRn2lEJCcIeLkUxpJgBEvjKkG78QDHXb4Pp6Kzzqs5MFw9lA4R+G4hEBgjXLeY0fw1uOyHQ=@vger.kernel.org, AJvYcCW3WZF007E8W1V03XIRr6PUezp47fVwBRCy7DnHuUPF7gGwgCsaj5cZgKNczqE+80sTafuTg8gj2jbhst1Mqz7h4zY=@vger.kernel.org X-Gm-Message-State: AOJu0YykwviRz6jtnU6ICwf1pyMSjCXsra6qXqEzudJJOQobt9N0WRSQ qo1Kvjkg9kuVBkMXoIAUnlZNLJF0PRRNpOT2MBa7RTQBbafuKShsP/4TqA== X-Google-Smtp-Source: AGHT+IEKZfhFv6fqAw6v9Iv29/q28Ziq7Nrie15hPqjgW3rCpAQTUaYvyN2Upd3KBT5rl4W831GGCA== X-Received: by 2002:a17:906:f59a:b0:a91:161d:7e7a with SMTP id a640c23a62f3a-a9967860a94mr69768566b.3.1728326950374; Mon, 07 Oct 2024 11:49:10 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:f429:642d:d66a:1085]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9953d48594sm180102766b.176.2024.10.07.11.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:49:09 -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 v4 16/17] media: rzg2l-cru: Add support to capture 8bit raw sRGB Date: Mon, 7 Oct 2024 19:48:38 +0100 Message-ID: <20241007184839.190519-17-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241007184839.190519-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@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 --- .../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 383f4b30e2ee..87c194961edf 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)