Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1348768lqt; Wed, 20 Mar 2024 00:31:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXYq4W/naiUCDPWPlgh480ib+gHCydxf+iIibc5RC/vt2g12LXb5CLDnmq9KrDNbLMuYZhlZR/dOEWmfjELuoLOBF0ruJnhiIkSf13RxA== X-Google-Smtp-Source: AGHT+IHMf9QpOQs+qapLxWQ5vwS0vJnz+Tc8g8qofwly8qfYg1Y9KnWjJkslE7HwfwNOcZG1HGWJ X-Received: by 2002:a05:620a:126f:b0:789:eccd:dbb6 with SMTP id b15-20020a05620a126f00b00789eccddbb6mr5467210qkl.43.1710919895583; Wed, 20 Mar 2024 00:31:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710919895; cv=pass; d=google.com; s=arc-20160816; b=yknTTRF9h/ZBAa1ntiOV154IwIsExdkhK856pILavxj5RDwboJXdfN8F6Oy6k25hK4 qVHc842nmw+kZSm4CWCzZ1hNU5uRvg8+ZFmjB0r8oLkwTQDj2gd2y06lp/W1bqsp4/G3 pCxLVWnPiyquKdqCE2TyRlkSKA5YhcqxOk1EnPDo5sB2hbZDYLRIJ7QltkpuCTam3Mrz 3NECnttvI9L4h4emsoLUVdoOeSxOjChQ62Focb7vhdxNjmfEE82pSIRPs7Yd9ZUBMgmX vMaOiwTjvpNPAnA8IbeQDUa7PPgiDrTB/pOjpf4ANAwm87CqGg4o2IOQHilIGHeqD3fT 4/nQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=voBe4cnKC0PYia7ms5iUQbaUgT546itFPRtdPkNE1ao=; fh=s/A4gmG50OV1FeBpoC1BBOnGwQDr1f0SHeEFo2M6QUM=; b=IG2jhbdUJkOZ31usfY1vZGN4t6I9iRDy2lfpW8Mky5S32IAb/AwMplEUWPeAuI03kv 24SYFb2gEhcv/v6EGlNQa/kUkAHCzWJYGkqcG4P8uovTGvaEyaoQAoLqw1aT5yBc3cC3 F3BrsY5uQOP//ZX3drsEX2SR36lPXW+aen8SSJ1usw0j3tLDTzfj41Fek3d8ZAAtJTRC RScMbbzFscU6dFZlFmebqfdE1p012UPa/c+7WqNlxQUuQ7LfvVLExbG3N5AKCV5RFP1l XDGY0ENgvdVNXXIWQWhPo7dIsBPfxVke3gY6i6HibAoAFvvJb+znHnsYVm7zUh8SZxTJ +2dA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Q1cBSxYK; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-108543-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108543-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id l24-20020ae9f018000000b007885e71a1eesi12946291qkg.51.2024.03.20.00.31.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 00:31:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108543-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Q1cBSxYK; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-108543-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108543-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id EE2B71C209D0 for ; Wed, 20 Mar 2024 07:31:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B629F22309; Wed, 20 Mar 2024 07:31:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Q1cBSxYK" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7284722F0D; Wed, 20 Mar 2024 07:31:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710919876; cv=none; b=c4oGtv477w3mbJqRT5/ux/Cw9so/onwquMpRY0jsvDdEvCPdfFHs0pducLjAdXmvUDQOA6z2jkUU2Vw96xfDxBIGwoq/W7p4icAJipyuIe7/VaOXHxS9lUN+CJMmyqvj0fMTO+p3kFlViOw6WKrWUPWwjQOaKynlMj5sA3tooUs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710919876; c=relaxed/simple; bh=Ik5ahjZmxjfQ1FR/v6ZDPMYWeeijut/xAT0hg7CxjZE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=GRq1t4efoQhAssGahkeYiv/rwk9IARHR5V0SMlk/8ZX2cHvrd+FTS9yPS1ANv4+DH2JemN9/nXn1Tq8cKtQk3Wr9DqbdVgnNskBWk9EmXRWVwFZbf0he06HMEjc7+SzX0pa+9eEqEgXpJkphgjrhl+bi64DGuXTROuCDgSSf4g4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Q1cBSxYK; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 68F241BF20A; Wed, 20 Mar 2024 07:31:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1710919871; 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=voBe4cnKC0PYia7ms5iUQbaUgT546itFPRtdPkNE1ao=; b=Q1cBSxYKQaIltFJkiNRkwe6YV7E7uUhmWbptRl2p/i0RABaEw6LCltBs36y+/AFubbLIoI Gm2n0LiHp+5jjpd7Ux+FiS6cQfihpFUlZuH5uqTXDDmejoDNW7Hpg8ku5vt7sfsVzszS2C HMOZ2ydoyDCJT6i8PqzsNXNMe27Y6ArMipnHj7rDltqswrI48QRV4v716Ay18bxoAkzimR uwKKDIkLQtJ/DDeNbbAsHpAJEFXACx1sRL6UePnwjfqnQWoT3NMwHx6ocx8grfkdymdzfE VFWAH2+u8OLiNA8UfJIbY6iTIrolrARnTn8ZBx+owPUttl1KIXsf1lN13sIPeA== Message-ID: Date: Wed, 20 Mar 2024 08:31:10 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 07/13] ASoC: ti: davinci-i2s: Add TDM support To: =?UTF-8?Q?P=C3=A9ter_Ujfalusi?= , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Thomas Petazzoni , herve.codina@bootlin.com, christophercordahi@nanometrics.ca References: <20240315112745.63230-1-bastien.curutchet@bootlin.com> <20240315112745.63230-8-bastien.curutchet@bootlin.com> <9d123584-1feb-404b-890f-2da694cf56d5@gmail.com> Content-Language: en-US From: Bastien Curutchet In-Reply-To: <9d123584-1feb-404b-890f-2da694cf56d5@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-GND-Sasl: bastien.curutchet@bootlin.com Hi Péter, >> +static int davinci_i2s_set_tdm_slot(struct snd_soc_dai *cpu_dai, >> + unsigned int tx_mask, >> + unsigned int rx_mask, >> + int slots, int slot_width) >> +{ >> + struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); >> + >> + dev_dbg(dev->dev, "%s - slots %d, slot_width %d\n", __func__, slots, slot_width); > > The __func__ can be ommited, it is better to leave it for dynamic > debugging by adding "dyndbg=+pmf" module parameter if needed. > True, I'll remove the __func__. >> + >> + if (slots > 128 || !slots) { >> + dev_err(dev->dev, "Invalid number of slots\n"); >> + return -EINVAL; >> + } >> + >> + if (rx_mask != (1 << slots) - 1) { >> + dev_err(dev->dev, "Invalid RX mask (0x%08x) : all slots must be used by McBSP\n", >> + rx_mask); >> + return -EINVAL; > > This is only a restriction for RX? > Nope you're right, I'll add the same for tx_mask. >> + } >> + >> + if (davinci_i2s_tdm_word_length(slot_width) < 0) { >> + dev_err(dev->dev, "%s: Unsupported slot_width %d\n", __func__, slot_width); >> + return -EINVAL; >> + } >> + >> + dev->tdm_slots = slots; >> + dev->slot_width = slot_width; >> + >> + return 0; >> +} >> + >> #define DEFAULT_BITPERSAMPLE 16 >> >> static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, >> @@ -228,6 +282,13 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, >> DAVINCI_MCBSP_SRGR_FWID(DEFAULT_BITPERSAMPLE - 1); >> >> dev->fmt = fmt; >> + >> + if ((dev->tdm_slots || dev->slot_width) && >> + ((fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) != SND_SOC_DAIFMT_BP_FC)) { >> + dev_err(dev->dev, "TDM is only supported for BP_FC format\n"); >> + return -EINVAL; > > I think this is not a valid statement, Fsync can be generated internally > or coming from external source in TDM mode also. > My hardware allow me to only test BP_FC so I wished to put some 'barriers' in front of untested things. Best regards, Bastien