From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (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 65D8647F2F9; Sat, 3 Oct 2026 16:19:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791044391; cv=none; b=MySjTpL2VdTdfIo1Bc0O8ygy7rJaSIPN55/qiuLG9+qH6E6hvdVhSC+vE0qgpf55xMI8+39sLXyqIUmjng+1Rl4YqDOOq9zgwtRJ9Y2B+TD84JdQR6R3HI8ZY5n9BxOQ4ExY2oQ0PxMgcqqaPFApQKQ0aAC7eF6wGV6NdlCPeV4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791044391; c=relaxed/simple; bh=5IOcEQbOTG2rgEVmb7kS10pbAMNXM5TrNK08bo4jq1s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:From:In-Reply-To: Content-Type:References; b=aWj/XZDWIRGmNN2nCau8uD6cykklQZbIJFUISol779oQ2w+/lBuAtcqFKsOU5WVhuCgL7dhGKTcGiho+kiKzDGEOw0LF8Raoosw6Gx0JaUw81gKiBj6yeQ9xb0qhuYTd9vM6uo91IUlcpzhxQnznugCXl3W5IuCF68gY/Sii31A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=lsnwuG0R; arc=none smtp.client-ip=210.118.77.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="lsnwuG0R" Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20261003161944euoutp015445fcbf6e0d4e3cb00b7533697c0e02~bEWDnwLC60335403354euoutp012; Sat, 3 Oct 2026 16:19:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20261003161944euoutp015445fcbf6e0d4e3cb00b7533697c0e02~bEWDnwLC60335403354euoutp012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1791044384; bh=1XaQcVeyhm8yfAFalkdFK1wk7N73U0zKdzj1RF8N3QE=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=lsnwuG0Rt3fGmtfGSOO65rhkC0IFUgrq1ANqgsQGtVreBctftYXQpGMAZgPzf+Ci0 +kvHkS1AYixN1TDhKQn3VgurKD90DR9RBMHeFubIeyUtXTe1ckGdkeIPTPBfcYCdGk P4JjhZ41OygKkWPJO9Q1IpC/ICJqCNGZ8gN2VJqo= Received: from eusmtip2.samsung.com (unknown [203.254.199.222]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20261003161943eucas1p2d4d85e066b9cedf34cbeaf481bf875db~bEWCnjmvZ2037620376eucas1p20; Sat, 3 Oct 2026 16:19:43 +0000 (GMT) Received: from [192.168.1.44] (unknown [106.210.136.40]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20261003161941eusmtip20b539371f409b63e666c140753664cb8~bEWBBnkRs2154121541eusmtip2G; Sat, 3 Oct 2026 16:19:41 +0000 (GMT) Message-ID: Date: Sat, 3 Oct 2026 18:19:41 +0200 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 08/21] drm/bridge: inno-hdmi: Split probe out of bind To: =?UTF-8?Q?Heiko_St=C3=BCbner?= , Vinod Koul , Manivannan Sadhasivam , Neil Armstrong , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andrzej Hajda , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Andy Yan , Philipp Zabel , Emil Renner Berthing , Hal Feng , Michael Turquette , Stephen Boyd , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Dominique Belhachemi , Brian Masney , Jerome Brunet Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, Marek Szyprowski , Maud Spierings , Graham Markall , Icenowy Zheng , Chaoyi Chen , Joshua Peisach , =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= Content-Language: en-US From: Michal Wilczynski In-Reply-To: <6535891.44csPzL39Z@diego> Content-Transfer-Encoding: 8bit X-CMS-MailID: 20261003161943eucas1p2d4d85e066b9cedf34cbeaf481bf875db X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20260929103221eucas1p264107850882dde96fcda4772332d4f41 X-EPHeader: CA X-CMS-RootMailID: 20260929103221eucas1p264107850882dde96fcda4772332d4f41 References: <20260929-jh7110-clean-send-v5-0-82b4d8e3c6c7@samsung.com> <20260929-jh7110-clean-send-v5-8-82b4d8e3c6c7@samsung.com> <6535891.44csPzL39Z@diego> On 9/30/26 12:02, Heiko Stübner wrote: > Am Dienstag, 29. September 2026, 12:31:05 Mitteleuropäische Sommerzeit schrieb Michal Wilczynski: >> inno_hdmi_bind() both sets up the bridge and attaches it to a DRM >> encoder. A platform whose HDMI controller is a child of a larger device >> needs the first half without the second, since it registers as its own >> platform driver and lets the DRM core bind the bridge later. >> >> Move the setup into a new exported inno_hdmi_probe(), and reduce >> inno_hdmi_bind() to a wrapper around it. >> >> No functional change intended. >> >> Reviewed-by: Joshua Peisach >> Signed-off-by: Michal Wilczynski >> --- >> drivers/gpu/drm/bridge/inno-hdmi.c | 49 +++++++++++++++++++++++++++++++++----- >> include/drm/bridge/inno_hdmi.h | 4 ++++ >> 2 files changed, 47 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/gpu/drm/bridge/inno-hdmi.c b/drivers/gpu/drm/bridge/inno-hdmi.c >> index d7c33b92e2ddf4ced84d17304463f44be52270b8..7a9f54dce2647f0320d77629a28154eade14385f 100644 >> --- a/drivers/gpu/drm/bridge/inno-hdmi.c >> +++ b/drivers/gpu/drm/bridge/inno-hdmi.c >> @@ -929,7 +929,14 @@ static irqreturn_t inno_hdmi_irq(int irq, void *dev_id) >> { >> struct inno_hdmi *hdmi = dev_id; >> >> - drm_helper_hpd_irq_event(hdmi->bridge.dev); >> + /* >> + * The interrupt is requested in probe, but bridge.dev is only set once >> + * the DRM master binds and attaches the bridge, which may never happen. >> + * Drop hotplug events that arrive before then rather than dereference a >> + * NULL drm_device. >> + */ >> + if (hdmi->bridge.dev) >> + drm_helper_hpd_irq_event(hdmi->bridge.dev); > > This is not part of the commit description and while true, should likely > be its own patch with its own description. It only made sense with this patch, hence why it's included. Happy to split it. > > >> >> return IRQ_HANDLED; >> } >> @@ -1061,11 +1068,24 @@ static struct i2c_adapter *inno_hdmi_i2c_adapter(struct inno_hdmi *hdmi) >> return adap; >> } >> >> -struct inno_hdmi *inno_hdmi_bind(struct device *dev, >> - struct drm_encoder *encoder, >> - const struct inno_hdmi_plat_data *plat_data) >> +/** >> + * inno_hdmi_probe - Internal helper to perform common setup >> + * @pdev: platform device >> + * @plat_data: SoC-specific platform data >> + * >> + * This function handles all the common hardware setup: allocating the main >> + * struct, mapping registers, getting clocks, initializing the hardware, >> + * setting up the IRQ, and initializing the DDC adapter and bridge struct. >> + * It returns a pointer to the inno_hdmi struct on success, or an ERR_PTR >> + * on failure. >> + * >> + * This function is used by modern, decoupled MFD/glue drivers. It registers >> + * the bridge but does not attach it. >> + */ >> +struct inno_hdmi *inno_hdmi_probe(struct platform_device *pdev, >> + const struct inno_hdmi_plat_data *plat_data) >> { >> - struct platform_device *pdev = to_platform_device(dev); >> + struct device *dev = &pdev->dev; >> struct inno_hdmi *hdmi; >> int irq; >> int ret; >> @@ -1128,7 +1148,24 @@ struct inno_hdmi *inno_hdmi_bind(struct device *dev, >> if (ret) >> return ERR_PTR(ret); >> >> - ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR); >> + return hdmi; >> +} >> +EXPORT_SYMBOL_GPL(inno_hdmi_probe); >> + >> +struct inno_hdmi *inno_hdmi_bind(struct device *dev, >> + struct drm_encoder *encoder, >> + const struct inno_hdmi_plat_data *plat_data) >> +{ >> + struct platform_device *pdev = to_platform_device(dev); >> + struct inno_hdmi *hdmi; >> + int ret; >> + >> + hdmi = inno_hdmi_probe(pdev, plat_data); >> + if (IS_ERR(hdmi)) >> + return hdmi; >> + >> + ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL, >> + DRM_BRIDGE_ATTACH_NO_CONNECTOR); >> if (ret) >> return ERR_PTR(ret); > > This clutters up the structure even more than it is right now. From "bind" > back to "probe" and "dev" back to "pdev" and calling a function called > "probe" from the bind callback. > > You are right, that all the resource allocation can (and probably should) > live in the drivers probe-path, but then please call that probe function > from the actual probe path. > > For example you could look at how all the Synopsys bridges do that. That is what the new jh7110 driver does - it is a plain platform driver and calls inno_hdmi_probe() from its own probe no component framework. Same shape as th1520-dw-hdmi.c which calls dw_hdmi_probe() from its platform probe and never calls dw_hdmi_bind(). I kept inno_hdmi_bind() as a wrapper on purpose so the rockchip probe/bind flow stays exactly as it is today. I do not have any rockchip hardware and moving resource acquisition out of bind and into probe there changes when the bridge is added, which I did not want to do build tested only. dw-hdmi keeps dw_hdmi_bind() for the same kind of consumer since dw_hdmi-rockchip.c is still component based. I am happy to convert inno_hdmi-rockchip.c so probe acquires the resources and bind only attaches - that would let inno_hdmi_bind() go away entirely - if someone with rockchip hardware can test it. Otherwise I would rather send it separately where it can get proper testing, as this series is at 21 patches already. You are right about pdev - inno_hdmi_bind() will take a platform_device like dw_hdmi_bind() does so the to_platform_device() goes away. > > > Thanks > Heiko > > > Best regards, -- Michal Wilczynski