All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: Simona Vetter <simona.vetter@ffwll.ch>
Cc: "Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Andrzej Hajda" <andrzej.hajda@intel.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Robert Foss" <rfoss@kernel.org>,
	"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Derek Kiernan" <derek.kiernan@amd.com>,
	"Dragan Cvetic" <dragan.cvetic@amd.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Saravana Kannan" <saravanak@google.com>,
	"Paul Kocialkowski" <contact@paulk.fr>,
	"Hervé Codina" <herve.codina@bootlin.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	"Paul Kocialkowski" <paul.kocialkowski@bootlin.com>,
	"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>
Subject: Re: [PATCH v2 0/5] Add support for GE SUNH hot-pluggable connector (was: "drm: add support for hot-pluggable bridges")
Date: Wed, 25 Sep 2024 12:58:56 +0200	[thread overview]
Message-ID: <20240925125856.321f7ef7@booty> (raw)
In-Reply-To: <ZvJ3vUCLsowLr_Mv@phenom.ffwll.local>

Hello Simona,

[+Cc: Dmitry Baryshkov who took part to the LPC discussion]

On Tue, 24 Sep 2024 10:26:37 +0200
Simona Vetter <simona.vetter@ffwll.ch> wrote:

> On Mon, Sep 09, 2024 at 03:26:04PM +0200, Luca Ceresoli wrote:

...

> > There is a fundamental question where your position is not clear to me.
> > Based on this:
> >   
> > > - The last fixed bridges knows that all subsequent bridges are hotplugged.  
> >     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
> > >   Which means instead of just asking for the next bridge, it needs to ask
> > >   for the fully formed bridge chain, including the connector.
> > >   
> > 
> > and this:
> >   
> > > - The hotplug bridge connector code checks every time a new bridge shows  
> >     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
> > >   up whether the chain is now complete. Once that is the case, it creates
> > >   the connector (with the new bridge design this is no longer the job of
> > >   the last bridge in the chain, so we need to require that for
> > >   hotpluggable bridges). Then it can attach all the bridges to that
> > >   connector, and hand the entire fully formed chain to the last fixed
> > >   bridge to hotplug insert and register.  
> > 
> > The question is: do you think the hotplug-bridge driver should be
> > present, or not? To me the two above sentences appear to contradict each
> > other.
> > 
> > The reason we decided to implement a hotplug DRM bridge is it allows to
> > decouple the fixed and the remote segments of the pipeline, in such a
> > way that all the regular bridge drivers don't need any special handling
> > to support hotplug.
> > 
> > In my work the upstream bridge driver is samsung-dsim.c and the
> > downstream one is ti-sn65dsi83.c and none of them needed a single line
> > changed to support hotplug. I think this is useful: virtually any
> > physical bridge with pins can be used in a hotplug setup, either in the
> > fixed or in the removable section, so not needing to modify them is
> > valuable.
> > 
> > OTOH in various parts of this and other e-mails you seem to imply that
> > there should be no hotplug-bridge (not as a struct drm_bridge, not as
> > a driver, or both). Except for the fact that there is no chip
> > implementing such a bridge (there is a physical connector though) I do
> > not see many reasons.  
> 
> Yeah you can have a dummy hotplug-bridge driver which just represents the
> hotplug connector, I don't see an issue with that. And sounds like a
> reasonable idea if it helps modelling with DT and all that.
> 
> What I described above was just focused on the interaction between bridge
> drivers and the hotplug support code. I think you absolutely need the last
> bridge driver to be aware that the entire subsequent chain is hotplugged,
> otherwise it wont work. That last bridge driver can be a special
> hotplug driver, but it doesn't need to be the case.

I see, that clarifies your position, thanks.

...

> > > Yeah we need special functions, which the last fixed bridge needs to call
> > > instead of the current set of functions. So instead of of_drm_find_bridge
> > > we need something like of_drm_register_hotplug_source_bridge or similar.  
> > 
> > Continuing on the above topic, are you suggesting that there should be
> > no hotplug-bridge, and that every bridge that can be used as the "last
> > fixed bridge" should handle the hotplug case individually?
> > 
> > If that is the case, we'd need to modify any bridge driver that people
> > want to use as "last fixed bridge" to:
> > 
> >  1. know they are the "last fixed bridge" (via device tree?)
> >  2. use of_drm_register_hotplug_source_bridge()
> >     instead of of_drm_find_bridge() accordingly  
> 
> This depends upon the dt design. If the dt design has a separate distinct
> hotplug node, then we could bind a hotplug bridge against that, which is
> aware.
> 
> But I think for some case (maybe dsi nodes) the dt design would be more an
> attribute somewhere plus a link to the first hotplugged element. And in
> that case the last physical bridge driver needs to be aware of that - we
> simply don't have any dt node we can bind the hotplug bridge driver
> against. I think the generic bridge hotplug design should not make an
> assumption about how the dt is designed here and allow both.
> 
> Also if the dt design for the approach without a separate hotplug
> connector is standardized, we can have a of_drm_handle_next_bridge
> function which does the right thing for both cases automatically. I think
> that way the impact on existing bridge drivers is minimal.

Pushing this even more, instead of having bridges aware of being the
last fixed ones, I've been pondering on a structure where every bridge
assumes the next one could disappear, and works appropriately. So the
current case (all bridges are fixed) would be just a special case where
the next bridge is found initially and never disappears.

This would probably be cleaner, no [if (hotplug) {this} else {that}]
constructs, but I'm concerned about the transition path for old
poorly-maintained drivers.

...

> > > > > Instead I think that code should be directly in core bridge code (I don't
> > > > > see the benefit of having this entirely in a separate driver), using drm
> > > > > locking to make sure there's no races.    
> > > > 
> > > > Not sure I got what you mean here. Which one of the following?
> > > > 
> > > >  1. The entire hotplug-bridge driver should not exist, and the DRM
> > > >     core should handle it all (seems not doable, this driver has lots of
> > > >     device-specific details)
> > > >  2. The hotplug-driver should exist, but the code to attach/detach the
> > > >     pipeline on hotplug/unplug should be moved to the core, with the
> > > >     hotplug-driver providing callbacks for the device-specific aspects
> > > >  3. Same as 2, but additionally the hotplug-bridge should become a
> > > >     connector driver (hotplug-connector.c?) -- not sure it can decouple
> > > >     the two sides without a bridge however
> > > >  4. None of the above    
> > > 
> > > 3, roughly. The connector creation must be in core bridge code, or things
> > > will go boom.  
> > 
> > Based on this I think you mean:
> > 
> >  1. the hotplug-*something* driver should exist  
> 
> This part I'm not sure is required, see my comments above. I think it
> depends upon how the dt design ultimately will look like, and I don't have
> an input on that.
> 
> >  2. it should add the fixed connector (DSI in my case) on probe
> >  3. it should add/remove the removable connector (LVDS) on hot(un)plug  
> 
> The new bridge design is that bridges do _not_ create connectors
> themselves. Instead the driver does that, using the bridge code as helpers
> to make sure things work correctly.
> 
> But aside from that I think this sounds good. I'm not sure you need the
> connector from step 2, but it shouldn't hurt either. With dp mst we create
> that connector because dp can also be driven directly without mst, so
> there we need that connector to be able to do modesets from userspace.

I had a sort of assumption that the fixed connector is needed to even
populate the card, not sure I was correct. Surely from a high-level API
it would make sense to remove it.

I'll postpone this aspect to a later moment, and by that time questions
about the hotplug-bridge will have been clarified. Right now I'm going
to tackle the drm_bridge refcounting.

> >  4. it should add _no_ bridge (in the sense of struct drm_bridge)
> >     [not sure it can still decouple the fixed VS addon pipeline parts]  
> 
> Yeah that's the tricky part, but definitely those hotplugged bridges
> should not be part of the currently existing bridge chain, because that
> cannot cope with hotplugs.

Not sure what you mean here, and what you mean by "the currently
existing bridge chain".

Do you mean hot-plugged bridges, when present, should not be in the
global bridge_list? That would make sense, sure.

Best regards,
Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

      reply	other threads:[~2024-09-25 10:59 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10  7:10 [PATCH v2 0/5] Add support for GE SUNH hot-pluggable connector (was: "drm: add support for hot-pluggable bridges") Luca Ceresoli
2024-05-10  7:10 ` [PATCH v2 1/5] dt-bindings: connector: add GE SUNH hotplug addon connector Luca Ceresoli
2024-05-10  8:41   ` Rob Herring (Arm)
2024-05-10 10:37     ` Luca Ceresoli
2024-05-10 13:22       ` Rob Herring
2024-05-10 14:39         ` Luca Ceresoli
2024-05-10 16:36   ` Rob Herring
2024-05-14 16:51     ` Luca Ceresoli
2024-06-05 14:45       ` Rob Herring
2024-06-11 14:43         ` Luca Ceresoli
2024-05-10  7:10 ` [PATCH v2 2/5] drm/bridge: add bridge notifier to be notified of bridge addition and removal Luca Ceresoli
2024-05-10  7:10 ` [PATCH v2 3/5] drm/encoder: add drm_encoder_cleanup_from() Luca Ceresoli
2024-05-10  7:10 ` [PATCH v2 4/5] drm/bridge: hotplug-bridge: add driver to support hot-pluggable DSI bridges Luca Ceresoli
2024-05-10  7:10 ` [PATCH v2 5/5] misc: add ge-addon-connector driver Luca Ceresoli
2024-05-10  7:55   ` Greg Kroah-Hartman
2024-05-10 10:24     ` Arnd Bergmann
2024-05-10 10:54       ` Luca Ceresoli
2024-05-10 10:57         ` Arnd Bergmann
2024-05-10 15:32           ` Luca Ceresoli
2024-05-10 10:54     ` Luca Ceresoli
2024-05-10 11:03       ` Greg Kroah-Hartman
2024-05-10 16:44 ` [PATCH v2 0/5] Add support for GE SUNH hot-pluggable connector (was: "drm: add support for hot-pluggable bridges") Rob Herring
2024-05-14 17:11   ` Luca Ceresoli
2024-05-16 13:22 ` Daniel Vetter
2024-05-20 12:01   ` Luca Ceresoli
2024-05-21 12:01     ` Daniel Vetter
2024-06-05 14:47       ` Luca Ceresoli
2024-08-23 10:39       ` Luca Ceresoli
2024-08-27 16:37         ` Daniel Vetter
2024-09-09 13:26           ` Luca Ceresoli
2024-09-24  8:26             ` Simona Vetter
2024-09-25 10:58               ` Luca Ceresoli [this message]

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=20240925125856.321f7ef7@booty \
    --to=luca.ceresoli@bootlin.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=arnd@arndb.de \
    --cc=conor+dt@kernel.org \
    --cc=contact@paulk.fr \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel@ffwll.ch \
    --cc=derek.kiernan@amd.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dragan.cvetic@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=herve.codina@bootlin.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=rfoss@kernel.org \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    --cc=simona.vetter@ffwll.ch \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tzimmermann@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.