From patchwork Fri Oct 11 17:30: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: 13832827 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.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 95CE01BE854; Fri, 11 Oct 2024 17:31:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667863; cv=none; b=usbYYj51ggBy0yz0+p8SZITjsyNG0Rlq/X/889Nh2nh02fkVKPybXz0D9yI8gc2SaTq0svX4O8SVW8eLPH/dtw7+7oFsTknOAn0sylHZLGiF61IPiHEbZE71njsRFYUbl5JfC9xj3/zNcm+l6+EuDZ/VSceczIl1yc/IH21Pr5Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667863; c=relaxed/simple; bh=i1qXdEBpnGriWoad2OUw0LjWiot65g8XR1zyIQJI1lo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S2ckeRwaOG9Rksitsk0fGAxd9si0Mixeil2uENXwJ8hIyt4spUZrkpwWss6at64ws3USRJI3PaGifWjj9Hs+0kuFHneWcRqL5G+R0dxtxT8WELJpKQVqDj4O8+i37CUDW4Js/gLXt27bhzA3AOFmSxj5lWZxUkuUebcTB9P+R9I= 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=HwS2LIr9; arc=none smtp.client-ip=209.85.221.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="HwS2LIr9" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-37d49a7207cso1282800f8f.0; Fri, 11 Oct 2024 10:31:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667860; x=1729272660; 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=HwS2LIr90E+UiHrdo2OnjCBH6e8ZrGgXfF5oMthORcLozAIP6WPYtKNxahes5Wy9Sa M2cL8zkenpWComRDN8KuAVotUBlbQdAeXfcGCKUwVQ/Rw9qnsYlhPwVm0aQF5lb2XvRI NNtm4pIOX0EO4+N9igmoYlRHXJXCaBEexE63XociHXRMvKMhy1Z9YQ9S/Rz2COW///0y PV38b2qs1SvfqHas2byRrhq3a8zcrJT94ykpsHDdaO9zLeRUQjqboZXKNRNU1qrMw3Ct RscgqwGuaG9tBuYEAkdbIPKbIG69XZfkLAAuPb0Y2Cyc/Le2ZBSyb6HeF7SYyzQ4TibI /LNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667860; x=1729272660; 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=RYMHYRTcga84FeUZ5Lni0Fwy2tYFun6kOUeXG1vMTh87d20BGGqnQ7lR4+mqdi1xDy 9r2mYBXPiYtXbmRh+9GJBNStOwqU8T93WHoHmIQ2S1pYeS2p/tZ2yo7LDmJrqD1RsrES dB6U1zOrZYrdf175M1SSy5s5CcR7+LBcpAN6RtS7JIc6WsyoGjzyWoXq7kGi6CS+u74K MaHNJ/hRw1Ouk9WlOnLTYmu949jiVpkNgeptMxE1vFmAfSo42bBNRrW/FaKp1t1SfTFX tuChD3GfjBr5KqaNN295Pl1LJZvljOTLS6O+J9AXpRCpiFL/c5iqDUu/WcLikdS0w1Vn Rqqg== X-Forwarded-Encrypted: i=1; AJvYcCXo3ITPd9pmjLjAMHNMWS/+0yqi5/kkJp4/kKM/8rMPtZjDMKWJDFUDAym2a4ZEc6KRJS5Ez/Nc85tVTEg=@vger.kernel.org, AJvYcCXqBmE0YL9a6sG8GyYYxXS40vN1uAHpEZKVUTY9MTjDlKYG+ECAq2wQVWGUd4KDiYaoV7jM6AXsXCHV3frj9ljvvug=@vger.kernel.org X-Gm-Message-State: AOJu0YzXFqn6t3M/TSiMy8mCJp3AGC6q6JHQPyQh1HxG15QSAdKn9/S5 XLbbRzEwNxColsHdqF1dEP8s2fsdj3IQTobe1SQ9JG06orlcb5cr X-Google-Smtp-Source: AGHT+IG7DMlRr4HXxIAmYsODq0xBplLBz0wZzKkHB5ar9rFOkF6mfRn8XEwFZAXQ/v4cE69i2LMfQQ== X-Received: by 2002:a5d:638c:0:b0:37d:5103:8894 with SMTP id ffacd0b85a97d-37d5ffb99d4mr271486f8f.42.1728667859644; Fri, 11 Oct 2024 10:30:59 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:30:59 -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 01/22] media: rzg2l-cru: Use RZG2L_CRU_IP_SINK/SOURCE enum entries Date: Fri, 11 Oct 2024 18:30:31 +0100 Message-ID: <20241011173052.1088341-2-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 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 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: 13832828 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: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: 13832829 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 C88DE1C232C; Fri, 11 Oct 2024 17:31:03 +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=1728667865; cv=none; b=sfm6bZLb2q+goN5DNyBt5vmkrWUFT3wJ06HrNZPNFsqJ7MgfgJNdkmcXrd/H4kLqMHInhfQON4wHjbGvCo25ZTBMNTd76ZhIrIkQQm3OydDRkRbqmXVCUrPWa28LYzLabFojVnz2VxsewczTsaQCC83TrRalOhVrrkvVq1nO2pY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667865; c=relaxed/simple; bh=pcfgfWFO4/e6ngaEOYf/I9xYEAvOdCY1IzThYtqzqpU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AwM6w1uFny9qlGDTZIS7Y+nvhiMZWTC0x/Yl2/sRplyBi3JT0e5gC72oSiP2omAST4sRn/xLLy0Bk6VmZZW+4Z6YwuHCX8DglEzG4Mk2w0fgWa27xmRY5khQLetnhvrpJJXeiXNZjeEoMyYaXvEFsGgZ7tGAOMeUsZEJ6VA6eDI= 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=XSRDJWbJ; 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="XSRDJWbJ" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-430576ff251so19576615e9.0; Fri, 11 Oct 2024 10:31:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667862; x=1729272662; 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=XSRDJWbJ2/K7SqFTg8gV5Kh893h2NpMguf9BGKIKDqs3kEbXOpi8WtZZ8hnRm+AXwM lPov664BMHnZeBqeKPWpcHhGIjRrb1Q0/Fm2XEpdVyQWhvk6SrxQkfX0cyBtCjWy9wUG 89NbphHvRRv3zrdOQ66Rf9LwleuP9H5qqoHLi3L2n5yyWVwJOsJz7zlTfNzyoh7DrnmG c+o1svJk3WdqxqyKwcZo+E1PsXmQeNQyq3ms5o0vMFOyG5+c1Qw0qecJuv9kEsEM4LeS 959u6l4J78sZsL0hoCgBP9C7bX8Sql74Awm225Y76x4z6H/Ze2cA5oV6VkcUEus8M0qH fv/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667862; x=1729272662; 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=Cg5fu5anaMjAQT16q0+2q5g6Zn9om04mml98l2P1WvTs5H0sNidKKUNpdItZrrbuZv Xgg927kb4xprvpM6CAkD4uKJrEomGorShDSRkCzJT0KnbhIiexl9sns+JKKXhKyokqJA 6SeHg1dQbYl+qJ19Yvtj77oryNGqGV7JlP9L9jcDJumVCYqMr7pgDT1nr9ad4rVI4Q9d TqNW9dmVLEH3OdxEtRzLW81KKBvsQvgI+iOdiD25qs8pzPcsrTwPNxYu5icjWJNrJ3A8 6qWG1zOj+JZeuV2woI1tpS5kbldY8/94gPdILSz+HHHQlBTJQdnAMrIHRxq/Ulrvqo/h vjFg== X-Forwarded-Encrypted: i=1; AJvYcCV4nmCzNL5c3zBtBDOP2eAPjlG8+mp/59qwxIDKjlxN6lR/R5RZVM4tdFNnthh/3lkP3cxqQ7YIKFqdhAo=@vger.kernel.org, AJvYcCX1Fwb4S1sxElO18SkqxrfLzhPjVMriQ+zYoe4K2DCSvvJhgyHe7oBaMc4gbT9z0Kvq6fREHYAQ2idBcOaPxe4tgi4=@vger.kernel.org X-Gm-Message-State: AOJu0YzHZPw0ypy723D3GXpqh4r6oPY+JF68dL2y1Zawp/5SatFCt/Uv 21Ur3gwOc+TwmRAgObyH72zdkGN0v56cmYZkp3bHV4ar4uxbyNWWFQlbnw== X-Google-Smtp-Source: AGHT+IGpRSEv7gmOKl+6fdtA2iLdECckBDXs+r0Xa/0VyX8y4KYo0gkNLQrwO7bWGLiqFk/VaKN7qw== X-Received: by 2002:a5d:4fc8:0:b0:378:89be:1825 with SMTP id ffacd0b85a97d-37d5529bc9fmr2458173f8f.49.1728667862018; Fri, 11 Oct 2024 10:31:02 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:01 -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 03/22] media: rzg2l-cru: csi2: Mark sink and source pad with MUST_CONNECT flag Date: Fri, 11 Oct 2024 18:30:33 +0100 Message-ID: <20241011173052.1088341-4-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-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 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: 13832830 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: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: 13832831 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.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 C60B21C8FA6; Fri, 11 Oct 2024 17:31:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667867; cv=none; b=WvPohvgJFs4BsmOaJV0DbhSPdaVeScLojY8mvavic/lrgBh6bxEDgAFLSmvGevSgIdeJXo3FsihwFdHQc8o89NbHAN+AMJfokAVrzdCGG9OgtDwJzfgK7LhVU0J7Sa7PxHtQ3EwuHx3J2+Qcrk8pwfJzadfwBQHDoQJ+FDQiEhw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667867; c=relaxed/simple; bh=7XriRKCpYwD8owVfe8+uQIfwJyyzecNO4HObS1ODUME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gCYFN3mZmZ2VfFKwTsjlwDCs4R1Hw0e/Y1xTwGCZAg8eGRIzig4ITTA2yHOyaWMoowIRo2a0Sp+koHoty0h8CpJpIsy/VrpxTzBUPlMg67CpBUKXsiVIe12i0CU74eUdc9HcnYR5p65RqCGTE+iKMefYK8eX5eGIVOoriZSsCYk= 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=gXpnNt85; arc=none smtp.client-ip=209.85.128.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="gXpnNt85" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4311ae6426aso12379885e9.2; Fri, 11 Oct 2024 10:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667864; x=1729272664; 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=gXpnNt85zEVtO6mEiS1XhWr20p9HBuKqPxCgjEIeeqIICVY6gkrjWfYX0FM3lAoxEY Zw4hmJZyLUTjR2oFkswrIkL2kZLmF4vrNbibVRrmHIJOcdFfVNY3r0FCFm95CJA8MMNl T/vMTlXi4ljgvSL6/dYAcOr2AfmLdfPVBDXkdKBvflPCP3DQFq/YMSQh4CLNvYNWakzS 4Oz2J4lEhsu3sWqIhhAJifeWi7vp3DC/lOQBIahY+CP4OEEL9MHe8POpY+RtvZzj0wka TCD2IJuCzW2Weg0EJ3RrIySyiNu44aFyr7Kfehrnk55/UIG+lXOVLw0JuLQ8AH/sOIHP czsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667864; x=1729272664; 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=k8MrfcLdLeA3pIURHtp6OptlSIfj4FVseBqzMx7aaWRj7EYt7nPVdGD+aHAw2Jxywb FgPEHKYOvkwHgxzAlqYIG4mpcf+/EmkiCzz6zXSqOUQtGPhhusEtWCFh8tAdoIkI1QLm JanwTObDu1GtrYC0eB9ECo3PRhBzz80FymajsCNjGBlRyeOOyYO8Oq8hIofivo1dxNL3 +w/0yXLnkh4TQ9WOpnrMKK14/72LBaEoQqjsxV6YewRVdYMGKhG/GdUg4yMWS+hXo6i9 z8g8jnRriapH4Rrc8u89ch3sAHo6Z6CKzeCA/dAuoFqUBWf3xwo1Tiqefzc3BgxwkzD6 BBaA== X-Forwarded-Encrypted: i=1; AJvYcCVHalBpUdDgmF5ZPxUIi7QQj62f5ivBb+ZeOZ0zBNO2Ub/O6SDk8aQ3Dx4XxYncXrLVFLQcmHgel03qp6c=@vger.kernel.org, AJvYcCVX6ymXjiyAX2MIWSV7KCOQnyJ5QivNAqDnfLH6DoZtGnixLXzSWrG8rGlivaVL+I6LfNsc7t8CLx09uLlS4S5qPiY=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6wptXQtw3v92WOXsPr0Q0OSeXsoN5NAvwdS/S0z26IgnAIdiI PjZ/XheXLl4a9Qhol4uEF2zhfHdDVL4O0nxfOIS46MkNuDsn8YSo X-Google-Smtp-Source: AGHT+IHObhAbzYvZnqkrLmUFgJdpmdtuLoDgBpZewIa6K9TUf5uZ1tJ8Cbd8vXQQDh8MFGszCfUjmw== X-Received: by 2002:adf:fa8f:0:b0:37d:4956:b0c2 with SMTP id ffacd0b85a97d-37d5532cd7fmr1939515f8f.58.1728667863866; 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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:03 -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 05/22] media: rzg2l-cru: csi2: Implement .get_frame_desc() Date: Fri, 11 Oct 2024 18:30:35 +0100 Message-ID: <20241011173052.1088341-6-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 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 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: 13832832 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: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: 13832833 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.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 33D851D0485; Fri, 11 Oct 2024 17:31:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667870; cv=none; b=KLjpx+n2CJ9KizXaQkYWnbUU5efapq1D/hUpHe9DaGukw13SJx3NSr02gzEKfyjT3Lc7DiS/TGHS3QWqgtWjhV28bKZ4zqv9CsyEtzmlXq2WDB2/PKco2HcX+v8qPOZyVS+WnHnRXZ3EnDSmxLbWvCv2DMQP6ntkd3AVaI26LkY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667870; c=relaxed/simple; bh=R4slbuQbnwLyRfm3Uh78TiH/6+iHc6Vpb7lHlAzHkVw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OB6HnRZbdKrfVpWGx9XOj/+oXFkAkOn3rgyKnoF/+dZ4S6oInrPD4LxXZTVl6bZMALaIc76tv03aKQ3K0IdBWXSI0XvR6XYzJcAQ6+f6/URIlYP5wVT5TlWJ7rmEmzeFsFPrrpahyDhnlvjGCUET0prsgHmyLsChtwCbO6rN9Q4= 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=T5GnP08O; arc=none smtp.client-ip=209.85.128.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="T5GnP08O" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-42cae4eb026so20696915e9.0; Fri, 11 Oct 2024 10:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667866; x=1729272666; 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=T5GnP08O/73wX+xzVa+J1GpRpTJ3FtRgBZMDzzKgnKmo/nO454BmC5cNgxw18RFqB+ 5I8ekAlXAbXK/5Jg82UWW78SWQz2AtNOGLX0S6uAwp53UdFc1brBKqqrShGG1ftCeY+N j2FVyjOvy881Iq5YNdD1ZLLuD5r3AYH9JpipHy0fH0eTfMMfWJruHH/E7xfcyBbV4A4O QJwvuWoNe2XXWxlpet1JJs52ee+FIwUBsK36rM2pYMGOG42hTZvRJ0Z2vD+9Eeo3v7SN +pRMOEjgjpdj5o3kcBBaJJKCtSs/UTdHL/Od572Q5amAK64jSrIwSy4Dv4n9zGQ7Dger 9//g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667866; x=1729272666; 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=tekQhKhtZVYQyYRICuVfAQ1jhN25r3aTspk6CVz4mh/UKSsIILSHgAp0rx3jGMZcnx r8MGTti2bCuYlxLpFhhOuj8w2eXA41WAIQKpGRqLtZX8i3/ZV1UwKs5zOnxZwqHz1MdV HyUQyTsCvXULVQb05SGDvgArcioOaIAHhTJr4W+0en8FllY1+eBLljfQXatUsk2LfxvB Dfev3XkN4ThcHYyohxhEPd2tFJDHcbJ0Im7XRkYopp27QNbPaaBMOe5K8y4TrGF2aP5h +J9vvJXpIDwbK+7riULTtZKTgzHcNO+HTV784NOfriAU/KW/pKri0kodKJWNhbx/vsBJ VpjA== X-Forwarded-Encrypted: i=1; AJvYcCW+JLQQSkt9N6ADiQfCXh5J1mxC3ZYqUZ6tRoQCfPQDRuqk3HF3qQJJWOUwKuGOe1jLgrtYJBbJJ4Zwk/c=@vger.kernel.org, AJvYcCXXGUX17Pc9M2JO3ZNTjtKpzpnoBKNWd7lIE5rTffETmsK4PGPpANL0uLPUtsTpJN0KMrbKidXzjs/A/YLIXBOMjp4=@vger.kernel.org X-Gm-Message-State: AOJu0YxFgLhK0GkSaqffLV2Eonyy0lS9U8cVw59gW52bwweUGaTgDGLq Z3uGyznvlL3PSAgh+L97gg9Pr5Ll9vPK4SzOuv2k+KpkRtacvE2l X-Google-Smtp-Source: AGHT+IFyeWXUnEjKsNs2TEJWFOSpiKdRXIZdD+wp3OsMh5rnvvhrHwzXaAEwTgOCEZINTWtzeQEg6Q== X-Received: by 2002:a5d:63d1:0:b0:37d:4ebe:163e with SMTP id ffacd0b85a97d-37d552cccb6mr2688302f8f.53.1728667866417; Fri, 11 Oct 2024 10:31:06 -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.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:05 -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 07/22] media: rzg2l-cru: Remove `channel` member from `struct rzg2l_cru_csi` Date: Fri, 11 Oct 2024 18:30:37 +0100 Message-ID: <20241011173052.1088341-8-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 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 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: 13832834 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: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: 13832835 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.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 B466F1D07BB; Fri, 11 Oct 2024 17:31:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667872; cv=none; b=Hs6PgQtKQYR+eP1Eo/ge9rhCotn40gRw8fb7dMKee6vVBFjPBBeA+UacULVHjj2mgdADabERNnhfDDdEoX81pr9uAa2zuG4Z60ylJDlU6Kn1POVR+pQ5A6aBh1icO8IRREqCx4/pAqp47HN6F47kJj5MvdOsPd38oHtjijT8cJw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667872; c=relaxed/simple; bh=jjKhdL2ZlFvCxK6TQCDrMqBP3ZWyNv7UnbEcwC/zyfU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iF0oT3jgLv+NJqXENVZ4k7Dv+iRoPi0eAyy1hKn9wSrBScJCKNGgl98c/VsbBo94gfuzoQZWfXCyIpnPPMQjqcLXvZOYy9q0jK9uM3y1/eZzpBS4jEnq4TTHmHF8ikHpUx7kmg6147A7KsIjzTpziJWDqfIwjBGc+gD+06u07bs= 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=SQY424bT; arc=none smtp.client-ip=209.85.128.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="SQY424bT" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-431195c3538so14084385e9.3; Fri, 11 Oct 2024 10:31:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667869; x=1729272669; 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=SQY424bTcM86j6QlrvQCSbY9j6+TNiKBmnS9oOSEdAMQnis+JGSv0aozmPUB8PXE3l Qco5ZWpVXcq2TFFrzax+RBJEDBz3o7cfXiacjb5xQISRY0s/3aUTKdIUUuNhacGJkfmY rLOadcV+g+916RDsfBrizOUepOiDrCaUxGtgXZRSFDpH2yZSGwuzZkc79xFI5n0qfPnn ZNR338gZlOVA8OMxKpTMnQopvOMtCOirWjFpZC2FIgGDDg8sglyCOJHPQ5XHvj+j8tj1 EOiZVgx2MRXzrkj+TMnbqikda6F6aKt2eY8N81BnKqqcP00HjZ7qSduff/IHtOCDbihS 3yCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667869; x=1729272669; 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=mfAG1LKDDPSp+ZQYxLoewI1XoPMkl3yjXkchDX9xapQ1FCzBHpEcAGGCDxC9RWCaBb mEac5z1xEjxulqjUwVyuyvsesQ4ZNtkH1/BKqJlmPVoT4YkCxwgRTlvlVjNvgoSy5uRL /RWIZPuemVVTKClaAEJte4HqR8IGlSt34zEFBANkYV1riMX2LmhyAP8rpR6t6bT9Js2m LiQv/bzWp5rtNROMoGkbW+jQSNWuF50Z/fLFMj7HmnT0gyy3X0nbMXfnfZAOArHK2Nbb 1iPDOMiWATmqTObIQIjf5waIQIGP9HiYEb+8Mlx1Ijiy6r0WgALLjfXfV9aXBGCvomFV AZng== X-Forwarded-Encrypted: i=1; AJvYcCWNc7MjIMpfVuimbdjYf5eaNJvpze7gW80Tzm7+GStLIAmQyf+ftpnTVnw5BUMIkMrVTZ2DEAiSZXJU5oYBI5sGQOA=@vger.kernel.org, AJvYcCX3TTnBHi7n0vmxZw68VtDfgyjAL3eCr1zaQSwNd259WCpqsKW/J10mfgHiRq6RnUav+ZLFzGiOOSikXT0=@vger.kernel.org X-Gm-Message-State: AOJu0Ywr/rs4GYNF2USLJAZwH5XXc1zuhmWBP8NTJY4TiI6nEZGRDgKp P8X/LZD649ubKYkazj3dwe0+Qysc8DL+y3fo00m+UCvlMoPec7LU X-Google-Smtp-Source: AGHT+IFGAO6T+onA77JYp1uDBIPc/erkj9W6nZlMCZgpZO1/soFy7ZTiRigXkOUPAYEeAXmGevGkDg== X-Received: by 2002:a5d:460a:0:b0:37d:34f6:92a with SMTP id ffacd0b85a97d-37d5531b1b1mr1671628f8f.51.1728667868956; Fri, 11 Oct 2024 10:31:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:08 -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 09/22] media: rzg2l-cru: Remove unused fields from rzg2l_cru_ip_format struct Date: Fri, 11 Oct 2024 18:30:39 +0100 Message-ID: <20241011173052.1088341-10-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 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 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: 13832836 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:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13832837 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.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 5A1941D0DC0; Fri, 11 Oct 2024 17:31:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667875; cv=none; b=rQvzcJw4biwCVTwm+RdCGXwQvJWo0XSZNWbSUVIdCgrozigqGoLiO5cWdzLSbUIZk0sGaljQTW+0bpwp3qnUSbUJexIxuNP0WMZjqTqXDbDdRmWBKBQv9t7oPdYC5EsXxkSvriLNALC+Y/P6ywoQW9FMoLjFYiYUBb/fpWaweXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667875; c=relaxed/simple; bh=SBDLLvT+tYkHyYzrrt3YaV1ugUtMtCxAYl+lmcAG8Pc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FoF4+NX5ru0/dl1b3vwvJEzI5ygB8dwG567X1WqvjNmlJwA8y8LXla6QMb7X/vugHp4+5tW8SQyTltYzsTBgGj6Wc40k3bhx40/qocOTyNWXig22GFtaGB0iKkyKQ7BHq2kvgS+7pK2LgJQFsS3P0ki1xorxh250PnTNsHLQcR0= 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=RmFZcYfK; arc=none smtp.client-ip=209.85.221.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="RmFZcYfK" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-37d50fad249so1068556f8f.1; Fri, 11 Oct 2024 10:31:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667872; x=1729272672; 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=EI4+FlVaH8+BwT126GKNT8C9nofJLcr7PU9LplAktD4=; b=RmFZcYfKYAUuUvra/e0fWlIddblddzPTjmWuppWYFC960lBgk903GvkafHmnZbnJv3 MwuZW/mJW1pROfSLzlEYP6HsPpio2tjzJh/G+fYq39LrVMht2f8IOvyQE6n91lSAb1qP n14gQNYSutq80IUEMZgsvu3k++0PzTMZDHiPrln0uLdszKdcTWSBcGTzi45uBjjtnPnY YvrVfEmfBWKudn/V61qeCLZRsjsy54x9J2K3bCgUL5yjR+XgIDtuu0MeNwK0LTHRTc4B h0/4UW98t6GkHmFRcilaIu8CxyNZ4rwhTo48LVFWyImsiUVzwjGxO8S3CKzrQhowPjGa MVsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667872; x=1729272672; 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=EI4+FlVaH8+BwT126GKNT8C9nofJLcr7PU9LplAktD4=; b=qIRUYFPGlbZ3BEpSV75CRoMbzSmIcl++BazE0Wog2mHN5vhsvwTnHZIMuAGOPMd4lu FRnpYxDVFmOf1/mBm7I0LYcfaVkZeLrbl0SHCPWlgR9ueR0IAVonPifJmYG1alGx2ZWa AxgDJITeNbvshiRaaQQKN2j5qkcknvXCPK5Q6Ee5MAIFJ3oxUKVgT66LX/CFpuPJgmEp Md50eTHr2RFNmIdOQo33FTh2mdO4EhETqJC8/v2DDJV6DOqnZyzejUURS5xyNT8Au3lx spVgQX/rfKPwvK27/UZc3jPSchH23q2uv9NFQaj3jgVl5dOi6NodwHUBaIq0lRA1Wwil +PNg== X-Forwarded-Encrypted: i=1; AJvYcCUVoFdiKOL8iAWI0NOy4iG2O5FTmi0RIUMUT2BeCU1hzR8lQahsOTQX+odt0PnKl42ICf00USE3xZ6OJg8=@vger.kernel.org, AJvYcCUie7RH8Uip37CWRnRVX64DRdm1amq0F/Jiw3IgoaBnG1raC3z3TT0tXuyh5hPTSHBmYYsMaV1g5Vq7fiz2Kttaqic=@vger.kernel.org X-Gm-Message-State: AOJu0YyEwvs0BrP3GNbhPFbhf0j+TayU4efeN/+c2SMsd5eJ4n+kPVtY 3V9+59fK8IB0c73nzzFtyB3oNoMCkZplsw84xyuhImVWfuNgjVJ4 X-Google-Smtp-Source: AGHT+IFCz9ssNpLDIhUPAPmVUOSfySYRYt1ZBy1sIsYK0/Brg4zGbAAbq7w7Xfs0S4+z/Feg06mY1A== X-Received: by 2002:a5d:404d:0:b0:37d:4f1b:35b with SMTP id ffacd0b85a97d-37d551fb778mr2255048f8f.34.1728667871522; Fri, 11 Oct 2024 10:31:11 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:10 -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 11/22] media: rzg2l-cru: Simplify configuring input format for image processing Date: Fri, 11 Oct 2024 18:30:41 +0100 Message-ID: <20241011173052.1088341-12-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 `rzg2l_cru_ip_format` struct to `rzg2l-cru.h` for better accessibility and add a `datatype` member to it, allowing the configuration of the ICnMC register based on the MIPI CSI2 data type. Also, move the `rzg2l_cru_ip_code_to_fmt()` function to `rzg2l-cru.h` to streamline format lookup and make it more accessible across the driver. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- .../media/platform/renesas/rzg2l-cru/rzg2l-cru.h | 12 ++++++++++++ drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 13 +++++++------ .../media/platform/renesas/rzg2l-cru/rzg2l-video.c | 13 +++++++------ 3 files changed, 26 insertions(+), 12 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..9b1ba015df3b 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h @@ -62,6 +62,16 @@ struct rzg2l_cru_ip { struct v4l2_subdev *remote; }; +/** + * struct rzg2l_cru_ip_format - CRU IP format + * @code: Media bus code + * @datatype: MIPI CSI2 data type + */ +struct rzg2l_cru_ip_format { + u32 code; + u32 datatype; +}; + /** * struct rzg2l_cru_dev - Renesas CRU device structure * @dev: (OF) device @@ -150,4 +160,6 @@ 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); + #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..8f9683bf31fa 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -6,17 +6,18 @@ */ #include -#include "rzg2l-cru.h" +#include -struct rzg2l_cru_ip_format { - u32 code; -}; +#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, + .datatype = MIPI_CSI2_DT_YUV422_8B, + }, }; -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; diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index 401ef7be58ec..37fea2bed00f 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -301,18 +301,17 @@ 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, u8 csi_vc) + const struct rzg2l_cru_ip_format *ip_fmt, + u8 csi_vc) { - u32 icnmc; + u32 icnmc = ICnMC_INF(ip_fmt->datatype); - switch (ip_sd_fmt->code) { + switch (ip_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; } @@ -328,11 +327,13 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru, struct v4l2_mbus_framefmt *ip_sd_fmt, u8 csi_vc) { + const struct rzg2l_cru_ip_format *cru_ip_fmt; bool output_is_yuv = false; bool input_is_yuv = false; 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, &input_is_yuv, cru_ip_fmt, csi_vc); /* Output format */ switch (cru->format.pixelformat) { 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: 13832838 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 Reviewed-by: Laurent Pinchart --- 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:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13832839 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.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 27B9E1D0E32; Fri, 11 Oct 2024 17:31:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667878; cv=none; b=rprTVZ1HVyw1BXytP0y7SbpBf0NUE16Gh4LryPC2tizQC/3DJuyIuimoALUZhVDtAs5dOr54dY3usF/vQHXmmbvJvXF9Ge6ukm4Ex91HA373Z/obNA9MErVpFG16ALiSSYk+/lLhP7rTAppPsBpiqbhW/5+zkkCG46uDKu+Rd/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667878; c=relaxed/simple; bh=KTwHxJPGGmnTDDeEdfmp2pRlvoDQDpveiol86Up99rs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qi05PgFgIvpi1ykILlZGxCJwebtCxL9jIEx4U4K33xb+MrvSViyNoi4iugegaYGYFtAK4/wV/VRCNRxrg56nTlcqb3S2DDhT3VCu9Wi/vAY2+T0ualQWeE9ZMyiezlINZLpYMqT6Jz6yu2HxM2Kf6OwbbLNd5ox4ysTWKJ2Axik= 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=ezkrT62H; arc=none smtp.client-ip=209.85.128.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="ezkrT62H" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4311ac1994dso13741315e9.1; Fri, 11 Oct 2024 10:31:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667874; x=1729272674; 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=wY1XP8VNcmtboxIDcKmmWO6r1IAbBAFqyuHXxooTX1s=; b=ezkrT62H2UGCBT6WTc2QlNoD00wUrPTZluamLjRzSOVIBzvbfGSyxyu33heNX/nUxc VJLnfooGcQYSegtXhX7CIp1JsR5bRFPRoPEbNJeJVMj+XwSQ4q+cs0YeGFLzqykLkGK/ p/B5AIccgWmgJDx8DH7oQQMuaeW93R6Pz+4H1pzvihnwfq4w9TqMrPZsqq2jo3ifUx73 Pn5SSGRziIpbhk5AW5WTt6EKtR3OR0HmRbbJXNRHDbzZIsxsr2ujbRvdGl+Uqum7lbqF u/P+VxuHBgfWHmttuqH+umrCGIusj25YCr0xORBjnyMmE2Gnu1UIML46gjunJxyWpB+R XyLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667874; x=1729272674; 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=wY1XP8VNcmtboxIDcKmmWO6r1IAbBAFqyuHXxooTX1s=; b=Ouzqv3WMs/ZAr1ftlCVxxD6+EOzPOhENbwQQZqZghCutnBvijHooGN/EGzEq9Wotsi 1Tfv7NZFrzm/2dKN5nfsoh/Ka8kCszOKAYMCxf2FkbxqtCgnM/YSlXdkQqVbIt4EPyAJ EqfNbVZyF8CV6e42KShOzeu+xiyBoeXe97lEmThjJ+5PWFANQU6njPeeLOXKZNwo8FDs IgJt/UN6JbGVph1oDQZirZY5aF3qAg33YMpaAE8W1BPo2LYVa53jyK2g6usAD+WubINO fFyO9tYtPw+fQxlPvF0z8EjUPmtaA6ysbhuTH1Q7dmu2aFImNo4LprWLNhrXqqEGKIc4 7POg== X-Forwarded-Encrypted: i=1; AJvYcCX+K63XBydhbU9Vk6r5PZ5Bqz5D7z4yzbgmUWhaOhZTNUJeRR/6RTlucyhR9P2RTVvo8qaZZ6vhvjKACqc=@vger.kernel.org, AJvYcCXnZOKXslNtmS+1/CODeFOW54vAfgcG7YdW1jFsGmNYLTIh3Mn9Eh8cv4uImAgQCd1jkb48XbV6HbTXNOcIrMdGRDU=@vger.kernel.org X-Gm-Message-State: AOJu0YyT/TPLuGICgAGZ3McM/UYgkYWChq2vzfSF74aWnQRpgWeymzl5 LU2A0uKDRyhcAD9qYcOXUg74dxvQiUuMM5Wg6QuItWmYMs3pTM4v X-Google-Smtp-Source: AGHT+IHZIUDmlJuISyMwRFfGXogzGdVZAZYFVaboUPmKePD3F2fHpcxSmednmnS2jc53EjJg8QdkTA== X-Received: by 2002:a5d:63c2:0:b0:37d:52bc:72ed with SMTP id ffacd0b85a97d-37d551c9775mr2361535f8f.14.1728667874316; Fri, 11 Oct 2024 10:31:14 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:13 -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 13/22] media: rzg2l-cru: Simplify handling of supported formats Date: Fri, 11 Oct 2024 18:30:43 +0100 Message-ID: <20241011173052.1088341-14-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 handling of supported formats in the RZ/G2L CRU driver by moving the `rzg2l_cru_ip_format` struct to the common header for reuse across multiple files and adding `pixelformat` and `bpp` members to it. This change centralizes format handling, making it easier to manage and extend. New helper functions, `rzg2l_cru_ip_format_to_fmt()` and `rzg2l_cru_ip_index_to_fmt()`, are added to retrieve format information based on 4CC format and index, respectively. These helpers allow the removal of the now redundant `rzg2l_cru_format_from_pixel()` function. The new helpers are used in `rzg2l_cru_format_bytesperline()`, `rzg2l_cru_format_align()`, and `rzg2l_cru_enum_fmt_vid_cap()`, streamlining the handling of supported formats and improving code maintainability. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- .../platform/renesas/rzg2l-cru/rzg2l-cru.h | 6 ++++ .../platform/renesas/rzg2l-cru/rzg2l-ip.c | 22 +++++++++++++ .../platform/renesas/rzg2l-cru/rzg2l-video.c | 33 +++++-------------- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h index 9b1ba015df3b..327516272e53 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h @@ -66,10 +66,14 @@ struct rzg2l_cru_ip { * struct rzg2l_cru_ip_format - CRU IP format * @code: Media bus code * @datatype: MIPI CSI2 data type + * @format: 4CC format identifier (V4L2_PIX_FMT_*) + * @bpp: bytes per pixel */ struct rzg2l_cru_ip_format { u32 code; u32 datatype; + u32 format; + u8 bpp; }; /** @@ -161,5 +165,7 @@ 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 8f9683bf31fa..a40b0184b955 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -14,6 +14,8 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { { .code = MEDIA_BUS_FMT_UYVY8_1X16, .datatype = MIPI_CSI2_DT_YUV422_8B, + .format = V4L2_PIX_FMT_UYVY, + .bpp = 2, }, }; @@ -28,6 +30,26 @@ const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned int code) 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 6a4f0455dc9c..a0fa4542ac43 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -812,37 +812,19 @@ 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; + const struct rzg2l_cru_ip_format *fmt; - fmt = rzg2l_cru_format_from_pixel(pix->pixelformat); + fmt = rzg2l_cru_ip_format_to_fmt(pix->pixelformat); - return pix->width * fmt->bpp[0]; + return pix->width * fmt->bpp; } 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) { @@ -934,10 +916,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 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: 13832840 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:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13832841 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.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 4EDEE1D0E30; Fri, 11 Oct 2024 17:31:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667880; cv=none; b=AqXJpJqMZNhLFt36lXWCnmTGbYJc5J2jrGx1y4idy7ywTs+ELbyS9OriZcOeaENcCy67C5hzfaIZ/F+TD9/0e6fR4OzRaQSCP9sf2oOxgc499/FSXZO7X92FO3EHNuE+jp9S7j7YmQR00ilAJ0EhBFIALlBRrEeZpPimSyFMBxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667880; c=relaxed/simple; bh=XhamZKYuM0y79EZK77oBjUQjUsabnbMGOLSH3i3PDAc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M058qqqml9ESalJRry0CaG3LdsNHwHDMILcdNuHvpGTVZxQQIBegohkxOUZlgsVideSxWjfvHzwYS5x8JgVXHQEu59xVc9oCqotB/0KNLmSStjpDLsy9+9Qx+EHMpvf1piLniKjOAAsp/IFbyhupfTJG1uBokRO1+Cwd0zzrFKg= 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=V4JohYb/; arc=none smtp.client-ip=209.85.221.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="V4JohYb/" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-37d49ffaba6so1319095f8f.0; Fri, 11 Oct 2024 10:31:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667876; x=1729272676; 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=xVOFkLkwo1V9dWZHHxyVDhi2i35wgRZJzR7V957XBq8=; b=V4JohYb/N7AnzVVaAhkjUu0qaFun4mAAlpEl20+1af+dIGJICKSgLDmkfXtqUG+wGw KwvelbR35R/kTog5m8ywC021lsv3U+zoySmRxZD4aoTvE9pq5/RmlsziP/fF4lwtZTaA P+QLcNWcIzwJ9KglN2Q3LsTY79+u/JPzXvFaFf9qKIniE9wvUWD00NIaI4Ll9p/IjyMC rZlvuYBMsw+9ceNoSwx+dUSe4t1hdaHYsc7V+3etu5+F7lQ04MKWrGCVu8W3r4BFfYOo FXPD1aHzIwLuYjPC7ajuTpFnu6wjmC0LWIhFVrRQmgdBhGVBYLjXC08PERbSRchoDVnP r1HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667876; x=1729272676; 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=xVOFkLkwo1V9dWZHHxyVDhi2i35wgRZJzR7V957XBq8=; b=qrV9tXsfKc84iuOEzP6AZAjsMwmJ9C/CzRi+AzRzjkAlEhO0tPWRTatXUCVxT8texo SI0kGzPdFpzguqjWaL3SR04doANqU2yYk5xCozj62ggAxWW3ZRY0uIPseLAmkiX8JxiZ 7VVlsKm3/nmFsI+Yl1FzI0cuxHFzw4IWyI+dtYQNw8v98L7Bhr+fM2t3RFLNx94TiC07 GvDyQbaWJSAb+9VVEPDhUsGME5q85QtudyujrkmKogAaQruHGgLaWuh9Ijlo7K5E7GO1 IhFHH42BBXrO04ZHm5X3jl9vpDgxORlCYJr93bh5pTFY7JUS5DrDGOvgFD0Fp6V/krSA 5KZg== X-Forwarded-Encrypted: i=1; AJvYcCULoJJs7RcvtO7eRqnumqzb1EX7tNAcLZWMD2drIGhkoZ3Rw3MB+kGjg7LNLX6MyrvV00KbjPop2YtFtf8=@vger.kernel.org, AJvYcCVbyzrwb/jiIkjXj7k5S1nckfpqI36wqmTiMNA+1zkjiKQyaF0dfK6BMUlxnHoFvCWFMhI/OxFtemCWc+bLxi7UBgs=@vger.kernel.org X-Gm-Message-State: AOJu0YzxYfe3RMITV773LJqbULXpfuFhnIqjiQ7HXfzhlrNN6SvWqTZK Bx4q1hbVFeSqhR/hkLypF62rpNv9l0xIIdbM2XvVpqBc+UlnZELI4K2BDA== X-Google-Smtp-Source: AGHT+IEtOoR0J9DrRo7UrsG35o5aKXvbr3xxAE1cUtHAgDqNSZtKtMtbq8pz/a4ZNgvpZAbZiamH/Q== X-Received: by 2002:a05:6000:128d:b0:37d:4332:e91d with SMTP id ffacd0b85a97d-37d5529f8f0mr2597260f8f.52.1728667876439; Fri, 11 Oct 2024 10:31:16 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:15 -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 15/22] media: rzg2l-cru: Make use of v4l2_format_info() helpers Date: Fri, 11 Oct 2024 18:30:45 +0100 Message-ID: <20241011173052.1088341-16-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 Make use of v4l2_format_info() helpers to determine the input and output formats. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- .../platform/renesas/rzg2l-cru/rzg2l-video.c | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index 8932fab7c656..0cc69a7440bf 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -300,21 +300,12 @@ 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, +static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru, const struct rzg2l_cru_ip_format *ip_fmt, u8 csi_vc) { u32 icnmc = ICnMC_INF(ip_fmt->datatype); - switch (ip_fmt->code) { - case MEDIA_BUS_FMT_UYVY8_1X16: - *input_is_yuv = true; - break; - default: - *input_is_yuv = false; - break; - } - icnmc |= (rzg2l_cru_read(cru, ICnMC) & ~ICnMC_INF_MASK); /* Set virtual channel CSI2 */ @@ -327,19 +318,17 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru, struct v4l2_mbus_framefmt *ip_sd_fmt, u8 csi_vc) { + const struct v4l2_format_info *src_finfo, *dst_finfo; const struct rzg2l_cru_ip_format *cru_ip_fmt; - bool output_is_yuv = false; - bool input_is_yuv = false; u32 icndmr; cru_ip_fmt = rzg2l_cru_ip_code_to_fmt(ip_sd_fmt->code); - rzg2l_cru_csi2_setup(cru, &input_is_yuv, cru_ip_fmt, csi_vc); + 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; - output_is_yuv = true; break; default: dev_err(cru->dev, "Invalid pixelformat (0x%x)\n", @@ -347,8 +336,11 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru, return -EINVAL; } + src_finfo = v4l2_format_info(cru_ip_fmt->format); + dst_finfo = v4l2_format_info(cru->format.pixelformat); + /* 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 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: 13832842 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:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13832843 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.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 A72A81CEADB; Fri, 11 Oct 2024 17:31:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667882; cv=none; b=M+vRliGEK2F/oaqJMktWLdI1VP6ML/US1mWGnaL8JW0ENc8xmRxgtyN2IKv2xwZ2NgoiOmrUGDzz/tWqof8ljM3pfEjJftPBGA2dWMzBiAUjy8w6rjYiVhDIMZBsnBAveZy2CesphhYXu4b73sRtcG+VsZkV8cqI1NszWbXWEng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667882; c=relaxed/simple; bh=BK/nuBnleo0GMpERs+3xSBfnWAQP2PkPNF09ALoxB68=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n49LZPPbQZxj6r3mBB7XhGPC3mG+dtoC5iU4rcUSxFLi2sEuB918ilWieNFRGbU+khkI+2RNMc7THIZYgtNghpF9C72Idbmgfliv514rCQSOLNd2viulxyo5njkoKc18MwUQhinzt1z0c/fgQd3mR2ygZ42edpWjH1qgYIiIzLo= 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=FRxypKt7; arc=none smtp.client-ip=209.85.128.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="FRxypKt7" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-43124d1ca5dso1684085e9.2; Fri, 11 Oct 2024 10:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667879; x=1729272679; 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=FRxypKt7Nhl318gQHOLySInhnMM1q8Ps2Bo/nSGHQsNpBYcAAgqJezDMcDAyqSEclW 46CGae1KCYjyaUgNFJkhuUmrQvwLdXTAbjgDnUlPCmjRmjzEn2kPT7otvNT4OeD8/Nyy EZIa+yOIsOotENR3A5kw1+/k3wm9NtI36c7u9liNy4zxyCyy+yH9b5Nro7W6tkAmMupE Mu3B4UNtbckQzMWjDg8xYsnAxVfF8d92G2cergCnCA/SFAynFa6QLoXfDhlpfRT/KKMU unp8BHdguDBLbLo5lg5mMlREnantnW0yyGUL00KljnPv9bIgx7DHULzDVz37MQjgUptc RfyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667879; x=1729272679; 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=dfdrXsc08EMKdQM3AmIECNSKYhmxf50Ko3vOPBSjZlgGk5wOG+TR45X78VCBhI3q1y 7LOHTvBRb+JL3R2a1Dz9jMDUTAUlHFlgqzSDIGSwW2V8JbIs3QXAXz3X17oGSP+0j6ve iag1XYbqD9C1bQCdM9Cd7k0zTES2IKxPNOiKEXFefSieHS6I5Syjt8gm4yzctNKeDwlT BI2er5l+mhpB3/sTrh3ei8LfVvTdl419mjeupARJ3Q9V8/u3iOPQPbNrKcDUvdWzMySU 4Sl0qwyiO7XevYgroFJ8yJnu9J2olU28Zx01kGWRUMiYl6f6O1BIOsS9WhjN5Wsn82M1 wblg== X-Forwarded-Encrypted: i=1; AJvYcCUdDPdJSw4oeysI9NjeF19+oMChs3U6VAYiwhW+mRSVKcVwbR6OvM9vJR0Hv2fqyQtT+CJNKEXSb/+as9Q=@vger.kernel.org, AJvYcCW43FWsbEBL8AeaHeDzy+Wr2igNd9nItNFLzM+t0Yfrwl5EDeCLar004Gxybzj8yD6d0nRz4MYgFezjOUdelizbyyU=@vger.kernel.org X-Gm-Message-State: AOJu0YyASM2gLWemKD0IHCVT9SGCPwmsTFzvZQc0pnMyyZmiO/e7u73J Y4FwVPksmPdqUzqT6ch75032Ag06Ezn2fqHkrtbRc8GxnlAn7ARH X-Google-Smtp-Source: AGHT+IHd35DSkqn8duao5nIDoMIRLMCn08cedsZH9XRpY+AFgCSQgSvYf3chxiVM+LTFM7TKznFwDQ== X-Received: by 2002:adf:f64f:0:b0:37d:49cc:cadc with SMTP id ffacd0b85a97d-37d551fc4e0mr2168785f8f.32.1728667878663; Fri, 11 Oct 2024 10:31:18 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:18 -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 17/22] media: rzg2l-cru: csi2: Remove unused field from rzg2l_csi2_format Date: Fri, 11 Oct 2024 18:30:47 +0100 Message-ID: <20241011173052.1088341-18-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 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 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: 13832844 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:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13832845 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 B54061D1E77; Fri, 11 Oct 2024 17:31:22 +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=1728667884; cv=none; b=OTlN3HY/nwQ5NUEsjjCN1UxgDqwChCA4q3m4KNlnF11hamrDkRKhrcr2GZNKGTjNAMShdqBNuTsseaG6RKAi2TASv04pMMcFu7t79eWWqGIRYcSEaaqp6+xXOIBeP8PNTfKR652OHnGDxYvZhjtA0JhDjpX9K9376ct4OvwpUXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667884; c=relaxed/simple; bh=RsSdZNrx3Rc7LnOARDgr5Ae2+j/EXAx9YIy2cRRGl+I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rTYzL/rnLkhjcJ+mqEJd6UJtOTeChZ1fXhYUIhHaiAglA9FbaX/3+bQQ//89GoLPZ8YN7Wj5AZKtbZEko6qngVC1YdbBGrk8a9aMrZZIEPxN2tWojIXGV01Aw0RXF4sPRHEb2kk0MUMTeMnEj+zZQnOks3EqLjflQwkITEEcelQ= 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=UxQUoivI; 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="UxQUoivI" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-37d47eff9acso1234484f8f.3; Fri, 11 Oct 2024 10:31:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667881; x=1729272681; 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=UxQUoivIzObX3XJloWM+C7x3Xse3x/7JetxLnZxDWpqkiupFiDL3ujjPiDLYahIoko rZUddcySMzAb7ltaRiq2lVxicHHAxHTWy/mS3582b3MElb7jyZcWuIJFcX3XW9sk1RbL LteYe0kqhmEkISI20S/FNx962vvorbZdrtWTcrxsQiPP86PlkCxCBbvDQ+LRR0/po7m/ 6LyOtSZGsQSuOoZy3Q6Fzr/DqQDDbEvNB8iF17XLzocsxCxfAusADdEKGJVZtAepkq6l cXuRcXydolmGPn6j5T+exxEpq/j2LGcINSXK0D96nwGMKsnhHnTkgVn5hD3Z6ual6Pb/ 0HqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667881; x=1729272681; 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=kCP+Onn9e6iwsGPk87E3BI7i8rVXnCFJUn1XSSYkDmD9pRNXjQ0ffbHFgF3hdMFzBx 2OwxsaynP+6O167umDoqmqD28iyQwvWSr1hzZ2t7wZV16k6AcDK0LifBsTHcSZNsg7PP dhJecPCWufV6HXvbbn1lhsma6abDurH0au/z6VTh+gpDFIIObRwXi04RxJ8lPTzFfVkJ 39qsA33wwjziQwSfv3o59mtH4cfsPPgUuKIQ5VqT9xQORoOSSPboFuRjS/z4CKyeIHkx 3vLOipooR2JwacMBnUV943mX6qCCpk9+w8ozpS08MxLI31aWNQrTSCoQer7Txin81wn3 oRpA== X-Forwarded-Encrypted: i=1; AJvYcCU8f+hwgP1RCQlEzkV+eS8ohS9enbZdLld6x1lJ1oEk/puB7g7V3cYMsxz5WsXG6ebcns40vumLXgh3QKA=@vger.kernel.org, AJvYcCVyLjEYa+4boUkzSyZ5xMIWMwns6M6GWaQOq8b5MVFHLodaFJgevqqKBkVSMVhAFxvueStvDhgjtNYM7zpFjlcyVlc=@vger.kernel.org X-Gm-Message-State: AOJu0YyN/ryk+JrtuIIPhOQWtOOX/fR2FgH2QYh1LCAoOQAmNzvbzIiU +HxYjjaWvofUkZxntxRuDS3YpjGV4YwmcaFUA8TKxuZrtTjaOid6 X-Google-Smtp-Source: AGHT+IE/+YdT1TgsNx+098QeAWYkq+c6emdAovRZ1H2XxXlWCApndzkDj6NW3VWT+bUw6H7E6gLDlQ== X-Received: by 2002:adf:f70c:0:b0:37c:c842:a16e with SMTP id ffacd0b85a97d-37d5fe96419mr304694f8f.5.1728667881003; Fri, 11 Oct 2024 10:31:21 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:20 -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 19/22] media: rzg2l-cru: csi2: Use rzg2l_csi2_formats array in enum_frame_size Date: Fri, 11 Oct 2024 18:30:49 +0100 Message-ID: <20241011173052.1088341-20-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 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 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: 13832846 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:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 13832847 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.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 12C8B1D31AE; Fri, 11 Oct 2024 17:31:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667886; cv=none; b=NBcuQswQpn44MuLDCbvcThiPwlLwE6128xFld8FK6khPH35It4vciBQRWNy1EE0oy+IN5qQFlZ5C9+xK9GBvxwLga4/KIJsaJCK7iDuE2oNODN5zKy72lHwMhQ3u3ixAHnlRlaYU5497ftrui5owi1sYdQA13uzUTSaODau6B3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728667886; c=relaxed/simple; bh=psuz1kH6lKHsMHp2QzwSzak8zSEeU2tE4jLe2BRBj7I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b1iNY2Iy9OTngDckkkbUpxeHZ608PTvHtje14YCiR+RamzutMo0ZAVcG6mgGFxjPrIwLdNK4HYcpvWvFdOCokTw/Xuo/cNFEKxPd+CtlI4buSwvOEX4Flb2tLbb7f/59T4UGRJp6j77j9HXlXZjQg3o03neT8J95vKulLHpldlM= 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=cB8rEvX7; arc=none smtp.client-ip=209.85.128.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="cB8rEvX7" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-42f6bec84b5so20598455e9.1; Fri, 11 Oct 2024 10:31:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728667883; x=1729272683; 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=bsds6gEZXaV158PTz4H31/UuEAFL6ixFyip3+gMCH3A=; b=cB8rEvX7e2uc17yYP5oucd3mkMQkOVB4idxzLd84ESlBlBYXMtgZOxroL4z4cuM1yr /E7OHIM3hw83HuIppQKUv81HzgW0PGawUEd1i7fxH+PPUzuCP3PkOiKHxiEiKh1Fhtk+ xtclxbhnGcPqZUAVQcXfzhL83r+csb9DSv02qoR/WjE2exE488aTjgZXUhyOVtID7s25 mmpvsf56NHR4fJsh1ITRHRvFJc2UeZBXye4IIp4GS8uKPZ2XytoUKKccayCw1jF97H9f NscTGNbx2zlLjCFDwr5ANHh8t6GFOmvPbNmGNfrlmzc16l1k7hMVZTelKXDGwMurz1DI /iXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667883; x=1729272683; 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=bsds6gEZXaV158PTz4H31/UuEAFL6ixFyip3+gMCH3A=; b=k1/8PU4Aa/PMEorH0iJShXmkIRGOFzBKBejHAVcUSyflXsITZRLy1cppe+awID3twV pH+hGKPUvnK4l3F3L7l3zC/6JDkSA3uuSdJBwaHpAE5stByc4REAw/tdTMomTAX5G+LU qBQjcAH4FbkMZPQrZlujx/1KduUc/LnRjOzsbxv+dZ/bceGGpIpHzNOwqlglWaC0UKjG jAlsXJG4/UBNZ3f7jHnbBxqejTVrmq8ZoZlQ96jHoWoQvQRUeh1VWBaBOzzcuH5Z/qUh RHohvsYHWbqdDjThnO42e+2p54oQM228hL5XuRp91vPFfNtnln4jewe4p10i6clNfvDj HE3Q== X-Forwarded-Encrypted: i=1; AJvYcCW3B9YNTgbxClpDDZATIqOdXZV/ZHOUMtUFWurrZb+OSfuzZTSmwkq6tabqxpyUfHwcHFobB6kSvQrcXfV4b2/+R6s=@vger.kernel.org, AJvYcCWLsYxqfFLjjclUIlzFsw3H39XVqsYpBhQJzFboAYaRbkXoNlkevqmIiiFv6fi2W4pxZztaDDD8vwYxhnI=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1B3meKBuVuEDa+LHw39EGlZ05h3RPC3o1RCcrl/U99lvAK1lE Thdg0EmoJNNcyAQJpqWtX36jk+WwQ0opzjXkWNK2re5Vx5WdlR9c X-Google-Smtp-Source: AGHT+IF+0dDYlKXLHb/smlPMuGAdsbf24PYgvdGvqEMWDvD7C5QY8iw9ApNZrIOL+1ml2XtaxQXFlw== X-Received: by 2002:adf:f449:0:b0:37d:2db5:b50c with SMTP id ffacd0b85a97d-37d5518e16emr2165704f8f.8.1728667883230; Fri, 11 Oct 2024 10:31:23 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:31:22 -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 21/22] media: rzg2l-cru: Add support to capture 8bit raw sRGB Date: Fri, 11 Oct 2024 18:30:51 +0100 Message-ID: <20241011173052.1088341-22-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 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 ad470de440ad..982c996cc777 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -18,6 +18,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 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: 13832848 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