Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wilczynski <m.wilczynski@samsung.com>
To: "Heiko Stübner" <heiko@sntech.de>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Andrzej Hajda" <andrzej.hajda@intel.com>,
	"Robert Foss" <rfoss@kernel.org>,
	"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Luca Ceresoli" <luca.ceresoli@bootlin.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Andy Yan" <andy.yan@rock-chips.com>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Emil Renner Berthing" <kernel@esmil.dk>,
	"Hal Feng" <hal.feng@starfivetech.com>,
	"Michael Turquette" <mturquette@baylibre.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Paul Walmsley" <pjw@kernel.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	"Dominique Belhachemi" <db@domibel.de>,
	"Brian Masney" <bmasney+clk@redhat.com>,
	"Jerome Brunet" <jbrunet+clk@baylibre.com>
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" <m.szyprowski@samsung.com>,
	"Maud Spierings" <maud_spierings@murena.io>,
	"Graham Markall" <hello@big-grey.co.uk>,
	"Icenowy Zheng" <zhengxingda@iscas.ac.cn>,
	"Chaoyi Chen" <chaoyi.chen@rock-chips.com>,
	"Joshua Peisach" <jpeisach@ubuntu.com>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Subject: Re: [PATCH v5 08/21] drm/bridge: inno-hdmi: Split probe out of bind
Date: Sat, 3 Oct 2026 18:19:41 +0200	[thread overview]
Message-ID: <e1b83c15-1ca9-4575-97aa-f44552ecb182@samsung.com> (raw)
In-Reply-To: <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 <jpeisach@ubuntu.com>
>> Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
>> ---
>>  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 <m.wilczynski@samsung.com>

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2026-10-03 16:19 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20260929103200eucas1p17af134cc3b93c242227964f574f13aa5@eucas1p1.samsung.com>
2026-09-29 10:30 ` [PATCH v5 00/21] drm: starfive: jh7110: Enable display subsystem Michal Wilczynski
2026-09-29 10:30   ` [PATCH v5 01/21] drm/bridge: inno-hdmi: fix swapped HSYNC and VSYNC polarity Michal Wilczynski
2026-10-01 15:40     ` Maud Spierings
2026-09-29 10:30   ` [PATCH v5 02/21] dt-bindings: phy: Add starfive,jh7110-inno-hdmi-phy Michal Wilczynski
2026-09-29 20:52     ` Rob Herring (Arm)
2026-09-29 10:31   ` [PATCH v5 03/21] dt-bindings: display: bridge: Add starfive,jh7110-inno-hdmi-controller Michal Wilczynski
2026-09-29 21:00     ` Rob Herring (Arm)
2026-09-29 10:31   ` [PATCH v5 04/21] dt-bindings: soc: starfive: Add starfive,jh7110-hdmi-subsystem Michal Wilczynski
2026-09-29 21:31     ` Rob Herring
2026-09-29 10:31   ` [PATCH v5 05/21] dt-bindings: soc: starfive: Add starfive,jh7110-vout-syscon Michal Wilczynski
2026-09-29 10:31   ` [PATCH v5 06/21] dt-bindings: display: verisilicon: Add starfive,jh7110-dc8200 Michal Wilczynski
2026-09-29 21:33     ` Rob Herring
2026-09-29 10:31   ` [PATCH v5 07/21] dt-bindings: soc: starfive: Add starfive,jh7110-vout-subsystem Michal Wilczynski
2026-09-29 10:31   ` [PATCH v5 08/21] drm/bridge: inno-hdmi: Split probe out of bind Michal Wilczynski
2026-09-30 10:02     ` Heiko Stübner
2026-10-03 16:19       ` Michal Wilczynski [this message]
2026-09-29 10:31   ` [PATCH v5 09/21] drm/bridge: inno-hdmi: Allow the register map to come from a parent Michal Wilczynski
2026-09-29 10:31   ` [PATCH v5 10/21] drm/bridge: inno-hdmi: Add .disable platform operation Michal Wilczynski
2026-09-30 10:07     ` Heiko Stübner
2026-09-29 10:31   ` [PATCH v5 11/21] drm/bridge: inno-hdmi: Add .mode_valid " Michal Wilczynski
2026-09-30 10:19     ` Heiko Stübner
2026-09-29 10:31   ` [PATCH v5 12/21] drm/bridge: inno-hdmi: Make the PHY configuration table optional Michal Wilczynski
2026-09-29 10:31   ` [PATCH v5 13/21] drm/bridge: inno-hdmi: Make the register clock source selectable Michal Wilczynski
2026-10-01 15:38     ` Maud Spierings
2026-09-29 10:31   ` [PATCH v5 14/21] soc: starfive: Add jh7110-hdmi-subsystem driver Michal Wilczynski
2026-09-29 10:31   ` [PATCH v5 15/21] soc: starfive: Add jh7110-vout-subsystem driver Michal Wilczynski
2026-09-29 10:31   ` [PATCH v5 16/21] drm/bridge: starfive: Add JH7110 HDMI controller driver Michal Wilczynski
2026-09-29 10:31   ` [PATCH v5 17/21] phy: Add common Innosilicon HDMI PHY helpers Michal Wilczynski
2026-09-30 10:11     ` Heiko Stübner
2026-09-29 10:31   ` [PATCH v5 18/21] phy: rockchip: inno-hdmi: Use the common Innosilicon " Michal Wilczynski
2026-09-30 10:14     ` Heiko Stübner
2026-09-29 10:31   ` [PATCH v5 19/21] phy: starfive: Add jh7110-inno-hdmi-phy driver Michal Wilczynski
2026-10-03 14:25     ` Vinod Koul
2026-09-29 10:31   ` [PATCH v5 20/21] riscv: dts: starfive: jh7110: Update DT for display subsystem Michal Wilczynski
2026-09-29 10:31   ` [PATCH v5 21/21] MAINTAINERS: Add StarFive JH7110 display subsystem entry Michal Wilczynski
2026-09-29 14:54   ` [PATCH v5 00/21] drm: starfive: jh7110: Enable display subsystem Icenowy Zheng
2026-09-29 15:02     ` Icenowy Zheng
2026-09-30  0:20   ` Byron Stanoszek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1b83c15-1ca9-4575-97aa-f44552ecb182@samsung.com \
    --to=m.wilczynski@samsung.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=alex@ghiti.fr \
    --cc=andrzej.hajda@intel.com \
    --cc=andy.yan@rock-chips.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=bmasney+clk@redhat.com \
    --cc=chaoyi.chen@rock-chips.com \
    --cc=conor+dt@kernel.org \
    --cc=db@domibel.de \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hal.feng@starfivetech.com \
    --cc=heiko@sntech.de \
    --cc=hello@big-grey.co.uk \
    --cc=jbrunet+clk@baylibre.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=jpeisach@ubuntu.com \
    --cc=kernel@esmil.dk \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=m.szyprowski@samsung.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mani@kernel.org \
    --cc=maud_spierings@murena.io \
    --cc=mripard@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=neil.armstrong@linaro.org \
    --cc=p.zabel@pengutronix.de \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=rfoss@kernel.org \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tzimmermann@suse.de \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=vkoul@kernel.org \
    --cc=zhengxingda@iscas.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox