lkml.org 
[lkml]   [2020]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/8] soundwire: bus_type: add master_device/driver support
From
Date


>>> 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.
There are two other related issues that you didn't mention.

the ASoC layer does require a driver with a 'name' for the components
registered with the master device. So if you don't have a driver for the
master device, the DAIs will be associated with the PCI device.

But the ASoC core does make pm_runtime calls on its own,

soc_pcm_open(struct snd_pcm_substream *substream)
{
...
for_each_rtd_components(rtd, i, component)
pm_runtime_get_sync(component->dev);

and if the device that's associated with the DAI is the PCI device, then
that will not result in the relevant master IP being activated, only the
PCI device refcount will be increased - meaning there is no hook that
would tell the PCI layer to turn on a specific link.

What you are recommending would be an all-or-nothing solution with all
links on or all links off, which beats the purpose of having independent
link-level power management.

Given these limitations, I am not willing to change directions on power
management. We have a tried-and-tested solution, backed by months of
validation, and you are sending down an unproven path with your suggestion.

So what are the options?

a) stay with the current approach and platform devices. Greg's vetoed
this so we can move to the next one.

b) use a solution similar to what we suggested back in October, and very
similar to the GreyBus host device, which creates a master device but
did not require a full-blown master_driver, it only uses the name and
pm_ops fields of the raw driver structure, which is all we really need.

the basic usage from the PCI layer was

struct driver {
.name = "my-driver",
.pm_ops = &my_ops,
} my_driver;

md = sdw_master_device_add(&my_driver, parent, fw_node, link_id)

and all the rest is platform-specific/optional.

sdw_intel_master_device_init(md);
allocations and call to sdw_bus_master_add()
sdw_intel_master_device_startup(md);
hardware enablement
sdw_intel_master_device_wake_process(md).
deal with wake information coming from PCI layer.

We liked this solution since it was as simple as can be, but you
rejected it on the grounds that the probe/init should be handled "by the
core" to quote your own words, but looking back it may be the best
solution for all. There is no additional overhead, and it deals with
both the ALSA name requirement and lets us us power management. If you
don't have power management at the link level you don't have to use the
pm_ops.

c) use the proposal in this patch with a more elaborate driver handling.
Yes it requires a full-blown driver with callbacks but it addresses your
prior feedback that the core handles the probe/remove operations.

All these solutions are proven to work. Pick one.

If you want to suggest another, then please provide a pseudo API and
address the non-negotiable requirement of independent link-level power
management.

Thanks
-Pierre








\
 
 \ /
  Last update: 2020-03-06 22:06    [W:0.175 / U:0.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site