Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp118283pxu; Tue, 24 Nov 2020 21:09:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhodFs92pxx/j4Nh1eyEJjNdnmU+WnJIg9DP+ENd8YzOcP5PAIabNkJvmML2iw1FgKyLV8 X-Received: by 2002:a17:906:7690:: with SMTP id o16mr1557585ejm.159.1606280998965; Tue, 24 Nov 2020 21:09:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606280998; cv=none; d=google.com; s=arc-20160816; b=v0IU81NnYuULfTWUrHbJR7cFYmVzd7PEjIWdwAGitMlPMIAg5A21Xc5S+nffmN7XxQ 9QTlToNzS1D0tsyFRC4jFdcP6sk5IRLk6ex6rwv8jNtU1jaLtvcba5mdBw59GdnDlsjQ 1NVtvCbZ+yT7+jMZGJ43UmZFg3v47rLLe/bxzU3SFEHAIw35XjMoMnvsmVraptHK86ev jjoO5V1+t+sOUzjGN+WCT9CN427YPyBrw1N/KLRlNM6fwkxvVl+m+j/ZINEKkh3V/uM/ DaOlcv8cqApHGi0OhX37GwKiKBTscPf2/76wnsqZ2Zq/rJ93owR8LCmLA8kPNPfIJA00 EPgA== 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=OgTH638z8g4qRJU1NMWFqOs8KkWvTcLpQ9RIhACU3rs=; b=GPHsY9FrvMjVhYalRZEoL+15KIQa8S516m7k0fx4psEf3KpSkBrul52xWk0gAX/eUS WMOZmdQYeS6VOsC9XccNbTSbTVqKZKKexBEDGFPLZgWxwY4RKlqC7jXrvMKquM2CSA1t WiZjoyAMjF9f9y17rpoVzJJJQQqm3XY5URYX0CqpHRYrd9OIst3QWNg6rPPbGhMmj8OT ceVUHXRuA/3ojYi90VuIBmK2GLqYmw31XxIazSlZ7hohdqgKRgj8CDi7XcHmWTmHa2rG yJ+FiHklOmxgRrIeH8VLlNgOWQO4JjU7Ib2HxRnSscn0huKgXIiECAUVw51L+7JgVU7U 3HmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kaxDI2pc; 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 u11si625486eja.365.2020.11.24.21.09.35; Tue, 24 Nov 2020 21:09:58 -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=kaxDI2pc; 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 S1726009AbgKYFFf (ORCPT + 99 others); Wed, 25 Nov 2020 00:05:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:33118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725835AbgKYFFf (ORCPT ); Wed, 25 Nov 2020 00:05:35 -0500 Received: from localhost (unknown [122.179.120.21]) (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 F0C312075A; Wed, 25 Nov 2020 05:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606280734; bh=OQivpyeKMz4JHTOLZeqk0jAOobpDhVdKkjY2Gy+r8VA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kaxDI2pcNpXJ643EHknXHl3rHCWh49qRo2CtOIUkY+YIkwvvhfmrLku1NdEHYpb9n yk4Y++tty12lSbOPHuEarrh/sg2q92xfp2YMU1LbVH9OyqcvgGIBQ5AYDJcVkaNTX5 OyY+he6dFIiKj0vzpCYgaEnbAYwOQbO4PrbNbfiM= Date: Wed, 25 Nov 2020 10:35:28 +0530 From: Vinod Koul 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, sanyog.r.kale@intel.com, mengdong.lin@intel.com, bard.liao@intel.com Subject: Re: [PATCH] soundwire: master: use pm_runtime_set_active() on add Message-ID: <20201125050528.GC8403@vkoul-mobl> References: <20201124130742.10986-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201124130742.10986-1-yung-chuan.liao@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks -- ~Vinod