From patchwork Mon Mar 17 11:56:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 14019111 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D8D4238D2B; Mon, 17 Mar 2025 11:57:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742212659; cv=none; b=WabO2A8bD/7uOkU0XIiIIyxMWZ4/hHuAUtAjCUbYQbd5tvEHfMnthL8oXhZ775aBJVXyiGTa+Bgzh/jyIK5aFGcz3vvkjI2Xa8xsEdsLTFQSv984/KHAml0poUUGQ1SCOdR3R/UYq9yc4S0UDRHvuIcs/wv8qOo21r9YkQVIXDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742212659; c=relaxed/simple; bh=67W3hpK6t4UKZQbz1TQUlLYyHuwLjfy2UxxPfU8G9nQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NQkFhaNh4rgZxjodLknbWc7EbEPmCtUuouhPamtPuu8dZOicwUC6UKeFvuvXaQDcwZqMs+UXTYmCuAspRUquFTqLxKL7TZeRw6iW6Zj5JrJNhzG3dCa9Kbg0KS8WDt+eis6ohr11W0SGBdIL2mHiHdVqXlqDvfHIOYeOg/k5tk0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=oznZlGRI; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="oznZlGRI" Received: from [192.168.1.102] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AB3C88DB; Mon, 17 Mar 2025 12:55:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742212546; bh=67W3hpK6t4UKZQbz1TQUlLYyHuwLjfy2UxxPfU8G9nQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=oznZlGRIdyVoTzthgSnoWq9uwHXvqNtTv7eEct4kvtkqYGAxtyhtrYbj+THNP2tJQ eJVwWviEoyPRPY01yaQFxQaP9ZM1G12HjpL1IxZKEfN46J567qxgPBuevK7jlmha2B SPSjKyXoRTEF8NynvlggOOkxfnZ/t+dhzHIU2X4o= From: Jacopo Mondi Date: Mon, 17 Mar 2025 12:56:39 +0100 Subject: [PATCH v3 1/7] media: vsp1: Add support IIF ISP Interface Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-v4h-iif-v3-1-63aab8982b50@ideasonboard.com> References: <20250317-v4h-iif-v3-0-63aab8982b50@ideasonboard.com> In-Reply-To: <20250317-v4h-iif-v3-0-63aab8982b50@ideasonboard.com> To: Laurent Pinchart , Kieran Bingham , =?utf-8?q?Niklas?= =?utf-8?q?_S=C3=B6derlund?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Jacopo Mondi , Laurent Pinchart , =?utf-8?q?Ni?= =?utf-8?q?klas_S=C3=B6derlund?= X-Mailer: b4 0.15-dev-1b0d6 X-Developer-Signature: v=1; a=openpgp-sha256; l=12781; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=67W3hpK6t4UKZQbz1TQUlLYyHuwLjfy2UxxPfU8G9nQ=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBn2A4kyfYJtA7KK1gKamTiq8X7NdquXGU8NR1py 6b/8yiBgLWJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ9gOJAAKCRByNAaPFqFW PBKUEAC09amFAYjEtkw2WaYlsP0tADAhA39KuuSMB2GlPUJIcP/KGLIij3yoOwRGB8hXWhfYCpl kQk7gzdpaTPSmw9wrJARt8/u3/mHHtyaLx69yGCwrglOj2r0zH5NylXk3/rJYJehTgnx4JGKQ6Y 2JvoKvs3NLTiICs/tGSh38A/MnXf7UkrQgFRU/9gqjusy71dk8CoGmD6EQXk7Yt2N4lWgucg95z YOTSSLYIC8WS3Uq/cnBrojmCdb1GkR4M8cINVuizVEv8/SWk7U//pdxfdbeANIeOgyFk8Ki1n8/ XhzfaKMbhlM9w3H+J1Rc/3RkZ4dWHLrrhv4O8SWBa1pW2m3NVPKYNOrSNOnlk9s6Lf9k6+P504A a5TcH6gwb6gU/AjzxCc3RmE9lcF13oty+vuMtDTYcXF6wS6xRyzo8pnrRy2TtxEVnFd35kRO+2n c6HSZOBNDc+hRTjaC3HvcBr/Atuv2rwKE1jqjyW0yAdtKeGJUMNoH6QVGhA0t5ut4zY52w0StIS fxtCIxgmfpYrdQ1DFwasjMJZuh3QcIys87g1MfEV2DxROtJ0Ip9wAyR2CCnyCswbHR9aYwEcoaa eJe7kxObiJNXZ9kUktSedufxGJD4TzZtTFiErP5UeDo+m0Y934T2yL0PJSp7+kE/eirW3OVqCI1 fSv6qRIXJREuNAQ== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The IIF (ISP InterFace) is a VSP2 function that transfers data to the ISP by reading from external memory through two RPF instances. Add support for it in the vsp1 driver by introducing a new entity type. The sole required operation is to enable the IIF function during configure_stream(). Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Tested-by: Niklas Söderlund Signed-off-by: Jacopo Mondi --- v2->v3: - Replace SRGGB codes with luma-only - Fix CI loop warning report - Drop a hunk that was not meant to be there --- drivers/media/platform/renesas/vsp1/Makefile | 2 +- drivers/media/platform/renesas/vsp1/vsp1.h | 3 + drivers/media/platform/renesas/vsp1/vsp1_drv.c | 11 ++ drivers/media/platform/renesas/vsp1/vsp1_entity.c | 8 ++ drivers/media/platform/renesas/vsp1/vsp1_entity.h | 1 + drivers/media/platform/renesas/vsp1/vsp1_iif.c | 121 ++++++++++++++++++++++ drivers/media/platform/renesas/vsp1/vsp1_iif.h | 26 +++++ drivers/media/platform/renesas/vsp1/vsp1_pipe.c | 1 + drivers/media/platform/renesas/vsp1/vsp1_pipe.h | 1 + drivers/media/platform/renesas/vsp1/vsp1_regs.h | 8 ++ 10 files changed, 181 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas/vsp1/Makefile b/drivers/media/platform/renesas/vsp1/Makefile index 4bb4dcbef7b55be7a40231a04e14029911da9beb..de8c802e1d1a16aabe1326fc8c27be33ad2b2e10 100644 --- a/drivers/media/platform/renesas/vsp1/Makefile +++ b/drivers/media/platform/renesas/vsp1/Makefile @@ -5,6 +5,6 @@ vsp1-y += vsp1_rpf.o vsp1_rwpf.o vsp1_wpf.o vsp1-y += vsp1_clu.o vsp1_hsit.o vsp1_lut.o vsp1-y += vsp1_brx.o vsp1_sru.o vsp1_uds.o vsp1-y += vsp1_hgo.o vsp1_hgt.o vsp1_histo.o -vsp1-y += vsp1_lif.o vsp1_uif.o +vsp1-y += vsp1_iif.o vsp1_lif.o vsp1_uif.o obj-$(CONFIG_VIDEO_RENESAS_VSP1) += vsp1.o diff --git a/drivers/media/platform/renesas/vsp1/vsp1.h b/drivers/media/platform/renesas/vsp1/vsp1.h index 2f6f0c6ae55514d312e48232a5f8c8673f69ba13..263024639dd2a7564fc70ad52dbe17f9a5279f45 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1.h +++ b/drivers/media/platform/renesas/vsp1/vsp1.h @@ -32,6 +32,7 @@ struct vsp1_clu; struct vsp1_hgo; struct vsp1_hgt; struct vsp1_hsit; +struct vsp1_iif; struct vsp1_lif; struct vsp1_lut; struct vsp1_rwpf; @@ -56,6 +57,7 @@ struct vsp1_uif; #define VSP1_HAS_BRS BIT(9) #define VSP1_HAS_EXT_DL BIT(10) #define VSP1_HAS_NON_ZERO_LBA BIT(11) +#define VSP1_HAS_IIF BIT(12) struct vsp1_device_info { u32 version; @@ -91,6 +93,7 @@ struct vsp1_device { struct vsp1_hgt *hgt; struct vsp1_hsit *hsi; struct vsp1_hsit *hst; + struct vsp1_iif *iif; struct vsp1_lif *lif[VSP1_MAX_LIF]; struct vsp1_lut *lut; struct vsp1_rwpf *rpf[VSP1_MAX_RPF]; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drv.c b/drivers/media/platform/renesas/vsp1/vsp1_drv.c index 9fc6bf624a520ae38e9c5f30dfa4dfa412eec38e..d13e9b31aa7cff8610ea196ae4de88ab22e44e0f 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_drv.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_drv.c @@ -29,6 +29,7 @@ #include "vsp1_hgo.h" #include "vsp1_hgt.h" #include "vsp1_hsit.h" +#include "vsp1_iif.h" #include "vsp1_lif.h" #include "vsp1_lut.h" #include "vsp1_pipe.h" @@ -340,6 +341,16 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) &vsp1->entities); } + if (vsp1_feature(vsp1, VSP1_HAS_IIF)) { + vsp1->iif = vsp1_iif_create(vsp1); + if (IS_ERR(vsp1->iif)) { + ret = PTR_ERR(vsp1->iif); + goto done; + } + + list_add_tail(&vsp1->iif->entity.list_dev, &vsp1->entities); + } + /* * The LIFs are only supported when used in conjunction with the DU, in * which case the userspace API is disabled. If the userspace API is diff --git a/drivers/media/platform/renesas/vsp1/vsp1_entity.c b/drivers/media/platform/renesas/vsp1/vsp1_entity.c index 8b8945bd8f108354f1b484530bc496dbac7d3d88..2096a09a12780ce64d9e8690aa4363bdaef3521e 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_entity.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_entity.c @@ -63,9 +63,14 @@ void vsp1_entity_route_setup(struct vsp1_entity *entity, /* * The ILV and BRS share the same data path route. The extra BRSSEL bit * selects between the ILV and BRS. + * + * The BRU and IIF share the same data path route. The extra IIFSEL bit + * selects between the IIF and BRU. */ if (source->type == VSP1_ENTITY_BRS) route |= VI6_DPR_ROUTE_BRSSEL; + else if (source->type == VSP1_ENTITY_IIF) + route |= VI6_DPR_ROUTE_IIFSEL; vsp1_dl_body_write(dlb, source->route->reg, route); } @@ -528,6 +533,9 @@ struct media_pad *vsp1_entity_remote_pad(struct media_pad *pad) { VI6_DPR_NODE_WPF(idx) }, VI6_DPR_NODE_WPF(idx) } static const struct vsp1_route vsp1_routes[] = { + { VSP1_ENTITY_IIF, 0, VI6_DPR_BRU_ROUTE, + { VI6_DPR_NODE_BRU_IN(0), VI6_DPR_NODE_BRU_IN(1), + VI6_DPR_NODE_BRU_IN(3) }, VI6_DPR_NODE_WPF(0) }, { VSP1_ENTITY_BRS, 0, VI6_DPR_ILV_BRS_ROUTE, { VI6_DPR_NODE_BRS_IN(0), VI6_DPR_NODE_BRS_IN(1) }, 0 }, { VSP1_ENTITY_BRU, 0, VI6_DPR_BRU_ROUTE, diff --git a/drivers/media/platform/renesas/vsp1/vsp1_entity.h b/drivers/media/platform/renesas/vsp1/vsp1_entity.h index 1bcc9e27dfdc7385e91987c84c46fc3725f3b90e..bdcb780a79dafccda3843bd65d337b64d6e12eb3 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_entity.h +++ b/drivers/media/platform/renesas/vsp1/vsp1_entity.h @@ -28,6 +28,7 @@ enum vsp1_entity_type { VSP1_ENTITY_HGT, VSP1_ENTITY_HSI, VSP1_ENTITY_HST, + VSP1_ENTITY_IIF, VSP1_ENTITY_LIF, VSP1_ENTITY_LUT, VSP1_ENTITY_RPF, diff --git a/drivers/media/platform/renesas/vsp1/vsp1_iif.c b/drivers/media/platform/renesas/vsp1/vsp1_iif.c new file mode 100644 index 0000000000000000000000000000000000000000..5dd62bebbe8ca1a99a978b66a943fe986dd44315 --- /dev/null +++ b/drivers/media/platform/renesas/vsp1/vsp1_iif.c @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * vsp1_iif.c -- R-Car VSP1 IIF (ISP Interface) + * + * Copyright (C) 2025 Ideas On Board Oy + * Copyright (C) 2025 Renesas Corporation + */ + +#include "vsp1.h" +#include "vsp1_dl.h" +#include "vsp1_iif.h" + +#define IIF_MIN_WIDTH 128U +#define IIF_MIN_HEIGHT 32U +#define IIF_MAX_WIDTH 5120U +#define IIF_MAX_HEIGHT 4096U + +/* ----------------------------------------------------------------------------- + * Device Access + */ + +static inline void vsp1_iif_write(struct vsp1_dl_body *dlb, u32 reg, u32 data) +{ + vsp1_dl_body_write(dlb, reg, data); +} + +/* ----------------------------------------------------------------------------- + * V4L2 Subdevice Operations + */ + +static const unsigned int iif_codes[] = { + MEDIA_BUS_FMT_Y8_1X8, + MEDIA_BUS_FMT_Y10_1X10, + MEDIA_BUS_FMT_Y12_1X12, + MEDIA_BUS_FMT_Y16_1X16, + MEDIA_BUS_FMT_METADATA_FIXED +}; + +static int iif_enum_mbus_code(struct v4l2_subdev *subdev, + struct v4l2_subdev_state *sd_state, + struct v4l2_subdev_mbus_code_enum *code) +{ + return vsp1_subdev_enum_mbus_code(subdev, sd_state, code, iif_codes, + ARRAY_SIZE(iif_codes)); +} + +static int iif_enum_frame_size(struct v4l2_subdev *subdev, + struct v4l2_subdev_state *sd_state, + struct v4l2_subdev_frame_size_enum *fse) +{ + return vsp1_subdev_enum_frame_size(subdev, sd_state, fse, + IIF_MIN_WIDTH, IIF_MIN_HEIGHT, + IIF_MAX_WIDTH, IIF_MAX_HEIGHT); +} + +static int iif_set_format(struct v4l2_subdev *subdev, + struct v4l2_subdev_state *sd_state, + struct v4l2_subdev_format *fmt) +{ + return vsp1_subdev_set_pad_format(subdev, sd_state, fmt, iif_codes, + ARRAY_SIZE(iif_codes), + IIF_MIN_WIDTH, IIF_MIN_HEIGHT, + IIF_MAX_WIDTH, IIF_MAX_HEIGHT); +} + +static const struct v4l2_subdev_pad_ops iif_pad_ops = { + .enum_mbus_code = iif_enum_mbus_code, + .enum_frame_size = iif_enum_frame_size, + .get_fmt = vsp1_subdev_get_pad_format, + .set_fmt = iif_set_format, +}; + +static const struct v4l2_subdev_ops iif_ops = { + .pad = &iif_pad_ops, +}; + +/* ----------------------------------------------------------------------------- + * VSP1 Entity Operations + */ + +static void iif_configure_stream(struct vsp1_entity *entity, + struct v4l2_subdev_state *state, + struct vsp1_pipeline *pipe, + struct vsp1_dl_list *dl, + struct vsp1_dl_body *dlb) +{ + vsp1_iif_write(dlb, VI6_IIF_CTRL, VI6_IIF_CTRL_CTRL); +} + +static const struct vsp1_entity_operations iif_entity_ops = { + .configure_stream = iif_configure_stream, +}; + +/* ----------------------------------------------------------------------------- + * Initialization and Cleanup + */ + +struct vsp1_iif *vsp1_iif_create(struct vsp1_device *vsp1) +{ + struct vsp1_iif *iif; + int ret; + + iif = devm_kzalloc(vsp1->dev, sizeof(*iif), GFP_KERNEL); + if (!iif) + return ERR_PTR(-ENOMEM); + + iif->entity.ops = &iif_entity_ops; + iif->entity.type = VSP1_ENTITY_IIF; + + /* + * The IIF is never exposed to userspace, but media entity registration + * requires a function to be set. Use PROC_VIDEO_PIXEL_FORMATTER just to + * avoid triggering a WARN_ON(), the value won't be seen anywhere. + */ + ret = vsp1_entity_init(vsp1, &iif->entity, "iif", 3, &iif_ops, + MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER); + if (ret < 0) + return ERR_PTR(ret); + + return iif; +} diff --git a/drivers/media/platform/renesas/vsp1/vsp1_iif.h b/drivers/media/platform/renesas/vsp1/vsp1_iif.h new file mode 100644 index 0000000000000000000000000000000000000000..165996a822c1baab1fc40636884c9e7a67e4db07 --- /dev/null +++ b/drivers/media/platform/renesas/vsp1/vsp1_iif.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * vsp1_iif.h -- R-Car VSP1 IIF (ISP Interface) + * + * Copyright (C) 2025 Ideas On Board Oy + * Copyright (C) 2025 Renesas Corporation + */ +#ifndef __VSP1_IIF_H__ +#define __VSP1_IIF_H__ + +#include + +#include "vsp1_entity.h" + +struct vsp1_iif { + struct vsp1_entity entity; +}; + +static inline struct vsp1_iif *to_iif(struct v4l2_subdev *subdev) +{ + return container_of(subdev, struct vsp1_iif, entity.subdev); +} + +struct vsp1_iif *vsp1_iif_create(struct vsp1_device *vsp1); + +#endif /* __VSP1_IIF_H__ */ diff --git a/drivers/media/platform/renesas/vsp1/vsp1_pipe.c b/drivers/media/platform/renesas/vsp1/vsp1_pipe.c index bb0739f684f39e23326a4d8fdb9f43e020bc23c8..8e9be3ec1b4dbdad1cbe35ae3a88952f46e41343 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_pipe.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_pipe.c @@ -286,6 +286,7 @@ void vsp1_pipeline_reset(struct vsp1_pipeline *pipe) pipe->brx = NULL; pipe->hgo = NULL; pipe->hgt = NULL; + pipe->iif = NULL; pipe->lif = NULL; pipe->uds = NULL; } diff --git a/drivers/media/platform/renesas/vsp1/vsp1_pipe.h b/drivers/media/platform/renesas/vsp1/vsp1_pipe.h index 1ba7bdbad5a845da0a4d71888e193e46d62bed90..1655a820da102003d3d7da82a7cdd64e01c29ac6 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_pipe.h +++ b/drivers/media/platform/renesas/vsp1/vsp1_pipe.h @@ -119,6 +119,7 @@ struct vsp1_pipeline { struct vsp1_entity *brx; struct vsp1_entity *hgo; struct vsp1_entity *hgt; + struct vsp1_entity *iif; struct vsp1_entity *lif; struct vsp1_entity *uds; struct vsp1_entity *uds_input; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_regs.h b/drivers/media/platform/renesas/vsp1/vsp1_regs.h index 7eca82e0ba7ec5e02a5f3b9a30ccdcb48db39ed2..86e47c2d991fb4e0719b63c4ccb29340610ac24f 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_regs.h +++ b/drivers/media/platform/renesas/vsp1/vsp1_regs.h @@ -252,6 +252,13 @@ #define VI6_RPF_BRDITH_CTRL_ODE BIT(8) #define VI6_RPF_BRDITH_CTRL_CBRM BIT(0) +/* ----------------------------------------------------------------------------- + * IIF Control Registers + */ + +#define VI6_IIF_CTRL 0x0608 +#define VI6_IIF_CTRL_CTRL 0x13 + /* ----------------------------------------------------------------------------- * WPF Control Registers */ @@ -388,6 +395,7 @@ #define VI6_DPR_HST_ROUTE 0x2044 #define VI6_DPR_HSI_ROUTE 0x2048 #define VI6_DPR_BRU_ROUTE 0x204c +#define VI6_DPR_ROUTE_IIFSEL BIT(28) #define VI6_DPR_ILV_BRS_ROUTE 0x2050 #define VI6_DPR_ROUTE_BRSSEL BIT(28) #define VI6_DPR_ROUTE_FXA_MASK (0xff << 16) From patchwork Mon Mar 17 11:56:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 14019112 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04946238D5A; Mon, 17 Mar 2025 11:57:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742212659; cv=none; b=SqnjSM/pbpj7Nd33b59DaBN2e2DcLWPBGtf0yLfUasaj93aDfyRnLhZf3ra+GpyqBt5GvXQz+YJM4MmHm72LKRH/CXcX5PTCEJ/yFeN9VJr5iRTLP1luQzw8z+7BvuFkLdaVXjhAxzur50+jXI8TxcehnFNskyeqy1lsht24iqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742212659; c=relaxed/simple; bh=ZN1jlt5fzffXHX7r0+lU8IjtsYcES1i+/u6V6QY9S6U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=USKzvWuECCy7ZySprOgZLIi4s9Nk4tah4geUUXhZHmzar+9sAB1CHFL6er25pVsYuVk8HDKmDYNA5xrOSNOEnUvXw2SLgj1MBm5CMYwpd5HDjueVTwypyXXrhKpODUzfA/Pfaplb1+LnGe4elXLSLRQoKtxA7Z+l8WgJtcEdjrY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=bF+r6iz7; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="bF+r6iz7" Received: from [192.168.1.102] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 663FDD77; Mon, 17 Mar 2025 12:55:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742212546; bh=ZN1jlt5fzffXHX7r0+lU8IjtsYcES1i+/u6V6QY9S6U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bF+r6iz7NKeoeXe+OZ2KT7zKmdz4fWHZDb1YyCenVAU2b7YQivvSiWhgVsdgOulbR 1qjf8jque5sOk3okpJx6RN3E8dxKa9N5+paYLRaYNK8p2dGlMtPzFkEnWHVnYu/bK4 oUb4WeWy7KB9rDJCI6sbhP2Q+SwAYzHKJAYmmIVY= From: Jacopo Mondi Date: Mon, 17 Mar 2025 12:56:40 +0100 Subject: [PATCH v3 2/7] media: vsp1: dl: Use singleshot DL for VSPX Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-v4h-iif-v3-2-63aab8982b50@ideasonboard.com> References: <20250317-v4h-iif-v3-0-63aab8982b50@ideasonboard.com> In-Reply-To: <20250317-v4h-iif-v3-0-63aab8982b50@ideasonboard.com> To: Laurent Pinchart , Kieran Bingham , =?utf-8?q?Niklas?= =?utf-8?q?_S=C3=B6derlund?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Jacopo Mondi , Laurent Pinchart , =?utf-8?q?Ni?= =?utf-8?q?klas_S=C3=B6derlund?= X-Mailer: b4 0.15-dev-1b0d6 X-Developer-Signature: v=1; a=openpgp-sha256; l=1937; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=ZN1jlt5fzffXHX7r0+lU8IjtsYcES1i+/u6V6QY9S6U=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBn2A4lmr3g0RO3lAsm5eR9hiR6UKpF4XYGxJIwU TWP+qPqK0iJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ9gOJQAKCRByNAaPFqFW PH8qD/47EVF1oWgUKg2kJwZodPEBzBMghS3MzWSVjRg45g6iRlnnV0EZEyf0YQ5gpemzjyA333z 7ho39ER1n5nDdpSoh/oXKcPawIcogfPE3WzhNeIElv3qlSOnf8pTMWdu+nfPQp6KDfVF3rbL110 5KMw1+hTRnebOBfEFjC6oG244ThNE2CBvwu7zKaemlJdJLu/2CupEKbH1V/gqY/rScxGEuOojCB uaRcomW20oftvDMEG+O74rdcnkP/0L/jhB2jIVj13stdtAfm2YK5XNF4xSA+N8XIc4x9Sz1VpbK A63znN0R854OZt0OPbv2URbH8LiqIUpVYK0jWzaybevJ6tSlSRfrPph+7ytRITG4bxu2fEA7eTb jwU7VfH1Zl2X67dDvVPxRkU2xLDHK27ursyPXmagtXxkZ9fIQgJLv+EgxHKLQ8AmCBAKB7hU7WF 6FXZgmedckoQYdlWq3O4Ui0CLzxBWdGGIp5hVUU2caDPqBSJA44rdWaVyjHWJxBeWQ78meh7LO2 s6F380YtZjMOEUEIHL7vFWLGnU3sDALrjZLxN41QbhiRzea2EhDWE74dMK6ar/qBhwDRukGzmt3 UaQs8QHQh/iazukS5ATRH8Q0J9y97pKYfHetero/W2hiTDvbCt9Ddaa/T/f5zp0/v2XiwZZxkGb qmHU+rWrHq2vteQ== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The vsp1_dl library allows to program a display list and feed it continuously to the VSP2. As an alternative operation mode, the library allows to program the VSP2 in 'single shot' mode, where a display list is submitted to the VSP on request only. Currently the 'single shot' mode is only available when the VSP2 is controlled by userspace, while it works in continuous mode when driven by DRM, as frames have to be submitted to the display continuously. For the VSPX use case, where there is no uapi support, we should however work in single-shot mode as the ISP driver programs the VSPX on request. Initialize the display lists in single shot mode in case the VSP1 is controlled by userspace or in case the pipeline features an IIF entity, as in the VSPX case. Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Tested-by: Niklas Söderlund Signed-off-by: Jacopo Mondi --- v2->v3: - Drop () in condition --- drivers/media/platform/renesas/vsp1/vsp1_dl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_dl.c b/drivers/media/platform/renesas/vsp1/vsp1_dl.c index ad3fa1c9cc737c92870c087dd7cb8cf584fce41b..bb8228b198249943399719b5f37c337fc43eed5b 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_dl.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_dl.c @@ -1099,7 +1099,12 @@ struct vsp1_dl_manager *vsp1_dlm_create(struct vsp1_device *vsp1, return NULL; dlm->index = index; - dlm->singleshot = vsp1->info->uapi; + /* + * uapi = single shot mode; + * DRM = continuous mode; + * VSPX = single shot mode; + */ + dlm->singleshot = vsp1->info->uapi || vsp1->iif; dlm->vsp1 = vsp1; spin_lock_init(&dlm->lock); From patchwork Mon Mar 17 11:56:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 14019113 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F34523A58F; Mon, 17 Mar 2025 11:57:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742212662; cv=none; b=CQncc83MRLi9q3ZVDKzbeW5W8ysZ507q3qhf4LZK75W+aA1w8Sfb/3AYtah2QUT1+QkUTsxhT83243wiZUo5yAsD/zfffr5qjhTqRwrpdbxVKuOyplUd4v/JWR/82SoPaxaGl5HrWWJqI9Ub/tC74OYcPIcvkz14CYV5k2oT9HQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742212662; c=relaxed/simple; bh=tE1slbE2zq9KHFM8EaSkGynY+cnKiXq+U8c3be9vz70=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fYx2zQSuHs61xAYiA4dseiVYyIR+MRMOu4vWVlZVVAGj6tEANC09DPjuvkXcc8nTTWJ6gPjUalAeOSzFt2aoggcCUwkVIfPBAy6ddz9kJBVp6Ms8fUm7yFVHLpWf70PIdAzMxqHw1VYVt5yS61kj5adpGm523cSXOlqQgHxKvH8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=AdSFFul8; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="AdSFFul8" Received: from [192.168.1.102] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1D23810D8; Mon, 17 Mar 2025 12:55:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742212547; bh=tE1slbE2zq9KHFM8EaSkGynY+cnKiXq+U8c3be9vz70=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=AdSFFul8v08J04fwGVjmMImh9tVnCE4Vw28YEQh6LKL/QZCxo8g+dGmxFgAAROBFH FO5hURZbcLXQGBixa9IWO7fAfm+MRZlhd1SXpnKZd60TQRNNJ0HVjlNXmP959BirAH U9+rce7+/tyzYUUarXgId0ElPS+vjpQ1cX6EXMWw= From: Jacopo Mondi Date: Mon, 17 Mar 2025 12:56:41 +0100 Subject: [PATCH v3 3/7] media: vsp1: rwpf: Break out format handling Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-v4h-iif-v3-3-63aab8982b50@ideasonboard.com> References: <20250317-v4h-iif-v3-0-63aab8982b50@ideasonboard.com> In-Reply-To: <20250317-v4h-iif-v3-0-63aab8982b50@ideasonboard.com> To: Laurent Pinchart , Kieran Bingham , =?utf-8?q?Niklas?= =?utf-8?q?_S=C3=B6derlund?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Jacopo Mondi , Laurent Pinchart , =?utf-8?q?Ni?= =?utf-8?q?klas_S=C3=B6derlund?= X-Mailer: b4 0.15-dev-1b0d6 X-Developer-Signature: v=1; a=openpgp-sha256; l=2948; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=tE1slbE2zq9KHFM8EaSkGynY+cnKiXq+U8c3be9vz70=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBn2A4lU9ic/WqMtX5s9iJYWr/DkhfOvxHLniPs2 +LkyMtUkzaJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ9gOJQAKCRByNAaPFqFW PJZ7D/41wo0p1C/jDn4JMKGcvi5ThPiaT5ATsjbth3FDVIRj5mm8eaeyqiXpPWVo06EPWlzcI+t B5GiM8vttBAWfGpPK+YwtHM2rPDe7HLs+uwYNYIaii8KleJ5TCyIzoC0wX06CGmPizZPo/pZzzP G9zMfVuOPHa5+BQN/xaiGzzzqzIToKFHFyLGUjakMe+Ax0wQ04nt6gfnkeI+5drHEtcanLIrcID Ow69bYjF4l7xvRGHFvpgJiRW+N3s4QrlPIaoXDIVdt2hgs1Xy9Hjkrw3cEoOz/FHzSjwRcRpItN FBvOkpPSU5lVJ5h1mFvaXvF4C0bKY3MYdwFVr4D3snjV9PMlt9ElLToYb+jJNxUVF3iOegMjXKu +zo3kDjhm6vFLAQVnpUaT3PDL4Fe3ZsQYhdkqjsX2KnAkXMsEHYi4JYBmDdoN90IlYZSxc4UTt1 iF6hxy2ck4KP5CZ/IDja1WWbCdlgBNBV0uwElbjMQC1rBEEVBlmvA6saeiJRrMq97JPK63BGK9C +/umXkAS54ueLLcl1ybht0V1tTyfa6Ndx91kFKmtN8Ay8eaYjVcUW1tqAg9sDRDEoW4JbP0aBfF XPf0WRAmn2NsoUDC73TZ9jv/12LZgvwnJ/9a9jbTHcU2E3VDeZcznGoybON8IKAosicX+u0Ogsd dgRMMxRo16YTuqg== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The current implementation of the r/wpf format handling assumes three formats to be supported in the RGB/YUV space. With the forthcoming support for VSPX the r/wpf units will be used to fetch from external memory images in RAW Bayer format and buffers of ISP configuration parameters. Prepare for adding support for these new formats by breaking out the list of supported media bus codes in the vsp1_rwpf.c file. Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Tested-by: Niklas Söderlund Signed-off-by: Jacopo Mondi --- drivers/media/platform/renesas/vsp1/vsp1_rwpf.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c index 9d38203e73d00b82a1a7db0353e2f0b5a94084f6..93b0ed5fd0da0c6a182dbbfe1e54eb8cfd66c493 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c @@ -16,6 +16,12 @@ #define RWPF_MIN_WIDTH 1 #define RWPF_MIN_HEIGHT 1 +static const u32 rwpf_mbus_codes[] = { + MEDIA_BUS_FMT_ARGB8888_1X32, + MEDIA_BUS_FMT_AHSV8888_1X32, + MEDIA_BUS_FMT_AYUV8_1X32, +}; + /* ----------------------------------------------------------------------------- * V4L2 Subdevice Operations */ @@ -24,16 +30,10 @@ static int vsp1_rwpf_enum_mbus_code(struct v4l2_subdev *subdev, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_mbus_code_enum *code) { - static const unsigned int codes[] = { - MEDIA_BUS_FMT_ARGB8888_1X32, - MEDIA_BUS_FMT_AHSV8888_1X32, - MEDIA_BUS_FMT_AYUV8_1X32, - }; - - if (code->index >= ARRAY_SIZE(codes)) + if (code->index >= ARRAY_SIZE(rwpf_mbus_codes)) return -EINVAL; - code->code = codes[code->index]; + code->code = rwpf_mbus_codes[code->index]; return 0; } @@ -57,6 +57,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, struct vsp1_rwpf *rwpf = to_rwpf(subdev); struct v4l2_subdev_state *state; struct v4l2_mbus_framefmt *format; + unsigned int i; int ret = 0; mutex_lock(&rwpf->entity.lock); @@ -68,9 +69,11 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, } /* Default to YUV if the requested format is not supported. */ - if (fmt->format.code != MEDIA_BUS_FMT_ARGB8888_1X32 && - fmt->format.code != MEDIA_BUS_FMT_AHSV8888_1X32 && - fmt->format.code != MEDIA_BUS_FMT_AYUV8_1X32) + for (i = 0; i < ARRAY_SIZE(rwpf_mbus_codes); ++i) { + if (fmt->format.code == rwpf_mbus_codes[i]) + break; + } + if (i == ARRAY_SIZE(rwpf_mbus_codes)) fmt->format.code = MEDIA_BUS_FMT_AYUV8_1X32; format = v4l2_subdev_state_get_format(state, fmt->pad); From patchwork Mon Mar 17 11:56:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 14019114 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F2D023A58D; Mon, 17 Mar 2025 11:57:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742212664; cv=none; b=A2P0aHkXVyj6EK0dyJVqk49b2x7jT96JI8ysuPnUkBwFxr5ub7Hfi7bINOhPkL+2OVgx7S/SGBZM3cnUnwsJINV8mFeD1Mwz7KT2QN88+7JzjtTgXo6tFVslbz++rbcE9OYUsiO27XZindlJtqTZsRrSOInOosGCCdCEC+h87dI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742212664; c=relaxed/simple; bh=RvfpMdjio+jNXatPfiV1crfd0LQ+0MrPkEiQbAWzgwE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=daBoaTriokPv+5qDNQIuGxOV2tee+BKjhG6JKKEEB01rb8OB+8O3t3QsbQTxNAl/RhA1d4koLURTCLbeAj2p22Hz58rmqKsWCBuDC1OgIETon8QXprHuBu7OXa3gzbDUgRQSCx8lV9EvGzPfBCAsFsEBtv/9PpVJsN/WoBw+9qQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=YChffNKs; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="YChffNKs" Received: from [192.168.1.102] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BC743132B; Mon, 17 Mar 2025 12:55:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742212548; bh=RvfpMdjio+jNXatPfiV1crfd0LQ+0MrPkEiQbAWzgwE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YChffNKsVzcMED99XBBWMawPq0bnJ1b7JkHEfvW/mYqLD7GCF4oeREjySklNCrZf8 ai+XO8C/dts5GbvzVXPmr7F3+AoqrIh4PvSguJiC5tibiPkAB3Y2MeRn7ePKbGP5oY PPde+17XRGMNilYKh8VZv2nRF8/gy6B3E0tjhln0= From: Jacopo Mondi Date: Mon, 17 Mar 2025 12:56:42 +0100 Subject: [PATCH v3 4/7] media: vsp1: wpf: Propagate vsp1_rwpf_init_ctrls() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-v4h-iif-v3-4-63aab8982b50@ideasonboard.com> References: <20250317-v4h-iif-v3-0-63aab8982b50@ideasonboard.com> In-Reply-To: <20250317-v4h-iif-v3-0-63aab8982b50@ideasonboard.com> To: Laurent Pinchart , Kieran Bingham , =?utf-8?q?Niklas?= =?utf-8?q?_S=C3=B6derlund?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Jacopo Mondi X-Mailer: b4 0.15-dev-1b0d6 X-Developer-Signature: v=1; a=openpgp-sha256; l=1747; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=RvfpMdjio+jNXatPfiV1crfd0LQ+0MrPkEiQbAWzgwE=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBn2A4lWDRYm0NzveckWfxrtFfCqV/zcKrsZBnEa 0EPs06CzdaJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ9gOJQAKCRByNAaPFqFW PAtWEACWAu2OWrAbsgG7fYrX/FWOGWEXUfi5/D+CZWTqxa7jsWq7bANXFXPI23NNROdd+Fts2cF kqJzpMfS9YmOOxv9G6VK1zW7Dox+O8TG1C48FhrH3DNbKVsAnWi53ZO++adsEQhb716nSUTsrK/ wljiRqkR+toThYGtDQjPRhaRpEWnI+742UrN1npurTgRZcnVh3BPMPavvOlIbSpZiwQSP5YJjDj sbWmDc4EBDQJBy01scpdhhXOObTGDtYb4Ch47+kJQApKrBfTmX442FgBb9J8iUa7EqHPBTR1wxL alga/iblbs8E7iOAtWLOO65PxaVgkeJEu3CV2sVviQL7SAB5oIC1/Ul9cNP/semeHygWvaa5+Kc HCGnex+/AZ5UXIBQvnfZ0KemnOeV2LNEK4liBGbOqptzu6k71/PZtJWZk0cwj8CKENR8yAOFk7j sdR1fq6nujuHBMqX+jz0XuYzBwPJBxQVou2yvW5BslFwG/Xns7Div4nHwEyoYxgbLJIaxPSqd/4 WciVMiuA/quXLUOSp2Ho0d+1/uaZ22FB0r8c1BoSqs8SO2QLzdKHwqeodjKMG6W7Yg1au0XgJ++ o8eFUv/PvnATsr88rCjM4ja5Y97bJZJ4C4T+wSQ23LEeI+nxtHEwjcIcOlo9MYJ8WrESL4SdpzX mO6IY3fYT5QVThA== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B vsp1_wpf.c calls vsp1_rwpf_init_ctrls() to initialize controls that are common between RPF and WPF. However, the vsp1_wpf.c implementation does not check for the function call return value. Fix this by propagating to the caller the return value. While at it, drop a duplicated error message in wpf_init_controls() as the caller already report it. Signed-off-by: Jacopo Mondi --- v2->v3: - New patch --- drivers/media/platform/renesas/vsp1/vsp1_wpf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c index f176750ccd9847fdb8d51f7f51a6bd5092b70197..da651a882bbb7e4d58f2dfea9dcea60a41f4f79c 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c @@ -133,6 +133,7 @@ static int wpf_init_controls(struct vsp1_rwpf *wpf) { struct vsp1_device *vsp1 = wpf->entity.vsp1; unsigned int num_flip_ctrls; + int ret; spin_lock_init(&wpf->flip.lock); @@ -156,7 +157,9 @@ static int wpf_init_controls(struct vsp1_rwpf *wpf) num_flip_ctrls = 0; } - vsp1_rwpf_init_ctrls(wpf, num_flip_ctrls); + ret = vsp1_rwpf_init_ctrls(wpf, num_flip_ctrls); + if (ret < 0) + return ret; if (num_flip_ctrls >= 1) { wpf->flip.ctrls.vflip = @@ -174,11 +177,8 @@ static int wpf_init_controls(struct vsp1_rwpf *wpf) v4l2_ctrl_cluster(3, &wpf->flip.ctrls.vflip); } - if (wpf->ctrls.error) { - dev_err(vsp1->dev, "wpf%u: failed to initialize controls\n", - wpf->entity.index); + if (wpf->ctrls.error) return wpf->ctrls.error; - } return 0; } From patchwork Mon Mar 17 11:56:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 14019115 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84A3B23BD1C; Mon, 17 Mar 2025 11:57:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742212666; cv=none; b=fiaaMb7DD6sN9jrCPr/JiXnFQsLK57CkQycx4E9kiz8Hvz2t9PIUP4ynglSRifzTB1CfOs65QKkS7c9uMrIrpNhXxB59mUuD/qajLndj+p2DjrOV04OvOmyBEuK8i6agRiLL0X7zCITFMpqkui1rAwwRyXFFolLL86Im1mQK0l8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742212666; c=relaxed/simple; bh=Ntfb/leZ76e56lVNlSaDyhMpZbW5jt2+J80bJ1w8X8I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bKuAwruZIz043SlmxXnW79Uz7daRszZR1Yyi14uB1OwqnxO/qYATxUR9oIeMj88QWK6gOyNzNk14grP2EUiPh+LcWKdiA4T3JHI0DgWoKlECeQgqmZdAUccJoWGLIH6iwCMHOxS74rzk9mhlut+KNf2R6yZL/jH53DkJEib4GeU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=q7x1oIil; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="q7x1oIil" Received: from [192.168.1.102] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 69C0C14B1; Mon, 17 Mar 2025 12:55:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742212548; bh=Ntfb/leZ76e56lVNlSaDyhMpZbW5jt2+J80bJ1w8X8I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=q7x1oIilWsysoPE+nvyVd0d7YX6msu6I0dzweyNo8s1oId/USh64Kcsht3f7+np1M T8tURcfcX9Ezs4waNVSV0tCeS5QWwyA8GAL4oQacgw9UJo/Uuaph5nEq9PecY3raW1 s7NZiNPrXk7hs35lN0/jhLdcK10cgvI72j8E2vC8= From: Jacopo Mondi Date: Mon, 17 Mar 2025 12:56:43 +0100 Subject: [PATCH v3 5/7] media: vsp1: rwpf: Initialize image formats Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-v4h-iif-v3-5-63aab8982b50@ideasonboard.com> References: <20250317-v4h-iif-v3-0-63aab8982b50@ideasonboard.com> In-Reply-To: <20250317-v4h-iif-v3-0-63aab8982b50@ideasonboard.com> To: Laurent Pinchart , Kieran Bingham , =?utf-8?q?Niklas?= =?utf-8?q?_S=C3=B6derlund?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Jacopo Mondi , =?utf-8?q?Niklas_S?= =?utf-8?q?=C3=B6derlund?= X-Mailer: b4 0.15-dev-1b0d6 X-Developer-Signature: v=1; a=openpgp-sha256; l=7618; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=Ntfb/leZ76e56lVNlSaDyhMpZbW5jt2+J80bJ1w8X8I=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBn2A4llD3bvxxrcJLw22UBaaQbOPx1GkVpZ4LWF eFsOq3b/QqJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ9gOJQAKCRByNAaPFqFW PFrKD/90GPvB2o0A2K46SkcWMyigq7zu9oTqV1QDLZ8M7XzuUz+/WAu1oa0LyMPvVwLiX//S/Ga FWhHLAEcQrOzmDZl2lYYOgozeyxlvcjI/kNhjWu1Sng4+IEnSDt1Xsp5UXHUqH41mjiWw13ga+5 pcvYexfWOt0Ig4Yg9D+1hYSE1LobmE76s0CfR4hCeWRr0+iGS5G/NhE9f2wWa9MFg/N0xA7LuCh kvdzP4Ub/yv8c1MWDFTxIftSAgRvgE2A8Q/zFcnH8IRY/dK/5zEFvYXPSpHxzDKwYRrf/0Kmve1 3uRLv7lIK+aZt6HAWA9H/K2oLXHSUQJUFwPofvCXVqzTBRauACKayaloCT8h3gawAClx5hN0jDV eRPzkmZtdo8IPZb+6anzFKL7UtYP2Vc+i0kxgsFKopZqRsvKbfdk/cQ+R1gQJ00T7/0cIY8CRd7 BEJNZ9pmjSN79zEiotnJzhO7TV+GDB68Wf6voJL4UGBfxg5XT+dCpLCC82ZaFb0cvc5GqWVK3Ky BYBkuo6mLixEV4++dpjTNwlp+T6wjlB2wl4R4kPXxHc76MBZp189X6f2ekLyHRC/fVPVhJKkNRD s//2k77kL0ZfdXYbCFRGElJ6Ae3f5NyETf0xJnF2Djr7cUpgMDfizH8HjgWQyVK6Jbfr28+dgc6 VNESaZfW6oS4eeA== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B With the forthcoming support for VSPX the r/wpf unit will be used to perform memory access on the behalf of the ISP units. Prepare to support reading from external memory images in RAW Bayer format and ISP configuration parameters by expanding the list of supported media bus codes. Store the list of valid mbus code in the rwpf device and initialize it in the new vsp1_rwpf_init_formats() function, called by RPFs and WFPs at entity creation time. Reviewed-by: Niklas Söderlund Tested-by: Niklas Söderlund Signed-off-by: Jacopo Mondi --- v2->v3: - Introduce vsp1_rwpf_init_formats() - Store the list of mbus codes at init time instead of computing it --- drivers/media/platform/renesas/vsp1/vsp1_rpf.c | 7 +++ drivers/media/platform/renesas/vsp1/vsp1_rwpf.c | 79 +++++++++++++++++++++++-- drivers/media/platform/renesas/vsp1/vsp1_rwpf.h | 4 ++ drivers/media/platform/renesas/vsp1/vsp1_wpf.c | 7 +++ 4 files changed, 91 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c index 5c8b3ba1bd3c2c7b9289f05c9c2578e9717c23ff..056491286577cc8e9e7a6bd096f1107da6009ea7 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c @@ -400,6 +400,13 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index) rpf->entity.type = VSP1_ENTITY_RPF; rpf->entity.index = index; + ret = vsp1_rwpf_init_formats(vsp1, rpf); + if (ret < 0) { + dev_err(vsp1->dev, "rpf%u: failed to initialize formats\n", + index); + return ERR_PTR(ret); + } + sprintf(name, "rpf.%u", index); ret = vsp1_entity_init(vsp1, &rpf->entity, name, 2, &vsp1_rwpf_subdev_ops, MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c index 93b0ed5fd0da0c6a182dbbfe1e54eb8cfd66c493..f1d27300ecf3f0f82550fb6aae1d37de33805ca1 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c @@ -16,12 +16,47 @@ #define RWPF_MIN_WIDTH 1 #define RWPF_MIN_HEIGHT 1 +struct vsp1_rwpf_codes { + const u32 *codes; + unsigned int num_codes; +}; + static const u32 rwpf_mbus_codes[] = { MEDIA_BUS_FMT_ARGB8888_1X32, MEDIA_BUS_FMT_AHSV8888_1X32, MEDIA_BUS_FMT_AYUV8_1X32, }; +static const struct vsp1_rwpf_codes rwpf_codes = { + .codes = rwpf_mbus_codes, + .num_codes = ARRAY_SIZE(rwpf_mbus_codes), +}; + +static const u32 vspx_rpf0_mbus_codes[] = { + MEDIA_BUS_FMT_Y8_1X8, + MEDIA_BUS_FMT_Y10_1X10, + MEDIA_BUS_FMT_Y12_1X12, + MEDIA_BUS_FMT_Y16_1X16, + MEDIA_BUS_FMT_METADATA_FIXED +}; + +static const struct vsp1_rwpf_codes vspx_rpf0_codes = { + .codes = vspx_rpf0_mbus_codes, + .num_codes = ARRAY_SIZE(vspx_rpf0_mbus_codes), +}; + +static const u32 vspx_rpf1_mbus_codes[] = { + MEDIA_BUS_FMT_Y8_1X8, + MEDIA_BUS_FMT_Y10_1X10, + MEDIA_BUS_FMT_Y12_1X12, + MEDIA_BUS_FMT_Y16_1X16, +}; + +static const struct vsp1_rwpf_codes vspx_rpf1_codes = { + .codes = vspx_rpf1_mbus_codes, + .num_codes = ARRAY_SIZE(vspx_rpf1_mbus_codes), +}; + /* ----------------------------------------------------------------------------- * V4L2 Subdevice Operations */ @@ -30,10 +65,12 @@ static int vsp1_rwpf_enum_mbus_code(struct v4l2_subdev *subdev, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_mbus_code_enum *code) { - if (code->index >= ARRAY_SIZE(rwpf_mbus_codes)) + struct vsp1_rwpf *rwpf = to_rwpf(subdev); + + if (code->index >= rwpf->mbus_codes->num_codes) return -EINVAL; - code->code = rwpf_mbus_codes[code->index]; + code->code = rwpf->mbus_codes->codes[code->index]; return 0; } @@ -69,12 +106,12 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, } /* Default to YUV if the requested format is not supported. */ - for (i = 0; i < ARRAY_SIZE(rwpf_mbus_codes); ++i) { - if (fmt->format.code == rwpf_mbus_codes[i]) + for (i = 0; i < rwpf->mbus_codes->num_codes; ++i) { + if (fmt->format.code == rwpf->mbus_codes->codes[i]) break; } - if (i == ARRAY_SIZE(rwpf_mbus_codes)) - fmt->format.code = MEDIA_BUS_FMT_AYUV8_1X32; + if (i == rwpf->mbus_codes->num_codes) + fmt->format.code = rwpf->mbus_codes->codes[0]; format = v4l2_subdev_state_get_format(state, fmt->pad); @@ -267,8 +304,38 @@ static const struct v4l2_ctrl_ops vsp1_rwpf_ctrl_ops = { .s_ctrl = vsp1_rwpf_s_ctrl, }; + +int vsp1_rwpf_init_formats(struct vsp1_device *vsp1, struct vsp1_rwpf *rwpf) +{ + /* Only VSPX and RPF support reading Bayer data. */ + if (!vsp1_feature(vsp1, VSP1_HAS_IIF) || + rwpf->entity.type != VSP1_ENTITY_RPF) { + rwpf->mbus_codes = &rwpf_codes; + return 0; + } + + /* + * VSPX only features RPF0 and RPF1. RPF0 supports reading ISP ConfigDMA + * and Bayer data, RPF1 supports reading Bayer data only. + */ + switch (rwpf->entity.index) { + case 0: + rwpf->mbus_codes = &vspx_rpf0_codes; + break; + case 1: + rwpf->mbus_codes = &vspx_rpf1_codes; + break; + default: + return -EINVAL; + } + + return 0; +} + int vsp1_rwpf_init_ctrls(struct vsp1_rwpf *rwpf, unsigned int ncontrols) { + /* Initialize controls. */ + v4l2_ctrl_handler_init(&rwpf->ctrls, ncontrols + 1); v4l2_ctrl_new_std(&rwpf->ctrls, &vsp1_rwpf_ctrl_ops, V4L2_CID_ALPHA_COMPONENT, 0, 255, 1, 255); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.h b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.h index 5ac9f0a6fafcee955f32d768aafe8a87516908ae..64feb4742494f6d6a34abe4a21c89b64cfc0a6ca 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.h +++ b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.h @@ -30,6 +30,7 @@ struct vsp1_rwpf_memory { dma_addr_t addr[3]; }; +struct vsp1_rwpf_codes; struct vsp1_rwpf { struct vsp1_entity entity; struct v4l2_ctrl_handler ctrls; @@ -39,6 +40,8 @@ struct vsp1_rwpf { unsigned int max_width; unsigned int max_height; + const struct vsp1_rwpf_codes *mbus_codes; + struct v4l2_pix_format_mplane format; const struct vsp1_format_info *fmtinfo; unsigned int brx_input; @@ -81,6 +84,7 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index); void vsp1_wpf_stop(struct vsp1_rwpf *wpf); +int vsp1_rwpf_init_formats(struct vsp1_device *vsp1, struct vsp1_rwpf *rwpf); int vsp1_rwpf_init_ctrls(struct vsp1_rwpf *rwpf, unsigned int ncontrols); extern const struct v4l2_subdev_ops vsp1_rwpf_subdev_ops; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c index da651a882bbb7e4d58f2dfea9dcea60a41f4f79c..a32e4b3527db41e7fac859ad8e13670141c1ef04 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c @@ -548,6 +548,13 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index) wpf->entity.type = VSP1_ENTITY_WPF; wpf->entity.index = index; + ret = vsp1_rwpf_init_formats(vsp1, wpf); + if (ret < 0) { + dev_err(vsp1->dev, "wpf%u: failed to initialize formats\n", + index); + return ERR_PTR(ret); + } + sprintf(name, "wpf.%u", index); ret = vsp1_entity_init(vsp1, &wpf->entity, name, 2, &vsp1_rwpf_subdev_ops, MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER); From patchwork Mon Mar 17 11:56:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 14019116 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95A9E23C8CB; Mon, 17 Mar 2025 11:57:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742212667; cv=none; b=DJTgWe4Wglr3CQfCwzcaTjssGAN6CAKt3T8EJXHG3UuorkYW+6+6DVLU4S7xkR2KqcJ0QOdm3zVfF1wsbX2sdYjCiTxz5CETd+EGXkg0Q6b1Xg3usUh0XfreO+qqrSZWOj8CWgBlLJ4T19Cz3qEDEvZ8DX48uHVMe3w0fPPvWjY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742212667; c=relaxed/simple; bh=L3EHJlduO8HxIoJ1jIlrPRmfWgrTM/fRI/20nH4RFRs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ot11VZxAbohAXOIdYfUakpRu8tb6uVrrK1aA3Kw3zF6s8bqqyhbmbdW4U7UuqHb/SbySi9v1WElXGbeCDsD4KTAcRi1f9m+PesZCSo7JkNBcHmFaeS/gn974Gv3CF1ULygH6QNBfQL5g5qnAGKfbMrkoaGct1yOz7GskZFrJJaM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=kjn6/7JB; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="kjn6/7JB" Received: from [192.168.1.102] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 08309193B; Mon, 17 Mar 2025 12:55:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742212549; bh=L3EHJlduO8HxIoJ1jIlrPRmfWgrTM/fRI/20nH4RFRs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=kjn6/7JBMNxmOVAxv00ALnZrrds3KTld4Dn12Kbc1l1UpMlz2CKRfekW8DL/zTiEN s9QQcDdIEGQya/u39rm7h0iTuizNB8Rno7hwACcZ3O3qaZDfSwoIRQ9B+bpWWp/bEE joSZn9uqQpum7qe7mKvW5YN/CpM/xL2Cyy6itozE= From: Jacopo Mondi Date: Mon, 17 Mar 2025 12:56:44 +0100 Subject: [PATCH v3 6/7] media: vsp1: rwpf: Support operations with IIF Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-v4h-iif-v3-6-63aab8982b50@ideasonboard.com> References: <20250317-v4h-iif-v3-0-63aab8982b50@ideasonboard.com> In-Reply-To: <20250317-v4h-iif-v3-0-63aab8982b50@ideasonboard.com> To: Laurent Pinchart , Kieran Bingham , =?utf-8?q?Niklas?= =?utf-8?q?_S=C3=B6derlund?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Jacopo Mondi , Laurent Pinchart , =?utf-8?q?Ni?= =?utf-8?q?klas_S=C3=B6derlund?= X-Mailer: b4 0.15-dev-1b0d6 X-Developer-Signature: v=1; a=openpgp-sha256; l=4350; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=L3EHJlduO8HxIoJ1jIlrPRmfWgrTM/fRI/20nH4RFRs=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBn2A4lk1YJ67TVGoJyyx/LynhHeRFnF1yfnWVv2 SQ5jxSk1JOJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ9gOJQAKCRByNAaPFqFW PKnWEACGzM2dIVMmAfTp4XTh0JiRopsZmf8hui1fEp18wKJqA/ay66zT29GUTAldNF1maEL/ieW j827S9XwbIPpUWUNfoc2qDDh7sbZGZN0RhEq/YZEtu2dpgwWjQDlXQ/GpTanmASXh8X/UrE/Zwy 6gX3jHZC9csXnmK49sGuJgSDU6iWgy4DwZ801Oyuglai3Vt+KbTUelxnqW4Hg/k0VyoSErYQqNA kWJQz7Y6y66wwJvu0++coDbYEP/tZuPl8Q2qgWtj1OLvaTW9KtZW4vC+BwkMpmURwCxUAispFJI Ntsh81k7RQP2eyZExbWk3Zvvw4J820hl9iMQtAcROnBI03g8yvo7vurhMVxsEXWbEpGRqjJp85A sov2qcBoK9gzgN8QiU4DaW2J3XK30Cr1vHHMZaj0AyEG0ifkUso3aDEeuDRHJeYjNhYb0xabl7/ rDBT+MtVaAzHDMdhVrE2pURdHcKU+ZInFTTL1HqSwAGgYERRhJt2PzMuVUCmCMlbZTB6J5Qc1gY qM+bMs1fXN3pMAs9CDgwQJi2BlH2AMnPyE3dAt0y+w8iAGKoRQOb7X3CNIxFwPrZj5SyXgyROR5 bKLPQ7qnhyWbp73T3EwmwQENEOlaxuMChV9NWT1VzKXNZvI66OI3R1VZ+bq7/F6uW3CheZGFMtU 3Hy0Cgv2lXYciFQ== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B When the RPF/WPF units are used for ISP interfacing through the IIF, the set of accessible registers is limited compared to the regular VSPD operations. Support ISP interfacing in the rpf and wpf entities by checking if the pipe features an IIF instance and writing only the relevant registers. Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Tested-by: Niklas Söderlund Signed-off-by: Jacopo Mondi --- drivers/media/platform/renesas/vsp1/vsp1_rpf.c | 11 +++++++++-- drivers/media/platform/renesas/vsp1/vsp1_wpf.c | 14 ++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c index 056491286577cc8e9e7a6bd096f1107da6009ea7..4e960fc910c16600b875286c2efec558ebdc1ee7 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c @@ -84,7 +84,7 @@ static void rpf_configure_stream(struct vsp1_entity *entity, sink_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SINK); source_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SOURCE); - infmt = VI6_RPF_INFMT_CIPM + infmt = (pipe->iif ? 0 : VI6_RPF_INFMT_CIPM) | (fmtinfo->hwfmt << VI6_RPF_INFMT_RDFMT_SHIFT); if (fmtinfo->swap_yc) @@ -98,7 +98,7 @@ static void rpf_configure_stream(struct vsp1_entity *entity, vsp1_rpf_write(rpf, dlb, VI6_RPF_INFMT, infmt); vsp1_rpf_write(rpf, dlb, VI6_RPF_DSWAP, fmtinfo->swap); - if (entity->vsp1->info->gen == 4) { + if (entity->vsp1->info->gen == 4 && !pipe->iif) { u32 ext_infmt0; u32 ext_infmt1; u32 ext_infmt2; @@ -163,6 +163,13 @@ static void rpf_configure_stream(struct vsp1_entity *entity, if (pipe->interlaced) top /= 2; + /* No further configuration for VSPX. */ + if (pipe->iif) { + /* VSPX wants alpha_sel to be set to 0. */ + vsp1_rpf_write(rpf, dlb, VI6_RPF_ALPH_SEL, 0); + return; + } + vsp1_rpf_write(rpf, dlb, VI6_RPF_LOC, (left << VI6_RPF_LOC_HCOORD_SHIFT) | (top << VI6_RPF_LOC_VCOORD_SHIFT)); diff --git a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c index a32e4b3527db41e7fac859ad8e13670141c1ef04..fafef9eeb3f898b774287d615bb4a99fed0b4cfe 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c @@ -247,8 +247,11 @@ static void wpf_configure_stream(struct vsp1_entity *entity, sink_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SINK); source_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SOURCE); - /* Format */ - if (!pipe->lif || wpf->writeback) { + /* + * Format configuration. Skip for IIF (VSPX) or if the pipe doesn't + * write to memory. + */ + if (!pipe->iif && (!pipe->lif || wpf->writeback)) { const struct v4l2_pix_format_mplane *format = &wpf->format; const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; @@ -291,7 +294,7 @@ static void wpf_configure_stream(struct vsp1_entity *entity, * Sources. If the pipeline has a single input and BRx is not used, * configure it as the master layer. Otherwise configure all * inputs as sub-layers and select the virtual RPF as the master - * layer. + * layer. For VSPX configure the enabled sources as masters. */ for (i = 0; i < vsp1->info->rpf_count; ++i) { struct vsp1_rwpf *input = pipe->inputs[i]; @@ -299,7 +302,7 @@ static void wpf_configure_stream(struct vsp1_entity *entity, if (!input) continue; - srcrpf |= (!pipe->brx && pipe->num_inputs == 1) + srcrpf |= (pipe->iif || (!pipe->brx && pipe->num_inputs == 1)) ? VI6_WPF_SRCRPF_RPF_ACT_MST(input->entity.index) : VI6_WPF_SRCRPF_RPF_ACT_SUB(input->entity.index); } @@ -316,6 +319,9 @@ static void wpf_configure_stream(struct vsp1_entity *entity, vsp1_dl_body_write(dlb, VI6_WPF_IRQ_ENB(index), VI6_WPF_IRQ_ENB_DFEE); + if (pipe->iif) + return; + /* * Configure writeback for display pipelines (the wpf writeback flag is * never set for memory-to-memory pipelines). Start by adding a chained From patchwork Mon Mar 17 11:56:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 14019117 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A47F923E33A; Mon, 17 Mar 2025 11:57:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742212669; cv=none; b=hZ/DKRU6z0amPEuDSoVSxIJNLbAgEapAyvO1Goqy4Gx5DSa8EHY93XNkwtBM/ayzJS0/68JryGS6ryZfiPUfAtCr4BWhNPXFbvZFDKFKKP0wHAw4q/f0xzjK4ic45F/Fm2N3avelp5I4Gfg0Dy2eXND5lU5DI07SkdX3zNNs95Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742212669; c=relaxed/simple; bh=bq3PFayu/4BwfT2SlO+W2wU2snxSQnLdE8pQmBjWLnU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Wh5m6roboVyODjKmJhAW/1Q6qb9MVKCq7i1H95q2EiHOHomcBh/IrjjeEEG/9OnerCDQmKM/1oxK6ixKB8Kjs57AyXbf43rulnizSZNUlCNFUuVNDJQ0RgjH7dqHqgGu1u5xYOouLhAXXiSymq3xyDMVCb6QaNHGcG0nnVm3LLU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=NWfJO4UQ; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="NWfJO4UQ" Received: from [192.168.1.102] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BCDB219C7; Mon, 17 Mar 2025 12:55:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742212550; bh=bq3PFayu/4BwfT2SlO+W2wU2snxSQnLdE8pQmBjWLnU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NWfJO4UQ2sPYdFVkeRPNPkXcsxIBVsuLneDHkI39mrvzp/MYfREBuHpyHLFRkjLWk BIjG74rHteI2eN2vwtu8W1e3bu2XsoACaBknDo1W7RpX+k1L0h3OTtL5SbLQoClF4i 0Nh4U8WDGBEqz4XiVJl27Ng0xsUbL1K1p95x1pc4= From: Jacopo Mondi Date: Mon, 17 Mar 2025 12:56:45 +0100 Subject: [PATCH v3 7/7] media: vsp1: pipe: Add RAW Bayer formats mapping Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250317-v4h-iif-v3-7-63aab8982b50@ideasonboard.com> References: <20250317-v4h-iif-v3-0-63aab8982b50@ideasonboard.com> In-Reply-To: <20250317-v4h-iif-v3-0-63aab8982b50@ideasonboard.com> To: Laurent Pinchart , Kieran Bingham , =?utf-8?q?Niklas?= =?utf-8?q?_S=C3=B6derlund?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Jacopo Mondi X-Mailer: b4 0.15-dev-1b0d6 X-Developer-Signature: v=1; a=openpgp-sha256; l=4791; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=bq3PFayu/4BwfT2SlO+W2wU2snxSQnLdE8pQmBjWLnU=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBn2A4liAhyBVGNxI7gQVZyZo3ZAkozexTFiA19l lBOrTKfC/uJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ9gOJQAKCRByNAaPFqFW PI9RD/9TEnzECr/kPgF0R555kLpW4jEADpErswgIN6W/GbXMwUheqDyBE2CiTIKkISuIxnl1DuP /4VSmJzfXqiSVcDCvgrlawuOTJlHhdWhKtZoopgs2soJPvQaT6C+oUxEGHrvbjW1idVRuz3HgrI kB1nHO4hd3CS43UbMvdVY60EPmTkKb0bM20JQvD5spBn8LkdzlLvFPFZkAwt/NfzYZtoJt8m27p WRy9y9UrfMOQZgBlcqo94XfsRU3tWseUiBbY2hYZxYpTbvWanAlnv6p9OXpyY4dAJet6TE5W7eQ 6FpLMk14l737P4bMv1PblultZl/dayS2huQsYzyYhErKaqqDcMzkc75v1TGD8EN/WvKrM0aBeLt Nu3RvVJBtzv3o8m9PwWcJl+Lljq1B4e6uohSQR9E/UGi5J2PhvodnfM7IHz3jhr5DtevHrT66zB GeLWgLjcnj89u1iHqdKJFUwD27KwyIJzHeDS6caZ2Vu1pF5qBqjE7OpCEyldIfdtpeAZ6Fr8V/B 0WIhC6KBG2Ftw4trQ/W8le0B+XSzR6svTkr6GBb2prywtVYyWKfNuMRG/tcsMUJd4Spm+cikI7Q 111iWu/iEUFITOte6vY9WuUdsXiWiEbkQnYxnty/6noQq23ScB7lnSq+hfD97wSuGGQoEvW3StB v9zk5CD8yR/sPUg== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B Add formats definition for RAW Bayer formats in vsp1_pipe.c. 8-bits RAW Bayer pixel formats map on VSP format RGB332. 10, 12 and 16 bits RAW Bayer pixel formats map on RGB565 insted. Signed-off-by: Jacopo Mondi Reviewed-by: Niklas Söderlund Tested-by: Niklas Söderlund --- drivers/media/platform/renesas/vsp1/vsp1_pipe.c | 72 ++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_pipe.c b/drivers/media/platform/renesas/vsp1/vsp1_pipe.c index 8e9be3ec1b4dbdad1cbe35ae3a88952f46e41343..6592513ca833175bdbfe850d61d1b5957ad27e0d 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_pipe.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_pipe.c @@ -30,10 +30,80 @@ */ static const struct vsp1_format_info vsp1_video_formats[] = { - { V4L2_PIX_FMT_RGB332, MEDIA_BUS_FMT_ARGB8888_1X32, + /* Raw Bayer 8-bit: Maps on RGB332 */ + { V4L2_PIX_FMT_SBGGR8, MEDIA_BUS_FMT_Y8_1X8, + VI6_FMT_RGB_332, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 8, 0, 0 }, false, false, 1, 1, false }, + { V4L2_PIX_FMT_SGBRG8, MEDIA_BUS_FMT_Y8_1X8, + VI6_FMT_RGB_332, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 8, 0, 0 }, false, false, 1, 1, false }, + { V4L2_PIX_FMT_SGRBG8, MEDIA_BUS_FMT_Y8_1X8, + VI6_FMT_RGB_332, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 8, 0, 0 }, false, false, 1, 1, false }, + { V4L2_PIX_FMT_SRGGB8, MEDIA_BUS_FMT_Y8_1X8, VI6_FMT_RGB_332, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, 1, { 8, 0, 0 }, false, false, 1, 1, false }, + + /* Raw Bayer 10/12/16-bit: Maps on RGB565 */ + { V4L2_PIX_FMT_SBGGR10, MEDIA_BUS_FMT_Y10_1X10, + VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 10, 0, 0 }, false, false, 1, 1, false }, + { V4L2_PIX_FMT_SGBRG10, MEDIA_BUS_FMT_Y10_1X10, + VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 10, 0, 0 }, false, false, 1, 1, false }, + { V4L2_PIX_FMT_SGRBG10, MEDIA_BUS_FMT_Y10_1X10, + VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 10, 0, 0 }, false, false, 1, 1, false }, + { V4L2_PIX_FMT_SRGGB10, MEDIA_BUS_FMT_Y10_1X10, + VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 10, 0, 0 }, false, false, 1, 1, false }, + + { V4L2_PIX_FMT_SBGGR12, MEDIA_BUS_FMT_Y12_1X12, + VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 12, 0, 0 }, false, false, 1, 1, false }, + { V4L2_PIX_FMT_SGBRG12, MEDIA_BUS_FMT_Y12_1X12, + VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 12, 0, 0 }, false, false, 1, 1, false }, + { V4L2_PIX_FMT_SGRBG12, MEDIA_BUS_FMT_Y12_1X12, + VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 12, 0, 0 }, false, false, 1, 1, false }, + { V4L2_PIX_FMT_SRGGB12, MEDIA_BUS_FMT_Y12_1X12, + VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 12, 0, 0 }, false, false, 1, 1, false }, + + { V4L2_PIX_FMT_SBGGR16, MEDIA_BUS_FMT_Y16_1X16, + VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 16, 0, 0 }, false, false, 1, 1, false }, + { V4L2_PIX_FMT_SGBRG16, MEDIA_BUS_FMT_Y16_1X16, + VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 16, 0, 0 }, false, false, 1, 1, false }, + { V4L2_PIX_FMT_SGRBG16, MEDIA_BUS_FMT_Y16_1X16, + VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 16, 0, 0 }, false, false, 1, 1, false }, + { V4L2_PIX_FMT_SRGGB16, MEDIA_BUS_FMT_Y16_1X16, + VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 16, 0, 0 }, false, false, 1, 1, false }, + + { V4L2_PIX_FMT_RGB332, MEDIA_BUS_FMT_ARGB8888_1X32, + VI6_FMT_RGB_332, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | + VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS, + 1, { 10, 0, 0 }, false, false, 1, 1, false }, { V4L2_PIX_FMT_ARGB444, MEDIA_BUS_FMT_ARGB8888_1X32, VI6_FMT_ARGB_4444, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS | VI6_RPF_DSWAP_P_WDS,