From nobody Fri Oct 10 09:19:25 2025 Received: from fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) (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 812062741A6; Sat, 14 Jun 2025 14:16:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749910581; cv=none; b=k7bk5vtO7Z2tW6J4ZYLkhanj4U+Ac0Xq0R74wKPegiIJ6wlCPPlg9/ObsVo+a5Zt0vuLLVSKXzSHaq8tFEwjyhy6oykPQr2p9aZyEoe7v4cvXi5CNSeTzKa0+gtZADU5A8csx2piR3ayAzX7uhVgZ4CIQgsHAaHrezjPNSZ2zWU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749910581; c=relaxed/simple; bh=DTa3l0kwmyk7N78wNwbyykF7mani9JGdtPkBxKyAh3M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oaqOKS/ayuhttSnLEQzghymXVLq829x/iqikzAAtXtZquRXmJgIuI0SJDoyhf5IJvW4uHKo+FpAz0OvtFJ7TVcUY+UDuJ1W2xleV9dKDARa8gscqGBSu997q6+MmEskRQaobo4cqowoFhmDCIdKyqHJITNBRQS7gZO/J6vwUu5w= 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=f/QsDmTc; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=X9HkQV0L; arc=none smtp.client-ip=103.168.172.151 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="f/QsDmTc"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="X9HkQV0L" Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id 89BAF13803A4; Sat, 14 Jun 2025 10:16:18 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-10.internal (MEProxy); Sat, 14 Jun 2025 10:16:18 -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=1749910578; x=1749996978; bh=tKRllI5iYUJxtWb3aibDMssFPVfW6Nf8VxZvseykuio=; b= f/QsDmTcdFaRDeq/4JiiGV3tP1+UC7SCsOzEI1I3Sevl8JCZ8Fvh8sCkpT74KzOv q/NYo47r/mywzmeH0eqJjB3RVqUfv6myFl85vaOAZxIzr2Hz8/fXzHDm1WemMi4P l8FXCzPqV0zwtBo1AnQTCSki3MMuKyfLLgkmc2nbqPAo5aQ/nUfncgIt3guhQ7pC 2J1j0mEKbcCi+4RSjpWa9B6cgR11pFBhpvX6iQVdzqrPqD+LQ6TiTLJR01DiXAPZ vPbDGOm1xRN6ygQvzZu55SM/QGE7aYBYdD3Tc2ymozx30eUXJ5Kdbc5v0SnTkCUO QBWGb2krnOaY/cIVUuiE7Q== 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=1749910578; x= 1749996978; bh=tKRllI5iYUJxtWb3aibDMssFPVfW6Nf8VxZvseykuio=; b=X 9HkQV0L3jMEp+S0fMuluvpPbP4eaXLzrTASMNVOmcfZ8XHweHsPOQaiZN9dX23u0 QVaSisxvZRv7mdQzizZnkb/D2tHJUM9ntIoJbgvYEkCnzCl7t/Pp/L2A3Q15Bace Gtqq2djMJRhFszwGFjScuYAXoFmRBIzWuYUKBT20KCNUF2ttz2vIfwXlxEKGUxhH 00BnUDZBmQw0OVfYIrMTtwXTD0qNVg2luWaFdGy2kQPpkF7HFZXvonQzENVE4gWt rBN0PBH4pvQ/VnN/hsRXQgcW23a0A53nrueF1BqlASI2FWjAd0fuqvgWvJnXADFA FaskfnqTOwJVMJUlqavhQ== 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:17 -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 1/3] media: rcar-vin: Fold interrupt helpers into only callers Date: Sat, 14 Jun 2025 16:15:43 +0200 Message-ID: <20250614141545.2860860-2-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 The call sites using the interrupt helper functions have all been reworked to only one for each. Fold echo of them into the only call sites left. While at it rename the variable holding the current interrupt status to make the code easier to read. There is no functional change. Signed-off-by: Niklas S=C3=B6derlund Reviewed-by: Laurent Pinchart --- .../platform/renesas/rcar-vin/rcar-dma.c | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/m= edia/platform/renesas/rcar-vin/rcar-dma.c index 5c08ee2c9807..585b8b3dcfd8 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c @@ -912,21 +912,6 @@ static int rvin_setup(struct rvin_dev *vin) return 0; } =20 -static void rvin_disable_interrupts(struct rvin_dev *vin) -{ - rvin_write(vin, 0, VNIE_REG); -} - -static u32 rvin_get_interrupt_status(struct rvin_dev *vin) -{ - return rvin_read(vin, VNINTS_REG); -} - -static void rvin_ack_interrupt(struct rvin_dev *vin) -{ - rvin_write(vin, rvin_read(vin, VNINTS_REG), VNINTS_REG); -} - static bool rvin_capture_active(struct rvin_dev *vin) { return rvin_read(vin, VNMS_REG) & VNMS_CA; @@ -1049,22 +1034,22 @@ static void rvin_capture_stop(struct rvin_dev *vin) static irqreturn_t rvin_irq(int irq, void *data) { struct rvin_dev *vin =3D data; - u32 int_status, vnms; + u32 status, vnms; int slot; unsigned int handled =3D 0; unsigned long flags; =20 spin_lock_irqsave(&vin->qlock, flags); =20 - int_status =3D rvin_get_interrupt_status(vin); - if (!int_status) + status =3D rvin_read(vin, VNINTS_REG); + if (!status) goto done; =20 - rvin_ack_interrupt(vin); + rvin_write(vin, status, VNINTS_REG); handled =3D 1; =20 /* Nothing to do if nothing was captured. */ - if (!(int_status & VNINTS_FIS)) + if (!(status & VNINTS_FIS)) goto done; =20 /* Nothing to do if not running. */ @@ -1417,7 +1402,7 @@ void rvin_stop_streaming(struct rvin_dev *vin) rvin_set_stream(vin, 0); =20 /* disable interrupts */ - rvin_disable_interrupts(vin); + rvin_write(vin, 0, VNIE_REG); =20 /* Return unprocessed buffers from hardware. */ for (unsigned int i =3D 0; i < HW_BUFFER_NUM; i++) { --=20 2.49.0 From nobody Fri Oct 10 09:19:25 2025 Received: from fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) (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 E76942D9EF9; Sat, 14 Jun 2025 14:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749910583; cv=none; b=lHfuVX2Prl032T+LuGI3W9KLOmCki0T5m4BorocjvTXAtnAVDCj3a6o6jK3l3YX2TeS9U72UZ98VesUcSpyTV8GRxYI9sYbCxH65lGW9ciCsabjpPMvnhYcKr8ZdDM0zZyzRAGdkalU+h3HDMsa/j1GY/qt9NyaaIEB5XCvp6Zg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749910583; c=relaxed/simple; bh=BldEuytxszT6LQKIo0RKEfQejpLe0DeGBghC01c2Qzc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=R8AlKAkIJ5F+5aiEeoK4CnOfqjrRtrANOd5285sNLbIsm37wASacAgDMJf2NHDEviKGG9U3SjjmwbbSoUG6f8DQRlQ7rzGPenMbnfV+bKBQYjZrsrMdzabFLBaM67AlgKW+8L7UiI8GumveY+gpfF/qm3nKgOENWzJ41oT6PoHc= 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=M437Zfkt; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=VMsjd2ZO; arc=none smtp.client-ip=103.168.172.151 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="M437Zfkt"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="VMsjd2ZO" Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id 0E934138039F; Sat, 14 Jun 2025 10:16:21 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Sat, 14 Jun 2025 10:16:21 -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=1749910581; x=1749996981; bh=EccDRHfC1owa9BxBFhyftHnzmhde0tP0Z21NX7L5gEQ=; b= M437ZfktzQ4f3ye0RI7F1DcgCOG69S45VWLrFOg2uYVLJbab7oWPeEnfLdIWe0rP qqtLuA8jz4zxHQezi/Qvy9wOLmsEIVZIwK3bxPUQTaAIbywhSLE8EItfjQ8cCvlu qlUNsBVbHTdotq3FB8TKyPi9jRF11OaqxFxDisax9fZK4uewl8Se0VOFnwtMyblg azeWns5S49eokI8TZa6gt4GPyxOD3hQgDvJCoCMOIStpNohcv5nwTWLufrtWBtqy OC7qykfiW70d93ruWj7do44uf+AO+f83czTk/ag1b/x9IIwqduOORs0kyyfTqo/3 Vn/qY73iWCzh52DlK83Qdg== 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=1749910581; x= 1749996981; bh=EccDRHfC1owa9BxBFhyftHnzmhde0tP0Z21NX7L5gEQ=; b=V Msjd2ZOY7iVTW3d4kDA8V4XKTkrtwgJr6yCxbAS9DKlV/qvy+pOzfbb4AfIfMcHk DohVce24s/NvC3ekNEcvX9TjhlrD168cOyoe6AsCMSc4VL/pkHvgPDZw1Jx5qKBE ICWIzbr+PbFcMspEKHZaRL1llapG72mSaaGI+UV8+S2T65+aAlZGOFx6sYHuTzq3 QqxkDyBMVhkMffwTGdUP0i80t3yK6vIWVqkwLQGy/R0v1J5SMGIYWePnUEaGz2qD jfvbg4yBpXOrzJSbjJlXfnO8dV4oer010bUb8vIpDkWFGeY0FqNn81VtM/2ngTp5 FZrIfon8QyvblXetbnGkg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugddvuddtgecutefuodetggdotefrod 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:20 -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 2/3] media: rcar-vin: Check for correct capture interrupt event Date: Sat, 14 Jun 2025 16:15:44 +0200 Message-ID: <20250614141545.2860860-3-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 Depending on if the capture session deals with fields or whole frames interrupts can be generated at an end of field, or end of frame event. The interrupt mask is setup to generate an interrupt on one of the two events depending on what is needed when the VIN is started. The end of field bit is set in both cases so controlling the mask that generates an interrupt have been enough to control the two use-cases. Before extending the interrupt handler to deal with other types of interrupt events it is needs to extended to "capture complete" check for correct the use-case in operation. Without this the simplification in the handler can result in corrupted frames when the mask on what type of events can generate an interrupt generated can no longer be assumed to only be an "capture complete" event. Which bit is checked matches which bit is enabled at configuration time as which event can generate an interrupt for "capture complete". There is no functional change. While at it switch to use the BIT() macro to describe the bit positions for the interrupt functions. Signed-off-by: Niklas S=C3=B6derlund Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/m= edia/platform/renesas/rcar-vin/rcar-dma.c index 585b8b3dcfd8..85e44a00e0fc 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c @@ -115,11 +115,12 @@ #define VNFC_S_FRAME (1 << 0) =20 /* Video n Interrupt Enable Register bits */ -#define VNIE_FIE (1 << 4) -#define VNIE_EFE (1 << 1) +#define VNIE_FIE BIT(4) +#define VNIE_EFE BIT(1) =20 /* Video n Interrupt Status Register bits */ -#define VNINTS_FIS (1 << 4) +#define VNINTS_FIS BIT(4) +#define VNINTS_EFS BIT(1) =20 /* Video n Data Mode Register bits */ #define VNDMR_A8BIT(n) (((n) & 0xff) << 24) @@ -1034,7 +1035,7 @@ static void rvin_capture_stop(struct rvin_dev *vin) static irqreturn_t rvin_irq(int irq, void *data) { struct rvin_dev *vin =3D data; - u32 status, vnms; + u32 capture, status, vnms; int slot; unsigned int handled =3D 0; unsigned long flags; @@ -1049,7 +1050,10 @@ static irqreturn_t rvin_irq(int irq, void *data) handled =3D 1; =20 /* Nothing to do if nothing was captured. */ - if (!(status & VNINTS_FIS)) + capture =3D vin->format.field =3D=3D V4L2_FIELD_NONE || + vin->format.field =3D=3D V4L2_FIELD_ALTERNATE ? + VNINTS_FIS : VNINTS_EFS; + if (!(status & capture)) goto done; =20 /* Nothing to do if not running. */ --=20 2.49.0 From nobody Fri Oct 10 09:19:25 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