From mboxrd@z Thu Jan 1 00:00:00 1970 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B583C433F5 for ; Thu, 16 Dec 2021 15:31:39 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C969E1F1D; Thu, 16 Dec 2021 16:30:46 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C969E1F1D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639668696; bh=9THLTA4df0y6i8ygulPqwlz2msdcT0tN7mwAfdR0Vss=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=KvueEWjisMY2dbotjb794n8xDzf0Wi6Dviz/FAn6Zw7bR3N9feokSzicLumQuyMvs ff73gjmfdMyfpfbw6U5bL4US+jWfxouB3SUZK7MsI5iKg3pGIbME9f4wKKnF3E6qGW kgtX2PNpK32q5PgRCNXrv0XRYtyiFjQVfcYnvVWY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5423EF80116; Thu, 16 Dec 2021 16:30:46 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 514DCF8014C; Thu, 16 Dec 2021 16:30:45 +0100 (CET) Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id B3AFBF800B0 for ; Thu, 16 Dec 2021 16:30:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B3AFBF800B0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hfDSQRBr" Received: by mail-wr1-x432.google.com with SMTP id s1so10760740wrg.1 for ; Thu, 16 Dec 2021 07:30:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8ljz1sia0YjUcnh8cX/bSKFrHoMO2tH/2wPxmNzX1O4=; b=hfDSQRBrhQVm2NOzdpqwxylBGQgeOUmm8l8Ro2WD06r79RRhoMX8Jwm6RhUmtUCLDn CN1ivuFuclTpTB2h5j7URTwgL5x4u5r8I4DEg9qimVY3Zuhf9gqgcoTSKQSXjQcd2qAZ Mw3fznXHYx/UYtdjAjx/kVSIWlOSXooFnYvm+eGcZg9H9DCOE0yKCt+QXygZ9elAPIQA cklYHS4uSDCY5yC7WtEiT9qq8MXoLcl0st+4lWR3gTEl33sJrBGyuY9WpG2l84VvrIPq 6nLGOopCQ4ewFXcVvMcwsEjdAu/cV/oudhLr7y14aI+SiWrGNnAQA+xaEDV3BdzI649f o6aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8ljz1sia0YjUcnh8cX/bSKFrHoMO2tH/2wPxmNzX1O4=; b=QwQT+TmbAtcfmTFDD65RkI0RHh6kNOh0EUz659sSgNaBzhGcgPD4xonAcMlnvoc5MY CQ7V5CJkVrhHlDFIkQZN9GvT2zgV393m9CLPsUel/dnWXqiCttGyyuoNIIehteXswXJI imZmGwl+Sramp43XQFBS9wT9p7evE32PVrKPf2zUtb0VOmPjBQn7wQXZEo5lu+Pjo2D7 nQLdJeiO4ZPlsjE8oIMbOI4IL6x1C/ExfMGwxOlKX5M2yqPwuo3CGubrnO0QJBYsa6ve CJV91zXY1SCt7J8QnwfMqef/0dX4fAd+pVeJGQ1wgiTNh+Bihk9JzNksVHZGPhvKKsC0 x36Q== X-Gm-Message-State: AOAM533i/9/xI//TbpVL25DH4q38C9ks01EjZOUnWhYrScBUxljLXbVb ZGmXA1IBSjuMub8RdcgoJcmquHkl+adH3Q== X-Google-Smtp-Source: ABdhPJyGqb1sK9/KehghXxEJLcEssMut1QZQEgMFWqLe0DyI32xXK6U2NEiO83P+2tWeOyGZch1AlQ== X-Received: by 2002:adf:aa9a:: with SMTP id h26mr9312334wrc.437.1639668634242; Thu, 16 Dec 2021 07:30:34 -0800 (PST) Received: from orome ([193.209.96.43]) by smtp.gmail.com with ESMTPSA id l22sm4869371wmq.2.2021.12.16.07.30.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 07:30:33 -0800 (PST) Date: Thu, 16 Dec 2021 16:30:29 +0100 From: Thierry Reding To: Dmitry Osipenko Subject: Re: [PATCH v4 12/22] ASoC: tegra20: spdif: Filter out unsupported rates Message-ID: References: <20211204143725.31646-1-digetx@gmail.com> <20211204143725.31646-13-digetx@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hlDusqvBIjGc6g1d" Content-Disposition: inline In-Reply-To: <20211204143725.31646-13-digetx@gmail.com> User-Agent: Mutt/2.1.3 (987dde4c) (2021-09-10) Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, Arnd Bergmann , linux-kernel@vger.kernel.org, Takashi Iwai , Liam Girdwood , Rob Herring , Mark Brown , dri-devel@lists.freedesktop.org, Agneli , linux-tegra@vger.kernel.org, Jonathan Hunter X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" --hlDusqvBIjGc6g1d Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 04, 2021 at 05:37:15PM +0300, Dmitry Osipenko wrote: > SPDIF and other SoC components share audio PLL on Tegra, thus only one > component may set the desired base clock rate. This creates problem for > HDMI audio because it uses SPDIF and audio may not work if SPDIF's clock > doesn't exactly match standard audio rate since some receivers may reject > audio in that case. Filter out audio rates which SPDIF output can't > support, assuming that other components won't change rate at runtime. >=20 > Signed-off-by: Dmitry Osipenko > --- > sound/soc/tegra/tegra20_spdif.c | 61 +++++++++++++++++++++++++++++++++ > 1 file changed, 61 insertions(+) >=20 > diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_sp= dif.c > index a4aa5614aef4..d09cd7ee6879 100644 > --- a/sound/soc/tegra/tegra20_spdif.c > +++ b/sound/soc/tegra/tegra20_spdif.c > @@ -79,6 +79,7 @@ static int tegra20_spdif_hw_params(struct snd_pcm_subst= ream *substream, > struct tegra20_spdif *spdif =3D dev_get_drvdata(dai->dev); > unsigned int mask =3D 0, val =3D 0; > int ret, spdifclock; > + long rate; Perhaps we should change spdifclock to be "long" as well, even though they're the same on Tegra20. SND_SOC_TEGRA depends on || COMPILE_TEST, so technically somebody could build this on 64-bit and then these are no longer the same types. Still shouldn't be problematic given the numbers that are passed in, but it'd still be nice to keep consistent types for these. > =20 > mask |=3D TEGRA20_SPDIF_CTRL_PACK | > TEGRA20_SPDIF_CTRL_BIT_MODE_MASK; > @@ -133,6 +134,12 @@ static int tegra20_spdif_hw_params(struct snd_pcm_su= bstream *substream, > return ret; > } > =20 > + rate =3D clk_get_rate(spdif->clk_spdif_out); > + if (rate !=3D spdifclock) > + dev_warn_once(dai->dev, > + "SPDIF clock rate %d doesn't match requested rate %lu\n", That should be %ld since it's not unsigned. Otherwise, looks good. Probably not worth respinning for just these minor comments, so: Acked-by: Thierry Reding --hlDusqvBIjGc6g1d Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmG7W5UACgkQ3SOs138+ s6EoZA//RbQ55S5Uiwy8g6JPCcgotaa5lun+zkW1rlcFkNxQdjV2L34+7vI2qe0p cq0JRwSP9gcN70Ev3gZvdfsX8gF3PpUa8CI/n4LekRF/w7UpBODl2DnjBMx5ooMT oCttnlJ9n6Oguj4HumyNE4IHEaEvPh4ZM2zwTYjWZKRFZprajsSOLnLld9Hb5DIz ouN5/TX14FNRl1SlW69oBs370/y+ai9VKIgYnHjgkDCyG0iIHVUDG6qlowt8XbfR RTUeB6yxy9Pb2ip2zRFC/q2bK4SjsrVk3nM1UgQ1MRtJXUhXI7KmIsHMsZgOKYqL P+HSo1xynxA9KlqowzmB7z8rmkAb8C0ItGNDeC56B+D62mJNaRGMlPd8eP9g4S+P UKev7F4U6L9kER3L+0LbpTvfNRngqgaGwiCvluPdP/u2DR000QGH9/9GOeQvGHqQ 0BcqIunA/H+DTdWqcvlyoqUIZxH1EWWsa7W6jJ+YRsW0W7jTrHjm1oV+EWg+mNt3 uWHb7dvl106okJNL9NPnxYN3mrAUAxgCUaCwRNrLp2Ls8qK524kXIbkGvm6AkwPn 7W5fLG0y0+nocEBXD51rz6uFzl1t5xCqw1Y77p5QDamNyErjxZx9DyXe4/fdWrTt ouaaeKp7Og++Bpn0D0XcwBIFDu40tBkQLzD0xF0Ieu2tv3gWMlE= =gmxg -----END PGP SIGNATURE----- --hlDusqvBIjGc6g1d-- From mboxrd@z Thu Jan 1 00:00:00 1970 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 BB893C433F5 for ; Thu, 16 Dec 2021 15:30:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238533AbhLPPah (ORCPT ); Thu, 16 Dec 2021 10:30:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238552AbhLPPag (ORCPT ); Thu, 16 Dec 2021 10:30:36 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E8A8C06173F; Thu, 16 Dec 2021 07:30:35 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id u17so44914865wrt.3; Thu, 16 Dec 2021 07:30:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8ljz1sia0YjUcnh8cX/bSKFrHoMO2tH/2wPxmNzX1O4=; b=hfDSQRBrhQVm2NOzdpqwxylBGQgeOUmm8l8Ro2WD06r79RRhoMX8Jwm6RhUmtUCLDn CN1ivuFuclTpTB2h5j7URTwgL5x4u5r8I4DEg9qimVY3Zuhf9gqgcoTSKQSXjQcd2qAZ Mw3fznXHYx/UYtdjAjx/kVSIWlOSXooFnYvm+eGcZg9H9DCOE0yKCt+QXygZ9elAPIQA cklYHS4uSDCY5yC7WtEiT9qq8MXoLcl0st+4lWR3gTEl33sJrBGyuY9WpG2l84VvrIPq 6nLGOopCQ4ewFXcVvMcwsEjdAu/cV/oudhLr7y14aI+SiWrGNnAQA+xaEDV3BdzI649f o6aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8ljz1sia0YjUcnh8cX/bSKFrHoMO2tH/2wPxmNzX1O4=; b=WH+14+bWlXPM0GE0zIqsOybNWk8C0TWwQ9/c/eUN5SumA2s0xX3BftMZvvxvRwM5js /6y0aUV+xtuJjHC0eLAAdT0WPibm4uNjFRcGyW3LQg3qqZtBkScf14DXT1ewaW7QHLoQ gyARKYtwZzW9Pdqwkp41WZJJ7fq18GA3CS1ijoBB7kC9GhMlvW2uf72sLs75YNWvpSNA 8x/Wh7FtbxLNHSvCrFe1rKFubMXxekqTbw3e3VNkS/ApkwFYDFJuWUhOs49tq7zulzo+ 0EADSSt60aYnqtNWR/KCHH1/A4wQYj2VnpFqnpIEyvmk60ewv10Cmz2P5QQkK601bcRf B/tw== X-Gm-Message-State: AOAM531y3EySqD2e5aH14gOpL0I/0/k7K2k4DNEYVRKHOIRnQOXsEt8f kxRzCi70A280fKvuKbtz3Wo= X-Google-Smtp-Source: ABdhPJyGqb1sK9/KehghXxEJLcEssMut1QZQEgMFWqLe0DyI32xXK6U2NEiO83P+2tWeOyGZch1AlQ== X-Received: by 2002:adf:aa9a:: with SMTP id h26mr9312334wrc.437.1639668634242; Thu, 16 Dec 2021 07:30:34 -0800 (PST) Received: from orome ([193.209.96.43]) by smtp.gmail.com with ESMTPSA id l22sm4869371wmq.2.2021.12.16.07.30.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 07:30:33 -0800 (PST) Date: Thu, 16 Dec 2021 16:30:29 +0100 From: Thierry Reding To: Dmitry Osipenko Cc: Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Liam Girdwood , Agneli , linux-tegra@vger.kernel.org, Arnd Bergmann , Rob Herring , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH v4 12/22] ASoC: tegra20: spdif: Filter out unsupported rates Message-ID: References: <20211204143725.31646-1-digetx@gmail.com> <20211204143725.31646-13-digetx@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hlDusqvBIjGc6g1d" Content-Disposition: inline In-Reply-To: <20211204143725.31646-13-digetx@gmail.com> User-Agent: Mutt/2.1.3 (987dde4c) (2021-09-10) Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org --hlDusqvBIjGc6g1d Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 04, 2021 at 05:37:15PM +0300, Dmitry Osipenko wrote: > SPDIF and other SoC components share audio PLL on Tegra, thus only one > component may set the desired base clock rate. This creates problem for > HDMI audio because it uses SPDIF and audio may not work if SPDIF's clock > doesn't exactly match standard audio rate since some receivers may reject > audio in that case. Filter out audio rates which SPDIF output can't > support, assuming that other components won't change rate at runtime. >=20 > Signed-off-by: Dmitry Osipenko > --- > sound/soc/tegra/tegra20_spdif.c | 61 +++++++++++++++++++++++++++++++++ > 1 file changed, 61 insertions(+) >=20 > diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_sp= dif.c > index a4aa5614aef4..d09cd7ee6879 100644 > --- a/sound/soc/tegra/tegra20_spdif.c > +++ b/sound/soc/tegra/tegra20_spdif.c > @@ -79,6 +79,7 @@ static int tegra20_spdif_hw_params(struct snd_pcm_subst= ream *substream, > struct tegra20_spdif *spdif =3D dev_get_drvdata(dai->dev); > unsigned int mask =3D 0, val =3D 0; > int ret, spdifclock; > + long rate; Perhaps we should change spdifclock to be "long" as well, even though they're the same on Tegra20. SND_SOC_TEGRA depends on || COMPILE_TEST, so technically somebody could build this on 64-bit and then these are no longer the same types. Still shouldn't be problematic given the numbers that are passed in, but it'd still be nice to keep consistent types for these. > =20 > mask |=3D TEGRA20_SPDIF_CTRL_PACK | > TEGRA20_SPDIF_CTRL_BIT_MODE_MASK; > @@ -133,6 +134,12 @@ static int tegra20_spdif_hw_params(struct snd_pcm_su= bstream *substream, > return ret; > } > =20 > + rate =3D clk_get_rate(spdif->clk_spdif_out); > + if (rate !=3D spdifclock) > + dev_warn_once(dai->dev, > + "SPDIF clock rate %d doesn't match requested rate %lu\n", That should be %ld since it's not unsigned. Otherwise, looks good. Probably not worth respinning for just these minor comments, so: Acked-by: Thierry Reding --hlDusqvBIjGc6g1d Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmG7W5UACgkQ3SOs138+ s6EoZA//RbQ55S5Uiwy8g6JPCcgotaa5lun+zkW1rlcFkNxQdjV2L34+7vI2qe0p cq0JRwSP9gcN70Ev3gZvdfsX8gF3PpUa8CI/n4LekRF/w7UpBODl2DnjBMx5ooMT oCttnlJ9n6Oguj4HumyNE4IHEaEvPh4ZM2zwTYjWZKRFZprajsSOLnLld9Hb5DIz ouN5/TX14FNRl1SlW69oBs370/y+ai9VKIgYnHjgkDCyG0iIHVUDG6qlowt8XbfR RTUeB6yxy9Pb2ip2zRFC/q2bK4SjsrVk3nM1UgQ1MRtJXUhXI7KmIsHMsZgOKYqL P+HSo1xynxA9KlqowzmB7z8rmkAb8C0ItGNDeC56B+D62mJNaRGMlPd8eP9g4S+P UKev7F4U6L9kER3L+0LbpTvfNRngqgaGwiCvluPdP/u2DR000QGH9/9GOeQvGHqQ 0BcqIunA/H+DTdWqcvlyoqUIZxH1EWWsa7W6jJ+YRsW0W7jTrHjm1oV+EWg+mNt3 uWHb7dvl106okJNL9NPnxYN3mrAUAxgCUaCwRNrLp2Ls8qK524kXIbkGvm6AkwPn 7W5fLG0y0+nocEBXD51rz6uFzl1t5xCqw1Y77p5QDamNyErjxZx9DyXe4/fdWrTt ouaaeKp7Og++Bpn0D0XcwBIFDu40tBkQLzD0xF0Ieu2tv3gWMlE= =gmxg -----END PGP SIGNATURE----- --hlDusqvBIjGc6g1d-- From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A1BE4C433FE for ; Thu, 16 Dec 2021 15:30:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F18D10E914; Thu, 16 Dec 2021 15:30:36 +0000 (UTC) Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by gabe.freedesktop.org (Postfix) with ESMTPS id B12F710E914 for ; Thu, 16 Dec 2021 15:30:35 +0000 (UTC) Received: by mail-wr1-x430.google.com with SMTP id t18so44822514wrg.11 for ; Thu, 16 Dec 2021 07:30:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8ljz1sia0YjUcnh8cX/bSKFrHoMO2tH/2wPxmNzX1O4=; b=hfDSQRBrhQVm2NOzdpqwxylBGQgeOUmm8l8Ro2WD06r79RRhoMX8Jwm6RhUmtUCLDn CN1ivuFuclTpTB2h5j7URTwgL5x4u5r8I4DEg9qimVY3Zuhf9gqgcoTSKQSXjQcd2qAZ Mw3fznXHYx/UYtdjAjx/kVSIWlOSXooFnYvm+eGcZg9H9DCOE0yKCt+QXygZ9elAPIQA cklYHS4uSDCY5yC7WtEiT9qq8MXoLcl0st+4lWR3gTEl33sJrBGyuY9WpG2l84VvrIPq 6nLGOopCQ4ewFXcVvMcwsEjdAu/cV/oudhLr7y14aI+SiWrGNnAQA+xaEDV3BdzI649f o6aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8ljz1sia0YjUcnh8cX/bSKFrHoMO2tH/2wPxmNzX1O4=; b=lxppwzjNHMsTnbwVA7U+xHgSebuCGeRT5ka/DmnA62Mn8YFJpKcVbcViQ9MpNERfT2 3C6X/Xub2osfPWOSa26DenjlGT1Oz2Vf5wDJ8rxmQlXjdctQZaR5XOrJZdOE5eSZUFF4 XJYY88Mm5g6uLBYIjErndFJUxUAAp8GezCQ2/s6kDB/5w+sXmbgoEgpRIzK0sj7oHRWY pAffjUw/KTv1RIWCH1WJSszfnE+rQ108rDYOR6SxLiPakZoRAkaRTkw6xdfB7C2FGv+Y ilPbJQBSXPHgiWOTx02f2JAucNu0AxAufXBeRdLL2O9hC+1xezAR0VeKFDJh4EKbsAmP b35Q== X-Gm-Message-State: AOAM532A/A5m8vDXjGbtHmtyTMSFCOfRbWB4Z7Hr9ODz5dR92B+fO5CD 7hmJbVfaUOaPT+aColWgekU= X-Google-Smtp-Source: ABdhPJyGqb1sK9/KehghXxEJLcEssMut1QZQEgMFWqLe0DyI32xXK6U2NEiO83P+2tWeOyGZch1AlQ== X-Received: by 2002:adf:aa9a:: with SMTP id h26mr9312334wrc.437.1639668634242; Thu, 16 Dec 2021 07:30:34 -0800 (PST) Received: from orome ([193.209.96.43]) by smtp.gmail.com with ESMTPSA id l22sm4869371wmq.2.2021.12.16.07.30.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 07:30:33 -0800 (PST) Date: Thu, 16 Dec 2021 16:30:29 +0100 From: Thierry Reding To: Dmitry Osipenko Subject: Re: [PATCH v4 12/22] ASoC: tegra20: spdif: Filter out unsupported rates Message-ID: References: <20211204143725.31646-1-digetx@gmail.com> <20211204143725.31646-13-digetx@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hlDusqvBIjGc6g1d" Content-Disposition: inline In-Reply-To: <20211204143725.31646-13-digetx@gmail.com> User-Agent: Mutt/2.1.3 (987dde4c) (2021-09-10) X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, Arnd Bergmann , linux-kernel@vger.kernel.org, Takashi Iwai , Liam Girdwood , Rob Herring , Jaroslav Kysela , Mark Brown , dri-devel@lists.freedesktop.org, Agneli , linux-tegra@vger.kernel.org, Jonathan Hunter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --hlDusqvBIjGc6g1d Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 04, 2021 at 05:37:15PM +0300, Dmitry Osipenko wrote: > SPDIF and other SoC components share audio PLL on Tegra, thus only one > component may set the desired base clock rate. This creates problem for > HDMI audio because it uses SPDIF and audio may not work if SPDIF's clock > doesn't exactly match standard audio rate since some receivers may reject > audio in that case. Filter out audio rates which SPDIF output can't > support, assuming that other components won't change rate at runtime. >=20 > Signed-off-by: Dmitry Osipenko > --- > sound/soc/tegra/tegra20_spdif.c | 61 +++++++++++++++++++++++++++++++++ > 1 file changed, 61 insertions(+) >=20 > diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_sp= dif.c > index a4aa5614aef4..d09cd7ee6879 100644 > --- a/sound/soc/tegra/tegra20_spdif.c > +++ b/sound/soc/tegra/tegra20_spdif.c > @@ -79,6 +79,7 @@ static int tegra20_spdif_hw_params(struct snd_pcm_subst= ream *substream, > struct tegra20_spdif *spdif =3D dev_get_drvdata(dai->dev); > unsigned int mask =3D 0, val =3D 0; > int ret, spdifclock; > + long rate; Perhaps we should change spdifclock to be "long" as well, even though they're the same on Tegra20. SND_SOC_TEGRA depends on || COMPILE_TEST, so technically somebody could build this on 64-bit and then these are no longer the same types. Still shouldn't be problematic given the numbers that are passed in, but it'd still be nice to keep consistent types for these. > =20 > mask |=3D TEGRA20_SPDIF_CTRL_PACK | > TEGRA20_SPDIF_CTRL_BIT_MODE_MASK; > @@ -133,6 +134,12 @@ static int tegra20_spdif_hw_params(struct snd_pcm_su= bstream *substream, > return ret; > } > =20 > + rate =3D clk_get_rate(spdif->clk_spdif_out); > + if (rate !=3D spdifclock) > + dev_warn_once(dai->dev, > + "SPDIF clock rate %d doesn't match requested rate %lu\n", That should be %ld since it's not unsigned. Otherwise, looks good. Probably not worth respinning for just these minor comments, so: Acked-by: Thierry Reding --hlDusqvBIjGc6g1d Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmG7W5UACgkQ3SOs138+ s6EoZA//RbQ55S5Uiwy8g6JPCcgotaa5lun+zkW1rlcFkNxQdjV2L34+7vI2qe0p cq0JRwSP9gcN70Ev3gZvdfsX8gF3PpUa8CI/n4LekRF/w7UpBODl2DnjBMx5ooMT oCttnlJ9n6Oguj4HumyNE4IHEaEvPh4ZM2zwTYjWZKRFZprajsSOLnLld9Hb5DIz ouN5/TX14FNRl1SlW69oBs370/y+ai9VKIgYnHjgkDCyG0iIHVUDG6qlowt8XbfR RTUeB6yxy9Pb2ip2zRFC/q2bK4SjsrVk3nM1UgQ1MRtJXUhXI7KmIsHMsZgOKYqL P+HSo1xynxA9KlqowzmB7z8rmkAb8C0ItGNDeC56B+D62mJNaRGMlPd8eP9g4S+P UKev7F4U6L9kER3L+0LbpTvfNRngqgaGwiCvluPdP/u2DR000QGH9/9GOeQvGHqQ 0BcqIunA/H+DTdWqcvlyoqUIZxH1EWWsa7W6jJ+YRsW0W7jTrHjm1oV+EWg+mNt3 uWHb7dvl106okJNL9NPnxYN3mrAUAxgCUaCwRNrLp2Ls8qK524kXIbkGvm6AkwPn 7W5fLG0y0+nocEBXD51rz6uFzl1t5xCqw1Y77p5QDamNyErjxZx9DyXe4/fdWrTt ouaaeKp7Og++Bpn0D0XcwBIFDu40tBkQLzD0xF0Ieu2tv3gWMlE= =gmxg -----END PGP SIGNATURE----- --hlDusqvBIjGc6g1d--