From nobody Fri Oct 10 13:46:58 2025 Received: from fhigh-a2-smtp.messagingengine.com (fhigh-a2-smtp.messagingengine.com [103.168.172.153]) (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 CBA9C2DFA24; Sat, 14 Jun 2025 14:16:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749910585; cv=none; b=uBKf0ZMMWX0dkCXg40nw0N61eaZdrq1JAxAu6k5TyWpVVnHfDzz9HEhAfX4dMPf9r8eHhrLm6pO41AYZl0crK6qGzA1FJ7kjabD2vwlXkonXjvQoAXZKUCDnTB3Tr5weNvRrMh0QQux7Xut4SQ80HTxnEH+xZeChfJkwtHxP3cg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749910585; c=relaxed/simple; bh=KGH5CSdIP2weibyL94KEuSJoXrkh/CqKUDTXEgGO40M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qxD4O1NkIl/WCno2yFLMr1+W7QU2CyCyMm52nsVXgqbo8uLizT1sVFjFQjunivEUT4pYAdt15ADoHmhepsh58gdplJsvH4SzQuWjjJSRvKF5YOPUrdoe+5CbNv5zSy4A8kRWzS0j3II355+L45FGWE4Bs6orLNM4gUm9T/oXZpw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=YsFwBOgP; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=gW6lf5U5; arc=none smtp.client-ip=103.168.172.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="YsFwBOgP"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="gW6lf5U5" Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 04BD4114013B; Sat, 14 Jun 2025 10:16:23 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Sat, 14 Jun 2025 10:16:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1749910583; x=1749996983; bh=bq11b5Mjk9Qzjdb7PAB+0M142DvbpJs/FKBwosq60i4=; b= YsFwBOgPEus+UroV/6rL7/FvXxAglKw1oviL6JyR96lgMW4zoZoJszsm7Ky0XlEp is1xBY6EiDTvlZIMcJs9UFolxbfpFy9UdkyQMOHd1uLvDrmT42uvL8SO/a3SuAqk KfwLzuwn5bGZTpsxDP0xL/BUvrH+9zqPDPad3VBn2GTDBukyJhGisdSApJBBJt5F hatPRax3TZ0uPkVgVhZxdDKNhdBT9JXwqsobhXbkQxC1g52bKSXUDGefLgG7sQDO ifOqT7TiGsjufWrcbwf4wg0Vc564U4rqfqg9k5U7fb5llbrdTpyxjmme8do9bv6g E+tf7gt55bb6914NmfH3tA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749910583; x= 1749996983; bh=bq11b5Mjk9Qzjdb7PAB+0M142DvbpJs/FKBwosq60i4=; b=g W6lf5U5ypeYkBIHyJMIKrjDfgnhAC1DUYeaRhgvGbmIZ1oy/FsuQfcwJUcz7V2xF NCM6leL/TasK9TVk4K+Uk4sXJYy27mxdmZhouNiOl82eO6Mhqu9tHLVsqD3NvRxA 6T+QAeLXsb/M4BsR4iwi0dvlYi0caodMhWJtDBHqBGQopgnKfZ5vlCC6q+yJIDJ8 Da4/fI6GxgrXjv6oIVkI9oWI5VH6zY0eB9UyssgoL4dDc7Xkskr12pdvBKTmXMDh 7ckAglzKlv2scb3LJeqT6rmrbRmnbSQTTyHJQbTPjgSos34zAIZLQOv7UvbG5c3F 1DKkL64+M4ippAaq3QzJQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugddvuddthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfgggtgfesthekredtredt jeenucfhrhhomheppfhikhhlrghsucfunpguvghrlhhunhguuceonhhikhhlrghsrdhsoh guvghrlhhunhguodhrvghnvghsrghssehrrghgnhgrthgvtghhrdhsvgeqnecuggftrfgr thhtvghrnhepheeigfeuveeutdefhfehgeekvedtleeuueekveefudehhffhjeffgfegff elfeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep nhhikhhlrghsrdhsohguvghrlhhunhgusehrrghgnhgrthgvtghhrdhsvgdpnhgspghrtg hpthhtohepkedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhgthhgvhhgrsges khgvrhhnvghlrdhorhhgpdhrtghpthhtohepghgvvghrthdorhgvnhgvshgrshesghhlih guvghrrdgsvgdprhgtphhtthhopehsrghkrghrihdrrghilhhusheslhhinhhugidrihhn thgvlhdrtghomhdprhgtphhtthhopehlrghurhgvnhhtrdhpihhntghhrghrthesihguvg grshhonhgsohgrrhgurdgtohhmpdhrtghpthhtoheplhhinhhugidqmhgvughirgesvhhg vghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhrvghnvghsrghsqd hsohgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgv rhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepnhhikhhlrghsrd hsohguvghrlhhunhguodhrvghnvghsrghssehrrghgnhgrthgvtghhrdhsvg X-ME-Proxy: Feedback-ID: i80c9496c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 14 Jun 2025 10:16:22 -0400 (EDT) From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: Mauro Carvalho Chehab , Geert Uytterhoeven , Sakari Ailus , Laurent Pinchart , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCH 3/3] media: rcar-vin: Generate FRAME_SYNC events Date: Sat, 14 Jun 2025 16:15:45 +0200 Message-ID: <20250614141545.2860860-4-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250614141545.2860860-1-niklas.soderlund+renesas@ragnatech.se> References: <20250614141545.2860860-1-niklas.soderlund+renesas@ragnatech.se> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Enable the VSYNC Rising Edge Detection interrupt and generate a FRAME_SYNC event form it. The interrupt is available on all supported models of the VIN (Gen2, Gen3 and Gen4). Signed-off-by: Niklas S=C3=B6derlund Reviewed-by: Laurent Pinchart --- .../media/platform/renesas/rcar-vin/rcar-dma.c | 17 +++++++++++++++++ .../media/platform/renesas/rcar-vin/rcar-v4l2.c | 2 ++ 2 files changed, 19 insertions(+) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/m= edia/platform/renesas/rcar-vin/rcar-dma.c index 85e44a00e0fc..a1ae9c9bccc7 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c @@ -14,6 +14,7 @@ #include #include =20 +#include #include =20 #include "rcar-vin.h" @@ -115,10 +116,14 @@ #define VNFC_S_FRAME (1 << 0) =20 /* Video n Interrupt Enable Register bits */ +#define VNIE_VFE BIT(17) +#define VNIE_VRE BIT(16) #define VNIE_FIE BIT(4) #define VNIE_EFE BIT(1) =20 /* Video n Interrupt Status Register bits */ +#define VNINTS_VFS BIT(17) +#define VNINTS_VRS BIT(16) #define VNINTS_FIS BIT(4) #define VNINTS_EFS BIT(1) =20 @@ -898,6 +903,8 @@ static int rvin_setup(struct rvin_dev *vin) =20 /* Progressive or interlaced mode */ interrupts =3D progressive ? VNIE_FIE : VNIE_EFE; + /* Enable VSYNC Rising Edge Detection. */ + interrupts |=3D VNIE_VRE; =20 /* Ack interrupts */ rvin_write(vin, interrupts, VNINTS_REG); @@ -1049,6 +1056,16 @@ static irqreturn_t rvin_irq(int irq, void *data) rvin_write(vin, status, VNINTS_REG); handled =3D 1; =20 + /* Signal Start of Frame. */ + if (status & VNINTS_VRS) { + struct v4l2_event event =3D { + .type =3D V4L2_EVENT_FRAME_SYNC, + .u.frame_sync.frame_sequence =3D vin->sequence, + }; + + v4l2_event_queue(&vin->vdev, &event); + } + /* Nothing to do if nothing was captured. */ capture =3D vin->format.field =3D=3D V4L2_FIELD_NONE || vin->format.field =3D=3D V4L2_FIELD_ALTERNATE ? diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c b/drivers/= media/platform/renesas/rcar-vin/rcar-v4l2.c index db091af57c19..6339de54b02b 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c @@ -734,6 +734,8 @@ static int rvin_subscribe_event(struct v4l2_fh *fh, const struct v4l2_event_subscription *sub) { switch (sub->type) { + case V4L2_EVENT_FRAME_SYNC: + return v4l2_event_subscribe(fh, sub, 2, NULL); case V4L2_EVENT_SOURCE_CHANGE: return v4l2_event_subscribe(fh, sub, 4, NULL); } --=20 2.49.0