linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Stephen Boyd <swboyd@chromium.org>,
	Douglas Anderson <dianders@chromium.org>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Rob Clark <robdclark@gmail.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Saravana Kannan <saravanak@google.com>
Subject: Re: [PATCH v6 02/35] component: Introduce the aggregate bus_type
Date: Mon, 31 Jan 2022 17:34:26 +0100	[thread overview]
Message-ID: <YfgPkliOLorgXwVE@kroah.com> (raw)
In-Reply-To: <CAKMK7uFYyQ9siB5ENHku+yVPWWM1H=TEn-NZofEKqpJnuEvMmw@mail.gmail.com>

On Mon, Jan 31, 2022 at 04:15:09PM +0100, Daniel Vetter wrote:
> On Mon, Jan 31, 2022 at 2:48 PM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > On Thu, Jan 27, 2022 at 12:01:08PM -0800, Stephen Boyd wrote:
> > > The component framework only provides 'bind' and 'unbind' callbacks to
> > > tell the host driver that it is time to assemble the aggregate driver
> > > now that all the components have probed. The component framework doesn't
> > > attempt to resolve runtime PM or suspend/resume ordering, and explicitly
> > > mentions this in the code. This lack of support leads to some pretty
> > > gnarly usages of the 'prepare' and 'complete' power management hooks in
> > > drivers that host the aggregate device, and it fully breaks down when
> > > faced with ordering shutdown between the various components, the
> > > aggregate driver, and the host driver that registers the whole thing.
> > >
> > > In a concrete example, the MSM display driver at drivers/gpu/drm/msm is
> > > using 'prepare' and 'complete' to call the drm helpers
> > > drm_mode_config_helper_suspend() and drm_mode_config_helper_resume()
> > > respectively, so that it can move the aggregate driver suspend/resume
> > > callbacks to be before and after the components that make up the drm
> > > device call any suspend/resume hooks they have. This only works as long
> > > as the component devices don't do anything in their own 'prepare' and
> > > 'complete' callbacks. If they did, then the ordering would be incorrect
> > > and we would be doing something in the component drivers before the
> > > aggregate driver could do anything. Yuck!
> > >
> > > Similarly, when trying to add shutdown support to the MSM driver we run
> > > across a problem where we're trying to shutdown the drm device via
> > > drm_atomic_helper_shutdown(), but some of the devices in the encoder
> > > chain have already been shutdown. This time, the component devices
> > > aren't the problem (although they could be if they did anything in their
> > > shutdown callbacks), but there's a DSI to eDP bridge in the encoder
> > > chain that has already been shutdown before the driver hosting the
> > > aggregate device runs shutdown. The ordering of driver probe is like
> > > this:
> > >
> > >  1. msm_pdev_probe() (host driver)
> > >  2. DSI bridge
> > >  3. aggregate bind
> > >
> > > When it comes to shutdown we have this order:
> > >
> > >  1. DSI bridge
> > >  2. msm_pdev_shutdown() (host driver)
> > >
> > > and so the bridge is already off, but we want to communicate to it to
> > > turn things off on the display during msm_pdev_shutdown(). Double yuck!
> > > Unfortunately, this time we can't split shutdown into multiple phases
> > > and swap msm_pdev_shutdown() with the DSI bridge.
> > >
> > > Let's make the component_master_ops into an actual device driver that has
> > > probe/remove/shutdown functions. The driver will only be bound to the
> > > aggregate device once all component drivers have called component_add()
> > > to indicate they're ready to assemble the aggregate driver. This allows
> > > us to attach shutdown logic (and in the future runtime PM logic) to the
> > > aggregate driver so that it runs the hooks in the correct order.
> >
> > I know I asked before, but I can not remember the answer.
> >
> > This really looks like it is turning into the aux bus code.  Why can't
> > you just use that instead here for this type of thing?  You are creating
> > another bus and drivers for that bus that are "fake" which is great, but
> > that's what the aux bus code was supposed to help out with, so we
> > wouldn't have to write more of these.
> >
> > So, if this really is different, can you document it here so I remember
> > next time you resend this patch series?
> 
> aux takes a device and splits it into a lot of sub-devices, each with
> their own driver.
> 
> This takes a pile of devices, and turns it into a single logical
> device with a single driver.
> 
> So aux is 1:N, component is N:1.
> 
> And yes you asked this already, I typed this up already :-)

Ok, thanks.  But then why is a bus needed if there's a single driver?
I guess a bus for that driver?  So one bus, one driver, and one device?

I think we need better documentation here...

thanks,

greg k-h

  parent reply	other threads:[~2022-01-31 16:34 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 20:01 [PATCH v6 00/35] component: Make into an aggregate bus Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 01/35] component: Replace most references to 'master' with 'aggregate device' Stephen Boyd
2022-01-31 13:48   ` Greg Kroah-Hartman
2022-01-27 20:01 ` [PATCH v6 02/35] component: Introduce the aggregate bus_type Stephen Boyd
2022-01-31 13:48   ` Greg Kroah-Hartman
2022-01-31 15:15     ` Daniel Vetter
2022-01-31 15:32       ` Laurent Pinchart
2022-01-31 16:34       ` Greg Kroah-Hartman [this message]
2022-02-08 12:53         ` Daniel Vetter
2022-02-11  2:04           ` Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 03/35] component: Add aggregate_device_parent() for driver use Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 04/35] component: Add {bind,unbind}_component() ops that take aggregate device Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 05/35] drm/of: Add a drm_of_aggregate_probe() API Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 06/35] drm/msm: Migrate to aggregate driver Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 07/35] drm/komeda: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 08/35] drm/arm/hdlcd: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 09/35] drm/malidp: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 10/35] drm/armada: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 11/35] drm/etnaviv: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 12/35] drm/kirin: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 13/35] drm/exynos: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 14/35] drm/imx: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 15/35] drm/ingenic: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 16/35] drm/mcde: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 17/35] drm/mediatek: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 18/35] drm/meson: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 19/35] drm/omap: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 20/35] drm/rockchip: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 21/35] drm/sti: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 22/35] drm/sun4i: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 23/35] drm/tilcdc: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 24/35] drm/vc4: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 25/35] iommu/mediatek: " Stephen Boyd
2022-02-10 11:03   ` Yong Wu
2022-02-15 17:35     ` Krzysztof Kozlowski
2022-01-27 20:01 ` [PATCH v6 26/35] mei: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 27/35] power: supply: ab8500: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 28/35] fbdev: omap2: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 29/35] sound: hdac: " Stephen Boyd
2022-01-31  8:18   ` Takashi Iwai
2022-01-27 20:01 ` [PATCH v6 30/35] ASoC: codecs: wcd938x: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 31/35] drm/sprd: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 32/35] usb: typec: port-mapper: " Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 33/35] ALSA: hda/realtek: " Stephen Boyd
2022-01-28 15:31   ` Stefan Binding
2022-01-27 20:01 ` [PATCH v6 34/35] component: Get rid of drm_of_component_probe() Stephen Boyd
2022-01-27 20:01 ` [PATCH v6 35/35] component: Remove component_master_ops and friends Stephen Boyd

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=YfgPkliOLorgXwVE@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=robdclark@gmail.com \
    --cc=saravanak@google.com \
    --cc=swboyd@chromium.org \
    /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;
as well as URLs for NNTP newsgroup(s).