Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp412035pxu; Thu, 26 Nov 2020 01:42:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJw4Z2aSat+jO/Jnhn+CUju5FQGropPi/J1uZ6oU37bXmftTYOU7ZRnIcJ8XIImAFwYwO99U X-Received: by 2002:aa7:d0c7:: with SMTP id u7mr1716739edo.137.1606383770748; Thu, 26 Nov 2020 01:42:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606383770; cv=none; d=google.com; s=arc-20160816; b=Eh1wce8AlJM18uQ1utyjPiwqKXp014TzUdWxygL33zAN8NoHvkhub9gAjr/aqs1U+I UzOarvWRCYCdDkDL+34qX5kfTbQVj8X0yWM/EpOF07a828IdyvmMEVr3bwHi/Md4isUs bhI/41qGCmgSginsNg+jPQKNc8qwNbouZBdc9XQ6oLxbab+6swdDKujWMrxe7SnJgwRG A0tKBBEQRszuHuWTJR+wBIdnp08Cneg2JsYskxJpjiw1QnwKJAj4fsyx0WeanZ/zQf6C Ak/AqmYz23FSMsTuVJZoBmka79iZLr1YDH/VCO1yOPHohp2d/Ea1Wb+oyfLUViru94cm P0OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IhphCBu5mCDsMiQRw8xSgoEFWzyc04M+Mc63jOmfY+E=; b=iYIhhWbO4jEdDlR65pa16hK/6jlKen17FDmbCBPfX5PsKwbpaFWdBd98Qcve/8tiBK jre6cwt7dBrOR4QVhF3aNyeh0NBTqIgV/RSPJ6qFOyB957VcWjFigQWvycJqrI1OBXhb cM+fi/FWIFR+QPmOJ6saA/Ec4qF8un4xSoFGHl/4b8l9O9SOo8SijBjEaaach8gIIGEq 8gTAOYWqfQjl4wZ5a8XqnVcYBeMnLHuUg5jTxUc+tmoaDL/4e1k1DGiDYsfRZBnuVwkS 9DFkmjH/LaRVufE5aRpWDGenzVthhMRKzn7TKRNOlh9+w6rVMEqb8wAhUPdcQIoHPw7D 7WHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yjiLoMq8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y16si2618900ejp.532.2020.11.26.01.42.27; Thu, 26 Nov 2020 01:42:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yjiLoMq8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387568AbgKZEW2 (ORCPT + 99 others); Wed, 25 Nov 2020 23:22:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:55704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387541AbgKZEW2 (ORCPT ); Wed, 25 Nov 2020 23:22:28 -0500 Received: from localhost (unknown [122.179.79.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FE46206B7; Thu, 26 Nov 2020 04:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606364547; bh=lPPiTGMeU8PpU5mX6yzjCp594S3qDNomjgsxTVj3DMc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=yjiLoMq8FjTpL1Qf8n5/xSWCYAhU98rLyyh6jPTL8jCx+EfjcNxYxLGdvir2CVMl5 BvimTMbxfi55nSDDAkUnZgfzxxBbTOOVWvHSuC+ZifX6xrHWEFEByX6nqI1NphZx61 lHMZ6ltA0iROGuysgVk8DA3xngKQpLfZ1zf5HFho= Date: Thu, 26 Nov 2020 09:52:22 +0530 From: Vinod Koul To: "Liao, Bard" Cc: Bard Liao , "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" , "gregkh@linuxfoundation.org" , "jank@cadence.com" , "srinivas.kandagatla@linaro.org" , "rander.wang@linux.intel.com" , "ranjani.sridharan@linux.intel.com" , "hui.wang@canonical.com" , "pierre-louis.bossart@linux.intel.com" , "Kale, Sanyog R" , "Lin, Mengdong" Subject: Re: [PATCH] soundwire: master: use pm_runtime_set_active() on add Message-ID: <20201126042222.GG8403@vkoul-mobl> References: <20201124130742.10986-1-yung-chuan.liao@linux.intel.com> <20201125050528.GC8403@vkoul-mobl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26-11-20, 03:11, Liao, Bard wrote: > > -----Original Message----- > > From: Vinod Koul > > Sent: Wednesday, November 25, 2020 1:05 PM > > To: Bard Liao > > Cc: alsa-devel@alsa-project.org; linux-kernel@vger.kernel.org; > > gregkh@linuxfoundation.org; jank@cadence.com; > > srinivas.kandagatla@linaro.org; rander.wang@linux.intel.com; > > ranjani.sridharan@linux.intel.com; hui.wang@canonical.com; pierre- > > louis.bossart@linux.intel.com; Kale, Sanyog R ; Lin, > > Mengdong ; Liao, Bard > > Subject: Re: [PATCH] soundwire: master: use pm_runtime_set_active() on > > add > > > > On 24-11-20, 21:07, Bard Liao wrote: > > > From: Pierre-Louis Bossart > > > > > > The 'master' device acts as a glue layer used during bus > > > initialization only, and it needs to be 'transparent' for pm_runtime > > > management. Its behavior should be that it becomes active when one of > > > its children becomes active, and suspends when all of its children are > > > suspended. > > > > > > In our tests on Intel platforms, we routinely see these sort of > > > warnings on the initial boot: > > > > > > [ 21.447345] rt715 sdw:3:25d:715:0: runtime PM trying to activate > > > child device sdw:3:25d:715:0 but parent (sdw-master-3) is not active > > > > > > This is root-caused to a missing setup to make the device 'active' on > > > probe. Since we don't want the device to remain active forever after > > > the probe, the autosuspend configuration is also enabled at the end of > > > the probe - the device will actually autosuspend only in the case > > > where there are no devices physically attached. In practice, the > > > master device will suspend when all its children are no longer active. > > > > > > Fixes: bd84256e86ecf ('soundwire: master: enable pm runtime') > > > Signed-off-by: Pierre-Louis Bossart > > > > > > Reviewed-by: Rander Wang > > > Signed-off-by: Bard Liao > > > --- > > > drivers/soundwire/master.c | 14 ++++++++++++++ > > > 1 file changed, 14 insertions(+) > > > > > > diff --git a/drivers/soundwire/master.c b/drivers/soundwire/master.c > > > index 3488bb824e84..9b05c9e25ebe 100644 > > > --- a/drivers/soundwire/master.c > > > +++ b/drivers/soundwire/master.c > > > @@ -8,6 +8,15 @@ > > > #include #include "bus.h" > > > > > > +/* > > > + * The 3s value for autosuspend will only be used if there are no > > > + * devices physically attached on a bus segment. In practice enabling > > > + * the bus operation will result in children devices become active > > > +and > > > + * the master device will only suspend when all its children are no > > > + * longer active. > > > + */ > > > +#define SDW_MASTER_SUSPEND_DELAY_MS 3000 > > > + > > > /* > > > * The sysfs for properties reflects the MIPI description as given > > > * in the MIPI DisCo spec > > > @@ -154,7 +163,12 @@ int sdw_master_device_add(struct sdw_bus *bus, > > struct device *parent, > > > bus->dev = &md->dev; > > > bus->md = md; > > > > > > + pm_runtime_set_autosuspend_delay(&bus->md->dev, > > SDW_MASTER_SUSPEND_DELAY_MS); > > > + pm_runtime_use_autosuspend(&bus->md->dev); > > > + pm_runtime_mark_last_busy(&bus->md->dev); > > > + pm_runtime_set_active(&bus->md->dev); > > > pm_runtime_enable(&bus->md->dev); > > > + pm_runtime_idle(&bus->md->dev); > > > > I understand that this needs to be done somewhere but is the core the right > > place. In intel case it maybe a dummy device but other controllers are real > > devices and may not support pm. > > > > I think better idea would be to do this in respective driver.. that way it > > would be an opt-in for device supporting pm. > > Should it be put in the same place as pm_runtime_enable? > IMHO, pm_runtime_enable is in the core already and it seems to be harmless > for devices which don't support pm. And pm can still be optional on md's > parent device. For intel case yes, but world is not only intel, there are md which do not have a parent like sof. they are real sdw controller devices -- ~Vinod