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 84E6FC04A6A for ; Tue, 8 Aug 2023 17:20:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234379AbjHHRUf (ORCPT ); Tue, 8 Aug 2023 13:20:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234389AbjHHRUM (ORCPT ); Tue, 8 Aug 2023 13:20:12 -0400 Received: from mslow1.mail.gandi.net (mslow1.mail.gandi.net [217.70.178.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C19A21DD3A; Tue, 8 Aug 2023 09:08:07 -0700 (PDT) Received: from relay5-d.mail.gandi.net (unknown [IPv6:2001:4b98:dc4:8::225]) by mslow1.mail.gandi.net (Postfix) with ESMTP id E5694C6AB4; Tue, 8 Aug 2023 09:06:22 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 167A31C000E; Tue, 8 Aug 2023 09:06:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1691485578; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yV4jZ6QrskrDU/HVotl7NEUNo5CW4ftnk7BIqgEB1+w=; b=flZfpRXqaC4cOa0lUVXQGmj6OEssvWZubCe2w5MHqI8U2vWQwtOj0FQFAqgAJBxJ8I75XZ I0TZlmNSRmqSWR5xLTIKJ/1FDCZ4stZY0pIriPzLH17o1+eZR+fqsAFgkHhfKw1IeHA6F/ BRImFTSpS5Rv0R1y0afDagZYKTek8UGg0TZs9w8hjDyqKGA3Umv42FjNTa+dNkNUSu3Gue Tx2D6FfesdOvac81rHxEHFQ6xKJfocvJHBN0OnBZAPqs83Owy9ptNTQG7K7UjxPB67/rcA 8c/v/aUZh+TVfJDMed/1Ph30nJadiv+LXoAjitpDUEWw4zjs+hG26YAH/4HjPQ== Date: Tue, 8 Aug 2023 11:06:13 +0200 From: Herve Codina To: Christophe Leroy Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Linus Walleij , Qiang Zhao , Li Yang , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shengjiu Wang , Xiubo Li , Fabio Estevam , Nicolin Chen , Randy Dunlap , "netdev@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "alsa-devel@alsa-project.org" , Thomas Petazzoni Subject: Re: [PATCH v2 26/28] ASoC: codecs: Add support for the framer codec Message-ID: <20230808110613.07e222a3@bootlin.com> In-Reply-To: References: <20230726150225.483464-1-herve.codina@bootlin.com> <20230726150225.483464-27-herve.codina@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Tue, 8 Aug 2023 08:26:16 +0000 Christophe Leroy 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 > > Reviewed-by: Christophe Leroy > > 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é