From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47F88762D0 for ; Mon, 6 Jan 2025 14:34:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736174046; cv=none; b=a0xD/XcJQVGYVeZalQ8qHrSTgWT+wz/DK5xr3TfovOCKixyDtLu9nOE+ZMjwWWbxKdq4QpES+k3EIBadWcImXbKFBeZ/BkbVHRVkuTm4o+sHetzBzfwn0Kb/VAHBMBZMfqU0z7RsV6RB51eDwjXhhJLNeytWOSenmrf61R7XTVY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736174046; c=relaxed/simple; bh=uiTzVrTUCZ3WSt6oaICrJzKtcpKhbkZxUd3KwPMCmu4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=nKyYm4QYV7Ow/WJm9xjxUvAr68CQteES3qsUUVlo+LJ0Iy/pA3HJdAL6PHq6xlFb+DQfyBGSwe3vsDSvYffrz6GqbSx3Hkdf0ja32Yd/YKOVjEwMtfiXMTggsPTPeV8nZSNLj6oxVV5BjtrJjmH4F0bPKH+A9I1Za7XAcaNt8sE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=H3vctfrT; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="H3vctfrT" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4362f61757fso143757155e9.2 for ; Mon, 06 Jan 2025 06:34:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736174042; x=1736778842; darn=vger.kernel.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=LJS2rW2T2RcSfQ5iAkA0Gffqe23ezlX4jRnbxIk5ccs=; b=H3vctfrTnrU4CJP/gvbDHoSxmnURSO0sbdBtgkB9RTYQSRktyNCsftGOJe7W/yh1hV +lO/drNR2cmL/vE/a26vsr/GOtEPG32n1Bn3LR7Pkq712wB2rUcdQ3+98ws8kfnuHOim P7y17gGaFQRLRMeoh8tDu61AimBaRwUDpLiCbmfNhTdkU3YQSlOCRRB5KveoyszEf/M6 mrZ1o8ckIr+8vus4+w720wTRNd/6SvcO3Odfm22rnSaKuVzRac/4DR5H51de+aQyh5lA l1U2cggfF6AwA8d5olzwevNvyJfzjZdrX6quoGcNiS8XH89bM1A5HAeS/MkhebV6AAoY s0Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736174042; x=1736778842; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LJS2rW2T2RcSfQ5iAkA0Gffqe23ezlX4jRnbxIk5ccs=; b=pmd8jsi0rIceEUgnWtdq+7gAnv95YUSUyQw1Zu8ugdNwNMt2P2m0RtcyH54GLbJfsQ NUyWicvnHNEQXSHwG5ofDH0tQ4vMsNtvbiW/XK53J9RrNdCVW4stQuEom+BuPJO4d6cd q1913flECjP3uvTPONeI5wUlvOPEHjQv2/z0Wl/L+07gLp8lr3wQdnYZ/7VpWrxVNyv9 pIH0LhZKBw0Ol541ZD0sGxtAueHYc4qrv7FpqEiXSowulVkq99jxomlVr29TjeuCxiCn j5vu3cZeDuVhOYq4EkzNg1/fxYa3Bo5D5AveH8WpDYnzlHywJalxGvo/qiWYw9Qfe94m WPsw== X-Forwarded-Encrypted: i=1; AJvYcCUv1Xidm4sejEAwPqQAI3J6lb+TZ+Ty50iAy3MwHoxNbMkcCw82O3ev3Pn6LlHpNjj+u/eO5CUGpzw7rwU=@vger.kernel.org X-Gm-Message-State: AOJu0YxPvI6OUAM2YVg+nKC5Fy1RD/aFQSykDaWqHcy3g5JaWUz88igR uzzlby8t8Qrf+LU9nm8c+996qpcMQRWjKTQH4c4JKHf1U3vBD+Nnv/0Q3DKbGUQ= X-Gm-Gg: ASbGncvSfZqmw8fgfGDz94bUDu5RUOHqkqVZzNpUg4hCWyzgV05wa4oFSoOi2LUSRwW w4kvRYP+QX2CRME7dgZ/26dOaE03MtTCRUzKXtt+1D59D7JeoIo4SERrpLlrGsfRCicVXbUdU8/ 2Y+aL84BSrYfxZ3WfEKW1tNdaW4QgchjwkjYMDkbjoQHJ7EUwVeCr18+1WUqttlfzXVG5ff5FbD bNu35fYUyzC6RMM/F03gcpxdHfPd/sLFEia5xOuRstHSpm+R95yNqaS X-Google-Smtp-Source: AGHT+IFP7sfF3m4i727Wam1azM0kasnMNja3MbbIcuKtEVEEuVjvrxhTyPP+GTViojdnICts5GSdLA== X-Received: by 2002:a7b:cd98:0:b0:42c:b9c8:2bb0 with SMTP id 5b1f17b1804b1-4366b2f95c5mr489415105e9.4.1736174042302; Mon, 06 Jan 2025 06:34:02 -0800 (PST) Received: from localhost ([2a01:e0a:3c5:5fb1:2a4a:e041:e2ff:6b41]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436611ea40csm569164115e9.1.2025.01.06.06.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2025 06:34:01 -0800 (PST) From: Jerome Brunet To: Martin Blumenstingl Cc: linux-sound@vger.kernel.org, linux-amlogic@lists.infradead.org, s.nawrocki@samsung.com, lgirdwood@gmail.com, broonie@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v1 2/2] ASoC: dapm: add support for preparing streams In-Reply-To: <1jy0zo9fu4.fsf@starbuckisacylon.baylibre.com> (Jerome Brunet's message of "Mon, 06 Jan 2025 15:28:35 +0100") References: <20250106141316.375984-1-martin.blumenstingl@googlemail.com> <20250106141316.375984-3-martin.blumenstingl@googlemail.com> <1jy0zo9fu4.fsf@starbuckisacylon.baylibre.com> User-Agent: mu4e 1.12.7; emacs 29.4 Date: Mon, 06 Jan 2025 15:34:01 +0100 Message-ID: <1jsepw9fl2.fsf@starbuckisacylon.baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Mon 06 Jan 2025 at 15:28, Jerome Brunet wrote: > On Mon 06 Jan 2025 at 15:13, Martin Blumenstingl wrote: > >> Codec driver can implement .hw_params and/or .prepare from struct >> snd_soc_dai_ops. For codec-to-codec links only the former (.hw_params) >> callback has been called. >> >> On platforms like Amlogic Meson8/8b/8m2 the SoC's sound card >> (sound/soc/meson/gx-card.c) uses a codec-to-codec link for the HDMI >> codec output because further digital routing is required after the >> backend. The new DRM HDMI (audio) codec framework (which internally >> uses sound/soc/codecs/hdmi-codec.c) relies on the .prepare callback >> of the hdmi-codec to be called. Implement a call to >> snd_soc_dai_prepare() so the .prepare callback of the hdmi-codec is >> called on those platforms. >> >> For platforms or sound cards without a codec-to-codec link with >> additional parameters (which applies to most hardware) this changes >> nothing as the .prepare callback is already called via >> snd_pcm_do_prepare() (as well as dpcm_fe_dai_prepare() and >> dpcm_be_dai_prepare()) on those. >> >> Suggested-by: Jerome Brunet >> Signed-off-by: Martin Blumenstingl > > Thanks for working on this. Overall it looks good. > > Not sure if the call the .prepare() should go at the beginning of > POST_PMU, as done here, or at the end of PRE_PMU ? > >> --- >> sound/soc/soc-dapm.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c >> index 99521c784a9b..ac8eef217dc4 100644 >> --- a/sound/soc/soc-dapm.c >> +++ b/sound/soc/soc-dapm.c >> @@ -4013,6 +4013,13 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, >> break; >> >> case SND_SOC_DAPM_POST_PMU: >> + snd_soc_dapm_widget_for_each_sink_path(w, path) { >> + sink = path->sink->priv; >> + >> + snd_soc_dai_prepare(sink, substream); I initially missed it but I think you should do that on the source path too On Amlogic, the cpu side of the link does not have a .prepare() callback but it would be incorrect to do the codec side only if it did. >> + ret = 0; >> + } >> + >> snd_soc_dapm_widget_for_each_sink_path(w, path) { >> sink = path->sink->priv; -- Jerome