From patchwork Fri Mar 21 15:45:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 14025683 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 99094154426; Fri, 21 Mar 2025 15:45: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=1742571946; cv=none; b=Oysnca3uSESwhpYREhznv4YqCd/gtG3duMDtXg6Fiblo1Yz31RJXIvGKTXP62HX8o/IWw//d1pqCFQ0nXcUX+5mO9O98kOJzkuX27RdHobl7Ke9jnjn7XA7kO4N+TfANeHBgMXtou08Tbo8nb1J7lY/7GFhMVZ7Z8eGJQRL1quA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742571946; c=relaxed/simple; bh=mJknMhHwY51fCLlC4PKnAISgV5O4N7lJcBbILqKyOow=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nwaV1NWKfVuGxtlIcHVqT63+s6ohMJknMmUPC+MbgxRYhh1iL7CVHc0ltcZ7ADofWMFpDYeTg3h/SeigaMcEBch8F1ONzbXACRxFRl/sDQ61ttT81ZAx2AeO4Kemekz1lXcdRUgKF+eM2wSOp6P8Ksc2cYHL4zlZ3vmpiyWGtNU= 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=qoAk13dm; 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="qoAk13dm" Received: from [192.168.1.109] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 160899FF; Fri, 21 Mar 2025 16:43:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742571838; bh=mJknMhHwY51fCLlC4PKnAISgV5O4N7lJcBbILqKyOow=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qoAk13dmEx1Jj550QtGFinyjedNk5p0l9vNOrrQ9b5tPrzyUmIU3woorMxQKsbpuh 116shp8zAAOL4k5c6xPlLJvQYEW29aknHMkSMqmKbnpbqcH8TaLwwD+/yXwOf+svCb q11CKwJ7MYGtcUximGN4ZpLNvYuGFRSNO6HjndFY= From: Jacopo Mondi Date: Fri, 21 Mar 2025 16:45:33 +0100 Subject: [PATCH v6 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: <20250321-v4h-iif-v6-1-361e9043026a@ideasonboard.com> References: <20250321-v4h-iif-v6-0-361e9043026a@ideasonboard.com> In-Reply-To: <20250321-v4h-iif-v6-0-361e9043026a@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-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=12221; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=mJknMhHwY51fCLlC4PKnAISgV5O4N7lJcBbILqKyOow=; b=owEBbAKT/ZANAwAIAXI0Bo8WoVY8AcsmYgBn3YmkkExO1L7LWpDRXAHIdvOh4h+qFcFxF0/Gz ibXhIm6gd+JAjIEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ92JpAAKCRByNAaPFqFW PL7xD/iGqVNTU8q9u9wdZ8OK22rqQR2qInqlBY4VOLhd6SEDxHsyxHS8YNYoL+omRefGz75Ydkd NgQnYL4l0VQTBd4uZvE32z0+JOk8x4E8OFsqb6vypyxo5XxJo+ZNMP0V+S8w/5gMilaeCD5+FRK 3OeqIpmEOZry5myqAQznlmU2m/1d+LunN0Am5qXt3mMlRwNeoL+vSe1Dqme0+5k+THYe6PEE2zS /MjXXYhr4PUUr0TMdn765ZLhZNdJfRdUhkazhfz5L5+2Br9JpqztVX+fJuYDiF0ZlZNddDJKuND OG/NBjBiIJhORP3lSxNCvECffD/WIdw+V0b6xEWxFGgTnWyGT7WVcbpzKRrS+duldfk0V/XphJV VDjnlgRq+WIru4TiLZzIqZYAeOSLVbLOymfUA6qGektZe7NyifHYrDep6anFkmfrJNCAhBJcqYC 5zl5mqOqe99BfaTexU4+uUZfbw5yLBzh/5i9oPcX2RRt2mqEbOIw8xdygBJQGuBp1/SKg69uIiu Tnvjye2lFDMfJNoaDasL83os+MlEIE0+guWF4uD1PHjNI5kph2J7/VLgRvL61JdaPxnintOf6eT clHC5Z9q839v+UZAwhaQOrUB5dxf67cvb3n5ZimLox5tN9Q9+CP+y6hkTKwHkUdxvqBlwREI6+G Sfomb37d2yySi 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 4bb4dcbef7b5..de8c802e1d1a 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 2f6f0c6ae555..263024639dd2 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 9fc6bf624a52..d13e9b31aa7c 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 8b8945bd8f10..2096a09a1278 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 1bcc9e27dfdc..bdcb780a79da 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 000000000000..5dd62bebbe8c --- /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 000000000000..165996a822c1 --- /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 bb0739f684f3..8e9be3ec1b4d 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 1ba7bdbad5a8..1655a820da10 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 7eca82e0ba7e..86e47c2d991f 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 Fri Mar 21 15:45:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 14025684 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 6D0A422423F; Fri, 21 Mar 2025 15:45: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=1742571949; cv=none; b=KHLNpFye82ZpEgMYnCIdHAQc1iS/bvwtag0G/yUNt3t9BD3NYF1fBkJqETaEVoqGx/eog+I+GDcULuxAy5vJeDGw3t8E3X2bLOZr/Dyym+XQXuUKHwFcHrMe3iTNFlukR897hlGgvGDxMdgN8HMcOREtwqyQuHr8rUiMm6AZ21k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742571949; c=relaxed/simple; bh=Yajun6kMjbV9z3AGrMVZcN4ap3LqbMRdasdkVLXWuJA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D3qG75N7rmt4fRxm2HXOJRPyGcplwZaCsnxqClwMBANEcnMhAjes3ZqucVN3Q6O0Lj+zsM+3qhBbFOyyXoLE92my6jw7Zg5xtNGkRwbKtMFZg0SY5H2Ym2QtQkcGlXqEge7v/OtGveGYdkkjRIfT1durrRfiU5Puv7Z935ZBANE= 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=YckXoq8p; 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="YckXoq8p" Received: from [192.168.1.109] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AFCCF1112; Fri, 21 Mar 2025 16:43:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742571839; bh=Yajun6kMjbV9z3AGrMVZcN4ap3LqbMRdasdkVLXWuJA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YckXoq8pSPNNgsZKlsVEYFsp7stB43SHng05TPsR7xeo2U3gZsh4/YTXaPUJWOSXL 6cEQyIkzcrTUAuAHyOQuSl//LUr6fSh3mZtr6ZzBbJz3qdW+rM1PW8aeug7Sb81KFb TIwyvIH0Nr3DToF3ZUfE03OmSMSGww5/fbzvJ0Fo= From: Jacopo Mondi Date: Fri, 21 Mar 2025 16:45:34 +0100 Subject: [PATCH v6 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: <20250321-v4h-iif-v6-2-361e9043026a@ideasonboard.com> References: <20250321-v4h-iif-v6-0-361e9043026a@ideasonboard.com> In-Reply-To: <20250321-v4h-iif-v6-0-361e9043026a@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-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1881; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=Yajun6kMjbV9z3AGrMVZcN4ap3LqbMRdasdkVLXWuJA=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBn3YmkiNEmfWJCU59bpklY/1LtzZjvUCpRElBJ3 OdJm/eYEnSJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ92JpAAKCRByNAaPFqFW PK5BD/wPsyuS2aF4gRZ+wjfZDURpqDpG9s57hvIZZbXhLMKz7LRvBhWPzBWQPkimzVDcTOaXjQU l95yITRziFwMTWXZEedUkbxsGPdVh0y3PCtlMXer/SJ1vdx++rQ5StrX9eXspIyUhRjufJBABoT CgjdKacMDAlQTNwDJ86502YVS2HUAcT5G8JhFZ4CGUnQVQCPxBly/55W9JLoIrJBWtNrSeK/DV0 qBLOpn3efS8a5k+qf2mM+ixg3s4Mie9h3GrhlfxlJk7PPaLXU3Y2f+mxttDki1aRpJu+D0Ystfz g+nYhqoomyFTfH3qToGUsiOsNEFdkn/1jddA8dqeoQEdQgmGENW9elU4VOeK4TbYpjotjStM7IM 66WwItgzcrYnoemUz1VTQE1MYlCTtrSC4AbgNiPSCAummj8cVtjC1LhSAyV1xXpehx0ijyyMvwd hgHvGF7EuAULeaV7bHQ8UAGsg7rA7dz+98VSc/LO1JSxTKIsxgCsGtRKKkvy9abbNcA21SRv7lu IIjjtNWM6qyWEY7mez7aal22wShNc18TRGu/juunBK4BKNell5uudP005thz1Or12Ea0XTT6c3Z L18eBLKGSKkkjrq4uIlbXG1N2dp7igRMJkY0mg+Rx0SolW9Wyx93TUrWYW+qp84GoPqHU0TcLNg wQyQbM70/6rGiIg== 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 ad3fa1c9cc73..bb8228b19824 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 Fri Mar 21 15:45:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 14025685 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 6F905227BA2; Fri, 21 Mar 2025 15:45:48 +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=1742571950; cv=none; b=bIHjpiNwPeVHAs8op3PvW3EYITv3LHxxnrCOQRvcwmvx3OXkW3CL69ZtRbY6lgUwRd+7wDIb9uBrmuHzLRAPZqcbOCWg4/KuL5D/wZtj5iU4fqiR+yPO34bsckiiRWoDm15hiAgLhYRcrIGmx1JQ5p+rm1rNvLT+tYEzcPL6jX8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742571950; c=relaxed/simple; bh=BpD1h8o+ayIQ9HPPT1CHNuNJ6FnlNNR/OmFuyw03Nwc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=G3SdaOJHITpFjKuak8PoxktmyLuMRuLxUCkOHU6lfPgKDAM2FI0lpD/MPGXiXXYuFGQdZHvQNYhnKG7z/YRkcbRpD9c4U65ZrwfR2Xi8IVjqOGRyp6xI3KLoHeO8YYoZGHYxpEQrJqyA3AniQPoAMi+wlrYdv+1VVvS/JyTA954= 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=I2P47qiE; 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="I2P47qiE" Received: from [192.168.1.109] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 54554146B; Fri, 21 Mar 2025 16:43:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742571839; bh=BpD1h8o+ayIQ9HPPT1CHNuNJ6FnlNNR/OmFuyw03Nwc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=I2P47qiEZOxaw2rm6Psh8Z8UOKWQ1KksWgLAuBq+isxma65/QHYE445RC9XV55nyQ +5gc76/wKXdkNSdp6SXv+1H/aOyf5FoGWmvbxe4nBWxEnvjQ+YfdXBV4zLy/P7kBSP wRZInVTC9HJhtYtZiq0iTyFLPh6fGBBBMJG1AAbI= From: Jacopo Mondi Date: Fri, 21 Mar 2025 16:45:35 +0100 Subject: [PATCH v6 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: <20250321-v4h-iif-v6-3-361e9043026a@ideasonboard.com> References: <20250321-v4h-iif-v6-0-361e9043026a@ideasonboard.com> In-Reply-To: <20250321-v4h-iif-v6-0-361e9043026a@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-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2892; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=BpD1h8o+ayIQ9HPPT1CHNuNJ6FnlNNR/OmFuyw03Nwc=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBn3YmkvCA1iwvVR+pdWeMWlNdmjYFKO9VaGMBIR I9EFhae8syJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ92JpAAKCRByNAaPFqFW PLneD/9Lu3ODhJlAXk3pz8qjAHF5KyIrPjxVTO8fazdq2T7S+ykdZ0ldOs3PJVHc/+IazbQSQMi RDFXtOg+cA1pQK2rU2v2DVt0Tga+Fc3KyOrSUnTS4Bk0R4vELefi1iIF1LWn8aRrqJYb+y9nemT /zUf7ZgEIwwj0k8LkwqiMwJK6z4r2cNctRAO4SHV48NETDMCr6bnzHEQy7yrA2gbBS/+AsHMXIa wYh6EtMIhy8etHOZohK19F5SCDI81fG/KyVplvRlPJIPUPN70PTDet44Hr5SojVgJPvwenRr91B Ah4mltajzU34gvAulB7iK+rSExsra8YC0/C3XqDcxBsTiEIcCBjG8uQWAy7O0+EMLBv3YNrZFIh GAMIdnPjwFsPvrriUU9mLp67iFNSsmKYPLZnAbVRfpX42ebdX9essjpLhdCK9dSl/NrbB7EwlvZ 99HMstafSTmSCM1FEI1Y4pCWTHHHThhNBA2c4JcDOzJJSjp5PuRjONme9o6MKH3sln4NqeDg4cC Z7rbbLhuuLiSLo4DBo+7ceGNw+bdMbvv79/p4A8zphKj/u8xRnu/2A2eFXeWrf0u3zRgSX2nJuz kvubyiibZ0ozoMHdfEfKYnppctPmwOsoEjdOnwVTiW8c2+zjU/GEnmosUWG9vRiTl1K/WueTqAm 0B68sGIUXUt1mXA== 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 9d38203e73d0..93b0ed5fd0da 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 Fri Mar 21 15:45:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 14025686 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 7BB1122B5A8; Fri, 21 Mar 2025 15:45:50 +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=1742571952; cv=none; b=dJ5z2E7pxf4JqPJdXrZsZbdpY8SsNF6G++Zd3xMEyMonvvmrrZoyDAjGqRKLHGU+qyeJbfjtKIDsEOVD63p4RM0w/nVDHyqsKlVLemDzt+dDjimG7fG3+7Qoj4KmP0jcTqGiO7ziDIGwlaoE6jh/YPDbProbmH0nAgaHMNhBO0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742571952; c=relaxed/simple; bh=QKOvnt4V2j7Ud2WP+3AgBCDY0nLJ/iaswXcqa7b8V6A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EUVG4ix/Q+e4sSiVq19vO57G39dRYP8YgB5EReZza4Rc+VbzE9fN/2hAzQ/9jTl6AXHW7MGLwh5klOS7zr617cGIeH3XbK+LeQAZ9jlIm7sdW3RPzRA4LKzOGjIygWH7NYR//Y+k/0mIovqtn65RcUVyEIobe8BegIK1xSKcJNQ= 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=Sv8SZQDw; 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="Sv8SZQDw" Received: from [192.168.1.109] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EE68214AC; Fri, 21 Mar 2025 16:43:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742571840; bh=QKOvnt4V2j7Ud2WP+3AgBCDY0nLJ/iaswXcqa7b8V6A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Sv8SZQDwTOg8cQ65ZGI0MPdK0QX4csl9oDyIFaO6EeWvxji9pjeMk43vTLv+L9TCC 9lWQgAejhLn2gSuJCQOAtsHwTKddV/ifqbdTun7DPBuumIesIPic0lgKU+XXNveH4B iNNDADzM3P8Z4mJjO/BOBrDw7GbU9K5ohI8GGOss= From: Jacopo Mondi Date: Fri, 21 Mar 2025 16:45:36 +0100 Subject: [PATCH v6 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: <20250321-v4h-iif-v6-4-361e9043026a@ideasonboard.com> References: <20250321-v4h-iif-v6-0-361e9043026a@ideasonboard.com> In-Reply-To: <20250321-v4h-iif-v6-0-361e9043026a@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-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1758; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=QKOvnt4V2j7Ud2WP+3AgBCDY0nLJ/iaswXcqa7b8V6A=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBn3YmkRznniXxQ9+2XPV6tviYiTVWpu2gTMZzmb FZ8gxg/2AOJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ92JpAAKCRByNAaPFqFW PKMyEADDGoZ3jWjOQgSYqKSUf19KAKgSaCiZjpCFIhJR4Mtgwq+28fOe819yZ6quqDXYt3e0bKX unhUyr02l8fwwA2s8u5Plej9n3giR7oA6Tn44G3dbS+pCdy65MgZdouRKPf/j1Co5s55l0+TfQ+ Q50fuQNMpbKL3s+6FqSaXlPSytT1ag2hqIO+86MvtMqgT4alBN22CIcMTJ/W/oL1Qd12n0GeKX7 7bA0shruuCVGS4wJrtozfcRTqZWFy8SbeoubBuc/FA8JqeRxEXaQI55JA8/WYcTBWcx5NBcPd3M gFkiNm3fsx+rlghsqOmbi1YxF3EzivzrXezZosrIgCFnr+WNdWxjKWFOJPgWEZr0uBZwlMA2hU6 JprIVTaeI1r2PSK4ZVvuP65pyGQtRHA0zEq80KqM7NEHfzFQMsJa011PMfVhNBd7VxpPvIXVF56 wfghvKMKRjHhDAyKJ3s2RTnF1yavifoP1iOSiruD6ce2Ht+TcAkD/kG/IGqHfiSrTc2layujh21 427P1jf6JAhXq33zNJIkxZ4U8Hk4uGnzeM8g6HVGg65eRrYNrLiNHBEgG0tmX++x4fEdOplcXQn qGxD3EhnUlB/ggQYTa8Stqx0MpJVTAZ25fUL4Dk1UqQPx8Nj96C3IQAHIVqJ3XFhZ1MtiVGBYoZ nQuNBXMmv3V9pxg== 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 Reviewed-by: Laurent Pinchart --- 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 f176750ccd98..da651a882bbb 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 Fri Mar 21 15:45:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 14025687 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 2066D22CBC7; Fri, 21 Mar 2025 15:45:51 +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=1742571953; cv=none; b=g2au75Ux2F28gAz6yVIxiMC7+9d3BS/4c2Et+L+Nz2fs8mnQ+PuA/MUvxkTEM6E0SgPBrSn/k3v1i5q8Mg9lK1U2Sga1tj7BGy4WlLHCGMTP7aNBZ5xPX191L3658v8tvizhtDFxAQvF74byn97f6PESjcHj9kEfxZkTXvqF40E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742571953; c=relaxed/simple; bh=U/UplP1DgHiA3hPWAMkJFrm9ZEdaeEJUcJqBVcZiFfA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=swCfV6+M6ndrhWGIWtX/j+1O7zexR/NHHlC/s38lLVzjT2J38/otGrsVlE5uBpeUySQ5tqxjzIuGYcZR3EcuMH0v+A25xZYSwxx7cP3pzbh0Hnm3HTyzAe37G+kpRmUgnZru96sSh4IJ6Wt4VFa1wNa1ytDnXESowDrhANFjFwA= 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=WfnWfVp2; 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="WfnWfVp2" Received: from [192.168.1.109] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 79E60158E; Fri, 21 Mar 2025 16:44:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742571840; bh=U/UplP1DgHiA3hPWAMkJFrm9ZEdaeEJUcJqBVcZiFfA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=WfnWfVp2prljTGNbDORY/OuKz2+/1WP7yW2EKVfURBXuUCN6vLJHNzMEv1LpNCjr4 nI/6jIGH5bO9Cws9EiIWqkqNB3ZbioAYqctn6HFCXANYAtxtp9fHIVEFV6T5UiU7qz K2DYf8XEDe4V7Z4HLXHZyNwqIKjQXrFtBSSc9otI= From: Jacopo Mondi Date: Fri, 21 Mar 2025 16:45:37 +0100 Subject: [PATCH v6 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: <20250321-v4h-iif-v6-5-361e9043026a@ideasonboard.com> References: <20250321-v4h-iif-v6-0-361e9043026a@ideasonboard.com> In-Reply-To: <20250321-v4h-iif-v6-0-361e9043026a@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-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=7428; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=U/UplP1DgHiA3hPWAMkJFrm9ZEdaeEJUcJqBVcZiFfA=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBn3Ymk9PkGTRlW77jJIogPycrXhxsjj73ldEhIH BGOtFr9qdaJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ92JpAAKCRByNAaPFqFW PLi9D/9qkcEASjapaMSTsLsw9ExRsjHIlCzO66hz2LoIJutNg7GrcTnB7Y23Yl79CTNX7s1OWA3 BuTKYVn3MUkJAtsTn6WHzmz9HM0/uo7sCA502ViPshBVGSWlHCscYM83fkhuwGhJXgEpkLLAOWw 1wTX1rfbZ2YSDGpMe2aA64AGCr9wgh+xbmdzDNB59J5Ctd4Zeklge5l6VQLQJsQ/w+dxIk2OROe yqELxvk6fkOpuyOMAIu1lZtY7orea073TKea2cZKcP2KpCnNkeO8HewXyFFdHyodUUNwx6xRwHa u2kV4QRCEGy2sUHFN+4prfFISCMLVJYkNByuYHcxIc5Bd1ZEh7TSZttyqh/UobuJFnyDxtTJUw2 xjB3xgcSofmFBYxYWLgZ/ww+HKcaj79xtZPBUQK++KAhmxxUjDrsNNrgt5rpho9lDTetx0ibb7q 8wMRka9RHD0I8lg0ejzHGvfnbuh7yr3qjoaXMPz4+/6a7Ybbq0F5vbLJyrzklcFoyqB64BaFB9r mV4A+YOitRvWPxf48EWVKUvMkUbL6oB2OYaxzj9+G79YpIO1O5YTg8pvNgnINMfX4jzRCH9WtBk xCOYJ7gXfhRtRT1Rf2irlLH+Zthmbrnt3Fi+8Id1sXgi3FefBdYRvTksGy+FNJKME1+4WVx0AcE d5jXNAMxh3fAghw== 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 Reviewed-by: Laurent Pinchart --- v4->v5: - Drop double empty line 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 | 78 +++++++++++++++++++++++-- drivers/media/platform/renesas/vsp1/vsp1_rwpf.h | 4 ++ drivers/media/platform/renesas/vsp1/vsp1_wpf.c | 7 +++ 4 files changed, 90 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c index 5c8b3ba1bd3c..056491286577 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 93b0ed5fd0da..91d70886e64d 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,37 @@ 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 5ac9f0a6fafc..64feb4742494 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 da651a882bbb..a32e4b3527db 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 Fri Mar 21 15:45:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 14025688 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 0F25D1E571B; Fri, 21 Mar 2025 15:45:53 +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=1742571955; cv=none; b=nm4Ch5jXGyPynmSLEE2VGuIb1bjwXE3jlJpZoU6QI78MBdkGOgkvRnK7RJdFPVzjJRZgTMhEaaLvK/y4osKZvIeDdq9Zvx9WDZldCKcTjtED/1n8JYtjV0nIo2tcBV4XpEk7Tdw+CPByWWWqR9oGY0WNSNzVB0CNdxObcd0s4j8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742571955; c=relaxed/simple; bh=GkhQrc7huofYtRfwb1FCBYsdda+2vEItebsLYKisRQI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PqJ5ikPpPyahc4/SEz0wzZo06ZecXv8QHK/cmbj60nSJcPiqBsSqmrJ89OgqjKFMiVaPTNAjrqzhhfGPUzgXAXXjLTupjaJvOmZCGi4Brtj6/oGhRQE8QZ+MuXt6+gfDA4tEFXomE58r+3L7mvv5kzLxMu2/QmjdHik2pjQxa8I= 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=kjU0CHRr; 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="kjU0CHRr" Received: from [192.168.1.109] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 126B215CA; Fri, 21 Mar 2025 16:44:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742571841; bh=GkhQrc7huofYtRfwb1FCBYsdda+2vEItebsLYKisRQI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=kjU0CHRrNmsVFHsC85slhUpm+Uwrq8mFyMXVc0yHhdDHqisSvR/lSmO81A4vBH0EC /puxSnAYKwJQaBZD4aE3+Z/Zocpqg/ylHHx8++xR+mgNxLP7RfgMYGiHzTqoe/D2ne bSQ0/HiAdSuZzVLr1L8xDNhbtcmSQ24tRk6Mn3fQ= From: Jacopo Mondi Date: Fri, 21 Mar 2025 16:45:38 +0100 Subject: [PATCH v6 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: <20250321-v4h-iif-v6-6-361e9043026a@ideasonboard.com> References: <20250321-v4h-iif-v6-0-361e9043026a@ideasonboard.com> In-Reply-To: <20250321-v4h-iif-v6-0-361e9043026a@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-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3903; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=GkhQrc7huofYtRfwb1FCBYsdda+2vEItebsLYKisRQI=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBn3YmlaNTlX3P5JhA/hv8xEiyzaXYJxxE4dq3nA k5FW0Q50rmJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ92JpQAKCRByNAaPFqFW PEH5D/0V047oXoig8ufJwD8aUWg4YKVsL7K+bt0kmktFwGvXD4ByFD7VcXwRWnULfCd5AwMkBmv ZhIBVtHBakM1kGXO3MkRmlEwk67KBaF0JH5X6Ck4M/wDLkwuMeMb7Fx4i9s6Y5lZTLh1CJy3+bt qow1hSHjHpXTFNY9QlC5vrNiNBevgqu2GWkbRfj/SGvBsdevhQAL1qml/V5mBat+wdysro4Bn6E AZn3Iw1VeDLRmSShIgiifGgkqL0kgjCRL7yeda1mqmqgSZiP8KbQ1xJt71UKVpORsNb6SuXMBhp B/J71y9rjj9yj7fN1/ZBN6NMcpJ6I/rKo9akChLNvUUVUANhtRJOqOD9Y6E+zKF4fYz6tnOVr90 lLHvNrbw+g9Jtu/XF8f/tM2mYuePohNNumHsUu9+qlUlBGtBkvoS9iadjz+fWPXxeHYU8/Qb3k+ tzsaJ5boBxzNaZUSMROv3van9FFXUg4toYaHw31HFI66R6oEUP8qv3HV3ONbdLxDQuK7NsSxM62 Azc5LEGN1opDE2kka3OJN5PMkstk38jkxdjItHl9M1i22YJTGJ0qTG7MidDIQVQovjCmLZc1r+j DQ2evOgNy87f40lZheyOEzZ0uTPQYa8mlHkFVYozT3MCAOAxRqH+ChDvsdIPY4VQ2RiOKhhWBAO 4oLKgZWQ6K5B6JQ== 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 | 9 ++++++++- drivers/media/platform/renesas/vsp1/vsp1_wpf.c | 14 ++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c index 056491286577..6f6cf70e267b 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,6 +98,13 @@ 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); + /* 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; + } + if (entity->vsp1->info->gen == 4) { u32 ext_infmt0; u32 ext_infmt1; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c index a32e4b3527db..fafef9eeb3f8 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 Fri Mar 21 15:45: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: 14025689 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 7898322D4F9; Fri, 21 Mar 2025 15:45:55 +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=1742571957; cv=none; b=qmjxj49MMHjWiKfOOKkCLMRR0TetWeu/gFQg5gPR2R2e3NSS4l+mfUT+QsQNjnddvKIt8Cn8s7vGQMyMalGjcJQHXMM1IkGvkP0X/tYbW5AoqX7XDZSUE0JJzzKUQopl5LoRm2hDX4fOsWmGS7K20s6jSxGXfzHdHltcVH87Jls= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742571957; c=relaxed/simple; bh=RZNS0y+0e/yCc3+LUuaBbUDmxpcUGtmHMOolcJUG42g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tX+bNQ7gEnO2vcJeQtH2zFAp7w2uTeHgrP2DLsYkIi92UBzPnE4uMe0nwOT4ukViYs7ajVJoEUXYLqFHHszzAoOigmS89lDEhmw3fZ2UfrHIfhEouuGkKx+KBKC32HbVJ8/cWRTXSTVjeMYHINtt2bmVy/rkxuQgpxm+tijSF1g= 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=s4JNUeYn; 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="s4JNUeYn" Received: from [192.168.1.109] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AB634185A; Fri, 21 Mar 2025 16:44:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742571842; bh=RZNS0y+0e/yCc3+LUuaBbUDmxpcUGtmHMOolcJUG42g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=s4JNUeYn1jK8dO0rd3r7q6TyjNhcr0bmW9ofrZVjcEpT5bFPuZJuC0rwOSd4YAOo8 wsvzKsmNB3a2LfXRh7X+tnGJ8u23ILGJPwgxWLiw2cWK5qOezw91DEB/m08XNTRyjn q/yrcij+ViOLum+HYEAefJB+es5w3iOfLuhuQVHs= From: Jacopo Mondi Date: Fri, 21 Mar 2025 16:45:39 +0100 Subject: [PATCH v6 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: <20250321-v4h-iif-v6-7-361e9043026a@ideasonboard.com> References: <20250321-v4h-iif-v6-0-361e9043026a@ideasonboard.com> In-Reply-To: <20250321-v4h-iif-v6-0-361e9043026a@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-c25d1 X-Developer-Signature: v=1; a=openpgp-sha256; l=4668; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=RZNS0y+0e/yCc3+LUuaBbUDmxpcUGtmHMOolcJUG42g=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBn3Yml1iyjbylAxWpRNzTtOrtQhkATYsIMz+BEY 73xA+85od+JAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ92JpQAKCRByNAaPFqFW PLaJD/9roQ4yb2g79T/zGESS6D3dKSCgP7LHwnomWVZkvsoITgVYE+nYke31Zst/phbxpFdWva2 AlP3eR/EG29NrZqc+LZvYF2kfezgbLS+mjhWGD2CGslt/59thWXRz18Y34WvXmLDkVwigL8NtxF QdUkLWTQYAs+gTBpyETCTDyj+hpfVvi18MvpgZN+opadJmuq5FeLD7AgAKJqeq5xP85cz2US1mk AUmbalx3zGBDgFBcHKYxrgPpCaZ7wOTDAOUhHbgau7HgtIF8w6g968sK1EG4+AFOvgXCKfT45sY afEAWodPhxt3zv/Ug+LpfUAt41IOayy9XIaVuy4B6HTu1HbmnSwXNF254lqOqEdo9SS783QU7CC GC+nPIOiSjNcxEnUhARI0u2Rn722cVM52qUllMlo8CEuPP9Ucc/joZura60ddRrYN4xlMHTley/ CFmP+06qlepiISQc4uJ1Ek2HCWToZ2KIlFE4OLv8UuO0BfFvk8FAsDM5piHLbAYIDnzg7v71He8 D10i5ZzuqHetI8W4g2lL4vWoCpnmB5fwmIH7SzhrcMt2JjpOP009QR4KLbn69XZ3ZjZNdZzpoz9 MF2+UX+CsIaeufSxGiLuUldY0eGKWIgdRKUDMlLN35OBCuDKdkjQG1ohQlpftrWVs6UQhfOZZXB FPwNl2cFBXqzZBw== 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. Reviewed-by: Niklas Söderlund Tested-by: Niklas Söderlund Signed-off-by: Jacopo Mondi --- v3->v4: - Fix SWAP bits for RAW 10, 12 and 16 --- 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 8e9be3ec1b4d..a51061738edc 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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,