From patchwork Fri Oct 18 13:34:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841783 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41C8120E335; Fri, 18 Oct 2024 13:34:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258499; cv=none; b=aLd3E95yoWDsck4rrY/STKo8ex7IDMeek7SRf5NSaEDaD4Xn6y/dUVSkHOFClYyMTcvb+b/pxEGMQ3WWRZDkUxE3FbcFnO+YQ3euFMmSLbzgWqhn5dbehuofrRk4R+vLACmYQ881PXKKN3KIk9F/pxe5tC57NTBraV2SK4M3t+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258499; c=relaxed/simple; bh=i1qXdEBpnGriWoad2OUw0LjWiot65g8XR1zyIQJI1lo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RiKlOJiXsyyTTzLDhMjEOLUIUyGiDlm4Fqc+SUT4sEIXOGWOkfXtQmoA8aVlY8jNc+fu6/2+J2RHP2cievBtx3+kal0L5AneZ3wgfd5y5xlaqJylob2YKv/MsSkAjb8Sz0/R0WSKV5ycr3+5YXYm1q6cFCbVbW/us+4DoJZX4M0= 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=jHM+w2pT; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jHM+w2pT" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4305413aec9so22375465e9.2; Fri, 18 Oct 2024 06:34:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258495; x=1729863295; 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=jHM+w2pT+6Za19QPn1VQRomlBLuUgvCWDrbRaxFF9jasjSP7N2gApuJZfv/4aD027E iKEahGglsLlcFUYM/Rmn+vIOpAFsHa8zRI8b1JEvgjsIBDvHSsqjUFotRI4oUTB+TBgE DDG4gXMw76p1k+kb3VPW+oyLdwvfNqJF+FFQR6mq2WTSSY6mZYYb05nkVCJH1E4W+5uq rh+eqWAibH5PqdFI3HdjvQUy6mm2rqnDQO56Tz55XcXPvhlTL2HGMPsDuPeraHViYzJp gpCTXVPLyIf/0WxoNayuGvRtYwIEPhxMIHvLG0tDoIQSK7gcUwfJWyUZK8CwgL6C2ZYS drzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258495; x=1729863295; 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=kIbY1HfCFCVpRl4OOd6hRg3U9y9QhetaRtUXlhhQ27aKGV8MV/qrH3vBrgs5cSZPCW j3bZ/o6b1N+v1KgD9aLSnisqA5czvGYY+Bk0qOcbsB5+v1mnsQVZHdR3DLq3DYTA835J 6TtI0HMd2J5tL6pUMrG6RQBcm75NbGvplaH4E18qbuO33QvYK+DMfn+HxlcqsJWnCKKp i8Gx1TwBjKb3R8mpzMdBfObNOeTye0w8h9p+5ifTCJvSp2Db5y1iVrVJfB7qCfTQsiMQ 0X/m2ea4pbo41kJImeeRJtj66I7K0Un4vtQRIRdsSPRJEitVIhyx+K8mYJkx/4bxzX2I IXXg== X-Forwarded-Encrypted: i=1; AJvYcCWDasxbYbV2109iabX3QmRbd/6Je+MIT305pieqWO4d6/tTtwripq9njczNm8LslvtQ3vu7+ok9p/wKAOMOcU3EUsM=@vger.kernel.org, AJvYcCWUKZt4QBbXmeraba3G419EMUSBmY3ZIFPpHf3D5g//j4mADW8+DSMquVP1UakqButQuv/lN2gONvRw/lQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwTTjsBKTDZmWiieMu7ApuG2Y36kNwQAKEaG1xXn/nnHsbMxL1g mNId1ZizMCJ6TNUwl6/CyaHhDsw0LAIxD5pMnQKdq2QePNj+Fp2w X-Google-Smtp-Source: AGHT+IHjSsgEADNXaUxNCZucoVIj7XfIEjiEfu2sboM3jkNnUSOwechkc9T7VJUr6Bkvtbn/6ss5cg== X-Received: by 2002:adf:f141:0:b0:37d:4ebe:1647 with SMTP id ffacd0b85a97d-37eb488c4d7mr1754020f8f.49.1729258495181; Fri, 18 Oct 2024 06:34:55 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:34:54 -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 v6 01/23] media: rzg2l-cru: Use RZG2L_CRU_IP_SINK/SOURCE enum entries Date: Fri, 18 Oct 2024 14:34:24 +0100 Message-ID: <20241018133446.223516-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Use enum values (`RZG2L_CRU_IP_SINK` and `RZG2L_CRU_IP_SOURCE`) instead of hardcoded array indices. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index ac8ebae4ed07..9f0ea1de50da 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -217,8 +217,8 @@ int rzg2l_cru_ip_subdev_register(struct rzg2l_cru_dev *cru) ip->subdev.entity.function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER; ip->subdev.entity.ops = &rzg2l_cru_ip_entity_ops; - ip->pads[0].flags = MEDIA_PAD_FL_SINK; - ip->pads[1].flags = MEDIA_PAD_FL_SOURCE; + ip->pads[RZG2L_CRU_IP_SINK].flags = MEDIA_PAD_FL_SINK; + ip->pads[RZG2L_CRU_IP_SOURCE].flags = MEDIA_PAD_FL_SOURCE; ret = media_entity_pads_init(&ip->subdev.entity, 2, ip->pads); if (ret) From patchwork Fri Oct 18 13:34:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841784 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2764CB667; Fri, 18 Oct 2024 13:34:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258500; cv=none; b=omrhpIWaNpO3+dPLtii7rTVAJPmoumz9KglmMO4dj6CTv+e80UiPe4uG8Y15uuMPQC+29VtAeihc2tur2QaB1hKvab91XJRbDUUOGdlwdNgNCRMzd99RgSVKoV0rYRkk00+tvQV0AOv6riqJQn8KCDRgMHQIAMbyn5ajAJGCaSY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258500; c=relaxed/simple; bh=uZKPksgqQXYAFjaVTG5r+mbOST1Bvbh7s/7CGAT/xgM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dSgEblH2bCyMFurZaPbIhYbIiHdjpZe0q5ty0KfdZmtvqA3ONQQVAh/t8IUAZyVssxEpLOReopmhtT2qIndrH79TY0vxQe0sW1oFyQwr/kTgGT2+SQLKp9YEYuHOzwCh3yeEAbi/BpBrE/ScQlXmSkNni7KFabo4n35BoOGsRaY= 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=Vd0L8bLJ; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Vd0L8bLJ" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4314b316495so20194385e9.2; Fri, 18 Oct 2024 06:34:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258496; x=1729863296; 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=/5z7tndQL48sGbzY5YWFWfX5NjQnoyKt2xoxkttaM88=; b=Vd0L8bLJr6N/E5DrIbug/ijR4+W34b0GpAW0Sv9eZkwSwz2BIB/UtTxLDujp5aQ5To vlDbv4ocbBrPYKptjnxHVE+pb/lXkD25mU2IlvPj/Cgghqmn/uCPiy/j8UYypEuAum+I wkaBqrzoXn0pPqmiVTKrSPhJ7FAI/bDPYdko2Bc9kU6TWIBab0orqojPUICv7mM7RZIT RUIeWU24jotuUH7dHF4xF51855m6iP13Wr7o2xzCIAa+BWLdk5nOAagwO60K7zXLLt9b knym3esILD0KtfnzQA8KfELj3nhDnW6CVU3OTC+oZKlUPBU8/hmlTmdGBC8BptVlrx1k Ky0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258496; x=1729863296; 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=/5z7tndQL48sGbzY5YWFWfX5NjQnoyKt2xoxkttaM88=; b=M/MJh8ysjALyEUOso/BgO4vTGmPKppRcSYgIabmB6PF1/eLh3onURaAFEfhbOdadjs q9XYBpeIX3u/9rOE1s8UgDZUF2G38hv5hvtijMBNiiICloNZgKwPHtMXpN5w9xLvd3/A aYlOjxu5qFxujksst+ijHYCJjISDXjuI+joKFl4si4Wm6QYfrp2lc2nLv6PE8k/DJ6co JIbmUlEURSwlYakeoyADFKZxWDl5l9Zk77oyJTmv/+OFiMQonaVqha9hNXjopsz9gsEO uGkcFvEuEai6VDZPhi5hp9Pp5o+/7qvSjZy2iKuvTiGnWTEO5VC9SnjO38HD0pVNmyNK fC6A== X-Forwarded-Encrypted: i=1; AJvYcCX6xEkzDsWilBW9eN48PfU9QDf2zqaGEpfI5a3HztACsk+Cpu00K+LSqQnUUbGKExLuCgNBEF336Ir23sthIOLFzng=@vger.kernel.org, AJvYcCXHCZ0EY6yJdu90NvHN+g7WdzWe/qoUuhn1cj4QsA8U2jaY5+ez9VG+14RVFushJe1R6O0FvFu5NFceJnA=@vger.kernel.org X-Gm-Message-State: AOJu0YwcWVa8Akay+v3fNrmmBH0mhHvs2lh5QeXiRe9bq/fGG98LHBd7 Xw/yhCcie0bbSlKI0YsCWd0I3BTQum3Nu54bIl39k3tlM/7W3Yit X-Google-Smtp-Source: AGHT+IH+ZLOMtoyMBavV9A9nkk+JTlxm2FuxLo+xp3VEJfnGhkXi7nWX0yUuNuTKXxPUrAEHenhZyA== X-Received: by 2002:a5d:58f6:0:b0:37d:2e78:8875 with SMTP id ffacd0b85a97d-37eab731ac2mr1677278f8f.56.1729258496039; Fri, 18 Oct 2024 06:34:56 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.34.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:34:55 -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 v6 02/23] media: rzg2l-cru: Mark sink and source pad with MUST_CONNECT flag Date: Fri, 18 Oct 2024 14:34:25 +0100 Message-ID: <20241018133446.223516-3-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Mark the sink and source pad with the MEDIA_PAD_FL_MUST_CONNECT flag to ensure pipeline validation fails if it is not connected. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c | 2 +- drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c index 922aa2c58d46..43da91c4fdc3 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 18 13:34:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841785 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.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 1EB2B1D7E57; Fri, 18 Oct 2024 13:34:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258501; cv=none; b=Cdohc7wlXOEle862Jcg35tRqvq7Qkr0yiYIVFJrOxpaIh1pUkEnw8PdftV5CXtpnKBmO4O5R2G5oKFH3d+2d4x3JHCgNe+XZuamhQfbw3+7V225Ql52DTSfPbC6HcPQ/aslATb2T0FtNt5ICr0UdYYQ+ez5ZVQ/lT27K0zb7X5U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258501; c=relaxed/simple; bh=XrZ0Y9voLBD//Xb3HNxBf04kB84TJPdYukCdenkpZ7Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G2eWblq7CeFNrPPHXLyzvuUd4Ixr6WnZ+6uuDfq1zO7v36Mhsbf4E+CZfs8fs3bn1GaRU5ghyHfvwfWLBhurRxYHWONtuFw7ml83/TjldKrZLDwtSNroWskYr70ybtFdPBmMATcW7wteXmPWINDigGs3zi57jfzq3uFuauYwZUI= 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=laohAVbp; arc=none smtp.client-ip=209.85.128.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="laohAVbp" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4311c285bc9so20983435e9.3; Fri, 18 Oct 2024 06:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258497; x=1729863297; 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=HkacEOlSZqELBxa5jdq8M4LStax1MjtHMjdYa4KcK14=; b=laohAVbpbNxHsid2z2TYwci3qbrNn747hIRipgN7AxgyWWP4nsqAyNkQTKwSfFBq0I XthsBSj08NdZJuWPldLuyWAhl50EiimBG0hsXh90GcCyIcJYWP0ZyVhynGZGBaV6RXpn onFiTYI0Mcy9LZqPKv2+9xEaEgFjUMnK89ax2/UwBevkUuUX/3yokQB/bJMTtIRE+jea GzbQ8YIwjujnlB9M9VbKZxz2n65xAGk7/38H62XEwoXAwrxH9mgtdE1ha7kBLaI4J52C Kl6UH7uiK/oOTRc9L9xDAA+KxPnWAlJuf1XTQ/nOPFKnQWy2PdH+5e575MIrOwg7xfmc sc/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258497; x=1729863297; 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=HkacEOlSZqELBxa5jdq8M4LStax1MjtHMjdYa4KcK14=; b=RkkLhbUihAlvffX64c+fY1cRHyZ+OnVljtZ6tW7h5+lEw8fzWQCO0USk+Bcpb0RH6C zw/pAkBfm99irwBSEiLwDd/kbTryJtgmocY8xQtjVzHVaBoU9qmIheeeqPRqop7ItUIb LcnUW0x1zRDhQht8WXMxkoPMvS/qmvX7MB8c9YQ3gEST0ohSq6bF2CcVKqBF18zEO8uX a6mIsR4iio8Ds6A8f3k0dcMK8Ov0eSFtO5BaBGr55C28GaQiQcqeDXb9Ttn10EKzH4de KoQA16XLAyyp6NLpvQd2d2y3EwQkWcaaLM5rtUGkdDRX7cZFsoHwauQgT3e50/DcQqrh OwxQ== X-Forwarded-Encrypted: i=1; AJvYcCVSOpqSOtbtjEiAfgx2ZD/cMTUy/hzMzRoWf4d4eW9dxS7x/lSpQd9YZNw1uMLufI6kkoUpJrbb7uHADv6T5F3Gl4w=@vger.kernel.org, AJvYcCW7YeQ03gME51BFTUn1FRYRwxruVrJAbbo1iJWZ8ov+obkIIKjhFtwnAd5BpUJxmZ1KH13s8yOa4wwZtjc=@vger.kernel.org X-Gm-Message-State: AOJu0YyTq1f6EVE3Cctziw6+MWeKn2Pg3I6EIk/XdI2B4DZeNgzWd18u whIhWgYu4mzfW3j8Pop517cg9QlEwbt+VrCBdri8rW/KeS4rkmzF X-Google-Smtp-Source: AGHT+IFb1Xc7jD8lTtB0gEzO7sa4Jfk7Hk8eKa1bZfr83WBKAU47jibQJZfAQeh/Z2ZCfWEA7Zjemg== X-Received: by 2002:a05:600c:1988:b0:431:59b2:f0d1 with SMTP id 5b1f17b1804b1-4316163614bmr16432895e9.4.1729258497197; Fri, 18 Oct 2024 06:34:57 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.34.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:34:56 -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 v6 03/23] media: rzg2l-cru: csi2: Mark sink and source pad with MUST_CONNECT flag Date: Fri, 18 Oct 2024 14:34:26 +0100 Message-ID: <20241018133446.223516-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Mark the sink and source pad with the MEDIA_PAD_FL_MUST_CONNECT flag to ensure pipeline validation fails if it is not connected. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c index e725982c4705..b6a118ce9fcb 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 18 13:34:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841786 X-Patchwork-Delegate: kieran@bingham.xyz 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 C272F1EE03E; Fri, 18 Oct 2024 13:35:00 +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=1729258502; cv=none; b=Tko1dMY6FxNMs2e+UsXEc+D96h3yQMW5esavarc1c8yIHz2EJLMNs4dxJuTsXu9PjeUN95c2uB9sXEoaEvJeyvs64pWSW02lkXIjjYb69mVW3rNYq1ZLnVy+WOxf1X2bAxLfLo6MmOIWyc+qtZIOTeKcv5DFtIxvDR5OElWsJBg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258502; c=relaxed/simple; bh=lUtC8a7sSCz47vyuJQTv4ILpvCflOBhL8IZ2N4GLEdQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sitKq9cMDTrpLPKYsoYQP6DQBYSV2CQyQMXkhPyOHFXNw7Sj51gUscSaghaaNVomTUicI6NlVyqhibJWWTenhmOPmR/wMD2bw6p7ylmdeC0IBbfZldA47ejOZoXjp2MnyrcWjQeW3YQ5NaKrS2ujpl7d14knGjso8wLc0ZuK4u8= 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=mlSm/rmb; 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="mlSm/rmb" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-37d461162b8so1426939f8f.1; Fri, 18 Oct 2024 06:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258499; x=1729863299; 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=cuoSfcit6bOI6/DSccbRpehmL54/bDzKmYQIekLBIqA=; b=mlSm/rmbTxXLOyxp7H/Yqo0KjSgsEPL/egvRgBh0Ztx15Q022fHCPoXcjfmr9q9FEU 4ak/N2ibpWucT9k8VD+qqhXKelkXBP14h08oeXV7oKm+LXpxlGpJ7eeOQkZF+bd3QPRY OUn06zjUQx3xqyBH0UGa13DLMWmQt38fBUvbvWOIB/zgV4+zg7EIVXyhpR+CLw0DULyb M8S1++o5jF7dx72lSYKaCrbPhp/TPRpk3xdGx/9FUa+opGukwe9nVILHVLrF5/11TCjE HUkZQnWJE/S2FqpcBkRhikOgcvozRP8fqpabHSWVtBPWKPPMytTbS1hM2yUSVeZlrAwC tsSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258499; x=1729863299; 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=cuoSfcit6bOI6/DSccbRpehmL54/bDzKmYQIekLBIqA=; b=KAaYap0FjIzdl2ZSSVmgncGWID1vJ+M8Md6ROsUm95cO6wYv8UJp/aAVOPaJfXTsry uWxBxM77ht98L8fypQyfJqfdJg8MuqnASjfnmrPWoKZps3SgKch0nCCmrr3aLnMiVtwD gAmGNhfTpZD3+n2EU72DPmUhZy9sWXpOc0Jk1uhxdeuRN6E6NXACCCEFcIKzxpoQh76s idiPif8Alo6bNQbeOgtM1drTLAK/LgjdV0f37l002NTY++0Ml+VrHf53mIbdEf5+VgVp T3oPNlhw4+BXcPVjcDCInPdras6DFj7Jay+EB+dFcWcC6crqM86QrqOPw4Fd2XbgHzoH HusA== X-Forwarded-Encrypted: i=1; AJvYcCVDRrzXBpSjHQ4WIIv5UOGsDwD6pbUn/imjT+THttV9e/7IeH6EVR5WAvnkFX6BaRpIJLaL8PnbnwjAKlY=@vger.kernel.org, AJvYcCVRkRXv+yo9vmGkAxr+ky5tLyn44+j01mAmSryso0jCwsoZefvPbwKBh6bHB59eCXyZ7CsGTxuoKbzRxzzC1Iws6xk=@vger.kernel.org X-Gm-Message-State: AOJu0YyzLMs4hJqXRDFNRleGnVM42lA4MRQZKMlGuAd28YwpDXdxMeXc wlVgTvrJfjc4VhMDo+ZqpHVGeucHNyJgWORkG7uA6k6+Nm8kY2tj X-Google-Smtp-Source: AGHT+IHiVmg+tWkHufGFE+lP4QBsah9YFdMN6VDB2TkrNb5bR76XT+1CO802BJo+eDoYIsXgqx/8MQ== X-Received: by 2002:adf:ed4f:0:b0:37d:32ba:ee76 with SMTP id ffacd0b85a97d-37eab72a15amr1407390f8f.57.1729258498675; Fri, 18 Oct 2024 06:34:58 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.34.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:34:57 -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 v6 04/23] media: rzg2l-cru: csi2: Use ARRAY_SIZE() in media_entity_pads_init() Date: Fri, 18 Oct 2024 14:34:27 +0100 Message-ID: <20241018133446.223516-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar The media_entity_pads_init() function was previously hardcoded to use a magic number for the number of pads. Replace the magic number with the ARRAY_SIZE() macro to determine the number of pads dynamically. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c index b6a118ce9fcb..5d1050e685c6 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 18 13:34:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841787 X-Patchwork-Delegate: kieran@bingham.xyz 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 0567C1FF5ED; Fri, 18 Oct 2024 13:35:02 +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=1729258505; cv=none; b=dnE8Okh+ZwBxG4rKUPhZtJBMdvPlBnZN2EMFJ+XP4xRl1EiAPksewBYYdAMB0T9hZ4AbRBcIhRtB/46U444zlSCHz9QhBl4GzaJVTx7nmViMGTd43QkekmbcUKqzD4ys2sU7sIYv4DaLhimsi6MZCENA586ABCd8SaTYvHCsnvw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258505; c=relaxed/simple; bh=fpUR1+qxDG2szYJO5YIaz2ZcwUG5msJngpgrZ86kV2E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dKLnDprF75BeW9zyjGWJd15ezpSWoKDQiafhyi6zc3SehgGvycUxHvrNicmtnWzZ3nznOFlnlcyIe1jOQOpqo5YlxaQqZJcGkvvFgJC8zLS0LC3AqP0jFPLtneFj6lH/lNceHpi+2VUeo8aQIBXAVkR4NSzlnWNjTW9hgR/UzaA= 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=N9Jlmd+0; 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="N9Jlmd+0" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-37d4821e6b4so1328327f8f.3; Fri, 18 Oct 2024 06:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258501; x=1729863301; 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=+fnKsxu/i1g3u97zLV6i+rixu2RvWCgAvgDPPXQlvvI=; b=N9Jlmd+0zrCUjy19KAe3xFukzOEbL2zkxnqN06QG685/wBewMasQjOkdW37RnVh/5y LIKXwDNQG3UN8B5/NIUCpr1bImnBjolK031csVK2kOQGou6VMjNGlse7PdK/gJAYFs9B QmcmHZmFg9Xwf7k0YpXS6hNDKqP+1oDyJMCcA8dPE66a4Jg2gnTczm8bfZZSyAQVnoNK 8vHFnuj9GgpE7S0CME+FjEi87TBum3gREPq9CbvbQ/4BfqRumjoOGKfMnM39BNvoNrzw /sWxbSGv/zFqLcs6wddD54W1/d0LPLbZi4N0ZDNkTlK4IXNQmMcKh/j6eX0Im2U1mIzq SIDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258501; x=1729863301; 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=+fnKsxu/i1g3u97zLV6i+rixu2RvWCgAvgDPPXQlvvI=; b=qnMU0L8GBpifTuM+Tl0yt+ZzN+z/G4aZz0hG+k7eJPak/hQJeAAup2DZnEqipavdj/ XfZkP2YOoyORCzB6zbf/Gr5UDgLfv9WM/0lsL3r0MBLkutSgaMguLm0mkIpBKPPEx6dA 2KQu/U+CjoX9yKmnqOlxGlUnwC3QjMbzqen2f3lquZRmAH3dqaReKvsEzhAikLI7zyWE Uw1aaNgxxHrq3W1pvn/pV3QpaxUU5coCf2CaAwTvv6f/IePTLyfBUb9iAPgPws9UXf3G ucptRubihb0tBVO0nXdwB1lsKxqWCbJ5ezv6uOEZUhdoy4ANWuNxe4CpUSzdxgiHzEJT buTw== X-Forwarded-Encrypted: i=1; AJvYcCUFdyo1kblJTmYcRME/x9QXcion6zzfmoTqg1WpqkuFJ9EIbbw4A0s82+HFDVlEohjkyJ31XEROrYoUDb9ZCJyb3FE=@vger.kernel.org, AJvYcCWEihKnpSJv6BXtW6XCvCjxAbsKGzOC4PJ+MuLIvCf1meGecb5UKqWu74JQqdhxp4GE3ALnfX6TsA4v0QE=@vger.kernel.org X-Gm-Message-State: AOJu0Ywuyjh/116AdpO1d7E3M2Vvvwd8wOthQ1K+F4UdVUc6JMLMLM+N FBrU7+PXWuC9EGuXsZzGMekkmgmXVLuC32iFBOnR9qCA4ddCs1OK X-Google-Smtp-Source: AGHT+IFwBQKHB4F9egtSahGfU5PwpGVo/0Fn2JHbC8ZrHS2AzSzBU/BJTwId8Dnkmyx/V55VRbvpXA== X-Received: by 2002:a5d:4d03:0:b0:37d:476d:2d58 with SMTP id ffacd0b85a97d-37eb47693bamr1710364f8f.45.1729258500312; Fri, 18 Oct 2024 06:35:00 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.34.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:34: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 , Laurent Pinchart Subject: [PATCH v6 05/23] media: rzg2l-cru: csi2: Implement .get_frame_desc() Date: Fri, 18 Oct 2024 14:34:28 +0100 Message-ID: <20241018133446.223516-6-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar The RZ/G2L CRU requires information about which VCx to process data from, among the four available VCs. To obtain this information, the .get_frame_desc() routine is implemented. This routine, in turn, calls .get_frame_desc() on the remote sensor connected to the CSI2 bridge. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- .../platform/renesas/rzg2l-cru/rzg2l-csi2.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c index 5d1050e685c6..dee8c1a749c7 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 18 13:34:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841788 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.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 AF7CC1FF61C; Fri, 18 Oct 2024 13:35:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258505; cv=none; b=uOclrvw8E86O+LEJ8W3hb7l9MycH52Ko6yjHtocxfsRA2vU3GkWZvoR7/ZVHU2z/h3guVENwpBezoalgjCxwM+Ig3la0LtEvU1UjYecByfRsScCC3I7QaEta8zXR5eHABbE1KlbLzM8FUXzpJwnEr4RFmluQUsZS3j4xFbYDKuc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258505; c=relaxed/simple; bh=riQB/ps7KNocNV/AUMqu2fP1J1RbHtnimUeTAOvwnFI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XTAErutNSl7rJx27rywEC4jgMT1cpntr6S4kruSgMiCvxvAOZIxdQHurYznDRicWqgU1jGnFtE+Qxdb3yYUc3oC0glWI5AgHaTFdB9Z719qOP/UWMh+J5jHlOlZicQIn2HciNcKR2aSucj/GXr7+XyBZl0E3Ev4BJJfrKup799E= 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=BbVyK/Zt; arc=none smtp.client-ip=209.85.128.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="BbVyK/Zt" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-43158625112so19957025e9.3; Fri, 18 Oct 2024 06:35:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258502; x=1729863302; 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=BbVyK/Zt0SmsCrvt324MvrqyIuoED88Xctn697wh9k/LLMPz54Fl74tZ/Jm56pDw1t 7vFg1F/LC8IdMvQClvb5jZWmVoLY+rpTGK2PbVp+BP3stIWW9/Nsgm1wphuwcR3o9iYo G+49kjuM0DkuYAH7Es4svFy48Anjw9kJQL3pFIGq+IQ4mW62ZK0HYDjCdvL98t2Te+ni H+N6pM+WNo0fOe9i4AfHuAuC5jpBr7zfx/HvOlAYIIEi2UoRHzg9E7kl1TuOsYOWPBLU G3dtJfDHJH5XP93ETjbW2YH+z1WcAEBA0942xmP475waFVAMILdEzOmtKal13w/ngDDs 7l5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258502; x=1729863302; 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=qVVztu70GY4WjCZvsblkUZJvY2RVfv1YmLcJTLdU5wYp/hkcpdiEX01/l1uc9GxJFJ kOKYQGfkALitbI0gVIDwM31o2ylaX+ZwvF3g+xp3maD1lYKEhn+YSkJN9HuoWb0uequw JCtrcQbHAPbojPmmlaoDqF2gO1bq7AtXPliS3eOZUHZwRYtzarMg5Adz1YleqqxV4X8w T9r/Zadb1FQ1fbAJZR5ONnQZP1fgzaRp2A6EUzwiPAGjxO/BDDn75ZiPTA3Y1MYjVspu qNb1HjYu2RSM9vXJy/YkeQ2sfpL8Qa4FjY9F7h7x5DTYl3IH2VMGhJ1Dq+sRbW1EXwTr qPVA== X-Forwarded-Encrypted: i=1; AJvYcCWlOtnIf7M4mRe87UsK9i27slqaKmLifchaga793WoPLCVSriq00MYxRNvPJGuBhikReUtgCq43r613TRD9hp+BxnY=@vger.kernel.org, AJvYcCXP5Gop5dj+h7kbFZ+t8rQvgn0KlV7Z87lHj3h72lYZprilVKOTn8wONViGSa+gQsL0tPzTKFIdd+rKHNs=@vger.kernel.org X-Gm-Message-State: AOJu0YywYvbETF2Wb09m2uj+qELLesbUllRk3xOMowo9KCO8e8Zu5YaQ OVof4IEhk8LzPGC1icTOW0j4VTC7qu+LpgLysBXJ9lmRFgRNWqzV X-Google-Smtp-Source: AGHT+IGCIJ7fQT8myaKnPfVnZXWnBmyVNgmFxZAzpjbDb/rq5PNK2MlO7MbGZgTWzylRT5WNQ4zy5g== X-Received: by 2002:a05:600c:1547:b0:431:5e3c:2ff0 with SMTP id 5b1f17b1804b1-4316163c947mr17076615e9.8.1729258501505; Fri, 18 Oct 2024 06:35:01 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 , Laurent Pinchart Subject: [PATCH v6 06/23] media: rzg2l-cru: Retrieve virtual channel information Date: Fri, 18 Oct 2024 14:34:29 +0100 Message-ID: <20241018133446.223516-7-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar The RZ/G2L CRU needs to configure the ICnMC.VCSEL bits to specify which virtual channel should be processed from the four available VCs. To retrieve this information from the connected subdevice, the .get_frame_desc() function is called. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- .../platform/renesas/rzg2l-cru/rzg2l-cru.h | 5 +++ .../platform/renesas/rzg2l-cru/rzg2l-ip.c | 5 --- .../platform/renesas/rzg2l-cru/rzg2l-video.c | 34 +++++++++++++++++++ 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h index 174760239548..8fbd45c43763 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h @@ -31,6 +31,11 @@ #define RZG2L_CRU_MIN_INPUT_HEIGHT 240 #define RZG2L_CRU_MAX_INPUT_HEIGHT 4095 +enum rzg2l_csi2_pads { + RZG2L_CRU_IP_SINK = 0, + RZG2L_CRU_IP_SOURCE, +}; + /** * enum rzg2l_cru_dma_state - DMA states * @RZG2L_CRU_DMA_STOPPED: No operation in progress diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index 700d8b704689..aee7d4ba70b0 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -18,11 +18,6 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { { .code = MEDIA_BUS_FMT_UYVY8_1X16, .datatype = 0x1e, .bpp = 16 }, }; -enum rzg2l_csi2_pads { - RZG2L_CRU_IP_SINK = 0, - RZG2L_CRU_IP_SOURCE, -}; - static const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned int code) { unsigned int i; diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index bbf4674f888d..7cd33eb1939c 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -433,12 +433,46 @@ void rzg2l_cru_stop_image_processing(struct rzg2l_cru_dev *cru) spin_unlock_irqrestore(&cru->qlock, flags); } +static int rzg2l_cru_get_virtual_channel(struct rzg2l_cru_dev *cru) +{ + struct v4l2_mbus_frame_desc fd = { }; + struct media_pad *remote_pad; + int ret; + + remote_pad = media_pad_remote_pad_unique(&cru->ip.pads[RZG2L_CRU_IP_SINK]); + ret = v4l2_subdev_call(cru->ip.remote, pad, get_frame_desc, remote_pad->index, &fd); + if (ret < 0 && ret != -ENOIOCTLCMD) { + dev_err(cru->dev, "get_frame_desc failed on IP remote subdev\n"); + return ret; + } + /* If remote subdev does not implement .get_frame_desc default to VC0. */ + if (ret == -ENOIOCTLCMD) + return 0; + + if (fd.type != V4L2_MBUS_FRAME_DESC_TYPE_CSI2) { + dev_err(cru->dev, "get_frame_desc returned invalid bus type %d\n", fd.type); + return -EINVAL; + } + + if (!fd.num_entries) { + dev_err(cru->dev, "get_frame_desc returned zero entries\n"); + return -EINVAL; + } + + return fd.entry[0].bus.csi2.vc; +} + int rzg2l_cru_start_image_processing(struct rzg2l_cru_dev *cru) { struct v4l2_mbus_framefmt *fmt = rzg2l_cru_ip_get_src_fmt(cru); unsigned long flags; int ret; + ret = rzg2l_cru_get_virtual_channel(cru); + if (ret < 0) + return ret; + cru->csi.channel = ret; + spin_lock_irqsave(&cru->qlock, flags); /* Select a video input */ From patchwork Fri Oct 18 13:34:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841789 X-Patchwork-Delegate: kieran@bingham.xyz 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 6822C200B99; Fri, 18 Oct 2024 13:35: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=1729258506; cv=none; b=imyFHYIVnSOEikc+6zE71Hwz9EEMvAm9dbGc0ABpXScfsApaZ0GZyJ+DP85Dny0a+35XXdySX25tfmNj4jJIHWOv+rlIsytN126VfoUBFzVR8yUuGOSfn66RDai8MaPU4s6FTfdC0KHrteErHpDF4hzkxcbeIfOaURkl6ML7YjA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258506; c=relaxed/simple; bh=oSyANygK9+1tRoO+oi3cs/pvQ7TK/hoTnUQN/5DMMXU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EZ8mPg2sCYHy8VlXLxgxyIVSgjhsfF4jqAIX5tWksUdEPpz6ckPytBlFlwI1hlvqUCiWZX/i61DUEFaVHbw9PaTyaCNdT8NlX93KaR04rJT0gj9GS9dHPv+d8W/H6c2fcSRZ9sfzNaaG/KZTZLaN98umZ2DpPtFZtdYUMKLMrzQ= 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=BRF68a/D; 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="BRF68a/D" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-37d3ecad390so2334281f8f.1; Fri, 18 Oct 2024 06:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258503; x=1729863303; 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=pNupP9JfUiIRbpMOXQPiRaKCecULdi37qatyogUW7qs=; b=BRF68a/DonXVgA8RGUk8BEqZyEavornq/NpKN+3I1kU3WJX+f2RPP7YU4xHB2+SqNB OHKEu8TfTh9iDNbMolcJshWp4/Q0c1wpnrIC3NFUwsrorsd88bruwWNMWXSduJM3JtjF KitA4w1s4Vicr5dmDoOI0dt4aA0Afv9I0rGWZCrt3rJBzlZMxzfQZZvs0anO8ZDpaiVk b8lA3Ad49XS/ajY/l7ylUnCJe7k+RGj4JmExkZAhWj0srGWD6VoKzlL4jw0AMAStVKpA xS+D+Lb2z4reMbhHi1lilLTTJgjvNjcPymbXXmqEj6bo/7rskM9NymiseRefgJFYMW6U wKEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258503; x=1729863303; 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=pNupP9JfUiIRbpMOXQPiRaKCecULdi37qatyogUW7qs=; b=BIyTl35dIbcg+MOYdVzptBZwuLCl9SmGhdBvxEDyYQUrQ959g4V0jDzj1nzfAXgAaS VyTeuwIEzNOmyw5dqrkLoFAyYfbeJK0gKCFmDtmcCf3yhp1dJaPj5fQUzmrSdcFsdDih BUJ7YLP5RDmKJKUrh0lr/DWjywdE1ARaDkqfQdeVKcS23yAusxxt6ZZhP6KWZyOo+bk8 1hGuLjQ5XZPsmxurF+GpKK92dNYhBhZ3XnEqE3y7UHjCozPRUuWOBrbugaSVkQDVb4N6 SoXOfOojBbLhR/fpfLdhepPQ6OY1hydRkgLwQmBXU7w+zQV0ZHVE+f04Yjo5H2Aoasye wjRw== X-Forwarded-Encrypted: i=1; AJvYcCWbhWiE3FsFOwOd6EsH6Yov5Kdl94FRp1jJIZAwAb8+PGAKkynBGaH4SElRacC0s2pdbmcApJd4bQILbcF5mPTz5J4=@vger.kernel.org, AJvYcCXYWBJolQnE5YRscLo15Qgo2Dd4FK4Ai49h9MiGufhFSvNK6+GRJ4pxGyxWMSHZ7c8tj38Ib8MWmRTGdi8=@vger.kernel.org X-Gm-Message-State: AOJu0Yyj0voQ45hdVw33wopobiTlXywG1gzUO5jGq6wxwJmx8ZX1tzjn bxZPni61zzQ/RRpnAfliGuy26pMxNI4zoVvJ1qZTU2jPWcGu//8k X-Google-Smtp-Source: AGHT+IEpTLxPT893iOVRNmvS+Yy6Q+T2QH3HC398BRU/YouQqBGsgy9A3VoKYc4HN54SvcHPgOBqbg== X-Received: by 2002:a05:6000:2184:b0:37e:7027:c86f with SMTP id ffacd0b85a97d-37e7027c9eemr2118365f8f.9.1729258502532; Fri, 18 Oct 2024 06:35:02 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 v6 07/23] media: rzg2l-cru: Remove `channel` member from `struct rzg2l_cru_csi` Date: Fri, 18 Oct 2024 14:34:30 +0100 Message-ID: <20241018133446.223516-8-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Remove the CSI virtual channel number from `struct rzg2l_cru_csi`. Instead, pass the CSI virtual channel number as an argument to `rzg2l_cru_csi2_setup()`. Suggested-by: Laurent Pinchart Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- .../media/platform/renesas/rzg2l-cru/rzg2l-core.c | 1 - .../media/platform/renesas/rzg2l-cru/rzg2l-cru.h | 1 - .../media/platform/renesas/rzg2l-cru/rzg2l-video.c | 14 ++++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c index 43da91c4fdc3..89be584a4988 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 18 13:34:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841790 X-Patchwork-Delegate: kieran@bingham.xyz 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 029B8374CC; Fri, 18 Oct 2024 13:35:05 +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=1729258508; cv=none; b=hcG+y1Qe8jrJYGNoIYUpVI1/lLA3AD75IAVZZRefzm0eT2zDD6gRN4zTgHeOD716JF31lNUEZ6dky2nKu2v9LeYz4YQCr3xJO+FAE4zJT2RxNotRXJYM1XADX6WdBSSpB4hSQx2grWu/cqfq/WRGLIEja5pcrPNm66bmOKRikwc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258508; c=relaxed/simple; bh=C1qUYYuRnWzN0Zz7CliMFvIfZZC42AzyLPIVnw9T4s4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FGBz6OyDnJfrHQe/dB1tvcUBKgFMG25/RyFkxQQdDMGyRnpjzzWK0bps8eEvvoVokSYzFQlHPO2+Brwy2u2wJugSAsUhJ+h4QUoeutvAYit8tmo4PruzXreL4yHVwPXfQ34Et1PpRREy0CVTDH+YTLPt7kIGgq5isQ77wBfm3v0= 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=DYYlkYIh; 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="DYYlkYIh" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-43158625112so19957795e9.3; Fri, 18 Oct 2024 06:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258504; x=1729863304; 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=DYYlkYIhOoJM7UyT8966Ktpby0TCprqw+D7SJsYKNh0TIIPvRNUav2yxAyBCJwmVFf g6Q6KZRFU9tcfaKNDse03XPx3okUOnv/hgzAM5pKsxxGA5fcoxn6g+JW6BOvNdJQ/0cn kjSEA1TangiYmHtPlChcP5F+76Tkl2rcaHC8rAhs76P6dr790bXGBSt30Q0Pq0XJWDAx Wyft+6TKcHsCMHzTM4OvkVXt4yp0OQiXGaPNCmk+w6NjcWqcTrPpWRK1SDMHFImKacmi KcsoaK5LiwYd0fGhgXmkbXBy/e+8ynSTumLDfkmtVPqTlg/3Ig4Ov3O4yN23Xz+lZJ6H zHzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258504; x=1729863304; 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=CJPiFsYWoSw4ZHWmv657f8BV5+K7YCmUpp/DvXS9paKofMIperxiAlO8H7rP4upW7l g6ITvkH/BTiWKKzA6SY9M8gbtT7YYenqGphjm6GD7UFM4klIeyG5aXcJDR8BAXz5ykYQ DaPLZKdajak6kb27UzByHmuIL7nA5qaIeeGDhMuGc+IQHvH8x9vsODLfyuYRYB1UEHiV y6Qd7RAldIBhq/2SSV/x2h27+vgbBrRDBFKjWH5aXf1dm4vT/o2GQXe1RSDEBv69ywdU ThbOPMsowuX/yYDwnYZN5vMwbOS9YqeIxIaAsFqE9eGDbABCzt9zbI4c0vQ7SqSKfhXI miKg== X-Forwarded-Encrypted: i=1; AJvYcCV7AZszbITjKnVVU2BwPMtKeO3TpR8n5gvnryswsX7eUDoB9kwYNIHt4sSg7aI7dAZSDTQujzc4rs6e+H4=@vger.kernel.org, AJvYcCW9s0zQdTRdPQ0JYyZhP0dysty/5nK8TJvqbXxA47VjXiDBaUuFegvm7raaasIfCWTJPmQxFQ55BbJRp201BWjokR8=@vger.kernel.org X-Gm-Message-State: AOJu0YzBSaovOzhO7x2GAaB/rlLzKQpZh5YmURMLKBIZhr2hMbZumcxG Zj+X5aM7ewrfJLePKSbPZzLvrGWZvBSfdwW7x8KlfVJfH9yDNfS114cTPg== X-Google-Smtp-Source: AGHT+IFohn/9b+GBpybbjuPTY0wePe0Xk8f7ewlj7wjB8K04lcdeOXZy6DpC9lhcoE7Yx+n8y6YVeg== X-Received: by 2002:a05:600c:3553:b0:42b:af5a:109 with SMTP id 5b1f17b1804b1-431616a3c1bmr19067205e9.24.1729258503796; Fri, 18 Oct 2024 06:35:03 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 v6 08/23] media: rzg2l-cru: Use MIPI CSI-2 data types for ICnMC_INF definitions Date: Fri, 18 Oct 2024 14:34:31 +0100 Message-ID: <20241018133446.223516-9-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar The INF field in the ICnMC register accepts data type codes as specified in the MIPI CSI-2 v2.1 specification. This patch introduces the `ICnMC_INF()` macro to use the MIPI CSI-2 data types, which are available in the `media/mipi-csi2.h` header. Suggested-by: Laurent Pinchart Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index 9ab7ef33c9da..de88c0fab961 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -77,8 +78,7 @@ /* CRU Image Processing Main Control Register */ #define ICnMC 0x208 #define ICnMC_CSCTHR BIT(5) -#define ICnMC_INF_YUV8_422 (0x1e << 16) -#define ICnMC_INF_USER (0x30 << 16) +#define ICnMC_INF(x) ((x) << 16) #define ICnMC_VCSEL(x) ((x) << 22) #define ICnMC_INF_MASK GENMASK(21, 16) @@ -307,12 +307,12 @@ static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru, bool *input_is_yuv, switch (ip_sd_fmt->code) { case MEDIA_BUS_FMT_UYVY8_1X16: - icnmc = ICnMC_INF_YUV8_422; + icnmc = ICnMC_INF(MIPI_CSI2_DT_YUV422_8B); *input_is_yuv = true; break; default: *input_is_yuv = false; - icnmc = ICnMC_INF_USER; + icnmc = ICnMC_INF(MIPI_CSI2_DT_USER_DEFINED(0)); break; } From patchwork Fri Oct 18 13:34:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841791 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76CA22022C0; Fri, 18 Oct 2024 13:35:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258509; cv=none; b=jSg/N+JOG7KH+53mK3Fh34/UBQPrz4RFicPUgU3GTqCNuqZ7tnn7rLrFhH7ZPiyPyHpx6prbI98fGx92m6MDS2J+kFsuN0VIJhQRqDG7u8W82n3EUc3SvnSQpmaawYFb0NeB7FHF5fjNy9zKHPEIDnz0r5pNKNxyFTRZ9sVWtxI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258509; c=relaxed/simple; bh=jjKhdL2ZlFvCxK6TQCDrMqBP3ZWyNv7UnbEcwC/zyfU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CBmYqCK6W1ajeQ0/ZY5iREavEapMATb984Kr3eUUKf+dNYxSgp8XVkp5YPFxXnVvDOlQs+XawUV9q4nu19aAqgyTKp29aEBJ3OM6ZEq1e/bAlzWixoT06/+YIqYce5KEioXhVi+w58ZdpILxLPJuxV3G1+lSOtBEybCQ3kBEQZw= 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/B3X4Ct; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="A/B3X4Ct" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4315e62afe0so15118055e9.1; Fri, 18 Oct 2024 06:35:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258506; x=1729863306; 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=A/B3X4CtuLq8Mp/L4mNQY3IIinSvpqMDvNU3LP9aqj9HPy4P+cPHPF1WcSGemI8c+A Ux6y0HPgoh2Oc0l7pfrYkbqYpZuDOhmT75MnAjiYjcO2rAtbPJlrwFDpD0JM2NuUV/+6 doEU0k8w+OOR5W+qull8LEG7HoGTIHx0oDx/QvYcLGtEhQ3nroLinamvRpTqnLpfQMTJ YaCSkMeoxfrxppke3kL/qnxSQ2FV4Cg83b8va9y6cNSqQ7sgOS3ZtVWnHQLGIdGBXSJD CROLz7yAX2mp5RVINPKIW1yLqM10VfnasihpdT5bwqVVnL2DzLxOIptyTEljr0lBj83c SZDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258506; x=1729863306; 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=jRIqzDHKmuGLS1D33Aq5RlxgkRP9TX1mFmNmpoFOLsf+vSdfFhx+aL/fu2gaEhGQNM ww/MPKNDJQUWQJI67WTJrfHRD/snlsV2zuvrjgoTbBEJ7IbOwgLSqGcOkaAC9VcWVjG+ +j95zgBrBCc0kj1mLQmx+RbioGhjiTEe+Oulwv4VXj8Jumz9ks2srsEV78xi1187Opm4 WFgm1gGeZNKHOocPZ7sJsM3Gw3EPosWNOgXOJPgDJbQIogo027RRfdmnQXZiPQmKk/KS fxavOtFpjeWv+0msQKGbTPCkmL3EhG6//ajiprxFlBlrZRp4oM6lpWRjWEMyirXAfjLF prDQ== X-Forwarded-Encrypted: i=1; AJvYcCV//ZxeIp1A9vIBIUy9OuQKpXXQW/FxZcW9h3Pyv6uHzUePD2enOX64P3ozJzwEtt5+zX7SK2nd1gDB3O1WCkhObXo=@vger.kernel.org, AJvYcCXT247vk3h6UUEdpNHi1jwCU+NxjCC24uQgWMma1OabC2sv5ItAEvpNNQsAU+Oy0YC81SyPTsY1DKCU6Tw=@vger.kernel.org X-Gm-Message-State: AOJu0YyFDOj7ljNudgnAlEJKzoixOaKfK7i9tMaP7Tj/szdnbCcJhZj5 QeGPehO0K1KjDnO/dGQBz9iwNe4bSpjEGPuiWVlGbPUG5O66hK0R X-Google-Smtp-Source: AGHT+IFFkmPrPsaccyHOM8SlcK7JXLS1oZQqJx5Ux4bfM5ae/7pIePIk05dSlc4rR3RDg44K/ckBMQ== X-Received: by 2002:a05:600c:4687:b0:42c:b9c8:2bb0 with SMTP id 5b1f17b1804b1-431616331d2mr15713515e9.4.1729258505494; Fri, 18 Oct 2024 06:35:05 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 Subject: [PATCH v6 09/23] media: rzg2l-cru: Remove unused fields from rzg2l_cru_ip_format struct Date: Fri, 18 Oct 2024 14:34:32 +0100 Message-ID: <20241018133446.223516-10-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Simplified the `rzg2l_cru_ip_format` struct by removing the unused `datatype` and `bpp` fields from the structure in `rzg2l-ip.c`. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index aee7d4ba70b0..7b006a0bfaae 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -10,12 +10,10 @@ struct rzg2l_cru_ip_format { u32 code; - unsigned int datatype; - unsigned int bpp; }; static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { - { .code = MEDIA_BUS_FMT_UYVY8_1X16, .datatype = 0x1e, .bpp = 16 }, + { .code = MEDIA_BUS_FMT_UYVY8_1X16, }, }; static const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned int code) From patchwork Fri Oct 18 13:34:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841792 X-Patchwork-Delegate: kieran@bingham.xyz 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 EDC882022FD; Fri, 18 Oct 2024 13:35:08 +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=1729258510; cv=none; b=ktjtaBQEDucnzEPPq1ANGcxgu6ANtDvKqUfNjSvPe2ztuTpmHAvjOtkmSZqixpM7qtmy+rOWlqJsxX0zvbVmX4xyw+QZNaWB18Lc4MnE2KJBJHx8ZhBKhcFRtA8lAA9/zmlWQ5ffGSpJfDPIBIdzX3iCyauG5sjwQzeH72DXDB0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258510; c=relaxed/simple; bh=WaMT2+l3tGajGSAOHnITmChvR6gY6YGJIR7Q4psEVfI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Nkls+V+ZgYy03sDp59J8u15dZNTukVKo2cupg6QdVq+HUKPXvFU3TjiVCFWuOm9V5rLYwXLDn+yxm9tuwen4xKkUp3iA4N+szybv55Mwh2bseCeX6jmMWCBc3DiH6GxTyzy8i+S8dSdo96OfqCqw01H40MbHlHIVcWzvicK0uPw= 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=FK53hbX1; 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="FK53hbX1" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-43152b79d25so20257555e9.1; Fri, 18 Oct 2024 06:35:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258507; x=1729863307; 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=dnwZfFFsmDCuxXuxjDHgIuMhjacz42UF8i31XPe25zk=; b=FK53hbX1C2DKbBOOZTPrqHSna/RYXg0ifYz0ssXlDXenFAWjxvIt55Cb9vq8AKWWG/ j43qFJyVju5GU0FPuS+JrjIFJW9dJnLXfXfK9+Ql7PZf+qThQ0Du10do4DyDnZV0jQ57 14HsCk6K00AHHBy2vB3XiipRWg0vNw+vFoyb4HkGW9fY6yXjx2dHQKgBGEeoEB3E2/ar DAa4WNrvzMP75n/P244rk1OuS1+yDss+jGIPhcRR90ugz73bga/FQziF25kPZBimBuY6 fcUg2KGqEHzDvv1agDN6GwC77HcL8R80vAZsoAPqhuK+YGAdl3xOL544S97afVab+jbG lDhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258507; x=1729863307; 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=dnwZfFFsmDCuxXuxjDHgIuMhjacz42UF8i31XPe25zk=; b=CP+p5AYrnObjNhbHsaHXVH26byj0MIssFV976+cmSf1dsf6G8nekG2rx33LAFPQ7lo liATr3G008Dq38tnsH6nSdBQZXLV8ICIahR/2tph+KP1EQEKRnIiWElnGx1QhAT3QQHH LYCFRICnGxZTHCw5ZXCFSTSo4Y3/616EjcjEu9VxupFZBABr/NG8M40tg03C9Ogvtluf P3U/ToWLAFI3B/RpdHw9Oj48kPl71IevACCk+KAovDk+neQxzeGI1hYT1ftVVbcQ5DwL 7UkfmELglEeKV2m8k40htaZxGx3E8tWSKga7S+Fvi7470Sfq6usc1H9EI/Wc2zxji0rF 9SQg== X-Forwarded-Encrypted: i=1; AJvYcCVZ9165/3SQduaR2f6dikXkriM8VD7vu4SsVydcImGBaS/lfVGOf9zSYHxEb/ogQESVqd4MgbgIHS+CAxA=@vger.kernel.org, AJvYcCXgp9ToomsblB/e67RRAFYDoWu9BMZnLQiFAib5kCPqTGjbqGblIcybvT9VL0o9tmfGWQWtEWR+GvxhTEdabNtNy8o=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6ZFONiL0l5gaIAPpmHYDNQFYH6Z4ug/bDvOCMDksvJJgocdLZ uq4fjLC7KPUPbIwvdBb284yl5ZmRslLAZVnsiHleQ2pPMf69Ds01+nhp5g== X-Google-Smtp-Source: AGHT+IE7oXFB+1tY7zn/jzHxbE0oMKKILJsBRqLZfhhvSB5/MqsJ2j5hQxjuKY2BGIb/MJ4H702lew== X-Received: by 2002:adf:fbc5:0:b0:374:babf:ac4f with SMTP id ffacd0b85a97d-37ea2151b96mr1780467f8f.12.1729258507051; Fri, 18 Oct 2024 06:35:07 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 v6 10/23] media: rzg2l-cru: Remove unnecessary WARN_ON check in format func Date: Fri, 18 Oct 2024 14:34:33 +0100 Message-ID: <20241018133446.223516-11-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar `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 18 13:34:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841793 X-Patchwork-Delegate: kieran@bingham.xyz 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 3B433202F65; Fri, 18 Oct 2024 13:35:10 +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=1729258512; cv=none; b=p2goUiFVpcbhHMDmcrQIYJbEwCZdV9tVrPQbRcAZvzX2oLLTtNiaGGMygC3vQxp9j49v+X7qmUwS72/rkTrGJPui+DuOvzISjwHIR6OKr9sEAgte8QYLvEXdosNUYgpSR9Vv/GikepVnyvKljzhearIeo/2fC0X3E0Z84W9HTkU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258512; c=relaxed/simple; bh=6WpIL0bspVMBgaKsR4KGjVyON4QJ3HcAnrUnUJMYobE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L6ndvB0cczGWTtbDANTng4tOekll+wMooIXOEA+9KRU2uHZ923h2khoUooWsqb0VxUXF8ndzK0GxknzDbQL639K8N89YZleUuugSAmKpMNnvi2C7y1Fbmw0lOAmzi761yIxj0hi1qujO4nRpviaijLegCpo7QGTa6e5m3rfj3b8= 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=iTV/89bV; 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="iTV/89bV" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-43118c9a955so20179565e9.3; Fri, 18 Oct 2024 06:35:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258508; x=1729863308; 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=6/6N4lQ0Uquk2VO7s5YzfVz5ebCQEGPSZSJXM/9H7Ig=; b=iTV/89bVR4lSjCdNmQAMkT44+cPqrNMMcd1PKJfEyJbPwCyb7Zt4lasddwxGjZkxYe Kv5TQDSc4+lJuSS2IgtrSEt8bPNmLKRmKfSQ/5D18Ld9TmXYI7sEDAhTYXT0doKNdBJZ +nLUZrxzmjlKox4uPVPx5AL0Ea6FinpC+6ooLnlIfoiXmEcEFN9WkrM6g10j6sZJw+Vl eP0d1JZUpoHagWUjW908dcL07Zjf3QgDvDYJby+I4K9qZaD/kv1eLtHk1MhRB/5Mj90a XH6lO7N4B1AjX9j8I3XNgufQPxvqK2d9LbFmbUta0rOAiyA9D1cJ43J/GhW9aiExbN3H S2nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258508; x=1729863308; 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=6/6N4lQ0Uquk2VO7s5YzfVz5ebCQEGPSZSJXM/9H7Ig=; b=iEbSJm0L0pNldCWMLfX9d1Vt4iWGe4Kt2y/MXr1w82DZx6cprpPxhwkAQpRUf1e4Fz Tu33YEhmZlUOBuTL/4R7AuCtlDr5tv07vMaS2WiVQODTzTBDMOrv9K0voE0Kd3fO0uK3 wSYNb7VOqizCdYD1VIdUupCuyEWoPqQf6GEHs2OmfhMbBoj1TUds7/jwXelKtXTo0FDd etaF6MeTu6UW5Q5Gc15ACf5ngYbBX3rb3YwogqO991iFGEMUcv7VBUAXTkLC1M1s7UNx LjcOD8cE1jVsLAShIRQde8jA4HLWlGStmu/SpUvAcEkDVm0/4xdoIPJRtynur1dQprfN ibqA== X-Forwarded-Encrypted: i=1; AJvYcCVORgaIR7IXCt+Q7lwBBX/ejVwAzxSrTusW3VcX4p21y2ic/Hxu+OQny0iEU+d6p0TDQNFTf9kpxklwo7+TDiUz/70=@vger.kernel.org, AJvYcCWeSSs+PM/6dbtRLc1CJLle4BW9SZSX1S6YDhqFXu8HcJawirRAgnXG5XnH/OcqH23GTpQv3Diapgws5vU=@vger.kernel.org X-Gm-Message-State: AOJu0Yz/MNsgyNb1wsUyXH1rfPwYovKfm3ZuLCislo1u3rd0YsetZ4Us 0DWEPn+dwZCn3bhBNvpFmRe9l04tVPJiVdXcSelWR83x1qXx/b6c X-Google-Smtp-Source: AGHT+IHyebNjnIr+8rDF4nR+d3BKtuJ8twSr9VVau33AX0FqtjLZTQe0+r9jdH863EMwlJ6yTozPrg== X-Received: by 2002:a05:600c:458d:b0:431:5aea:964 with SMTP id 5b1f17b1804b1-4316166a975mr17064335e9.19.1729258508270; Fri, 18 Oct 2024 06:35:08 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35:07 -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 v6 11/23] media: rzg2l-cru: Simplify configuring input format for image processing Date: Fri, 18 Oct 2024 14:34:34 +0100 Message-ID: <20241018133446.223516-12-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Move the `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 18 13:34:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841794 X-Patchwork-Delegate: kieran@bingham.xyz 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 67973202F8D; Fri, 18 Oct 2024 13:35:11 +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=1729258513; cv=none; b=Br1gAhqzJra203VsR/aAzykMZRBpVCljG5mBpjB4qOff72VG8xYZHgDUbbNo1uybmUZB9esG+vyWbwafzqTX1kPk4a+a6t1QimsqVvlHCyXjSjAc9hwvOYdKRBMIiGlRkpsMYTAKY8LfWM/VMSse8pRgWDTDH7aJz+3Z1ewa3PU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258513; c=relaxed/simple; bh=MHL+cGwrYKjALIAcXQIyfGRXQH+NW625WOpP8KM+4u0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AYKyV6n10cpTsMLnirSlg6FXvdX2ZmZO3Jes56hrJx378Mh1bJz2NJoUOLHj0afCIDbGVXiLP8P5rj8dyZe7dzu3StHnvXy1hii4JKfNdjWdzkfHUxMOkRX6yxigmNlCrIlKUhOJMO+IhHn6JrDnOMR2+VKkkNoIuYSU7aMjf9A= 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=MnD7ev4u; 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="MnD7ev4u" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-43161c0068bso6098805e9.1; Fri, 18 Oct 2024 06:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258510; x=1729863310; 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=sfay+6XQLhQuLyjd0986nDfaEEar+zrG+nqf3/TB8Rg=; b=MnD7ev4udDP0OgYe7t4Xo3pZdAXyHT2eTA6/sBlqYJOyOibJZqPvXJsSLqVCy+vR7A jTWs4wtcfS7AX5SOX8mGWR/+ftXuc4LcHRlWzcSziLjH8HH1c5AOrBR4w7sBAGyb4zMf qIQ9UpWRFI3IUUgPQF1vBxX2HwB/mR2qOSYauaATc+IqB8pluECNJrPiPC9K0rpYvHxB 4cfK5OkhHsoom13ZiU9Q6ol3BcbLbYET8tGlIKygarHv5yF3OmtaUbd8axqEPFvKK002 V1YI60iKsQdKodX/AWhUcYwK6IxR3thOU0sLL+xlEFE58WJIpfC2Fo2/3rqYjevLyXKi rtHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258510; x=1729863310; 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=sfay+6XQLhQuLyjd0986nDfaEEar+zrG+nqf3/TB8Rg=; b=fJ6biPIaQDg/EzMuq5hsexlty/LHlSy4/GdLR5sv22pLuEsgmwptaBc2557jLwHJx8 Ykdenpi25PHnasDKaiYmgY7Jh7LUdotMmamgaUb1/fZxId1xjZDnQLrJ9YTbQdfFgEDW enKR3YVzUkQdhnGe39YA/suHGujk+bcZGyJd6KAxNSu9XS6xUogNwCERkwivuqlFZrBF tYbQx/wT3qgmtoRZ5DEPkvSQ99sJYML+1IvqtPPOMc/9psP9AxLWmMsnLDrUgpgSbUBW eLgsd3R4O9lXrcifLl1pkh7fd1rk0QVaqP9h9c44DK1pa/d1z22hIHHy9IocdfiI9wkg PrJA== X-Forwarded-Encrypted: i=1; AJvYcCUO200Ex6b2xsFBKuK03dO0cBkpT80/lyPVe+Apaq7+5k30jhhu549kY1Rais7hvF7nkdaFHRJKY//n8q0eQANz0Ww=@vger.kernel.org, AJvYcCVVVI9r0UflKbs3FP2eDy1zf9ULveO345xu0i5q9rp4GkmZa4hNetnqmBondy8uuu8Aig6u6mmmBbmWcLo=@vger.kernel.org X-Gm-Message-State: AOJu0Ywrc/qYTYBSxaxd0BuIIM6oAxxDj7qT3XW76IT9B/gZGB41YuJx +sRkDGIUusWmrZ6ADE56avzbtxk21qqZBfMznSbTrCUzzdDpniX9 X-Google-Smtp-Source: AGHT+IFJfZtXnA78fTiQmluvQSsmI2ptS/mjLsodA6hieIyyf5n9M2jU5ghor+t4HY6X3SsTcE4hzw== X-Received: by 2002:a05:600c:5124:b0:42f:823d:dddd with SMTP id 5b1f17b1804b1-4316169a57amr15813715e9.27.1729258509518; Fri, 18 Oct 2024 06:35:09 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 v6 12/23] media: rzg2l-cru: Inline calculating image size Date: Fri, 18 Oct 2024 14:34:35 +0100 Message-ID: <20241018133446.223516-13-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Inline the `rzg2l_cru_format_sizeimage()` function into its single caller as the function is trivial and is not expected to be called anywhere else. 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 18 13:34:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841795 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF08C20370D; Fri, 18 Oct 2024 13:35:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258514; cv=none; b=aMwF25kkMi8S3NltfMP58RGs/PCvN93cZq9E8vEgxu3k6LXOTjb4sov2+r/siWIpnk+WWK0Q0ynUwtX8Gz7vuUSlo5J5bfOTRojyuWdwOx7z2FLSaThQcKflBDiRkP5NqcmuOElMG5h/Dz9hy+CFe7bFXE96fHKUSAjtqz+wOOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258514; c=relaxed/simple; bh=CDD08ujuKX9CULa5McYzbHMVjexSF2pbzyKN2Eu45Lk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZsYNEfecPtcUcrffn2OkDnVmnFTmnZ9RJVkP7vuE1Xbj85BeJ8B+shKbkJnNJXsNEAKjV5VREo/NS5rTrlXe2C6HxHstjrkccRKW/p2KzcG/+xCHJxpN/Vp/92LeaQuFdhj+TlBAqhIsIxAHJNuikNnA/I+bOkUURJa2ksa9Cp0= 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=N9vYIQtB; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N9vYIQtB" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-43159c9f617so17783895e9.2; Fri, 18 Oct 2024 06:35:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258511; x=1729863311; 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=trsgOkHMBaD2DU4Cng+2eCbnxFBSbjCokXCeMUaoZyk=; b=N9vYIQtBBb1lE437g0YX6uFL3WUrJ2dtpJtQEMDlvfWxgFZdngP6wuAS/ltaBxqWU6 0UvP/lCIthGEoaGk5Ys2r5PwLgW8uiweRwbASJ6t43nyxZQc42PxvCbcaRL0L4gakcMo UXLwhPAUKi8qSkPxNlge4ciQU+fUz0K5UiQUk+huemD0A6nJOYN3rcTtqTpNErNq00x8 wPn4V+W9l3d7Hy0Y/PlgPrFRziS6ndRAi+sG4+ytvEVlMv37t8wcxIIJdHhp88vAM2IS Hymiy/HEfqlL+4EPjOOJOooQ/ItiqVPLnixkI124w4OJFawPMaOqL2aXmqaAbeqKSJXd zcrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258511; x=1729863311; 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=trsgOkHMBaD2DU4Cng+2eCbnxFBSbjCokXCeMUaoZyk=; b=rq0z2IHyWKzIJWxPEcrjV8p3E1iq4yRSnIzLlmO6tDMMf6Kvg6rsQN/VOLAdkTPD9k fOgnrD2fLZKk7JpUCKz7JpTMToFOK9FKVj+JlQotT1NDZnVFepKN8MAVuwT7zgQvt/0g XEaciUv3LQNFNUmP9Lquglxv5rXQUDyAoXbc9DZ36pZgJ5pwqZo909SKb0pILy69JpUz tohVUhEmJOPvNXb+FXz3xBuB3KY8MqtJ/8XXaFpNwnbms2Rj8WXmwhwmZLyTse0OBpou PYnxyw2CYvh5Jd3xxJzEuehxyKHX0NKlWc9wvZf9XSfBw/itzUBYKbyAHfx2rmkp5KH3 O1Kg== X-Forwarded-Encrypted: i=1; AJvYcCU3yCv98YW79bGkm55xwY+6yvgRseFVlPyqtAAISozpRkcKiEmt2tZWIbTWZgWeuIWiyXdSieQzIjaI8PE=@vger.kernel.org, AJvYcCV+HG7AwMYa9q3DI0K89dBWThtj7lThlssa+rUlXTTAA8a+I/bkUX1A9q5tTFsjikXIwiQtdixJpfVHlMng9WVpg/0=@vger.kernel.org X-Gm-Message-State: AOJu0YyiV3xOL1/CVL/x/DgGbOi6Obvd8PvlTDt60vKwhIAY9KSdGQUZ qTE26mOVfKi+623Qp1JRdbE1cyAOQOgrdByevneE4LJ+nFW9Fpqt X-Google-Smtp-Source: AGHT+IFGEkUsM7YOlEV0+1ew1xlNnTv8lx7ph5Fn2RUW+0lYvdZlVXVDDXxEP/thwC6zWqrq7vi48w== X-Received: by 2002:a05:600c:3b89:b0:431:5d4f:73b9 with SMTP id 5b1f17b1804b1-43161689882mr18609445e9.26.1729258510721; Fri, 18 Oct 2024 06:35:10 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 v6 13/23] media: rzg2l-cru: Simplify handling of supported formats Date: Fri, 18 Oct 2024 14:34:36 +0100 Message-ID: <20241018133446.223516-14-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Refactor the handling of supported formats in the RZ/G2L CRU driver by adding `pixelformat` and `bpp` members to the `rzg2l_cru_ip_format` structure. 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 18 13:34:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841796 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18E1D2038CC; Fri, 18 Oct 2024 13:35:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258516; cv=none; b=WEJ1XWEml1TivnrrhIs0Njq+VWb8WxGFhR2qkps8s1CAjyg/bf0t0waBkj3Jw4NwW0uzqQ9P9SM2GbIwPMBjXfi2onUZ5iK1nzZsTta+wtYymwq+GRha+mKyfCEOY4ijAmHRl1sugbxvP11Xh2fBq2bQSvtgpNFYTa+L6jn1Ba4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258516; c=relaxed/simple; bh=+/agONk/gxEUUW3+pm9dXTEcKcgLsOsiDgSaT5pawdc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fJk6G3KTdkjOlYymI5bGsPEsdLT7AK2si4YTbcpH8vSLeDh8STnrSWxf0EmRzaBAGySqT5tjNMdlW8k/zPig0Fs1xl/zeACppdxK/Jqvh7DlVXuDksbdz5LuJwL+UrBJLkFHYafAALmSPhSPeafNk66TLKX0KfLEH25q6uVdK7Y= 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=SllOVKLR; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SllOVKLR" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4315e9e9642so13542045e9.0; Fri, 18 Oct 2024 06:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258512; x=1729863312; 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=bAJytwAC4eOvoaZ3IKILJd66FgvFsvwVRbpuQcJX+Mw=; b=SllOVKLRs4R15oD0tKv4BZzgQOYSKMhgb0B4Ml7VAenxefU3PS+DgYHFtOFVaAxID9 ABVD9vqzNAu7eXEpuYIEGHxfNSOAtZE822h08WIv9E0GAwuFgoTRco3rOtjJ7A/kpnjS lOpdyLTdeZtV4WK9dokv6Zjh+5yD3rbRxqw1iugqG01lxN3J0U+D4939FbX/G/d1bDtX nf4iUvj2bAcTq//Cafep3zp66OkJVeNe99LpTaVR1TmUKSCaSro0Zncnm9fP3ve/AW2D X0oFELx56dmMPBg4cQ0anHbkHmw31XinJltgg6b9QuA7aV6NyurkuoFUQAXA7q7FhmQp rh/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258512; x=1729863312; 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=bAJytwAC4eOvoaZ3IKILJd66FgvFsvwVRbpuQcJX+Mw=; b=LSrbHzZ9gS/hLyJc8k2C8yooXoWI3whRlXn6n3uhxlnItk3LyyTrIhh4F9vMNL//X+ n/K3pNjF/rlFaRi0ca1qZ5nPjGWfTwaid8ILWn9yiAWVaXD2jPhqdtoQJQVz1Cj59XAg FkZn0305k7qSABVMoBcOWq5NshnLyB3XXc3etSMxzWM2+OKk/jUSjty+bbiAcvkccmG3 izd8+kqS+sDLsxKjzhOLrhO59jdQuXW1pXkUZF7ZT4q3TFQkLmGrkdHcRf237hEXt5o1 lzTF2x8DNtCA+KXGi679MRH/Ow8MHPD5BdjlV4LRkcZBaSRahLLC4iTgmBYRpuCRKHEE ydCQ== X-Forwarded-Encrypted: i=1; AJvYcCUE080nPUIqJUIEhiYey1CKRDs/SY9IUVtjH8ysJlgoQL80/wrIpBynLKhT58GyU45yTAjo/FBbJOWn0z0=@vger.kernel.org, AJvYcCVFjBoRKgx+trYq83s5dzj3rod3H5Ep8tMrtRCo9sqfgEz1SGxtX1RWa8DHN4/V/zuDrsj3PBr8XGwAGAkzFJYBkw4=@vger.kernel.org X-Gm-Message-State: AOJu0Yy3BBDHPhLttielpBXkbFdPEATVgu8fDzfqCdA+jeVaFhER1Xbn 3D5AKwF/n6vgAkN1cELI1tpImU6emBjOLOJIcHTr02HPobS7SnvA X-Google-Smtp-Source: AGHT+IFGZP2mQs2KvjTIyHap0ljBlkOqrl4imncdI3Ue8VDy/svgzbzX5krude+ICdC7DpV125GbLg== X-Received: by 2002:a05:600c:3110:b0:431:60ec:7a96 with SMTP id 5b1f17b1804b1-4316169ac06mr19875555e9.25.1729258512104; Fri, 18 Oct 2024 06:35:12 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 v6 14/23] media: rzg2l-cru: Inline calculating bytesperline Date: Fri, 18 Oct 2024 14:34:37 +0100 Message-ID: <20241018133446.223516-15-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Remove the `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 18 13:34:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841797 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF039204020; Fri, 18 Oct 2024 13:35:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258517; cv=none; b=Qi6hR8Xmgn4gFGNbgkjovgGDIa+BUlbzHh3LKgIHy206raL9w3sbKi3kgjg7ARfqCYolJCm9+Zwr+7os2dGHOQCbKWdbsypFpFaETYGgrxYKLkCRLRXM2vh5gMDxpiClYdcHJeTmzsRubd/6lHT2jsxyOoJJpXOWhuNVwvSPUrc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258517; c=relaxed/simple; bh=thXl2/TczZGuXsqW1hCg3NABlmoFkFxqDMk3QB443UA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nAvj7xJmrq6eLmSjuOCSU+0eSfoFdeRx1hdmYkIymppEyM1Wf2oj5extr0vwNTuWxKtlCTVXh8npRlj6VLjsOaGj58RyYO3aI4hKxk0h2PIPxnaoYJSLaNVclTQlXK0ilev+3nMxm1LGMZ6xNcQozYxMJOAvR9dxWC3WM2l8fZk= 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=MY1A5Hgx; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MY1A5Hgx" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-37d4ba20075so1596186f8f.0; Fri, 18 Oct 2024 06:35:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258514; x=1729863314; 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=liSecY/iWyb1X6LpZ5dLf6/KtZZR3s29c8vcS1XDL9E=; b=MY1A5HgxEArpCY6L8K2eN7LZ82tQ0MWXQQOpjaQOw0ElnypmmEh01xEXWb9B4gRQXi laAxSDM/0Na4D38XPowB+SSF/IDcfife/8Fla4DfmwtXdV6hr1pr2sc19OWQPC48AmxQ FsdU83YB6coKQPnTT36DwHs84BdWfkKvY3YR3Zc8yegq10jkAhHIt/cNwnsgBaIdtmnC OR3zL2nX5u/WYG0x7sARPLAOmbJ7zip9COMmEg6PDwhC3Da9vKB7W+ZTrEJMDP/Z9TLx VRkw6IoATnZtrSq7fm3UdpLKd10b+Gb0ZlAmWHdqsZNWstVCzl1U0jvZUvyh15gjy/gv 0Y5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258514; x=1729863314; 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=liSecY/iWyb1X6LpZ5dLf6/KtZZR3s29c8vcS1XDL9E=; b=ZY8ret5Ghf3RomgiHQ33XybETaLDF0Jsonyab8oWccJdrVRz1Nj+SmJ70SMROX+Id8 c/U7BmHlOiSHuPmF3h1DsIna2ZP+rXOySR3dWosvIqJ5PEK7136bZx3zP/j4hcc7fz1V 3yxrt8ZjroE6VhQ2AliZQDdKFP2js8EiyFdLVnbzujefvijBKoX0ruiwV0ES6ByT1jGK 2NEiVRs1VhQAVY7ESZOVdUsj9k7ZxkHgVOpY71yoYTjqXCyw13x6cUhAQ+VOyGOiywZa LqUU8qfc7lY2ON2/6Qj3errwpcRGGUrIjhWP6fD6cVzT/kK54hvIJlCbGtCth3yIm4NL kQdw== X-Forwarded-Encrypted: i=1; AJvYcCXba5PzEFnQS2qp4wTb6besfuyQtk4aBg+BorRFw7waL0BVFwHZQLl1hHfewdsiV4PT7vn+Uolow/i+mR8=@vger.kernel.org, AJvYcCXo5VeiA4q84rQS+3Ol2lv289X3HNA42aWnf0ffpbiEhVgKThjRHF34zm91qjekcZyr/V1YJjbERM2dwlW5VJkpRMU=@vger.kernel.org X-Gm-Message-State: AOJu0YyCHns/et6uhC6Ia5rzcFSG0DR4K5+PC5W/4A0fzTT8WIG5e9P5 DfhSBAggX5BXmTlTncL97wfj2w7U+rICUzGD++WTPRIZdyYqd2y1 X-Google-Smtp-Source: AGHT+IF85UNxOEJJfAsBpcXrcodNoSc9yv/7LgqHzFQ814R2FDOorlgTwf0UMegKnMZzcXQ7MbWeSg== X-Received: by 2002:a5d:5310:0:b0:374:c31e:9721 with SMTP id ffacd0b85a97d-37eab6e49d5mr1821339f8f.42.1729258513743; Fri, 18 Oct 2024 06:35:13 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35:12 -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 v6 15/23] media: rzg2l-cru: Make use of v4l2_format_info() helpers Date: Fri, 18 Oct 2024 14:34:38 +0100 Message-ID: <20241018133446.223516-16-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Make use of 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 18 13:34:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841798 X-Patchwork-Delegate: kieran@bingham.xyz 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 12F27204084; Fri, 18 Oct 2024 13:35:16 +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=1729258518; cv=none; b=Hl4iH38nYxGNzNv3Zt1Vd4ZlBWaPYypUcTo9v5oa0J7EPUGV7oMfkpiZPvxOV5IAcd2NUQmMqHZU43NQIRl4wVAxRAXYKWmCEWI05tGZdTPEdMnr/xcBDsE2vsxIMh78YhvllU08rFKFfzRSjJQiJFgB0qVJSZkx2/W6zoBrbJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258518; c=relaxed/simple; bh=PHRKf7x6L1ASM8G3srDIcBNdp5OhV2Njq3EqPXHRcho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aA1wWnc/1fvka1Fd/59RaGiliCIvK9g3yyER7LQZp78JlfpqOd2LeDNw6eGBpwfdW9hducDOxrC7NrO6GXPqglhfpQp1OCpVU2pwq6KGon5WZUHfa4TSmfb69BZziYeXJNBYysm4RA1znzRbsWDvRcXyv467tpWcX26YowzvVCg= 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=YOvObG/p; 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="YOvObG/p" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4315f24a6bbso11993365e9.1; Fri, 18 Oct 2024 06:35:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258515; x=1729863315; 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=YOvObG/pEcxEeIImcO0XRuWSI5TErK31TkjCprqhttt3vka/hpdCyv90ZgeFnrAywW xntsFcBV+MRG6Wyoc3sILwXrtrCmeOTlRFLOUt2KREgPgfvl4i+TcEgsdzolPhdKEjqQ wTcMhaXAI1IAWpzT/o0+XqiLIBKTXk87lAu5S7OedCwx+4L2BRuGN8zahZ9uA9oGGXiX 8EgiHVCI7Uk2yqzJOBosoX6AjYewCsiRfgA0zzJ+F8lSOVFlZpL3WMrAxUszzJ1ePV0l kbzwUa3MPoLm518h5v7N+ka3cs/UXOb18wzU6T1fz0Wep72Wng3FREsfrwjiPqbBWxrz MbIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258515; x=1729863315; 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=O8ldYCeVTK34dlSpwUmj2AYNIjoZj6HlZtA74nOd4/tC7TsEoVS25bSYZFJI26usvK Nja3NoWXVirYdzJeQY99szDFx3M5EK2Nr/HeDZ9rwer3huF1u4xYKCmdjr5OELZMBOeF yq6U1PLxbJFFSkd5Q8xE/gLhADCQm/paGR7nz8yXOS9eJXxTz5VYgGnWWp6eyVw/Qu26 7imfkHxQRMCB80afHjpjePxiTk23/bbChaWgFjLpnbWR6DSFKOF+HHHSUyCc0zspX7fI NXDVrNri49DpCAVdY+McsvNce86WsWUt2wU7IGHKiBvnwZOKIaCKUFCHwemGQkgFeDW+ grPA== X-Forwarded-Encrypted: i=1; AJvYcCUUWjq0sD58oP2wmayfwDayLzpnxPPEo8oCcrCT2vkHnBMJYV8Tu7bStAupotuLGrCV9Gw8rFPSybDmKPU=@vger.kernel.org, AJvYcCVePbdJhEg42KLN15AcQjtLirFH11OYVTY60wEn/CLkhd1gQG2LzJJbWdzYHOoSKtyxaMvMDRYx6iSOJy0UoAO3MdU=@vger.kernel.org X-Gm-Message-State: AOJu0Yzgkps7GrXtJx1RvuVklHApM5onBNwIQ2GczoKZtuSyDrkB/K1Y lFssvBcuTlpE4nbrrAq0WjlqMK0xmNkXU9R/xOEW0xyFk21hVudL X-Google-Smtp-Source: AGHT+IG7BcFLJf8wfPD4S5KCnIb1Rf33UiEGcYwKZrAWfa/bvxMW/w5d76EvrLbjDwRnMUytYY5SjQ== X-Received: by 2002:a05:600c:458e:b0:431:561b:b32a with SMTP id 5b1f17b1804b1-43161647f5dmr16565205e9.19.1729258515226; Fri, 18 Oct 2024 06:35:15 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 v6 16/23] media: rzg2l-cru: Use `rzg2l_cru_ip_formats` array in enum_frame_size Date: Fri, 18 Oct 2024 14:34:39 +0100 Message-ID: <20241018133446.223516-17-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Use the `rzg2l_cru_ip_formats` array in `rzg2l_cru_ip_enum_frame_size()` to validate the format code. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index 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 18 13:34:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841799 X-Patchwork-Delegate: kieran@bingham.xyz 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 23352204099; Fri, 18 Oct 2024 13:35:17 +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=1729258520; cv=none; b=Tq1PR+mDbRpArAdl0D5kL6dwRJfj6JJLX6STBvizRo4MXu+L7LZ3GpED6DDML+1e05rYOBBCHpGwQpq/Z1gFFJwO+lJiIHQAA9G5Ca/80U90CaK5zVebOq+q5bVDum3M9k5RO2/w43741qW817HcVUhafmNSyKpgTnr8TYNLMt0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258520; c=relaxed/simple; bh=iLZOVU3YiNAFnEGYBvMAWuofYknlyFWUQwL0sgtvlNo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iS6xgvIJ37uNVYO0JVr+HUsHNfCyfAu+iVQf2ZkffuaxDhvXmQElBlJ+F6wbEnIMkiE5X7tFpOUQnvZaiAeqAdmiSCUs1JoJohTD0J2XKy8HHHDSMI5RbHYzs2Vo8YjgVS1eB4PixmEeJmFzVvsxJopHrRdD6rYw3DmYcZSD2MA= 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=VR9aK1U9; 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="VR9aK1U9" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-37d533b5412so1502146f8f.2; Fri, 18 Oct 2024 06:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258516; x=1729863316; 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=nky1P2dXpB22MDGCjnPFN5ftZZLoZSsMxjzNL1As6N8=; b=VR9aK1U95x392OuNsq61EjDJXzO7V4bvRxak0qDkwzW9QZysS8YTYPBrOVyJxABlp7 eAye2SqnhMewgjegZGl/xar3pGSSMCMZbEXFYQIR6msj4aHuUBYwX8CciRvFxxzIPPMG S8kLfuFid4k4FWa98dVMZOkXIZ/nw+z8tl5SquIkSalauv4R9e6gnyH/KMtQNcxrNx8o B4SqqEJn+Jj6qBI4jminLfQyTE54J+KnZ+NpF6sxlteKzqBSCf2IsAi2oS3rHOqePxgP UAO5inENLX+1P3vRt+Asjvz8+vpmhFNaCYbb7GOPSUEZ+xdY876C6NnYUcyDKixFdCTK jWoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258516; x=1729863316; 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=nky1P2dXpB22MDGCjnPFN5ftZZLoZSsMxjzNL1As6N8=; b=wGEKPPgrMjTu8+VWysdG0hM7t8yUH6WxnlmIg1yljROwzBEWu0kJB9ELvEJa8cOeM2 uURbLo+1cMuWXKvvLTnKT1CxVldK8pq3zAdjFN4P0slk1D7mVuBYklC6GXEZ+LaOROYB tzPd+aWdmK3FtrqTOIXO/PdXysfGRxIvTIGPHNf1BIBb8Lc4FVG/W5T/bX97+iXKcQB0 jT52vsmtnUIS3HXBH2WdlesY8dLI2UWYYYKbeMECJbamReZLd/wfc2uzwKCM4nkTgpEo j8HgI0f4ABdU2D4fFiX6+b48irp/1bOC/ipPsY1V8Jxw8cy8lyIm1+NvS+QnDnnQvDg3 t0RA== X-Forwarded-Encrypted: i=1; AJvYcCUv6413xHVDJgN/qw9bqpd0FwlKBsLeBGYssWx+VoVGWdKLC8lPXh/Z7fSWKbR41144r6En+IzALcpQNbchwm7EpLw=@vger.kernel.org, AJvYcCXeGNEekHSPmlJuNXmlfqgs/kM1iW0sb/6MIB8EArq/mBfPC6h667GlPvJ4MpbQ8X5alO9OXWpCpFM8sm4=@vger.kernel.org X-Gm-Message-State: AOJu0YyATIsjBO2xHqEL1mI2HvaiGiIvO5Midd6L4kLFpNPmERjjLHom vYaApm0ZvHgZk5nwkQRL22DlueNrcXk/BqMQnBdeLptMrMD3YWtvo0PpNA== X-Google-Smtp-Source: AGHT+IG5gRjrN1Z0bChB2aeQM+7T7a39cH2S6CZWTuHuTEnzM74YiLC0pml0E61PjQKK6C7CJalaGg== X-Received: by 2002:adf:cf08:0:b0:37c:d179:2f77 with SMTP id ffacd0b85a97d-37eab4d13aamr1697130f8f.12.1729258516265; Fri, 18 Oct 2024 06:35:16 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 v6 17/23] media: rzg2l-cru: csi2: Remove unused field from rzg2l_csi2_format Date: Fri, 18 Oct 2024 14:34:40 +0100 Message-ID: <20241018133446.223516-18-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Remove the unused `datatype` field from the `rzg2l_csi2_format` struct and update the `rzg2l_csi2_formats[]` array to reflect the updated structure. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c index dee8c1a749c7..7a658518b4d6 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 18 13:34:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841800 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3700D20493D; Fri, 18 Oct 2024 13:35:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258522; cv=none; b=kcgV7dE2VUkKt4hSLtzXRs8/fVpDj3JKrNy77QEwIUOEVv7gq8svpH9hHvx7SfVusbFwAAtBxlwtFdlIP2rq5ZPjm+wj4erNcH7Tk4V1kxXwS9z0bmjHqLg6Ph95sEWVP1uJRi2fv+aTi+VuPhAPafznFNj55Rri9UwN9seJons= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258522; c=relaxed/simple; bh=dObkFoQMfxWpnzmFLXeLG9Ub7x7dLl4erSWlskl+/0M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S7UjkwpRBuzlCB5A2w7guSPP1flEg/rxhvoI4HjOP6Mzx1q3G2JOWuEt03MKMJP8+96s2Pzs199D2nqRbuEHG96kJLkAe1mmgFVxFgKTQE08BmDX+oFyZMS0wCPCqfmCH83HDEVxfTifEiirpFNLbc0ecKAs0VVG1dP9lh30xUs= 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=XDeKnAKJ; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XDeKnAKJ" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-43158625112so19960635e9.3; Fri, 18 Oct 2024 06:35:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258517; x=1729863317; 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=KNd9OmmvhKypM/yaRV3iO9rQyA+b1IGapkHtHr4lWe0=; b=XDeKnAKJfJzdYpnNTaHUUkEpP4iqaiTtKNdEuOqZYabBF3KbhpiRc0wzAyWVBZEKob fwAM1pEXPkHbG3IgTNS6VxOjs5GtOx881TThCwsGAihr0PqR5Vj8qmjYUk151KI+eRO6 ZxpOecyN7KM9coJFqVf6+ayTE9QkJNaxrssyyLIRMMHSwlRIKCeU475EJg034IGUA2zT 9i2XGCWkIJNCxn5NuoGxs03waI5IX4VZMdIa3s5pWfxjznFUg22+X6X/quBzYjctSKnq WAPlJ0HoJcrHMWMs512BTUwkWBHMfWoCgo1udRPQocfYYk0asbvPSgZT60NnA51XQotw Mr6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258517; x=1729863317; 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=KNd9OmmvhKypM/yaRV3iO9rQyA+b1IGapkHtHr4lWe0=; b=grCWj4T8TOFvQcrjbhV6KmgzVSxGw1pq3ZxZsA4l4aT+dDXEptIpacLsLxmZfHXttc UBJpYafWwSeC3RDPC+J7JvnXsbiUOsZcMxMBrylmOLLVB+siSsenh3z+x1qhTA96hjLV M6QD2aN1X006/3wHmB/RaVSr6j5Kv2pqdtLRUmWnV8K2GTImNL/NI7Ao/sG5j4YY5XxK LzEXGnCuolFpqgVrxAmRmzQxCvPYSfoykNY+sII0jg212rl+1Z0vmoT4hc4nfi7M/H3D wn34QO7KNTQ9VY99y+zq3fL7ttFI38/UrvLgOrRsFoebkTG7gHjsyzGPTkt8GL0yTCFp qmiw== X-Forwarded-Encrypted: i=1; AJvYcCUAy4XIV48bzmH66B98dUn+ZcovbPYvD8yeI7RTw8qFBNCnGI5slUUG20ik6pyyV0wQrOqUnU3G023LjkE=@vger.kernel.org, AJvYcCUfWbGH/1FqHHzjV7tYAWpG4v3VoMnvKTn4g5omwKkhuiDoDhM7P3bY2IUvooHjoOPmGuH6Tn9ZsUuQDHRFw80+F78=@vger.kernel.org X-Gm-Message-State: AOJu0YyzvKP1xy+6phX9EeStHelWpydoqK52G1SbS9iLftxfJ19x8jgz YK5pxryloaSeMau7K3S9/I3qkYX+aNxKl5Wipyx6igfddp954iQj X-Google-Smtp-Source: AGHT+IGDra0I5QNOVRlXXtYMG4+qRmi7l7aBsDf/8ur0p+vY3TxhgyHbl0QJCaUJkDdbPQWRDSt4fQ== X-Received: by 2002:a05:600c:4f42:b0:431:44fe:fd9f with SMTP id 5b1f17b1804b1-431616a3ac4mr18375745e9.23.1729258517317; Fri, 18 Oct 2024 06:35:17 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 v6 18/23] media: rzg2l-cru: video: Implement .link_validate() callback Date: Fri, 18 Oct 2024 14:34:41 +0100 Message-ID: <20241018133446.223516-19-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Implement the `.link_validate()` callback for the video node and move the format checking into this function. This change allows the removal of `rzg2l_cru_mc_validate_format()`. Note, the fmt.format.code and fmt.format.field checks have be dropped as the subdev .set_fmt() handler ensures that those fields always hold valid values. 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 18 13:34:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841801 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.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 DA02D204953; Fri, 18 Oct 2024 13:35:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258522; cv=none; b=tEDzcGHhTv6bVAKunodw8OuTISjdSLoHSIGSCjNiDBljp4ZQhO4gMTEnTUN4GRVwzJ8mV6k2EReqjQh0Aa0TlIe3+b7Rc9pYTrIW5ydcar6lWBioi+atYIArrr+9C+SFWWR2Jmt6Q7MMLTJdisN5pXmLbE7ZK02YgSXcoIUzjW4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258522; c=relaxed/simple; bh=hNCd9uNtCRM2hwA8k/edRSCd9T31zSFg9BqyFyDvYD4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Icu5farPTbosf0a8lvg256aNQ2/gkYZSgYbHtZ2z7r3dPzlUK9awR8VMU7JgOdLlRT2/ev/Sjo8mCHhn1dhJkOVEKNFFSkOqyFgeqCQHBAGgrzk8O18+JEyOTE3kKnu6/A21iU+3wcV7x1tL3ZNkRnwhUK8ZuppWnL0qPf4ZREg= 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=g8XrAQWg; arc=none smtp.client-ip=209.85.221.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="g8XrAQWg" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-37d461162b8so1427275f8f.1; Fri, 18 Oct 2024 06:35:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258519; x=1729863319; 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=zo7pmWVX1OVaFTdkkZPlKolKf8bJGft6RtN49GD8+ys=; b=g8XrAQWgeapABLZ2J0I+77Ya8a6Ac5y9YAlvnT99bBCVcNW7nIwCg5Bl1bxwH5wh/I mA4xRaucmxzL15jT5D2vN1UV0ssf+uMLsQ/niqkkmLLcgErlfO4L+ezkTel5Dq9Jw7Ff tzoch/8saEotYCQDXjVguV4Gd2K0hfTAUYZm/2JgsmovP645BF26dNqDISRmCXSQZwUA i/Q614Gmxg9xJNG4XMBxDYfUgFSHJGqR0lfgaXJrXTYpQC5/qBfvouF4op0WdX23ynCt aY3ynIZ1AS7sCAcehtk4vCC/MxVslaPf2wFHVmy7EH2+5rlvhD94qsr5RXBsRhnLzmSl zLew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258519; x=1729863319; 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=zo7pmWVX1OVaFTdkkZPlKolKf8bJGft6RtN49GD8+ys=; b=I/EBtB16fdyFm25Lq/wQFS/yMxRSsrRQfFS0ba4sgqrrG8zF+WT91yh8k2K27RWe3j PkOD3H9Yhg3GyAh8u8ku1JXgDo4kqKrGk6/V8UwtVRD4O9IVmEpn7fUhhbM32Ad6PWNU +/+ySmgq2HZ2eaZoLQEytqY25f1xn4gOKl//UbMz04DATrLORh3qrK6jPZHjZMIKzp+o tI7wrsLu040O4ZuUXy8F3ubEkNNDtVbKFZbt6JCvxLCnIYuYI1kWF4Hb2zYGLphzqySg AJFGGch/yr06n9KpWoT0FCd4dkkf+yWRe0q6PEokxoLlVPqcVLMaeM2NRJz3A3UdI3tJ ecug== X-Forwarded-Encrypted: i=1; AJvYcCUa3Yz5aZ4do40S4YkEY/VptNzvykGiStm9tRgHWwAjWBQdgWXxZgfLsJJvv3InQ+f5hkm+8P9yuKI3250=@vger.kernel.org, AJvYcCUguO/L4slD4/r6sbiYv9yQUxJHySSMJgtb66Fog0Rhdjtc3Dmx84Up3ug6CdL45qo24/qFcWajWqfkz3Gn6d5k9Sk=@vger.kernel.org X-Gm-Message-State: AOJu0Yytr2SP/9A7hGWaSNdNJiHalKmaVPZU/HRWlXZh13pVgR3fSZ4p Pj1vIpFFBThq+yx/HlPt2BKRYVbbYB+e05habTE+g5Vj3BWwbySW X-Google-Smtp-Source: AGHT+IHsA660u5v21wJKhR99XiJHegM0AcG5/YRHw4S2pFNWY98a3Du0snvHav+L1CWNCp/S2DlihQ== X-Received: by 2002:a5d:44c8:0:b0:37d:501f:483f with SMTP id ffacd0b85a97d-37eab6ee112mr1632466f8f.44.1729258519021; Fri, 18 Oct 2024 06:35:19 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35:17 -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 v6 19/23] media: rzg2l-cru: csi2: Use rzg2l_csi2_formats array in enum_frame_size Date: Fri, 18 Oct 2024 14:34:42 +0100 Message-ID: <20241018133446.223516-20-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Make use of `rzg2l_csi2_formats` array in rzg2l_csi2_enum_frame_size() to validate if the `fse->code` is supported. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c index 7a658518b4d6..4073452f3a66 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 18 13:34:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841802 X-Patchwork-Delegate: kieran@bingham.xyz 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 7869C204F7D; Fri, 18 Oct 2024 13:35:22 +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=1729258524; cv=none; b=l3R2HvmZTG7vR4rZpgJnfkDrLBmqnqT2WHrv9QCZP030DaFtcXOIK3akbkvDQGeBCxkAp+9TlxJk36Gp0BjMvpEha1Ettg0xirz22rMIdfqsAKxRzru/oAD17n4N8hz1+7LLFK5aYWpYdt7sXdWUvwBcn67TRIAwmpesqbSH98U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258524; c=relaxed/simple; bh=dbBLP3+NjouqpjK/Rm2H9o60ChL3mY538dfZoaHJnrk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tvIt8+JwVYidZIygq+aDywtPffmVZzdSRJu/EFjGCcyZ2OubOpXGsZHFZp8kd/2cqtZxfwXx4gU4ExRjzYMatXg/DJ+6ZJmXadQsLpM5KFz9FQK3xK+wP5OoYFUrvIVBDZD7+KTNEw61zyJUPtH2S3Zm3Uu+eA8wHEplUzSGXfs= 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=TFuWGX4Y; 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="TFuWGX4Y" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-431481433bdso21471575e9.3; Fri, 18 Oct 2024 06:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258521; x=1729863321; 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=TFuWGX4YOtLNQ8OzReQhKUPVXGCpQxzgoS+J1JNc37sSQ2ElySlmRIbWwTk+yfbKoZ gPIlJURW7b6WrWBU1pwOv9FbSKIl743DQHsRg+o5aITg9/SHw1rMEIGApBTRpk6GOZfn GgdeVc65ALz5HnK+wJdHD8zWcMAvYA6QbGObSuVFnOm2REYtsmEaHHDWu3FJ7oMDX5z/ 9dpP7Whkgrw29FBN0BPURMtv+0LZcsKE7FavuEYW+v01TR4iqgR03gvyWGbIToraQWF3 0rD9Q2yXWPAwCyO28wA0oek6HUusL6MSI6QfsQZFKvCIkSABmFLX3zcDf9urp5ORT4fh VPtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258521; x=1729863321; 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=vMCUowPuiGG4jeTP+7jL/5j/g/Trkv/TCgl9LR/PMPbWEG6fBn2Z0xSfcBW9kiFwDK /AglHxYexQoK/aO6sAJIoRAOD8dGMGU+/0P4gNoKSCbAy9PLYonQ84URz1p8kQzoW54/ wrueQT3k4z4hyMyM+9Hfelv98AGJ0y88smkQmx0ipgAq9BvOuD3fO1ZxrGVOVExr/HDf Gc++mV+NlKqW7qxCoR6rW3Llebf0Qc4AeMWJ+DsIZIwmlx0CXk7o7qXebX+Gez91QT1I 1tyrbK5ucrXbWtvKpW8pv5bw7k2oxKBpH6Et8tQG/LvWElp6MdT0U7c+qJFYHKYhRjIH N+Jg== X-Forwarded-Encrypted: i=1; AJvYcCVdBiEipmDOLdFI0nqP4abap4EuNpee4pIYjhRhHPUjtonudZcjui1s5N3y7sDDUbxsJ2iVsA34HKq9j+M=@vger.kernel.org, AJvYcCWjH2heSyG4u/7pyPwU1+vmvSsvgKHJL0dI5IjcHseh3pUSEp+lvrx9zVk52srscnmNxYMywPSU7TxvANUQgm6vo9c=@vger.kernel.org X-Gm-Message-State: AOJu0YwKNgoKS96TMuWmr37SANr/bOwJ2Zl6jRD03IsY+ZnZ3u0iZsEP izmRZkK6r2ONmRYGyMyeUiU3Fr4E1JvnRufkhwlDMQQMyyRQRzAL X-Google-Smtp-Source: AGHT+IE/8ta528YuHeu5X79u5PL/Z7iTJ9aCJFTiAlRITMb9G+RqR04lRLi+YlHxf14zlEIDD4ms5A== X-Received: by 2002:adf:ee0f:0:b0:37c:c5fc:89f4 with SMTP id ffacd0b85a97d-37eb489803bmr2066665f8f.51.1729258520536; Fri, 18 Oct 2024 06:35:20 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 v6 20/23] media: rzg2l-cru: Refactor ICnDMR register configuration Date: Fri, 18 Oct 2024 14:34:43 +0100 Message-ID: <20241018133446.223516-21-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Refactor the ICnDMR register configuration in `rzg2l_cru_initialize_image_conv()` by adding a new member `icndmr` in the `rzg2l_cru_ip_format` structure. Suggested-by: Laurent Pinchart Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h | 4 ++++ drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 1 + .../media/platform/renesas/rzg2l-cru/rzg2l-video.c | 12 ++++-------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h index 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 18 13:34:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841803 X-Patchwork-Delegate: kieran@bingham.xyz Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6A36205143; Fri, 18 Oct 2024 13:35:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258525; cv=none; b=dEn6Fwq4H3O19lhbM1HVb3MGlx1Rk7dSx7Nv2CSLxJhSKONgmToIWOjyyrz5HgsWRwlq1GczuCXhWfdaSdspXiA4GwDKp6cxP7FvriY5qeMu3wWQSANPdnzm3JvqMYlDk1W3RxBnfQJW/OAoVbzdI8Et7KSo8I6t3mgJ31bBuSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258525; c=relaxed/simple; bh=BPiVuaP7GYbvOOAWHo7KiC1d1w2BNKxjcvojtUwI2BI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TX0XtDS1knamozN2VdF3JSdU8i2FFZRNCnYQvv6AScr/eM8jrdEhrFjjpK4Q24qnW4nT6yJ/6SDTmNRVskChwE6qR1gZqAwUSOeLibjMn+XniMyNvRWrFs1phxS11y6DOnqh5W+sUMwfNWt9Oe+FoO1BTxzJHy7qtUp+AON3o0Y= 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=OKfdDsNx; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OKfdDsNx" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-43155abaf0bso20168815e9.0; Fri, 18 Oct 2024 06:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258522; x=1729863322; 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=7zdVoC1QyRKvNRCTYp7dgVNxaoOkT1LXCY4uVFYfy9s=; b=OKfdDsNx+TLYoY/BPrnIHrzL36/xiXZUv7d6Va0fExMvwUGwYNJFohfJx6WuAgt4T4 nnvBbXA8KsEVZGtFXXk5wwr3HrUhLSzUMDwlb9JJ0OaQ9cO1vGB3KQND950CH1Gi29r0 dbj+QzP4z3fCy2fpGX2jv7g2wWonMGiT9BAXHU1K3O8kRCn1hFu/sjHWa06wd98Fn4Iw p/Kxwezui5n7xGPZvd73+bs11wnQDV56aSLnyXZMh1vWwxTIeHFZnGbbYm4x/CagJmNp 3w+L9HZBp5FqfCHrqEZhLSqiEWKE1jOFb0WKmZ4pJB9yapJPoobNbApv5ZPFpFxOakS3 ToZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258522; x=1729863322; 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=7zdVoC1QyRKvNRCTYp7dgVNxaoOkT1LXCY4uVFYfy9s=; b=RtTSJgHnRkLznYbtM0OuyT/ldHnR35SKu/lAirGlNn+2PbCPmlRwkZD0tq9TtcrWP/ UGs5JYIH5P/CRR7HlRDNM9uZkJkWnIjNFdFcM/ZJYFq6A2LUQ1o+8LIPYY2AC/+L8N97 yesBeXhj2MWUXkHC9X95jZVGzoVBbfv+YhgL4OUi68f5uzBh0eYCgvUVw8WEcyG5RRz2 WEVCsmVA47TuvRh5zIAEUofdkcI/z4Q+omYIGW9nAwHCEWGouKVykvjIEoJ4V/6x8Auy pAiJwQgIs8kITCSDchYKDOZlzz1nEZ2C9e1dz1PiEKpyi3BllZdyI8mni6BLx0szi7Bu DWew== X-Forwarded-Encrypted: i=1; AJvYcCX1nSb4ABBvQXzuBWwDG1rqkS+p2fr/xrTER6QDci/93dUznOe0L1aNVVmMy7dvQCZjL/aM8b0xHANBxXg=@vger.kernel.org, AJvYcCX3U8oQII8IDkTkB+mNsopmhJfQbILeQ7PZm8SEk4+G/NlsYCnEDwDehLAUXua5JrgB1pbe5dNWVVWjpFpb9MowCjw=@vger.kernel.org X-Gm-Message-State: AOJu0YwDGSlsEzTMq1jlaE3t8Vnc3veVQK2mOUBp9dlfhLMUrqCkeqNA q32TqeIxbNrY5kpCHJrb4VlCuHLl1ayyTSYKmxYewp+M4ZuKDbrn X-Google-Smtp-Source: AGHT+IHDrPpks+NUj0h5ZLD26RD2mVdfRw9BYuMyAuz+3Jr8JrEkw73WoPZcchfq9AQFypZkpGVoag== X-Received: by 2002:a05:600c:4f42:b0:431:44fe:fd9f with SMTP id 5b1f17b1804b1-431616a3ac4mr18377475e9.23.1729258521626; Fri, 18 Oct 2024 06:35:21 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 v6 21/23] media: rzg2l-cru: Add support to capture 8bit raw sRGB Date: Fri, 18 Oct 2024 14:34:44 +0100 Message-ID: <20241018133446.223516-22-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Add support to capture 8bit Bayer formats. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- .../platform/renesas/rzg2l-cru/rzg2l-csi2.c | 4 +++ .../platform/renesas/rzg2l-cru/rzg2l-ip.c | 28 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c index 4073452f3a66..881e910dce02 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 18 13:34:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841804 X-Patchwork-Delegate: kieran@bingham.xyz 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 B3AB3205AA5; Fri, 18 Oct 2024 13:35:24 +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=1729258526; cv=none; b=L0E6DVYFvRx7izPJWcAja8a/lVs7ZMWl5R/Qr7GFZsZGKPmiR7T1VJb8kLum91/a0+iczdlDVQusjL0/XKs0oPxn/UcL3BnGtgOrDMkHaOpISRfXgl7HDhPo3ZypTn3TFAt5NnhctuKds0KzK1o32EgluVW7Oagdoegdnvo27PY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258526; c=relaxed/simple; bh=4Z4zcz6qi1DRZkhl3ogXePn4yxxghDB3ja6oNYNj7pM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ICtFAHpIxdDn2KGdMDc43vrRt64mThwHXlJvBUXx0STe5PMcAHHJb0kWbT7D0O5mSjFiYlyqxj1wgvHjWZufduKCmf2GiVbhlNl5mjZYpKyN72dy3ra71hP/5YDulQGFtc6YByAPlmkphzr119rcLrBHgwhSFo1aaz/is5xe9x0= 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=LoAsJB/3; 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="LoAsJB/3" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-43118c9a955so20182935e9.3; Fri, 18 Oct 2024 06:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258523; x=1729863323; 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=LoAsJB/3N4b6s3sbLYgZ32RTs837O0RsUkW5idECh24HwFKXyQgHSODCnzbpdPx3Xw PGlSuu1negqb9kPGFzsla9lua0pRwacU/mkoCMsk18bMf078vaipLeFHaWtAhMYBMP1t 0sdgT3KqBsapzE7Btk0uaIZ4Lyd8DVgpEc/mKoR0GkvPh+/6a9IPmdY9t7V8FXeHVKi2 L0wqDnlH0KG65gDkyvtgeQLrgGBbOqRxf/sZvTtWfmgh1oRhlYd7ZBQXMVLsAqfqCj29 QHSUZs4E6GgzoBtNwSQRWItZLskvanbUDktnxz18Jxhf9sSgeFVZ9GjojjCEDeP+LQgC 6b3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258523; x=1729863323; 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=pVU8WSR+C5mXX2CbSNXxU7jXqARSmnpapd1BqJK3FV2ngLfU4W16Ac6XZ8VUxNjq4A RfZQjEiHslLTRjMQzcr8SS9FlxRDHDX111OeYEBcEVi8zMeL/iC2034J793qcqAxxI9t lhyRIYy/4FJIHeQcx+aEMF9dC0LSqnrl3QvqCSY2Jnc+ytU7Q2tKJv0+agd+o1jqZH/C 0SZ+mld/5Bf4OjpebkyebqAqReE3aFYK6xQfzCGbqOk4GD27L8A59Xb0E1MHV6d6+uTP 6uaupTPCnl5iWdY4elY91NSLoQVF3iyfZSQzKBLtm4Ls3R9Vc9yy5bqYnVHiLL4YwnWv WmAw== X-Forwarded-Encrypted: i=1; AJvYcCVFtt0YVJi0Uq649qJvezFgy3kLWIbgOBielyqohLZo3+HD1k0YqkCZYK2resuFEy1Vw9TeRXhFFO3S2uw=@vger.kernel.org, AJvYcCWaWVL/DS+6WiM4gML0ZPdWHNv+An95d1ZTTf7QvP3Iag4gTW4yVwhnUrPbMkd03J8t+y4q+xHNpZdYzpgI2ON0lhU=@vger.kernel.org X-Gm-Message-State: AOJu0YzpmGEfNxW41ohRfoIenX9c6DGzCCGOQhIkiWiTPIPT/m/rTgdz GqRsUhOZNIt6Q5nCRL4Gib2pN5pkSCo4+SzI5Dpb0AMq3gNEVBIeS7IPjg== X-Google-Smtp-Source: AGHT+IFm/sQpEJx8xrU7sZUzaW0cpIpGkhzvT5j0SpN4+A2vDu2nJ8j3l3AlHcdYTN3Qy67scIWS2A== X-Received: by 2002:adf:fe0c:0:b0:37d:4517:acdb with SMTP id ffacd0b85a97d-37ea218248fmr1772402f8f.20.1729258522751; Fri, 18 Oct 2024 06:35:22 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 v6 22/23] media: rzg2l-cru: Move register definitions to a separate file Date: Fri, 18 Oct 2024 14:34:45 +0100 Message-ID: <20241018133446.223516-23-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Move the RZ/G2L CRU register definitions from `rzg2l-video.c` to a dedicated header file, `rzg2l-cru-regs.h`. Separating these definitions into their own file improves the readability of the code. Suggested-by: Laurent Pinchart Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- .../renesas/rzg2l-cru/rzg2l-cru-regs.h | 80 +++++++++++++++++++ .../platform/renesas/rzg2l-cru/rzg2l-cru.h | 2 - .../platform/renesas/rzg2l-cru/rzg2l-ip.c | 1 + .../platform/renesas/rzg2l-cru/rzg2l-video.c | 69 +--------------- 4 files changed, 82 insertions(+), 70 deletions(-) create mode 100644 drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru-regs.h diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru-regs.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru-regs.h new file mode 100644 index 000000000000..1c9f22118a5d --- /dev/null +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru-regs.h @@ -0,0 +1,80 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * rzg2l-cru-regs.h--RZ/G2L (and alike SoCs) CRU Registers Definitions + * + * Copyright (C) 2024 Renesas Electronics Corp. + */ + +#ifndef __RZG2L_CRU_REGS_H__ +#define __RZG2L_CRU_REGS_H__ + +/* HW CRU Registers Definition */ + +/* CRU Control Register */ +#define CRUnCTRL 0x0 +#define CRUnCTRL_VINSEL(x) ((x) << 0) + +/* CRU Interrupt Enable Register */ +#define CRUnIE 0x4 +#define CRUnIE_EFE BIT(17) + +/* CRU Interrupt Status Register */ +#define CRUnINTS 0x8 +#define CRUnINTS_SFS BIT(16) + +/* CRU Reset Register */ +#define CRUnRST 0xc +#define CRUnRST_VRESETN BIT(0) + +/* Memory Bank Base Address (Lower) Register for CRU Image Data */ +#define AMnMBxADDRL(x) (0x100 + ((x) * 8)) + +/* Memory Bank Base Address (Higher) Register for CRU Image Data */ +#define AMnMBxADDRH(x) (0x104 + ((x) * 8)) + +/* Memory Bank Enable Register for CRU Image Data */ +#define AMnMBVALID 0x148 +#define AMnMBVALID_MBVALID(x) GENMASK(x, 0) + +/* Memory Bank Status Register for CRU Image Data */ +#define AMnMBS 0x14c +#define AMnMBS_MBSTS 0x7 + +/* AXI Master Transfer Setting Register for CRU Image Data */ +#define AMnAXIATTR 0x158 +#define AMnAXIATTR_AXILEN_MASK GENMASK(3, 0) +#define AMnAXIATTR_AXILEN (0xf) + +/* AXI Master FIFO Pointer Register for CRU Image Data */ +#define AMnFIFOPNTR 0x168 +#define AMnFIFOPNTR_FIFOWPNTR GENMASK(7, 0) +#define AMnFIFOPNTR_FIFORPNTR_Y GENMASK(23, 16) + +/* AXI Master Transfer Stop Register for CRU Image Data */ +#define AMnAXISTP 0x174 +#define AMnAXISTP_AXI_STOP BIT(0) + +/* AXI Master Transfer Stop Status Register for CRU Image Data */ +#define AMnAXISTPACK 0x178 +#define AMnAXISTPACK_AXI_STOP_ACK BIT(0) + +/* CRU Image Processing Enable Register */ +#define ICnEN 0x200 +#define ICnEN_ICEN BIT(0) + +/* CRU Image Processing Main Control Register */ +#define ICnMC 0x208 +#define ICnMC_CSCTHR BIT(5) +#define ICnMC_INF(x) ((x) << 16) +#define ICnMC_VCSEL(x) ((x) << 22) +#define ICnMC_INF_MASK GENMASK(21, 16) + +/* CRU Module Status Register */ +#define ICnMS 0x254 +#define ICnMS_IA BIT(2) + +/* CRU Data Output Mode Register */ +#define ICnDMR 0x26c +#define ICnDMR_YCMODE_UYVY (1 << 4) + +#endif /* __RZG2L_CRU_REGS_H__ */ diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h index 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 From patchwork Fri Oct 18 13:34:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 13841805 X-Patchwork-Delegate: kieran@bingham.xyz 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 A1882205AC2; Fri, 18 Oct 2024 13:35:25 +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=1729258527; cv=none; b=c8o4xgXV7DIWvDfqA9MmUF1lo9p/sa8VyFXkWhyWMm2w90hzsS+dFjimntL6NA/pXf0ysfwzoWXYsHwdkgKeghCcRgccRcr0hKe5Ef601JCDp1+aCYcw4cY2WpTbQILXDT5kSXPTN7eWvHtnqPMzbflAm3VYZVySnx8ES1N03Gk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729258527; c=relaxed/simple; bh=9EyKVQGfxkM4TUjIMOXbEc+giGmM+qPAFclUfRsiLC8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I8ghcmWsLrZ/pLGj6jgxEvJpNcMZVw0RTY0TeN1gtqiBZoqvHUnk6sbqH81OfDfaNYVSyKj9DzodszcKpKw9Om4Ax/vFnfaQvSZ41MLCx78pWQtmD1dXVl8IjMKBB7JapyrK8Etbbg88CKd4RcdlEGezGD8pVfOiKOydLwJQgj4= 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=Pyl+kNbV; 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="Pyl+kNbV" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-43159c9f617so17787245e9.2; Fri, 18 Oct 2024 06:35:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729258524; x=1729863324; 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=mXXSJSHNhlnPKdDxv7AsqXdKQPS/9DW+EDxhQqaRwPg=; b=Pyl+kNbVqS35tU/epIGhHs8NfkeVe5BFdJEya3Mp060ZGtdiDwBU0LBfYqXOBgI5Tq Lyy9ybJvTbbmrz3XDe4f1lf6ZkNiP5IHfKKhpPXlloub5y48DHJ85L3YHh0goRlHd6dQ xlvqBUyWgBswqEuihIo1trm2qEFgFcq6AHHSJbPhrHrLFtV/345FOYEm6O3d5VldJfxh YoUijqV/OSArcRU1AVNMCGnDjPrik7P4YuCCZkoT0hztDq8NdVkCRvIReiw55Y4rI0Xq yWy098oPRTntaW6JbjPCTq9nxYpmI5zTq6Y9OFOH6fGGebTN2HPTKJf9BjNx6xV/b6Em ZDSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729258524; x=1729863324; 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=mXXSJSHNhlnPKdDxv7AsqXdKQPS/9DW+EDxhQqaRwPg=; b=GnzLXEiItX8VVWa3UEvfgwvYEFcOrSYjzU9k/bRr52SXYyqW737RxcYBdi0cMd7bLY 5sMj6JMAhi42Mar8Sqo1wzi87pAlhVjLqREpbFj9UiR/7N8MW0Eu6xQYnI57CkuXa/JZ n9mO56oGG1Yl0ASK9pYuZ7uVvVpowLUFKYF71Im+VW9ywvC0v0R8cLKb8GiAIeAHb+kO I0T0Kbm6i2ivuWkv5Z+yzqONI2G0ySHnstlezQD9tEFZzEqjKAazXTMmAAlLmm+JqJaF MavnH70W3i4ZigiEZBVjlXfdfh/lFzwq7v2cFFpNAzEKvBpe+q5+EgydiKKhto4cXLvU ThVg== X-Forwarded-Encrypted: i=1; AJvYcCUyr/7PrCOt1Kwn8pDjAbPfqFFWmHT2X4zyJOyHjaio1S0MCXPM/OgCfOVgQLHzRjObpVL+Mhi9r6FpoAU2q4Mc6/w=@vger.kernel.org, AJvYcCXHJUj0/d6Y6kHyD3Qp51ZlC+odmT0m7lHuaZjKdsFBvm9jVPJoA2Hza+8JtaAyoH3s+CoRKCdOn0YaUIk=@vger.kernel.org X-Gm-Message-State: AOJu0YwxquRrxEl8c8XtQWli5y2zIJrFrpmAeCW6PnsWPBPQS70Fmgul Fnmv8rVRZUXVtu4YILTcJBg+JBduTKnBXZcN5bOdr1E2GD7gooTc X-Google-Smtp-Source: AGHT+IHJMxHpFEdcW9IKa5n+g65KS3gTMOwo8H4sVtrnj8ptd1W1tUyE2m1L4gaxXDxe8EqhOXAwng== X-Received: by 2002:a05:600c:1e04:b0:42f:4f6:f8f3 with SMTP id 5b1f17b1804b1-4316162297emr17617955e9.7.1729258523801; Fri, 18 Oct 2024 06:35:23 -0700 (PDT) Received: from localhost.localdomain ([2a06:5906:61b:2d00:d416:f456:3869:adaf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e0a7acsm24320475e9.22.2024.10.18.06.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:35: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 v6 23/23] media: renesas: rzg2l-cru: Add 'yuv' flag to IP format structure Date: Fri, 18 Oct 2024 14:34:46 +0100 Message-ID: <20241018133446.223516-24-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20241018133446.223516-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Lad Prabhakar Add a 'yuv' flag to the `rzg2l_cru_ip_format` structure to indicate whether a given format is YUV-based and update the `rzg2l_cru_ip_formats` array with this flag appropriately. This change enables a more efficient way to check if the input and output formats use the same colorspace. With this change, we can eliminate the use of `v4l2_format_info()` in `rzg2l_cru_initialize_image_conv()` as the necessary details for the source and destination formats are already available through the `yuv` flag. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h | 2 ++ drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 5 +++++ drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 6 +----- 3 files changed, 8 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 a83e78d9b0be..8b898ce05b84 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h @@ -69,6 +69,7 @@ struct rzg2l_cru_ip { * @format: 4CC format identifier (V4L2_PIX_FMT_*) * @icndmr: ICnDMR register value * @bpp: bytes per pixel + * @yuv: Flag to indicate whether the format is YUV-based. */ struct rzg2l_cru_ip_format { u32 code; @@ -76,6 +77,7 @@ struct rzg2l_cru_ip_format { u32 format; u32 icndmr; u8 bpp; + bool yuv; }; /** diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index d935d981f9d3..76a2b451f1da 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -18,6 +18,7 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { .format = V4L2_PIX_FMT_UYVY, .bpp = 2, .icndmr = ICnDMR_YCMODE_UYVY, + .yuv = true, }, { .code = MEDIA_BUS_FMT_SBGGR8_1X8, @@ -25,6 +26,7 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { .datatype = MIPI_CSI2_DT_RAW8, .bpp = 1, .icndmr = 0, + .yuv = false, }, { .code = MEDIA_BUS_FMT_SGBRG8_1X8, @@ -32,6 +34,7 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { .datatype = MIPI_CSI2_DT_RAW8, .bpp = 1, .icndmr = 0, + .yuv = false, }, { .code = MEDIA_BUS_FMT_SGRBG8_1X8, @@ -39,6 +42,7 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { .datatype = MIPI_CSI2_DT_RAW8, .bpp = 1, .icndmr = 0, + .yuv = false, }, { .code = MEDIA_BUS_FMT_SRGGB8_1X8, @@ -46,6 +50,7 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { .datatype = MIPI_CSI2_DT_RAW8, .bpp = 1, .icndmr = 0, + .yuv = false, }, }; diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index a4dc3689599c..e980afc32504 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -210,7 +210,6 @@ 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_video_fmt; const struct rzg2l_cru_ip_format *cru_ip_fmt; @@ -225,11 +224,8 @@ 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 (v4l2_is_format_yuv(src_finfo) == v4l2_is_format_yuv(dst_finfo)) + if (cru_ip_fmt->yuv == cru_video_fmt->yuv) rzg2l_cru_write(cru, ICnMC, rzg2l_cru_read(cru, ICnMC) | ICnMC_CSCTHR); else