From patchwork Mon Feb 24 20:19:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13988882 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 870D01FF5FF; Mon, 24 Feb 2025 20:20:00 +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=1740428402; cv=none; b=gOuuuthHyLScvzkd7b0nmJ+GGgWM7aDIVx1UoLUB057A3mcg4FdtdnjCSyV50UE3Ic0Qgkc3oi9C8kZmUettxS6A69ch2wC2GVs3rX3DLEQm4iJiOFElcuu96X8TbieFEFRgKzZUavZHfzAf1SWxF71muomYzhfJXMSOqtu51qE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740428402; c=relaxed/simple; bh=/RxtWwoYoXIrodnSIYgLATNnVHkI2ng+An1Ak86l110=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RzycbfuIeqK+gVg6ftf1bRPFOgDkSKgIBxSLiCW/nkBc6XssZCqlixYuOO7aAgGfBY2QFqxUQcaR2yFK6sz4zHhkeRm/9CFks32S0GialHmgFlZ02/HR+EI5KhQA42HSLWVUUEx45l3lgr7cBlZJaz4u8lSurxNknFl/Tepjad0= 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=VXGaLugT; 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="VXGaLugT" Received: from [192.168.1.103] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 40BCA55A; Mon, 24 Feb 2025 21:18:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1740428311; bh=/RxtWwoYoXIrodnSIYgLATNnVHkI2ng+An1Ak86l110=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VXGaLugTDVVStZ7ZDWywpz3AuQ2d7iUBnDMlhlrT0rEw/vNDO94VT9g1bPTqy5Jfx vyQQaW+HGrqs/6QIDiIRpMx4WAPvnJ8drlV6vD8kuwIocgmLNRUEgJZkqS4SYNDatl oHs00BuZzCvlUpiKWnWO1jyzOIem0qOcsJKbtzmY= From: Jacopo Mondi Date: Mon, 24 Feb 2025 21:19:41 +0100 Subject: [PATCH v2 1/6] 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: <20250224-v4h-iif-v2-1-0305e3c1fe2d@ideasonboard.com> References: <20250224-v4h-iif-v2-0-0305e3c1fe2d@ideasonboard.com> In-Reply-To: <20250224-v4h-iif-v2-0-0305e3c1fe2d@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=13642; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=/RxtWwoYoXIrodnSIYgLATNnVHkI2ng+An1Ak86l110=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBnvNRr0ASOo8G++gLBQbxwuY51XTFb33kDdFaW6 P7n52Vasf+JAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ7zUawAKCRByNAaPFqFW PPpUD/9XpKEwSjj76EpU2lg7I3KYrg9olikJgHRRl24vzr+R23nls6elVOPMpb9mr2VxMj8G76b gmbQl0co+JLq02hzIetjOyq6E7dn1WDnqceR1AoAIuCmDOW0gZhQaym36O8VYLlXNNZw4GCk1lA C3AymOoikEHlAdzLabNlaB6rw30SmBEgOJvFLHxfw/Z7vCSiFvul4OuyyLKMrU9W5QI6nb3thxL BB5UOjDvOANpBC7bgamFSetgKThfPL9mqIKMZjlKQ7dJIuaTj+Zuf9MxYXykq1Ht7a++EaXovBp CnuLJ0EoyxiY2NKWaS2E1k3mWBoyg8uJQ8Xw26Muu2Z3apmWyohuN5ZuOD+//9TYmIa9LSD7rsz LfOdWwabjVZrisgeLL7arEyJYWb/UTt4JYlEWvwt62r0gaBbaxFvHN+mGWJkXu0VbRkJnS1GMpj kcS4B5nFpZHV6K+LB1RNyEsI8CEUm5PpIecoHyWG21CaKtGcwRAin0AMUByEaDm7MDR8NoKsnbT wjm18R6LmMKt6miTvopVMOGJYoIfL0FJ5geGpR80IFGeIbHdAkJev5kHaO9P46stTz2+Y9mkt9k XbZXzTSQaJS5wzB+e3cfssxWAj8zi/8v5L69lUltjT6qbqAu374ut8dp9r7XOVPWcx8jUyxj0Y7 fB9dWORrvFK+rOQ== 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(). Signed-off-by: Jacopo Mondi --- 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 | 133 ++++++++++++++++++++++ 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 ++ drivers/media/platform/renesas/vsp1/vsp1_rpf.c | 7 ++ 11 files changed, 200 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..12889885b14f8d61ee5e416b4111d2eced7a0715 --- /dev/null +++ b/drivers/media/platform/renesas/vsp1/vsp1_iif.c @@ -0,0 +1,133 @@ +// 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_SBGGR8_1X8, + MEDIA_BUS_FMT_SGBRG8_1X8, + MEDIA_BUS_FMT_SGRBG8_1X8, + MEDIA_BUS_FMT_SRGGB8_1X8, + MEDIA_BUS_FMT_SBGGR10_1X10, + MEDIA_BUS_FMT_SGBRG10_1X10, + MEDIA_BUS_FMT_SGRBG10_1X10, + MEDIA_BUS_FMT_SRGGB10_1X10, + MEDIA_BUS_FMT_SBGGR12_1X12, + MEDIA_BUS_FMT_SGBRG12_1X12, + MEDIA_BUS_FMT_SGRBG12_1X12, + MEDIA_BUS_FMT_SRGGB12_1X12, + MEDIA_BUS_FMT_SBGGR16_1X16, + MEDIA_BUS_FMT_SGBRG16_1X16, + MEDIA_BUS_FMT_SGRBG16_1X16, + MEDIA_BUS_FMT_SRGGB16_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 == NULL) + 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) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c index 5c8b3ba1bd3c2c7b9289f05c9c2578e9717c23ff..e10ed836153633c4fe27224d0df39c77d4c8ab89 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c @@ -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)); From patchwork Mon Feb 24 20:19: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: 13988883 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 B04B8244E8C; Mon, 24 Feb 2025 20:20:03 +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=1740428405; cv=none; b=CojusZNi6FB2oMIsOyay2W64m+FTp5XpWcD63uwaCGwbizStnthXDdGEN11Xx8Nbvl4ixE+7oEASiQQFU7YBzgjNOCR35sfOsZ1z4f7G5T/WdX4qBpcPn79j/RBDZ6X/pkin20e9GP5Nv5bd9aaq5jsolDu6ZQ5aOi4MSWlAVRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740428405; c=relaxed/simple; bh=eFBbTPMz4pjW3upJItf+CF0P7+hXPrFgG06nWdnmCeI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NxVVWGqLv15RTa7xfDch9l78U2+Hcos+J5jjJZlt/dOOJqfQZ59qbfBIZUKJlX31aXePi9rUHKtplVzvzFpTy8sojhyKdmaST7XS7QvyxopnuoaIOvXJDa+lICBZGUdYKJcJ11FbC6F5JgU/ozfrZYDywPus4bb4HHew9ifn/Vg= 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=AyUv4in6; 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="AyUv4in6" Received: from [192.168.1.103] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D2ADBA57; Mon, 24 Feb 2025 21:18:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1740428312; bh=eFBbTPMz4pjW3upJItf+CF0P7+hXPrFgG06nWdnmCeI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=AyUv4in6CuvuGzLpT/0SRCmHpdMbAxSsxd7TBOtYB3mwzaLRAioBj7u4Q6BIuJLdY 2r9igSHBGSl48Yl6Qj2p2TBFiEUoSqDMV1Hmo8Q9ii1YUVFKuDNBW2ldefZn9TkK3M 1N4Em3QzKdcYqq4WPjW1bv8QVGSWgZbRkKZJtLY8= From: Jacopo Mondi Date: Mon, 24 Feb 2025 21:19:42 +0100 Subject: [PATCH v2 2/6] media: vsp1: Clean FRE interrupt status Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250224-v4h-iif-v2-2-0305e3c1fe2d@ideasonboard.com> References: <20250224-v4h-iif-v2-0-0305e3c1fe2d@ideasonboard.com> In-Reply-To: <20250224-v4h-iif-v2-0-0305e3c1fe2d@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=1095; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=eFBbTPMz4pjW3upJItf+CF0P7+hXPrFgG06nWdnmCeI=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBnvNRreBzdqHE3ZhS59B4jINNiXscmvN0ICswOo yfT+XOF6jaJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ7zUawAKCRByNAaPFqFW PDlJD/96ziesFu2RNAVtkVuwEZRzOKxp323WlWwgxrZhmWNkYyDVjEkkY/7F1TQLtKl2yybUPtg aB4tfVoTxnJro035mjP8+ZbYlh5hdB38Vp+cGgZWvrosVlrhnaD5sKHe5xbeh2ixY8VTsZx39sj +FjjZgAJREHk8flZ1lwKslsHOIr5Fg07hju17JOUj5PIjWHcftA91uJ2RVsIMiHKJmYbSSAgXyP 6hYtiGZHhSnWhRW5T9xjy4zdHw3NFfle2/BF4GEV602KsuPC8EvpDasJv5pEffXUFogpuJXpeqO 8YyIOm+euKFnrVy2n1zHqRznkPJVAQgl+FvwbeqLELB60/H1citF0kEdKlyBMyK9wEFd6fjsHdR gx6Ap6YpapUjj2Zo+PKvEZ7qQiJ5qzVSEhXUz9UtIxeACuoUQI2IY+gHF95t9EZRKR4yD5mDTW7 kLzdLapxMpYW/w87qKN5olZN9YLbb2XF2rEkHT+wQBlHj4DmzoWRUMgU/pDI3xdkcdf1AjAHQ11 zPOGGXS9J3C423gDShSFJsLr+MRvEmdMQ56nKPJK/dqe4jZN7sg/1mTCU3ZUYaim/jqoNAgqghy hQm1hMV5cHZIDgm1EYmtfWkPMPNFKFaAqkwRnFE/y0TyYxFybroyKqbRgemiDuGVlWfBRqMlaBq chWR4PvAflGvZpQ== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The VSPX generates "FRame End" (FRE) interrutps, one for each buffer transferred to the ISP. Even if the FRE interrupt is not enabled, it is reported as active in the interrupt status register. Make sure to clean it when handling the interrupt. Signed-off-by: Jacopo Mondi --- drivers/media/platform/renesas/vsp1/vsp1_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drv.c b/drivers/media/platform/renesas/vsp1/vsp1_drv.c index d13e9b31aa7cff8610ea196ae4de88ab22e44e0f..17ace4c6844d19aaafc27e79f016cc05091372bf 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_drv.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_drv.c @@ -69,7 +69,8 @@ static irqreturn_t vsp1_irq_handler(int irq, void *data) i, wpf->entity.pipe->underrun_count); } - if (status & VI6_WPF_IRQ_STA_DFE) { + if (status & VI6_WPF_IRQ_STA_DFE || + status & VI6_WPF_IRQ_STA_FRE) { vsp1_pipeline_frame_end(wpf->entity.pipe); ret = IRQ_HANDLED; } From patchwork Mon Feb 24 20:19: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: 13988884 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 C1018248892; Mon, 24 Feb 2025 20:20:04 +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=1740428406; cv=none; b=Aay+8H2KgfdCQwUkNF28aLemD6w4p9A6Hkzx8p8GxRcTd3ztB14CAEUo09Wbd6xBJQl2BVfxiG62FmrXdTLa+PeIaLpJl1SNgClJTlt9OBFsYIjLwf9RsmdLEM766BN4SIXUef1YNTOrEv3OTeSan4AaJvSeP5PkE3fvXzxC41U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740428406; c=relaxed/simple; bh=wKQVCD1mwop8tyRfNkYHGt7rxeI11mWS6QNoHD9G8c4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TUww6ClqI+fm4Ot+a8HRdqb5dWx9b4xULwt8CFJ+TCEloosJX3ISurOZWtBWuU7Z7O27VuCqIoC/G3mBVdQBrweyUUqFcQmH/3VqEoylFN4c0ra67yyGzj0HWVbnSXhmRFzzqnr5S4TC2X1zmQz2RsOoClBxWrWolEoQz+20jy4= 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=VSgIFIBr; 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="VSgIFIBr" Received: from [192.168.1.103] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5E982C8D; Mon, 24 Feb 2025 21:18:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1740428312; bh=wKQVCD1mwop8tyRfNkYHGt7rxeI11mWS6QNoHD9G8c4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VSgIFIBrVZam+2u77+kx+omZUKkQl7YQGXlufLbTCMFDXNdOUBqfVgnqQikLlzVeU C5UHiS9IwAY7bLT7EbWdeId8GiBrjnurojLPCCPzx/C8F8EGyvo1EnXlJyv4PYjz5v pMSWbZzbc0LtUk/VIaQ72bqED9YqYOehTMKmEix8= From: Jacopo Mondi Date: Mon, 24 Feb 2025 21:19:43 +0100 Subject: [PATCH v2 3/6] 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: <20250224-v4h-iif-v2-3-0305e3c1fe2d@ideasonboard.com> References: <20250224-v4h-iif-v2-0-0305e3c1fe2d@ideasonboard.com> In-Reply-To: <20250224-v4h-iif-v2-0-0305e3c1fe2d@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=1753; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=wKQVCD1mwop8tyRfNkYHGt7rxeI11mWS6QNoHD9G8c4=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBnvNRsS3U4HNCiUiDr58yixv6x+2LTUurF8TWQ6 t0eauWMODyJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ7zUbAAKCRByNAaPFqFW PANWEACPtBk99d240nvH5qGP7lDqICWFPXnW9Z8sMhEAR0+B4sMSnIIgs88U8wSqibdDiVJkG16 Gg7cMAvSpWz1M8lD1NWhiANEUhb8r4ls1V6/apEuuENbS+eBXpscBdwQq2Vi1EBn3XdCC0vGkIT E6LpMhfhhqJmuzKmI58T8YYCxwT2lCNgp1D6OamFBluTniNjXQCZ5PeawAQ/lYoAhUptQv39m1f 6UgV9KSbltF5nZfMRvDXt66oWKGbfNrai5y1N0KBlpGksafUZsSoNnciMtnX9BoxFnIiD1L+YeN pQv53HACqiRFqMn45llXGbdLT2OFiX+xavFjajIEL1k4V0Ffc7qIZeKMsPRE60scDQM+k4AYtsq EPgEB2aRCRVXD49Na6FYd1dETkBRYkRHTlfxH4pzrjD5djqcYDR2wcg8VW+f6rUxO3hlLgzMdd2 DIEYnTO1rZNoHr6KEjic0wOQZ1OR+TyPtnBAIUIXll5tCBQeoRSlcYljB+3GMPU75vrykuuxExW qKI0BA3YhlplY3MSzIUseBrjEBAazVZdYLz3MJfk473Wbtinl50A/kYzRWfMv9kxMvBwxUGPTgp 0g3YzGIS1uwWsccOHluMou1UOMZNgzzr3AWoRvz991oPuA7GR72ruFDXmomiJrU6cFFnuwUhzoo kC7aVDAeEVySBag== 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: Niklas Söderlund Signed-off-by: Jacopo Mondi --- 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..b8f0398522257f2fb771b419f34b56e59707476b 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 Feb 24 20:19: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: 13988885 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 AD662262801; Mon, 24 Feb 2025 20:20:06 +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=1740428408; cv=none; b=Y+tsjLLrBcyqc6ZR4GXLIYGOqFhLqb/JNBtb+awt9anFVEeNJXPNroORG9qWsiFr4mh5MXeNUOlS14UOtBBVPyNcj0WjTY/zsDWD0ipP1JD4cTvC5Dr4xmRiJvvCrAwha/GTZ8TH61pAKpAK9v3f63FITJ1jP+vrSGiRcUsfLT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740428408; c=relaxed/simple; bh=0hADf7QXDoCsszjAfVEsTNGYlKDXXkZAZ0v+heiZK10=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mYZ22tX9ji0VdoMCRVPQVWiUWRsQS0t+/GufE9LTXQ80aRW7TtD6DPqFptuH15ntOGttDzazRt0w5OEf0OA3ufukX0+ee1wE2I440e0zw6DlDZ6rCL9/Kl4XX/9gsOed4VUKMRijAjzM9RMSRnmIAV+HsuBDgVkLWkU016fRduE= 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=LPqqJ95R; 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="LPqqJ95R" Received: from [192.168.1.103] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EB89AD1F; Mon, 24 Feb 2025 21:18:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1740428313; bh=0hADf7QXDoCsszjAfVEsTNGYlKDXXkZAZ0v+heiZK10=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LPqqJ95R1aQklGYpNwf3RaylMe2zu7oWjamlAFDXYOFoVfFGfvoRhaXnIbp3vRLg0 pC2aGLdIW+Y6Ox/3hly3XoU+DCk1qwYoa9btf4xXf5VlaZBy+ATMzZIWQIY/lsNzR6 iynqOlciZvPsO7NHnd+qBCPlQktBCYw9gFjUowLA= From: Jacopo Mondi Date: Mon, 24 Feb 2025 21:19:44 +0100 Subject: [PATCH v2 4/6] 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: <20250224-v4h-iif-v2-4-0305e3c1fe2d@ideasonboard.com> References: <20250224-v4h-iif-v2-0-0305e3c1fe2d@ideasonboard.com> In-Reply-To: <20250224-v4h-iif-v2-0-0305e3c1fe2d@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=2878; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=0hADf7QXDoCsszjAfVEsTNGYlKDXXkZAZ0v+heiZK10=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBnvNRsjvv1fW+gIEgHqTKn7fGh9cGY8h3NWDP5m Mv/zpeCGueJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ7zUbAAKCRByNAaPFqFW PGp3D/4/9gNuSyBhm+7qmkKYoagrhlWDsPtPi9/Zsj5WKz9/D0qLm2d09n2ULvTCt5+jpJgwTHa WFu9+sdpBAXAkb/o5UtqitzeJvevIC4Cltg2vZbTB8fsgbOGR67kfRefg8ezDifyXQ0/zKM3F2X VHEvTXFRp22VtffekYnHpeYasGiMQQK5rRxm8ufgkaRJdI0XTJG5hHMsrfqfyhL816U4jRvIZAT 4OfrciW5Cux6PYcb6nXpC1VgsQCW3+rLN+vI8uVV1UvTURMuhWr0jsi+LuRzzxMAk/UeqXLE8q/ gDBo0XXaosi4s0q5WTgbMPgqOySKzUKLMZCWBK5sLaVXQmKiu0WUGtgN6I/zJpT7IB3qr759mVb tsuVcOeoApYst3KyUmaeztx1Jg19MpMNTciw8W7VkvgN95T9dcbnZavfjSi8/oRUys0oZeAacV2 WYYGbwRLlZixpEwf+2k4D+fILhzG6MimmtEaW+UAV71HdZ6deacc+j3drfwMNohMoYngByyj0N0 EHwClJq5joSoJnG6TCNCIrkgC3xiO35m/ky4wOrzP+9yf6VnBdXiX1khycrnPJiWUP5ZObtKcq7 jhne/BlgnQWX/20TgzDxJpGPxA2MZmK4JgiFmHBbmXyqr1I6illpkil+cjc6Lh2QnLuN+T7tM8F Y5l8OJjDDX0dAyw== 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 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 Feb 24 20:19:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13988886 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 509D4264F9D; Mon, 24 Feb 2025 20:20:07 +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=1740428410; cv=none; b=g9eoYM5RNVs70wtAQSt/slWnhOe0BESLyoAVstCJPF+y4/5TYwljER4Cdlncw/fRlkb5REZ+Tb7LCnVZoFDLAsT1CyJ97Hw/zJhniGlj2xLMke80P2S3FezuyMxdnlzHOatZ9nhSKiYy+NfHZyznodAgZsmBAJ0V3vyD2OsIVLo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740428410; c=relaxed/simple; bh=uzFQyNFwu4bIhY1bncdEtv31cE46uVRuczhuiLdIcWE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gO6t8jgLVPTqOMvZZtbrgmF6o7TBwMUqF5eGWfBs2pfn9sSMvQjLT6Qcb6J5+x2ZRWtZ46mqhM7YrwtRitAtW50MeMIlWpwtAsBCVp1RyCPeW6Nj/GcTITiW9hvYJC5Z1BavHCGWM7PK2tfHNzXKS9aL4/VqdFnmFGbdCuAuvdA= 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=g1uwU+2F; 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="g1uwU+2F" Received: from [192.168.1.103] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 91886E45; Mon, 24 Feb 2025 21:18:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1740428313; bh=uzFQyNFwu4bIhY1bncdEtv31cE46uVRuczhuiLdIcWE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=g1uwU+2F8vS27+7hR+aMo2UsYIHDb/mVW9ZPexgdZjpHAweU1xGQlRNDSz1W2lzuY ylAcL53KQRq/8dtiOU0hqMaXbuxX2HkXnw7vU5gbD6/9RkAnwVShPrv1y38p3lo+Jx HIIBLdWQatGZWl45pXDzupZQpgh/IihsKuEKGSgo= From: Jacopo Mondi Date: Mon, 24 Feb 2025 21:19:45 +0100 Subject: [PATCH v2 5/6] media: vsp1: rwpf: Support RAW Bayer and ISP config Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250224-v4h-iif-v2-5-0305e3c1fe2d@ideasonboard.com> References: <20250224-v4h-iif-v2-0-0305e3c1fe2d@ideasonboard.com> In-Reply-To: <20250224-v4h-iif-v2-0-0305e3c1fe2d@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=4904; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=uzFQyNFwu4bIhY1bncdEtv31cE46uVRuczhuiLdIcWE=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBnvNRsTDGfyIsCHkP3sCJaLhEUdH8/lff1vWrXD 2PeTXLos7aJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ7zUbAAKCRByNAaPFqFW PMyvEAC4E1muK+IG03oWAolNrO1KSkJoalUQHClfQGx/nLptuexw6CpwsRIsxR/ozZLDz04Sy61 TV5ZLZqZofq7smmpGBRlFjvofZ1hC78XaAPJoiE/F+F6YWlyMynIepMATv/6d1+hzGPQryVWuSy 37TJgyVqCvrjVhZ26waAEppXUfBUIqfH+/RaQXskhw4tgAqpf1A/nia7W/BwcsON5I9zHI3oyH6 wObDlKqw3z9cs8mHbRZjbqSOvZMI6gVOM3awqhoSx0Eb4UZjsGjHVjKCeV0+yMmLEbpaA8Qu3QE 9ZPtnd8OXgF4Zze1+9Av7N8uH9WgUcmdupVi6TQx3YfFrBcGbvPH2E0+bhaoaR6byKu5nG/Ro+O 1qll5Fez1DGwAYAlbc263qpEbSdIZPyWK5h9DlnqHRBO5tdnd0GTrUv2ReXQLePWmelrf/G5dX3 ZW819m0DYmH3qHeHR2aNo1h3v7PwpNtr5s6hR72BBbeDB+FSB/MhVTOVjWqxO05rG3tM97rMUQM cYBoKD1lgK5TmjX0EYhGH46VYWBHk2uunjCVuzOJfQnwdJvbfhMRty25UO6loPthhBBxc41MFNw eoATvCUb2c3ecCNrQQoEq+htcDW+uSqUnQFZz/KfdzLOKVMIjCS0dfQe9kSeJV1UNl3j+HoE+Rd 20DRG5+J7i7kx+Q== 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. Signed-off-by: Jacopo Mondi --- drivers/media/platform/renesas/vsp1/vsp1_rwpf.c | 97 +++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c index 93b0ed5fd0da0c6a182dbbfe1e54eb8cfd66c493..aef7b3d53a2171cda028a272f587641b4a8f85dc 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c @@ -10,18 +10,102 @@ #include #include "vsp1.h" +#include "vsp1_pipe.h" #include "vsp1_rwpf.h" #include "vsp1_video.h" #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_SBGGR8_1X8, + MEDIA_BUS_FMT_SGBRG8_1X8, + MEDIA_BUS_FMT_SGRBG8_1X8, + MEDIA_BUS_FMT_SRGGB8_1X8, + MEDIA_BUS_FMT_SBGGR10_1X10, + MEDIA_BUS_FMT_SGBRG10_1X10, + MEDIA_BUS_FMT_SGRBG10_1X10, + MEDIA_BUS_FMT_SRGGB10_1X10, + MEDIA_BUS_FMT_SBGGR12_1X12, + MEDIA_BUS_FMT_SGBRG12_1X12, + MEDIA_BUS_FMT_SGRBG12_1X12, + MEDIA_BUS_FMT_SRGGB12_1X12, + MEDIA_BUS_FMT_SBGGR16_1X16, + MEDIA_BUS_FMT_SGBRG16_1X16, + MEDIA_BUS_FMT_SGRBG16_1X16, + MEDIA_BUS_FMT_SRGGB16_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_SBGGR8_1X8, + MEDIA_BUS_FMT_SGBRG8_1X8, + MEDIA_BUS_FMT_SGRBG8_1X8, + MEDIA_BUS_FMT_SRGGB8_1X8, + MEDIA_BUS_FMT_SBGGR10_1X10, + MEDIA_BUS_FMT_SGBRG10_1X10, + MEDIA_BUS_FMT_SGRBG10_1X10, + MEDIA_BUS_FMT_SRGGB10_1X10, + MEDIA_BUS_FMT_SBGGR12_1X12, + MEDIA_BUS_FMT_SGBRG12_1X12, + MEDIA_BUS_FMT_SGRBG12_1X12, + MEDIA_BUS_FMT_SRGGB12_1X12, + MEDIA_BUS_FMT_SBGGR16_1X16, + MEDIA_BUS_FMT_SGBRG16_1X16, + MEDIA_BUS_FMT_SGRBG16_1X16, + MEDIA_BUS_FMT_SRGGB16_1X16, +}; + +static const struct vsp1_rwpf_codes vspx_rpf1_codes = { + .codes = vspx_rpf1_mbus_codes, + .num_codes = ARRAY_SIZE(vspx_rpf1_mbus_codes), +}; + +static const struct vsp1_rwpf_codes *vsp1_rwpf_codes(struct v4l2_subdev *sd) +{ + struct vsp1_rwpf *rwpf = to_rwpf(sd); + struct vsp1_entity *ent = &rwpf->entity; + + /* Only VSPX supports reading Bayer formats. */ + if (!vsp1_feature(ent->vsp1, VSP1_HAS_IIF)) + return &rwpf_codes; + + if (ent->type == VSP1_ENTITY_RPF) { + switch (ent->index) { + case 0: + /* VSPX RPF0 supports ISP config data too. */ + return &vspx_rpf0_codes; + case 1: + return &vspx_rpf1_codes; + default: + return &rwpf_codes; + } + } + + return &rwpf_codes; +} + /* ----------------------------------------------------------------------------- * V4L2 Subdevice Operations */ @@ -30,10 +114,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)) + const struct vsp1_rwpf_codes *codes = vsp1_rwpf_codes(subdev); + + if (code->index >= codes->num_codes) return -EINVAL; - code->code = rwpf_mbus_codes[code->index]; + code->code = codes->codes[code->index]; return 0; } @@ -54,6 +140,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_format *fmt) { + const struct vsp1_rwpf_codes *codes = vsp1_rwpf_codes(subdev); struct vsp1_rwpf *rwpf = to_rwpf(subdev); struct v4l2_subdev_state *state; struct v4l2_mbus_framefmt *format; @@ -69,11 +156,11 @@ 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 < codes->num_codes; ++i) { + if (fmt->format.code == codes->codes[i]) break; } - if (i == ARRAY_SIZE(rwpf_mbus_codes)) + if (i == codes->num_codes) fmt->format.code = MEDIA_BUS_FMT_AYUV8_1X32; format = v4l2_subdev_state_get_format(state, fmt->pad); From patchwork Mon Feb 24 20:19:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13988887 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 1067B266196; Mon, 24 Feb 2025 20:20:09 +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=1740428411; cv=none; b=p7UYe2EWLWy24W+bKPOFk6y3pS0/FGE/edmBt2vYiIvdycxsqWoTq7jdfZwlu7i0MeNZJuVYMMe7mQWl1ys2oRZz8x+HwdnvbWWpH9JMOEml9wTtHKbU/HQ8Tk995yuQxjhWjKJd+VNBeOQJ/UAqmpq9gEpSCez+B91VucexYzc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740428411; c=relaxed/simple; bh=WiLiBj0SJRFxfxK31XdalHPJfovGc7Rsw7QaWrP0nVU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oLsGtVaxpwvOuOVseSQ2pkmMexU4T0qnvHhgJzZ5ydK6yGSNzWgpZrIkEPwvbZsgRS/2jE+a4JDORFKAqIcPPrVJuNouVsPNCxbsLs0zMVCPn2dgvi7IXFPlPhNVAVC+d4dHDt3X9uEUXD8H4HCv5t5+Q5TAUhMTjoam6jQgjOI= 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=bmWbPwxQ; 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="bmWbPwxQ" Received: from [192.168.1.103] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 20780E62; Mon, 24 Feb 2025 21:18:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1740428314; bh=WiLiBj0SJRFxfxK31XdalHPJfovGc7Rsw7QaWrP0nVU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bmWbPwxQHixWMcoOldCF4PIntnRHDcoVoHtEqZBqdN8XLcWZgjfnaHN5XSI73YuqO dg2A1feTHBzacGUlrO1XFKR+y6NhRd7atOFeETWmcqczIuY4XEmRZpZb8syYfPLxAu +GfzFDNnkDAiQ64/iiwkkQKxb4nAm1BdT4UKO1pY= From: Jacopo Mondi Date: Mon, 24 Feb 2025 21:19:46 +0100 Subject: [PATCH v2 6/6] 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: <20250224-v4h-iif-v2-6-0305e3c1fe2d@ideasonboard.com> References: <20250224-v4h-iif-v2-0-0305e3c1fe2d@ideasonboard.com> In-Reply-To: <20250224-v4h-iif-v2-0-0305e3c1fe2d@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=4208; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=WiLiBj0SJRFxfxK31XdalHPJfovGc7Rsw7QaWrP0nVU=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBnvNRsit80a6Z3tyW/pK842HRUMRIMrv3YdA6vJ quy39XlfIeJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ7zUbAAKCRByNAaPFqFW PLorD/49Lh2mL+vg/uPNKWD/OcVw/XdyZfm2bG5clJDF1yVfzWUeH8Fif5OVEOsuznC3Fit3tfo 5vidnyF/8ufolJInIj6aZSoQ5f32tXLjeGqJzZwyoWDj9G0r77xb2ntj+fxtijsTsrW7bOf8z1z FM76ALLboU7EPobWE93jD1l7rVC8FaoRmcI5dVAR0qbi2OtIeM0HzKNHuwcaiCTiA7i+ItHwlhM fXAoPs5DbrKJGrKp001wKyxiGHPVKZ6SJWEsHozSSsJXu0O9yn9EIP8xRFPh0dvkVlB6Rbtw6J/ T+CKzRAuE0iMgHGIVqlN3IGeMm5oNsREq7YRO/IG/P/ue/7nv4FhcMBjJ3Vd/opU5SSsr88Hlc1 BjWPWKss/fELlMwXpkU3UkLLsmU54dU+dVP9Mykm9r/UDb5ujq/GxO3+p0wnfUrazDByJa1fByA t6AaM4aaGFhO4r72tiYbv79gQRSEHu8wcQ4hQ/dt1J2atxbGlXclaeJvOg5pPGU+UdZFql0W6wW YKTkSEdsVjQbaUC0wG3zyvlU9YeFAgBVd8u5Bc47/9GEPZZJGnQFBCh93NXHU/gf6NP3nO8aAOr +YeOzSwVu8MyKfiEnWCh4Vj+Kx6sk5c27HyWCEdDI50oD4M7y7NO9d92WY+oLeYmsOeBPYFHj+O LDB20kPNd2l6kbg== 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 drivers by checking if the pipe features an IIF instance and writing only the relevant registers. 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 e10ed836153633c4fe27224d0df39c77d4c8ab89..dae94129a105a646917353dba0181f9c93327132 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; @@ -174,6 +174,13 @@ static void rpf_configure_stream(struct vsp1_entity *entity, (left << VI6_RPF_LOC_HCOORD_SHIFT) | (top << VI6_RPF_LOC_VCOORD_SHIFT)); + /* 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; + } + /* * On Gen2 use the alpha channel (extended to 8 bits) when available or * a fixed alpha value set through the V4L2_CID_ALPHA_COMPONENT control diff --git a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c index f176750ccd9847fdb8d51f7f51a6bd5092b70197..88db60596f0f2f459eddbbc2ea7247620d675dd8 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