lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c5a19ddaa458cbd48b8040d1b6e81f6cfe017906.camel@mediatek.com>
Date:   Tue, 24 Oct 2023 02:27:32 +0000
From:   Maso Huang (黃加竹) 
        <Maso.Huang@...iatek.com>
To:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-mediatek@...ts.infradead.org" 
        <linux-mediatek@...ts.infradead.org>,
        "broonie@...nel.org" <broonie@...nel.org>,
        "tiwai@...e.com" <tiwai@...e.com>,
        "lgirdwood@...il.com" <lgirdwood@...il.com>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "matthias.bgg@...il.com" <matthias.bgg@...il.com>,
        "perex@...ex.cz" <perex@...ex.cz>,
        "alsa-devel@...a-project.org" <alsa-devel@...a-project.org>,
        "angelogioacchino.delregno@...labora.com" 
        <angelogioacchino.delregno@...labora.com>
Subject: Re: [PATCH 2/2] ASoC: mediatek: mt7986: add sample rate checker

On Mon, 2023-10-23 at 13:07 +0200, AngeloGioacchino Del Regno wrote:
> Il 23/10/23 11:54, Maso Huang ha scritto:
> > mt7986 only supports 8/12/16/24/32/48/96/192 kHz
> > 
> > Signed-off-by: Maso Huang <maso.huang@...iatek.com>
> > ---
> >   sound/soc/mediatek/mt7986/mt7986-dai-etdm.c | 22
> > +++++++++++++++++----
> >   1 file changed, 18 insertions(+), 4 deletions(-)
> > 
> > diff --git a/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
> > b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
> > index e523d33846fe..270852ce3dd9 100644
> > --- a/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
> > +++ b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c
> > @@ -237,12 +237,26 @@ static int mtk_dai_etdm_hw_params(struct
> > snd_pcm_substream *substream,
> >   				  struct snd_pcm_hw_params *params,
> >   				  struct snd_soc_dai *dai)
> >   {
> > +	unsigned int rate = params_rate(params);
> >   	struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
> >   
> > -	mtk_dai_etdm_config(afe, params, dai,
> > SNDRV_PCM_STREAM_PLAYBACK);
> > -	mtk_dai_etdm_config(afe, params, dai,
> > SNDRV_PCM_STREAM_CAPTURE);
> > -
> > -	return 0;
> > +	switch (rate) {
> > +	case 8000:
> > +	case 12000:
> > +	case 16000:
> > +	case 24000:
> > +	case 32000:
> > +	case 48000:
> > +	case 96000:
> > +	case 192000:
> > +		mtk_dai_etdm_config(afe, params, dai,
> > SNDRV_PCM_STREAM_PLAYBACK);
> > +		mtk_dai_etdm_config(afe, params, dai,
> > SNDRV_PCM_STREAM_CAPTURE);
> > +		return 0;
> > +	default:
> > +		dev_warn(afe->dev, "%s(), sample rate: %d is not
> > supported\n", __func__, rate);
> > +		dev_warn(afe->dev, "%s(), only support
> > 8/12/16/24/32/48/96/192 kHz\n", __func__);
> 
> That's better:
> 
> dev_err(afe->dev,
> 	"Sample rate %d invalid. Supported rates:
> 8/12/16/24/32/48/96/192 kHz\n",
> 	rate, __func__);
> 
> after which,
> 
> Reviewed-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@...labora.com>
> 
> Regards,
> Angelo
> 
> 

Hi Angelo,

Thanks for your review!
I'll refine it in v2.

Best regards,
Maso

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ