From nobody Thu Sep 24 12:55:35 2026 Received: from mx1.white.stw.pengutronix.de (mx1.white.stw.pengutronix.de [185.203.200.13]) (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 B312F531AF6; Wed, 23 Sep 2026 13:45:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=185.203.200.13 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171104; cv=pass; b=gCKNhoyT9yPn7mm8l5+S8fbUU44bWposEdMZLr41LoS+YhqGoMjZ69MdQ/Q4DTjOhbK1I+U6VpGWa1t1vhq7tWZUEkiydVhmBUW0KQJ4dCBoSudoGhf3xiEDXhejmHAJ6OWZ0ec6SGUGHONjh53Usq/REtbG7q0lkIjaD4ewlb0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171104; c=relaxed/simple; bh=/C7CtqaNr5SoHMXI/KMNxIoLwTQ7gGl2eC5ncNA+6cE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bfPHT3TcnAb1pLPjcp89hrseMpou9Ba0Ql4DtILmwjsVDh9I8NLD9G1nXe6+/jzlyuL4wOQOA26VoGME0NIlSND7IviRlZLfe0dws78syPKqqUiAKRabrFcJqwF6Nyfowzx+xLgxqI4vx30wpCT3SqFu1bSpVLGEllrKomj8Ot8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b=G6A1A9CS; arc=pass smtp.client-ip=185.203.200.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b="G6A1A9CS" Received: from [127.0.1.1] (unknown [IPv6:2a02:560:5dd5:4b00:9ebf:dff:fe00:fdb5]) (Authenticated sender: sha@pengutronix.de) by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id 9EB81201A8D; Wed, 23 Sep 2026 15:44:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171095; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gzqi4eMOsIxYxypilO5M4GqTbX/Tk4lvEkSYHODftBU=; b=G6A1A9CSvqb9gOrICIw3EgCRXVZisfi9OQS2F+alTFwYXC1OwnQ+4+IZKl+WkYWqjvfGfI QuO5XymhspjCW3U6gaNm15UWd2Dv/MsgZkF8CxFOn4+mIyCP5zf5fsf2mUQ8Ofz+7JlJ6k h2X+PI3aFR2mJuwdKoxXevNT2W7wY0ByYzDsolRm3899h9wFM1jN3oQQ0QYrMWKnE0oMxK DmMYwLPIpHYHhHsided9nR/ubBzPL6cYv3D1WMRA3NfrkwrSH+WILRnrrFHW6XxH/5C0gT 1S4fdWcpIGisConT79oNoSxpnsG0jOuW2s+x7RcPshvOMfDND+AMjq9xCqRmDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171095; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gzqi4eMOsIxYxypilO5M4GqTbX/Tk4lvEkSYHODftBU=; b=CcsRGgmOw+JfHuF8956B/deSJGGKl4vZG3BrIC3pfbFWgKga8Wh4sFN6sAZxT0nk4RqojT /xy27JIpPqKSQ9ER6vDg1K5aUuVugVA1dcmal80utsqV74QqksH07nnql9HL7fZLkIe/fp PF5HHP4CsJsX+MKeJ/7QvKWXxUlRJfDD8rS80TuzxLdg3eLvWwlVXPJET5MmjykwANnA2V 3CGWIIbhFBmkdfoiY3oqN6Z3ZuvM/Pzno4/NqV97B2a9EL/kbmGdO97pMdcQLm1wbwCQmp 32Bjj3pcAVQxRv2l1El3eqJdWBCqkFZ7V6DJUAuSOQCoWkSVJ94gSd1gBtv8BA== ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1790171095; a=rsa-sha256; cv=none; b=bFh0HlIgvfb36rPgUTCTdBniHwwq7oOTIxYGHgCiCCtuayZpCgwFW4F0Sg6PEnQthBuSm1 Ivv2d0Hc6Ubah6pGzLwP1Zp6S7SmkaB2U5l++NFNCgpqrsdgRFjk+fjtGGuJHRejhC6xoN ASPDKP27svRNlyNbdL9sqrNeprCTISqJf6JtjCqU0t00hE651CsoqrmhM++vGUql14z093 1rrlphx+sLd+uaZuGn0Cn0pYUwgrM8DOXtrfspfjgDjUNANdPj2rnZ7sHXQIqxA5NIxcvo qVM70kOLoBuVAgJwrTkrTCRNuSq5LGXP67ZenTm4aqDLzIqOejswSLukiFyGcg== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=sha@pengutronix.de smtp.mailfrom=s.hauer@pengutronix.de From: Sascha Hauer Date: Wed, 23 Sep 2026 15:44:40 +0200 Subject: [PATCH 1/9] media: synopsys: hdmirx: add media device infrastructure 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 Message-Id: <20260923-hdmirx-media-v1-1-ea3d77d4a5f3@pengutronix.de> References: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> In-Reply-To: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> To: Dmitry Osipenko , Mauro Carvalho Chehab , Hans Verkuil , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Gerald Loacker , Lucas Sinn , linux-media@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com, linux-kernel@vger.kernel.org, Sascha Hauer X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790171091; l=2335; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=NuNNgUFsC9RW7kHtNJHPpvTxgDs+TKGIHfD/QjqPBAI=; b=ajsNJlG+Oe6pNJYyp8H3gdCpveJD4oPo9+kX+oyzT56d7I1P6UP3LfkuPQCuB6wQvv2esgPYH M4q6o3sUIRJDBiZeKYtIV22X/dUWT/O0mLdZcVtcTaLcD5l/SCNqZe3 X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= From: Gerald Loacker Initialize the media device to enable integration with HDMI bridge devices in the video capture pipeline. This provides the foundation for representing the hardware topology through the media controller framework. Signed-off-by: Gerald Loacker Signed-off-by: Sascha Hauer --- drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers= /media/platform/synopsys/hdmirx/snps_hdmirx.c index 25f8ca0d6d946..f51a1619b71ec 100644 --- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c @@ -31,6 +31,7 @@ #include =20 #include +#include #include #include #include @@ -123,6 +124,7 @@ struct snps_hdmirx_dev { struct device *dev; struct hdmirx_stream stream; struct v4l2_device v4l2_dev; + struct media_device mdev; struct v4l2_ctrl_handler hdl; struct v4l2_ctrl *detect_tx_5v_ctrl; struct v4l2_ctrl *rgb_range; @@ -2742,6 +2744,11 @@ static int hdmirx_probe(struct platform_device *pdev) goto err_hdl; } =20 + hdmirx_dev->mdev.dev =3D dev; + strscpy(hdmirx_dev->mdev.model, "snps-hdmirx", sizeof(hdmirx_dev->mdev.mo= del)); + media_device_init(&hdmirx_dev->mdev); + hdmirx_dev->v4l2_dev.mdev =3D &hdmirx_dev->mdev; + stream =3D &hdmirx_dev->stream; stream->hdmirx_dev =3D hdmirx_dev; ret =3D hdmirx_register_stream_vdev(stream); @@ -2771,6 +2778,7 @@ static int hdmirx_probe(struct platform_device *pdev) vb2_video_unregister_device(&hdmirx_dev->stream.vdev); err_unreg_v4l2_dev: v4l2_device_unregister(&hdmirx_dev->v4l2_dev); + media_device_cleanup(&hdmirx_dev->mdev); err_hdl: v4l2_ctrl_handler_free(&hdmirx_dev->hdl); err_pm: @@ -2794,6 +2802,7 @@ static void hdmirx_remove(struct platform_device *pde= v) vb2_video_unregister_device(&hdmirx_dev->stream.vdev); v4l2_ctrl_handler_free(&hdmirx_dev->hdl); v4l2_device_unregister(&hdmirx_dev->v4l2_dev); + media_device_cleanup(&hdmirx_dev->mdev); =20 /* touched by hdmirx_disable()->hdmirx_plugout() */ hdmirx_dev->rgb_range =3D NULL; --=20 2.47.3 From nobody Thu Sep 24 12:55:35 2026 Received: from mx1.white.stw.pengutronix.de (mx1.white.stw.pengutronix.de [185.203.200.13]) (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 EAB3C531617; Wed, 23 Sep 2026 13:45:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=185.203.200.13 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171108; cv=pass; b=PHVS1g62oB5Q8arIUzh0Jh5khPeck4KVRcDVwgdsoruHdBUod2wJllzPnzmEF50I7QSdzVzr79zkuWSFhRkK8lHyuHwpr6FFsqAkIFnA6BrUoY/qhyR8OHntKso8RdKWcnGvXFO9OJed+ofbAK966SPhpk0lRoHg6bBy4Pc/c28= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171108; c=relaxed/simple; bh=ycs4ObMprK4flWOLIWr10LTMNjPTG7lkKT5OYTwxHBw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i+6BciGI3OsFuaF4vKy8+0jGM9XUTFtW9AIgGyffLQt4PdCteUcjDhe49VITrSObmq+adKTGolF12MgVzLib6rRx1CTnUYz2aLO+RWp3oAHf0/nUpDSMsSs5ggxqRf40GO9+WDByXV4eDvkQqGUocQTf412MIKZXx8lrf9lSQyc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b=Y6QbGfZ2; arc=pass smtp.client-ip=185.203.200.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b="Y6QbGfZ2" Received: from [127.0.1.1] (unknown [IPv6:2a02:560:5dd5:4b00:9ebf:dff:fe00:fdb5]) (Authenticated sender: sha@pengutronix.de) by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id E236F201FAF; Wed, 23 Sep 2026 15:44:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UBEDDu/J1MDr9WOvSIGGAqAjcW5uhUos4+n3DxvZsBo=; b=Y6QbGfZ2BYhLG8n0vv9pjRqF7062pwVJWPzXtw5hEWhule3EglM6oTBYfWhbkWL2FmYCCR bsgft+rhnxyJyCZCRYu0QtkQfVGZwtq78yn+DVQNII32sAHwuBSPEGZvva1zLAXqMWKAq+ 56rbXqTKcbCX0701VS6MX+/tV5e6D3CIIX0EEKrhIIqj2UVsTqGLEHsZtT9XFeIFRXxwE5 e3eJbb8Vh4JRyOZprRFvPhpQjTmNpfCoTIqjD/AiQxoK2MdaZFyRoceNznMWfVWTGHVM27 6A9Nj98cPfXXhn7r8r3Db5WwnAlYEle48Xjvc3KdWwnIsAa1TvRzC+GiUMELHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UBEDDu/J1MDr9WOvSIGGAqAjcW5uhUos4+n3DxvZsBo=; b=GqvSv4DXNYpzItyz7G/onRbavf7Wc/aOVh2pjAFxGQ+Kjr76oPaYpV1HnyXMqgpYWcPi07 qw3rr7TnCM7ce1DMxzB0aozvanWtvUn7PgPK10ZSYW9jGOZdx4KprrvPRj0U1ci1tl77lJ 90Yih3htvijT55MmJBJPyq/b3pLLCZvMEvyFaqQT8jqo3577esLYrAORhJSq5Fy+woeAsC H+/7U7O9V23bGuXWcs6KhC/z8SipClKOBGsknvTTvadLK+A2JLxPmo6/cYCv66ujw3gsVA QurtCbxefFk6TqjFOd88tuv61wcjhNijsjD1kKPMmsNpnnZa9z38jOPsM/1qLA== ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1790171099; a=rsa-sha256; cv=none; b=I71QDvMZNRpxUiBzze4WXXqI+7VJmHpQcMvijqc+73ecMo/Hw+/sCPcPYoRIsEej2s0aN9 jrJcElPxOLjxSvOssQtyC4lXbAzw/U78GmdH79AORzz9wH0fPYIJnE3W81lH8a4J7o2ewQ 7FjQxGd64wNP7wpxy1CQD4wBQJlxlPpQaO8eKpbjXv8hSwrwIil75bvLs+RWVFIT3o9V1K iCuP2exZqD+5FpzsC6xKH9aQIGEuvkYEAGWri4Pwb+6t/fjUWlkGO0M9OvpEwn2wDGhaW0 ZnmFT03I83N/qmBuBFOPfn1MCHRRqadER1Uu4zQx19QmJPWrMB66HZ+cQoYPDg== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=sha@pengutronix.de smtp.mailfrom=s.hauer@pengutronix.de From: Sascha Hauer Date: Wed, 23 Sep 2026 15:44:41 +0200 Subject: [PATCH 2/9] media: synopsys: hdmirx: add media entity for video capture device 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 Message-Id: <20260923-hdmirx-media-v1-2-ea3d77d4a5f3@pengutronix.de> References: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> In-Reply-To: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> To: Dmitry Osipenko , Mauro Carvalho Chehab , Hans Verkuil , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Gerald Loacker , Lucas Sinn , linux-media@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com, linux-kernel@vger.kernel.org, Sascha Hauer X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790171091; l=3301; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=E5oEDquafxhjhoyW8XKX219aNRI+JsAYY0MoDfrT+1M=; b=Hq9D9sl+jp1d69FjvGE+J3uwz8pQkRjW3JXjpak7EF8MS8bJlFmI/Ky25IfrlI+bRGZlQ2Evr g7diPPtFD5kCG51hRi+DPRMWVZz4P0HEFXEXwJvokAKwaQVOo2VJlwc X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= From: Gerald Loacker Register the video device as a media entity with a sink pad to integrate it into the media controller topology. This allows the capture device to be properly represented in the media graph and enables userspace to discover the device capabilities through the MC API. The sink pad indicates that this entity receives data (HDMI video stream) which is then made available through the V4L2 video capture interface. Initialize the pad before registering the video device. The previous patch gave v4l2_dev an mdev, so video_register_device() already registers the entity, and doing it the other way round would hand media_device_register_entity() an entity with no pads yet. Signed-off-by: Gerald Loacker Signed-off-by: Sascha Hauer --- .../media/platform/synopsys/hdmirx/snps_hdmirx.c | 26 ++++++++++++++++++= ++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers= /media/platform/synopsys/hdmirx/snps_hdmirx.c index f51a1619b71ec..11a9b16586a57 100644 --- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c @@ -125,6 +125,7 @@ struct snps_hdmirx_dev { struct hdmirx_stream stream; struct v4l2_device v4l2_dev; struct media_device mdev; + struct media_pad pad; struct v4l2_ctrl_handler hdl; struct v4l2_ctrl *detect_tx_5v_ctrl; struct v4l2_ctrl *rgb_range; @@ -2751,15 +2752,29 @@ static int hdmirx_probe(struct platform_device *pde= v) =20 stream =3D &hdmirx_dev->stream; stream->hdmirx_dev =3D hdmirx_dev; + + hdmirx_dev->pad.flags =3D MEDIA_PAD_FL_SINK; + ret =3D media_entity_pads_init(&stream->vdev.entity, 1, &hdmirx_dev->pad); + if (ret) { + dev_err_probe(dev, ret, "media entity pads initialization failed\n"); + goto err_unreg_v4l2_dev; + } + ret =3D hdmirx_register_stream_vdev(stream); if (ret < 0) { dev_err_probe(dev, ret, "video device registration failed\n"); - goto err_unreg_v4l2_dev; + goto err_cleanup_entity; + } + + ret =3D media_device_register(&hdmirx_dev->mdev); + if (ret) { + dev_err_probe(dev, ret, "media device registration failed\n"); + goto err_unreg_video_dev; } =20 ret =3D hdmirx_register_cec(hdmirx_dev, pdev); if (ret) - goto err_unreg_video_dev; + goto err_unreg_media; =20 hdmirx_load_default_edid(hdmirx_dev); =20 @@ -2774,8 +2789,12 @@ static int hdmirx_probe(struct platform_device *pdev) =20 return 0; =20 +err_unreg_media: + media_device_unregister(&hdmirx_dev->mdev); err_unreg_video_dev: vb2_video_unregister_device(&hdmirx_dev->stream.vdev); +err_cleanup_entity: + media_entity_cleanup(&hdmirx_dev->stream.vdev.entity); err_unreg_v4l2_dev: v4l2_device_unregister(&hdmirx_dev->v4l2_dev); media_device_cleanup(&hdmirx_dev->mdev); @@ -2799,7 +2818,10 @@ static void hdmirx_remove(struct platform_device *pd= ev) =20 hdmirx_disable_irq(dev); =20 + media_device_unregister(&hdmirx_dev->mdev); + vb2_video_unregister_device(&hdmirx_dev->stream.vdev); + media_entity_cleanup(&hdmirx_dev->stream.vdev.entity); v4l2_ctrl_handler_free(&hdmirx_dev->hdl); v4l2_device_unregister(&hdmirx_dev->v4l2_dev); media_device_cleanup(&hdmirx_dev->mdev); --=20 2.47.3 From nobody Thu Sep 24 12:55:35 2026 Received: from mx1.white.stw.pengutronix.de (mx1.white.stw.pengutronix.de [185.203.200.13]) (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 A35725349C0; Wed, 23 Sep 2026 13:45:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=185.203.200.13 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171111; cv=pass; b=C7uqPysJ4SB4onR36QFfmFxoBOGby00MfFS53M+csIf0/pR6qnvxTW3Lccgwk2b+dBE/6gYqClAvogjSdUHvG3RhCqSYENaUq16jzl/mDNCt8L0U/8H2qo4+VMclotzlf/tXfGSf9ChtaLHzhSeHCYT8Tdc1ohIwr51HDNpkD70= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171111; c=relaxed/simple; bh=xWlfN9+GhrAH5fBlIOLGlxYKkOs7XRP/KRcvv+/TXdg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UgnU9I72Z6d03w64brWU3V4RXQ/ypKcp1a8sd2mrKYzuZ5vbkTvbp+iAeLbVpRh6ztBSYznzUH2jof84z9YGXJ4+aA19JQzDzlQnvxoSjvYqloj+GvJ+MOLL6ZAKhAyqXorhmUku3CIErMNb0EkORjD8lfVktJAPchVGewSdxNA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b=Mc0PQ002; arc=pass smtp.client-ip=185.203.200.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b="Mc0PQ002" Received: from [127.0.1.1] (unknown [IPv6:2a02:560:5dd5:4b00:9ebf:dff:fe00:fdb5]) (Authenticated sender: sha@pengutronix.de) by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id 1D970201F09; Wed, 23 Sep 2026 15:45:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZSEXIAd3qXxHLdXQzZDZh0D3NtCVTAxo16HvIUyaOuU=; b=Mc0PQ002vtU3xjhdWWW6GbU5vg5Ea42q1KvKuZ6DaOMRM6XNX1KY1yz7tXgshXQoOir1r0 Wd1G/zYvcg8iTMiix/UR0be1BhToBiaQw3GZuoiWTNLGpyeCXntnTGTJ9xRdB1sevWRf+q Xni+GdZENqCD6rjUIpIfpvxxtTv+N8Zy0eA48/Tax5OOBUvNVa+wiIvCiY2Reyd0tJYsW/ Qf7vsARhBcYjd4L/AQ3bhvFFGOHMTTmvCZW1ZF4VBupFrWYih7QsQ3hXn3k7PpCHZxqVHn XswAj3bj4nylqQS5QFCQoyQXQiYGGmcsycEpkDg8PlmPrTOwzLOsO2LJV4PkvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZSEXIAd3qXxHLdXQzZDZh0D3NtCVTAxo16HvIUyaOuU=; b=dnSV5HEaRC70bpXVNUXKDtKuuxg2aFQ8GfL8EigWj2JHn8vaE4QCJmvtU0tThZ25Nt+bEq 0rcA8g/rkoO2RitaRTyyII4HY0/zccSqZNVcq/A1IwwnLibglanB5RD22m5vdnURO/G58p j0YIotKQGr9B7r3Ehav8uuVcVGFeNpRKenTHmppz7SHLgjNq7tFfB6BkHBohxGRgt/Dizn yYHjF092/cs2N3W4h8gbTfG5wr3JMERpZtD36sYkPqZyi6q7wQ3mTc12e9Tgrxm0RHqpUK iuAk/YoXbqQfdCdQadPnY/KjHsdCINdSaQq0PhNpDvQOES8IP/JXoDkNE3XZcg== ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1790171104; a=rsa-sha256; cv=none; b=TqiO1kafYOz8E/JaJeFSYia3HZ5dkVfqaMJcUkQKQh3kHyi6HJ5f0xSTbj6KEDgz6upQ2p Vdc8npmq5ugClbZmmQcvoGH0hqsu1kdP1EAvQjVrC9CXx0LewFbn23SG5z7ixztCFXwOGg 5O+5FdBghzJf0j44QPsJndICOACHcNZDkK/Smmn99J+hpFq8OaZp0YSbCPERC82nErl/YN ozIwHapB/Vp7KJeVhy3peLZAYAxgzo5u3h1vnfR3RXxoTQI5QCY+9jYcQtRXRJvuLB/jt5 Ml8PfPMNLsOa02plPOBcT67FZnMJnptsY4f8AVMYPDBgrlXZbVqq8H9UJrnfBA== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=sha@pengutronix.de smtp.mailfrom=s.hauer@pengutronix.de From: Sascha Hauer Date: Wed, 23 Sep 2026 15:44:42 +0200 Subject: [PATCH 3/9] dt-bindings: media: snps,dw-hdmi-rx: add the source port 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 Message-Id: <20260923-hdmirx-media-v1-3-ea3d77d4a5f3@pengutronix.de> References: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> In-Reply-To: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> To: Dmitry Osipenko , Mauro Carvalho Chehab , Hans Verkuil , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Gerald Loacker , Lucas Sinn , linux-media@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com, linux-kernel@vger.kernel.org, Sascha Hauer X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790171091; l=1367; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=xWlfN9+GhrAH5fBlIOLGlxYKkOs7XRP/KRcvv+/TXdg=; b=xh6g3YoiPyFajwKr69TSbaiAxdYaJdAsgY3VWGKF3wUZkI+KBB+isn5xj4CUeetURwCUouYY+ utTnedKToH6B9zXRppYi1KpYgtGLNfZj1m/X244jeuUUDr4FBLF/BSj X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= Describe the OF graph port connecting the receiver to an HDMI bridge in front of it. Boards that wire the HDMI connector straight to the receiver leave it out, so it is not required. The schema sets additionalProperties: false, so without this a device tree carrying the endpoint does not validate at all. Assisted-by: Claude:claude-opus-5 Signed-off-by: Sascha Hauer --- Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml b= /Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml index b7f6c87d0e06a..7e66dcbdfe2cb 100644 --- a/Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml +++ b/Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml @@ -66,6 +66,14 @@ properties: description: GPIO specifier for HPD. maxItems: 1 =20 + port: + $ref: /schemas/graph.yaml#/properties/port + description: + Connection to the HDMI source. Present when an HDMI bridge sits in + front of this receiver instead of the connector being wired straight + to it. The bridge is bound as a v4l2 subdevice and appears in the + media graph. + rockchip,grf: $ref: /schemas/types.yaml#/definitions/phandle description: --=20 2.47.3 From nobody Thu Sep 24 12:55:35 2026 Received: from mx1.white.stw.pengutronix.de (mx1.white.stw.pengutronix.de [185.203.200.13]) (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 96B7D535FDC; Wed, 23 Sep 2026 13:45:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=185.203.200.13 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171117; cv=pass; b=u6mdIbEa7/os6nKrWlWj1WTQqimTvwb11PEDYgMaIrGv7udd+dRnX+eBBa+JbBiS+feR2WGnMlA+Fr9U5+yNLX33a7Pl7+z29wapXWPIyGdYIAPM5Aar1CjkC3slbY22zXxtrd78qzNYwMilKc3JgSe/UD/1ujCu1LRYEhuSDx0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171117; c=relaxed/simple; bh=3/Yk0Yvw1kD2F8JSuLxcnx8LcODhfHcMWRkLVvwM4lA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e6Byk+MKeH2WSCfmf6fr3/b8JXx9IZKQt0xrMkNmvhMZQ5Yk1BSCo3iEXldreKdQmkYxQ0Aeq7f0tlKp+jatUFACarw0tzw20TXorj7GwLXDUyVj6kEAKEzfe0xFWL+WY/KA2XOv7qg25xs3PETEWPiPCfiyGUGvwLvMR99ZIaw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b=IEBrTs/7; arc=pass smtp.client-ip=185.203.200.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b="IEBrTs/7" Received: from [127.0.1.1] (unknown [IPv6:2a02:560:5dd5:4b00:9ebf:dff:fe00:fdb5]) (Authenticated sender: sha@pengutronix.de) by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id 52658202010; Wed, 23 Sep 2026 15:45:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z3qCfW4yaGS96w7Isp0+c1VOVZi43ecJ2SNcm1JwpHU=; b=IEBrTs/7cWjIvQf/u7Dmy9e/ddd6eHW6Z8EuVjtwclCTW9dfdtpgETkC+RnfErc8RQR3JD kAANjiLn3JFyO5clPlWyeRKQARuIA4TToi+ahJ8RYgrkaZv+uBpLkcUdpsyPY7gdIqdDc7 KwHxRbIpwYsd7q5YDdE31FBfBAknSYYBYUM9U8Tt7MjDL8ZAXznhsyNuwU3OK5TrGYhQsD k2Z5ezqiZDaYhRYD9DMjgU0kLy//Fjp/Aow3sNlX+yPn4nXeKECXIPTBJT4deix+/I38tk /sISKaaXgIy1ZRRO2CvTd5NboRPbN/eYuGwT32cvAwWf7hy/u6zw57HJsnv2GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z3qCfW4yaGS96w7Isp0+c1VOVZi43ecJ2SNcm1JwpHU=; b=ZCdunkIPUQ5BA/NhpGUYQpmcPZwNOkpz0CglSIvcFUv/wuPuxzjOcz0+lKeNmla8zUNFPD rcYpltcu77+16B8RSaEVOSo+zUOcWKqSEXuTBTVVdO3yK+IwvHrvPu90hbp2M8OSD78O8P p3fjmQeE1AuzNbYg9nH6LKeVqpNC6gVIqNxE2Qwr0Hta6cwfyzrxXksiKnpL8p2OLafCDh HpD3YfTLJmfL+UrnC2U5m9iJB5meZRj6G9oBvS88ZiGreVtKHS6WeCpbZizf8WFFTf6Y0c yFANLEM6nBUFdz0Yzk1fUqlWOOxmUp+4fkQBlwENcs9XARq6niT2ShGTMAoY/g== ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1790171108; a=rsa-sha256; cv=none; b=Fj1N746t4ktuQ3EdN7p2XjovzS8wotN4NRmqk6ghZZ73uCYr5/QD7Lp1M3ZXk7ikLU6AB8 PWyv354LCkTD4a3SnOVadcfE+1QibmCyKpbH+fCgabFfRJt0zIMulfZoWb7AbJfCjgKGFb Zw9NrryTCLnjGoaIrKIWnXQ52omkBI+Av5G5m99bXC/CicMgHSMSA9GcApCgmaN3+F3KZO vAMVvRX+6thtDSVE5mz44Hvo24u0ar6AwbdLdtkzGj5FOmfb6IFN6Emglr+pLvzkYnxw2k wUkgIdavsPUssFUr94zOmpnn/vbAdGqsujvoTnCo5FzOI8oCTcILOmFssyO6QQ== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=sha@pengutronix.de smtp.mailfrom=s.hauer@pengutronix.de From: Sascha Hauer Date: Wed, 23 Sep 2026 15:44:43 +0200 Subject: [PATCH 4/9] media: synopsys: hdmirx: add async subdevice support 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 Message-Id: <20260923-hdmirx-media-v1-4-ea3d77d4a5f3@pengutronix.de> References: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> In-Reply-To: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> To: Dmitry Osipenko , Mauro Carvalho Chehab , Hans Verkuil , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Gerald Loacker , Lucas Sinn , linux-media@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com, linux-kernel@vger.kernel.org, Sascha Hauer X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790171091; l=7244; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=OyIEVhnDZ8GHZi5qTTgJsl1zRHQjOzpPwi0JDuiy5QQ=; b=rO3jUqaZr/KwPpnvBqGiKfWBfaYmRBBlXnKpybbTdLYfkUxPy+vOj/Z7eZ/1qvEy2jjB3RiHK poEsZ003tZKBUXzOAlBoVNNFKFjeA9qzVG2OdUQcblLSwGsEOooGk0S X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= From: Gerald Loacker Add V4L2 async notifier support to enable dynamic binding of connected subdevices in the video pipeline. The driver parses device-tree endpoints to discover and register video bridge subdevices. When a subdevice is bound, a media link is created between its output pad and the HDMI RX sink pad. Subdevice nodes are registered once binding completes, making them accessible from userspace. If no endpoint is defined in the device tree, the driver operates in standalone mode and registers its subdevice nodes directly, maintaining backward compatibility with simpler configurations. The notifier itself is unregistered on the way out whether or not a subdevice ever bound. Only v4l2_async_nf_unregister() takes the notifier off the global list, so cleaning up without it would leave an entry pointing into memory devres is about to free. Both calls are no-ops when there was no endpoint to watch. Ask the bound subdevice which of its pads faces us rather than assuming the second one. media_create_pad_link() warns and fails on an index the entity does not have, which a bridge with a single pad would hit. V4L2_ASYNC has to be selected now that the driver calls the notifier helpers. v4l2-async.h has no stubs for them, and nothing else the driver already selects pulls the symbol in. Signed-off-by: Gerald Loacker Signed-off-by: Sascha Hauer --- drivers/media/platform/synopsys/hdmirx/Kconfig | 1 + .../media/platform/synopsys/hdmirx/snps_hdmirx.c | 90 ++++++++++++++++++= +++- 2 files changed, 90 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/synopsys/hdmirx/Kconfig b/drivers/media= /platform/synopsys/hdmirx/Kconfig index 4321f985f6320..598c303eba8d0 100644 --- a/drivers/media/platform/synopsys/hdmirx/Kconfig +++ b/drivers/media/platform/synopsys/hdmirx/Kconfig @@ -5,6 +5,7 @@ config VIDEO_SYNOPSYS_HDMIRX depends on ARCH_ROCKCHIP || COMPILE_TEST depends on VIDEO_DEV select MEDIA_CONTROLLER + select V4L2_ASYNC select VIDEO_V4L2_SUBDEV_API select VIDEOBUF2_DMA_CONTIG select CEC_CORE diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers= /media/platform/synopsys/hdmirx/snps_hdmirx.c index 11a9b16586a57..0c7cac25bf694 100644 --- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -32,12 +33,14 @@ =20 #include #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -126,6 +129,7 @@ struct snps_hdmirx_dev { struct v4l2_device v4l2_dev; struct media_device mdev; struct media_pad pad; + struct v4l2_async_notifier notifier; struct v4l2_ctrl_handler hdl; struct v4l2_ctrl *detect_tx_5v_ctrl; struct v4l2_ctrl *rgb_range; @@ -2649,6 +2653,48 @@ static int hdmirx_register_cec(struct snps_hdmirx_de= v *hdmirx_dev, return 0; } =20 +static int hdmirx_fwnode_bound(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *subdev, + struct v4l2_async_connection *asc) +{ + struct snps_hdmirx_dev *hdmirx_dev =3D + container_of(notifier, struct snps_hdmirx_dev, notifier); + int source_pad; + int ret; + + source_pad =3D media_entity_get_fwnode_pad(&subdev->entity, + asc->match.fwnode, + MEDIA_PAD_FL_SOURCE); + if (source_pad < 0) { + dev_err(hdmirx_dev->dev, "%s has no source pad for %pfw: %d\n", + subdev->name, asc->match.fwnode, source_pad); + return source_pad; + } + + ret =3D media_create_pad_link(&subdev->entity, source_pad, + &hdmirx_dev->stream.vdev.entity, 0, + MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE); + if (ret) { + dev_err(hdmirx_dev->dev, "Failed to create media link: %d\n", ret); + return ret; + } + + return 0; +} + +static int hdmirx_fwnode_complete(struct v4l2_async_notifier *notifier) +{ + struct snps_hdmirx_dev *hdmirx_dev =3D + container_of(notifier, struct snps_hdmirx_dev, notifier); + + return v4l2_device_register_subdev_nodes(&hdmirx_dev->v4l2_dev); +} + +static const struct v4l2_async_notifier_operations hdmirx_async_ops =3D { + .bound =3D hdmirx_fwnode_bound, + .complete =3D hdmirx_fwnode_complete, +}; + static int hdmirx_probe(struct platform_device *pdev) { struct snps_hdmirx_dev *hdmirx_dev; @@ -2656,6 +2702,8 @@ static int hdmirx_probe(struct platform_device *pdev) struct v4l2_ctrl_handler *hdl; struct hdmirx_stream *stream; struct v4l2_device *v4l2_dev; + struct device_node *ep_node; + struct v4l2_async_connection *asc; int ret; =20 hdmirx_dev =3D devm_kzalloc(dev, sizeof(*hdmirx_dev), GFP_KERNEL); @@ -2772,9 +2820,38 @@ static int hdmirx_probe(struct platform_device *pdev) goto err_unreg_video_dev; } =20 + ep_node =3D of_graph_get_endpoint_by_regs(dev->of_node, 0, -1); + if (ep_node) { + v4l2_async_nf_init(&hdmirx_dev->notifier, &hdmirx_dev->v4l2_dev); + hdmirx_dev->notifier.ops =3D &hdmirx_async_ops; + + asc =3D v4l2_async_nf_add_fwnode_remote(&hdmirx_dev->notifier, + of_fwnode_handle(ep_node), + struct v4l2_async_connection); + of_node_put(ep_node); + + if (IS_ERR(asc)) { + ret =3D PTR_ERR(asc); + dev_err_probe(dev, ret, "Failed to add remote fwnode\n"); + goto err_unreg_media; + } + + ret =3D v4l2_async_nf_register(&hdmirx_dev->notifier); + if (ret) { + dev_err_probe(dev, ret, "Failed to register async notifier\n"); + goto err_cleanup_notifier; + } + } else { + ret =3D v4l2_device_register_subdev_nodes(&hdmirx_dev->v4l2_dev); + if (ret) { + dev_err_probe(dev, ret, "Failed to register subdev nodes\n"); + goto err_unreg_media; + } + } + ret =3D hdmirx_register_cec(hdmirx_dev, pdev); if (ret) - goto err_unreg_media; + goto err_unreg_notifier; =20 hdmirx_load_default_edid(hdmirx_dev); =20 @@ -2789,6 +2866,10 @@ static int hdmirx_probe(struct platform_device *pdev) =20 return 0; =20 +err_unreg_notifier: + v4l2_async_nf_unregister(&hdmirx_dev->notifier); +err_cleanup_notifier: + v4l2_async_nf_cleanup(&hdmirx_dev->notifier); err_unreg_media: media_device_unregister(&hdmirx_dev->mdev); err_unreg_video_dev: @@ -2818,6 +2899,13 @@ static void hdmirx_remove(struct platform_device *pd= ev) =20 hdmirx_disable_irq(dev); =20 + /* + * Both are no-ops when there was no endpoint to watch: the notifier is + * zeroed and neither v4l2_dev nor waiting_list is set. + */ + v4l2_async_nf_unregister(&hdmirx_dev->notifier); + v4l2_async_nf_cleanup(&hdmirx_dev->notifier); + media_device_unregister(&hdmirx_dev->mdev); =20 vb2_video_unregister_device(&hdmirx_dev->stream.vdev); --=20 2.47.3 From nobody Thu Sep 24 12:55:35 2026 Received: from mx1.white.stw.pengutronix.de (mx1.white.stw.pengutronix.de [185.203.200.13]) (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 917DD5326BE; Wed, 23 Sep 2026 13:45:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=185.203.200.13 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171120; cv=pass; b=btd6RN9OsxIQLgi6BlfI+CUrL2Rc0q/juUpt+tIcP71UFJhOt9PLI1dDZkQmBISJLm6kTjVeye/d6yK6Q0TRS5IGwhmrRo+kgGIG61Q0RaRJ/UV3uKUSc8h3910irD/JaddiMoBNO2CmPX0vf5X7zV0s4wykwXjpUujeVCJCbSo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171120; c=relaxed/simple; bh=4kWiazAr75BVDRtz1SnxWmp8mUluqiTz7KuBffGL3OI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oMo24J4aSYKUR8ICaW9xXOoGc2td0KWCn6SacMgg6M66a2HKwPM6MRTLOb9IAqs8pa3qTxIAqKQrMCW2Kxp6W5ETy6j6qcCva7oMuMzUQK1hdj5YQbUc2wzLk2Qrg/ye2X+IJCSddF3Qdv2/quwmQiBL7t+n6mqptUzQDuKxA8s= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b=SUPAd0Pu; arc=pass smtp.client-ip=185.203.200.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b="SUPAd0Pu" Received: from [127.0.1.1] (unknown [IPv6:2a02:560:5dd5:4b00:9ebf:dff:fe00:fdb5]) (Authenticated sender: sha@pengutronix.de) by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id 87083201A8D; Wed, 23 Sep 2026 15:45:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171112; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wIDtAWSuo3acxuuYHq+f4Byw1UkvfAjrADlZkEtCpiU=; b=SUPAd0PuEPQ90/PdDCn7FOfqfEiZURbjEazLgwHBa4vAfLIZHtrP7t7BdkFDomeOo9zh5P Om2RP9bHYFuqM5WmZJz0aQuy+Mv5pCn2o5aqdUOTNdZ530rJWmqrgK5GqTR4gBHk0LTVrF r/mfnJSG5ujBqx5+5rEE+DmDiZlgqH4URfbNRQngFWUFMfpbK5i0Zn6WWimhmNflJaJ/gi xulcTVbYZ/CCOJGMbr+3JEDpFQ/JXug3LbFSKD1b1ARA1H0/VbS2tK/uQpQX5S3SU4Qqnw QrREZWlcqELoswpc9eRSkx96xlxi8XiLNO0JHf4DVe5Ic7Z/6nry0H25edXtSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171112; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wIDtAWSuo3acxuuYHq+f4Byw1UkvfAjrADlZkEtCpiU=; b=D9DWJemIv9SJJCArDUzGBUc6irYjj0huNqQF5ad72le920hYO17WDhf8YgKxSARvY5/e6z 4LOQlT0TvY+j9f9Mk2NuIEiF3QPFL0Z7/SyQu0nFR7LR3pk9oYmWQejCFZE7knJ2nt05xQ 2iG0IloPpuIEeqnWHjsAkYkNYEgIPnftp8WAj+g9eZOlbK6GD6njY0OtHhtzsNMEL06VmX 1HxwGZuCd9qD64AUHyfei/xsoaVMPH7B1N/9snhVOy7vY0FA7ES5MLZ3HOyZFzWYfeIwxt BXIXV9aWZSiQ7vFgzuFAAXgfh3kBv2Kvb0Ir6ijiMQQvmLFclwGUVQO964W0zA== ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1790171112; a=rsa-sha256; cv=none; b=G+8+3Y75/gktW4wAkfZBTIFPERsM7exbR9e5IqjnoDd8VQXvvSxeOKAHAWyfxgAgAgmV7m 3aw2OHQyb4FmpmDMcAMBKNdA+tbY98yhT9exn3oHcG1lzUPq/8aFUqSm390IeV7ocyb1bZ kRQg/QJIDvBKF0TIcAlxZAv2Z2EmS2K0qqHFk7l+gE6O5WDgTSbM0r8vHIGu6iUVn5UGbJ YALdvB7Y6ITuhm0240f5tM9ee4trmNvw4jIyU15NgaCY1iF2zEvhBQ1v68qnu9V3aNR6T+ 0RNrJ64z/gvaqhjSIsFuqaJo1JItA6+H98dyR4EfAmA/+Si2TTh6NwGjA0r+Yw== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=sha@pengutronix.de smtp.mailfrom=s.hauer@pengutronix.de From: Sascha Hauer Date: Wed, 23 Sep 2026 15:44:44 +0200 Subject: [PATCH 5/9] media: synopsys: hdmirx: give the signal lock wait a real timeout 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 Message-Id: <20260923-hdmirx-media-v1-5-ea3d77d4a5f3@pengutronix.de> References: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> In-Reply-To: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> To: Dmitry Osipenko , Mauro Carvalho Chehab , Hans Verkuil , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Gerald Loacker , Lucas Sinn , linux-media@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com, linux-kernel@vger.kernel.org, Sascha Hauer X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790171091; l=3970; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=EdQuUrFKGXdLgynOwcCftYo1HL2jXpjohXhNm96s0fE=; b=2D/gPne5B26EmBkSiOm9E9uZsev68no2NJycZqwExqoYU6wWmZcveUCZGnBmXKYGxuScoWN+Z fLM6JyfOMFYCH0aBEWeZGuX5A5zsMd140uXM7n2X+NTmidGUTzvMy8V X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= From: Gerald Loacker hdmirx_wait_signal_lock() bounded itself by a count of 300 iterations. How long that came to depended on the debounce inside tx_5v_power_present(), which the loop calls once per iteration and which sleeps about 7ms of it, so the effective timeout was around two seconds by accident rather than by design. That accident is about to go away. A later patch in this series takes the 5V state from an upstream subdev where the board has no hpd-gpios, which leaves tx_5v_power_present() a plain read of a flag costing microseconds. The same 300 iterations would then be over in a few milliseconds and the wait would give up almost immediately. Poll on a fixed 10ms interval against an explicit three second deadline. Check the deadline after the 5V test so a disconnect is still reported as -ENOLINK rather than a timeout, and report the timeout as -ETIMEDOUT; the sole caller only tests for non-zero, so neither is a change in behaviour. Assisted-by: Claude:claude-opus-5 Signed-off-by: Gerald Loacker Signed-off-by: Sascha Hauer --- .../media/platform/synopsys/hdmirx/snps_hdmirx.c | 40 +++++++++++++++---= ---- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers= /media/platform/synopsys/hdmirx/snps_hdmirx.c index 0c7cac25bf694..8c6b04425c8a9 100644 --- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c @@ -2133,13 +2133,25 @@ static irqreturn_t hdmirx_dma_irq_handler(int irq, = void *dev_id) return IRQ_HANDLED; } =20 +/* + * Wait for the HDMI signal to lock: TMDS clock detection and ratio + * configuration, then PHY and CMU lock, then DMA lock. + * + * The wait used to be bounded by a count of 300 iterations. What that came + * to in wall clock time was decided by the debounce inside + * tx_5v_power_present(), which is called once per iteration and sleeps + * about 7ms of it, so the real timeout was an accident of how 5V happens = to + * be sensed. Poll on a fixed interval against an explicit deadline instea= d. + */ static int hdmirx_wait_signal_lock(struct snps_hdmirx_dev *hdmirx_dev) { struct v4l2_device *v4l2_dev =3D &hdmirx_dev->v4l2_dev; u32 mu_status, scdc_status, dma_st10, cmu_st; - u32 i; + unsigned long timeout; + + timeout =3D jiffies + msecs_to_jiffies(3000); =20 - for (i =3D 0; i < 300; i++) { + for (;;) { mu_status =3D hdmirx_readl(hdmirx_dev, MAINUNIT_STATUS); scdc_status =3D hdmirx_readl(hdmirx_dev, SCDC_REGBANK_STATUS3); dma_st10 =3D hdmirx_readl(hdmirx_dev, DMA_STATUS10); @@ -2153,21 +2165,25 @@ static int hdmirx_wait_signal_lock(struct snps_hdmi= rx_dev *hdmirx_dev) if (!tx_5v_power_present(hdmirx_dev)) { v4l2_dbg(1, debug, v4l2_dev, "%s: HDMI pull out, return\n", __func__); - return -1; + return -ENOLINK; } =20 - hdmirx_tmds_clk_ratio_config(hdmirx_dev); - } + if (time_after(jiffies, timeout)) { + v4l2_err(v4l2_dev, + "%s: signal not lock, tmds_clk_ratio:%d\n", + __func__, hdmirx_dev->tmds_clk_ratio); + v4l2_err(v4l2_dev, + "%s: mu_st:%#x, scdc_st:%#x, dma_st10:%#x, cmu_st:%#x\n", + __func__, mu_status, scdc_status, dma_st10, + cmu_st); + return -ETIMEDOUT; + } =20 - if (i =3D=3D 300) { - v4l2_err(v4l2_dev, "%s: signal not lock, tmds_clk_ratio:%d\n", - __func__, hdmirx_dev->tmds_clk_ratio); - v4l2_err(v4l2_dev, "%s: mu_st:%#x, scdc_st:%#x, dma_st10:%#x\n", - __func__, mu_status, scdc_status, dma_st10); - return -1; + hdmirx_tmds_clk_ratio_config(hdmirx_dev); + usleep_range(10000, 11000); } =20 - v4l2_dbg(1, debug, v4l2_dev, "%s: signal lock ok, i:%d\n", __func__, i); + v4l2_dbg(1, debug, v4l2_dev, "%s: signal lock ok\n", __func__); hdmirx_writel(hdmirx_dev, GLOBAL_SWRESET_REQUEST, DATAPATH_SWRESETREQ); =20 reinit_completion(&hdmirx_dev->avi_pkt_rcv); --=20 2.47.3 From nobody Thu Sep 24 12:55:35 2026 Received: from mx1.white.stw.pengutronix.de (mx1.white.stw.pengutronix.de [185.203.200.13]) (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 EBD0F5326CF; Wed, 23 Sep 2026 13:45:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=185.203.200.13 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171124; cv=pass; b=XThhD9jd3zSGisrFC+xhM3e6K97rBvo7K7F6yreV4xCDxEFHxZ0SUNIyOHYbu81bxGM7n7KsfqynsPHwTyvlH+i0M1XZW1dHGOgLxo3DE9gJ3WH69erg2J+p1yBdEl2eMkAAtVE34a42o/MvnPUw+ksUL1PmUIueTx5kF6SAhzw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171124; c=relaxed/simple; bh=11pf395HFPqFFVE7WIMBOBNHTy0rozSU49939RIVDm0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KJLZltETvgKpzGW4lvZZkyiMMZOMWXEWwQ1sz3uhtsyLGAeSiCsDiSPke2fWTIGmZWAG5mlz4vFt0u8AVoSkIXgpqOGa8yRuCQ6Qoz/C4UMQWAmPOcdZvXSf4KIFActDVnU9p9azTSLWoS/C7P21EJBt621IIOD3/6V4tYJtvcw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b=ELoPbdhK; arc=pass smtp.client-ip=185.203.200.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b="ELoPbdhK" Received: from [127.0.1.1] (unknown [IPv6:2a02:560:5dd5:4b00:9ebf:dff:fe00:fdb5]) (Authenticated sender: sha@pengutronix.de) by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id C2FFD201F09; Wed, 23 Sep 2026 15:45:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zIQ+kVeTFpwdQFubcs+XfNdlKKJLxXXt43xFDdw4Yyg=; b=ELoPbdhKWTaixBZyDG/dVjXNRry/+DcVm+Ap5ALKB97id2ov4tbjcMIZsW6mqrpM9TnIRg BkVfrJH0otaH+k+9ozuTfYYi/VAfQ0eJi4lsmPga7hMPabLbWXMmJKZFkQ++DlurQ4NXtv cTAw9GPBgqHuQtMrfTiOcYMdfWcB7fyPRXmSGvvg8OddzazC9NvH5lb2YS7KSaIKfwyy1G B/SzEIMluvTzItk7s8Q3uS2sGCmAzEGpIkKpP+HKPAtEuNViCxRiQ8Hjn1wCg1oGhLV7Jr zaW9fY5X7P14NQjmH8hDRNQjj+l2ivbBY2W96+++82XV8wUMhqpnI9ZnEGbUIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zIQ+kVeTFpwdQFubcs+XfNdlKKJLxXXt43xFDdw4Yyg=; b=aGV9LlbP4Li54hsdiFKHqIv/4KigqSR+V/phX6ilU4hBATu4lbYGGCResznwp66QsZz9WJ pwZpuhon9W4SK+6Elur3D9u2mK1myfoTBUdpp2RSlU+8VgyGc2AEoAxdS21uCbaJ7/eBh2 zi7/KR3ZCRcWGbnbCDOfEQSZRbrFd1YnDBqbewMm3tXQyqi79fcsd7x2GN3HQrXWh8PFKl IqfAZaLkrY9lTUpqr//i5ciUibRfaANfZ9Uab4fLVEgzW8RNJ/jXyrwXJ6Bck9wWiwnEIZ cUCVX0M91N0AL8reb9T2wag4ZY1qmaOR/1+CTbfe3OddBRCoL8fQf8M3wGBoiA== ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1790171116; a=rsa-sha256; cv=none; b=EyCSBwtQB7CVyyOQRKatfGm/nGPNki0TG6AuzZb20ybkHWP8miX95Yovgres/iBtT2uQZy US5TFSnHwh2Fpygq7I/XsNUChoeGgtpfCxRuhU2M3S2LlFV9hhMwoUeAWC6//geb4QBmBf H+zjKcgNYkyVlswGat4Hm4SJ9vXncmQXMEI5cjhMN40LNfYI+I+CB6+SceLQmnNbfTCb+U TfBexRICyDaYH0G4mdEEmcMz60ph5v5XY7wwBAPwwwx+mFantNoLXS+N0UeC8K47cTdI0S n9JwB0NDHxKHVbuyuh3ytDAdpNv0PxvfhR9AEtSYWatXTPuh1BaQ+3167tP6tg== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=sha@pengutronix.de smtp.mailfrom=s.hauer@pengutronix.de From: Sascha Hauer Date: Wed, 23 Sep 2026 15:44:45 +0200 Subject: [PATCH 6/9] dt-bindings: media: snps,dw-hdmi-rx: make hpd-gpios optional 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 Message-Id: <20260923-hdmirx-media-v1-6-ea3d77d4a5f3@pengutronix.de> References: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> In-Reply-To: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> To: Dmitry Osipenko , Mauro Carvalho Chehab , Hans Verkuil , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Gerald Loacker , Lucas Sinn , linux-media@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com, linux-kernel@vger.kernel.org, Sascha Hauer X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790171091; l=1727; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=11pf395HFPqFFVE7WIMBOBNHTy0rozSU49939RIVDm0=; b=psY9k97KirQSqUpLK3qIAY6/apFlbVLxPNsiS2wPveZUAZRtf8p9W2iHJXgZbFj0XXTOFGjTk TRtce6RdonkAZlQMX+dgCNlngHWTbK0XWNmVnAPN8oUhZLBeO1chHJE X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= hpd-gpios is the +5V line of the HDMI connector, which the source drives to announce itself. On a board whose HDMI connector belongs to a bridge placed in front of this receiver, that line goes to the bridge and there is nothing for the receiver to sense, so the property cannot be provided. Drop it from the required list and describe what it actually carries. The name is unfortunate: the hot plug detect line the receiver drives back at the source is a controller register, not this GPIO. Assisted-by: Claude:claude-opus-5 Signed-off-by: Sascha Hauer --- Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml b= /Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml index 7e66dcbdfe2cb..9c6c377417c0b 100644 --- a/Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml +++ b/Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml @@ -63,7 +63,12 @@ properties: maxItems: 1 =20 hpd-gpios: - description: GPIO specifier for HPD. + description: + The +5V line of the HDMI connector, which the source drives to annou= nce + itself. Despite the name this is an input to the receiver; the hot p= lug + detect line the receiver drives back at the source is handled inside= the + controller. Absent when the connector belongs to a bridge in front of + this receiver rather than to the receiver itself. maxItems: 1 =20 port: @@ -96,7 +101,6 @@ required: - power-domains - resets - pinctrl-0 - - hpd-gpios =20 additionalProperties: false =20 --=20 2.47.3 From nobody Thu Sep 24 12:55:35 2026 Received: from mx1.white.stw.pengutronix.de (mx1.white.stw.pengutronix.de [185.203.200.13]) (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 4C4D539891F; Wed, 23 Sep 2026 13:45:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=185.203.200.13 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171129; cv=pass; b=CR8IEgmuAEgz6BE0Yd6UqiCWSKGuyJzc4wdbCnbJCN1BlBO2TnNGkO6z5AszFum0vYPFKOmDCH4TmEx7w7nOydktvv/DMEGE5OdTiGsF+zw7UmX5Nrd9wWBlWUXgoZ725AjzIRmy5U9DOJdqmqXNJY3iRn2i8Q1OdZpTIe4tkFs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171129; c=relaxed/simple; bh=0NXDT/PVThS1RfhVU8RQ1/XF/TYPByJaVhZBJCoVd94=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VLNSlI3uweIHP776Qj6o1e4e/NZIuqCJbTTevLFhlBQzdZqNhsK9JvOJA4YWRYCd7IDuXmGKuR8ihYBjjwzmXZzHuIV1b69/WDvZ+8EtwaInN1aIW7wrM2OyEAKRPrmtkOcOi+uviKL0477mh1gyDA+ScfQDNDzrJ2/B6Ze4kpw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b=Lpjcj5+y; arc=pass smtp.client-ip=185.203.200.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b="Lpjcj5+y" Received: from [127.0.1.1] (unknown [IPv6:2a02:560:5dd5:4b00:9ebf:dff:fe00:fdb5]) (Authenticated sender: sha@pengutronix.de) by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id 06D9E201A8D; Wed, 23 Sep 2026 15:45:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fkrae6X1EJJUdBjAuftMl+vPu91AOGhn0TgUhRhTHoE=; b=Lpjcj5+ycewpw6vbOqBqDdcHvQdxgJ+QEBMtMuBUumgj3zet/kSlXz/VIycXv/8dtv2bTW KCR3iXqy2/b/aTjEGPOwbFmQNX3A1KrD7ufpAw0kwuHYFBQnAfpe0HqSBPP1LQivRgV/Bv d2jRkUHsvnOOjjwS2d69fqs6UgiT+qar2wB0W5AAtoexV9niUOUjQfucT1GgvWg4KrIrCa HOvWZt9cj9//8Qd+VyEWg2dluGOOKcx/cMnFde+4o02NK4t3mWeYUMGQLXkTo2R6W48t3I Px7IJwfoe+3sEDZM00+HCP6/cU8RtJWoqGWYQkhDJkkUGzzl6T1jbqa5/a4fDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fkrae6X1EJJUdBjAuftMl+vPu91AOGhn0TgUhRhTHoE=; b=WEoRe/X+D+DPE5rKUnpiMpfdiGA2RjdB5vSs+1fNfknrv4M+s+bMKSa51jkVytZI/pOO0Y +JLoN8zs1XNr68gwsEpSa5MPzAlh0/fn+tmBY9qH293KR2SJJfJtR1zwDSpcZJkn+yKX6S 0NP6Bu+OFGHwDrWNQK2/UvyufYIgFTvBrHdIa4ZQN3cEWKrA8Ynblei4gsLO4YJaPX5xiS +rYojQclSKTTk0QG6xLIAnhGm3y/IqNAosF85blCU6LHF6CYGg7ThP/drwpkQkoTgiRDiN ceE7Ljy6/u7Kzzhw9zwSs0ur7L+PAaq/eqrRpmZTIA+jUR7ImqdtHaViYcG+/w== ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1790171121; a=rsa-sha256; cv=none; b=aCjs3ZvZF9ziIVRKlMd3I5yPUBcXXBCKDvCvUhUyp4syOK7jO6KuF0LyAqxqzFMbyIX4xw wi8uGUX1tTIC/vHe2CV+jUhfXPamPHKXsse20LmPmcA1seOZvIxn84PmSECyqO6lxTAwCv aOqAKmieHYzW04gByfjUmklXOv8YqnmxLqF0WGRlyzqurCuMu+aWfwGWSosl7CPRhXILx6 ry0WqVNt5Ja/imYtHW1KU58+R6dip5F2SkQs4yyQFJ3x+f/kfRcfYjn4jn+qBNYPjavLGw /zVLgDqQhpsfIqAfYQOUa/XMRdLqDutBaiOThXuPJNEQeHJr6rIs7RnGIaHNUg== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=sha@pengutronix.de smtp.mailfrom=s.hauer@pengutronix.de From: Sascha Hauer Date: Wed, 23 Sep 2026 15:44:46 +0200 Subject: [PATCH 7/9] media: synopsys: hdmirx: skip the 5V detect interrupt without a GPIO 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 Message-Id: <20260923-hdmirx-media-v1-7-ea3d77d4a5f3@pengutronix.de> References: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> In-Reply-To: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> To: Dmitry Osipenko , Mauro Carvalho Chehab , Hans Verkuil , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Gerald Loacker , Lucas Sinn , linux-media@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com, linux-kernel@vger.kernel.org, Sascha Hauer X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790171091; l=3146; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=Ejsm2jAZdcyeIkAuOWtEAswQewgyA5wFh0wTnHPHsrI=; b=2KU8CgO46kMXRebT0ui03bBM3jICUHc+rQOR7ZSCG0osLA/Mz4Duni3EyxPszdYb3BHtqQpG5 k3D6i3oUD77Df2cYzi36DoPxaQKodRzyprpzQ+P/Vj6hy4/BwSN10VP X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= From: Gerald Loacker The hpd GPIO is fetched with devm_gpiod_get_optional(), so a board that does not wire 5V detect to the receiver leaves detect_5v_gpio NULL. hdmirx_setup_irq() then calls gpiod_to_irq() on it anyway, which returns -EINVAL for a NULL descriptor, and probe fails. The GPIO is only optional as far as the fetch goes. Set the interrupt up only when the GPIO is there. det_irq then keeps the zero devm_kzalloc() gave it, so hdmirx_enable_irq() and hdmirx_disable_irq() skip it as well. Nothing else has to change for such a board to probe: 5V is then never reported as present, which is what gpiod_get_value_cansleep() on a NULL descriptor already returns. Getting the state from somewhere else is a separate matter. Assisted-by: Claude:claude-opus-5 Signed-off-by: Gerald Loacker Signed-off-by: Sascha Hauer --- .../media/platform/synopsys/hdmirx/snps_hdmirx.c | 34 ++++++++++++------= ---- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers= /media/platform/synopsys/hdmirx/snps_hdmirx.c index 8c6b04425c8a9..23b4dd853be57 100644 --- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c @@ -2525,7 +2525,8 @@ static void hdmirx_disable_irq(struct device *dev) { struct snps_hdmirx_dev *hdmirx_dev =3D dev_get_drvdata(dev); =20 - disable_irq(hdmirx_dev->det_irq); + if (hdmirx_dev->det_irq > 0) + disable_irq(hdmirx_dev->det_irq); disable_irq(hdmirx_dev->dma_irq); disable_irq(hdmirx_dev->hdmi_irq); =20 @@ -2539,7 +2540,8 @@ static void hdmirx_enable_irq(struct device *dev) =20 enable_irq(hdmirx_dev->hdmi_irq); enable_irq(hdmirx_dev->dma_irq); - enable_irq(hdmirx_dev->det_irq); + if (hdmirx_dev->det_irq > 0) + enable_irq(hdmirx_dev->det_irq); =20 queue_delayed_work(system_dfl_wq, &hdmirx_dev->delayed_work_hotplug, @@ -2623,21 +2625,23 @@ static int hdmirx_setup_irq(struct snps_hdmirx_dev = *hdmirx_dev, return ret; } =20 - irq =3D gpiod_to_irq(hdmirx_dev->detect_5v_gpio); - if (irq < 0) { - dev_err_probe(dev, irq, "failed to get hdmirx-5v irq\n"); - return irq; - } + if (hdmirx_dev->detect_5v_gpio) { + irq =3D gpiod_to_irq(hdmirx_dev->detect_5v_gpio); + if (irq < 0) { + dev_err_probe(dev, irq, "failed to get hdmirx-5v irq\n"); + return irq; + } =20 - irq_set_status_flags(irq, IRQ_NOAUTOEN); + irq_set_status_flags(irq, IRQ_NOAUTOEN); =20 - hdmirx_dev->det_irq =3D irq; - ret =3D devm_request_irq(dev, irq, hdmirx_5v_det_irq_handler, - IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, - "rk_hdmirx-5v", hdmirx_dev); - if (ret) { - dev_err_probe(dev, ret, "failed to request hdmirx-5v irq\n"); - return ret; + hdmirx_dev->det_irq =3D irq; + ret =3D devm_request_irq(dev, irq, hdmirx_5v_det_irq_handler, + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, + "rk_hdmirx-5v", hdmirx_dev); + if (ret) { + dev_err_probe(dev, ret, "failed to request hdmirx-5v irq\n"); + return ret; + } } =20 return 0; --=20 2.47.3 From nobody Thu Sep 24 12:55:35 2026 Received: from mx1.white.stw.pengutronix.de (mx1.white.stw.pengutronix.de [185.203.200.13]) (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 6767E534473; Wed, 23 Sep 2026 13:45:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=185.203.200.13 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171132; cv=pass; b=FmXv3zcFo6mZgUxHiPHsiX2Hs5BB1gqJEyjrviFt9SMWTxSNorsZ6YWPtrG4A1DAHreneCsE9hOdaCcvX6B4hwi+trbOfOep9KehE5rBc6/IL+EjsSyukqjAAKyYry3V0X5ESakbh/wl2At+sBEqLrWoAuZH0bfjzqfAci1XXnI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171132; c=relaxed/simple; bh=t1v5oCq7AbDEQsFkLv6r5sDpDSeu1X4jbI9KRzVoKI0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cDFHKP4R70bdLOsGzPNJO+mMBh10zPVxdAWKMFFugs9q8j0Ahm/VEF+PKGC/A0OMwsABhAF7WIKuPT2n6IvcpJ69gikliqc8Nns9DjXMZx3ld7uqz6hlIls1CqPciBDil0uOC1K8zS+SjxjCzKuGWdZJ31thMSPdPLo3gySJqMA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b=QHQwDOZl; arc=pass smtp.client-ip=185.203.200.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b="QHQwDOZl" Received: from [127.0.1.1] (unknown [IPv6:2a02:560:5dd5:4b00:9ebf:dff:fe00:fdb5]) (Authenticated sender: sha@pengutronix.de) by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id 49415201F09; Wed, 23 Sep 2026 15:45:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W4jAV22Xrw4YIDaiJqg1Run+tpO3VEw2vJGgrK8QLKU=; b=QHQwDOZlOmr5BchOQtgCSINVfUOOq5W8yGo+w+WAsRjVElMV0wZq8qYmiujlcA9MkvYYEV 1ZMYsO0BHBYb9UJNNxYBYG+/QB5FuM/7kmO8QMoz7dMgzUO9WOVwDLoh4vmQKLTzrIEfN1 yE/XPAAVQJ7Q/i6Y/q9qg4gvKcPpkjuiuf+eqtzIW0XLYey6BaK2GLFWRi0GjnvybGeAeU 8JyexzXD+aYnX8G+koymJk1DWh+ME7e/f6Mueihyu+I4ravKVcbptiBZXxtRzitkQNfk9k XYm6WvrJ5gsrWA+9PHiWIL9rOY+mD2i5yq/jPM5G67NsPXJ9SXzhBi1/JihIbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W4jAV22Xrw4YIDaiJqg1Run+tpO3VEw2vJGgrK8QLKU=; b=NEhxdiXPop4aS/8YIX/6c4OOYMCuEUrYfd/QoZW3Pp/jWy2NDM7+/fF9AXxJHSORCyceRi vUAqQzGw27H7uLFvpgq4IVdE8Abs1nIfJPkzB6Zc4uuCnvOHfseBfZ3SLQdlCKzRdp5g/q +xA683hEhJPHLCJdSyjutYhviGT5qgQ9C/yOezxfwmz2nKttkrsfimonaBvkrveqSVno34 E2Yzwaw4GzG4WhgrkCkty1cwqRkIPJbAyacNL8ONwibDiEM9APib8XxrVcrYvIL1mTjTf5 oy/9EsDHlGS0Yrkx3kNOv723c5xbXvL0QTPwpU3eIDKRM/m9oj7d5xbOn09acA== ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1790171125; a=rsa-sha256; cv=none; b=eJ5jjVPXeclAHBbpVcat385ZNfNHhVa/r0JgeMKsSC/aaltRHXD5u4BPxwi41LxBxJ+WJM Op8PmIf4EdZtfb9ai62UGHk6Dwu/VL/+mdhZ7wqZcMfdiiSdDTn37oRMWcpe3yyoHDiOFw kmJvFoqjV6XC1NQ28NcyJk2A0fVDCv29lpPQ4jP2D5pZq0RW/AlgWyFrD4cv4uB2n9b3yo iPGL+BUTKrZbh3W4rTRrsEMZn4cFcTGQL4stOe1DgsLJGGGCX1Z1dzXd2zV9UsyjerjJap 7NV3OaePIURRGachY/LR2lqGshJXsMdlj94zwjZDJHWBp98SsdsReTl7k/RHRA== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=sha@pengutronix.de smtp.mailfrom=s.hauer@pengutronix.de From: Sascha Hauer Date: Wed, 23 Sep 2026 15:44:47 +0200 Subject: [PATCH 8/9] media: v4l2-subdev: notify the bridge when the source power changes 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 Message-Id: <20260923-hdmirx-media-v1-8-ea3d77d4a5f3@pengutronix.de> References: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> In-Reply-To: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> To: Dmitry Osipenko , Mauro Carvalho Chehab , Hans Verkuil , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Gerald Loacker , Lucas Sinn , linux-media@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com, linux-kernel@vger.kernel.org, Sascha Hauer X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790171091; l=1765; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=t1v5oCq7AbDEQsFkLv6r5sDpDSeu1X4jbI9KRzVoKI0=; b=CtkE+yOMb0E3CIeyvS8K0cCTiNsFCxtCqPuURbBpgGi8x62iZbecfWOWEzwmt8uVterGoIIdX xz2vlm+RIyoBegz6SRgGaZ6vQQrki6yNV5dzl18jAVy4p8Ue8++L6Vq X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= Whether a source is driving the connector's +5V line is published as V4L2_CID_DV_RX_POWER_PRESENT and nowhere else. adv7604, adv7842, tc358743 and tda1997x all set that control from their cable detect interrupt and stop there, so a driver that has to act on the change in hardware, rather than hand the value to userspace, has nothing to hook. The in-kernel channel already exists for the neighbouring events. A format change goes out through v4l2_subdev_notify_event() as V4L2_EVENT_SOURCE_CHANGE, and adv7604 sends a private ADV76XX_HOTPLUG when the bridge has to drive HPD back out at the connector, which cobalt consumes. Only the source power state is missing. Add a generic notification for it. The argument carries the same per-input mask as the control, so a device in front of a receiver can pass on what it sees without the receiver having to reach into its control handler. Assisted-by: Claude:claude-opus-5 Signed-off-by: Sascha Hauer --- include/media/v4l2-subdev.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index d256b7ec8f848..407b353fa943d 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -29,6 +29,14 @@ =20 #define V4L2_DEVICE_NOTIFY_EVENT _IOW('v', 2, struct v4l2_event) =20 +/* + * The source power state a receiver publishes as + * V4L2_CID_DV_RX_POWER_PRESENT has changed. The argument points at an + * unsigned int holding the same per-input mask as that control, so zero + * means no input sees a source. + */ +#define V4L2_DEVICE_NOTIFY_RX_POWER_PRESENT _IOW('v', 3, unsigned int) + struct v4l2_device; struct v4l2_ctrl_handler; struct v4l2_event; --=20 2.47.3 From nobody Thu Sep 24 12:55:35 2026 Received: from mx1.white.stw.pengutronix.de (mx1.white.stw.pengutronix.de [185.203.200.13]) (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 B83955383F9; Wed, 23 Sep 2026 13:45:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=185.203.200.13 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171138; cv=pass; b=Fa81cQ73PjTVjdMC0SZxbThJQUlE8veCz22199awWf4jKU3K44kxJXbZjlQ0/3Pf5pd1l4VmkPw5ZjjBIG4LlVcarb95WngvKr5TT1wk7BX8Mf/vfTYrXvGjvn58VdKdhlmSf+B9LCB9BDOwjf8b6eaDzkECwkhBs69y/0u9tvs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790171138; c=relaxed/simple; bh=pRkiTAC2G8aBEOjf8f5ZCU7GlO+mB3s5SEVhscg/uEM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nHxeM1FFRmrjEeUqwLFV9uz3nl8XSs1M6/gnOqQsUK6hZWF1dA9FTqzNo4MoXirqGzSdwkPn4XciRf4RZSvykDNCmTMo3FyYfSWRDr/ErC4jtMFPyLFqPghtUybiaNX/5EV1Unf1WAHcKn8379WfGfp6Xk0WohBK9aqqjLzYajs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b=Rh6W0k6z; arc=pass smtp.client-ip=185.203.200.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.b="Rh6W0k6z" Received: from [127.0.1.1] (unknown [IPv6:2a02:560:5dd5:4b00:9ebf:dff:fe00:fdb5]) (Authenticated sender: sha@pengutronix.de) by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id 7EB6D201A8D; Wed, 23 Sep 2026 15:45:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6rr9w3URUQ0TGCGXkjnhXsYr1YK45zhyOjaHeo1XL4A=; b=Rh6W0k6z5YYwWHyIJnFeR9zs3MVh6KtQEiZYhVnmp/Xwj00hLnVpwsdLQAorsvpV6iCznq 78nKdqXp7qdAbVVvwb6qy3PCz0nG8x2vgRk1YLOZXk0zxVk6F549LScD5hmj72LD1rEH2H ZllXUhrxY2B7J+T8JivAaEBlsDmQQW2FUnniMeXT9Xp8X7AuXZkCStObt4BjcNbcZyjk3p GNz54f2lSTHT9Q0tU1yqwmIuz+thHIABukz7e13X3v44NcMI18aUhtGI3lT6KNeoyWpe09 ImoDPVtfLPjJo0GxhtvckADRSnLeGZXg48YWYJrJmoINok16WQ5GEHJsUKuTHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1790171129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6rr9w3URUQ0TGCGXkjnhXsYr1YK45zhyOjaHeo1XL4A=; b=XBWKIYCDBcIFU5WTfsSV4vI+1ezibVH+Zay7y9CHGdIDsoqxSFhtzyelJYT26k+MPDpzWS cauD3o4SHeePe6+/RSJDdG/aSbKHiHghWikXvaHtKERYANl7lLl9uvcuSYhRN1RqOOAw1i x/lwc/ngAJoHYkE6Y1AaJKkdLMWGGWX9VyZLKVGhim1YmdDkBG+/jq9RBB4ns0oV+0zH+l 25js9qIs8Zc0sjDJyae02Pjosx/Ew5KL6jtA8ANrWyRMuEoWycphQKPm7jfPZbZF3cY7DA O6UImxSH882Oi48XlCAvZNcCTd88Kmh1S0BAB1sTalHtvPafqxCudig2uorh/w== ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1790171129; a=rsa-sha256; cv=none; b=ZtJSQLT+HPXqekhCgKmK7dlsOIBzYFUeM6/KCgTslJAhRcxW4smuVuvZG1+IK9XovhJHJ6 iGnMRFlQXiqXbcLai5/oWjK5xcyoroL1qpNk1takoMGLauIKevpGbvzSWK/WlROSwhlP4r NUE3CNOu8LLxsQsNTxSbibxs9pJRBxpd5jiKMEBNB3ihpZdtnASDvh/K68TcXql+K8yZPa jv4bX7ZHdbu+mjF2M7CalrCOdVI2bGKe3VEDwFP/nl8Lm4Uiz1k4Ilmf4xhVlUziu9K273 PtYJCIY4Dlmlc8lkZfS0vRQaua4ftOJTxmRru/TJwD350qC3NZnD9y62MZ1ezA== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=sha@pengutronix.de smtp.mailfrom=s.hauer@pengutronix.de From: Sascha Hauer Date: Wed, 23 Sep 2026 15:44:48 +0200 Subject: [PATCH 9/9] media: synopsys: hdmirx: get the 5V state from the upstream subdev 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 Message-Id: <20260923-hdmirx-media-v1-9-ea3d77d4a5f3@pengutronix.de> References: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> In-Reply-To: <20260923-hdmirx-media-v1-0-ea3d77d4a5f3@pengutronix.de> To: Dmitry Osipenko , Mauro Carvalho Chehab , Hans Verkuil , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Gerald Loacker , Lucas Sinn , linux-media@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com, linux-kernel@vger.kernel.org, Sascha Hauer X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790171091; l=10805; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=WWCYpRiNYOounjsFxLI57fqzPdh5k5Xh1Z5Ea/U8Xck=; b=QXrlwe+E0uXhrCBjE+ikCsJ2wAyGoElfHb5xSAuzXpG25JPeeqj0JXmLhbUYF6RblIPCLxb6H SImkePSoz9+B5AEv63uvPhXT0WLgdpnlXtQy9K+BiZRggzRfQC0KC7B X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= From: Gerald Loacker On a board whose HDMI connector belongs to a device in front of this receiver, the connector's +5V line goes to that device and hpd-gpios is absent. tx_5v_power_present() then reads a NULL descriptor, which gpiod_get_value_cansleep() reports as zero, so the receiver never sees a source and hdmirx_plugin() never runs. Have the device in front tell us. Once it is bound through our async notifier its sd->v4l2_dev is ours, so v4l2_subdev_notify() lands in the callback installed here, and V4L2_DEVICE_NOTIFY_RX_POWER_PRESENT stands in for the 5V interrupt this board does not have. Remember what arrives in source_5v, which tx_5v_power_present() returns when there is no GPIO of our own, so everything else carries on unchanged and no pointer into the other device is kept. A notification is an edge, so it says nothing about a source that was connected all along. Ask g_input_status() once at bind and take V4L2_IN_ST_NO_POWER as the answer. A subdev without that op is bound anyway: a receiver that sees no source beats one that refuses to probe. Without a det_irq there is nothing to disable_irq() across the cancel in hdmirx_disable_irq(), so a notification can arm the hotplug work right afterwards - including from hdmirx_suspend(), on its way to gating the clocks. Gate both workers on hotplug_on under work_lock instead. It starts clear, which also keeps them off the hardware during probe, where hdmirx_fwnode_bound() can arm the work well before the EDID is written. The flag is not enough on the way out. The worker still has to reach work_lock to read it, and hdmirx_fwnode_unbind() arms the work once more from inside v4l2_async_nf_unregister(), after hdmirx_disable_irq() has already cancelled it. hdmirx_dev is devm allocated, so by the time the worker runs it can be gone. Cancel the work again once the notifier is unregistered, in hdmirx_remove() and in the probe error path. Assisted-by: Claude:claude-opus-5 Signed-off-by: Gerald Loacker Signed-off-by: Sascha Hauer --- .../media/platform/synopsys/hdmirx/snps_hdmirx.c | 121 +++++++++++++++++= +++- 1 file changed, 118 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers= /media/platform/synopsys/hdmirx/snps_hdmirx.c index 23b4dd853be57..43d7857b4458b 100644 --- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c @@ -142,6 +142,7 @@ struct snps_hdmirx_dev { struct mutex phy_rw_lock; /* to protect phy r/w configuration */ struct mutex stream_lock; /* to lock video stream capture */ struct mutex work_lock; /* to lock the critical section of hotplug event = */ + bool hotplug_on; /* under work_lock: the hardware is up, workers may run = */ struct reset_control_bulk_data resets[HDMIRX_NUM_RST]; struct clk_bulk_data *clks; struct regmap *grf; @@ -160,6 +161,7 @@ struct snps_hdmirx_dev { bool hpd_trigger_level_high; bool tmds_clk_ratio; bool plugged; + bool source_5v; /* 5V as last reported by the subdev in front of us */ int num_clks; u32 edid_blocks_written; u32 cur_fmt_fourcc; @@ -237,6 +239,15 @@ static bool tx_5v_power_present(struct snps_hdmirx_dev= *hdmirx_dev) int val, i, cnt =3D 0; bool ret; =20 + /* + * Without a GPIO of our own the connector belongs to the subdev in + * front of us and there is no line here to sample, so sampling is + * reading back what that subdev last told us. Nothing to debounce: + * it did that on its side of the connector. + */ + if (!hdmirx_dev->detect_5v_gpio) + return READ_ONCE(hdmirx_dev->source_5v); + for (i =3D 0; i < 10; i++) { usleep_range(1000, 1100); val =3D gpiod_get_value_cansleep(hdmirx_dev->detect_5v_gpio); @@ -2227,6 +2238,11 @@ static void hdmirx_delayed_work_hotplug(struct work_= struct *work) delayed_work_hotplug.work); =20 mutex_lock(&hdmirx_dev->work_lock); + if (!hdmirx_dev->hotplug_on) { + mutex_unlock(&hdmirx_dev->work_lock); + return; + } + plugin =3D tx_5v_power_present(hdmirx_dev); v4l2_ctrl_s_ctrl(hdmirx_dev->detect_tx_5v_ctrl, plugin); v4l2_dbg(1, debug, &hdmirx_dev->v4l2_dev, "%s: plugin:%d\n", @@ -2249,6 +2265,11 @@ static void hdmirx_delayed_work_res_change(struct wo= rk_struct *work) delayed_work_res_change.work); =20 mutex_lock(&hdmirx_dev->work_lock); + if (!hdmirx_dev->hotplug_on) { + mutex_unlock(&hdmirx_dev->work_lock); + return; + } + plugin =3D tx_5v_power_present(hdmirx_dev); v4l2_dbg(1, debug, &hdmirx_dev->v4l2_dev, "%s: plugin:%d\n", __func__, plugin); @@ -2272,17 +2293,39 @@ static void hdmirx_delayed_work_res_change(struct w= ork_struct *work) mutex_unlock(&hdmirx_dev->work_lock); } =20 -static irqreturn_t hdmirx_5v_det_irq_handler(int irq, void *dev_id) +/* + * A 5V edge. Neither source of one says more than "look again": the + * hotplug worker samples tx_5v_power_present() and acts on what it finds. + */ +static void hdmirx_5v_edge(struct snps_hdmirx_dev *hdmirx_dev) { - struct snps_hdmirx_dev *hdmirx_dev =3D dev_id; - queue_delayed_work(system_dfl_wq, &hdmirx_dev->delayed_work_hotplug, msecs_to_jiffies(10)); +} + +static irqreturn_t hdmirx_5v_det_irq_handler(int irq, void *dev_id) +{ + struct snps_hdmirx_dev *hdmirx_dev =3D dev_id; + + hdmirx_5v_edge(hdmirx_dev); =20 return IRQ_HANDLED; } =20 +/* + * The same edge from a subdev in front of us, on a board where the + * connector is its and not ours. It has no line here to leave asserted for + * the worker to sample, so remember what it saw on its side. + */ +static void hdmirx_5v_source_edge(struct snps_hdmirx_dev *hdmirx_dev, + bool present) +{ + WRITE_ONCE(hdmirx_dev->source_5v, present); + + hdmirx_5v_edge(hdmirx_dev); +} + static const struct hdmirx_cec_ops hdmirx_cec_ops =3D { .write =3D hdmirx_writel, .read =3D hdmirx_readl, @@ -2525,6 +2568,17 @@ static void hdmirx_disable_irq(struct device *dev) { struct snps_hdmirx_dev *hdmirx_dev =3D dev_get_drvdata(dev); =20 + /* + * Disabling det_irq is what stops the work being armed again, but + * there is no det_irq when the 5V state comes from a subdev: it can + * notify us into hdmirx_5v_source_edge() right after the cancel + * below. Have the workers bail out instead. They take work_lock + * first thing, so anything queued from here on sees this. + */ + mutex_lock(&hdmirx_dev->work_lock); + hdmirx_dev->hotplug_on =3D false; + mutex_unlock(&hdmirx_dev->work_lock); + if (hdmirx_dev->det_irq > 0) disable_irq(hdmirx_dev->det_irq); disable_irq(hdmirx_dev->dma_irq); @@ -2538,6 +2592,15 @@ static void hdmirx_enable_irq(struct device *dev) { struct snps_hdmirx_dev *hdmirx_dev =3D dev_get_drvdata(dev); =20 + /* + * Also the first time the workers are let in: hdmirx_fwnode_bound() + * can arm the hotplug work from within hdmirx_probe(), well before + * the EDID is written and HDCP is registered. + */ + mutex_lock(&hdmirx_dev->work_lock); + hdmirx_dev->hotplug_on =3D true; + mutex_unlock(&hdmirx_dev->work_lock); + enable_irq(hdmirx_dev->hdmi_irq); enable_irq(hdmirx_dev->dma_irq); if (hdmirx_dev->det_irq > 0) @@ -2673,6 +2736,18 @@ static int hdmirx_register_cec(struct snps_hdmirx_de= v *hdmirx_dev, return 0; } =20 +static void hdmirx_notify(struct v4l2_subdev *sd, unsigned int notificatio= n, + void *arg) +{ + struct snps_hdmirx_dev *hdmirx_dev =3D + container_of(sd->v4l2_dev, struct snps_hdmirx_dev, v4l2_dev); + + if (notification !=3D V4L2_DEVICE_NOTIFY_RX_POWER_PRESENT || !arg) + return; + + hdmirx_5v_source_edge(hdmirx_dev, !!*(unsigned int *)arg); +} + static int hdmirx_fwnode_bound(struct v4l2_async_notifier *notifier, struct v4l2_subdev *subdev, struct v4l2_async_connection *asc) @@ -2680,6 +2755,7 @@ static int hdmirx_fwnode_bound(struct v4l2_async_noti= fier *notifier, struct snps_hdmirx_dev *hdmirx_dev =3D container_of(notifier, struct snps_hdmirx_dev, notifier); int source_pad; + u32 status; int ret; =20 source_pad =3D media_entity_get_fwnode_pad(&subdev->entity, @@ -2699,6 +2775,23 @@ static int hdmirx_fwnode_bound(struct v4l2_async_not= ifier *notifier, return ret; } =20 + if (hdmirx_dev->detect_5v_gpio) + return 0; + + /* + * Changes arrive through hdmirx_notify(). Ask once for the state a + * source connected before we bound is already in. + */ + ret =3D v4l2_subdev_call(subdev, video, g_input_status, &status); + if (ret) { + dev_err(hdmirx_dev->dev, + "%s did not report the input status and there is no hpd-gpios, no sourc= e will be detected: %d\n", + subdev->name, ret); + return 0; + } + + hdmirx_5v_source_edge(hdmirx_dev, !(status & V4L2_IN_ST_NO_POWER)); + return 0; } =20 @@ -2710,8 +2803,24 @@ static int hdmirx_fwnode_complete(struct v4l2_async_= notifier *notifier) return v4l2_device_register_subdev_nodes(&hdmirx_dev->v4l2_dev); } =20 +static void hdmirx_fwnode_unbind(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *subdev, + struct v4l2_async_connection *asc) +{ + struct snps_hdmirx_dev *hdmirx_dev =3D + container_of(notifier, struct snps_hdmirx_dev, notifier); + + /* With a GPIO of our own the connector is ours and stays put. */ + if (hdmirx_dev->detect_5v_gpio) + return; + + /* The source went with it. */ + hdmirx_5v_source_edge(hdmirx_dev, false); +} + static const struct v4l2_async_notifier_operations hdmirx_async_ops =3D { .bound =3D hdmirx_fwnode_bound, + .unbind =3D hdmirx_fwnode_unbind, .complete =3D hdmirx_fwnode_complete, }; =20 @@ -2806,6 +2915,7 @@ static int hdmirx_probe(struct platform_device *pdev) goto err_pm; } hdmirx_dev->v4l2_dev.ctrl_handler =3D hdl; + hdmirx_dev->v4l2_dev.notify =3D hdmirx_notify; =20 ret =3D v4l2_device_register(dev, &hdmirx_dev->v4l2_dev); if (ret < 0) { @@ -2890,6 +3000,8 @@ static int hdmirx_probe(struct platform_device *pdev) v4l2_async_nf_unregister(&hdmirx_dev->notifier); err_cleanup_notifier: v4l2_async_nf_cleanup(&hdmirx_dev->notifier); + /* Binding and unbinding both arm the hotplug work. */ + cancel_delayed_work_sync(&hdmirx_dev->delayed_work_hotplug); err_unreg_media: media_device_unregister(&hdmirx_dev->mdev); err_unreg_video_dev: @@ -2926,6 +3038,9 @@ static void hdmirx_remove(struct platform_device *pde= v) v4l2_async_nf_unregister(&hdmirx_dev->notifier); v4l2_async_nf_cleanup(&hdmirx_dev->notifier); =20 + /* The unbind above arms the hotplug work again. */ + cancel_delayed_work_sync(&hdmirx_dev->delayed_work_hotplug); + media_device_unregister(&hdmirx_dev->mdev); =20 vb2_video_unregister_device(&hdmirx_dev->stream.vdev); --=20 2.47.3