lkml.org 
[lkml]   [2023]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 26/28] ASoC: codecs: Add support for the framer codec
Date


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;
}

\
 
 \ /
  Last update: 2023-08-08 18:29    [W:1.807 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site