From patchwork Mon Jan 20 13:10:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13945083 X-Patchwork-Delegate: kieran@bingham.xyz 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 935C31BEF87; Mon, 20 Jan 2025 13:11:33 +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=1737378695; cv=none; b=lHBGmy5aYkpjMQkdSQaCBfvxvE+UEWMiqXVpuAG71wRQSBHDot86ZzBxu20n6iaSYNdPiSYKijO30XB2W7eQq5NlJNQ5piSWWu9dSetCT/Q/Ob9lN80DLSRkegauXrD0OZBspH2iQgOa/csx86Hfuxn/1GBmTcJd5H0pGi8tHww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737378695; c=relaxed/simple; bh=rS3t3u+oSZ/MP7QaYQqmyDuShbf4qPxbxmv6v/KRmXs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DWzHlmPcQV9oKhlp2aVHT8uCnoQcnO1T8b7B0FSmKXZNg6cDXciUB8qpFGBVgCWfsdKmnVNWjYQcOwoV3NvPo0hzerNqif5580ahCzvo40t/JKf9DEuYRCUlTeisYbSpBqXnXc/SdpYGb6Cj85bgA5RjVIj6O5B8TmnRQ2ZJOXw= 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=voAUOhDo; 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="voAUOhDo" Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 29CFECDB; Mon, 20 Jan 2025 14:10:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737378623; bh=rS3t3u+oSZ/MP7QaYQqmyDuShbf4qPxbxmv6v/KRmXs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=voAUOhDoTq2rJcSeOuqGaeuuCdotqzKm8B7NE3DnKJlqeRppEpLSikxv9K8tIE4X6 eGNGVlKXCY0CQRsFZIY+U+QF3sx59H61pu/5QY2GatiztgFw798qcZsZxgAY189//y YO6ljNSAuuC3UtI9yTttxxTShSqI3Ree/C8G0QIw= From: Tomi Valkeinen Date: Mon, 20 Jan 2025 15:10:34 +0200 Subject: [PATCH 01/10] media: rcar-csi2: Move Y8 entry to a better place Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250120-rcar-media-impro-v1-1-043823c3893e@ideasonboard.com> References: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> In-Reply-To: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> To: =?utf-8?q?Niklas_S=C3=B6derlund?= , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1156; i=tomi.valkeinen+renesas@ideasonboard.com; h=from:subject:message-id; bh=rS3t3u+oSZ/MP7QaYQqmyDuShbf4qPxbxmv6v/KRmXs=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnjkt3ME1QGfCLjsPGSrcSz5B5KmAljsY5ly9lf nrD1z4+BuOJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ45LdwAKCRD6PaqMvJYe 9QyhD/oCxgITXFlv2vrxfeu5xMdU054jg4mIlq3TOgqrJm8lazK8gzq7Ivbshs92ImdgxnVA8nD 6914lI0vh3GIbrva+5nwzs3prhvN+3a+6WWqQOKWhH1sPzuJOaCn2FDLt4IdXx73dDTzqKgN/tu 9biRB0MC/BHIp6w0y8+Aucw3qH/VQd7+JRsPG+fzAh5SQsCn/fhkKRkYQt1aWAyMeNW/gQd2UVl tXHYi2oYrQbPlSsKenwG73bg/oOW1PyccGAYjwgBs2eBfhuyQy3YrKoqhp7jic1jkUo8hxwsAMa ir6VLmh/es5i3xUwXvBUETm/0/k6EuJ16mB7b4J/5TjnMInsQOwI5OxhrvCmkHV1qYrJJWznNFy JFh82eJdtXuy2WDgGe6o3yv6dc9j5mcfcQI6lRNVa0fm8ZC5Qo7wRFqqTwD5on0neCGokMu5e3I zdVxrPq4sKAzNedzrjQvj4fWosZl9Vjtw1Aw0A4UG28oWhL66VX/z5yIl4UTArJLvlmVrLDOtxU yfLWXMPQCiR/tMNirPMt2HmPiM0AmK8u5+ZL3/1S5H0CozbnuSPMuEJXWvaInCUWGAv6ux8rKRt IJ4dVsWlZ1SMuwZPp7TQKzwnD7dMWYuBduLkQIJqygHNZ3YoGox81MCfrKF2aBzItISXTuiD+Ke eHrzNvFCKvHKCoQ== X-Developer-Key: i=tomi.valkeinen+renesas@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Move the Y8 entry before Y10, so that the entries are in a bit more logical order. Signed-off-by: Tomi Valkeinen --- drivers/media/platform/renesas/rcar-csi2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c index 0a53dd47d7bf..be930ebca3f5 100644 --- a/drivers/media/platform/renesas/rcar-csi2.c +++ b/drivers/media/platform/renesas/rcar-csi2.c @@ -636,6 +636,10 @@ static const struct rcar_csi2_format rcar_csi2_formats[] = { .code = MEDIA_BUS_FMT_YUYV10_2X10, .datatype = MIPI_CSI2_DT_YUV422_8B, .bpp = 20, + }, { + .code = MEDIA_BUS_FMT_Y8_1X8, + .datatype = MIPI_CSI2_DT_RAW8, + .bpp = 8, }, { .code = MEDIA_BUS_FMT_Y10_1X10, .datatype = MIPI_CSI2_DT_RAW10, @@ -656,10 +660,6 @@ static const struct rcar_csi2_format rcar_csi2_formats[] = { .code = MEDIA_BUS_FMT_SRGGB8_1X8, .datatype = MIPI_CSI2_DT_RAW8, .bpp = 8, - }, { - .code = MEDIA_BUS_FMT_Y8_1X8, - .datatype = MIPI_CSI2_DT_RAW8, - .bpp = 8, }, }; From patchwork Mon Jan 20 13:10:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13945085 X-Patchwork-Delegate: kieran@bingham.xyz 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 B55BB1E2007; Mon, 20 Jan 2025 13:11:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737378698; cv=none; b=IjwmsJoZH/nhwO0WqYHZQ9vz+DNzjCo30GarLy/1/YiSKPPrX19AdxcKUtWL5u5241ujCKtc37XrLIMsvMWzenKVGmARiOTh4jOMFAGjYFBMyYnujL/KYW1g+RnyAnFIcWDygWIoJ3BU5Grwr0S1yepYSnmPBh/Ma/M1yKomNr4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737378698; c=relaxed/simple; bh=6NA5qbjrGQlNxg6LJ+6qAnM81wKg/Bz2pui0ogtvTu0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eMEKebydZsYK1CMrRDM+hoXKnHPL+3CIlQYgVpkJsg+UB9vu4x1SyqZJ8TnSzoLY0akepz33iO+4DLT/eMvPn48wv7CAadMVQjXJTB8lar9YKG9VaudRmZ3hHbeLjefj7GG9zJmTJB9PT2s2i8U5ONc9CknvWL5OHtXhUylVV+I= 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=JmHr6NGG; 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="JmHr6NGG" Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A3E2FF0C; Mon, 20 Jan 2025 14:10:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737378624; bh=6NA5qbjrGQlNxg6LJ+6qAnM81wKg/Bz2pui0ogtvTu0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JmHr6NGGcn9tSgENgkYpob69Gh10cfVJGUsjrzEiG0c00uuAOGxfwy1MPZ5deC+R8 CrVHXByF4FAu7tnB2X7etq8aAdnoFVp95mVIWhPzbCaGYmUdFCkxCbELpbgRgw60kM 0tCkj0CTOD8d/lZD7exllJDYdMHejsRcyeIb5m0A= From: Tomi Valkeinen Date: Mon, 20 Jan 2025 15:10:35 +0200 Subject: [PATCH 02/10] media: rcar-csi2: Add RAW10 and RAW12 formats Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250120-rcar-media-impro-v1-2-043823c3893e@ideasonboard.com> References: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> In-Reply-To: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> To: =?utf-8?q?Niklas_S=C3=B6derlund?= , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1525; i=tomi.valkeinen+renesas@ideasonboard.com; h=from:subject:message-id; bh=6NA5qbjrGQlNxg6LJ+6qAnM81wKg/Bz2pui0ogtvTu0=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnjkt43IltdF5yH2qnv4mSX2TERQVOeITuxWQTS WZF/K0OEsiJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ45LeAAKCRD6PaqMvJYe 9WQbD/9uRZrKIxe/2Lwnkx20eWAi29KELCZ47Bm3NRa7y0MDd21mbO1NFXC1x8DmGItMdBfzSw2 hKM55zkxzoSKiio4sqx3Zk3JzyPkqCOc7QjjbtNkDkvWbhzBkYNHn6u3AxePH9NHjRfnJVMrnjV P+64+gGyW3ywjF3zBgPtXwWMuJzzLVD1GRFZVPE+VJe3izAKZaqcQAcQ0BY+ZzQ+cLt/d8gfXAy ClXQjOH+cbt0ZaSIQ0N2/GIQf7LJ6X5BVgQRcSdl3RPgQOfwl29I8XOOQ4ZgCH6L709hgGTF+w9 7YjZ+MLG9S9MkJVOMdt0pN6e1bYaHAadGfoGCyzqZ5IG6RiySBERhLqGWWSNsJAK4RKovGxB/0k x4x6Ojw4BsBhDItJwqKB0OPVBFTBHenVDM92rSPsPHnba6tolVyKg08mfgFGfoqLugUBCSMsrIp 01YdQxqAq2mHok7t2/AwfkVWQcQMKTIZth2AVj6W87Vuy1vRJqt1yRw5XrGZ6uDBboMa492SNRW N/d8OC20XyTufy6pba0DAYQoiXabcJxymjdTqFx5SWz0rEbJ9gTiHSw8K4tsPkQVQwTvlShebL4 U3PU30Cc3f08hu5J/nhBKdhvv4+ulUH2Gx7Lx8JClJxMktDSc0f63EJPZWMYgRVmpvMkz1608ey iVfiEnW0ZHq1Oow== X-Developer-Key: i=tomi.valkeinen+renesas@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Add RAW10 and RAW12 formats. We only need to add the entries to the rcar_csi2_format list. Signed-off-by: Tomi Valkeinen --- drivers/media/platform/renesas/rcar-csi2.c | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c index be930ebca3f5..52d4e333c735 100644 --- a/drivers/media/platform/renesas/rcar-csi2.c +++ b/drivers/media/platform/renesas/rcar-csi2.c @@ -660,6 +660,38 @@ static const struct rcar_csi2_format rcar_csi2_formats[] = { .code = MEDIA_BUS_FMT_SRGGB8_1X8, .datatype = MIPI_CSI2_DT_RAW8, .bpp = 8, + }, { + .code = MEDIA_BUS_FMT_SBGGR10_1X10, + .datatype = MIPI_CSI2_DT_RAW10, + .bpp = 10, + }, { + .code = MEDIA_BUS_FMT_SGBRG10_1X10, + .datatype = MIPI_CSI2_DT_RAW10, + .bpp = 10, + }, { + .code = MEDIA_BUS_FMT_SGRBG10_1X10, + .datatype = MIPI_CSI2_DT_RAW10, + .bpp = 10, + }, { + .code = MEDIA_BUS_FMT_SRGGB10_1X10, + .datatype = MIPI_CSI2_DT_RAW10, + .bpp = 10, + }, { + .code = MEDIA_BUS_FMT_SBGGR12_1X12, + .datatype = MIPI_CSI2_DT_RAW12, + .bpp = 12, + }, { + .code = MEDIA_BUS_FMT_SGBRG12_1X12, + .datatype = MIPI_CSI2_DT_RAW12, + .bpp = 12, + }, { + .code = MEDIA_BUS_FMT_SGRBG12_1X12, + .datatype = MIPI_CSI2_DT_RAW12, + .bpp = 12, + }, { + .code = MEDIA_BUS_FMT_SRGGB12_1X12, + .datatype = MIPI_CSI2_DT_RAW12, + .bpp = 12, }, }; From patchwork Mon Jan 20 13:10:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13945084 X-Patchwork-Delegate: kieran@bingham.xyz 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 B555A1E1C3B; Mon, 20 Jan 2025 13:11:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737378698; cv=none; b=rIjCCDDVhuV+iYq1mKPN+Ro5hzTAMjJd6noL3Vx227xaFWXHTlhj85iAJC2Zy+GOG5q6wYAmnPG/UVbOnneSkYUgKlqxx25z6phAq+fab+JiJJJGPTU4iOSTCtrQ3JqFcRNzsTRuyRJeyhLrfwXX5b2b8D4y94RP0+Ze/EF7c4A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737378698; c=relaxed/simple; bh=Z8jlw8ElRA4Rtp59zIGgryH8jHparWgwOJ0ZRvrMmOU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OAB962tiyCmdfneuYKH6QDQSmgKdk69+MpZpK3T+0LN26qqVGfTg1bpJrhdR6sRp484o3hx+AHDB1CHqBUUUwI5qBZCJLt+7m+u9jwW5Xq7CDpdNjrerBQAU7EgqwoktCka5fEOnkCMhTCO3dOOji4+hb2SFRIFVJS3uipMjYe4= 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=Jm9TUkG2; 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="Jm9TUkG2" Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 275E61193; Mon, 20 Jan 2025 14:10:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737378624; bh=Z8jlw8ElRA4Rtp59zIGgryH8jHparWgwOJ0ZRvrMmOU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Jm9TUkG27OvnDvZLRMCmsbK56QD+MNpqVb3A+ypU6dmoLOKwF699dHG/BhWKhqkUM et6QjzRNxBZ8vHdbe24HXYwy5gDFiTKQ0Gvjz7hXjkWaOOa6nuu/pRHvMWHFWYuMVs bgj/AyD1gR62We6DtINOQwjELmRturGG5cqbJBT8= From: Tomi Valkeinen Date: Mon, 20 Jan 2025 15:10:36 +0200 Subject: [PATCH 03/10] media: rcar-isp: Add RAW8, RAW10 and RAW12 formats Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250120-rcar-media-impro-v1-3-043823c3893e@ideasonboard.com> References: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> In-Reply-To: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> To: =?utf-8?q?Niklas_S=C3=B6derlund?= , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1942; i=tomi.valkeinen+renesas@ideasonboard.com; h=from:subject:message-id; bh=Z8jlw8ElRA4Rtp59zIGgryH8jHparWgwOJ0ZRvrMmOU=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnjkt4QE/p03oaJhdkpmJRZJzrYp4WQUP5QYKT+ IwVdta5YYyJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ45LeAAKCRD6PaqMvJYe 9RPpEACmQBIpe2mu15JfULnnkTEdVO9zEYxcs35k9xLs/z2YR6h6tX5tWbJ5VobUfmzzU0vq2r9 U0GRfYlviYWI1POI/Zqe/rSHPjakp8XUr1lxDQJHwLX/XChiqPfVaO/fXV5HX3aqm841vVpkyJq +Oi1VwwE+jxzijzSb7xsc1RvG/2TT6/7z4uFl5oy+4vPFZU+rhqZKiJsVljtUsTo8dCbxnw292+ XU+D7RNafh7CT+P11NJnzn4gyM4neGRUQ0xgXk8DmIQeMSmTFhzRclZrjkXdpPu5i/0WM+rOw5I /rWJ8hRjBGy4UNpPlxazje4ZZsIsfwRMlAQE0tbWk9BadyeJKmYZqNSICby6YWFwbXrQ7KpdYZq 0YdacNW7yFrEGsRXi5i5NusU7LcTnwNW+PJN8OrFcL/0NDiMgVEQsLBizwaJRCvN2GcGfs+vCkb lJa4j9u38YoiOwpvxthj0JpnoFeiYaq7hvCQk9nyqRoUA62e8BKZ4Z5uEm0m8JG1M54bG93GtmI OdsOkCHXYIEVBpEHWku03WgBfd4HRHT7ZgO5VjVWjIZWNZ7J4VYWTZaQAG7fFk89TvOuARwdXQ2 Kqp1mB9mk9dUqPeR7Hji1Grbb79UT0ymmwfPGFmmgkX38F0Y1//OI6uxbYRDn5LqLImXAvC15h0 iZUDCBcsA9xpLzQ== X-Developer-Key: i=tomi.valkeinen+renesas@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Add RAW8, RAW10 and RAW12 formats. Signed-off-by: Tomi Valkeinen --- drivers/media/platform/renesas/rcar-isp.c | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/media/platform/renesas/rcar-isp.c b/drivers/media/platform/renesas/rcar-isp.c index c515278e3be5..121fa7524ee1 100644 --- a/drivers/media/platform/renesas/rcar-isp.c +++ b/drivers/media/platform/renesas/rcar-isp.c @@ -76,6 +76,54 @@ static const struct rcar_isp_format rcar_isp_formats[] = { .code = MEDIA_BUS_FMT_YUYV10_2X10, .datatype = MIPI_CSI2_DT_YUV422_8B, .procmode = 0x0c, + }, { + .code = MEDIA_BUS_FMT_SBGGR8_1X8, + .datatype = MIPI_CSI2_DT_RAW8, + .procmode = 0x00, + }, { + .code = MEDIA_BUS_FMT_SGBRG8_1X8, + .datatype = MIPI_CSI2_DT_RAW8, + .procmode = 0x00, + }, { + .code = MEDIA_BUS_FMT_SGRBG8_1X8, + .datatype = MIPI_CSI2_DT_RAW8, + .procmode = 0x00, + }, { + .code = MEDIA_BUS_FMT_SRGGB8_1X8, + .datatype = MIPI_CSI2_DT_RAW8, + .procmode = 0x00, + }, { + .code = MEDIA_BUS_FMT_SBGGR10_1X10, + .datatype = MIPI_CSI2_DT_RAW10, + .procmode = 0x01, + }, { + .code = MEDIA_BUS_FMT_SGBRG10_1X10, + .datatype = MIPI_CSI2_DT_RAW10, + .procmode = 0x01, + }, { + .code = MEDIA_BUS_FMT_SGRBG10_1X10, + .datatype = MIPI_CSI2_DT_RAW10, + .procmode = 0x01, + }, { + .code = MEDIA_BUS_FMT_SRGGB10_1X10, + .datatype = MIPI_CSI2_DT_RAW10, + .procmode = 0x01, + }, { + .code = MEDIA_BUS_FMT_SBGGR12_1X12, + .datatype = MIPI_CSI2_DT_RAW12, + .procmode = 0x02, + }, { + .code = MEDIA_BUS_FMT_SGBRG12_1X12, + .datatype = MIPI_CSI2_DT_RAW12, + .procmode = 0x02, + }, { + .code = MEDIA_BUS_FMT_SGRBG12_1X12, + .datatype = MIPI_CSI2_DT_RAW12, + .procmode = 0x02, + }, { + .code = MEDIA_BUS_FMT_SRGGB12_1X12, + .datatype = MIPI_CSI2_DT_RAW12, + .procmode = 0x02, }, }; From patchwork Mon Jan 20 13:10:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13945086 X-Patchwork-Delegate: kieran@bingham.xyz 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 D15A21E2843; Mon, 20 Jan 2025 13:11:39 +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=1737378701; cv=none; b=BmNhpiG5ie4ku/fhkUMvR1WRWf7z08YaFi+TCfKWGWsCf65C42wEiid5S2WHtDQPNgXU/v7eN/VaGcY2xENc5CVmM9d+p9++txfl9qEnSnkb4huLq4kKgDn9ctOmBwteWVpDEzDoZJwQf/bTQBL3stdUJ8m8Wxt2AzAoYnqPTMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737378701; c=relaxed/simple; bh=HOC0iwOhFBcP5j1MwMPNRotFW8j1Ia86cs/Eq8KP/9A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h+bO2X6iqNR0K/zBuY0M9oayjBzEJ8+Wh0hDEyPH7Sr6I3KeVqL24UY/99yAdv9grIc+TIgU9oOq9TDsPGnsUK05A9c6IWiJv5ccUsE6x8jMktEc9xpVgQJbo+rwXGBFSp2v/Rf7MXH3VjSL0FKk7HacL7kQdyURy97gvqZHEp8= 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=SFr/5Buu; 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="SFr/5Buu" Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9EEBC11A1; Mon, 20 Jan 2025 14:10:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737378624; bh=HOC0iwOhFBcP5j1MwMPNRotFW8j1Ia86cs/Eq8KP/9A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=SFr/5BuuVYAeHBLv3RnLVgdsxYr/XmxEn/XNcVHQtGLE5Hh6RdqdB2faCoyAYIdoX gRegpOTMzlDaFKS7/lO/Od02dFmvS2ujxeoSXGUSj8BN0IP7F6xxNNob9zDN7CSm0X H+e9IxTTise3PMx8mKzxYSbYoJycC+xgGZCEUJAc= From: Tomi Valkeinen Date: Mon, 20 Jan 2025 15:10:37 +0200 Subject: [PATCH 04/10] media: rcar-csi2: Use v4l2_get_link_freq() Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250120-rcar-media-impro-v1-4-043823c3893e@ideasonboard.com> References: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> In-Reply-To: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> To: =?utf-8?q?Niklas_S=C3=B6derlund?= , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2175; i=tomi.valkeinen+renesas@ideasonboard.com; h=from:subject:message-id; bh=HOC0iwOhFBcP5j1MwMPNRotFW8j1Ia86cs/Eq8KP/9A=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnjkt56oCr0WVy8D2Pu1OpmZK4MzT2ojO0Gj0R8 hbJP9UD6wiJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ45LeQAKCRD6PaqMvJYe 9Xj6D/9AVEMlaP7qNsVxHEMYI8pGvNz/7oNxkvVznpqYLB5GblBNTBltyH/t6uycQqblzt0FBFE WKndWD0FOFKjO6Re+or6ClpfO13W+PZMqo7DaO/7NQ+9jwvW8rhE2C8uzHqEVPoOLZmTYw0Ut1e SxCL6vltMD5k8dWZDrx7pUCGaPX/G17ofs26xcQ6bCcPcs0KAluywwNo3Z6+vTORvN0hyf5i1x1 Rcg+YyvbkPrH6sufvQtspZRHNCgi06YjNa3GQY0u8iyKuVtLy0on8k8kNDgbktvJ3G5S6sD/9RK mrAJ9SkyVMPMOna33bfmgPGAU997nIG5jjBml6yZRy4XQRWFl2+iFFd9mjGeRwZ3WqD8h2lFoFa AjttBducPkBmDe3t9kbR1jdAn6zzShTTTUCmNDLOf7nZ2qndbN+uOqPDME/NM7HeU+u+s2QhJmS w1FxctalwPKVHH8fThbFlhqp/i/oPO6EseHC35nFn4GiM545v95yziZuJsAut7LHp2INHVWIrjs rVf8gwwLv2ndQ3ggvvpjTpx82CrSh7IA6hri9rx3VDXWMqo9bC9ag5g6ZYtkJxGmpE+QpMeRUqW dXuBsAt9SUdMWSLVKRy0UrbVbtOxCRlI7uP09hiVoHf/bgnvoXKlp8LDgiC9q+PmMgus5Lh+Ba0 amJD+Tqh98V2NiQ== X-Developer-Key: i=tomi.valkeinen+renesas@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Instead of directly using V4L2_CID_PIXEL_RATE and calculating the mbps from that, use v4l2_get_link_freq(), which also supports V4L2_CID_LINK_FREQ. Signed-off-by: Tomi Valkeinen --- drivers/media/platform/renesas/rcar-csi2.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c index 52d4e333c735..84e6194fed6c 100644 --- a/drivers/media/platform/renesas/rcar-csi2.c +++ b/drivers/media/platform/renesas/rcar-csi2.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -15,6 +16,7 @@ #include #include #include +#include #include #include @@ -953,7 +955,7 @@ static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp, unsigned int lanes) { struct v4l2_subdev *source; - struct v4l2_ctrl *ctrl; + s64 freq; u64 mbps; if (!priv->remote) @@ -961,21 +963,17 @@ static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp, source = priv->remote; - /* Read the pixel rate control from remote. */ - ctrl = v4l2_ctrl_find(source->ctrl_handler, V4L2_CID_PIXEL_RATE); - if (!ctrl) { - dev_err(priv->dev, "no pixel rate control in subdev %s\n", - source->name); - return -EINVAL; + freq = v4l2_get_link_freq(source->ctrl_handler, bpp, 2 * lanes); + if (freq < 0) { + int ret = (int)freq; + + dev_err(priv->dev, "failed to get link freq for %s: %d\n", + source->name, ret); + + return ret; } - /* - * Calculate the phypll in mbps. - * link_freq = (pixel_rate * bits_per_sample) / (2 * nr_of_lanes) - * bps = link_freq * 2 - */ - mbps = v4l2_ctrl_g_ctrl_int64(ctrl) * bpp; - do_div(mbps, lanes * 1000000); + mbps = div_u64(freq * 2, MEGA); /* Adjust for C-PHY, divide by 2.8. */ if (priv->cphy) From patchwork Mon Jan 20 13:10:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13945087 X-Patchwork-Delegate: kieran@bingham.xyz 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 041011E2849; Mon, 20 Jan 2025 13:11:39 +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=1737378701; cv=none; b=kgGUYZFMZXw66hDvwLhzR6QoMnrg5o2yGXJ+EPyvH7F01+CRDqj0ycrYdBEE1/3eKz/eaHrd2Xsf/7mck1+HjzNJ9OR1QxwB5NKAJw9TQLIPEDPt/222Ajn1r7rAVhUjVd0ETW2zq33kOih1OVIZ7Mu+cxXOjTjyh2tUbuxujl0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737378701; c=relaxed/simple; bh=BjZpjYpEImADkqmU9fCdV5ag2Un9S02MUkMa7EiNmvY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HYjWsrmhVUZHxmlySEpkjJsXqnGk2vdrdVQiEbkSZxypaxkMs5sQpHI+EJzAdyej2AJd0KX92jatjzgwj8Cx36FZe8U0LC9DgFIgu12Y0WSdBp+oi59YDQO+Loe6aGM++CTjf7MQuHvC1IDYY2TwlJ2dKK4We5KL/fNxUjFX//8= 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=Gx+e0m21; 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="Gx+e0m21" Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 21EC811B3; Mon, 20 Jan 2025 14:10:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737378625; bh=BjZpjYpEImADkqmU9fCdV5ag2Un9S02MUkMa7EiNmvY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Gx+e0m21L0kMw7EXFAKTpDXTKO9gBDBknoDJqCeNiGlxqoaBuG5V6ZWMiW17PFiW0 FZXZnI+t7y/3/5SRqcv8N3BLurW7gHTx9E3ZqZaixFxlmBM7yD/9ZdFaKoqjaOuXyh Jy9HYvAiW6z1WD98Nk+mk/WL+dwWXF6Q/P2VedXU= From: Tomi Valkeinen Date: Mon, 20 Jan 2025 15:10:38 +0200 Subject: [PATCH 05/10] media: rcar-vin: Use v4l2_subdev_{enable|disable}_streams() Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250120-rcar-media-impro-v1-5-043823c3893e@ideasonboard.com> References: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> In-Reply-To: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> To: =?utf-8?q?Niklas_S=C3=B6derlund?= , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1231; i=tomi.valkeinen+renesas@ideasonboard.com; h=from:subject:message-id; bh=BjZpjYpEImADkqmU9fCdV5ag2Un9S02MUkMa7EiNmvY=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnjkt5mZUbGiVDLMYkk52gAT41iQG2L1ylu5z1y b5lJReNAfKJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ45LeQAKCRD6PaqMvJYe 9fNyEACHxvjAUoK9xoJvdPB6YJziJqb1iyiJt61cXSzck/nP5gi45CxlmGamL38t/HJ7rl+xSkZ KM0JNwuZ6ZnAbgvHzNOAUxx1MbTwGRg44G3t97I3QFheCn6aNWkrLXNlwW79xYyJKgGKlmYTmpY q6yENDtQdPUyw3i9HXs4Rvoy8QbVh4JB80ogYxXxeBwm9utQQ7e9EvOBkc+jFb7JjNHN4oOb6EI 6SIVgtVbJKC2IV7ld9LJqoGmsOky9m6p6WxDHATl2YNoztWVCxjUEcjzBIWBVzv8tYaU0DE8k2I mnUXFScqAAfXLufjGUyoA7PPyju0H0iRKilShrIW10NJNfgVuH962WLr/1ns5/aFozZNJ6Zvcm2 fToTMISAohTdst4tiqDdSiZ8jtBLChCuBWu4hYhrE5UyjBAl6GDtrEAOjtbX+dK1xFi/gNnBQ2n zoH1x1GMKuvy3N0mJKU8h1T0IfzqZF1Szs4j3g41fZkGwZ5pY6U+pm0FqbMPoPLgWNlstsanwMn BRQZZLGnfI0kC18fQZK7xt+R0kN5pfeh3rg1eV41LYxGALKhNF82bem/Ox+HsgTksUtg6itJMJn El4NIWE+YSSxV+oLPtp5m9epyQ1lgSZA4EY5jvTVBCkZt2tc68c+sC/Zu+FHyMyoR94T3my02X0 nRHP9+aWcDQKpyg== X-Developer-Key: i=tomi.valkeinen+renesas@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Use v4l2_subdev_{enable|disable}_streams() instead of calling s_stream op directly. This allows the called subdev to drop the legacy s_stream op. Signed-off-by: Tomi Valkeinen --- drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c index 8773998101ff..8de871240440 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c @@ -1397,7 +1397,7 @@ static int rvin_set_stream(struct rvin_dev *vin, int on) if (!on) { video_device_pipeline_stop(&vin->vdev); - return v4l2_subdev_call(sd, video, s_stream, 0); + return v4l2_subdev_disable_streams(sd, pad->index, BIT_ULL(0)); } ret = rvin_mc_validate_format(vin, sd, pad); @@ -1408,7 +1408,7 @@ static int rvin_set_stream(struct rvin_dev *vin, int on) if (ret) return ret; - ret = v4l2_subdev_call(sd, video, s_stream, 1); + ret = v4l2_subdev_enable_streams(sd, pad->index, BIT_ULL(0)); if (ret == -ENOIOCTLCMD) ret = 0; if (ret) From patchwork Mon Jan 20 13:10:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13945088 X-Patchwork-Delegate: kieran@bingham.xyz 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 067541E3793; Mon, 20 Jan 2025 13:11:42 +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=1737378704; cv=none; b=KCgjl7u8ORMBD4jUDdeN8ITb2F/nIHb14d3BF5M41Vl7IiRM+e8XStHjSfA1fIMRO9dBp60ilXONCbJtj+rMA1XiKvA2CunfHMUj/JC5tAIbFZT0KNB/QlEaJGim2up67gFrX/jJzNOk5T2QQrQsD5HCc3VMYWddRl+ZoBLWEyU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737378704; c=relaxed/simple; bh=X+TlKfpYSyW/I55G4eeXWUbG0Mub9IhXrQ8tx05iH5I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B/sReCtDYtnWHLzCWEbhTG1qo79Tc46VrWpgm6saXa+sQMv00pxlU329sYXrQFplBQRIIn6eFy9mhz9Vyf375YdrqHZjw2XpN97KjZy631OVLUenp20OmmtJASbhCjQtfa0A6905xmD/75fyxFawLBtWHhatEp3Y3QqvZ3WtF4c= 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=l4ORFvvj; 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="l4ORFvvj" Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 989FB11DF; Mon, 20 Jan 2025 14:10:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737378625; bh=X+TlKfpYSyW/I55G4eeXWUbG0Mub9IhXrQ8tx05iH5I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=l4ORFvvjmBhJvnEpJpIJY6031sgDAR5YTefX91/V4D5hE49Pfkf3N8itTq3ixwG+A 5nv8fIfLwhTbjSo8YX2PSIVjPwciO2euW8qFwEKhm5JiKaa9Z44/6o7zTMC17dSnSN jbsesw/b+FgM8ghL/GNEiqweowReS6vsfic++0ks= From: Tomi Valkeinen Date: Mon, 20 Jan 2025 15:10:39 +0200 Subject: [PATCH 06/10] media: rcar-isp: Use v4l2_subdev_{enable|disable}_streams() Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250120-rcar-media-impro-v1-6-043823c3893e@ideasonboard.com> References: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> In-Reply-To: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> To: =?utf-8?q?Niklas_S=C3=B6derlund?= , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1684; i=tomi.valkeinen+renesas@ideasonboard.com; h=from:subject:message-id; bh=X+TlKfpYSyW/I55G4eeXWUbG0Mub9IhXrQ8tx05iH5I=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnjkt5OMiy7omIOfdsETsOqDwFYMYq3uRGsrq4w sekkJy7XYaJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ45LeQAKCRD6PaqMvJYe 9XI5D/wI83N2zbRkchmiZIFThu/BdnE3tTNmaTOWT3oWsW6hLL9J0OUtj/X3gZ9FuMgc1yI8OZE UkPEqkoqn63vavpqYegjn128CqkVgTRAIQnwfjwUu10pjTabXppJ2v5UFV+H11HBI2aV7iJ3ge3 gz/tvMSo5ny6btQD537QkECgmnbc3C7nsCt7dSGkymEMngoBlecP5ggZp41+eaxZby0ObojjcCh FwM8f7TeYEa3wbsP/BPIRSjwT7mrBNuyYfn9ip3EiOdTUDqNhOJluL4GdSiJTHceVspAV7cKNzt Jf/L0pBJAbiBUnjwnwbw7T7RftNO8mC4MUs35CdGKJ4lRG0vmwT7n1Arnp8Y+8iS/cKZ+gs8CBi 25XQCTGYqABNIP4bPStH9X9Pq7n/qs2mE/xv4AkX3m2p/j9uyVk/WFceBsWVaJbrnXqRPalwUUT SocD/9Q6l23Bu5qCAjqBNZxRhlwuC1T6t/YNn2YfNeGfmJw3lEgoeaaWpYqRfYQySok4TomlHKY NPKnUjp0zTxNTyQecwRHJYtstRkWtQs9qB9PQ8YrYO4221hHGe7tmH9Gs12n+9BiBJFEUs1PJhy GKjSpqAUwMNriezN0/+FgO3dA4ir3/xckWbvN2WInYogHKug+kg5Glt8VWm75tGhTQXlyFqdHfd wl6LQDvFHgMk7DA== X-Developer-Key: i=tomi.valkeinen+renesas@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Use v4l2_subdev_{enable|disable}_streams() instead of calling s_stream op directly. This allows the called subdev to drop the legacy s_stream op. Signed-off-by: Tomi Valkeinen --- drivers/media/platform/renesas/rcar-isp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-isp.c b/drivers/media/platform/renesas/rcar-isp.c index 121fa7524ee1..385fafb2318f 100644 --- a/drivers/media/platform/renesas/rcar-isp.c +++ b/drivers/media/platform/renesas/rcar-isp.c @@ -169,6 +169,7 @@ struct rcar_isp { struct v4l2_async_notifier notifier; struct v4l2_subdev *remote; + unsigned int remote_pad; struct mutex lock; /* Protects mf and stream_count. */ struct v4l2_mbus_framefmt mf; @@ -267,7 +268,8 @@ static int risp_start(struct rcar_isp *isp) /* Start ISP. */ risp_write(isp, ISPSTART_REG, ISPSTART_START); - ret = v4l2_subdev_call(isp->remote, video, s_stream, 1); + ret = v4l2_subdev_enable_streams(isp->remote, isp->remote_pad, + BIT_ULL(0)); if (ret) risp_power_off(isp); @@ -276,7 +278,7 @@ static int risp_start(struct rcar_isp *isp) static void risp_stop(struct rcar_isp *isp) { - v4l2_subdev_call(isp->remote, video, s_stream, 0); + v4l2_subdev_disable_streams(isp->remote, isp->remote_pad, BIT_ULL(0)); /* Stop ISP. */ risp_write(isp, ISPSTART_REG, ISPSTART_STOP); @@ -387,6 +389,7 @@ static int risp_notify_bound(struct v4l2_async_notifier *notifier, } isp->remote = subdev; + isp->remote_pad = pad; dev_dbg(isp->dev, "Bound %s pad: %d\n", subdev->name, pad); From patchwork Mon Jan 20 13:10:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13945089 X-Patchwork-Delegate: kieran@bingham.xyz 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 06E391E3796; Mon, 20 Jan 2025 13:11:43 +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=1737378704; cv=none; b=Ek2DmDk305b2rGRCi7eLjWiL05Dp02kCf/8/oJrTF60dTcGXnpaxye9Ch5q7jp07yEvSf8nAjsvo5V33Y/4a1ZKBtAeg/zODZNasbX4LPY3aQb0mxxKCNaRVuUtfycj9AbAf4l+uqICDpAEZq3CIS1qOlFHWC6Gb/QrCSaIZ5TA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737378704; c=relaxed/simple; bh=5vSj21XFA++SuVr1CESTyfGqY5ake/5yy+jidRxQtFI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BeUf9R5cHQ3m6Crci/OiYfsTmY5/Ic9RVBH/HLdVa719R8Adyil/1VUoSR4ZHl7ZuPAG0DokYbguuY1deMkm+YyJvkTedweb7FBFTQTGSIYqlF7qMRWfOz8PhhD8iC2VnTa4x7m9ipCXPGr2rQHTMh4Bq8z+hFe/AZyZazaSizQ= 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=pgL3pCkV; 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="pgL3pCkV" Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1E05B11E4; Mon, 20 Jan 2025 14:10:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737378626; bh=5vSj21XFA++SuVr1CESTyfGqY5ake/5yy+jidRxQtFI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pgL3pCkVfmio4DLNFbTVxABYT05MQepnsIKjQ/bzuYT8EzGx2sN57UJDbRBgjPSfZ G27Q61NyHcIRwFtrOk/QYo2++j7QcRHJ8KCQQe1WgtAJxGz2jVlJ1vJUtWgJvsJLYr Qs1IJJWb+wJr9LSp7RteAm3ZJRDfFluzFVv5I1jY= From: Tomi Valkeinen Date: Mon, 20 Jan 2025 15:10:40 +0200 Subject: [PATCH 07/10] media: rcar-csi2: Use v4l2_subdev_{enable|disable}_streams() Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250120-rcar-media-impro-v1-7-043823c3893e@ideasonboard.com> References: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> In-Reply-To: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> To: =?utf-8?q?Niklas_S=C3=B6derlund?= , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1320; i=tomi.valkeinen+renesas@ideasonboard.com; h=from:subject:message-id; bh=5vSj21XFA++SuVr1CESTyfGqY5ake/5yy+jidRxQtFI=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnjkt6/uC7WBNUuRia7toejUQbN49CFpq064//C gRFRX8JK+SJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ45LegAKCRD6PaqMvJYe 9e0EEACaa7NR5ZkzMB1oqwHtSb9r/lT1NdQgI5e8VqFRA8+3ACALx4Wa++vHyyvb62H+JAlAvI8 /jBmjTknMl77zCn7TdbHI9coIYvlbpg69Yvfr+NwNfV9/vq8F26BG1Qqnf15PeJM9uOwSrAygY7 XetYleLQnXzjptvPYSOnmkpakzlfozwdZIeGfDs/1olXBgq1NPc1h2zK5M10v7W32DTnxryuotP wPvLJnjJcaojaQVEgKrJ1CsucO3/xW5hMGGJGk+FdDwGrd0qfbomyfyZqXGcIp0FP5gupTklfu1 69GCJWVSx51f5dcB9PVw9lJ7vTrm3UYM0J0Tr9GbOVJPNPag1V1FZ664oWixJlSyWUw4/XMxSvj CAccMltB4UhHFXVnmvUMYnGtBpS6QxsDx9JL7Urv8Ljmi+PCqx4gxR9+YTfginHX44oEzYU+okN x4vwNMof9rZ7LGfPdD/HWECc5VbVwy4DtLKFf4VS09qB7XTFGTehQlWZanH0aUQ657x/cWbsCXx a0ipGFTwxa2qHGaOH4egRgI0eskkXnyE3L6VpvfKCM/ij9ooHjHz74pIolaAT6oY3tLRqhqgzb9 oHAjA/XpsLxZAoJAt9UHjJwYbZfnTuIzMyxV1Fn2sjzUR3Z4x5dziiTDksqvQpdYPAiFWkl2NkR gHecSOMSeXHGYgg== X-Developer-Key: i=tomi.valkeinen+renesas@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Use v4l2_subdev_{enable|disable}_streams() instead of calling s_stream op directly. This allows the called subdev to drop the legacy s_stream op. Signed-off-by: Tomi Valkeinen --- drivers/media/platform/renesas/rcar-csi2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c index 84e6194fed6c..ff27a8845969 100644 --- a/drivers/media/platform/renesas/rcar-csi2.c +++ b/drivers/media/platform/renesas/rcar-csi2.c @@ -1577,7 +1577,8 @@ static int rcsi2_start(struct rcar_csi2 *priv, struct v4l2_subdev_state *state) return ret; } - ret = v4l2_subdev_call(priv->remote, video, s_stream, 1); + ret = v4l2_subdev_enable_streams(priv->remote, priv->remote_pad, + BIT_ULL(0)); if (ret) { rcsi2_enter_standby(priv); return ret; @@ -1589,7 +1590,7 @@ static int rcsi2_start(struct rcar_csi2 *priv, struct v4l2_subdev_state *state) static void rcsi2_stop(struct rcar_csi2 *priv) { rcsi2_enter_standby(priv); - v4l2_subdev_call(priv->remote, video, s_stream, 0); + v4l2_subdev_disable_streams(priv->remote, priv->remote_pad, BIT_ULL(0)); } static int rcsi2_s_stream(struct v4l2_subdev *sd, int enable) From patchwork Mon Jan 20 13:10:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13945090 X-Patchwork-Delegate: kieran@bingham.xyz 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 D71CC1E47B6; Mon, 20 Jan 2025 13:11:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737378707; cv=none; b=VovDEH3nne97/T62vCARDOceil4CY9wx4eEuk7bo8bmnOf1/kjVWO9gu8B56ix9CCrZfCmXQ/ngw6h0w5OcSLcJJuwpwfvs0MCxP+m6a3NTg/GHos3p7bhrt6OYcETfx0hsuH93Bdj6iFbR/MwBzMSsR126L0O3PDyKTdUkcdQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737378707; c=relaxed/simple; bh=e4FEE8+Vy6aIBfrj6HCMA0AaO6LCZd0h4tXExYMXGnw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Hj7ZcrnaF9P7ohp9rVc4EXMjd0lh+DLHv67QNxBXH3Ve22PmqPTOWS0UHZn4tfGa0Qwp+gQyE5GLj6YZRvdKa19zQVjF++97fMzL3MDc9GoNquNNix/Ad9cX1R9ySKsEM1jjwLIZKrMg537fJKOZ8ryy8LBMB1LDaTagLYGcv3o= 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=d1MLNz3l; 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="d1MLNz3l" Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 94A7911E6; Mon, 20 Jan 2025 14:10:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737378626; bh=e4FEE8+Vy6aIBfrj6HCMA0AaO6LCZd0h4tXExYMXGnw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=d1MLNz3lkERwNMzZvHKxdib6EfQb6RH/M8Xlp4mN7sfWTcW3rZvKTFFhavb1Z9ZT8 ilYU6EV5VfMppt2n0n9BXsoQv7Chb5CkUfa9O8DJZxie20ZqzybOgnUszBccuSqjgs h8C3BP++B64d90y3Cbt4/gSBvLwLN5Xw1G1bVL2s= From: Tomi Valkeinen Date: Mon, 20 Jan 2025 15:10:41 +0200 Subject: [PATCH 08/10] media: rcar-isp: Convert to subdev state Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250120-rcar-media-impro-v1-8-043823c3893e@ideasonboard.com> References: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> In-Reply-To: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> To: =?utf-8?q?Niklas_S=C3=B6derlund?= , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5282; i=tomi.valkeinen+renesas@ideasonboard.com; h=from:subject:message-id; bh=e4FEE8+Vy6aIBfrj6HCMA0AaO6LCZd0h4tXExYMXGnw=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnjkt6BwC2t1+8prZkPsEQzxa5tob2NY79X18GP xrWovEzGfGJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ45LegAKCRD6PaqMvJYe 9TEFD/0fY/2FuxShWJuvvKWzKq7E33E62RS6qQt2tXnUfCld1s4Zceg2il/62O+4XNuuRBHAoxF OuUikCuVP9YXo5TZLy4TrR9OWzyHNqNFr+z1XQWd4Pu/ODdMF/x99YYoKxY1Hh3RrPgpJJP+/hv SVvPPIe0nL6gUQvlrpOtym6C/Hqw/gElDjBsr4XR05AdVgOcGLDOE24SLcYU1DjzKkGU6kzEt16 GDwV7TUgB7tEfp5wp5B0tDZkOrvZL0PSGfuXU/bVGKznBsR4Clk4unKRCmA9An02FD3ySyyo+Ii uhTQwcahicyBW6Hin0yiPufSulZpZUbNWuprK9PZkOpH1g5wSh9OQU57znW6fIjz8gaIjeDuLjK DhE8Kk6zvg2EEPJlhz8zYFGPE6mSjnWSd6ktP5njx/jx9U1+kkwgm4NgVKz0WvtHS3CpkmNhvs9 ny0241dC2Wz2JHKL3jDGXloeyosUeX4BXhY+lkV3JG4EKkXANOuG8fNDKLlpMUR5LTLexU8UEw4 FIMRs+broOIpJtfmKj8JjSAGkbXkJus4lQe/PTySFXw6Bbku/bsLfN0hXyuYMddnf6yUS8wKXlC yHNWzmNBn6rmUR/GD79d92cKvnDaYBCE4Aj17yLQiE10PANpDIqjAPKRlAjoEvYLAQfFBUZj6TH y4/CO3Vk25BlCgg== X-Developer-Key: i=tomi.valkeinen+renesas@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Convert to subdev state. This allows us to drop the internal mutex and risp_get_pad_format(), and add streams support in the future. Signed-off-by: Tomi Valkeinen --- drivers/media/platform/renesas/rcar-isp.c | 70 ++++++++++++------------------- 1 file changed, 27 insertions(+), 43 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-isp.c b/drivers/media/platform/renesas/rcar-isp.c index 385fafb2318f..d4eaabb45e07 100644 --- a/drivers/media/platform/renesas/rcar-isp.c +++ b/drivers/media/platform/renesas/rcar-isp.c @@ -171,8 +171,6 @@ struct rcar_isp { struct v4l2_subdev *remote; unsigned int remote_pad; - struct mutex lock; /* Protects mf and stream_count. */ - struct v4l2_mbus_framefmt mf; int stream_count; }; @@ -219,14 +217,19 @@ static void risp_power_off(struct rcar_isp *isp) pm_runtime_put(isp->dev); } -static int risp_start(struct rcar_isp *isp) +static int risp_start(struct rcar_isp *isp, struct v4l2_subdev_state *state) { + const struct v4l2_mbus_framefmt *fmt; const struct rcar_isp_format *format; unsigned int vc; u32 sel_csi = 0; int ret; - format = risp_code_to_fmt(isp->mf.code); + fmt = v4l2_subdev_state_get_format(state, RCAR_ISP_SINK); + if (!fmt) + return -EINVAL; + + format = risp_code_to_fmt(fmt->code); if (!format) { dev_err(isp->dev, "Unsupported bus format\n"); return -EINVAL; @@ -289,9 +292,10 @@ static void risp_stop(struct rcar_isp *isp) static int risp_s_stream(struct v4l2_subdev *sd, int enable) { struct rcar_isp *isp = sd_to_isp(sd); + struct v4l2_subdev_state *state; int ret = 0; - mutex_lock(&isp->lock); + state = v4l2_subdev_lock_and_get_active_state(sd); if (!isp->remote) { ret = -ENODEV; @@ -299,7 +303,7 @@ static int risp_s_stream(struct v4l2_subdev *sd, int enable) } if (enable && isp->stream_count == 0) { - ret = risp_start(isp); + ret = risp_start(isp, state); if (ret) goto out; } else if (!enable && isp->stream_count == 1) { @@ -308,7 +312,7 @@ static int risp_s_stream(struct v4l2_subdev *sd, int enable) isp->stream_count += enable ? 1 : -1; out: - mutex_unlock(&isp->lock); + v4l2_subdev_unlock_state(state); return ret; } @@ -318,50 +322,28 @@ static const struct v4l2_subdev_video_ops risp_video_ops = { }; static int risp_set_pad_format(struct v4l2_subdev *sd, - struct v4l2_subdev_state *sd_state, + struct v4l2_subdev_state *state, struct v4l2_subdev_format *format) { - struct rcar_isp *isp = sd_to_isp(sd); struct v4l2_mbus_framefmt *framefmt; - mutex_lock(&isp->lock); + if (format->pad > RCAR_ISP_SINK) + return v4l2_subdev_get_fmt(sd, state, format); if (!risp_code_to_fmt(format->format.code)) format->format.code = rcar_isp_formats[0].code; - if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) { - isp->mf = format->format; - } else { - framefmt = v4l2_subdev_state_get_format(sd_state, 0); + for (unsigned int i = 0; i < RCAR_ISP_NUM_PADS; i++) { + framefmt = v4l2_subdev_state_get_format(state, i); *framefmt = format->format; } - mutex_unlock(&isp->lock); - - return 0; -} - -static int risp_get_pad_format(struct v4l2_subdev *sd, - struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_format *format) -{ - struct rcar_isp *isp = sd_to_isp(sd); - - mutex_lock(&isp->lock); - - if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) - format->format = isp->mf; - else - format->format = *v4l2_subdev_state_get_format(sd_state, 0); - - mutex_unlock(&isp->lock); - return 0; } static const struct v4l2_subdev_pad_ops risp_pad_ops = { .set_fmt = risp_set_pad_format, - .get_fmt = risp_get_pad_format, + .get_fmt = v4l2_subdev_get_fmt, .link_validate = v4l2_subdev_link_validate_default, }; @@ -500,12 +482,10 @@ static int risp_probe(struct platform_device *pdev) isp->dev = &pdev->dev; - mutex_init(&isp->lock); - ret = risp_probe_resources(isp, pdev); if (ret) { dev_err(isp->dev, "Failed to get resources\n"); - goto error_mutex; + return ret; } platform_set_drvdata(pdev, isp); @@ -536,20 +516,25 @@ static int risp_probe(struct platform_device *pdev) if (ret) goto error_notifier; + ret = v4l2_subdev_init_finalize(&isp->subdev); + if (ret) + goto error_notifier; + ret = v4l2_async_register_subdev(&isp->subdev); if (ret < 0) - goto error_notifier; + goto error_subdev; dev_info(isp->dev, "Using CSI-2 input: %u\n", isp->csi_input); return 0; + +error_subdev: + v4l2_subdev_cleanup(&isp->subdev); error_notifier: v4l2_async_nf_unregister(&isp->notifier); v4l2_async_nf_cleanup(&isp->notifier); error_pm: pm_runtime_disable(&pdev->dev); -error_mutex: - mutex_destroy(&isp->lock); return ret; } @@ -562,10 +547,9 @@ static void risp_remove(struct platform_device *pdev) v4l2_async_nf_cleanup(&isp->notifier); v4l2_async_unregister_subdev(&isp->subdev); + v4l2_subdev_cleanup(&isp->subdev); pm_runtime_disable(&pdev->dev); - - mutex_destroy(&isp->lock); } static struct platform_driver rcar_isp_driver = { From patchwork Mon Jan 20 13:10:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13945091 X-Patchwork-Delegate: kieran@bingham.xyz 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 40CAA1E0E05; Mon, 20 Jan 2025 13:11:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737378707; cv=none; b=p/AsSuDUojzN92TEc3unn9nXia2/TFdXEU01gwGGnJIsi7PVGtbWytVCpdscnJP06VOA3eNGw3yAT7P0dGDDZ3P+OJPJWORkhSfQhLw1fInuPP3Dbl9F1HOgjZH9ErFg0tmdeC4+MCQUL/a5mmYKvttplSGAAtUX83r6EPEDh2g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737378707; c=relaxed/simple; bh=6jI52+vImqohuSnWm8+OipEZIHzHwt+jMvCFZ8Pk6aQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Osj6zJ3CqlfLLIDhUudFpKKzDlM88qZ/DL+gXSNce71+NVBoD4ashKQZNMW5HipUbJFM6Q9SAaIxzruvUwWm1EibhdW6cSnnGA3sqiikwlzTC3MRvHrJrM7ivEzdEjVrAL3KqW8wZ9g+yIGzbSgGEjS/7Q7uEw38HzyFQ6QCl98= 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=ETxGXJY3; 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="ETxGXJY3" Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1881E11E9; Mon, 20 Jan 2025 14:10:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737378627; bh=6jI52+vImqohuSnWm8+OipEZIHzHwt+jMvCFZ8Pk6aQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ETxGXJY3Owydo2TlY41mhH7PcVK5XGcGwX8FKPa2T+sQpQ6HKWi2G0Jvo+c9yFZjH Jxexm4C8H4iuRysdEq4erBzUCHtyxcCjUS9f1BErU7MC/GkQ4F7fX2CC9OVJ4Y78e3 EFxdXu4EpDDu12U0s3SBAesSS15yfc77IEj0zCfQ= From: Tomi Valkeinen Date: Mon, 20 Jan 2025 15:10:42 +0200 Subject: [PATCH 09/10] media: rcar-isp: Convert to .{enable|disable}_streams Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250120-rcar-media-impro-v1-9-043823c3893e@ideasonboard.com> References: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> In-Reply-To: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> To: =?utf-8?q?Niklas_S=C3=B6derlund?= , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2622; i=tomi.valkeinen+renesas@ideasonboard.com; h=from:subject:message-id; bh=6jI52+vImqohuSnWm8+OipEZIHzHwt+jMvCFZ8Pk6aQ=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnjkt66ScvbuoNHkMwMbYyKjns99Pp76dD/30UA lb5GpmBXo+JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ45LegAKCRD6PaqMvJYe 9afGD/9Msnn3IKMqqupyxksfGXDVlnVJJReIf/0N8vkvrYVa/XrfgpuTtuibVfVKc+YTwZcN40w xLC1F7faiAwsSn5MvBy3JMhytXwXv6DF7Az7xJuBiZa0A9m92E4RgpK1FcgIFxNNDLLwYQPKrZo XVOzhjTbOBPre0u2Z2ub3ZsB9147zQOpUXuwQmT+vQXFe64ncEMuo9rkkcHsKkvvcCuM6crkRpH xH693YMzntlu/h+2ffKjYUmz4pEfc9EK72P9IlJi5DlgqDbM2hq68hniwDADf1S6lBANr7bhedI Atrra5yQY1tXHVpug2R8OClfN+WdGQRr+u2jrRsYTX9JfW2CIlN6oDyy64+86RGtohAhxjEmX19 /3Bv3xDvl7W5mlwMjHR34+VvvyxUfyRfCtEJvoTYiZT4uRZjq0BjUZ3acITJwCA3nYNsslfVUaP wbV2hAVPqpApDiQcHIRjbgH6GXhAodugVQSEN7q74FXbvGbsQYnYjr7EIDbh6K5zO5Y+mciau75 HqytjqpPte/tUXw+7c3CdubVKmY/edpx8IbZPFMEb0auKhN5rHJhxbmfjF5gqWuD22HKGEp3wJw AfVuDRSFEeQruHtXC7K/It0h6M+nYhyvJXIGv2KPgExPcmnRcXNVyxa97Z5TOHhXSSaHVHoNuh6 tT4IcfqNIinKVbQ== X-Developer-Key: i=tomi.valkeinen+renesas@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Drop the legacy .s_stream and convert to .{enable|disable}_streams. Signed-off-by: Tomi Valkeinen --- drivers/media/platform/renesas/rcar-isp.c | 49 +++++++++++++++++++------------ 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-isp.c b/drivers/media/platform/renesas/rcar-isp.c index d4eaabb45e07..4bc89d4757fa 100644 --- a/drivers/media/platform/renesas/rcar-isp.c +++ b/drivers/media/platform/renesas/rcar-isp.c @@ -289,37 +289,49 @@ static void risp_stop(struct rcar_isp *isp) risp_power_off(isp); } -static int risp_s_stream(struct v4l2_subdev *sd, int enable) +static int risp_enable_streams(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state, u32 source_pad, + u64 source_streams_mask) { struct rcar_isp *isp = sd_to_isp(sd); - struct v4l2_subdev_state *state; int ret = 0; - state = v4l2_subdev_lock_and_get_active_state(sd); + if (source_streams_mask != 1) + return -EINVAL; - if (!isp->remote) { - ret = -ENODEV; - goto out; - } + if (!isp->remote) + return -ENODEV; - if (enable && isp->stream_count == 0) { + if (isp->stream_count == 0) { ret = risp_start(isp, state); if (ret) - goto out; - } else if (!enable && isp->stream_count == 1) { - risp_stop(isp); + return ret; } - isp->stream_count += enable ? 1 : -1; -out: - v4l2_subdev_unlock_state(state); + isp->stream_count += 1; return ret; } -static const struct v4l2_subdev_video_ops risp_video_ops = { - .s_stream = risp_s_stream, -}; +static int risp_disable_streams(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state, u32 source_pad, + u64 source_streams_mask) +{ + struct rcar_isp *isp = sd_to_isp(sd); + + if (source_streams_mask != 1) + return -EINVAL; + + if (!isp->remote) + return -ENODEV; + + if (isp->stream_count == 1) + risp_stop(isp); + + isp->stream_count -= 1; + + return 0; +} static int risp_set_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, @@ -342,13 +354,14 @@ static int risp_set_pad_format(struct v4l2_subdev *sd, } static const struct v4l2_subdev_pad_ops risp_pad_ops = { + .enable_streams = risp_enable_streams, + .disable_streams = risp_disable_streams, .set_fmt = risp_set_pad_format, .get_fmt = v4l2_subdev_get_fmt, .link_validate = v4l2_subdev_link_validate_default, }; static const struct v4l2_subdev_ops rcar_isp_subdev_ops = { - .video = &risp_video_ops, .pad = &risp_pad_ops, }; From patchwork Mon Jan 20 13:10:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13945092 X-Patchwork-Delegate: kieran@bingham.xyz 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 1FDFC1E571F; Mon, 20 Jan 2025 13:11: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=1737378710; cv=none; b=i9ZkpSXiAwNFG14RRYC4ucKrZ8wKJ2YYpXaqe+0iS5WryQoXa1d6bAdEAzH3rkI0V2nYWi4zFpwezadTteVN7/umFth7uYPmbX7pDO6ZR+txpkZis8L5WOfUdo0YmgaYv++SCF3ZuMn9C76PHofCF0j5AA/VtYEm1tHaX4g8yYY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737378710; c=relaxed/simple; bh=vb/+NyJJH6WqOf9gan/UQHHHcah8dJBGTn6F9vFZyp8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kNV7Gk1PefVXr+SNYkyGjLr63yVJ4EFrJBOxi3ddUSwyAD31VM5W6uVI2l3D5xyLvJcJT19Da9Dp6X5RcHYou3QoiNlpjf3wUcLP2DZ9KTWIXxXWbE3LV514yBtaxBM5zgKpCYxzhKXFxK06TpEpqf4sbqa/xENSCSFbQr+aO+Y= 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=O66a06qX; 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="O66a06qX" Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9300311EB; Mon, 20 Jan 2025 14:10:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737378627; bh=vb/+NyJJH6WqOf9gan/UQHHHcah8dJBGTn6F9vFZyp8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=O66a06qXa8xW7gysP6Az6clEUkDec6f9EAZ7wA35HLKkJ+KMPnPwtQhGaXJUxBjmr flJmP0Ml8rCQsmdGkxWT1/QQxwq6TfqN2lcCXqCsx0Uvj0iQud7i3ERFbYWgYQLkgr z3phtU1gKOtN+7zkQfLRt1J+Lqnn9Kf8RSNfJWfg= From: Tomi Valkeinen Date: Mon, 20 Jan 2025 15:10:43 +0200 Subject: [PATCH 10/10] media: rcar-csi2: Convert to .{enable|disable}_streams Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250120-rcar-media-impro-v1-10-043823c3893e@ideasonboard.com> References: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> In-Reply-To: <20250120-rcar-media-impro-v1-0-043823c3893e@ideasonboard.com> To: =?utf-8?q?Niklas_S=C3=B6derlund?= , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2555; i=tomi.valkeinen+renesas@ideasonboard.com; h=from:subject:message-id; bh=vb/+NyJJH6WqOf9gan/UQHHHcah8dJBGTn6F9vFZyp8=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnjkt79re4sJKQL/QkUuHfQB9fi/MUCrXQ/YlnK Ur0xl1DyfqJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ45LewAKCRD6PaqMvJYe 9QmGD/9llK7gc2nNq8wUo8r5bVN3KUqCqZadaqGVCEeL4BzT5ERmxjdRYd5Y0tHyoUR/9BUrGPq 0nNAbEjpCkq2RRkqCY8/gmMO3mvMJ6YldJ4/1ZtRCJrtiEKUsycv2tnALUfM7wFi3WOhy4r/hor LaJzCg0EzODtTyFvkzkfXJkJ1ilp7k/g1PsjNilVYuuoBaLE1/P75UMpoHl1EJ3N0PdPozu9SCE IZJaS8RrACngctkjxHxPwDjr3YawVjj9GML6RtyqdMxjjdZxGj5S1za3NqnSZ2CLBKXqsttVc0k iXmAsf9I1MZVlmf2hTzQLMOVsRvxHYgztb06I2WwPJXvAbPcv4nW8gkKgbeeHXyQrgPCiRzx8HN 4GUZDOChHRfqwwnQH5yIp6T9iguxZH8LpLfwD1pcMwkVeu6geLOUoZ8MmV+I4Wngz3RoZuwtWWy if5x/XRw8quLG2uPt1whzg0B9FXJ+gUfxeV45ZbY+S3TAougYVZkNMwx30M1mYjsnroQpJR0ijf mmWrkPCrzo0GgH6/vak1en7t1iS579LDCsOxjeivyUepPIsLl2Ou6y/7W8wzJWRq+2K4ct3SSZL xLOrjmUd10cU34fEAv4fQ6G4VK03RijMzegQ35nL9cEm7kOHOEw3U7E24geR8U55tYrNkS3iTeb IOS4rLXulKlh+CQ== X-Developer-Key: i=tomi.valkeinen+renesas@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Drop the legacy .s_stream and convert to .{enable|disable}_streams. Signed-off-by: Tomi Valkeinen --- drivers/media/platform/renesas/rcar-csi2.c | 49 ++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c index ff27a8845969..38a3149f9724 100644 --- a/drivers/media/platform/renesas/rcar-csi2.c +++ b/drivers/media/platform/renesas/rcar-csi2.c @@ -1593,28 +1593,47 @@ static void rcsi2_stop(struct rcar_csi2 *priv) v4l2_subdev_disable_streams(priv->remote, priv->remote_pad, BIT_ULL(0)); } -static int rcsi2_s_stream(struct v4l2_subdev *sd, int enable) +static int rcsi2_enable_streams(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state, u32 source_pad, + u64 source_streams_mask) { struct rcar_csi2 *priv = sd_to_csi2(sd); - struct v4l2_subdev_state *state; int ret = 0; + if (source_streams_mask != 1) + return -EINVAL; + if (!priv->remote) return -ENODEV; - state = v4l2_subdev_lock_and_get_active_state(&priv->subdev); - - if (enable && priv->stream_count == 0) { + if (priv->stream_count == 0) { ret = rcsi2_start(priv, state); if (ret) - goto out; - } else if (!enable && priv->stream_count == 1) { - rcsi2_stop(priv); + return ret; } - priv->stream_count += enable ? 1 : -1; -out: - v4l2_subdev_unlock_state(state); + priv->stream_count += 1; + + return ret; +} + +static int rcsi2_disable_streams(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state, + u32 source_pad, u64 source_streams_mask) +{ + struct rcar_csi2 *priv = sd_to_csi2(sd); + int ret = 0; + + if (source_streams_mask != 1) + return -EINVAL; + + if (!priv->remote) + return -ENODEV; + + if (priv->stream_count == 1) + rcsi2_stop(priv); + + priv->stream_count -= 1; return ret; } @@ -1641,17 +1660,15 @@ static int rcsi2_set_pad_format(struct v4l2_subdev *sd, return 0; } -static const struct v4l2_subdev_video_ops rcar_csi2_video_ops = { - .s_stream = rcsi2_s_stream, -}; - static const struct v4l2_subdev_pad_ops rcar_csi2_pad_ops = { + .enable_streams = rcsi2_enable_streams, + .disable_streams = rcsi2_disable_streams, + .set_fmt = rcsi2_set_pad_format, .get_fmt = v4l2_subdev_get_fmt, }; static const struct v4l2_subdev_ops rcar_csi2_subdev_ops = { - .video = &rcar_csi2_video_ops, .pad = &rcar_csi2_pad_ops, };