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]
Date: Tue, 8 Aug 2023 08:26:16 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Herve Codina <herve.codina@...tlin.com>, "David S. Miller"
	<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
	<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Andrew Lunn
	<andrew@...n.ch>, Rob Herring <robh+dt@...nel.org>, Krzysztof Kozlowski
	<krzysztof.kozlowski+dt@...aro.org>, Conor Dooley <conor+dt@...nel.org>, Lee
 Jones <lee@...nel.org>, Linus Walleij <linus.walleij@...aro.org>, Qiang Zhao
	<qiang.zhao@....com>, Li Yang <leoyang.li@....com>, Liam Girdwood
	<lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>, Jaroslav Kysela
	<perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>, Shengjiu Wang
	<shengjiu.wang@...il.com>, Xiubo Li <Xiubo.Lee@...il.com>, Fabio Estevam
	<festevam@...il.com>, Nicolin Chen <nicoleotsuka@...il.com>, Randy Dunlap
	<rdunlap@...radead.org>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "alsa-devel@...a-project.org"
	<alsa-devel@...a-project.org>, Thomas Petazzoni
	<thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v2 26/28] ASoC: codecs: Add support for the framer codec



Le 26/07/2023 à 17:02, Herve Codina a écrit :
> The framer codec interracts with a framer.
> It allows to use some of the framer timeslots as audio channels to
> transport audio data over the framer E1/T1/J1 lines.
> It also reports line carrier detection events through the ALSA jack
> detection feature.
> 
> Signed-off-by: Herve Codina <herve.codina@...tlin.com>

Reviewed-by: Christophe Leroy <christophe.leroy@...roup.eu>

See below

> +static int framer_dai_hw_rule_channels_by_format(struct snd_soc_dai *dai,
> +						 struct snd_pcm_hw_params *params,
> +						 unsigned int nb_ts)
> +{
> +	struct snd_interval *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
> +	snd_pcm_format_t format = params_format(params);
> +	struct snd_interval ch = {0};
> +
> +	switch (snd_pcm_format_physical_width(format)) {
> +	case 8:
> +		ch.max = nb_ts;
> +		break;
> +	case 16:
> +		ch.max = nb_ts / 2;
> +		break;
> +	case 32:
> +		ch.max = nb_ts / 4;
> +		break;
> +	case 64:
> +		ch.max = nb_ts / 8;
> +		break;
> +	default:
> +		dev_err(dai->dev, "format physical width %u not supported\n",
> +			snd_pcm_format_physical_width(format));
> +		return -EINVAL;
> +	}

What about

	width = snd_pcm_format_physical_width(format);

	if (width == 8 || width == 16 || width == 32 || width == 64) {
		ch.max = nb_ts * 8 / width;
	} else {
		dev_err(dai->dev, "format physical width %u not supported\n", width);
		return -EINVAL;
	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ