Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4613521rwb; Tue, 8 Aug 2023 10:59:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKvVrVsOXgEj3L3QsQyxQ3lAxmfNcsQ6fASlsGVCpSWFzhGsyOOUXCid1yJvcVOh+Q54fa X-Received: by 2002:a05:6a21:3291:b0:135:8a65:a772 with SMTP id yt17-20020a056a21329100b001358a65a772mr250572pzb.50.1691517578522; Tue, 08 Aug 2023 10:59:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691517578; cv=none; d=google.com; s=arc-20160816; b=bBgQBNzKK8RXybh2ypZrPdKsenA7+GBS1eLz6WQldV4bP/LRlBC338AGqBX/L2z1f7 +k9mBuhuLAYwNYlDVIyK4qS9aTf5pTI7ZaSKGKzlKH0lkt9kaTeWQ6k+jKAW7VW5ZlAw wLINVfd2QJe4yBuFWBSplgROsxZWKL9agMv6LdOLpo7pA722IpC//PzXTtop7xyuv9+v KxJqHAqiMCpO/wQNOlWnKGKUhxD7E6wPYK0CO6nxekt6xsuKmhGp0DUgkR9Fo9rGjb1Q e2iE8bfuo5q75x0nUZTRHpiQUyNCHifpKjbp5XU4IshF/q8hvU7rYcruNbXdH/rfS1+h misQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=yV4jZ6QrskrDU/HVotl7NEUNo5CW4ftnk7BIqgEB1+w=; fh=kqFpIKHDkbJvpK3dGZ+YK6To74RZCcll8VeY9E08UC4=; b=CbWx9qUVWUNJvWLslkqB3QdIguL42mkoRJZPRx8wAH/4yPfV6vv/i762PPbqiSOlET xZ9IcGZae2FnFFXvnM32h/LKAkiYT0VID8JyA5tTxgQeU9oeH68ZryZodmZHtETwOE3N m1NiTRU0HfUyIgXkYZKuksZdb1y8P8Cay2Bvplbi7JKSbQr4FWCnfjBjYkq2GtCyNGe6 9uIgxBRGfYA70gMNYhgm2wtsn6CybCqoxhAOex8yYNLRpDDG3JAVes5oSkmC0pY+COP4 Ty6EUp7RVHL02w1FMOzy3D0XGjhlOcCrm1FKEO+V3A4ss5ivmzGXPDWoZAaIfYnycB3K dQ5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=flZfpRXq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z8-20020a633308000000b00564d6ad2746si5177984pgz.452.2023.08.08.10.59.26; Tue, 08 Aug 2023 10:59:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=flZfpRXq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234391AbjHHRUg (ORCPT + 99 others); Tue, 8 Aug 2023 13:20:36 -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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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é