Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp774477ybn; Tue, 24 Sep 2019 09:17:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJUj6dRIhrqyGsU34hoi4oDZXntLsnSSg+w/G2AJ9bm1ZUV7E3pj/WWQrSm+qirs34F2af X-Received: by 2002:a17:906:e92:: with SMTP id p18mr3278668ejf.308.1569341847436; Tue, 24 Sep 2019 09:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569341847; cv=none; d=google.com; s=arc-20160816; b=t8KVTDP8A3PfdJpIfEuGh2Zenoxbc5lr7zbCJDHvAviSJiQ+yKoh35eQlj7c6n4Giu I9jKPIO4b6W50ju/yR5ILF3O2Nd/nQVGJHPGIUzNXlqQt43H8k0QM/Y1eTRps8uc0cvV m02zQxLu3n6al/URVxIn6XU207ADgtGxGjaLbWcjvnCWlfursjMkU7stxUYQJ9FLSmeL sGrEz8lbFDNi3guUB4hFap9VLz6eFWHxhWdZSXNv4QFvfPVwQvaQnUyHdhzNB25CdpmA ls80OHBB8COtnF4XrNGibZzS7uph8BaDwunNUs/g7EWVvWYdcmeFuIlwehdnzsBDo/cH o+4g== 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=YIjgznuL/rGdxX1rg/izjacuPBhxzjWYOtiz0Wn8zq0=; b=tzS4LlUnnrB7Lt/ERFqan+aEjMmlHbCgMpqt6iPDN+hVWkJfJQXzRN65LqOuholIb1 KrpOf6AmM6fK/FG6qE1PtEH6mVjNJHi8vw4wnbt8HuhNsaTSGUuYJzh3TeLGf5rcSvic mbKyASn7+G0Kp8ZV+lwiyuwDZFduFgekBhBcF15WPGmuHNdPa4peVri+J5Do4I2XO7a8 /fVJGi3uT6mQMBwVhObGuZRZ08aiVUrSAzZLSE6ciRDuYVdaXNcIXcSy2+v71ngmksJV a1bEkIcdAsgso/V7V6+zU83g/h7eeb5ew/aCBiyB5Aj0Gm9QZo2+/wo/+Bs5MCWbPvR8 Ml8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DurhEnZ4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13si1134897ejr.34.2019.09.24.09.17.01; Tue, 24 Sep 2019 09:17:27 -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=@kernel.org header.s=default header.b=DurhEnZ4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404443AbfIVTih (ORCPT + 99 others); Sun, 22 Sep 2019 15:38:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:41038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389169AbfIVSpX (ORCPT ); Sun, 22 Sep 2019 14:45:23 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8B0DD2190F; Sun, 22 Sep 2019 18:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569177922; bh=Gr+mpr+UdVcsglgvTrR47wJ0vGzDZ7TykkhHAonJjdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DurhEnZ4OWaexqJkkrZ8JT9/W6JjrzyxyEb5VCpv3euam0Vdj9zw7Ilwj/7jmznYN Lx0QHB/r9atPTFUGl3QTeHLQI14tCJDBQTGIwk8lynUX9Wd4lBaTyAk7UL8FqHgSlD JWdVZFV+dbdoqNcwda63Tdta1rdk5tYV+17Xvumk= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jerome Brunet , Mark Brown , Sasha Levin , linux-amlogic@lists.infradead.org Subject: [PATCH AUTOSEL 5.3 034/203] ASoC: meson: g12a-tohdmitx: override codec2codec params Date: Sun, 22 Sep 2019 14:41:00 -0400 Message-Id: <20190922184350.30563-34-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190922184350.30563-1-sashal@kernel.org> References: <20190922184350.30563-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jerome Brunet [ Upstream commit 2c4956bc1e9062e5e3c5ea7612294f24e6d4fbdd ] So far, forwarding the hw_params of the input to output relied on the .hw_params() callback of the cpu side of the codec2codec link to be called first. This is a bit weak. Instead, override the stream params of the codec2codec to link to set it up correctly. Signed-off-by: Jerome Brunet Link: https://lore.kernel.org/r/20190729080139.32068-1-jbrunet@baylibre.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/meson/g12a-tohdmitx.c | 34 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/sound/soc/meson/g12a-tohdmitx.c b/sound/soc/meson/g12a-tohdmitx.c index 707ccb192e4c2..9943c807ec5d7 100644 --- a/sound/soc/meson/g12a-tohdmitx.c +++ b/sound/soc/meson/g12a-tohdmitx.c @@ -28,7 +28,7 @@ #define CTRL0_SPDIF_CLK_SEL BIT(0) struct g12a_tohdmitx_input { - struct snd_pcm_hw_params params; + struct snd_soc_pcm_stream params; unsigned int fmt; }; @@ -225,26 +225,17 @@ static int g12a_tohdmitx_input_hw_params(struct snd_pcm_substream *substream, { struct g12a_tohdmitx_input *data = dai->playback_dma_data; - /* Save the stream params for the downstream link */ - memcpy(&data->params, params, sizeof(*params)); + data->params.rates = snd_pcm_rate_to_rate_bit(params_rate(params)); + data->params.rate_min = params_rate(params); + data->params.rate_max = params_rate(params); + data->params.formats = 1 << params_format(params); + data->params.channels_min = params_channels(params); + data->params.channels_max = params_channels(params); + data->params.sig_bits = dai->driver->playback.sig_bits; return 0; } -static int g12a_tohdmitx_output_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params, - struct snd_soc_dai *dai) -{ - struct g12a_tohdmitx_input *in_data = - g12a_tohdmitx_get_input_data(dai->capture_widget); - - if (!in_data) - return -ENODEV; - - memcpy(params, &in_data->params, sizeof(*params)); - - return 0; -} static int g12a_tohdmitx_input_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) @@ -266,6 +257,14 @@ static int g12a_tohdmitx_output_startup(struct snd_pcm_substream *substream, if (!in_data) return -ENODEV; + if (WARN_ON(!rtd->dai_link->params)) { + dev_warn(dai->dev, "codec2codec link expected\n"); + return -EINVAL; + } + + /* Replace link params with the input params */ + rtd->dai_link->params = &in_data->params; + if (!in_data->fmt) return 0; @@ -278,7 +277,6 @@ static const struct snd_soc_dai_ops g12a_tohdmitx_input_ops = { }; static const struct snd_soc_dai_ops g12a_tohdmitx_output_ops = { - .hw_params = g12a_tohdmitx_output_hw_params, .startup = g12a_tohdmitx_output_startup, }; -- 2.20.1