--- Begin Message ---
- To: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>, vkoul@xxxxxxxxxx
- Subject: Re: [PATCH V6 8/8] soundwire: amd: add pm_prepare callback and pm ops support
- From: "Mukunda,Vijendar" <vijendar.mukunda@xxxxxxx>
- Date: Wed, 8 Mar 2023 01:55:39 +0530
- Cc: alsa-devel@xxxxxxxxxxxxxxxx, Basavaraj.Hiregoudar@xxxxxxx, Sunil-kumar.Dommati@xxxxxxx, Mario.Limonciello@xxxxxxx, amadeuszx.slawinski@xxxxxxxxxxxxxxx, Mastan.Katragadda@xxxxxxx, Arungopal.kondaveeti@xxxxxxx, claudiu.beznea@xxxxxxxxxxxxx, Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>, Sanyog Kale <sanyog.r.kale@xxxxxxxxx>, open list <linux-kernel@xxxxxxxxxxxxxxx>
- In-reply-to: <4330af6a-ce97-53ed-f675-6d3d0ac8f32f@linux.intel.com>
- References: <20230307133135.545952-1-Vijendar.Mukunda@amd.com> <20230307133135.545952-9-Vijendar.Mukunda@amd.com> <4330af6a-ce97-53ed-f675-6d3d0ac8f32f@linux.intel.com>
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1
On 07/03/23 20:58, Pierre-Louis Bossart wrote:
>> +static int amd_resume_child_device(struct device *dev, void *data)
>> +{
>> + struct sdw_slave *slave = dev_to_sdw_dev(dev);
>> + int ret;
>> +
>> + if (!slave->probed) {
>> + dev_dbg(dev, "skipping device, no probed driver\n");
>> + return 0;
>> + }
>> + if (!slave->dev_num_sticky) {
>> + dev_dbg(dev, "skipping device, never detected on bus\n");
>> + return 0;
>> + }
>> + if (!pm_runtime_suspended(dev))
>> + return 0;
>> + ret = pm_request_resume(dev);
> I still don't get why the test above was needed. It's racy and brings
> limited benefits.
As explained below thread,
https://lore.kernel.org/lkml/acd3a560-1218-9f1d-06ec-19e4d3d4e2c9@xxxxxxx
Our scenario is multiple peripheral devices are connected
over the same link.
In our implementation, device_for_each_child() function invokes
amd_resume_child_device callback for each child.
When any one of the child device is active, It will break the
iteration, which results in failure resuming all child devices.
If we skip , pm_suspended check , it will not resume all
peripheral devices when any one of the peripheral device is active.
>
>> + if (ret < 0)
>> + dev_err(dev, "pm_request_resume failed: %d\n", ret);
>> +
>> + return ret;
>> +}
--- End Message ---