Re: [PATCH 1/8] soundwire: bus_type: add master_device/driver support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05-03-20, 06:46, Pierre-Louis Bossart wrote:
> 
> > > If you want a technical objection, let me restate what I already mentioned:
> > > 
> > > If you look at the hierarchy, we have
> > > 
> > > PCI device -> PCI driver
> > >    soundwire_master_device0
> > >       soundwire_slave(s) -> codec driver
> > >    ...
> > >    soundwire_master_deviceN
> > >       soundwire_slave(s) -> codec driver
> > > 
> > > You have not explained how I could possibly deal with power management
> > > without having a driver for the master_device(s). The pm_ops need to be
> > > inserted in a driver structure, which means we need a driver. And if we need
> > > a driver, then we might as well have a real driver with .probe .remove
> > > support, driver_register(), etc.
> > 
> > Please read the emails sent to you completely, including the reply on
> > 2nd patch of this series. I think i am repeating this 3rd or 4th time
> > now.  Am going to repeat this info here to help move things.
> > 
> > Why do you need a extra driver for this. Do you have another set of
> > device object and driver for DSP code? But you do manage that, right?
> > I am proposing to simplify the device model here and have only one
> > device (SOF PCI) and driver (SOF PCI driver), which is created by actual
> > bus (PCI here) as you have in rest of the driver like HDA, DSP etc.
> > 
> > I have already recommended is to make the int-sdw a module which is
> > invoked by SOF PCI driver code (thereby all code uses SOF PCI device and
> > SOF PCI driver) directly. The DSP in my time for skl was a separate
> > module but used the parent objects.
> >
> > The SOF sdw init (the place where sdw routines are invoked after DSP
> > load) can call sdw_probe and startup. Based on DSP sequencing you can
> > call these functions directly without waiting for extra device to be
> > probed etc.
> > 
> > I feel your flows will be greatly simplified as a result of this.
> 
> Not at all, no. This is not a simplification but an extremely invasive
> proposal.
> 
> The parent-child relationship is extremely useful for power management, and
> guarantees that the PCI device remains on while one or more of the masters
> are used, and conversely can suspend when all links are idle. I currently
> don't need to do anything, it's all taken care of by the framework.
> 
> If I have to do all the power management at the PCI device level, then I
> will need to keep track of which links are currently active. All these links
> are used independently, so it's racy as hell to keep track of the usage when
> the pm framework already does so quite elegantly. You really want to use the
> pm_runtime_get/put refcount for each master device, not manage them from the
> PCI level.

Not at all, you still can call pm_runtime_get/put() calls in sdw module
for PCI device. That doesn't change at all.

Only change is for suspend/resume you have callbacks from PCI driver
rather than pm core.

> I might add that I don't see the logic in having pm support at the Slave
> device level, but not at the master, and again at the PCI level. It's just
> simpler to handle pm at each level rather that fudge layers.
> 
> I would also remind you that the solution you developed while at Intel did
> in fact use the parent-child relationship for power management, and I
> remember very clearly having discussions with you on this. I don't see why
> replacing platform devices by master devices should change this design
> choice.

That was with the premise of a platform device, since that is no longer
the case, we have to adapt.

But you still have PCI->master dev->slave relation and actually not much
changes wrt that. You still need to enable pm for master device. Only
change in that master_dev will not have pm_ops. Again, it is same for
i2c/spi where we have pci|of dev -> adapter dev -> i2c dev.

> > Second issue of PM:
> >   You do manage the DSP PM right? Similar way.
> > So here I would expect you to add functions/callbacks from SOF driver to
> > this module and call PM routines from SOF PM routines allowing you to
> > suspend/resume. Similar way DSP used to be managed.  Something like:
> > .sdw_suspend .sdw_resume functions/callbacks which will do sdw specific
> > pm configurations. You do not need module specific pm_ops, you can do
> > the required steps in callbacks from SOF driver
> > 
> > Bonus, this can be tuned and called at the specific places in DSP
> > suspend/resume flow, which is something I suspect you would want.
> 
> No. The links can only be resumed when the DSP is fully powered. We've tried
> all sorts of optimizations already and worked with the hardware team on
> this.

And you can call links _exactly_ when DSP is up and additional
optimizations applied. You are not reliant on core sequencing.

> > For places which need dev/driver objects like sdw dai's please pass the
> > SOF PCI dev object.
> > 
> > Is there any other technical reason left unexplored/unexplained?
> > 
> > > I really don't see what's broken or unnecessary with these patches.
> > 
> > Adding a layer for Intel in common code is unnecessary IMO. As
> > demonstrated above you can use the intel specific callback to do the
> > same task in intel specific way. I would very much prefer that approach
> > to solve this
> > 
> > We definitely need a sdw_master_device for everyone, but I don't believe
> > we need a sdw_master_device for Intel or anyone else.
> 
> I will flip the argument: you can implement a lightweight master driver in
> no time. All you need is to move the code you currently have in the platform
> device .probe() to the master_device .probe(). Big deal, the overhead is
> negligible - and you don't need to add pm_ops if you don't need to.

And in that case will you have use for sdw_master_driver?

> I would add that you cannot possibly compare the two implementations.
> 
> Qualcomm has an extremely simple SoundWire link optimized for 2 PDM
> amplifiers connected to a SLIMbus codec, with a fixed bit allocation. There
> is currently no power management for this link.

Not upstream but planned to be implemented. And assumption above may not
be true always esp future chipsets. More support will come eventually
but none of that warrants the need of a sdw_master_driver.

> Intel has 4 links running in parallel and synchronized in hardware, with
> complicated power management, different flavors of clock-stop - some not
> controlled by the driver but by DSP firmware - , 5 hardware configurations
> (more coming) and 6 third-party devices (more coming).

Number of links are inconsequential to soundwire. For us it is just an
instance.

> You've got to give us some slack here, and leave us handle power management
> in the simplest possible way.

I still do not agree that it will cause additional complexities for you.

Thanks
-- 
~Vinod



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux