From patchwork Fri Oct 11 17:30: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: 834814 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 D46F05228; Fri, 11 Oct 2024 17:31:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667864; cv=none; b=j91DWZyUDtKnWygE3PTw1oaqIHNWQnotusx3YEnjixNMi/pCnjh/W8+qM6UqLNIS+rCEMRMYXwCv4icOfx8uV9zExQ3ceVy67QriaGDfG5T84GEtxLpw+8Of5axOx0SLoD4elWMWJfKW/ngekKh4E4KCksT0ovbliOZ0Cp/NlPo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667864; c=relaxed/simple; bh=T8keBBIKmh+gQilFeSMtnLq1tChWN51TvIxv5AmsMX0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eQ+VVOi2ZRqvYebQz+FeJPLchZrYCq1FOXYC/HvpECO0vw92+yjz4Z7TQFWl6G4ymmygDu/6jN4FqYcEFWEMTVlW5G6XNrVgxGl9NjdLUxr/e0Rq4hv+veLmqMNEc343bcvkcnSySQKTdtRcY2ziVdlauyHUC0vVwAl/FuOuDqs= 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=a6sRzBhO; arc=none smtp.client-ip=209.85.221.43 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="a6sRzBhO" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-37d4612da0fso1777791f8f.0; Fri, 11 Oct 2024 10:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667861; x=1729272661; 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=a6sRzBhOtv5Dg/80SmrGzJ57+EmLOql591qEpS9dFi16uRpf8CJ7c6E0OLyjbH5SYR lG+943YG/NZP5GADdL/mD0yr/MOgk1EoITetuMJzVVbgy964KFq3RiLAlDrEGHcKp/dz aL9ECru9okM6yza4fUYAADF0snk9j/7gCmPAGMTW6Ps97vOB3+ooqRGSJ5zqHPxGgJmA od2Hh0R4Cg8/QKOI14cE8iNAn64nX/NFu94et7PidyEEBWrU4GeWoVC1AYw2uJy9jXoM aym6lQxPifJ6zwpH/Ktpy5+Y/pFPUJYr6GVv7ni64u78h2bzKPvSmpxASjdcbP2UQL3k SQYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667861; x=1729272661; 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=JC6lF4HzsKCiIUZsVzvcyPPR1Ib56n32Zo8/LTurXlE8bUJhRwgtEK83hPKpYXzrTB uixEaJ4cgiKgGmHAdXs3LCEpHCk5Qrdgh57NNe+nIZOZT1nQIZLSyDPYdZGjuJyBON66 9SamIzYVxyOR0YsEaOiHn1weN/fEqA+L9NYVbrghn5Ih0thPmSJouUR0RFCN8Vbry3EX MVKq1aWK4Bxrz+eoK6YxZEfcjStDYw1A3XJlYwr56ZKjpE40kiX1100MdZcDDXlxIcNV HWFF+ORi/cThzq5gvq09cYUAYWuPMmVnjtwdFmNoxUHuVdNgFRgHD0i8+UHqeOUF3jMe jbDw== X-Forwarded-Encrypted: i=1; AJvYcCWPTcZD9cSQb/uqMgRj1CGE/NAPw74ZXQ86/vRcUlIJBmD5o/VI6xjHey6Lw/3B33+BLqFWUGxzwm2JuSMPL05QIBg=@vger.kernel.org, AJvYcCXKklUwodH/bGf2yTQPfLLBqfl/40tbal3BFJb4WfRFV1Xtjllx6RvtrLVXPGttejpdLE/mEVlRBc1p17k=@vger.kernel.org X-Gm-Message-State: AOJu0YwTcW4WgZA4RtXzuiLFbhHLKDFLpqlTBiJOmttxFroW6fOf7vGF uAd4bubSuY/rlxXELvq+aaHApUMmJoF/XZhJmiODxDUJ6fdqCxFE X-Google-Smtp-Source: AGHT+IH9mlAZJfntfOBzrJiG39wS4TDQFeymdFwTYpyvvmcIzGFM8WNRSSjWp02axAdnk+/TYCnrCQ== X-Received: by 2002:a5d:44c5:0:b0:37d:3141:5b6 with SMTP id ffacd0b85a97d-37d551d6533mr3171820f8f.12.1728667861064; Fri, 11 Oct 2024 10:31:01 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:2595:4364:d152:dff3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b79fa0asm4396516f8f.83.2024.10.11.10.30.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:00 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus 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 v5 02/22] media: rzg2l-cru: Mark sink and source pad with MUST_CONNECT flag Date: Fri, 11 Oct 2024 18:30:32 +0100 Message-ID: <20241011173052.1088341-3-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Mark the sink and source pad with the MEDIA_PAD_FL_MUST_CONNECT flag to ensure pipeline validation fails if it is not connected. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c | 2 +- drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c index 19e0ba9596c9..69cd45b26951 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c @@ -209,7 +209,7 @@ static int rzg2l_cru_media_init(struct rzg2l_cru_dev *cru) const struct of_device_id *match; int ret; - cru->pad.flags = MEDIA_PAD_FL_SINK; + cru->pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT; ret = media_entity_pads_init(&cru->vdev.entity, 1, &cru->pad); if (ret) return ret; diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index 9f0ea1de50da..700d8b704689 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -217,8 +217,10 @@ int rzg2l_cru_ip_subdev_register(struct rzg2l_cru_dev *cru) ip->subdev.entity.function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER; ip->subdev.entity.ops = &rzg2l_cru_ip_entity_ops; - ip->pads[RZG2L_CRU_IP_SINK].flags = MEDIA_PAD_FL_SINK; - ip->pads[RZG2L_CRU_IP_SOURCE].flags = MEDIA_PAD_FL_SOURCE; + ip->pads[RZG2L_CRU_IP_SINK].flags = MEDIA_PAD_FL_SINK | + MEDIA_PAD_FL_MUST_CONNECT; + ip->pads[RZG2L_CRU_IP_SOURCE].flags = MEDIA_PAD_FL_SOURCE | + MEDIA_PAD_FL_MUST_CONNECT; ret = media_entity_pads_init(&ip->subdev.entity, 2, ip->pads); if (ret) From patchwork Fri Oct 11 17:30: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: 834813 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA5D51C579D; Fri, 11 Oct 2024 17:31:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667866; cv=none; b=i6jkC/TPJlkT9/I4lwC+gX5yPksbLan3JEiyeWApNLNL40QauRlNDKIVTRhf3amFIGn0nvN91swhKIPU15+8Vh1lXEG2e/Ybr7RX5KUFQy5F11eFgZFfuVIzast7zLE4wpi98/1S8oh3WauGeD13S8/D0i3Ig/040TpfkBbnA6g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667866; c=relaxed/simple; bh=EqMgQ7qYiKXRyYfaLbrU8JB9/SiOPCFQH5V8Wh0MYjg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WHda9olewb4Ok26wPZYprbsA8gsyaACMQTmszoHd7SfpqR8y9Q9mUppFuOWQ/ueFE/ucdJSW0Fo8XWp9LMPpItxxAD6DFztLvPQhHlyNnc0Q8+noEQFxh3sJ+hXbN61Yot2e+JIBmHpBKXtnbS0sRrWCxh8iltIttTMZClXDzig= 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=FMiun0dN; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FMiun0dN" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-37d5689eea8so504530f8f.1; Fri, 11 Oct 2024 10:31:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667863; x=1729272663; 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=FMiun0dNd+IILbZAVIrrCnNS/z9uyaaEumjaainQT2lpbaCVgdVSys76vNzgm/WtpN pmIXdhWvX+E9hjnkTtjESUAMxjo47jdXAOkUjRjj6VbiT+/t9zJi6IoK16apidMPtjmM MlUhButF90w2BwJfbXqGFjtuyM/zfenCAaXsOBrIGtjbKQyPZVH7kMtAT1+unI4XwcNe 5fZRUAUmMgDcvsMBuyVjUG2GRrAvGD6G6NKmaGr3lNG0yIdBk1IOYlo+3f43a1r0cVXp beep5+0wqi+DjBiDY7YlhvTP9IoGQI2/44V/aizvYi8+c1kILM2JXemm+d0JPsQey55B Ua/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667863; x=1729272663; 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=g8AntTeTYabCMIYMK+qt8OUlBvAZX0nXc5KIjNTDnZepyWTs/uVX8nSUz7qId6J+22 Wtqgjk9YMT5VUwmpLRJGnhimejbnhg1xH48Ywsy41RPYRq4HvZvG1cENgdDNVIZmbA+G ofbNhd9z0gAj21fXlkkC7oH2O4kIWHPY2SXmhDslEE2tD8DhmKBsULdZpHrcvsAUoXcP VFzPNmJeuNR2gWZS9iqyct+qQIP+sUiyHNmwgyhS9roy4tPXcktJncJNPaFIGBGjGQ8q AMpErfB3JJdAhP36VOFms7UQv1RIlA5SFb9NP9o5L/VosViz98g3+O7VwmjRSETEGXUd 3tQQ== X-Forwarded-Encrypted: i=1; AJvYcCUFU9bY0jBGUbDMmWLpn9czUYB7lgaxAKM/4fqy38agtLk/MS0CIZwoF0KgrIx4WBBsBpVq65EM/zrnuf2vUDfzV/4=@vger.kernel.org, AJvYcCXSg+PPcO86SCIPlMuMUy1kJNdMDYsng8b/1wkhT4bWD+MIlg+0mgAoU4/XsZ7JSS6yTs69qZwoP+GlMhc=@vger.kernel.org X-Gm-Message-State: AOJu0YzpWEsXy3lvcgcdFr6vYCkWBCsG0zbwKZ0vYnbJtwUcfTf615Gz z5GYtCCQGdgS1uF9TXyGxYrpqxFqVsRDgR1HqSl942hk5hXlinD2 X-Google-Smtp-Source: AGHT+IHJDrSjf/JJ9A9xmawa48UiBP702BiB7GiOR1bCg+qvxZ5UplsYBUQfPClH9A+KrrHRkqLDeA== X-Received: by 2002:a05:6000:44:b0:374:c4e2:3ca7 with SMTP id ffacd0b85a97d-37d5519020bmr2291600f8f.5.1728667863046; Fri, 11 Oct 2024 10:31:03 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:2595:4364:d152:dff3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b79fa0asm4396516f8f.83.2024.10.11.10.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:02 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus 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 v5 04/22] media: rzg2l-cru: csi2: Use ARRAY_SIZE() in media_entity_pads_init() Date: Fri, 11 Oct 2024 18:30:34 +0100 Message-ID: <20241011173052.1088341-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar The media_entity_pads_init() function was previously hardcoded to use a magic number for the number of pads. Replace the magic number with the ARRAY_SIZE() macro to determine the number of pads dynamically. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c index 2f4c87ede8bf..abacf53b944c 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c @@ -804,7 +804,8 @@ static int rzg2l_csi2_probe(struct platform_device *pdev) */ csi2->pads[RZG2L_CSI2_SOURCE].flags = MEDIA_PAD_FL_SOURCE | MEDIA_PAD_FL_MUST_CONNECT; - ret = media_entity_pads_init(&csi2->subdev.entity, 2, csi2->pads); + ret = media_entity_pads_init(&csi2->subdev.entity, ARRAY_SIZE(csi2->pads), + csi2->pads); if (ret) goto error_pm; From patchwork Fri Oct 11 17:30: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: 834812 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.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 E3AEA1D0406; Fri, 11 Oct 2024 17:31:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667868; cv=none; b=R4qI92J5Y8EjJZWmL8/EuD/mDkMqYNmbHca3QQnA8W7z4kdd4regHVeSkkIQLoZYyNoFBnOjgqaReGkfZBX0h4geGCHcSn7kCx/Zmb+si+swe+FPpV09mXVF8I71LGiXKt7B+65nPFIiZrepREI/FN3HzbnufQjlaxIHVmboEY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667868; c=relaxed/simple; bh=riQB/ps7KNocNV/AUMqu2fP1J1RbHtnimUeTAOvwnFI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Wdw430E1LKUEJtvGLOZMxYkOyOcyUrmhHewfzmqIgmGW5c9uUzjuGmVH+mxhdF599N6Jw6qsorcIymygWoj6ydR0Rveh/coD558pKmP5KDe6HBGqtBrNad3fec9CwDGDhvSDU5OxgEBQHOeCQ9jCSWTdInZbD5a98FnZAKXxTas= 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=AwuYw6Ps; arc=none smtp.client-ip=209.85.221.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="AwuYw6Ps" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-37d518f9abcso913432f8f.2; Fri, 11 Oct 2024 10:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667865; x=1729272665; 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=AwuYw6PszX4ppDS+/V1MDZ6kxxmNi8d42x+dvvrnBm9Y1HDci8w5JI5n2AEANOhrSH Jx3mIkwIOhSgU7pAgL2Von/0ToatIzyWSaytw99Mx/1k7fG7YS9t8kvMt6GIraPJZmpL xIZFC74erkH8wQhExnJDzwbSeUP+A5mM4us6+lWJrvcvuEIpPPoz1tLiDXGuoPS5SaZT KQiUTvf3D+OU09LPVb4bUUtH7KnQCMUqTtS+zHVIpDVbG3OHh3X+sBhbTZYCGaLUngdU gkdgL07BSYu8RxQgjO8NLH0cU/4G6zcS+E5DFvBipMQU9eNeYKLpmQ0S7JoXK9UJ/CnL ykDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667865; x=1729272665; 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=c+FmreIEt6x42HSnq8mNlk4wtKgxJLlIM0QR1VoQa4qYsgRZJMgY1XLGFGYvzD40GR 499bdfiX+xKzD96MA0pT6tqniNmE3ybOCiaRTp5UKX+BkNviZPMpb9NcDLIy55mtI4wk Gf+imjr9jndWM1jBj9ZBy6uCAvJMFFG2KQbK0v3H/2UpOyxMYH6Kht3p82OUXsLbeUug s3eu5YxX1viBvZsK5VHG68AN+kx6zS/Z6ZEKXAnU6V2EIlZrMOVJfRa3Zw0OpBalaYOK qQmn77qAd0ycnk4yy7/5Ls99im0EDXdVQ/ga43tLA9L8ShJrSsOjtyS81tAXM/lKQuc1 xRRw== X-Forwarded-Encrypted: i=1; AJvYcCV0X7D7lUpPyWyAdHZ8pwlY4HxF7Tk8Hml3X9rjNzT6npThyg7surEDfA9zVnocCpZDauzoVjnTnOd4L+M=@vger.kernel.org, AJvYcCXlckh6kX78L5QIeV1ZU+HwRB5T1UiztLaVYgSR08NOArQ0hg4vFYKfr6FvHI3deh+T3igAVHPKygMSYWqR+hAhvWY=@vger.kernel.org X-Gm-Message-State: AOJu0YzoNgsvNXkqJnx/FOIxKr1q511451lRmlaDVm+HPU7W3+xmnbHB jCDUTTxr7z4d4Yl0FU3h+kx/Fe2MP+Bmy4S8wYQCnR+v5jp7SsQ/HI0WEQ== X-Google-Smtp-Source: AGHT+IG/ZWyxCOxL5jWFjBZFw3Xi0B+eX8Vh3VD1mw4fyQxCP9Tg9haDep7QcMgW40dKps2sJomTGQ== X-Received: by 2002:a05:6000:b10:b0:37d:4846:42c3 with SMTP id ffacd0b85a97d-37d551b6ee1mr1992624f8f.22.1728667865102; Fri, 11 Oct 2024 10:31:05 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:2595:4364:d152:dff3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b79fa0asm4396516f8f.83.2024.10.11.10.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:04 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus 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 v5 06/22] media: rzg2l-cru: Retrieve virtual channel information Date: Fri, 11 Oct 2024 18:30:36 +0100 Message-ID: <20241011173052.1088341-7-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar The RZ/G2L CRU needs to configure the ICnMC.VCSEL bits to specify which virtual channel should be processed from the four available VCs. To retrieve this information from the connected subdevice, the .get_frame_desc() function is called. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- .../platform/renesas/rzg2l-cru/rzg2l-cru.h | 5 +++ .../platform/renesas/rzg2l-cru/rzg2l-ip.c | 5 --- .../platform/renesas/rzg2l-cru/rzg2l-video.c | 34 +++++++++++++++++++ 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h index 174760239548..8fbd45c43763 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h @@ -31,6 +31,11 @@ #define RZG2L_CRU_MIN_INPUT_HEIGHT 240 #define RZG2L_CRU_MAX_INPUT_HEIGHT 4095 +enum rzg2l_csi2_pads { + RZG2L_CRU_IP_SINK = 0, + RZG2L_CRU_IP_SOURCE, +}; + /** * enum rzg2l_cru_dma_state - DMA states * @RZG2L_CRU_DMA_STOPPED: No operation in progress diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index 700d8b704689..aee7d4ba70b0 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -18,11 +18,6 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { { .code = MEDIA_BUS_FMT_UYVY8_1X16, .datatype = 0x1e, .bpp = 16 }, }; -enum rzg2l_csi2_pads { - RZG2L_CRU_IP_SINK = 0, - RZG2L_CRU_IP_SOURCE, -}; - static const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned int code) { unsigned int i; diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index bbf4674f888d..7cd33eb1939c 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -433,12 +433,46 @@ void rzg2l_cru_stop_image_processing(struct rzg2l_cru_dev *cru) spin_unlock_irqrestore(&cru->qlock, flags); } +static int rzg2l_cru_get_virtual_channel(struct rzg2l_cru_dev *cru) +{ + struct v4l2_mbus_frame_desc fd = { }; + struct media_pad *remote_pad; + int ret; + + remote_pad = media_pad_remote_pad_unique(&cru->ip.pads[RZG2L_CRU_IP_SINK]); + ret = v4l2_subdev_call(cru->ip.remote, pad, get_frame_desc, remote_pad->index, &fd); + if (ret < 0 && ret != -ENOIOCTLCMD) { + dev_err(cru->dev, "get_frame_desc failed on IP remote subdev\n"); + return ret; + } + /* If remote subdev does not implement .get_frame_desc default to VC0. */ + if (ret == -ENOIOCTLCMD) + return 0; + + if (fd.type != V4L2_MBUS_FRAME_DESC_TYPE_CSI2) { + dev_err(cru->dev, "get_frame_desc returned invalid bus type %d\n", fd.type); + return -EINVAL; + } + + if (!fd.num_entries) { + dev_err(cru->dev, "get_frame_desc returned zero entries\n"); + return -EINVAL; + } + + return fd.entry[0].bus.csi2.vc; +} + int rzg2l_cru_start_image_processing(struct rzg2l_cru_dev *cru) { struct v4l2_mbus_framefmt *fmt = rzg2l_cru_ip_get_src_fmt(cru); unsigned long flags; int ret; + ret = rzg2l_cru_get_virtual_channel(cru); + if (ret < 0) + return ret; + cru->csi.channel = ret; + spin_lock_irqsave(&cru->qlock, flags); /* Select a video input */ From patchwork Fri Oct 11 17:30: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: 834811 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.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 6E23C1D0784; Fri, 11 Oct 2024 17:31:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667871; cv=none; b=UcEGSDPSIbajmu3BiFw7p88q1GoJ+Xj3xR3kvV4i6d7filRMjt3heALqTIZz205hW9vHPSMDFVZ2JDQxCg7mV/UKmgMgQKyD3JReJXXYrBZXJ002QwidlLC0OiIIBFrK9APv+dgr/m9+NDg8/8JtjbThogkDAGPnh5yWcIRXWow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667871; c=relaxed/simple; bh=C1qUYYuRnWzN0Zz7CliMFvIfZZC42AzyLPIVnw9T4s4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=utAZv64B8Ra+vsodh51AQ2Kq7DS725/1NqokHMF7OkXUcFmtPvj6ZmqSbBtfvvRQ09VQ27P55k3A75fJP3FW09XTb+qSd3I87GDeisWz340jR2vd9xbdAKKOf+6BFrzvpOnVduh3eSy7BiO51lCBa5YbJIUWpDLe5X73o3ZIWlw= 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=a/eZNimj; arc=none smtp.client-ip=209.85.221.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="a/eZNimj" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-37d47b38336so1297956f8f.3; Fri, 11 Oct 2024 10:31:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667868; x=1729272668; 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=a/eZNimjGIHSEDraZFSojXe47UlndxgFq/12pCdK3cEI8n1EdV6T6AKyALmmS0dg90 bjt0GnrsXTvVyE4U2fjn6Dc63D+WhQ+3slGyl6POBrwts8gw16WZUkogkBlkqCzSmIvY yL9/WZtSMGjjIrc2lOrfT3+//zxx+XUmn+S5KpvirAKVAeubC3fYvnLFyekJ0fQgh8u/ p5M0cfzc/oreuPgKaysUAZo9Aaj46dyEzpDhFI5E6/2uT+TOGz3QNdUY4xWqIlWm70rK 0x2BjtQf1aV1ptHBv9CsGDQUUvbhqDylWaqXL/icOHDRVuefqYrRKuX4ErZXuX7DhZvY t7GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667868; x=1729272668; 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=clBhvlBz3pP4lwMU4jWo6dr24sYUakOjGx4WF6XnteAd4G4ss5ZpepWKC0lSQSrVw/ yTCg1sJE2qD+vQeSR0wZhBAerYyX+XAQGDXAlaeBzhzMoAXHg+u3qKEEchKIeKKkNr7g v8BcNAGB3et+eLkG+I1gd3b4NUNJDX4fCf3NjhzMjJ2gDK0Kr27XQkA4R2he4j4lyToc gjFnbRsTKSsnsW2v9Q0iD+Djo1G5GINRlyVXAPhYSzi5DJQRbjNtyTed31FYEJTKBi+G nBk/aWuzMS6XSOu1f0i63wea0dOh6/FKISg7iHoNXPkg6rgQfszUbSD569zp7yIv/1sA bCkQ== X-Forwarded-Encrypted: i=1; AJvYcCVFaZIKkGgQZABpMlwF5qoJZfGnbbfULZLLkrh9sVBzgzlOXGvwODvgc/H1W/OTNU+4PsEvFPXHtLzt5wM=@vger.kernel.org, AJvYcCXP9fnj47eNqRf4RafzduK4foV0pMg2XuzfIr6y8xSaMRzsypVjJZWH3DjZ2NDpNsWGvaW8B5EG5gDn7tPSACQ59ZQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yys+N0ymlSRf//NHfB1A6bKw0zU4Fc0o5xSSL1g2CFiFnByhkQu 6mdbvBx23h0xcjDAbGVwN3lvVIVhJwnyNVrwZlqHDKE1unpY9zof X-Google-Smtp-Source: AGHT+IFztpNTjDwWyqlddWZsTSa+MgMCE+EdK4jeW57kb8jDEWOo2Q/3AbOS/9Rbz/eUNsI97rTmsw== X-Received: by 2002:a5d:4e0c:0:b0:37d:4ebe:164f with SMTP id ffacd0b85a97d-37d552fe3f2mr2209975f8f.46.1728667867628; Fri, 11 Oct 2024 10:31:07 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:2595:4364:d152:dff3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b79fa0asm4396516f8f.83.2024.10.11.10.31.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:06 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus 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 v5 08/22] media: rzg2l-cru: Use MIPI CSI-2 data types for ICnMC_INF definitions Date: Fri, 11 Oct 2024 18:30:38 +0100 Message-ID: <20241011173052.1088341-9-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar The INF field in the ICnMC register accepts data type codes as specified in the MIPI CSI-2 v2.1 specification. This patch introduces the `ICnMC_INF()` macro to use the MIPI CSI-2 data types, which are available in the `media/mipi-csi2.h` header. Suggested-by: Laurent Pinchart Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index 9ab7ef33c9da..de88c0fab961 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -77,8 +78,7 @@ /* CRU Image Processing Main Control Register */ #define ICnMC 0x208 #define ICnMC_CSCTHR BIT(5) -#define ICnMC_INF_YUV8_422 (0x1e << 16) -#define ICnMC_INF_USER (0x30 << 16) +#define ICnMC_INF(x) ((x) << 16) #define ICnMC_VCSEL(x) ((x) << 22) #define ICnMC_INF_MASK GENMASK(21, 16) @@ -307,12 +307,12 @@ static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru, bool *input_is_yuv, switch (ip_sd_fmt->code) { case MEDIA_BUS_FMT_UYVY8_1X16: - icnmc = ICnMC_INF_YUV8_422; + icnmc = ICnMC_INF(MIPI_CSI2_DT_YUV422_8B); *input_is_yuv = true; break; default: *input_is_yuv = false; - icnmc = ICnMC_INF_USER; + icnmc = ICnMC_INF(MIPI_CSI2_DT_USER_DEFINED(0)); break; } From patchwork Fri Oct 11 17:30:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 834810 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.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 1925A1D0B84; Fri, 11 Oct 2024 17:31:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667873; cv=none; b=j8yqzWcPty4D/KeCuJcMz8aqjcJDvbWnvweUk4dt8g/3j1PuBDsLdgt9iVlkahFU83Ka2Zi1MYT/Be985lk/Kd4ip8y5OsBwOk/QV3j5L8XDGH7J64EiVB1D7NCAdCXYjD8zfWdS0AC+xvFzzKYBlURBwU0aG0rGIXYeX5pA0Ik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667873; c=relaxed/simple; bh=EMEEGpz28ITh17bAsiQ44rC98irfH/K4wsPSJIRGzv0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uHN4FJVPJ7tNvG61upp7zGxo866ZGazQFHZpCrRBebm5EPg5pHRA/9gtoATf9wuvqK2blbNyiQRqt0jOl799uQq+kPdKVl5SIsdbwHx69TkDddzYf2ra3CwMLdojAPllGS6gF+pKM2nI1EqXsGBaGhBCMAlL+j9XLuPHX51xfMk= 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=hVhZrv92; arc=none smtp.client-ip=209.85.221.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="hVhZrv92" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-37d4612da0fso1777913f8f.0; Fri, 11 Oct 2024 10:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667870; x=1729272670; 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=oxsnjdbvuiczwQuJWOsZrOkz65HLp7uxonqOMxE2zD4=; b=hVhZrv92XT1It7x3BbZaqK2U3Iljtj5bjs2evICp//17pBbkXLo8s3hKlIAtMl6F/P vTgVRczV5dPlwGdQBePqlzONcTIdO9bGtpTinkNUF9cJoUUV0ufCUqs8BI3QorWyAmKr Izb/WYJ/UMvcwOm9Co8de8flIF6dNcNdhdvTUseZjDIFJQqEweC7BSsClnm9XyRRhnad Oh+EMYQdLDwlDURZWobkeMpjFcZKxKxe+9RE2MswkqOkOIgG+vGXU3EZ+ddBRv3xJ8vr Q9Z62e4zgDZ5lyEHOxhwiqBNzDjyxUjqk+nwXpbWP1xmiPx4LgeqQg8CicGr9a5UbEuU lOJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667870; x=1729272670; 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=oxsnjdbvuiczwQuJWOsZrOkz65HLp7uxonqOMxE2zD4=; b=tma3tcN7aPghr6uENtDgmjj9JL94XCFOZ1/r6wbT35EoyyZHeP8rxLkmHfpRtDYNoK m/XilfrKsw8h4wnpVCqxPxmUQFWmyyZ/fGPXNIBIlRgMCEjtGPfRBhmnpCjLh9P+nViK jzXifK3XtrnDE0djquboG3tsWfEJkgOv904+GWLYnEu9TNNS7J9mA9cxFtGJZSQnNNfZ /p4Q9Fl8KI6XuEbjW2NOnhPNMKKledWVrF1C8NIevJl3tzRuvOAtYCLoBTUFac2SBRSv NfE+Bn2IgAO9f8UXjlIkedJ/TaP3HR/9HaSurn9chnTO6x7thLq7QCd+Sn1BRsxwUHAP aY4w== X-Forwarded-Encrypted: i=1; AJvYcCW/OmupsV3a/WHrbYKb0ZF7zK9dD1DYZdBuv5DVqCvbvDd9P/VLKmpshaBCfXBlFdwoPlsODgYye00UWys=@vger.kernel.org, AJvYcCXkJbE4RECHEthtEi1f8N472WBcdc+p4MTCOUiaSWMquGxzJ6VHsIJPZb7V9C9Cwu1izUr8E/UYCzjmDO2Lv0IEs8k=@vger.kernel.org X-Gm-Message-State: AOJu0YwATUB2RhUoyCXxeYgAjLBKeqR7TgOTyzzBw26JBFIeO6ocEBe+ tK317DK3SHTxhVb2jU5JaIZprowhXyLkGtdOOyaTcYeGtSYE5KNtx7AYOw== X-Google-Smtp-Source: AGHT+IHRMzRhZXll7XaFFlaPTBjI7sVrtZlHzrVWQgMdan5CpLNnxFRcRVRDOTKqjIWR3QwLgw+UCg== X-Received: by 2002:a5d:5350:0:b0:37d:2e74:2eea with SMTP id ffacd0b85a97d-37d5519cbd3mr2685157f8f.5.1728667870194; Fri, 11 Oct 2024 10:31:10 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:2595:4364:d152:dff3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b79fa0asm4396516f8f.83.2024.10.11.10.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:09 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus 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 v5 10/22] media: rzg2l-cru: Remove unnecessary WARN_ON check in format func Date: Fri, 11 Oct 2024 18:30:40 +0100 Message-ID: <20241011173052.1088341-11-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar `WARN_ON(!fmt)` check in `rzg2l_cru_format_bytesperline()` is unnecessary because the `rzg2l_cru_format_align()` function ensures that a valid `pixelformat` is set before calling `rzg2l_cru_format_bytesperline()`. As a result, `rzg2l_cru_format_from_pixel()` is guaranteed to return a non-NULL value, making the check redundant. Additionally, the return type of `rzg2l_cru_format_bytesperline()` is `u32`, but the code returned `-EINVAL`, a negative value. This mismatch is now resolved by removing the invalid error return path. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index de88c0fab961..401ef7be58ec 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -835,9 +835,6 @@ static u32 rzg2l_cru_format_bytesperline(struct v4l2_pix_format *pix) fmt = rzg2l_cru_format_from_pixel(pix->pixelformat); - if (WARN_ON(!fmt)) - return -EINVAL; - return pix->width * fmt->bpp[0]; } From patchwork Fri Oct 11 17:30:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 834809 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 207041D0DFE; Fri, 11 Oct 2024 17:31:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667876; cv=none; b=qwSkn+pwiwtdFoel7sZj5+ICVU/e8MtABsBvONGyyGm0Ygp38Tb0QfADRRo/gS1W7s+nqS0+D1OcitmJCzs2Ufl+SY339QggX8V6yduXEHIypHxTu0hcVtMGnZUYsTq0V0kH0OtK5mX2VT+xXs6sLbbUBd5jr2h4jR9MT/d9B9w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667876; c=relaxed/simple; bh=UyZD62s1v2d5YaJvcqOxS/MfB69s2yqWlkTeAHIW0v0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tiWkHfOG9Gf8VHUySCPIaPcrF2xAn4Nl75zawfbSHZTuHdR4WnPsnwOWmXk7NiZR7IJKUJ4Srdm5JBBNzVkC8S1UjNndNTl08JtJphjuPDPCqgq66ZR2Hi6v3xc5bbURcbNHmYUD+TFjUEQ0U0S4Lq3HK98vBh/7f8b7DTH9bqE= 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=cMWKAKiK; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cMWKAKiK" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-43056d99a5aso21521205e9.0; Fri, 11 Oct 2024 10:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667873; x=1729272673; 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=dCAeo8KyOiOjgCPOqLwmsX3d8qXbi8D0bHOohJrw/JY=; b=cMWKAKiK1iZkHXB4ZIUqMOgkpjtKwzX+NDhGtJz1lyk2Uj6UpRLCDOR5uoWo4mw6r2 krEM8EE2Wx9enb0vgaZM5TI4FA5ryktoopZamuc2TLYZ4ON/pfbz6nxwTG3kDzPtuqS9 RkqMyS3DlAFRyklOt9nUt+hF1cjZ7mOayuR+tHUQ7zEejQmkljaPMll33mJZRpE2mCHm PuXLr483T9tGrGeXduztqF2Pkgh/BDSNrgPHQj8ET0JZLNDJU6pyBBs6KGOoK/qU5edT vKuqQOBYWQV+nu2JkHhfAJb/LvQcjKs56OLPuNVbRLRUtA1ICSJ1iAZr/EO5NMTPHRfR qvjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667873; x=1729272673; 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=dCAeo8KyOiOjgCPOqLwmsX3d8qXbi8D0bHOohJrw/JY=; b=f3zo1xJH3Y4PfHrhQKJnTaOmyEfDfJWG164mTy00X8FLOeqO1lxeMmPCbZafJJIBkJ kFcJiwZtDJAyM0jW8SQzbP4voQHg3d5o6KhnUy4FBGsH//Ok3gxdE87LnD0ZgVTAgqHn MR+5SNWOuYiRkqYRx5BA3Fw81u0Cv1ttOWpernyFKbcsb51ynLEvwgXAWa37ZknYmQG5 Sdv7D9IRctaEiaiYugALG1LQEja1fEK/hD4mLmXOERewAt80KGyjYo43pvq1pMsCm6ns DWUstqwq4avHEBE98TCSEmPDtmTGhRPgTJBQtWNXrxXjgbS+WgCQ0I0Aspds/esbaEBD +4aA== X-Forwarded-Encrypted: i=1; AJvYcCWJ2p2/Jil6fjWRbKukb7lWHNs6YZVJ4ZN4ZFl3msk8K5JUrImK/9psdJN4v/5Jf9VHvqxidTcgpBrO2LK+D3n1H08=@vger.kernel.org, AJvYcCWjrTDQOD9GjHCMySaTHg5JEy2v5TuXXwZPst6NJwIbbMQzA8B/FJPVhxnLPh9tg4Ox9ubMHpKuvwM7L9g=@vger.kernel.org X-Gm-Message-State: AOJu0YxGmUVq3/JK7ljrb6Djcnrt3LIH1i8g/ud4BkfQDg+OqB5avOSA J7/SRBy32XOxu8PTZWN+X6Z5q341I97vwMMIAZ4CrHGzUcv5sVen X-Google-Smtp-Source: AGHT+IE5il1yujibWZxDlla7UBFzfgL7bCZleTNmjT1uK2hnqAlyoTZlRS+yTXL5Psca6eVwJHAVXQ== X-Received: by 2002:a5d:5108:0:b0:376:dbb5:10c2 with SMTP id ffacd0b85a97d-37d552d4a14mr3072579f8f.29.1728667873312; Fri, 11 Oct 2024 10:31:13 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:2595:4364:d152:dff3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b79fa0asm4396516f8f.83.2024.10.11.10.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:11 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus 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 v5 12/22] media: rzg2l-cru: Inline calculating image size Date: Fri, 11 Oct 2024 18:30:42 +0100 Message-ID: <20241011173052.1088341-13-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar The `rzg2l_cru_format_sizeimage()` function has been inlined into the `rzg2l_cru_format_align()` function as it has a single caller. Signed-off-by: Lad Prabhakar --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index 37fea2bed00f..6a4f0455dc9c 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -839,11 +839,6 @@ static u32 rzg2l_cru_format_bytesperline(struct v4l2_pix_format *pix) return pix->width * fmt->bpp[0]; } -static u32 rzg2l_cru_format_sizeimage(struct v4l2_pix_format *pix) -{ - return pix->bytesperline * pix->height; -} - static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru, struct v4l2_pix_format *pix) { @@ -868,7 +863,7 @@ static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru, &pix->height, 240, RZG2L_CRU_MAX_INPUT_HEIGHT, 2, 0); pix->bytesperline = rzg2l_cru_format_bytesperline(pix); - pix->sizeimage = rzg2l_cru_format_sizeimage(pix); + pix->sizeimage = pix->bytesperline * pix->height; dev_dbg(cru->dev, "Format %ux%u bpl: %u size: %u\n", pix->width, pix->height, pix->bytesperline, pix->sizeimage); From patchwork Fri Oct 11 17:30:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 834808 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4A311D0F4C; Fri, 11 Oct 2024 17:31:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667878; cv=none; b=UzS7+r0Yozp0ZKEtXSA7ifZMgOZSpTWRG919SYNqclucbBDk38mY8+JGqYWGq+EWd+INIIkuL0gCHMkuEEVMtEu1KbcZdit51nR+g0hBMkGqRK1UDuEmzpq3jT2DA/w7Ljt5OwpjvKeSjqxvrZDS8MUWSxi1JliTBJSFTatOsL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667878; c=relaxed/simple; bh=OqGc6rLHSoJdJdnZGMY3nmYDbjz8rOMXI8c84zvYwRc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O4/FgRNB590giwhFqEo+CxpEpBAJFL+i0dPMVsK94tk0YoBtvBDxzyynk/0hPuIlmjFQohT2MxyCCqvhJnSffK8M3BuHaRRyJ0NkPJ2UQjwhPB9pFcj4UEbu7s3EMtOvzX+YsR4OKOLxkc6SSiWMZY6xEAas4XxFxwMQ5NdeO20= 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=DXs1lOsc; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DXs1lOsc" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-43117917eb9so17825225e9.0; Fri, 11 Oct 2024 10:31:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667875; x=1729272675; 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=xq1bR8QGhhUwaxGn4V/P0rav0fA/IINTBBL00un5dpA=; b=DXs1lOsc+f/ucGy6oNI7bo9RHMqXremLP7/ZDrOcHifk0ppfTMTDfH3y7/p7GGr+fV sMk/ds4LEPDLEAFlZ+QR50vqijR1IicNiyTvqOdWvJtJIgP5MFSC9LFwMlwoG5NOX1RF w7U98amVyRPcgLyviD+ICUuo8BFFPPqt8hJpdatpLRXgX2IoA42JUJAAZ/DwfRJ1AYEc QeTny6szMr6JxdzYYv0WQ1LZBMBoOXf8CJ1Tr3n+pdyeKWd+f3d3IpRR4u+Wyi+5Fdxb /G6kLhXdfyH6LzZjaNETaOPf5KTBS911qrNK4Mz+f1jv1dxn4D5l13kJn42Z2CbJ6HCN amYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667875; x=1729272675; 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=xq1bR8QGhhUwaxGn4V/P0rav0fA/IINTBBL00un5dpA=; b=ENcky8nLbGPVn6jCCmAQy7oq8QnBPHCrTf9Fut9IEGBCfwlWm1nSlGMGmbu1qh0i+e ggPY1vA/hK5NjwAdfFafg8T1e382ukuJUXaRQt8t3GCg7xpKdfEijofbrXIl0bPygPN6 +TYkKF3kvhPqy2Q/4M9VDGa4lgGKSqZFn6KiGVio8OoWkpSHQXVD0BEGVoPWW11bewe/ rJQPOUXSYixklNpAMiCvaq50z2K0ercnjRU3AG87pe34TERlGCAD7+xTM1tB6vPP8Wfu G7Uvv7+KLws/3pp1YSOi1lRnQnVJcGVFSOvtBZZIscH7wS9wlZItHaAeAFyEfCJ16pZ4 IjLQ== X-Forwarded-Encrypted: i=1; AJvYcCW+YmIuAp3tlP2VBow/bX7zWmTGfSi6jfamcU+D2E7q4ijsrkba9NlEfJg3uQMhAWOjsCeG4WKw3GpSGj8=@vger.kernel.org, AJvYcCWGPKs4icelcvZa3HHiUNa2Hwgq44PShNHvqIBtFaVxqtLl+omeeBmmTOuU6qv1TvkEBWbEKnU/clkxgFHQnqliatE=@vger.kernel.org X-Gm-Message-State: AOJu0Yzk/Xe8i/XyHIYQMMJfdzHYoMHp8a6ovIXEf7MMqX+UJ1SzdeJR vu9yHujFNrjIM/PvWFPXfCXAUlf2otH9Xa13hxpqDsQbrow0G7l8 X-Google-Smtp-Source: AGHT+IGmAHZ1HM/a3bdIdNo1p2ZKL5ZNuMZCNKC6qc/q/6P7urG/FftINnMUuDc62xQlctfHL71RcA== X-Received: by 2002:a05:600c:458d:b0:42c:bf94:f9ad with SMTP id 5b1f17b1804b1-4311df42073mr27114465e9.34.1728667875244; Fri, 11 Oct 2024 10:31:15 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:2595:4364:d152:dff3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b79fa0asm4396516f8f.83.2024.10.11.10.31.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:14 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus 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 v5 14/22] media: rzg2l-cru: Inline calculating bytesperline Date: Fri, 11 Oct 2024 18:30:44 +0100 Message-ID: <20241011173052.1088341-15-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Remove the `rzg2l_cru_format_bytesperline()` function and inline the calculation of `bytesperline` directly in `rzg2l_cru_format_align()`. This simplifies the code by removing an unnecessary function call and directly multiplying the image width by the `bpp` (bytes per pixel) from the format structure. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- .../platform/renesas/rzg2l-cru/rzg2l-video.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index a0fa4542ac43..8932fab7c656 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -812,20 +812,16 @@ int rzg2l_cru_dma_register(struct rzg2l_cru_dev *cru) * V4L2 stuff */ -static u32 rzg2l_cru_format_bytesperline(struct v4l2_pix_format *pix) +static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru, + struct v4l2_pix_format *pix) { const struct rzg2l_cru_ip_format *fmt; fmt = rzg2l_cru_ip_format_to_fmt(pix->pixelformat); - - return pix->width * fmt->bpp; -} - -static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru, - struct v4l2_pix_format *pix) -{ - if (!rzg2l_cru_ip_format_to_fmt(pix->pixelformat)) + if (!fmt) { pix->pixelformat = RZG2L_CRU_DEFAULT_FORMAT; + fmt = rzg2l_cru_ip_format_to_fmt(pix->pixelformat); + } switch (pix->field) { case V4L2_FIELD_TOP: @@ -844,7 +840,7 @@ static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru, v4l_bound_align_image(&pix->width, 320, RZG2L_CRU_MAX_INPUT_WIDTH, 1, &pix->height, 240, RZG2L_CRU_MAX_INPUT_HEIGHT, 2, 0); - pix->bytesperline = rzg2l_cru_format_bytesperline(pix); + pix->bytesperline = pix->width * fmt->bpp; pix->sizeimage = pix->bytesperline * pix->height; dev_dbg(cru->dev, "Format %ux%u bpl: %u size: %u\n", From patchwork Fri Oct 11 17:30:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 834807 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 790641D131E; Fri, 11 Oct 2024 17:31:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667881; cv=none; b=FhvybPlkwJIXtMg8Nu9v5Gk6hgR2QiH9NzVe+QOLv49PUAr1Tfk7G3ngEdr/jiIbDoI1yGaKjVtmLKJNnpIrJTbj13iWPSUwZioQ+j2GrAW+oa2uxI8ydwcDvhV2TBEV/1hkh0UnGfim2nSekx1OQkCe841Xe4RnBfaHkGerlYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667881; c=relaxed/simple; bh=PHRKf7x6L1ASM8G3srDIcBNdp5OhV2Njq3EqPXHRcho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WMH2bW6elT9LyWSprmNWteXJhdrIEFkyWLnqN+5fmSPESuqishVBHVLfsmE4JwHDwpaAZWRrTIdnpnEItaAEvv/tTxTmBgyKWOi/J/PNh8FBXrEZofFqn67PxNJLbZrJ/Ic7GslJpLWtOWsDfSED+5uzZzAixm6OFAIk3Qkd9Es= 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=CTDf/+oI; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CTDf/+oI" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4305413aec9so20540835e9.2; Fri, 11 Oct 2024 10:31:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667878; x=1729272678; 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=N+msqcCV32I7SF5lf57WZeKZsQ3gqFv9ozYk9tMSxqs=; b=CTDf/+oIB38jQfw4IsW/Z+yqi6bVuZycBFpNmkEGO3fP9mydiylotF1GAjlVmtpfAT y0IqAgYJmEg6KmvyFI3PH2A5g2p6UTK97Vrl23l2kr38cxweYZjjDdZgui68Ko1CseJn w4sxLTNKrPSOK7SLElPdSAHYhUPLQuCUxEfmZyrP89cXX2Zb6+beed+k0YNbsJwD/68r E6I2vsElU45aT8Y6+92ehxbUYDBt2AMbuFO+kXk4nd6+2NpxlFa8Zp5Z6C+OzjufnDA9 JLni47nzAEjT0Dyj+KSSyS7b4IymLa40/1ZdluxfO9QSHMNo8/AjzVmj8JCzlujqMGrB aWVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667878; x=1729272678; 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=N+msqcCV32I7SF5lf57WZeKZsQ3gqFv9ozYk9tMSxqs=; b=hqmuyvM2DWuL+hWqyZiaofMtud1wYECzrNcg4T278VwmXtAz9aQtRL6VefZ7EB/Hp4 cFKR8Q3e2ntA2ZBFPUAGsKw4dMjNVbAIG5kFlRYZAOgi+qBWCZ/mnZjBl3ijJ7/Lo72U FeTkROWtHNzG0SMAJW/XIEPThuBAyr0tHXYmVuSi/aDIdsGjtUCICQNsD0vgZEqmNzm6 2g+g6FEcnJ8b2HJYWgN050XZ52vivnGFLV0cky8v5gVFtOeREpVIAVJTER1XGU2Fz9jM XMV8mJovmC9Qey1RJGFf1zB5ipiHniiP9PF3R9ph3kYAcC+UH2Wg3kwjI8PFenZRT4ld VtuQ== X-Forwarded-Encrypted: i=1; AJvYcCU58jXT9wOnu/A2nKOtaieQtjuS+LTOxvO9pvpRe8ME7RQhejPfw4YjCOSqiXtHKf16SdPCTIDZ0juzkHg=@vger.kernel.org, AJvYcCVldhlC/ejtgMai0OIlVXLqlCKuS6fUzhDM8DauiTpMhbnRh1VWy9A/H+s5GSJbj3o8F6x8Ystm/sc0BP7UfgtcvSw=@vger.kernel.org X-Gm-Message-State: AOJu0YwiNkYCM83/xNx5XOwbOA3otRXk9Zr7ZQNNyptMxt+qKZp5ZtBP m5u8ACcg0tYRDqm1chz1TbjTuunG1FfpMlXX72vAdQz3hnwo5DLo X-Google-Smtp-Source: AGHT+IGlSsYL41bu/3RD07QWqrsfPUtn0x4LJ91nBsINUvs3TfWp6gx8G/MiUhwodx3vCiBORxCaZQ== X-Received: by 2002:a05:600c:3501:b0:430:699b:7d22 with SMTP id 5b1f17b1804b1-4311df423e3mr28968875e9.26.1728667877628; Fri, 11 Oct 2024 10:31:17 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:2595:4364:d152:dff3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b79fa0asm4396516f8f.83.2024.10.11.10.31.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:16 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus 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 v5 16/22] media: rzg2l-cru: Use `rzg2l_cru_ip_formats` array in enum_frame_size Date: Fri, 11 Oct 2024 18:30:46 +0100 Message-ID: <20241011173052.1088341-17-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar 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 a40b0184b955..07859c89be77 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -165,7 +165,7 @@ static int rzg2l_cru_ip_enum_frame_size(struct v4l2_subdev *sd, if (fse->index != 0) return -EINVAL; - if (fse->code != MEDIA_BUS_FMT_UYVY8_1X16) + if (!rzg2l_cru_ip_code_to_fmt(fse->code)) return -EINVAL; fse->min_width = RZG2L_CRU_MIN_INPUT_WIDTH; From patchwork Fri Oct 11 17:30:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 834806 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EAF11D1720; Fri, 11 Oct 2024 17:31:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667883; cv=none; b=cP0RGSqC/tG/GBc1CnRgiHKNJ28r2dtmi/6D+K0JvBucimdQYB3yQ+Pn7dOgbZVynqMMlkA8c6X8tSLSXRRtFwu7pHCbXAwVX3fWfUvVfZYr2h8+GSGiVn5ROTmHsI4LI7ERRT4bMhK1+f2t9Po4Owr/TceRB7T6Z2E0vN1IgkM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667883; c=relaxed/simple; bh=0+gFmlB4DNsucu+x+eYtavQ45hrttAe5qwlf52qdboo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GJaFiw4UwMesI0n/crlVbfNY5eVK5iDgq5m+8XENF509nifmzcCWyHQCoIGKbLRgbW4+Yv0snJfLm3Hodj8lbJmk0knMJBy95qxd6B2MxwpGFkRVnvUYgqkFoWY41F4NXaFfc1GMqVm75zt86HI9G7nN7gVF8kBO0J97BH92kks= 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=N4ySrPXX; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N4ySrPXX" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-431195c3538so14086635e9.3; Fri, 11 Oct 2024 10:31:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667880; x=1729272680; 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=ooCU0k683F64MUyLXar1nJROGv5on2+s8CeEiSJY7pw=; b=N4ySrPXXMel/mMtMbBWd0tMWLqCQ+vJpVhc8TushIsgzzmJ9hY3BZSjBYk1TPCpGrp kLNe4hElXGidyjjSO+hfHEDaAwi1sEksnGh1exU5hpNsQeSVcy26EgTzNMqkRyMnZWd8 Kye9E4GdmvT7cCsF1EfvZy//Hyok0w35ieXBvaeXP96Cc73bueDMUIi20IG1LGqMJf+b TAko2aNPP3T+gW6wTnY/QBwAoalbwWFtJFqao8OoFIlEec3NvYLN1TUFKw4jwdfRPG1y GR4Nq3gtO0qZ6f7ddSVZFYHp06EuA2+dqGkV9WcrFtlFfXgEiwqrEyG9MuLtHyKd/BFd sA6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667880; x=1729272680; 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=ooCU0k683F64MUyLXar1nJROGv5on2+s8CeEiSJY7pw=; b=oHwJPx716QRm/7CyAK7AabE3UWXb9MhoWCZSXXH5hx4bUkcUGlUrQF3t1VXEaiumUJ kiLO5kgZlQprrJUlPaUbtjAlhoiek0yiiBhorMf0DLWjwXTzALbqD/9xb9c3gE59CVUW S527oi8SrE0lu+93fk0+KgrM/6A+/WvzoZlex0GqMJSVRMLbpfjz0m5xt2MTHpoHfm7z 8XNQO4UqKcXtC+G8dYIHZZhktEXQhhei2SofX/yRELuUJ3QnxQhH+Xda+2FqLQuOqTXW jr88J42sCs9rjqUpzaIb3BvqBphAG32U02pY3uVPoPzz028pAkekeDZVUkHUPUEKvGRH w2RA== X-Forwarded-Encrypted: i=1; AJvYcCVx4oFkd+2mftpOW4gOwc8A1WGbvwnqn6oDW1qSrdM6tdpCJjM/X+Fg6Z+UXQnY6YQfPmaAaAsvfUnYugcsNM8YVTg=@vger.kernel.org, AJvYcCWUXHQdrko7gM/OxJIHEErfLr+QEQgGJWUvr6rMXIBt2ceOH2/SR0bNmDqjmIhcLh52WoLQu7UrbaGzO80=@vger.kernel.org X-Gm-Message-State: AOJu0YzwCW7aCuNPOcsynXqyetDJ92d8Lxtb1BGf27J/dDxnWASCjujl H7Z16aok9Z7tNsfpaA+CUcR5o3Ngra+FNIIyDNw9ThVjSkHTUVkQ X-Google-Smtp-Source: AGHT+IGE5ulRsw/Sdmmpuv0daohzxFgdMDrRE0Nf1Ba1RWcNnP7PYvpfyNTl0ydG0kA9jp2JENdzNQ== X-Received: by 2002:a05:600c:c0d:b0:42f:7e87:3438 with SMTP id 5b1f17b1804b1-4311de0041fmr25994355e9.0.1728667879673; Fri, 11 Oct 2024 10:31:19 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:2595:4364:d152:dff3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b79fa0asm4396516f8f.83.2024.10.11.10.31.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:19 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus 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 v5 18/22] media: rzg2l-cru: video: Implement .link_validate() callback Date: Fri, 11 Oct 2024 18:30:48 +0100 Message-ID: <20241011173052.1088341-19-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar 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 Reviewed-by: Laurent Pinchart --- .../platform/renesas/rzg2l-cru/rzg2l-video.c | 82 +++++++++---------- 1 file changed, 38 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 0cc69a7440bf..df6114cbe5c7 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) { @@ -532,10 +492,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) @@ -986,6 +942,43 @@ 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; + struct v4l2_subdev *subdev; + struct rzg2l_cru_dev *cru; + int ret; + + subdev = media_entity_to_v4l2_subdev(link->source->entity); + fmt.pad = link->source->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 (fmt.format.width != cru->format.width || + fmt.format.height != cru->format.height || + fmt.format.field != cru->format.field || + video_fmt->code != fmt.format.code) + 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; @@ -997,6 +990,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 Fri Oct 11 17:30:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 834805 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.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 119381D270F; Fri, 11 Oct 2024 17:31:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667885; cv=none; b=dPa3RpZWG/adlQghGVrqjsJykdD5yctNS3bcxbCg165kWazCUlj6YmgpQ3Ky0zBFykOxkKZuT1ALxpqE7L8zKOF70M7h0TckqK63WfIUPgU7r2+WIk9VT3qLx0/O22miI1pCybz3FlM/MKoUVZtatb8VsAusbpoDJcKHo1efJWw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667885; c=relaxed/simple; bh=dbBLP3+NjouqpjK/Rm2H9o60ChL3mY538dfZoaHJnrk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CW3g/AVqrwDAatpwolqBrwASSLCqdvudDANfxgDC/LsDWvv17sekTdyfaPOEcoNEJ8uZjwEj0yqbZW9bfTektloKKjpgs15i4z4buo9XJ4ec/SA2DRBiiRdZrKBAz8o97pdPyQ8niDcBoBQ5SsqZda/5n/YuYq7eqeOev9HStlw= 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=HUrc4Ttn; arc=none smtp.client-ip=209.85.128.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="HUrc4Ttn" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4311c285bc9so11680065e9.3; Fri, 11 Oct 2024 10:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667882; x=1729272682; 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=zjKH7Fuin3JQQgYx9/IMe+nE5SjnwHB7Sl3pQnlj3L8=; b=HUrc4TtnK6kV579QV8AMDBNXlclMCHXauORHP05vDdi8zG7jjhvrgL3BGZfYwf6zuD odyNzd2aLGY3ORxwafVVqBMkof3gsbkOo6tfRDRRB8uYjS16XR4utkpMnaLK/tGpGfpe VEW9+ApSW27DALNNt2dRrQTTfd9mOSFRhNmuDXGoH7GYKJXm/KcHRMJQrCQfmDhcKsOV JCoK/T9N333u2hNG2VDGKde/SrXjHZEc14/sBP3z5NzmrV44dYiKSbnxA/RJaECNtWzU Cy1a0r1C979fhGXLTiNgvXYClfiTqXLlH+AzDOIceq/CrqbNWJhZtBRXZyYzSEWCyQWz GArg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667882; x=1729272682; 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=zjKH7Fuin3JQQgYx9/IMe+nE5SjnwHB7Sl3pQnlj3L8=; b=YSIuV+s3Cr6cYCFCKFu52PFnwEzzzyk3YjQyMYYtyMpjvDhhAmwA0AUJCh9PsLO1z4 lW/uixfHZXlJcL00Dd3DESc5eAhfYSfhbOvoMXqwPmdsZ/B6yUA5cINAYiMj8Q2pnq8p eA1gcWY2UjDpnmrNClaW5u+aN+CMlJ/CY5+qt5w+RqEzRi2AFGYfyA8YDxurVcRYJpUw FrZqi813jwdDKndxUHnXktyeR3UgAolK8qeZ4uDd0IqbmNWchhgFlqR6J2X3aFaGzlXq 7uPK9J29VR+KeROCDxekv42NSr72Mdu8+xgmQWi9tNeiN1HRHOE4/zXs/n96PMO9VoSu sUIA== X-Forwarded-Encrypted: i=1; AJvYcCUT9w5jkzLNMWbt4frpY6eCZt/6NE2V6jsqiYA0otAj5Og95Np8UZ0ivdCHhROUHB1POxe9lm0YnjTVp6zmUct0s2g=@vger.kernel.org, AJvYcCXZFu+W5Ftw29gHo6buqNDKdLC1U4LPKMbsKPXbS8jyYXm5c9W+2Lw2EgkNQijTNQwuwnI08snb2pg+Jug=@vger.kernel.org X-Gm-Message-State: AOJu0YxqmijsXXJ4byiuad8aLTkzeCcbKfKIGxLVmZh5GttTaGzncw8s V5DLRjgekCJlX6mfE8Srq/T5kf8QffSuoZQi7uyYAQcLRF+Bgj3z X-Google-Smtp-Source: AGHT+IHRrel2erb0LyIl5I+yVHP8vY2YRgdZ4i2AfxN3+X7iL5LyafPWdhxxkM0kvLPQHumZjeMG+A== X-Received: by 2002:a05:600c:3588:b0:42f:5ca3:d784 with SMTP id 5b1f17b1804b1-4311ded5412mr30694385e9.14.1728667882238; Fri, 11 Oct 2024 10:31:22 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:2595:4364:d152:dff3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b79fa0asm4396516f8f.83.2024.10.11.10.31.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:21 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus 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 v5 20/22] media: rzg2l-cru: Refactor ICnDMR register configuration Date: Fri, 11 Oct 2024 18:30:50 +0100 Message-ID: <20241011173052.1088341-21-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Refactor the 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 327516272e53..c40754732576 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, @@ -67,12 +69,14 @@ struct rzg2l_cru_ip { * @code: Media bus code * @datatype: MIPI CSI2 data type * @format: 4CC format identifier (V4L2_PIX_FMT_*) + * @icndmr: ICnDMR register value * @bpp: bytes per pixel */ struct rzg2l_cru_ip_format { u32 code; u32 datatype; u32 format; + u32 icndmr; u8 bpp; }; diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index 07859c89be77..ad470de440ad 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -16,6 +16,7 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { .datatype = MIPI_CSI2_DT_YUV422_8B, .format = V4L2_PIX_FMT_UYVY, .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 df6114cbe5c7..a686a5cd4f59 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 @@ -279,18 +278,15 @@ 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, cru_ip_fmt, csi_vc); /* 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; @@ -308,7 +304,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 Fri Oct 11 17:30:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 834804 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.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 44AB11E5022; Fri, 11 Oct 2024 17:31:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667889; cv=none; b=n1uUVszHWAVG77e7mg+pWw8hQPaT5tcpKJpXkt/+A7fSq4AqvZKbBr+UGPghyxvOnixnngxdXUrjSMqLi5sq9c9luLRrMTuP6Clw4ohWnGT0kZ5wpftqwykaZ0ruG1j10hzeY/aDmpKW2DANOB3zbOrl5KYHbwyExOzu4EWlzdI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667889; c=relaxed/simple; bh=4Z4zcz6qi1DRZkhl3ogXePn4yxxghDB3ja6oNYNj7pM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N6YGj5IRAtpejVJp3R0FpBmIdf4KL7ykCQlJXxSseb5tQhD9/Z50vnHBjlz4olNqz5+hEuNiYo9uqZu9vw2Hxv21Tvu/86BO8zfKUVtBwlJue8vsIpo8DyQXvBiLsRJzN1q7sgJ7zWNRtRmYg5LidqFCy6AIAh3JrJDng/6XyiQ= 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=JbSi5BFL; arc=none smtp.client-ip=209.85.128.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="JbSi5BFL" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4311fd48032so5676735e9.0; Fri, 11 Oct 2024 10:31:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667884; x=1729272684; 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=LvRKqiDQxMChmwwfQQzV2pZodEp0URXdasfkV2jAffQ=; b=JbSi5BFLb3fJELr31BY9/FH9ZlF+BK3Cvdxm4jHi4G8GweIPSuVfWBvQNvs2MwaYuo UYlKdjinO0uafevxsu6lt1e9C8NmpdKqB0wEXu0fTFe5hMd3ei2Bfz4IeDd1rMItL/Z5 oPrsWQjYQJq69Rg8Ay05HKRXVIGkLcMS97ch160eaUvaNqHYlm33UH0xn13s7VgcPG6I HQBn7h9HJmcWVfatt6ZopRGFbhT91sMuRMH+lf96JvNZHTOxuU6UPyMl4QYLMu60sIwt jxNRMTw+Hp0Hck4+EXS81BQuv5ja2ApMXcR6ELS1vf1DNf83McDrE8xisakW/7ralwIq qvEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667884; x=1729272684; 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=LvRKqiDQxMChmwwfQQzV2pZodEp0URXdasfkV2jAffQ=; b=hB9AhZBpqEU3s+9mogopcY3nvEcNqVdujnKFjvh/nHlGZc/0d/N1TE5YZPZ5A6KgLC 3k5s+l6y9PNod2hWoJKy1K3+y1LJY3k8KAMeueBdEq5cBWKp1bk9xX6/OEbPr/VKbghB Ob5e31VRjDK5dwGr9x029KL4gZqN9OqV0s6+kOyWBSlUou2/zHlgIrIgXRCwx4IVQHpr 4LfpEjHlwnV3HOpu8z7vMTyrhfvWngGTMQYta/6WkxMmJEI/s/SWrBNdXhmkE5V4GgyM rXkSOFST4/1zg9xNR/oRIUhokvH+jcYiTVM74+9jNf43Ac3snFKBzD8DJqUsxEAda1lC O1ug== X-Forwarded-Encrypted: i=1; AJvYcCVnCPLFvpeEG8bd5JwsFciPPK/FJL044xdWX3+wfA372EWhCOZm7jdIMQrLyRXgtDyTKvLkn3LO654Jh0ochDL/NV8=@vger.kernel.org, AJvYcCX64Nt8mwXu+Gf3SB3kskJiuslBSJLtfXX67azfuqhH1wYYh4cJoDetmRg2G907LmRMZx4CF1U9fNGC+G4=@vger.kernel.org X-Gm-Message-State: AOJu0Yy9oMkF3EqbiDJzmkxQ0lFzjwmNLFVZk/HnDwNGo9tH1haNBkpD 40zPNMm4j2g0CmoNhiGp2XTqZ+jAGxlP1K56JKD/HcqYTz62cGv/ X-Google-Smtp-Source: AGHT+IGv2zXgVW4ojNjjD2WUBJJsLA91ulJPLgeim0WVTbZ/7G/GhMhudylAQhsqN/5E2Nd7h9TAdA== X-Received: by 2002:a05:600c:45d1:b0:426:60b8:d8ba with SMTP id 5b1f17b1804b1-4311df47678mr25904805e9.28.1728667884504; Fri, 11 Oct 2024 10:31:24 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2500:a01:2595:4364:d152:dff3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b79fa0asm4396516f8f.83.2024.10.11.10.31.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:23 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus 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 v5 22/22] media: rzg2l-cru: Move register definitions to a separate file Date: Fri, 11 Oct 2024 18:30:52 +0100 Message-ID: <20241011173052.1088341-23-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241011173052.1088341-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar 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 c40754732576..a83e78d9b0be 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 982c996cc777..d935d981f9d3 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -9,6 +9,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 a686a5cd4f59..a4dc3689599c 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