Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp164250pxk; Tue, 1 Sep 2020 19:59:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgFv7NVQyjPYm1TICQpKn0NEAYgyhFSrUEbk74nEAattwRBF5I11CRmDUr6/1B3tgDCc30 X-Received: by 2002:a17:906:15c2:: with SMTP id l2mr4246003ejd.112.1599015575357; Tue, 01 Sep 2020 19:59:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599015575; cv=none; d=google.com; s=arc-20160816; b=gZT/+zv3qTq1ATMdpQeY38xJg1f6s8rDZ9ypUHXAOL2/7G6jFnipnck3f/3JQ2IOrk /Onmb717fU5F2RN4p/dH8AHR7OCsKW+eqOVBPygt9fA0kJllXOXLHQXkx9c1e1NQM7mB hboG0fgohJtwyXJi9CJ7NYbP8eC2fQTqpQj0eapbsUGlRe0RSJNxmVpMNipFGX/Dkuap 7/OoneiLJ1htcdPUdFo4ywRjx9yK/jp3ul2yKonsD4OS3eCNF22gCzKDNHZ9UCyEKmQc Mt2M6NwtW72R3DRMt0SvVa7IDAdaYIxH+dKVrLrYgQQo1b2gRMUHqL35x4iwVez3xu6h qZug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=bzSDroBEiOtrejQbNCkB9sGj9PSCceI1g51raETiwPA=; b=UIpsBR3V9L47VFCQrIG1ESMEjUCbXru6+ucHs6ZOjkCDhDBxIUtaO6Ucn8XpTodpOZ 3Ed4QWF0ERV+l7MuUDcIDstrfVNXVW4i6+WzhtUfONsPZQmQAnKkqE1CzA2EiWOIU4wi ZJLMDFeQQJrDiywY99uC6+60q5PMlOoqLGJvjqGjHGCqwtmTV9Y3V8dn3P1p7T0VH1hd ykbg4ErP6RCqPUsyOs3TvVnPlxzDVP4BthIVckGQ0y8VFCP/CoCPDk9GTOe8LGfOvfL4 E23ta3yEBjLExvxU14j6kSyQvnWcROBtsqziuW0g7ys0j0OTkJICpIRq3PFkwcPm8/Tx ra8A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt21si2204158ejc.664.2020.09.01.19.59.12; Tue, 01 Sep 2020 19:59:35 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727049AbgIBC5C (ORCPT + 99 others); Tue, 1 Sep 2020 22:57:02 -0400 Received: from mga07.intel.com ([134.134.136.100]:49611 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727026AbgIBC4w (ORCPT ); Tue, 1 Sep 2020 22:56:52 -0400 IronPort-SDR: goHLiflEYzwN3XnpE3GrCgyuKVBjwvwHA1jy5y0arlHMhyeAbCi2UhRhpXruCPjQorxkfLK7/Q AlYnxkj+V7zw== X-IronPort-AV: E=McAfee;i="6000,8403,9731"; a="221528392" X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="221528392" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2020 19:56:52 -0700 IronPort-SDR: D6OE0swQDL37QvO/YL6AqCl1LAxeMK0F77bOVUE9z6krWZ+cb+iPvO6LJ/HhuRJzgBJkKuW8Pf pRtwguaR6+8w== X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="477457329" Received: from bard-ubuntu.sh.intel.com ([10.239.13.33]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2020 19:56:47 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@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: [PATCH 7/7] soundwire: intel: remove stream handling from .prepare and .hw_free Date: Tue, 1 Sep 2020 23:02:40 +0800 Message-Id: <20200901150240.19288-8-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200901150240.19288-1-yung-chuan.liao@linux.intel.com> References: <20200901150240.19288-1-yung-chuan.liao@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart Now that the stream is handled at the dai-link level (in the machine driver), we can remove the stream handling at the dai level. We still need these callbacks to perform dai-level resource handling (i.e. addition/removal of a master). Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 39d3186335ac..631c425ba430 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -931,7 +931,7 @@ static int intel_prepare(struct snd_pcm_substream *substream, struct sdw_intel *sdw = cdns_to_intel(cdns); struct sdw_cdns_dma_data *dma; int ch, dir; - int ret; + int ret = 0; dma = snd_soc_dai_get_dma_data(dai, substream); if (!dma) { @@ -967,13 +967,8 @@ static int intel_prepare(struct snd_pcm_substream *substream, dma->hw_params, sdw->instance, dma->pdi->intel_alh_id); - if (ret) - goto err; } - ret = sdw_prepare_stream(dma->stream); - -err: return ret; } @@ -989,12 +984,12 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) if (!dma) return -EIO; - ret = sdw_deprepare_stream(dma->stream); - if (ret) { - dev_err(dai->dev, "sdw_deprepare_stream: failed %d", ret); - return ret; - } - + /* + * The sdw stream state will transition to RELEASED when stream-> + * master_list is empty. So the stream state will transition to + * DEPREPARED for the first cpu-dai and to RELEASED for the last + * cpu-dai. + */ ret = sdw_stream_remove_master(&cdns->bus, dma->stream); if (ret < 0) { dev_err(dai->dev, "remove master from stream %s failed: %d\n", -- 2.17.1