From nobody Wed Sep 17 21:04:02 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B5DFC4332F for ; Thu, 15 Dec 2022 08:49:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229639AbiLOIth (ORCPT ); Thu, 15 Dec 2022 03:49:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbiLOItZ (ORCPT ); Thu, 15 Dec 2022 03:49:25 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4DCB2C679 for ; Thu, 15 Dec 2022 00:49:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671094161; x=1702630161; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Xb6HAMTOE8XGB+he/8crvLmIoKFamiSOnJ54h1Bx0Vg=; b=kqsGuQJhe/RQNhgnTxLn1446RoK2TMLkvc7D1CBJkh2SVmY+rRxPHxB6 OgfSBbfkAljnn324yvdpekD+AaJiFj305NCtxzcZW2Idw3Ij9NXEzxcLq BfctbE92Kn8sOGUG5NwKzY19e8Akd7WpSBVqqYfP2ayydPsPxCFehL1WJ 8fzi+2WM4ZmgDhB0k+2TljsLKaf8U0HM9FsF951/I9yTdp23UHKRYi8Rk paAFMFhfStO4dAu8ZzpEwxWp4b25mvhYsqvtcZdUgElRmZVARIEUf2k7h /KP+BGVDoAH9O/TL6g79WxjqZr5M9qvQvcmAwvCk3WxQ5S3kjqkLuQjvM A==; X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="345712034" X-IronPort-AV: E=Sophos;i="5.96,246,1665471600"; d="scan'208";a="345712034" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 00:49:21 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="627091306" X-IronPort-AV: E=Sophos;i="5.96,246,1665471600"; d="scan'208";a="627091306" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 00:49:18 -0800 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH] soundwire: intel: remove DAI startup/shutdown Date: Thu, 15 Dec 2022 16:54:36 +0800 Message-Id: <20221215085436.2001568-1-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart The only thing these DAI startup/shutdown callbacks do is play with pm_runtime reference counts. This is not wrong, but it's not necessary at all. At the ASoC core level, only the component matters for pm_runtime. The ASoC core already calls pm_runtime_get_sync() in snd_soc_pcm_component_pm_runtime_get(), before the DAI startup callback is invoked. None of the SoundWire codec drivers rely on pm_runtime helpers in their DAI startup/shutdown either. This adds to the evidence that only the component, or more precisely the device specified when registering a component, should deal with pm_runtime transitions. Beyond the code cleanup, this move prepares for the addition of link power management in the auxiliary device startup/resume/suspend callbacks. The DAI callbacks can by-design assume that the device is already pm_runtime active. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index bc9c50bacc49..2651767272c7 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -778,22 +778,6 @@ static int intel_post_bank_switch(struct sdw_intel *sd= w) * DAI routines */ =20 -static int intel_startup(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) -{ - struct sdw_cdns *cdns =3D snd_soc_dai_get_drvdata(dai); - int ret; - - ret =3D pm_runtime_resume_and_get(cdns->dev); - if (ret < 0 && ret !=3D -EACCES) { - dev_err_ratelimited(cdns->dev, - "pm_runtime_resume_and_get failed in %s, ret %d\n", - __func__, ret); - return ret; - } - return 0; -} - static int intel_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) @@ -954,15 +938,6 @@ intel_hw_free(struct snd_pcm_substream *substream, str= uct snd_soc_dai *dai) return 0; } =20 -static void intel_shutdown(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) -{ - struct sdw_cdns *cdns =3D snd_soc_dai_get_drvdata(dai); - - pm_runtime_mark_last_busy(cdns->dev); - pm_runtime_put_autosuspend(cdns->dev); -} - static int intel_pcm_set_sdw_stream(struct snd_soc_dai *dai, void *stream, int direction) { @@ -1088,12 +1063,10 @@ static int intel_component_dais_suspend(struct snd_= soc_component *component) } =20 static const struct snd_soc_dai_ops intel_pcm_dai_ops =3D { - .startup =3D intel_startup, .hw_params =3D intel_hw_params, .prepare =3D intel_prepare, .hw_free =3D intel_hw_free, .trigger =3D intel_trigger, - .shutdown =3D intel_shutdown, .set_stream =3D intel_pcm_set_sdw_stream, .get_stream =3D intel_get_sdw_stream, }; --=20 2.25.1