On Tue, 8 Aug 2023 08:26:16 +0000 Christophe Leroy christophe.leroy@csgroup.eu wrote:
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@bootlin.com
Reviewed-by: Christophe Leroy christophe.leroy@csgroup.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; }
Yes, indeed. Will be changed in the next iteration.
Regards, Hervé