From patchwork Wed Jul 24 16:24:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 169618 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp10465018ilk; Wed, 24 Jul 2019 09:24:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMfrWMfJM5Xg/0WUJy+kA4jNMm3K71B1PSp8aPlZa6x/FMEa/E6QDS1A0/9YdiGUg/nlcM X-Received: by 2002:a17:902:16f:: with SMTP id 102mr83514742plb.94.1563985473560; Wed, 24 Jul 2019 09:24:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563985473; cv=none; d=google.com; s=arc-20160816; b=q9OM1zYEjieF5p92rysJ4GbYMxLyFC+/k6h+gQR3tAbcpwGXMETwwpzoOg3vB5VR3w JZ8GCIpln/PvugtP/nNsa1+JIRtw37llCiiq/zoN0O0s6YhbDyr5kCU9rIeKOIe+ydWk RgLEUnb+BNYNzj/OKLe4XWshR2Rn9J/Qw+YzXyN9Yua+7xFUuXH90YlOGHiquGfgoQMU 78qO6R/tAtC01lZy/TJ95FuofT/0NQtJREkYjy8XKIfWlElXQrM7TmyNFzz/GH4BFSK8 Qjn8396EkX/AxPw1ssQbGjUW34wfI8N3TvcSgIubxK7GvdC67fyalRyAjUzNcJmrymlD xwuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ocUEQSXynTuFhR8u/rePjf3f/sB3eXLVGjV4BtMdyVs=; b=TD7Mb3cjIOOFMlauZMEzscjyKodVe4+0BPgs+YVuBr1hiI+yRkuXcGSRKrRyBty1gu W7sQaNnjfNSvv/jNqBt6XqPFd0PYiCp9TbKE3KLSsX+bZHyEzgztntr2H+qhaxDmtUK1 T8fOFGD4o4OYqDCV9FsfYJDnqzwkmapNvBmxGfKnazhYZYidjvRz04rJ2+XVzea86zYc YkGIB4fPVRFW3Ld358gl089kUPp7I0AgGeNV+plW5QICBu0XGRV98p0eshJ7q9zI/3BD TOpoS9vK9uImJjce9+VA0pvlQpLj1g1Zmwd2MHtNEjFiVFCATl4N+0B+HXqn4K+hgfE8 tDgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=T0XHmH7f; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k14si12860870pjq.53.2019.07.24.09.24.33; Wed, 24 Jul 2019 09:24:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=T0XHmH7f; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728787AbfGXQYQ (ORCPT + 29 others); Wed, 24 Jul 2019 12:24:16 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:39215 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728749AbfGXQYN (ORCPT ); Wed, 24 Jul 2019 12:24:13 -0400 Received: by mail-wm1-f66.google.com with SMTP id u25so31815946wmc.4 for ; Wed, 24 Jul 2019 09:24:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ocUEQSXynTuFhR8u/rePjf3f/sB3eXLVGjV4BtMdyVs=; b=T0XHmH7fMTKgxRE+sBpYoKeEOwc7aBtGRsTgi4fQxLrOEfcW0U1YUrrDIw3Rn8GfcX lhkdzqNgssqMuQEo4DlEKUn+PqiRDTIY4NzwiQSGNCWQYJT4nWBscmNenvtx/y77qByz O8J4L/61kEPly3Vt5mbDYBXjERECUfgji3eBFFbA6oDgkOQBZ8258HWGNKxps1E1ytBc yhcCI72ckTJOjSU/9LYbSvhgbXuhl++XmTvK3k18dhhjOxg4/KAzDMeMlj+t7BdxUBl4 j/DDcIcHQnT2kaq7UbX8BV78x4zpvLXHqdaoHZc5oUhkEUtplY4+LLtmUNuYSRCw2Q2N fe6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ocUEQSXynTuFhR8u/rePjf3f/sB3eXLVGjV4BtMdyVs=; b=MvlD32upCuzfc3n6Vci8W8jQzOjsYeOBsZOA5DX8DyYUkx24h/LrXnJWrxiFcqvt9p CMK34vqFQs7wxvZ/nG6etQpK/eWCtuZyf3AFX2PNtUhqWKDyXEY0NuHPHZSPgEvArTP3 EuuURSmub22TM7JYLmn4kvUjjdecnlC6BMTvK48oG/mNTRd0ZcLt9jNfEcyxQZMJW63f /eutasOWAaiOb/wu3LgcTvAE5a8AAbRyIMY6c+3+saG8MU1Pt6yz9btWGlMr+TyIK+60 hMAlsgpmu/aB5tGO3bvaVQhJRk3nl90usmvRPM7jPQpZJ11r/RbSOJk3nV5PqfDf/Yke ECCA== X-Gm-Message-State: APjAAAUs18wUklQBH6zUZyLIItsu4cbsty5RPI8ohVLU5nU4U6fy0sBF ynUgEYFKsfdkmqkUmGMa59/Idg== X-Received: by 2002:a1c:f409:: with SMTP id z9mr4986239wma.176.1563985450593; Wed, 24 Jul 2019 09:24:10 -0700 (PDT) Received: from starbuck.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id f70sm55688960wme.22.2019.07.24.09.24.09 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 24 Jul 2019 09:24:09 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood , Kevin Hilman Cc: Jerome Brunet , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 1/6] ASoC: codec2codec: run callbacks in order Date: Wed, 24 Jul 2019 18:24:00 +0200 Message-Id: <20190724162405.6574-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190724162405.6574-1-jbrunet@baylibre.com> References: <20190724162405.6574-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When handling dai_link events on codec to codec links, run all .startup() callbacks on sinks and sources before running any .hw_params(). Same goes for hw_free() and shutdown(). This is closer to the behavior of regular dai links Signed-off-by: Jerome Brunet --- sound/soc/soc-dapm.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) -- 2.21.0 diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 1d04612601ad..5348abda7ce2 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3835,11 +3835,6 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, goto out; } source->active++; - ret = snd_soc_dai_hw_params(source, &substream, params); - if (ret < 0) - goto out; - - dapm_update_dai_unlocked(&substream, params, source); } substream.stream = SNDRV_PCM_STREAM_PLAYBACK; @@ -3853,7 +3848,24 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, goto out; } sink->active++; - ret = snd_soc_dai_hw_params(sink, &substream, params); + } + + substream.stream = SNDRV_PCM_STREAM_CAPTURE; + snd_soc_dapm_widget_for_each_source_path(w, path) { + source = path->source->priv; + + ret = soc_dai_hw_params(&substream, params, source); + if (ret < 0) + goto out; + + dapm_update_dai_unlocked(&substream, params, source); + } + + substream.stream = SNDRV_PCM_STREAM_PLAYBACK; + snd_soc_dapm_widget_for_each_sink_path(w, path) { + sink = path->sink->priv; + + ret = soc_dai_hw_params(&substream, params, sink); if (ret < 0) goto out; @@ -3889,9 +3901,18 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, substream.stream = SNDRV_PCM_STREAM_CAPTURE; snd_soc_dapm_widget_for_each_source_path(w, path) { source = path->source->priv; - snd_soc_dai_hw_free(source, &substream); + } + substream.stream = SNDRV_PCM_STREAM_PLAYBACK; + snd_soc_dapm_widget_for_each_sink_path(w, path) { + sink = path->sink->priv; + snd_soc_dai_hw_free(sink, &substream); + } + + substream.stream = SNDRV_PCM_STREAM_CAPTURE; + snd_soc_dapm_widget_for_each_source_path(w, path) { + source = path->source->priv; source->active--; snd_soc_dai_shutdown(source, &substream); } @@ -3899,9 +3920,6 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, substream.stream = SNDRV_PCM_STREAM_PLAYBACK; snd_soc_dapm_widget_for_each_sink_path(w, path) { sink = path->sink->priv; - - snd_soc_dai_hw_free(sink, &substream); - sink->active--; snd_soc_dai_shutdown(sink, &substream); }