From patchwork Mon Oct 7 18:48:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13825145 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (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 EBE881DC046; Mon, 7 Oct 2024 18:48:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326931; cv=none; b=dwJI262+ZR9i4JbzI7TaijtJPlvOvIc//VvrqQLPoFzcfBxl2oT1pcpnHqnAVx0WUkdRdz9Fw9nShm/PioqDvS014vj85Mq43gCjo4jlG+OMBBF+KGOjngeBHYduWwItol6e3NxYWwRiouz70gDiRH+txWlRBLhNZO6PcC358Uc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326931; c=relaxed/simple; bh=i1qXdEBpnGriWoad2OUw0LjWiot65g8XR1zyIQJI1lo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZjriL+7Orv+wQCKYbsGh7wn1jCOzNQXXdx54Ysr9jYQ0NwYg/1WFH3ue7yvSKwIJ+n+JTbhp0JQP7ARfVtPgXQFA1CP6pEXjLrPRO9PsvKTlZaqPBGiyCgpVjuOprE6JmNUZojPXTieNFNQEzzt9We+6M2Iz4DJMF4kA6N8owMU= 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=haTA3sAD; arc=none smtp.client-ip=209.85.218.42 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="haTA3sAD" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a9943897c07so310427866b.3; Mon, 07 Oct 2024 11:48:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326928; x=1728931728; 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=N6hiBvRbwfsdlAJRIKTRoCgEM0lXiJPtAQiM4M7Yq7o=; b=haTA3sADoIkkG7cIqEG4Sq2MUy9FpfJcXRUGPdBg10fzwaQ3vQQSpdLrH4hoSMg05t lWCMdkEhLOMKrZMtrfFS5ykVl9jeiJHxS+llUftqzZxjwsUZtsdEZYNTZArR2N+IYHt9 30jTAaLyyCoM/yeK9PLcWNrp8Tw9nlYdIHIcFq8qxwEnEeUPvnJzH0dTJO4wSjkJqEnF DUXp52dIWdaL7EJiewr9rvvgGekFRt9KSwpusyt0uQvjKZaSMN1wDnljpOVOlzhnqP0b M+7l7nhLMokWZmXo1VLUAxT4WrKJzD0cs1+BfMHaPco4EIB1EDJb3fjPDxQYAi1RqAuE 3E2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326928; x=1728931728; 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=N6hiBvRbwfsdlAJRIKTRoCgEM0lXiJPtAQiM4M7Yq7o=; b=h0TStiDPgVpAfYg5z5FQdl/CcFPG2/fVroHkk2EgS2UqczW0ej6U9kKKpL2pwhzokZ Hb4RCOi+XxaBUV4U39l+dca7RHPa7woL/aXC5gXPVSv14ifiIFWZxWETMhNmma6pMDgL a0Aj5GYUPOJSUtxvIovOdAAdkpDJgFnCr4YjMBo6EizRKwGZ2NtnrG7Z7PjKB7Dwlgda oAh1c826b0gLX21gQPeTaAF5Ksee+5sofuzyV5JzUIanjCf7qIpAcXTMKeCiiqvsiVGh xWomfveRVPcSdp5y5h9WcSCZ6Rs4YbgVzQkM9jLTFUgh+5Tz2Rme/AlvPTn1FJtgQiJK taZw== X-Forwarded-Encrypted: i=1; AJvYcCVUNVFUyBDnslsxUKnI+Ees3SYwyHrGWcT6ttdXXLBuAzSByiYnvQklrqybyR2CqZehPzz1iG/+EfvmySEdFOFPqdo=@vger.kernel.org, AJvYcCWrGfpnUJDOwp8bjyGeUwR4gliHpdN/gfNStWWQ9uBEPUTKuqns0lDk40tW1ADyHulLclUfhF15HFf26a8=@vger.kernel.org X-Gm-Message-State: AOJu0YzMj2bCw8PgXu/teaH9iTfE89XKzUBqPGFa0M9RJr4VEspyWq2R mDR1IFVHVCF1o4atD93irhzddnEyGF1lno4OERXJIHfhkvg7GYK2 X-Google-Smtp-Source: AGHT+IGQvX4/I3SQeMaxk5/UXMxVH4W5OYkyllMmFHJ62Z4QX1F7Sr3lzfzpt+B5AC2c7G3tbQlqYw== X-Received: by 2002:a17:907:934a:b0:a7d:c148:ec85 with SMTP id a640c23a62f3a-a991c053223mr1537177466b.62.1728326928134; Mon, 07 Oct 2024 11:48:48 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:48:47 -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 01/17] media: rzg2l-cru: Use RZG2L_CRU_IP_SINK/SOURCE enum entries Date: Mon, 7 Oct 2024 19:48:23 +0100 Message-ID: <20241007184839.190519-2-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-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 --- 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 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: 13825146 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 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-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 --- 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:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13825147 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (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 DC1101DE3B9; Mon, 7 Oct 2024 18:48:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326934; cv=none; b=Hsv4pDVH0LZsXe2b5inzmzkGr5DqX/WZ6TN3UkAu7fUvi8if4uzxNpPenRyd07jKYPPnCG31S0RkGRlEJFaps5XzsXDqDP4hj9RbB/zirWAx7ntvPsQd1akPd6MLBzransLCTO4kypQHIEhN9+CfORYP5VYw7YgZoF+3HfdWcuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326934; c=relaxed/simple; bh=pcfgfWFO4/e6ngaEOYf/I9xYEAvOdCY1IzThYtqzqpU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kaI81F7HX+l8Q+m17cFozprPCXdGq9ILrPq/jEAIKJSibPNoG6aJJEB87GOLtz0Pk2wNlzJEvTEgiluw0vIQX6CctE0yzZ/6r9X05JFowTgog7QeMYny1Vb0olIkOfjlbQ3rjs5XcPyN2bNohf6ztYcgW5N72CbVCeN5Nrx4ew4= 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=TMIslS6q; arc=none smtp.client-ip=209.85.208.177 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="TMIslS6q" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2fac6b3c220so61510631fa.2; Mon, 07 Oct 2024 11:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326931; x=1728931731; 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=SnzUD0XGwShtQYaTeIme9/Et1GdDQt24EpXyBbyJYVg=; b=TMIslS6qvdTy8ycGEvQbFuIBH7yqRXWwBhSCqS/uUV8zu7HxRTMX8qBVB8Vp2K4Gmw 7qhCsOLyTO5vNFVv4YZBOeE92a6oAayOUFQqVTuhg9hvXj6SrOPlIkixmy5/W9YKE1ib MmfNXjSVkmEsC9aKbz5e7MUV9sG6znTy4bFj/r/8wNDite2izFtchu633jGwPDTkL7Me 7I0ZKjKTsfxbinaKRFMQSYP9etdiAT4Qh5wCOyRFbPD4pbw4vRWJnmldA7TxQEpez6yZ CF6TNr5ayYX5y7rWJUoqIrYId0zaVZit45Ykg6O6ZdKmV3k/i3ywgAAfYGpbmEVKyzam Bzpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326931; x=1728931731; 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=SnzUD0XGwShtQYaTeIme9/Et1GdDQt24EpXyBbyJYVg=; b=GQYRtDDsgGmlQZBMn/uAitzwHJOxcC9qSHfiatuFguY+l084e6kzpHnRbSOw1XQciV ZtcYDnzz46oHN6VARxQ5vWEGOTy90YKcIv5Fl6AbLkXxNJcZnRVoyy7abJYEd+keBuCY QsNTUSNZihEkEMptVJDKjiSpV8EtLWlyH0K0Q1UTHnzn1QbbV1n7YqgpazKlFsZ0cz+T MADyf0cRDh9wbGKJewiR47nBVfIanLdFVpTV+lBVFozYDSLr3Y6qO6/9DRFVlW8iMa2q CKDTdU7+e1WKvPU7I4JTSbcBpsqkxI1RRkk3OQfe2oZItMVLlcGUvt/tiqlrBzmVRhdS GTgw== X-Forwarded-Encrypted: i=1; AJvYcCVTEfh5vvkk2YcPmQzRmiM9rBCQpP9NHSNeLJDoRUsXbyGQKjE6wGT9ddlmCbqozivsDGgFDdkn+dTjpc8=@vger.kernel.org, AJvYcCW1p6ujN8ZXxfXLqYsBEPt06ubutuZ+xqeM0n8iitcNzasJet5JkfuYcJaark1QDABLHW7gM6H5oAcLGCmSHU30rXY=@vger.kernel.org X-Gm-Message-State: AOJu0Yztm19lDc7hTuMlztN1Q43C09xMN4mPhQesWjlN5tlXlqewWN6L Og+FrX6Z/2fIUJJqhYGoEaixZObF+CInIn93h53UBOumakKr2gWk/raBvA== X-Google-Smtp-Source: AGHT+IH/WD2cSCcuj8P0IlM3sGYJSHWtZIWvG7uBp9BOfO+yMceLT2XRBzbHtHxjIgB3XSJmzmWklQ== X-Received: by 2002:a05:651c:19ab:b0:2fa:c455:23c with SMTP id 38308e7fff4ca-2faf3d79741mr87322741fa.42.1728326930536; Mon, 07 Oct 2024 11:48:50 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:48: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 v4 03/17] media: rzg2l-cru: csi2: Mark sink and source pad with MUST_CONNECT flag Date: Mon, 7 Oct 2024 19:48:25 +0100 Message-ID: <20241007184839.190519-4-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-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 --- 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 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: 13825148 X-Patchwork-Delegate: kieran@bingham.xyz 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-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 --- 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:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13825149 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 CA8781DE4C7; Mon, 7 Oct 2024 18:48:54 +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=1728326936; cv=none; b=vDj9y12bnNI62cF1LPzOdaGesmyh7pgrBfb3XQOkLPM8F+C9Vk5ZzcgLQS5T2C1qB+avDfSMRbmuu3t9XhhXo6p0OGK5Mr4EjzHAT1A2Eq414US9bP+G1EZrKNG24Y9RJO7tzwIGe74EoHYZshadC2BvVStyquhDSr6o9YiHdoo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326936; c=relaxed/simple; bh=7XriRKCpYwD8owVfe8+uQIfwJyyzecNO4HObS1ODUME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GM8RXYh7kUseS+TwqJ5ZM3fdfu3Cgrd/gtlxfp5fYdxQGUKF5LoykugtV7hf/fVpvLOT5yljOY4ASezxH+NE3jTUP5/rW4zgiFSaLotx3JGQNkYzChAfjiQA+M8EvQdl5N/2EqKuLqSDJL68Eb1pNcL1ZF3ZVWcsGUCAdm1A56I= 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=jeZHBfr5; 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="jeZHBfr5" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a7a843bef98so642279366b.2; Mon, 07 Oct 2024 11:48:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326933; x=1728931733; 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=TuJj8iAoHYUBdDmpC5vawKODy4yu0kSUJX/hjCQJ+sc=; b=jeZHBfr509CI6fpG1DN3NH6QL45JEdUm4qV+ZA8ZcyoE4ol7BWBpnhv9vJMFgsCdio SCSMsa8poMhP1FyvJYfKgkg3g8rdHmWLI3RvpaDAQWqjLvZB7/X9bjpAd1zKv8YXZvVo tQI0YQ7sDMOVZTA5RwG/2/5MfIaW5Uy57u3eELhR5K/UoV2R9XK/JkozLVV72lwseOxZ cJxtcrudVTV/Se9QPqQUu3MqrX6LBqmFsVXbiFmlrGnMdvC8dL/LbNk4OaB79e0m01+i rRvO3ci7YHvSxlq2MFQJVXAlAHZY7AtfdrtWng3vXNoHAm8ELLWHfrsRUiQMFAFx+v1A sT5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326933; x=1728931733; 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=TuJj8iAoHYUBdDmpC5vawKODy4yu0kSUJX/hjCQJ+sc=; b=IAqRAkHCSnMAMA6sMesKUKbA3rXu2l7WPKoSfaFy706hers3Q4zL2B35Xv9zwmkXf1 5+8ivi5fGy7UjpAZnFSJFAyV5jCmwE+N/HucOtsqYiZCFLDwEyx6jy8Sbf/qJdP7VDO2 5Mg9oAYsipFPDoYEY7GMWT3J3gAQZP5UIzvl0ftvIYe4oY8gpZZHhLhbSgW7RSlXpzQH zHaFAzw6FU+b5V3wIhV5A5WueMEn03G1yKy0RRT6eRvzdsrjk26d/frtYezMBwZCjtLD Ta3rct9e8ttYxDKXvsp1XFnaRXOYYwhDELkfH6c3u2XchtYcqhkfYCdvoLSiyHxqLqVs ut4w== X-Forwarded-Encrypted: i=1; AJvYcCUCQdfosy3/vuOLclXi7o2G7Abc3JJ3uVCY8aAXHvB+D2jO0RXcvsfVz7O6gBZUGAVPr49+NdnyA7+whtM=@vger.kernel.org, AJvYcCXpPcW9mfp1yoQIv/OOD2AQOqGzSAXdIZA0Pq/ejwOM4vvp4V21n9wWx7JllASw103vI34NcQnRzYCCpQwWVofpA7Q=@vger.kernel.org X-Gm-Message-State: AOJu0YxsFcGJwYCAlVsKG1mkXi6bxL1YaRKMOH8Pd8xXgI+6g9fQzR+0 L+SysgTq13V+27QsrkMy7JVeV/K39ec71/rM3URXQpUxisOCpFCx X-Google-Smtp-Source: AGHT+IGZkKa8vnRrWQ+XIpIVzr3LAbJFo1i0vzokOUumSnPqxGPrVphhdUXG8vG4Of5MqK3Er+rOMg== X-Received: by 2002:a17:906:f584:b0:a99:d52:451c with SMTP id a640c23a62f3a-a991bce3436mr1327506266b.13.1728326933050; Mon, 07 Oct 2024 11:48:53 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:48: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 , Laurent Pinchart Subject: [PATCH v4 05/17] media: rzg2l-cru: csi2: Implement .get_frame_desc() Date: Mon, 7 Oct 2024 19:48:27 +0100 Message-ID: <20241007184839.190519-6-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-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 --- .../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 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: 13825150 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 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-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 --- .../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:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13825151 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (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 2D2D31DE89E; Mon, 7 Oct 2024 18:48:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326939; cv=none; b=VflPQod7qQ/HfUWyJlwm2rbFz+h78OIES+fRXZ7JxLzCEiou8n8rR/j4BtY9F/lH/jkpzgpq0+UpxKnvxG7rzLUi7tv2fh/0rREsGZc15lGOxjjRSTjZvfbPq0CJiU3wtR2FwWarX2Bpdwrer5AJwCLQ7M2ReSdJJt8D706Www0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326939; c=relaxed/simple; bh=R4slbuQbnwLyRfm3Uh78TiH/6+iHc6Vpb7lHlAzHkVw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u+9rlNIs/meWR1rS8/wnRDuwe9mZ1m7zbmuTMPnIDChchfNMKfA+jN7BTbqXlKLfkVLcjTbGTh9F4olyt3qnW646jaEDGeHL+c6rGBtlbRpHUjg+PRJgav1bfkEJr9XzEvBgLcPT/2jkWnyfmdUL/ZD8wFFxsoHd/ZOGCu3p+xA= 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=mSmHIorF; arc=none smtp.client-ip=209.85.218.42 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="mSmHIorF" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a993302fa02so296666666b.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=WDiX1yG/K2ux0bWDrdd88+XgQUgVwzcRTQU+c6loKrM=; b=mSmHIorFKBT2cDim/BZ9cCB3sOUxmXo87buT5jVgJCYcmtMzCvE60yunBtSsxojfeT txNMCJvYCrvFxrxYo3BnHyJ5N5WReNAKra/uaU6mmUD3RKXlHrHi9WJMhqTeyXsd0rC/ nPlXaRtMjSbiSp8IwC4U8fqlZInIIpffMbN8Svw/hrd8XWJdTZdxJcDh7sW5A0depYAo x4w3fNQ8tnjmsbaBQ3fW89PnBooo5lAm/OZiugdMZygTHoO/HyaxfAAkoEcnRe3pT5Dk RUVskx4LDe5xRFHl4wRCqWc2CARO05LfhbVwjuZxtzt/McshT8q0GJjqUF6JpdM/y7Rq LquQ== 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=WDiX1yG/K2ux0bWDrdd88+XgQUgVwzcRTQU+c6loKrM=; b=ABAa5Ek3NQXzQMSM67HAG0semq4Ts73F0mjIqmccjKLtgTRQhW9RYNylYNEQeWZE/4 49f3DDF+X+evLye99C0slAuUiXDluTbTIaOE1616E3qlAdkCs3+4Hu9D9lA+nM7gjwQX TregTOz5mHY5SNP6JQvhhkHVwwFPw7t7aZTTHrHIPY7vMUFEh9FLd1MnymYkddNH5pGZ NFkNYD5ldCMGJbpML+4wm0LornPV3EtZYRaid5zNxrX1RlIaZLsNVhw7PQDE8VuX73ko MsCvHP6TgA5f1+PlyYzTuQFgmrV/fS16uuFDm7G9aYjXJj9mCsXOfiqt3YQyQgFkbdj0 L+Ww== X-Forwarded-Encrypted: i=1; AJvYcCUw/mBmp5puCWqD5zqo1Ek4jsJWkcy7zaGaOLiP16w1GiSOy5tsxD0Be93KzGS+GLmN6X2mZ2+qChy6V3M=@vger.kernel.org, AJvYcCXa2mg/4dnwvpi4929WVf310+Dv56w/opVbszTlTNKIGR4pGig92GrE7T66ENreVX2ONYY9kTVrGWGYCBBaHnQb/00=@vger.kernel.org X-Gm-Message-State: AOJu0Yyb8ML7UfC3je9d2l0c5DqQeYohBfCMcHTJr5vfXh4i8aywXsu1 P20tGk40treSUUtv5/w5OKQHseBzescgNeD8p0M7oApCvFRjxjPjwJuUlA== X-Google-Smtp-Source: AGHT+IFH8rxA6j2sGotJUzvUqMblzrgM0r3cvwiPMFO0XBIe17I+9jjGsBulxWovTR06yhDlccvbiQ== X-Received: by 2002:a17:907:60d6:b0:a99:4ba9:c965 with SMTP id a640c23a62f3a-a994ba9ca53mr689684566b.44.1728326935296; Mon, 07 Oct 2024 11:48:55 -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.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:48: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 v4 07/17] media: rzg2l-cru: Remove `channel` member from `struct rzg2l_cru_csi` Date: Mon, 7 Oct 2024 19:48:29 +0100 Message-ID: <20241007184839.190519-8-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-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 --- .../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 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: 13825152 X-Patchwork-Delegate: kieran@bingham.xyz 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-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 --- 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:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13825153 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 730961DEFE1; Mon, 7 Oct 2024 18:49:02 +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=1728326944; cv=none; b=JaBssKPhSOti6reggCwNegGCJrOabdaMTtKtojmLtmw98Gp+E2tL3P575xZoqZ/N0mXr3zuRcKxFKzC5KKErkadw7gSVQ9yXXLkI8yuPQON6WtkPNqH0wuf1XHIGXVApAB6+vkBMwKERmGaz3z8zlcUTAnlib+us1QH3t61GZn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326944; c=relaxed/simple; bh=jjKhdL2ZlFvCxK6TQCDrMqBP3ZWyNv7UnbEcwC/zyfU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q6PVu8jmxjOgu7RoQ5SLnLNQ0sibCW+LaQ8P/TTZKMr/1riRVmPhWsSSv5Mjmm+v/aNslOsx8fyt3KmG1FIrmm1piRbRRgxjnfmYJTp/RF2piK6IzKeWTehAr1nxq/BFnxTXBCeKdM2Ld2Y3sUckffJRsCRvQ/sIMyZLN7kS4uY= 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=ipl1k9Pv; 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="ipl1k9Pv" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a993302fa02so296676866b.0; Mon, 07 Oct 2024 11:49:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326941; x=1728931741; 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=LOA5rh/i3sB2aiZsIVyQZqxDqnBUHZOsMDWgLcJkZqo=; b=ipl1k9PvR2s7MMuX5ihqN348R0R4lhAk8au07+EZ6Cc2rrjcMzWMx5zJK4+HQ5TkkT ZC7XCqywe47WMtkV6VlMEDsWCLd/lQl95jan+XYLF1WlfIqxXcTdsCzG/vynSG1KSTqE ZRr8uUz9g1Hsv9Hnng0Lc6orTYtNNYy80+dQO6AxIeQQyRQ4ihCz57pYyplduo+JChuW 25bj0wLs1YOsiRsUtPZJ9EoYecNs182H6kQhYzVxMdAzrPTn55vulR2gCd403tjM8q9K qUhJdZi0dnuICsxIQUvPNsAWapDw8lxJFdBrd+7+JznCj9Xb1ieS9ll/cFUo+O+hUwOh j2zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326941; x=1728931741; 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=LOA5rh/i3sB2aiZsIVyQZqxDqnBUHZOsMDWgLcJkZqo=; b=vXcN7s3YiBO5BHxdOz/fNL5W849cdnVbie21dttkj+X/tO9/+V0n7IGoCjduiEJIBU gSqeKwavICCjfjmVn+ZXCiH8fgsgAm+OwpRLKV1dbC8iOZLkAqfEU8r1y7mcBM30NINd TfaTBahrUIG3WrylWkVM1Y8vUBPbJrhZ2hpbJrw85Q2atAf81FbaR2+LCwTysPwkPWri Dkmy0HqzUuGywvX/ndWeP7nTOd6PZBvofslO0H2cOicVmGkbYRcZCydPn2rWG6FpjBWj 7KI/PEVf6+nR8jaGDeu4IAJtY3n/+PXD/fd9wVj68eeyL4S/cGZ0TPcH2tEn/OaHyqY3 s0XQ== X-Forwarded-Encrypted: i=1; AJvYcCVHdEXubCOBwuMHFgBPi7SkL+fvNAPWdSd8Uo9pS5EuMfQWiq7W5MbRoeziwj9llG2ovfzFNeV5Hhe6DhU=@vger.kernel.org, AJvYcCWOpPR0D79DpTDIEhvzakdHKS3TXswETpTVSv7beqCAhNO7ZDybbHXgiRAbYbcr/yHArainrNUF9un8Ro+ilN2Q15k=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/K6TIayLkwz5Qiwdj3o1VQjuw7ThpezdaUeviGx1CeGZCSiAS eZbdQcflxcvIKWiXTMLZuZ8zq/qjCeW7btlEh3LX0eA7pEhW7lYM X-Google-Smtp-Source: AGHT+IHxUiFI/rbjgKUNcq/HDSA08DHTDAUnvMS06sqo5ZNDKF9M6dhIda0R2GYpQkYr8kgARXL/Vw== X-Received: by 2002:a17:907:e9f:b0:a99:501c:b841 with SMTP id a640c23a62f3a-a99501cb8f4mr501119866b.28.1728326940612; Mon, 07 Oct 2024 11:49:00 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:48:59 -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 09/17] media: rzg2l-cru: Remove unused fields from rzg2l_cru_ip_format struct Date: Mon, 7 Oct 2024 19:48:31 +0100 Message-ID: <20241007184839.190519-10-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-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 --- 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 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: 13825154 X-Patchwork-Delegate: kieran@bingham.xyz 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-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 --- .../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:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13825155 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.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 CBE221DF24D; Mon, 7 Oct 2024 18:49:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326947; cv=none; b=iz/mLiRQZ+HF7v7M0R3CDVVBsACazQzknc68jfwGgBfYJl9F8S2qTyleFQ11Lx1lgsFM77uMT2AqeELb4406qgONwAe573SN8oKOAS+PmfdtnZqU3Tb2Y/GC+YUd3jFtxM8srwftIA0zvLV7ARHGfSCe3GyB/hmChzvkdedRkFA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326947; c=relaxed/simple; bh=Gmq4utQK+adZYhL7UUoG0fDZ7cjEvOJPyR/JCmBJmD8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lw3PN5FG9UnYizjmYZ3REGs37GIqe4DYVof1rUFdTKUWwjEeGNU3+JfPGn+v10Mo9g/dGYh3ffvzPySq7p79vpzowDap6vph6ODlnNVHHGEkxgCFbIDgaPcXju+4pkRo4eLFbMJcaSFeFKGu6t27cgEcrDntQhX7TzcvZXroRdc= 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=O3GpGrvo; arc=none smtp.client-ip=209.85.167.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="O3GpGrvo" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-539908f238fso5345631e87.2; Mon, 07 Oct 2024 11:49:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326944; x=1728931744; 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=lb9cm8GogiuPGh5bPslgEBHPGO7Vg4hjXnxPsK5tFso=; b=O3GpGrvoNEJ2sEdJGOZJUrSupGFhjqNcm1fkq+efzGjQ90xBh/PJspj5zcAAS+ExrU 5pTiHRws3KCbAbtUh5xWMGFZvAzkMgM/zElEOFR7qp5/tEj9zHEA9FPkNg+1TA4vkPwK MJ0aNsOduL1U94XUmaJvw4Lbtty1XIpF9ulehqHdnzYchyJHjH6LNbrKbBz3HfZlqK6r c8k5PWZv7SCik7TxWVwQcDITMYp1cyLhS5S09W4s6/A9m1t1eUfz4B3TTGVmtDIWNhXV bHX+QYHVjdOBv137MwfG4LhDTohQdDEiy+7kzFKTTVW3S7hcSw5QWrQGgQwUjZi6aenj /8bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326944; x=1728931744; 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=lb9cm8GogiuPGh5bPslgEBHPGO7Vg4hjXnxPsK5tFso=; b=cBSpc2WbQuIejBb27kNGttKejWcRaLcQnfrMUk4HCyGrpqKRgfkaCjJpMS4fhk9odM 5LFFRjv+dcifFHd8dz5L0cFDfI9h6B46HP8fkMMv8YQ7+twa/7D9FhFaMIA2wUG+Le9t bQpZd3SYanW9E216fU6yGkahPxyIlxqLiLp0o6rgJe6kpUe8oyBPEC75oJ4chwcYI1eJ uPt7lUH4olzRaQ9auFTI/U/jOFmi7Me22HOC56QC2T7QVUL6cB1MrqMcq6aUFkE8eqfS qrkFe0VKUTUzB3Y05k0XFpwRlxjAJPYbROkaibK8BvariO3uJ5KwI2WKoZAYMzTM3ox2 fIZA== X-Forwarded-Encrypted: i=1; AJvYcCX8Fe6HSgOx6gEWuhLuQUszT55glJ0XemPbIzhG2eT7iVQ8dewF/NYjZJO/QJ3EcGOwIEJsKaJg7HBYG/g=@vger.kernel.org, AJvYcCXljTcvLAVhD8FXYmO189G/HYa5VNVOHwOtb8reI1x5mTS3Z8WFLwtLxKPC2OjeCoAf8kWk15cFF0C05r9yD/G2Q1g=@vger.kernel.org X-Gm-Message-State: AOJu0Yx+WRTD8NUB5jC+A0DjBlAJVmCi98LUhJMdUVInNTP8EZpS2SAG LNNI8HxH9SujOFWgxNzjTEbojHliYcIrSeZMRsRXeEJ0GOSoi7KJ X-Google-Smtp-Source: AGHT+IHIWhDL2zYM56ll7KHchCRSJhPblusn2Km5xw7ldV9OjSifOPWq0jAF25M468Q/hh3v09ZG3Q== X-Received: by 2002:a05:6512:1250:b0:536:a4e1:5fa2 with SMTP id 2adb3069b0e04-539ab88cec1mr5872499e87.26.1728326943705; Mon, 07 Oct 2024 11:49:03 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:49:02 -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 11/17] media: rzg2l-cru: Use `rzg2l_cru_ip_formats` array in enum_frame_size Date: Mon, 7 Oct 2024 19:48:33 +0100 Message-ID: <20241007184839.190519-12-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-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 --- 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 fde6f4781cfb..fc9fbac72762 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -166,7 +166,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 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: 13825156 X-Patchwork-Delegate: kieran@bingham.xyz 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-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 --- 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:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13825157 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.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 F3AE11DF72D; Mon, 7 Oct 2024 18:49:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326950; cv=none; b=NeNjWKFLNM6IHRtoikU/XZkhK9ys0mtL2/XTXXvpshZwJb06pHBeBUKyZ1kce5lxWeaGw8pPFvrJcFdTjSKRjjAjh4N4Igwa+mQ+LP5JJIGAF1smmAjPYFw/mwX3QZEAUpyomkrvuGCgtKXVsGjHB4mZ3CnJnkrM134RV3F7ZtU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326950; c=relaxed/simple; bh=1nACJmXss4rs2ggvNM3w/QOnFvfKel8r7eag4gbUW6Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cT+ZkZtCb70drCa7tqY/SSr3qzTeR/M8xeN+nziEyPcP1CXbvvjUHkMcpE+HyvXl3ECfAEV6VQ8xPeBoYHaOriZB1MqbwsYABmz/V3HQj4Z0z0Pyt5YckC+6IqHmkPGHcbIJquyUSqkn8H2/yCIn5vQceqiJmoj2mBAkzmlm8jc= 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=Zcx/iFOM; arc=none smtp.client-ip=209.85.167.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="Zcx/iFOM" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-539908f238fso5345705e87.2; Mon, 07 Oct 2024 11:49:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326947; x=1728931747; 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=9JEATOmL2K7hfOJu0mTaa+l9QgeR1FwIUzr8jZgEsCU=; b=Zcx/iFOMVDpW9WYn8gowNlHHD9/yOwbGeF+Nbc4FGECjlOqMJMRtk4P7GplX8PxLZJ SlVl0g+3ShFGkYs0QN1C9HIGYeINBYGS/22Ec/WmXvMIv5okCXMlBlulaqx5DspdZozC mCeEOAkCH260+xLI2GHowJh6e+/vaX885ZGEF93ChwRxdid4kII+dfxh9ImsooQW//Va XnU1naulesuqaWj9TQJfOHZjnRdt9efTh0rK+/bMLP34YgO0PnDORdzNjGiJZU9x3MQq TH/oZnNcDjWUENGOBYwPNqYfaq0OALIUVPkmend1/DdFvPmnlCbI65U2C6zesAXA12kQ M3GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326947; x=1728931747; 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=9JEATOmL2K7hfOJu0mTaa+l9QgeR1FwIUzr8jZgEsCU=; b=CEUbKZX/bj7K2tLE0ljjebpVsyd/a7J9HOtn2sbv18SihdQCu71pULGQdq8l7tWIbt s+B4kzjz2658tR5yrsfW3GhF5EA4zboGDcCy/e9GLomPneRFId3Jodlly1elcFI0Ruzh 7YbqtupQ48YsPLJzQcaKuWI5YE7FUUNuvklWqhQ4vyjSywASIqkF2UYLLlIQhJ1eugKT 1KsLNi1qVKw+nlpbWsPlaqa2We/Z2J8WXUoB9hTpHx2fte5IgKWFm6sqSMnXUYXPcY+S ZI7j/uQZq2hrSD/ZFDLcqRXGdr3kIXEh2nLs3mEti1a3mpYp2j83Vc8G9kPJ9aV0r7dv tpKQ== X-Forwarded-Encrypted: i=1; AJvYcCVA9evzn1fflsBWo81dJL0Wv4R7+kUJFlreGURIyo+q1QoYAektMr5uL0kt8aShXM4GP0E2LJh1DdtxA+PhSc0sfwk=@vger.kernel.org, AJvYcCXpW7nNms6NLXBBL5Sunh+w+ao8VUlmJ0KFd3RG4mfIYCX/whHMo1+bDG58poN98oCwF9V8PnSjfoJgGfk=@vger.kernel.org X-Gm-Message-State: AOJu0YwtRMWD9rHHV3NBzw3/8gb/9asS3iwDmqUR341hOjzoSj33s/NC kUL2txWOWxwv4imPuf2OcxK+dz3i7PUXnteBQUMvU+ZNQ2HqCCNI X-Google-Smtp-Source: AGHT+IED3qM5Jvka2QYFA2RXc27lbtAKoostEzGULQQHVPXA9cKYbRziMYgHlK+XNQiXPel5yGN2eA== X-Received: by 2002:a05:6512:3089:b0:539:918c:5124 with SMTP id 2adb3069b0e04-539ab88d663mr6035723e87.31.1728326946771; Mon, 07 Oct 2024 11:49:06 -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.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:49:06 -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 13/17] media: rzg2l-cru: video: Implement .link_validate() callback Date: Mon, 7 Oct 2024 19:48:35 +0100 Message-ID: <20241007184839.190519-14-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-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 --- .../platform/renesas/rzg2l-cru/rzg2l-video.c | 91 ++++++++++--------- 1 file changed, 47 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..385b4242db2f 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,52 @@ 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, + }; + const struct rzg2l_cru_ip_format *video_fmt; + const struct rzg2l_cru_ip_format *ip_fmt; + struct v4l2_subdev *subdev; + struct rzg2l_cru_dev *cru; + struct media_pad *remote; + int ret; + + 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; + + cru = container_of(media_entity_to_video_device(link->sink->entity), + struct rzg2l_cru_dev, vdev); + video_fmt = rzg2l_cru_ip_format_to_fmt(cru->format.pixelformat); + if (!video_fmt) + return -EPIPE; + ip_fmt = rzg2l_cru_ip_code_to_fmt(fmt.format.code); + if (!ip_fmt) + return -EPIPE; + + if (fmt.format.width != cru->format.width || + fmt.format.height != cru->format.height || + fmt.format.field != cru->format.field || + video_fmt->code != fmt.format.code || + ip_fmt->format != cru->format.pixelformat) + 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 +1008,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 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: 13825158 X-Patchwork-Delegate: kieran@bingham.xyz 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-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 --- 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:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13825159 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.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 0F9041DF75E; Mon, 7 Oct 2024 18:49:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326952; cv=none; b=PNIs37Ow15/Cjn/azd/SoKX+mNMFGh5MPqpfdETUmQdfUzbpMSqCe0T1VjJqiFkRnAyAFg+64rWBLpx63qf4ma5LZBqqvJBxQsFzkYK2hIvJNmvhjDynk2f/TDhBwNCshbUvptxuj5cZuTewjY1jCigax1Ev+YKZCWkX7tu5VLQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326952; c=relaxed/simple; bh=UCtXhtxZnFZgL0KF/t8ylnPBGBCvzRGghwPcP1nq4fg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=es3NQjWLcLOBeOIpTSeOiOykWKdVbVbsEKl0Iv4xlWpYNpqCLfQSlpYPBeXl8EImJOKiSNWvQaeu5gLVOsoB8oGmi4tz0crlYZuOSe6cyBtwvQ7ajP7TnOzuFIBU6qcgBLoqb0xJ78T4j6IXwCYYDpyA0CVE/U/7/q3R9no7nPk= 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=WCA38Pfd; arc=none smtp.client-ip=209.85.167.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="WCA38Pfd" Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-5398b589032so7192122e87.1; Mon, 07 Oct 2024 11:49:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326949; x=1728931749; 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=3pnIGr9nmegsqFC6vGr76Zr9hZKIgM5DeB1/VBVOkKg=; b=WCA38Pfdgrtb9NBmpN3Cdy7pxY6QS4hYh9yyf2cgA6i2oi6RI5GjlL4A/n8BNMdN4C CFAEoftPDXx6zfV/RG/fM/rkJ0yylM2RSk4DX8AYP1Am3jtAuZpAVLGUPiPCIse7MnpZ 0KFI2Kic4kGva2A/1q1i5cHKiFnsGvvqw14hTDTUbAvEckVdPMNZvdYeXMGj5FRGQ352 gr2XzGcgDJNOd9bcFqcwUby2dqAAY1qx7X3YzPmuoTVNIOnuUGlH5YPTNAs5f9yq1sMA WMzNyKL0fbV7En2R1Ji+zNDw2PMqbXae9K6OKOxGhNgxTcnU7vK0/HBsCK2qJYxTQjog p0SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326949; x=1728931749; 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=3pnIGr9nmegsqFC6vGr76Zr9hZKIgM5DeB1/VBVOkKg=; b=PJQFlN27Yn1NgVxfsj4lFC94CfH0s32iUQgpZCIQGEJMrnFh86IJbytYq7AOTxK5+S 9qNfoTaDZtGcXkb6am+yfLPWw2SnsPkUgV5Ne4oCogQLeF9UkQwuynnM3TwkeXx/yzes WOohQdIOQlE+E8zfG/qQ9aR7W6OeMmx0rwbcIp0Z4KQru15jHRt+YsYtF09S14hpozkL E4rFEqbu04cSyEtrbyzdQ1EwgggXrPcs1Ux+BHAm75BLvovTSOuCT6NBLNlTlQ4JPDBi nd3c/T4FW/cNpOWZnysrf2jeZ3Nn2gSBJD10I2z+UPbKXc2gDujLu1GSkdUtM0eqTWIo EDvA== X-Forwarded-Encrypted: i=1; AJvYcCUHbvmVmgoIiIPn8ii1uHg1N3cBeIy/z5dwYL/og9tsqIWAaymfvJXwlkrBSWlU3qk7pkc91lu8P0vrlz35PylPkgw=@vger.kernel.org, AJvYcCVX6QidpjxhZpnpKt+Nvn+F5lEvLSPoOARtXv60s5PtMDnkDEOCGpa+/ZCp7TB/wsDx+k5kfuHBm8Ht+1Y=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+qT/bOtUgQ1W3qZOe5ZS5W+2wIzg7K5prozHd64yHEmFjdZCh v+tpaortGcgodWNnumwIih35pdP0oCWkBI9hn2vVRSSCfxTPHui6 X-Google-Smtp-Source: AGHT+IELseBLIfVUHbLcfppXKA5SkBcSBcq0dcWI84Zzl8pNSbwpeG9QwoVP5fafPGjMZYeAxJd4Ow== X-Received: by 2002:a05:6512:b07:b0:536:a7a4:c3d4 with SMTP id 2adb3069b0e04-539ab9cf1a9mr8877329e87.39.1728326949006; Mon, 07 Oct 2024 11:49:09 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:49:08 -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 15/17] media: rzg2l-cru: Refactor ICnDMR register configuration Date: Mon, 7 Oct 2024 19:48:37 +0100 Message-ID: <20241007184839.190519-16-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-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 --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h | 4 ++++ drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 1 + .../media/platform/renesas/rzg2l-cru/rzg2l-video.c | 12 ++++-------- 3 files changed, 9 insertions(+), 8 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 fc9fbac72762..383f4b30e2ee 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 385b4242db2f..a96590178cb9 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,8 +277,8 @@ 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; cru_ip_fmt = rzg2l_cru_ip_code_to_fmt(ip_sd_fmt->code); rzg2l_cru_csi2_setup(cru, csi_vc, cru_ip_fmt->datatype); @@ -288,11 +287,8 @@ 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; @@ -307,7 +303,7 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru, rzg2l_cru_read(cru, ICnMC) & (~ICnMC_CSCTHR)); /* Set output data format */ - rzg2l_cru_write(cru, ICnDMR, icndmr); + rzg2l_cru_write(cru, ICnDMR, cru_video_fmt->icndmr); return 0; } 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: 13825160 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 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-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 --- .../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) From patchwork Mon Oct 7 18:48:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13825161 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.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 E220A1DFD88; Mon, 7 Oct 2024 18:49:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326955; cv=none; b=D4lJSURBf/5Q72xr7kmR8LolXiSfO6EP6LTWww5/0irrsOCKM7nrhOJhlpD+IfDmmphoFKhtv28CBsJL+tz8zPmXEcha8Qqvzrkesbb/5g7WrD7fgBsCSQBFk24QDR3XOgWbgoZn62SW/nQ3KkOxCLKI1p2ZxtNgwsZh0BWcIe4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728326955; c=relaxed/simple; bh=/kg0wXaUNUJsVPf5/WjELzEQzGfs3Fsju7G7m59Nh2k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DGo1rdMs7rItIuW2GQoQKbNmz9/ivc5MFzEvs4D4yBpmWvdOkNhbVtx6zldrlQr4vJZy5HZBUdACjeIucQfMKMbhJ7XICV+PHOI3pKlZJY7G0mJUBi3fImTK4zzE7aQz1z6Np8ykTI5DY6sG5ewhmWMNk0uoG2I2RCkvm2eZ6gY= 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=TJszzuNM; arc=none smtp.client-ip=209.85.167.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="TJszzuNM" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-53988c54ec8so5454561e87.0; Mon, 07 Oct 2024 11:49:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728326952; x=1728931752; 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=ADogNEgxdb0AIMPfsSKEhNdNIaRQ/kooaT/qsVTDoQc=; b=TJszzuNMK/m86J7B1wf1a2TtMidfv3FZnIKkt2v5w/LdredlUgcAS+8hX8CyMbNz26 PS/0JJpVa6+86AL/pKkJoigULTvgiBEi4GihitkPMBzpdQNp4wgS8K9nI1LYxRVh1VJf 8sysZje/jZ4RVqjakuFxRVL4i+nMy3NFECNOl9VUqg5BdKWA396Wj6nNdRgGFWlmcYOs 0vpr4NtAUmTPsxt8C0jwFxlnTiuyyuAr13qUH8HJeCv9veZ5bnhr7R7w0i1kGmqVLO4J kbdnnNZ+K3UPig/WdhAK5AnDq1yjNAAU2/2X6D66uyz1bKz2K8gb3Mqb2Ukgvh6OOi5P RE+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728326952; x=1728931752; 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=ADogNEgxdb0AIMPfsSKEhNdNIaRQ/kooaT/qsVTDoQc=; b=w9JmSDREnwEF2P9oL9E+mLL0zncNeKjxcyOW3r0qHKghlmTaUNguY8IitZzARswafH hiorXOPpJSU04gDl9rGPFnviF7c8uu41D27K/oNFneN9wIo0MZimvqSLQgysJ05ORYML 2mZAEVyhu2u7+QIyjT5+ckIwv2BpW6fxxcc/WAkqg7PcK50+Q0d1MJf6WFsXK7CFUoQR n1OUKxiTLPxDGDPQDyRxyy0ksjelCk/bSD6EA5ExI6PpAkkMPELrJgcsXyiW2XLeJFHj vqrJf4W/OWxwA624THAm8Yl5giJeuLlQlZMwJsABNEW0k5ktXkuJKf7gbkE2sje3YoZO G1VA== X-Forwarded-Encrypted: i=1; AJvYcCUmGAbEak/o7df0j4fcX6aSwZdmFk38pqeMp9cxRdc7WB2s7h+aHgsHv5qwwQ6OtPr/YIPhvvbOYs22jJI=@vger.kernel.org, AJvYcCVOk/X1goxvs51XVqCnYl7JKEVeOtJOFVYN5PEMDIpScIpu1IbpGIXo6yJ4vefY7wQc53KHkFClLoTaOVqBz0M/Yf8=@vger.kernel.org X-Gm-Message-State: AOJu0YzQ/2E7ly+sTSbojhZJ03KC3dhi0SykZEUTSDc8oE2/pWoXx+/l wnx2HN1+vTjJly1Tsh0ojr7p9tNeocKwOqn9a2+dfk6ljT53BeaHkDCbew== X-Google-Smtp-Source: AGHT+IH1Dp1botUtth7NGfauweW5F6dMgO0BPcocVe+4PSHjgoP6OW0EQVCQt9H3ND9iLZ8mFBl0ZA== X-Received: by 2002:a05:6512:b9e:b0:534:3cdc:dbfe with SMTP id 2adb3069b0e04-539ab88d283mr5394476e87.28.1728326951860; Mon, 07 Oct 2024 11:49:11 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 11:49:11 -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 17/17] media: rzg2l-cru: Move register definitions to a separate file Date: Mon, 7 Oct 2024 19:48:39 +0100 Message-ID: <20241007184839.190519-18-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-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 --- .../renesas/rzg2l-cru/rzg2l-cru-regs.h | 80 +++++++++++++++++++ .../platform/renesas/rzg2l-cru/rzg2l-cru.h | 2 - .../platform/renesas/rzg2l-cru/rzg2l-ip.c | 1 + .../platform/renesas/rzg2l-cru/rzg2l-video.c | 69 +--------------- 4 files changed, 82 insertions(+), 70 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..1c9f22118a5d --- /dev/null +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru-regs.h @@ -0,0 +1,80 @@ +/* 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 +#define ICnDMR_YCMODE_UYVY (1 << 4) + +#endif /* __RZG2L_CRU_REGS_H__ */ diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h index 51206373b7fe..357086d026eb 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h @@ -31,8 +31,6 @@ #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, diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index 87c194961edf..012ca38bcd1a 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -10,6 +10,7 @@ #include #include "rzg2l-cru.h" +#include "rzg2l-cru-regs.h" static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { { diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index a96590178cb9..691b3f7c148e 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