[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f2d8715d-a1ad-45a4-952f-a702b29740be@bootlin.com>
Date: Wed, 20 Mar 2024 08:31:10 +0100
From: Bastien Curutchet <bastien.curutchet@...tlin.com>
To: Péter Ujfalusi <peter.ujfalusi@...il.com>,
Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>, Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>
Cc: linux-sound@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, alsa-devel@...a-project.org,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>, herve.codina@...tlin.com,
christophercordahi@...ometrics.ca
Subject: Re: [PATCH 07/13] ASoC: ti: davinci-i2s: Add TDM support
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
Powered by blists - more mailing lists