[alsa-devel] tegra30 tdm audio support
TDM audio support for tegra30 devices.
v2: - moved edge-control and data-offset to the set_fmt callbacks - fixed dev_dbg in set_tdm callback - fixed dev_dbg message contents in set_tdm callback - changed fsync width to be permanently 1 clock
v3: - cleanup fsync patch - fix rebase issue with tdm patch
v4: - fix comment style issues - change tdm-a to data-offset 1
v5: - fix format on tdm-b
From: Edward Cragg edward.cragg@codethink.co.uk
Add a callback to configure TDM settings for the Tegra30 I2S ASoC 'platform' driver.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: merge fix for power management] [ben.dooks@codethink.co.uk: add review change for fsync of 1 clock] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk --- sound/soc/tegra/tegra30_i2s.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index ac6983c6bd72..73f0dddeaef3 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -254,6 +254,34 @@ static int tegra30_i2s_trigger(struct snd_pcm_substream *substream, int cmd, return 0; }
+static int tegra30_i2s_set_tdm(struct snd_soc_dai *dai, + unsigned int tx_mask, unsigned int rx_mask, + int slots, int slot_width) +{ + struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); + unsigned int mask, val; + + dev_dbg(dai->dev, "%s: txmask=0x%08x rxmask=0x%08x slots=%d width=%d\n", + __func__, tx_mask, rx_mask, slots, slot_width); + + mask = TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_MASK | + TEGRA30_I2S_SLOT_CTRL_RX_SLOT_ENABLES_MASK | + TEGRA30_I2S_SLOT_CTRL_TX_SLOT_ENABLES_MASK; + + val = (tx_mask << TEGRA30_I2S_SLOT_CTRL_TX_SLOT_ENABLES_SHIFT) | + (rx_mask << TEGRA30_I2S_SLOT_CTRL_RX_SLOT_ENABLES_SHIFT) | + ((slots - 1) << TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_SHIFT); + + pm_runtime_get_sync(dai->dev); + regmap_update_bits(i2s->regmap, TEGRA30_I2S_SLOT_CTRL, mask, val); + /* set the fsync width to minimum of 1 clock width */ + regmap_update_bits(i2s->regmap, TEGRA30_I2S_CH_CTRL, + TEGRA30_I2S_CH_CTRL_FSYNC_WIDTH_MASK, 0x0); + pm_runtime_put(dai->dev); + + return 0; +} + static int tegra30_i2s_probe(struct snd_soc_dai *dai) { struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); @@ -268,6 +296,7 @@ static const struct snd_soc_dai_ops tegra30_i2s_dai_ops = { .set_fmt = tegra30_i2s_set_fmt, .hw_params = tegra30_i2s_hw_params, .trigger = tegra30_i2s_trigger, + .set_tdm_slot = tegra30_i2s_set_tdm, };
static const struct snd_soc_dai_driver tegra30_i2s_dai_template = {
On 18/10/2019 16:48, Ben Dooks wrote:
From: Edward Cragg edward.cragg@codethink.co.uk
Add a callback to configure TDM settings for the Tegra30 I2S ASoC 'platform' driver.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: merge fix for power management] [ben.dooks@codethink.co.uk: add review change for fsync of 1 clock] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk
sound/soc/tegra/tegra30_i2s.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index ac6983c6bd72..73f0dddeaef3 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -254,6 +254,34 @@ static int tegra30_i2s_trigger(struct snd_pcm_substream *substream, int cmd, return 0; }
+static int tegra30_i2s_set_tdm(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask,
int slots, int slot_width)
+{
- struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai);
- unsigned int mask, val;
- dev_dbg(dai->dev, "%s: txmask=0x%08x rxmask=0x%08x slots=%d width=%d\n",
__func__, tx_mask, rx_mask, slots, slot_width);
- mask = TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_MASK |
TEGRA30_I2S_SLOT_CTRL_RX_SLOT_ENABLES_MASK |
TEGRA30_I2S_SLOT_CTRL_TX_SLOT_ENABLES_MASK;
- val = (tx_mask << TEGRA30_I2S_SLOT_CTRL_TX_SLOT_ENABLES_SHIFT) |
(rx_mask << TEGRA30_I2S_SLOT_CTRL_RX_SLOT_ENABLES_SHIFT) |
((slots - 1) << TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_SHIFT);
- pm_runtime_get_sync(dai->dev);
- regmap_update_bits(i2s->regmap, TEGRA30_I2S_SLOT_CTRL, mask, val);
- /* set the fsync width to minimum of 1 clock width */
- regmap_update_bits(i2s->regmap, TEGRA30_I2S_CH_CTRL,
TEGRA30_I2S_CH_CTRL_FSYNC_WIDTH_MASK, 0x0);
- pm_runtime_put(dai->dev);
- return 0;
+}
static int tegra30_i2s_probe(struct snd_soc_dai *dai) { struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); @@ -268,6 +296,7 @@ static const struct snd_soc_dai_ops tegra30_i2s_dai_ops = { .set_fmt = tegra30_i2s_set_fmt, .hw_params = tegra30_i2s_hw_params, .trigger = tegra30_i2s_trigger,
- .set_tdm_slot = tegra30_i2s_set_tdm,
};
static const struct snd_soc_dai_driver tegra30_i2s_dai_template = {
Thanks!
Reviewed-by: Jon Hunter jonathanh@nvidia.com
Cheers Jon
The patch
ASoC: tegra: add a TDM configuration callback
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 07932563686a6c51b26266c8572901c46fd1cd55 Mon Sep 17 00:00:00 2001
From: Edward Cragg edward.cragg@codethink.co.uk Date: Fri, 18 Oct 2019 16:48:27 +0100 Subject: [PATCH] ASoC: tegra: add a TDM configuration callback
Add a callback to configure TDM settings for the Tegra30 I2S ASoC 'platform' driver.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: merge fix for power management] [ben.dooks@codethink.co.uk: add review change for fsync of 1 clock] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk Reviewed-by: Jon Hunter jonathanh@nvidia.com Link: https://lore.kernel.org/r/20191018154833.7560-2-ben.dooks@codethink.co.uk Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/tegra/tegra30_i2s.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 48a09c9d60be..8f8924060d9d 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -265,6 +265,34 @@ static int tegra30_i2s_trigger(struct snd_pcm_substream *substream, int cmd, return 0; }
+static int tegra30_i2s_set_tdm(struct snd_soc_dai *dai, + unsigned int tx_mask, unsigned int rx_mask, + int slots, int slot_width) +{ + struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); + unsigned int mask, val; + + dev_dbg(dai->dev, "%s: txmask=0x%08x rxmask=0x%08x slots=%d width=%d\n", + __func__, tx_mask, rx_mask, slots, slot_width); + + mask = TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_MASK | + TEGRA30_I2S_SLOT_CTRL_RX_SLOT_ENABLES_MASK | + TEGRA30_I2S_SLOT_CTRL_TX_SLOT_ENABLES_MASK; + + val = (tx_mask << TEGRA30_I2S_SLOT_CTRL_TX_SLOT_ENABLES_SHIFT) | + (rx_mask << TEGRA30_I2S_SLOT_CTRL_RX_SLOT_ENABLES_SHIFT) | + ((slots - 1) << TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_SHIFT); + + pm_runtime_get_sync(dai->dev); + regmap_update_bits(i2s->regmap, TEGRA30_I2S_SLOT_CTRL, mask, val); + /* set the fsync width to minimum of 1 clock width */ + regmap_update_bits(i2s->regmap, TEGRA30_I2S_CH_CTRL, + TEGRA30_I2S_CH_CTRL_FSYNC_WIDTH_MASK, 0x0); + pm_runtime_put(dai->dev); + + return 0; +} + static int tegra30_i2s_probe(struct snd_soc_dai *dai) { struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); @@ -279,6 +307,7 @@ static const struct snd_soc_dai_ops tegra30_i2s_dai_ops = { .set_fmt = tegra30_i2s_set_fmt, .hw_params = tegra30_i2s_hw_params, .trigger = tegra30_i2s_trigger, + .set_tdm_slot = tegra30_i2s_set_tdm, };
static const struct snd_soc_dai_driver tegra30_i2s_dai_template = {
From: Edward Cragg edward.cragg@codethink.co.uk
The tegra3 audio can support 24 and 32 bit sample sizes so add the option to the tegra30_i2s_hw_params to configure the S24_LE or S32_LE formats when requested.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] [ben.dooks@codethink.co.uk: add pm calls around ytdm config] [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk --- squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code --- sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 73f0dddeaef3..063f34c882af 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, struct device *dev = dai->dev; struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); unsigned int mask, val, reg; - int ret, sample_size, srate, i2sclock, bitcnt; + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; struct tegra30_ahub_cif_conf cif_conf;
if (params_channels(params) != 2) @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_16; + audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break; + case SNDRV_PCM_FORMAT_S24_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; + audio_bits = TEGRA30_AUDIOCIF_BITS_24; + sample_size = 24; + break; + case SNDRV_PCM_FORMAT_S32_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; + audio_bits = TEGRA30_AUDIOCIF_BITS_32; + sample_size = 32; + break; default: return -EINVAL; } @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, cif_conf.threshold = 0; cif_conf.audio_channels = 2; cif_conf.client_channels = 2; - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; + cif_conf.audio_bits = audio_bits; + cif_conf.client_bits = audio_bits; cif_conf.expand = 0; cif_conf.stereo_conv = 0; cif_conf.replicate = 0; @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops, .symmetric_rates = 1,
On 18/10/2019 16:48, Ben Dooks wrote:
From: Edward Cragg edward.cragg@codethink.co.uk
The tegra3 audio can support 24 and 32 bit sample sizes so add the option to the tegra30_i2s_hw_params to configure the S24_LE or S32_LE formats when requested.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] [ben.dooks@codethink.co.uk: add pm calls around ytdm config] [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk
squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 73f0dddeaef3..063f34c882af 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, struct device *dev = dai->dev; struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); unsigned int mask, val, reg;
- int ret, sample_size, srate, i2sclock, bitcnt;
int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; struct tegra30_ahub_cif_conf cif_conf;
if (params_channels(params) != 2)
@@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_16;
sample_size = 16; break;audio_bits = TEGRA30_AUDIOCIF_BITS_16;
- case SNDRV_PCM_FORMAT_S24_LE:
val = TEGRA30_I2S_CTRL_BIT_SIZE_24;
audio_bits = TEGRA30_AUDIOCIF_BITS_24;
sample_size = 24;
break;
- case SNDRV_PCM_FORMAT_S32_LE:
val = TEGRA30_I2S_CTRL_BIT_SIZE_32;
audio_bits = TEGRA30_AUDIOCIF_BITS_32;
sample_size = 32;
default: return -EINVAL; }break;
@@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, cif_conf.threshold = 0; cif_conf.audio_channels = 2; cif_conf.client_channels = 2;
- cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16;
- cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16;
- cif_conf.audio_bits = audio_bits;
- cif_conf.client_bits = audio_bits; cif_conf.expand = 0; cif_conf.stereo_conv = 0; cif_conf.replicate = 0;
@@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
.formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
}, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000,SNDRV_PCM_FMTBIT_S16_LE,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
.formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
}, .ops = &tegra30_i2s_dai_ops, .symmetric_rates = 1,SNDRV_PCM_FMTBIT_S16_LE,
Thanks!
Reviewed-by: Jon Hunter jonathanh@nvidia.com
Cheers Jon
The patch
ASoC: tegra: Allow 24bit and 32bit samples
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From f3ee99087c8ca0ecfdd549ef5a94f557c42d5428 Mon Sep 17 00:00:00 2001
From: Edward Cragg edward.cragg@codethink.co.uk Date: Fri, 18 Oct 2019 16:48:28 +0100 Subject: [PATCH] ASoC: tegra: Allow 24bit and 32bit samples
The tegra3 audio can support 24 and 32 bit sample sizes so add the option to the tegra30_i2s_hw_params to configure the S24_LE or S32_LE formats when requested.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] [ben.dooks@codethink.co.uk: add pm calls around ytdm config] [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk Reviewed-by: Jon Hunter jonathanh@nvidia.com Link: https://lore.kernel.org/r/20191018154833.7560-3-ben.dooks@codethink.co.uk Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index e6d548fa980b..48a09c9d60be 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, struct device *dev = dai->dev; struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); unsigned int mask, val, reg; - int ret, sample_size, srate, i2sclock, bitcnt; + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; struct tegra30_ahub_cif_conf cif_conf;
if (params_channels(params) != 2) @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_16; + audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break; + case SNDRV_PCM_FORMAT_S24_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; + audio_bits = TEGRA30_AUDIOCIF_BITS_24; + sample_size = 24; + break; + case SNDRV_PCM_FORMAT_S32_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; + audio_bits = TEGRA30_AUDIOCIF_BITS_32; + sample_size = 32; + break; default: return -EINVAL; } @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, cif_conf.threshold = 0; cif_conf.audio_channels = 2; cif_conf.client_channels = 2; - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; + cif_conf.audio_bits = audio_bits; + cif_conf.client_bits = audio_bits; cif_conf.expand = 0; cif_conf.stereo_conv = 0; cif_conf.replicate = 0; @@ -277,14 +288,18 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops, .symmetric_rates = 1,
18.10.2019 18:48, Ben Dooks пишет:
From: Edward Cragg edward.cragg@codethink.co.uk
The tegra3 audio can support 24 and 32 bit sample sizes so add the option to the tegra30_i2s_hw_params to configure the S24_LE or S32_LE formats when requested.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] [ben.dooks@codethink.co.uk: add pm calls around ytdm config] [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk
squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 73f0dddeaef3..063f34c882af 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, struct device *dev = dai->dev; struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); unsigned int mask, val, reg;
- int ret, sample_size, srate, i2sclock, bitcnt;
int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; struct tegra30_ahub_cif_conf cif_conf;
if (params_channels(params) != 2)
@@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_16;
sample_size = 16; break;audio_bits = TEGRA30_AUDIOCIF_BITS_16;
- case SNDRV_PCM_FORMAT_S24_LE:
val = TEGRA30_I2S_CTRL_BIT_SIZE_24;
audio_bits = TEGRA30_AUDIOCIF_BITS_24;
sample_size = 24;
break;
- case SNDRV_PCM_FORMAT_S32_LE:
val = TEGRA30_I2S_CTRL_BIT_SIZE_32;
audio_bits = TEGRA30_AUDIOCIF_BITS_32;
sample_size = 32;
default: return -EINVAL; }break;
@@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, cif_conf.threshold = 0; cif_conf.audio_channels = 2; cif_conf.client_channels = 2;
- cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16;
- cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16;
- cif_conf.audio_bits = audio_bits;
- cif_conf.client_bits = audio_bits; cif_conf.expand = 0; cif_conf.stereo_conv = 0; cif_conf.replicate = 0;
@@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
.formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
}, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000,SNDRV_PCM_FMTBIT_S16_LE,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
.formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
}, .ops = &tegra30_i2s_dai_ops, .symmetric_rates = 1,SNDRV_PCM_FMTBIT_S16_LE,
Hello,
This patch breaks audio on Tegra30. I don't see errors anywhere, but there is no audio and reverting this patch helps. Please fix it.
On 23/11/2019 21:09, Dmitry Osipenko wrote:
18.10.2019 18:48, Ben Dooks пишет:
From: Edward Cragg edward.cragg@codethink.co.uk
The tegra3 audio can support 24 and 32 bit sample sizes so add the option to the tegra30_i2s_hw_params to configure the S24_LE or S32_LE formats when requested.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] [ben.dooks@codethink.co.uk: add pm calls around ytdm config] [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk
squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 73f0dddeaef3..063f34c882af 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, struct device *dev = dai->dev; struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); unsigned int mask, val, reg;
- int ret, sample_size, srate, i2sclock, bitcnt;
int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; struct tegra30_ahub_cif_conf cif_conf;
if (params_channels(params) != 2)
@@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_16;
sample_size = 16; break;audio_bits = TEGRA30_AUDIOCIF_BITS_16;
- case SNDRV_PCM_FORMAT_S24_LE:
val = TEGRA30_I2S_CTRL_BIT_SIZE_24;
audio_bits = TEGRA30_AUDIOCIF_BITS_24;
sample_size = 24;
break;
- case SNDRV_PCM_FORMAT_S32_LE:
val = TEGRA30_I2S_CTRL_BIT_SIZE_32;
audio_bits = TEGRA30_AUDIOCIF_BITS_32;
sample_size = 32;
default: return -EINVAL; }break;
@@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, cif_conf.threshold = 0; cif_conf.audio_channels = 2; cif_conf.client_channels = 2;
- cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16;
- cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16;
- cif_conf.audio_bits = audio_bits;
- cif_conf.client_bits = audio_bits; cif_conf.expand = 0; cif_conf.stereo_conv = 0; cif_conf.replicate = 0;
@@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
.formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
}, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000,SNDRV_PCM_FMTBIT_S16_LE,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
.formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
}, .ops = &tegra30_i2s_dai_ops, .symmetric_rates = 1,SNDRV_PCM_FMTBIT_S16_LE,
Hello,
This patch breaks audio on Tegra30. I don't see errors anywhere, but there is no audio and reverting this patch helps. Please fix it.
What is the failure mode? I can try and take a look at this some time this week, but I am not sure if I have any boards with an actual useful audio output?
25.11.2019 13:37, Ben Dooks пишет:
On 23/11/2019 21:09, Dmitry Osipenko wrote:
18.10.2019 18:48, Ben Dooks пишет:
From: Edward Cragg edward.cragg@codethink.co.uk
The tegra3 audio can support 24 and 32 bit sample sizes so add the option to the tegra30_i2s_hw_params to configure the S24_LE or S32_LE formats when requested.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] [ben.dooks@codethink.co.uk: add pm calls around ytdm config] [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk
squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 73f0dddeaef3..063f34c882af 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, struct device *dev = dai->dev; struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); unsigned int mask, val, reg; - int ret, sample_size, srate, i2sclock, bitcnt; + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; struct tegra30_ahub_cif_conf cif_conf; if (params_channels(params) != 2) @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_16; + audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break; + case SNDRV_PCM_FORMAT_S24_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; + audio_bits = TEGRA30_AUDIOCIF_BITS_24; + sample_size = 24; + break; + case SNDRV_PCM_FORMAT_S32_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; + audio_bits = TEGRA30_AUDIOCIF_BITS_32; + sample_size = 32; + break; default: return -EINVAL; } @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, cif_conf.threshold = 0; cif_conf.audio_channels = 2; cif_conf.client_channels = 2; - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; + cif_conf.audio_bits = audio_bits; + cif_conf.client_bits = audio_bits; cif_conf.expand = 0; cif_conf.stereo_conv = 0; cif_conf.replicate = 0; @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops, .symmetric_rates = 1,
Hello,
This patch breaks audio on Tegra30. I don't see errors anywhere, but there is no audio and reverting this patch helps. Please fix it.
What is the failure mode? I can try and take a look at this some time this week, but I am not sure if I have any boards with an actual useful audio output?
The failure mode is that there no sound. I also noticed that video playback stutters a lot if movie file has audio track, seems something times out during of the audio playback. For now I don't have any more info.
25.11.2019 20:22, Dmitry Osipenko пишет:
25.11.2019 13:37, Ben Dooks пишет:
On 23/11/2019 21:09, Dmitry Osipenko wrote:
18.10.2019 18:48, Ben Dooks пишет:
From: Edward Cragg edward.cragg@codethink.co.uk
The tegra3 audio can support 24 and 32 bit sample sizes so add the option to the tegra30_i2s_hw_params to configure the S24_LE or S32_LE formats when requested.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] [ben.dooks@codethink.co.uk: add pm calls around ytdm config] [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk
squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 73f0dddeaef3..063f34c882af 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, struct device *dev = dai->dev; struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); unsigned int mask, val, reg; - int ret, sample_size, srate, i2sclock, bitcnt; + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; struct tegra30_ahub_cif_conf cif_conf; if (params_channels(params) != 2) @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_16; + audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break; + case SNDRV_PCM_FORMAT_S24_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; + audio_bits = TEGRA30_AUDIOCIF_BITS_24; + sample_size = 24; + break; + case SNDRV_PCM_FORMAT_S32_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; + audio_bits = TEGRA30_AUDIOCIF_BITS_32; + sample_size = 32; + break; default: return -EINVAL; } @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, cif_conf.threshold = 0; cif_conf.audio_channels = 2; cif_conf.client_channels = 2; - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; + cif_conf.audio_bits = audio_bits; + cif_conf.client_bits = audio_bits; cif_conf.expand = 0; cif_conf.stereo_conv = 0; cif_conf.replicate = 0; @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops, .symmetric_rates = 1,
Hello,
This patch breaks audio on Tegra30. I don't see errors anywhere, but there is no audio and reverting this patch helps. Please fix it.
What is the failure mode? I can try and take a look at this some time this week, but I am not sure if I have any boards with an actual useful audio output?
The failure mode is that there no sound. I also noticed that video playback stutters a lot if movie file has audio track, seems something times out during of the audio playback. For now I don't have any more info.
Oh, I didn't say how to reproduce it.. for example simply playing big_buck_bunny_720p_h264.mov in MPV has the audio problem.
https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h...
25.11.2019 20:28, Dmitry Osipenko пишет:
25.11.2019 20:22, Dmitry Osipenko пишет:
25.11.2019 13:37, Ben Dooks пишет:
On 23/11/2019 21:09, Dmitry Osipenko wrote:
18.10.2019 18:48, Ben Dooks пишет:
From: Edward Cragg edward.cragg@codethink.co.uk
The tegra3 audio can support 24 and 32 bit sample sizes so add the option to the tegra30_i2s_hw_params to configure the S24_LE or S32_LE formats when requested.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] [ben.dooks@codethink.co.uk: add pm calls around ytdm config] [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk
squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 73f0dddeaef3..063f34c882af 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, struct device *dev = dai->dev; struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); unsigned int mask, val, reg; - int ret, sample_size, srate, i2sclock, bitcnt; + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; struct tegra30_ahub_cif_conf cif_conf; if (params_channels(params) != 2) @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_16; + audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break; + case SNDRV_PCM_FORMAT_S24_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; + audio_bits = TEGRA30_AUDIOCIF_BITS_24; + sample_size = 24; + break; + case SNDRV_PCM_FORMAT_S32_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; + audio_bits = TEGRA30_AUDIOCIF_BITS_32; + sample_size = 32; + break; default: return -EINVAL; } @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, cif_conf.threshold = 0; cif_conf.audio_channels = 2; cif_conf.client_channels = 2; - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; + cif_conf.audio_bits = audio_bits; + cif_conf.client_bits = audio_bits; cif_conf.expand = 0; cif_conf.stereo_conv = 0; cif_conf.replicate = 0; @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops, .symmetric_rates = 1,
Hello,
This patch breaks audio on Tegra30. I don't see errors anywhere, but there is no audio and reverting this patch helps. Please fix it.
What is the failure mode? I can try and take a look at this some time this week, but I am not sure if I have any boards with an actual useful audio output?
The failure mode is that there no sound. I also noticed that video playback stutters a lot if movie file has audio track, seems something times out during of the audio playback. For now I don't have any more info.
Oh, I didn't say how to reproduce it.. for example simply playing big_buck_bunny_720p_h264.mov in MPV has the audio problem.
https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h...
Hello Ben,
Do you have any updates? I just re-check whether problem persists and it's still there using a recent linux-next.
Interestingly, I can hear some sound now, but it's very distorted.
If you don't have a solution, then what about to revert the patches for now and try again later on?
On 19/12/2019 21:21, Dmitry Osipenko wrote:
25.11.2019 20:28, Dmitry Osipenko пишет:
25.11.2019 20:22, Dmitry Osipenko пишет:
25.11.2019 13:37, Ben Dooks пишет:
On 23/11/2019 21:09, Dmitry Osipenko wrote:
18.10.2019 18:48, Ben Dooks пишет:
From: Edward Cragg edward.cragg@codethink.co.uk
The tegra3 audio can support 24 and 32 bit sample sizes so add the option to the tegra30_i2s_hw_params to configure the S24_LE or S32_LE formats when requested.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] [ben.dooks@codethink.co.uk: add pm calls around ytdm config] [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk
squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 73f0dddeaef3..063f34c882af 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, struct device *dev = dai->dev; struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); unsigned int mask, val, reg; - int ret, sample_size, srate, i2sclock, bitcnt; + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; struct tegra30_ahub_cif_conf cif_conf; if (params_channels(params) != 2) @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_16; + audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break; + case SNDRV_PCM_FORMAT_S24_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; + audio_bits = TEGRA30_AUDIOCIF_BITS_24; + sample_size = 24; + break; + case SNDRV_PCM_FORMAT_S32_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; + audio_bits = TEGRA30_AUDIOCIF_BITS_32; + sample_size = 32; + break; default: return -EINVAL; } @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, cif_conf.threshold = 0; cif_conf.audio_channels = 2; cif_conf.client_channels = 2; - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; + cif_conf.audio_bits = audio_bits; + cif_conf.client_bits = audio_bits; cif_conf.expand = 0; cif_conf.stereo_conv = 0; cif_conf.replicate = 0; @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops, .symmetric_rates = 1,
Hello,
This patch breaks audio on Tegra30. I don't see errors anywhere, but there is no audio and reverting this patch helps. Please fix it.
What is the failure mode? I can try and take a look at this some time this week, but I am not sure if I have any boards with an actual useful audio output?
The failure mode is that there no sound. I also noticed that video playback stutters a lot if movie file has audio track, seems something times out during of the audio playback. For now I don't have any more info.
Oh, I didn't say how to reproduce it.. for example simply playing big_buck_bunny_720p_h264.mov in MPV has the audio problem.
https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h...
Hello Ben,
Do you have any updates? I just re-check whether problem persists and it's still there using a recent linux-next.
Interestingly, I can hear some sound now, but it's very distorted.
If you don't have a solution, then what about to revert the patches for now and try again later on?
I will try and have a look later, I had completely forgotten these had been merged.
On 25/11/2019 17:28, Dmitry Osipenko wrote:
25.11.2019 20:22, Dmitry Osipenko пишет:
25.11.2019 13:37, Ben Dooks пишет:
On 23/11/2019 21:09, Dmitry Osipenko wrote:
18.10.2019 18:48, Ben Dooks пишет:
From: Edward Cragg edward.cragg@codethink.co.uk
The tegra3 audio can support 24 and 32 bit sample sizes so add the option to the tegra30_i2s_hw_params to configure the S24_LE or S32_LE formats when requested.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] [ben.dooks@codethink.co.uk: add pm calls around ytdm config] [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk
squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 73f0dddeaef3..063f34c882af 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, struct device *dev = dai->dev; struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); unsigned int mask, val, reg; - int ret, sample_size, srate, i2sclock, bitcnt; + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; struct tegra30_ahub_cif_conf cif_conf; if (params_channels(params) != 2) @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_16; + audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break; + case SNDRV_PCM_FORMAT_S24_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; + audio_bits = TEGRA30_AUDIOCIF_BITS_24; + sample_size = 24; + break; + case SNDRV_PCM_FORMAT_S32_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; + audio_bits = TEGRA30_AUDIOCIF_BITS_32; + sample_size = 32; + break; default: return -EINVAL; } @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, cif_conf.threshold = 0; cif_conf.audio_channels = 2; cif_conf.client_channels = 2; - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; + cif_conf.audio_bits = audio_bits; + cif_conf.client_bits = audio_bits; cif_conf.expand = 0; cif_conf.stereo_conv = 0; cif_conf.replicate = 0; @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops, .symmetric_rates = 1,
Hello,
This patch breaks audio on Tegra30. I don't see errors anywhere, but there is no audio and reverting this patch helps. Please fix it.
What is the failure mode? I can try and take a look at this some time this week, but I am not sure if I have any boards with an actual useful audio output?
The failure mode is that there no sound. I also noticed that video playback stutters a lot if movie file has audio track, seems something times out during of the audio playback. For now I don't have any more info.
Oh, I didn't say how to reproduce it.. for example simply playing big_buck_bunny_720p_h264.mov in MPV has the audio problem.
https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h...
Given that the audio drivers uses regmap, it could be good to dump the I2S/AHUB registers while the clip if playing with and without this patch to see the differences. I am curious if the audio is now being played as 24 or 32-bit instead of 16-bit now these are available.
You could also dump the hw_params to see the format while playing as well ...
$ /proc/asound/<scard-name>/pcm0p/sub0/hw_params
Jon
On 20/12/2019 11:30, Jon Hunter wrote:
On 25/11/2019 17:28, Dmitry Osipenko wrote:
25.11.2019 20:22, Dmitry Osipenko пишет:
25.11.2019 13:37, Ben Dooks пишет:
On 23/11/2019 21:09, Dmitry Osipenko wrote:
18.10.2019 18:48, Ben Dooks пишет:
From: Edward Cragg edward.cragg@codethink.co.uk
The tegra3 audio can support 24 and 32 bit sample sizes so add the option to the tegra30_i2s_hw_params to configure the S24_LE or S32_LE formats when requested.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] [ben.dooks@codethink.co.uk: add pm calls around ytdm config] [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk
squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code
sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 73f0dddeaef3..063f34c882af 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, struct device *dev = dai->dev; struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); unsigned int mask, val, reg; - int ret, sample_size, srate, i2sclock, bitcnt; + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; struct tegra30_ahub_cif_conf cif_conf; if (params_channels(params) != 2) @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_16; + audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break; + case SNDRV_PCM_FORMAT_S24_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; + audio_bits = TEGRA30_AUDIOCIF_BITS_24; + sample_size = 24; + break; + case SNDRV_PCM_FORMAT_S32_LE: + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; + audio_bits = TEGRA30_AUDIOCIF_BITS_32; + sample_size = 32; + break; default: return -EINVAL; } @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, cif_conf.threshold = 0; cif_conf.audio_channels = 2; cif_conf.client_channels = 2; - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; + cif_conf.audio_bits = audio_bits; + cif_conf.client_bits = audio_bits; cif_conf.expand = 0; cif_conf.stereo_conv = 0; cif_conf.replicate = 0; @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S32_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops, .symmetric_rates = 1,
Hello,
This patch breaks audio on Tegra30. I don't see errors anywhere, but there is no audio and reverting this patch helps. Please fix it.
What is the failure mode? I can try and take a look at this some time this week, but I am not sure if I have any boards with an actual useful audio output?
The failure mode is that there no sound. I also noticed that video playback stutters a lot if movie file has audio track, seems something times out during of the audio playback. For now I don't have any more info.
Oh, I didn't say how to reproduce it.. for example simply playing big_buck_bunny_720p_h264.mov in MPV has the audio problem.
https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h...
Given that the audio drivers uses regmap, it could be good to dump the I2S/AHUB registers while the clip if playing with and without this patch to see the differences. I am curious if the audio is now being played as 24 or 32-bit instead of 16-bit now these are available.
You could also dump the hw_params to see the format while playing as well ...
$ /proc/asound/<scard-name>/pcm0p/sub0/hw_params
I suppose it is also possible that the codec isn't properly doing >16 bits and the fact we now offer 24 and 32 could be an issue. I've not got anything with an audio output on it that would be easy to test.
On 20/12/2019 11:38, Ben Dooks wrote:
On 20/12/2019 11:30, Jon Hunter wrote:
On 25/11/2019 17:28, Dmitry Osipenko wrote:
25.11.2019 20:22, Dmitry Osipenko пишет:
25.11.2019 13:37, Ben Dooks пишет:
On 23/11/2019 21:09, Dmitry Osipenko wrote:
18.10.2019 18:48, Ben Dooks пишет: > From: Edward Cragg edward.cragg@codethink.co.uk > > The tegra3 audio can support 24 and 32 bit sample sizes so add the > option to the tegra30_i2s_hw_params to configure the S24_LE or > S32_LE > formats when requested. > > Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk > [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] > [ben.dooks@codethink.co.uk: add pm calls around ytdm config] > [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] > Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk > --- > squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is > needed > in tdm code > > ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code > --- > sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- > 1 file changed, 20 insertions(+), 5 deletions(-) > > diff --git a/sound/soc/tegra/tegra30_i2s.c > b/sound/soc/tegra/tegra30_i2s.c > index 73f0dddeaef3..063f34c882af 100644 > --- a/sound/soc/tegra/tegra30_i2s.c > +++ b/sound/soc/tegra/tegra30_i2s.c > @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct > snd_pcm_substream *substream, > struct device *dev = dai->dev; > struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); > unsigned int mask, val, reg; > - int ret, sample_size, srate, i2sclock, bitcnt; > + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; > struct tegra30_ahub_cif_conf cif_conf; > if (params_channels(params) != 2) > @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct > snd_pcm_substream *substream, > switch (params_format(params)) { > case SNDRV_PCM_FORMAT_S16_LE: > val = TEGRA30_I2S_CTRL_BIT_SIZE_16; > + audio_bits = TEGRA30_AUDIOCIF_BITS_16; > sample_size = 16; > break; > + case SNDRV_PCM_FORMAT_S24_LE: > + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; > + audio_bits = TEGRA30_AUDIOCIF_BITS_24; > + sample_size = 24; > + break; > + case SNDRV_PCM_FORMAT_S32_LE: > + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; > + audio_bits = TEGRA30_AUDIOCIF_BITS_32; > + sample_size = 32; > + break; > default: > return -EINVAL; > } > @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct > snd_pcm_substream *substream, > cif_conf.threshold = 0; > cif_conf.audio_channels = 2; > cif_conf.client_channels = 2; > - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; > - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; > + cif_conf.audio_bits = audio_bits; > + cif_conf.client_bits = audio_bits; > cif_conf.expand = 0; > cif_conf.stereo_conv = 0; > cif_conf.replicate = 0; > @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver > tegra30_i2s_dai_template = { > .channels_min = 2, > .channels_max = 2, > .rates = SNDRV_PCM_RATE_8000_96000, > - .formats = SNDRV_PCM_FMTBIT_S16_LE, > + .formats = SNDRV_PCM_FMTBIT_S32_LE | > + SNDRV_PCM_FMTBIT_S24_LE | > + SNDRV_PCM_FMTBIT_S16_LE, > }, > .capture = { > .stream_name = "Capture", > .channels_min = 2, > .channels_max = 2, > .rates = SNDRV_PCM_RATE_8000_96000, > - .formats = SNDRV_PCM_FMTBIT_S16_LE, > + .formats = SNDRV_PCM_FMTBIT_S32_LE | > + SNDRV_PCM_FMTBIT_S24_LE | > + SNDRV_PCM_FMTBIT_S16_LE, > }, > .ops = &tegra30_i2s_dai_ops, > .symmetric_rates = 1, >
Hello,
This patch breaks audio on Tegra30. I don't see errors anywhere, but there is no audio and reverting this patch helps. Please fix it.
What is the failure mode? I can try and take a look at this some time this week, but I am not sure if I have any boards with an actual useful audio output?
The failure mode is that there no sound. I also noticed that video playback stutters a lot if movie file has audio track, seems something times out during of the audio playback. For now I don't have any more info.
Oh, I didn't say how to reproduce it.. for example simply playing big_buck_bunny_720p_h264.mov in MPV has the audio problem.
https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h...
Given that the audio drivers uses regmap, it could be good to dump the I2S/AHUB registers while the clip if playing with and without this patch to see the differences. I am curious if the audio is now being played as 24 or 32-bit instead of 16-bit now these are available.
You could also dump the hw_params to see the format while playing as well ...
$ /proc/asound/<scard-name>/pcm0p/sub0/hw_params
I suppose it is also possible that the codec isn't properly doing >16 bits and the fact we now offer 24 and 32 could be an issue. I've not got anything with an audio output on it that would be easy to test.
I thought I had tested on a Jetson TK1 (Tegra124) but it was sometime back. However, admittedly I may have only done simple 16-bit testing with speaker-test.
We do verify that all soundcards are detected and registered as expected during daily testing, but at the moment we don't have anything that verifies actual playback.
Jon
20.12.2019 16:57, Jon Hunter пишет:
On 20/12/2019 11:38, Ben Dooks wrote:
On 20/12/2019 11:30, Jon Hunter wrote:
On 25/11/2019 17:28, Dmitry Osipenko wrote:
25.11.2019 20:22, Dmitry Osipenko пишет:
25.11.2019 13:37, Ben Dooks пишет:
On 23/11/2019 21:09, Dmitry Osipenko wrote: > 18.10.2019 18:48, Ben Dooks пишет: >> From: Edward Cragg edward.cragg@codethink.co.uk >> >> The tegra3 audio can support 24 and 32 bit sample sizes so add the >> option to the tegra30_i2s_hw_params to configure the S24_LE or >> S32_LE >> formats when requested. >> >> Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk >> [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] >> [ben.dooks@codethink.co.uk: add pm calls around ytdm config] >> [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] >> Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk >> --- >> squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is >> needed >> in tdm code >> >> ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code >> --- >> sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- >> 1 file changed, 20 insertions(+), 5 deletions(-) >> >> diff --git a/sound/soc/tegra/tegra30_i2s.c >> b/sound/soc/tegra/tegra30_i2s.c >> index 73f0dddeaef3..063f34c882af 100644 >> --- a/sound/soc/tegra/tegra30_i2s.c >> +++ b/sound/soc/tegra/tegra30_i2s.c >> @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct >> snd_pcm_substream *substream, >> struct device *dev = dai->dev; >> struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); >> unsigned int mask, val, reg; >> - int ret, sample_size, srate, i2sclock, bitcnt; >> + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; >> struct tegra30_ahub_cif_conf cif_conf; >> if (params_channels(params) != 2) >> @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct >> snd_pcm_substream *substream, >> switch (params_format(params)) { >> case SNDRV_PCM_FORMAT_S16_LE: >> val = TEGRA30_I2S_CTRL_BIT_SIZE_16; >> + audio_bits = TEGRA30_AUDIOCIF_BITS_16; >> sample_size = 16; >> break; >> + case SNDRV_PCM_FORMAT_S24_LE: >> + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; >> + audio_bits = TEGRA30_AUDIOCIF_BITS_24; >> + sample_size = 24; >> + break; >> + case SNDRV_PCM_FORMAT_S32_LE: >> + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; >> + audio_bits = TEGRA30_AUDIOCIF_BITS_32; >> + sample_size = 32; >> + break; >> default: >> return -EINVAL; >> } >> @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct >> snd_pcm_substream *substream, >> cif_conf.threshold = 0; >> cif_conf.audio_channels = 2; >> cif_conf.client_channels = 2; >> - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; >> - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; >> + cif_conf.audio_bits = audio_bits; >> + cif_conf.client_bits = audio_bits; >> cif_conf.expand = 0; >> cif_conf.stereo_conv = 0; >> cif_conf.replicate = 0; >> @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver >> tegra30_i2s_dai_template = { >> .channels_min = 2, >> .channels_max = 2, >> .rates = SNDRV_PCM_RATE_8000_96000, >> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >> + SNDRV_PCM_FMTBIT_S24_LE | >> + SNDRV_PCM_FMTBIT_S16_LE, >> }, >> .capture = { >> .stream_name = "Capture", >> .channels_min = 2, >> .channels_max = 2, >> .rates = SNDRV_PCM_RATE_8000_96000, >> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >> + SNDRV_PCM_FMTBIT_S24_LE | >> + SNDRV_PCM_FMTBIT_S16_LE, >> }, >> .ops = &tegra30_i2s_dai_ops, >> .symmetric_rates = 1, >> > > Hello, > > This patch breaks audio on Tegra30. I don't see errors anywhere, but > there is no audio and reverting this patch helps. Please fix it.
What is the failure mode? I can try and take a look at this some time this week, but I am not sure if I have any boards with an actual useful audio output?
The failure mode is that there no sound. I also noticed that video playback stutters a lot if movie file has audio track, seems something times out during of the audio playback. For now I don't have any more info.
Oh, I didn't say how to reproduce it.. for example simply playing big_buck_bunny_720p_h264.mov in MPV has the audio problem.
https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h...
Given that the audio drivers uses regmap, it could be good to dump the I2S/AHUB registers while the clip if playing with and without this patch to see the differences. I am curious if the audio is now being played as 24 or 32-bit instead of 16-bit now these are available.
You could also dump the hw_params to see the format while playing as well ...
$ /proc/asound/<scard-name>/pcm0p/sub0/hw_params
I suppose it is also possible that the codec isn't properly doing >16 bits and the fact we now offer 24 and 32 could be an issue. I've not got anything with an audio output on it that would be easy to test.
I thought I had tested on a Jetson TK1 (Tegra124) but it was sometime back. However, admittedly I may have only done simple 16-bit testing with speaker-test.
We do verify that all soundcards are detected and registered as expected during daily testing, but at the moment we don't have anything that verifies actual playback.
Please take a look at the attached logs.
On 20/12/2019 14:43, Dmitry Osipenko wrote:
20.12.2019 16:57, Jon Hunter пишет:
On 20/12/2019 11:38, Ben Dooks wrote:
On 20/12/2019 11:30, Jon Hunter wrote:
On 25/11/2019 17:28, Dmitry Osipenko wrote:
25.11.2019 20:22, Dmitry Osipenko пишет:
25.11.2019 13:37, Ben Dooks пишет: > On 23/11/2019 21:09, Dmitry Osipenko wrote: >> 18.10.2019 18:48, Ben Dooks пишет: >>> From: Edward Cragg edward.cragg@codethink.co.uk >>> >>> The tegra3 audio can support 24 and 32 bit sample sizes so add the >>> option to the tegra30_i2s_hw_params to configure the S24_LE or >>> S32_LE >>> formats when requested. >>> >>> Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk >>> [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] >>> [ben.dooks@codethink.co.uk: add pm calls around ytdm config] >>> [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] >>> Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk >>> --- >>> squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is >>> needed >>> in tdm code >>> >>> ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code >>> --- >>> sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- >>> 1 file changed, 20 insertions(+), 5 deletions(-) >>> >>> diff --git a/sound/soc/tegra/tegra30_i2s.c >>> b/sound/soc/tegra/tegra30_i2s.c >>> index 73f0dddeaef3..063f34c882af 100644 >>> --- a/sound/soc/tegra/tegra30_i2s.c >>> +++ b/sound/soc/tegra/tegra30_i2s.c >>> @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct >>> snd_pcm_substream *substream, >>> struct device *dev = dai->dev; >>> struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); >>> unsigned int mask, val, reg; >>> - int ret, sample_size, srate, i2sclock, bitcnt; >>> + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; >>> struct tegra30_ahub_cif_conf cif_conf; >>> if (params_channels(params) != 2) >>> @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct >>> snd_pcm_substream *substream, >>> switch (params_format(params)) { >>> case SNDRV_PCM_FORMAT_S16_LE: >>> val = TEGRA30_I2S_CTRL_BIT_SIZE_16; >>> + audio_bits = TEGRA30_AUDIOCIF_BITS_16; >>> sample_size = 16; >>> break; >>> + case SNDRV_PCM_FORMAT_S24_LE: >>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; >>> + audio_bits = TEGRA30_AUDIOCIF_BITS_24; >>> + sample_size = 24; >>> + break; >>> + case SNDRV_PCM_FORMAT_S32_LE: >>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; >>> + audio_bits = TEGRA30_AUDIOCIF_BITS_32; >>> + sample_size = 32; >>> + break; >>> default: >>> return -EINVAL; >>> } >>> @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct >>> snd_pcm_substream *substream, >>> cif_conf.threshold = 0; >>> cif_conf.audio_channels = 2; >>> cif_conf.client_channels = 2; >>> - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; >>> - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; >>> + cif_conf.audio_bits = audio_bits; >>> + cif_conf.client_bits = audio_bits; >>> cif_conf.expand = 0; >>> cif_conf.stereo_conv = 0; >>> cif_conf.replicate = 0; >>> @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver >>> tegra30_i2s_dai_template = { >>> .channels_min = 2, >>> .channels_max = 2, >>> .rates = SNDRV_PCM_RATE_8000_96000, >>> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >>> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >>> + SNDRV_PCM_FMTBIT_S24_LE | >>> + SNDRV_PCM_FMTBIT_S16_LE, >>> }, >>> .capture = { >>> .stream_name = "Capture", >>> .channels_min = 2, >>> .channels_max = 2, >>> .rates = SNDRV_PCM_RATE_8000_96000, >>> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >>> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >>> + SNDRV_PCM_FMTBIT_S24_LE | >>> + SNDRV_PCM_FMTBIT_S16_LE, >>> }, >>> .ops = &tegra30_i2s_dai_ops, >>> .symmetric_rates = 1, >>> >> >> Hello, >> >> This patch breaks audio on Tegra30. I don't see errors anywhere, but >> there is no audio and reverting this patch helps. Please fix it. > > What is the failure mode? I can try and take a look at this some time > this week, but I am not sure if I have any boards with an actual > useful > audio output?
The failure mode is that there no sound. I also noticed that video playback stutters a lot if movie file has audio track, seems something times out during of the audio playback. For now I don't have any more info.
Oh, I didn't say how to reproduce it.. for example simply playing big_buck_bunny_720p_h264.mov in MPV has the audio problem.
https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h...
Given that the audio drivers uses regmap, it could be good to dump the I2S/AHUB registers while the clip if playing with and without this patch to see the differences. I am curious if the audio is now being played as 24 or 32-bit instead of 16-bit now these are available.
You could also dump the hw_params to see the format while playing as well ...
$ /proc/asound/<scard-name>/pcm0p/sub0/hw_params
I suppose it is also possible that the codec isn't properly doing >16 bits and the fact we now offer 24 and 32 could be an issue. I've not got anything with an audio output on it that would be easy to test.
I thought I had tested on a Jetson TK1 (Tegra124) but it was sometime back. However, admittedly I may have only done simple 16-bit testing with speaker-test.
We do verify that all soundcards are detected and registered as expected during daily testing, but at the moment we don't have anything that verifies actual playback.
Please take a look at the attached logs.
I wonder if we are falling into FIFO configuration issues with the non-16 bit case.
Can you try adding the following two patches?
20.12.2019 17:56, Ben Dooks пишет:
On 20/12/2019 14:43, Dmitry Osipenko wrote:
20.12.2019 16:57, Jon Hunter пишет:
On 20/12/2019 11:38, Ben Dooks wrote:
On 20/12/2019 11:30, Jon Hunter wrote:
On 25/11/2019 17:28, Dmitry Osipenko wrote:
25.11.2019 20:22, Dmitry Osipenko пишет: > 25.11.2019 13:37, Ben Dooks пишет: >> On 23/11/2019 21:09, Dmitry Osipenko wrote: >>> 18.10.2019 18:48, Ben Dooks пишет: >>>> From: Edward Cragg edward.cragg@codethink.co.uk >>>> >>>> The tegra3 audio can support 24 and 32 bit sample sizes so add >>>> the >>>> option to the tegra30_i2s_hw_params to configure the S24_LE or >>>> S32_LE >>>> formats when requested. >>>> >>>> Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk >>>> [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] >>>> [ben.dooks@codethink.co.uk: add pm calls around ytdm config] >>>> [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] >>>> Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk >>>> --- >>>> squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is >>>> needed >>>> in tdm code >>>> >>>> ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code >>>> --- >>>> sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- >>>> 1 file changed, 20 insertions(+), 5 deletions(-) >>>> >>>> diff --git a/sound/soc/tegra/tegra30_i2s.c >>>> b/sound/soc/tegra/tegra30_i2s.c >>>> index 73f0dddeaef3..063f34c882af 100644 >>>> --- a/sound/soc/tegra/tegra30_i2s.c >>>> +++ b/sound/soc/tegra/tegra30_i2s.c >>>> @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct >>>> snd_pcm_substream *substream, >>>> struct device *dev = dai->dev; >>>> struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); >>>> unsigned int mask, val, reg; >>>> - int ret, sample_size, srate, i2sclock, bitcnt; >>>> + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; >>>> struct tegra30_ahub_cif_conf cif_conf; >>>> if (params_channels(params) != 2) >>>> @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct >>>> snd_pcm_substream *substream, >>>> switch (params_format(params)) { >>>> case SNDRV_PCM_FORMAT_S16_LE: >>>> val = TEGRA30_I2S_CTRL_BIT_SIZE_16; >>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_16; >>>> sample_size = 16; >>>> break; >>>> + case SNDRV_PCM_FORMAT_S24_LE: >>>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; >>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_24; >>>> + sample_size = 24; >>>> + break; >>>> + case SNDRV_PCM_FORMAT_S32_LE: >>>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; >>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_32; >>>> + sample_size = 32; >>>> + break; >>>> default: >>>> return -EINVAL; >>>> } >>>> @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct >>>> snd_pcm_substream *substream, >>>> cif_conf.threshold = 0; >>>> cif_conf.audio_channels = 2; >>>> cif_conf.client_channels = 2; >>>> - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; >>>> - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; >>>> + cif_conf.audio_bits = audio_bits; >>>> + cif_conf.client_bits = audio_bits; >>>> cif_conf.expand = 0; >>>> cif_conf.stereo_conv = 0; >>>> cif_conf.replicate = 0; >>>> @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver >>>> tegra30_i2s_dai_template = { >>>> .channels_min = 2, >>>> .channels_max = 2, >>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >>>> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>> + SNDRV_PCM_FMTBIT_S24_LE | >>>> + SNDRV_PCM_FMTBIT_S16_LE, >>>> }, >>>> .capture = { >>>> .stream_name = "Capture", >>>> .channels_min = 2, >>>> .channels_max = 2, >>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >>>> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>> + SNDRV_PCM_FMTBIT_S24_LE | >>>> + SNDRV_PCM_FMTBIT_S16_LE, >>>> }, >>>> .ops = &tegra30_i2s_dai_ops, >>>> .symmetric_rates = 1, >>>> >>> >>> Hello, >>> >>> This patch breaks audio on Tegra30. I don't see errors >>> anywhere, but >>> there is no audio and reverting this patch helps. Please fix it. >> >> What is the failure mode? I can try and take a look at this some >> time >> this week, but I am not sure if I have any boards with an actual >> useful >> audio output? > > The failure mode is that there no sound. I also noticed that video > playback stutters a lot if movie file has audio track, seems > something > times out during of the audio playback. For now I don't have any > more info. >
Oh, I didn't say how to reproduce it.. for example simply playing big_buck_bunny_720p_h264.mov in MPV has the audio problem.
https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h...
Given that the audio drivers uses regmap, it could be good to dump the I2S/AHUB registers while the clip if playing with and without this patch to see the differences. I am curious if the audio is now being played as 24 or 32-bit instead of 16-bit now these are available.
You could also dump the hw_params to see the format while playing as well ...
$ /proc/asound/<scard-name>/pcm0p/sub0/hw_params
I suppose it is also possible that the codec isn't properly doing >16 bits and the fact we now offer 24 and 32 could be an issue. I've not got anything with an audio output on it that would be easy to test.
I thought I had tested on a Jetson TK1 (Tegra124) but it was sometime back. However, admittedly I may have only done simple 16-bit testing with speaker-test.
We do verify that all soundcards are detected and registered as expected during daily testing, but at the moment we don't have anything that verifies actual playback.
Please take a look at the attached logs.
I wonder if we are falling into FIFO configuration issues with the non-16 bit case.
Can you try adding the following two patches?
It is much better now! There is no horrible noise and no stuttering, but audio still has a "robotic" effect, like freq isn't correct.
On 20/12/2019 15:02, Dmitry Osipenko wrote:
20.12.2019 17:56, Ben Dooks пишет:
On 20/12/2019 14:43, Dmitry Osipenko wrote:
20.12.2019 16:57, Jon Hunter пишет:
On 20/12/2019 11:38, Ben Dooks wrote:
On 20/12/2019 11:30, Jon Hunter wrote:
On 25/11/2019 17:28, Dmitry Osipenko wrote: > 25.11.2019 20:22, Dmitry Osipenko пишет: >> 25.11.2019 13:37, Ben Dooks пишет: >>> On 23/11/2019 21:09, Dmitry Osipenko wrote: >>>> 18.10.2019 18:48, Ben Dooks пишет: >>>>> From: Edward Cragg edward.cragg@codethink.co.uk >>>>> >>>>> The tegra3 audio can support 24 and 32 bit sample sizes so add >>>>> the >>>>> option to the tegra30_i2s_hw_params to configure the S24_LE or >>>>> S32_LE >>>>> formats when requested. >>>>> >>>>> Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk >>>>> [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] >>>>> [ben.dooks@codethink.co.uk: add pm calls around ytdm config] >>>>> [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] >>>>> Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk >>>>> --- >>>>> squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is >>>>> needed >>>>> in tdm code >>>>> >>>>> ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code >>>>> --- >>>>> sound/soc/tegra/tegra30_i2s.c | 25 ++++++++++++++++++++----- >>>>> 1 file changed, 20 insertions(+), 5 deletions(-) >>>>> >>>>> diff --git a/sound/soc/tegra/tegra30_i2s.c >>>>> b/sound/soc/tegra/tegra30_i2s.c >>>>> index 73f0dddeaef3..063f34c882af 100644 >>>>> --- a/sound/soc/tegra/tegra30_i2s.c >>>>> +++ b/sound/soc/tegra/tegra30_i2s.c >>>>> @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct >>>>> snd_pcm_substream *substream, >>>>> struct device *dev = dai->dev; >>>>> struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); >>>>> unsigned int mask, val, reg; >>>>> - int ret, sample_size, srate, i2sclock, bitcnt; >>>>> + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; >>>>> struct tegra30_ahub_cif_conf cif_conf; >>>>> if (params_channels(params) != 2) >>>>> @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct >>>>> snd_pcm_substream *substream, >>>>> switch (params_format(params)) { >>>>> case SNDRV_PCM_FORMAT_S16_LE: >>>>> val = TEGRA30_I2S_CTRL_BIT_SIZE_16; >>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>> sample_size = 16; >>>>> break; >>>>> + case SNDRV_PCM_FORMAT_S24_LE: >>>>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; >>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_24; >>>>> + sample_size = 24; >>>>> + break; >>>>> + case SNDRV_PCM_FORMAT_S32_LE: >>>>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; >>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_32; >>>>> + sample_size = 32; >>>>> + break; >>>>> default: >>>>> return -EINVAL; >>>>> } >>>>> @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct >>>>> snd_pcm_substream *substream, >>>>> cif_conf.threshold = 0; >>>>> cif_conf.audio_channels = 2; >>>>> cif_conf.client_channels = 2; >>>>> - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>> - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>> + cif_conf.audio_bits = audio_bits; >>>>> + cif_conf.client_bits = audio_bits; >>>>> cif_conf.expand = 0; >>>>> cif_conf.stereo_conv = 0; >>>>> cif_conf.replicate = 0; >>>>> @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver >>>>> tegra30_i2s_dai_template = { >>>>> .channels_min = 2, >>>>> .channels_max = 2, >>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >>>>> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>> + SNDRV_PCM_FMTBIT_S24_LE | >>>>> + SNDRV_PCM_FMTBIT_S16_LE, >>>>> }, >>>>> .capture = { >>>>> .stream_name = "Capture", >>>>> .channels_min = 2, >>>>> .channels_max = 2, >>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >>>>> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>> + SNDRV_PCM_FMTBIT_S24_LE | >>>>> + SNDRV_PCM_FMTBIT_S16_LE, >>>>> }, >>>>> .ops = &tegra30_i2s_dai_ops, >>>>> .symmetric_rates = 1, >>>>> >>>> >>>> Hello, >>>> >>>> This patch breaks audio on Tegra30. I don't see errors >>>> anywhere, but >>>> there is no audio and reverting this patch helps. Please fix it. >>> >>> What is the failure mode? I can try and take a look at this some >>> time >>> this week, but I am not sure if I have any boards with an actual >>> useful >>> audio output? >> >> The failure mode is that there no sound. I also noticed that video >> playback stutters a lot if movie file has audio track, seems >> something >> times out during of the audio playback. For now I don't have any >> more info. >> > > Oh, I didn't say how to reproduce it.. for example simply playing > big_buck_bunny_720p_h264.mov in MPV has the audio problem. > > https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h... > >
Given that the audio drivers uses regmap, it could be good to dump the I2S/AHUB registers while the clip if playing with and without this patch to see the differences. I am curious if the audio is now being played as 24 or 32-bit instead of 16-bit now these are available.
You could also dump the hw_params to see the format while playing as well ...
$ /proc/asound/<scard-name>/pcm0p/sub0/hw_params
I suppose it is also possible that the codec isn't properly doing >16 bits and the fact we now offer 24 and 32 could be an issue. I've not got anything with an audio output on it that would be easy to test.
I thought I had tested on a Jetson TK1 (Tegra124) but it was sometime back. However, admittedly I may have only done simple 16-bit testing with speaker-test.
We do verify that all soundcards are detected and registered as expected during daily testing, but at the moment we don't have anything that verifies actual playback.
Please take a look at the attached logs.
I wonder if we are falling into FIFO configuration issues with the non-16 bit case.
Can you try adding the following two patches?
It is much better now! There is no horrible noise and no stuttering, but audio still has a "robotic" effect, like freq isn't correct.
I wonder if there's an issue with FIFO stoking? I should also possibly add the correctly stop FIFOs patch as well.
20.12.2019 18:25, Ben Dooks пишет:
On 20/12/2019 15:02, Dmitry Osipenko wrote:
20.12.2019 17:56, Ben Dooks пишет:
On 20/12/2019 14:43, Dmitry Osipenko wrote:
20.12.2019 16:57, Jon Hunter пишет:
On 20/12/2019 11:38, Ben Dooks wrote:
On 20/12/2019 11:30, Jon Hunter wrote: > > On 25/11/2019 17:28, Dmitry Osipenko wrote: >> 25.11.2019 20:22, Dmitry Osipenko пишет: >>> 25.11.2019 13:37, Ben Dooks пишет: >>>> On 23/11/2019 21:09, Dmitry Osipenko wrote: >>>>> 18.10.2019 18:48, Ben Dooks пишет: >>>>>> From: Edward Cragg edward.cragg@codethink.co.uk >>>>>> >>>>>> The tegra3 audio can support 24 and 32 bit sample sizes so add >>>>>> the >>>>>> option to the tegra30_i2s_hw_params to configure the S24_LE or >>>>>> S32_LE >>>>>> formats when requested. >>>>>> >>>>>> Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk >>>>>> [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] >>>>>> [ben.dooks@codethink.co.uk: add pm calls around ytdm config] >>>>>> [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] >>>>>> Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk >>>>>> --- >>>>>> squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is >>>>>> needed >>>>>> in tdm code >>>>>> >>>>>> ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code >>>>>> --- >>>>>> sound/soc/tegra/tegra30_i2s.c | 25 >>>>>> ++++++++++++++++++++----- >>>>>> 1 file changed, 20 insertions(+), 5 deletions(-) >>>>>> >>>>>> diff --git a/sound/soc/tegra/tegra30_i2s.c >>>>>> b/sound/soc/tegra/tegra30_i2s.c >>>>>> index 73f0dddeaef3..063f34c882af 100644 >>>>>> --- a/sound/soc/tegra/tegra30_i2s.c >>>>>> +++ b/sound/soc/tegra/tegra30_i2s.c >>>>>> @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct >>>>>> snd_pcm_substream *substream, >>>>>> struct device *dev = dai->dev; >>>>>> struct tegra30_i2s *i2s = >>>>>> snd_soc_dai_get_drvdata(dai); >>>>>> unsigned int mask, val, reg; >>>>>> - int ret, sample_size, srate, i2sclock, bitcnt; >>>>>> + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; >>>>>> struct tegra30_ahub_cif_conf cif_conf; >>>>>> if (params_channels(params) != 2) >>>>>> @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct >>>>>> snd_pcm_substream *substream, >>>>>> switch (params_format(params)) { >>>>>> case SNDRV_PCM_FORMAT_S16_LE: >>>>>> val = TEGRA30_I2S_CTRL_BIT_SIZE_16; >>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>>> sample_size = 16; >>>>>> break; >>>>>> + case SNDRV_PCM_FORMAT_S24_LE: >>>>>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; >>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_24; >>>>>> + sample_size = 24; >>>>>> + break; >>>>>> + case SNDRV_PCM_FORMAT_S32_LE: >>>>>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; >>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_32; >>>>>> + sample_size = 32; >>>>>> + break; >>>>>> default: >>>>>> return -EINVAL; >>>>>> } >>>>>> @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct >>>>>> snd_pcm_substream *substream, >>>>>> cif_conf.threshold = 0; >>>>>> cif_conf.audio_channels = 2; >>>>>> cif_conf.client_channels = 2; >>>>>> - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>>> - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>>> + cif_conf.audio_bits = audio_bits; >>>>>> + cif_conf.client_bits = audio_bits; >>>>>> cif_conf.expand = 0; >>>>>> cif_conf.stereo_conv = 0; >>>>>> cif_conf.replicate = 0; >>>>>> @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver >>>>>> tegra30_i2s_dai_template = { >>>>>> .channels_min = 2, >>>>>> .channels_max = 2, >>>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>>> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >>>>>> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>>> + SNDRV_PCM_FMTBIT_S24_LE | >>>>>> + SNDRV_PCM_FMTBIT_S16_LE, >>>>>> }, >>>>>> .capture = { >>>>>> .stream_name = "Capture", >>>>>> .channels_min = 2, >>>>>> .channels_max = 2, >>>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>>> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >>>>>> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>>> + SNDRV_PCM_FMTBIT_S24_LE | >>>>>> + SNDRV_PCM_FMTBIT_S16_LE, >>>>>> }, >>>>>> .ops = &tegra30_i2s_dai_ops, >>>>>> .symmetric_rates = 1, >>>>>> >>>>> >>>>> Hello, >>>>> >>>>> This patch breaks audio on Tegra30. I don't see errors >>>>> anywhere, but >>>>> there is no audio and reverting this patch helps. Please fix it. >>>> >>>> What is the failure mode? I can try and take a look at this some >>>> time >>>> this week, but I am not sure if I have any boards with an actual >>>> useful >>>> audio output? >>> >>> The failure mode is that there no sound. I also noticed that video >>> playback stutters a lot if movie file has audio track, seems >>> something >>> times out during of the audio playback. For now I don't have any >>> more info. >>> >> >> Oh, I didn't say how to reproduce it.. for example simply playing >> big_buck_bunny_720p_h264.mov in MPV has the audio problem. >> >> https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h... >> >> >> > > Given that the audio drivers uses regmap, it could be good to > dump the > I2S/AHUB registers while the clip if playing with and without this > patch > to see the differences. I am curious if the audio is now being > played as > 24 or 32-bit instead of 16-bit now these are available. > > You could also dump the hw_params to see the format while playing as > well ... > > $ /proc/asound/<scard-name>/pcm0p/sub0/hw_params
I suppose it is also possible that the codec isn't properly doing >16 bits and the fact we now offer 24 and 32 could be an issue. I've not got anything with an audio output on it that would be easy to test.
I thought I had tested on a Jetson TK1 (Tegra124) but it was sometime back. However, admittedly I may have only done simple 16-bit testing with speaker-test.
We do verify that all soundcards are detected and registered as expected during daily testing, but at the moment we don't have anything that verifies actual playback.
Please take a look at the attached logs.
I wonder if we are falling into FIFO configuration issues with the non-16 bit case.
Can you try adding the following two patches?
It is much better now! There is no horrible noise and no stuttering, but audio still has a "robotic" effect, like freq isn't correct.
I wonder if there's an issue with FIFO stoking? I should also possibly add the correctly stop FIFOs patch as well.
I'll be happy to try more patches.
Meanwhile sound on v5.5+ is broken and thus the incomplete patches should be reverted.
On 20/12/2019 16:40, Dmitry Osipenko wrote:
20.12.2019 18:25, Ben Dooks пишет:
On 20/12/2019 15:02, Dmitry Osipenko wrote:
20.12.2019 17:56, Ben Dooks пишет:
On 20/12/2019 14:43, Dmitry Osipenko wrote:
20.12.2019 16:57, Jon Hunter пишет:
On 20/12/2019 11:38, Ben Dooks wrote: > On 20/12/2019 11:30, Jon Hunter wrote: >> >> On 25/11/2019 17:28, Dmitry Osipenko wrote: >>> 25.11.2019 20:22, Dmitry Osipenko пишет: >>>> 25.11.2019 13:37, Ben Dooks пишет: >>>>> On 23/11/2019 21:09, Dmitry Osipenko wrote: >>>>>> 18.10.2019 18:48, Ben Dooks пишет: >>>>>>> From: Edward Cragg edward.cragg@codethink.co.uk >>>>>>> >>>>>>> The tegra3 audio can support 24 and 32 bit sample sizes so add >>>>>>> the >>>>>>> option to the tegra30_i2s_hw_params to configure the S24_LE or >>>>>>> S32_LE >>>>>>> formats when requested. >>>>>>> >>>>>>> Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk >>>>>>> [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] >>>>>>> [ben.dooks@codethink.co.uk: add pm calls around ytdm config] >>>>>>> [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] >>>>>>> Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk >>>>>>> --- >>>>>>> squash 5aeca5a055fd ASoC: tegra: i2s: pm_runtime_get_sync() is >>>>>>> needed >>>>>>> in tdm code >>>>>>> >>>>>>> ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code >>>>>>> --- >>>>>>> sound/soc/tegra/tegra30_i2s.c | 25 >>>>>>> ++++++++++++++++++++----- >>>>>>> 1 file changed, 20 insertions(+), 5 deletions(-) >>>>>>> >>>>>>> diff --git a/sound/soc/tegra/tegra30_i2s.c >>>>>>> b/sound/soc/tegra/tegra30_i2s.c >>>>>>> index 73f0dddeaef3..063f34c882af 100644 >>>>>>> --- a/sound/soc/tegra/tegra30_i2s.c >>>>>>> +++ b/sound/soc/tegra/tegra30_i2s.c >>>>>>> @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct >>>>>>> snd_pcm_substream *substream, >>>>>>> struct device *dev = dai->dev; >>>>>>> struct tegra30_i2s *i2s = >>>>>>> snd_soc_dai_get_drvdata(dai); >>>>>>> unsigned int mask, val, reg; >>>>>>> - int ret, sample_size, srate, i2sclock, bitcnt; >>>>>>> + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; >>>>>>> struct tegra30_ahub_cif_conf cif_conf; >>>>>>> if (params_channels(params) != 2) >>>>>>> @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct >>>>>>> snd_pcm_substream *substream, >>>>>>> switch (params_format(params)) { >>>>>>> case SNDRV_PCM_FORMAT_S16_LE: >>>>>>> val = TEGRA30_I2S_CTRL_BIT_SIZE_16; >>>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>>>> sample_size = 16; >>>>>>> break; >>>>>>> + case SNDRV_PCM_FORMAT_S24_LE: >>>>>>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; >>>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_24; >>>>>>> + sample_size = 24; >>>>>>> + break; >>>>>>> + case SNDRV_PCM_FORMAT_S32_LE: >>>>>>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; >>>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_32; >>>>>>> + sample_size = 32; >>>>>>> + break; >>>>>>> default: >>>>>>> return -EINVAL; >>>>>>> } >>>>>>> @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct >>>>>>> snd_pcm_substream *substream, >>>>>>> cif_conf.threshold = 0; >>>>>>> cif_conf.audio_channels = 2; >>>>>>> cif_conf.client_channels = 2; >>>>>>> - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>>>> - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>>>> + cif_conf.audio_bits = audio_bits; >>>>>>> + cif_conf.client_bits = audio_bits; >>>>>>> cif_conf.expand = 0; >>>>>>> cif_conf.stereo_conv = 0; >>>>>>> cif_conf.replicate = 0; >>>>>>> @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver >>>>>>> tegra30_i2s_dai_template = { >>>>>>> .channels_min = 2, >>>>>>> .channels_max = 2, >>>>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>>>> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >>>>>>> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>>>> + SNDRV_PCM_FMTBIT_S24_LE | >>>>>>> + SNDRV_PCM_FMTBIT_S16_LE, >>>>>>> }, >>>>>>> .capture = { >>>>>>> .stream_name = "Capture", >>>>>>> .channels_min = 2, >>>>>>> .channels_max = 2, >>>>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>>>> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >>>>>>> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>>>> + SNDRV_PCM_FMTBIT_S24_LE | >>>>>>> + SNDRV_PCM_FMTBIT_S16_LE, >>>>>>> }, >>>>>>> .ops = &tegra30_i2s_dai_ops, >>>>>>> .symmetric_rates = 1, >>>>>>> >>>>>> >>>>>> Hello, >>>>>> >>>>>> This patch breaks audio on Tegra30. I don't see errors >>>>>> anywhere, but >>>>>> there is no audio and reverting this patch helps. Please fix it. >>>>> >>>>> What is the failure mode? I can try and take a look at this some >>>>> time >>>>> this week, but I am not sure if I have any boards with an actual >>>>> useful >>>>> audio output? >>>> >>>> The failure mode is that there no sound. I also noticed that video >>>> playback stutters a lot if movie file has audio track, seems >>>> something >>>> times out during of the audio playback. For now I don't have any >>>> more info. >>>> >>> >>> Oh, I didn't say how to reproduce it.. for example simply playing >>> big_buck_bunny_720p_h264.mov in MPV has the audio problem. >>> >>> https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h... >>> >>> >>> >> >> Given that the audio drivers uses regmap, it could be good to >> dump the >> I2S/AHUB registers while the clip if playing with and without this >> patch >> to see the differences. I am curious if the audio is now being >> played as >> 24 or 32-bit instead of 16-bit now these are available. >> >> You could also dump the hw_params to see the format while playing as >> well ... >> >> $ /proc/asound/<scard-name>/pcm0p/sub0/hw_params > > I suppose it is also possible that the codec isn't properly doing >16 > bits and the fact we now offer 24 and 32 could be an issue. I've not > got anything with an audio output on it that would be easy to test.
I thought I had tested on a Jetson TK1 (Tegra124) but it was sometime back. However, admittedly I may have only done simple 16-bit testing with speaker-test.
We do verify that all soundcards are detected and registered as expected during daily testing, but at the moment we don't have anything that verifies actual playback.
Please take a look at the attached logs.
I wonder if we are falling into FIFO configuration issues with the non-16 bit case.
Can you try adding the following two patches?
It is much better now! There is no horrible noise and no stuttering, but audio still has a "robotic" effect, like freq isn't correct.
I wonder if there's an issue with FIFO stoking? I should also possibly add the correctly stop FIFOs patch as well.
I'll be happy to try more patches.
Meanwhile sound on v5.5+ is broken and thus the incomplete patches should be reverted.
Have you checked if just removing the 24/32 bits from .formats in the dai template and see if the problem continues? I will try and see if I can find the code that does the fifo level checking and see if the problem is in the FIFO fill or something else in the audio hub setup.
20.12.2019 20:06, Ben Dooks пишет:
On 20/12/2019 16:40, Dmitry Osipenko wrote:
20.12.2019 18:25, Ben Dooks пишет:
On 20/12/2019 15:02, Dmitry Osipenko wrote:
20.12.2019 17:56, Ben Dooks пишет:
On 20/12/2019 14:43, Dmitry Osipenko wrote:
20.12.2019 16:57, Jon Hunter пишет: > > On 20/12/2019 11:38, Ben Dooks wrote: >> On 20/12/2019 11:30, Jon Hunter wrote: >>> >>> On 25/11/2019 17:28, Dmitry Osipenko wrote: >>>> 25.11.2019 20:22, Dmitry Osipenko пишет: >>>>> 25.11.2019 13:37, Ben Dooks пишет: >>>>>> On 23/11/2019 21:09, Dmitry Osipenko wrote: >>>>>>> 18.10.2019 18:48, Ben Dooks пишет: >>>>>>>> From: Edward Cragg edward.cragg@codethink.co.uk >>>>>>>> >>>>>>>> The tegra3 audio can support 24 and 32 bit sample sizes so >>>>>>>> add >>>>>>>> the >>>>>>>> option to the tegra30_i2s_hw_params to configure the >>>>>>>> S24_LE or >>>>>>>> S32_LE >>>>>>>> formats when requested. >>>>>>>> >>>>>>>> Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk >>>>>>>> [ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit] >>>>>>>> [ben.dooks@codethink.co.uk: add pm calls around ytdm config] >>>>>>>> [ben.dooks@codethink.co.uk: drop debug printing to dev_dbg] >>>>>>>> Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk >>>>>>>> --- >>>>>>>> squash 5aeca5a055fd ASoC: tegra: i2s: >>>>>>>> pm_runtime_get_sync() is >>>>>>>> needed >>>>>>>> in tdm code >>>>>>>> >>>>>>>> ASoC: tegra: i2s: pm_runtime_get_sync() is needed in tdm code >>>>>>>> --- >>>>>>>> sound/soc/tegra/tegra30_i2s.c | 25 >>>>>>>> ++++++++++++++++++++----- >>>>>>>> 1 file changed, 20 insertions(+), 5 deletions(-) >>>>>>>> >>>>>>>> diff --git a/sound/soc/tegra/tegra30_i2s.c >>>>>>>> b/sound/soc/tegra/tegra30_i2s.c >>>>>>>> index 73f0dddeaef3..063f34c882af 100644 >>>>>>>> --- a/sound/soc/tegra/tegra30_i2s.c >>>>>>>> +++ b/sound/soc/tegra/tegra30_i2s.c >>>>>>>> @@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(struct >>>>>>>> snd_pcm_substream *substream, >>>>>>>> struct device *dev = dai->dev; >>>>>>>> struct tegra30_i2s *i2s = >>>>>>>> snd_soc_dai_get_drvdata(dai); >>>>>>>> unsigned int mask, val, reg; >>>>>>>> - int ret, sample_size, srate, i2sclock, bitcnt; >>>>>>>> + int ret, sample_size, srate, i2sclock, bitcnt, >>>>>>>> audio_bits; >>>>>>>> struct tegra30_ahub_cif_conf cif_conf; >>>>>>>> if (params_channels(params) != 2) >>>>>>>> @@ -137,8 +137,19 @@ static int tegra30_i2s_hw_params(struct >>>>>>>> snd_pcm_substream *substream, >>>>>>>> switch (params_format(params)) { >>>>>>>> case SNDRV_PCM_FORMAT_S16_LE: >>>>>>>> val = TEGRA30_I2S_CTRL_BIT_SIZE_16; >>>>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>>>>> sample_size = 16; >>>>>>>> break; >>>>>>>> + case SNDRV_PCM_FORMAT_S24_LE: >>>>>>>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_24; >>>>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_24; >>>>>>>> + sample_size = 24; >>>>>>>> + break; >>>>>>>> + case SNDRV_PCM_FORMAT_S32_LE: >>>>>>>> + val = TEGRA30_I2S_CTRL_BIT_SIZE_32; >>>>>>>> + audio_bits = TEGRA30_AUDIOCIF_BITS_32; >>>>>>>> + sample_size = 32; >>>>>>>> + break; >>>>>>>> default: >>>>>>>> return -EINVAL; >>>>>>>> } >>>>>>>> @@ -170,8 +181,8 @@ static int tegra30_i2s_hw_params(struct >>>>>>>> snd_pcm_substream *substream, >>>>>>>> cif_conf.threshold = 0; >>>>>>>> cif_conf.audio_channels = 2; >>>>>>>> cif_conf.client_channels = 2; >>>>>>>> - cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>>>>> - cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; >>>>>>>> + cif_conf.audio_bits = audio_bits; >>>>>>>> + cif_conf.client_bits = audio_bits; >>>>>>>> cif_conf.expand = 0; >>>>>>>> cif_conf.stereo_conv = 0; >>>>>>>> cif_conf.replicate = 0; >>>>>>>> @@ -306,14 +317,18 @@ static const struct snd_soc_dai_driver >>>>>>>> tegra30_i2s_dai_template = { >>>>>>>> .channels_min = 2, >>>>>>>> .channels_max = 2, >>>>>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>>>>> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >>>>>>>> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>>>>> + SNDRV_PCM_FMTBIT_S24_LE | >>>>>>>> + SNDRV_PCM_FMTBIT_S16_LE, >>>>>>>> }, >>>>>>>> .capture = { >>>>>>>> .stream_name = "Capture", >>>>>>>> .channels_min = 2, >>>>>>>> .channels_max = 2, >>>>>>>> .rates = SNDRV_PCM_RATE_8000_96000, >>>>>>>> - .formats = SNDRV_PCM_FMTBIT_S16_LE, >>>>>>>> + .formats = SNDRV_PCM_FMTBIT_S32_LE | >>>>>>>> + SNDRV_PCM_FMTBIT_S24_LE | >>>>>>>> + SNDRV_PCM_FMTBIT_S16_LE, >>>>>>>> }, >>>>>>>> .ops = &tegra30_i2s_dai_ops, >>>>>>>> .symmetric_rates = 1, >>>>>>>> >>>>>>> >>>>>>> Hello, >>>>>>> >>>>>>> This patch breaks audio on Tegra30. I don't see errors >>>>>>> anywhere, but >>>>>>> there is no audio and reverting this patch helps. Please >>>>>>> fix it. >>>>>> >>>>>> What is the failure mode? I can try and take a look at this >>>>>> some >>>>>> time >>>>>> this week, but I am not sure if I have any boards with an >>>>>> actual >>>>>> useful >>>>>> audio output? >>>>> >>>>> The failure mode is that there no sound. I also noticed that >>>>> video >>>>> playback stutters a lot if movie file has audio track, seems >>>>> something >>>>> times out during of the audio playback. For now I don't have any >>>>> more info. >>>>> >>>> >>>> Oh, I didn't say how to reproduce it.. for example simply playing >>>> big_buck_bunny_720p_h264.mov in MPV has the audio problem. >>>> >>>> https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h... >>>> >>>> >>>> >>>> >>> >>> Given that the audio drivers uses regmap, it could be good to >>> dump the >>> I2S/AHUB registers while the clip if playing with and without this >>> patch >>> to see the differences. I am curious if the audio is now being >>> played as >>> 24 or 32-bit instead of 16-bit now these are available. >>> >>> You could also dump the hw_params to see the format while >>> playing as >>> well ... >>> >>> $ /proc/asound/<scard-name>/pcm0p/sub0/hw_params >> >> I suppose it is also possible that the codec isn't properly >> doing >16 >> bits and the fact we now offer 24 and 32 could be an issue. I've >> not >> got anything with an audio output on it that would be easy to test. > > I thought I had tested on a Jetson TK1 (Tegra124) but it was > sometime > back. However, admittedly I may have only done simple 16-bit testing > with speaker-test. > > We do verify that all soundcards are detected and registered as > expected > during daily testing, but at the moment we don't have anything that > verifies actual playback.
Please take a look at the attached logs.
I wonder if we are falling into FIFO configuration issues with the non-16 bit case.
Can you try adding the following two patches?
It is much better now! There is no horrible noise and no stuttering, but audio still has a "robotic" effect, like freq isn't correct.
I wonder if there's an issue with FIFO stoking? I should also possibly add the correctly stop FIFOs patch as well.
I'll be happy to try more patches.
Meanwhile sound on v5.5+ is broken and thus the incomplete patches should be reverted.
Have you checked if just removing the 24/32 bits from .formats in the dai template and see if the problem continues?
It works.
I will try and see if I can find the code that does the fifo level checking and see if the problem is in the FIFO fill or something else in the audio hub setup.
Ok
[snip]
I've just gone through testing.
Some simple data tests show 16 and 32-bits work.
The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame)
My preference is to remove the 24-bit support and keep the 32 bit in.
05.01.2020 03:04, Ben Dooks пишет:
[snip]
I've just gone through testing.
Some simple data tests show 16 and 32-bits work.
The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame)
My preference is to remove the 24-bit support and keep the 32 bit in.
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет:
[snip]
I've just gone through testing.
Some simple data tests show 16 and 32-bits work.
The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame)
My preference is to remove the 24-bit support and keep the 32 bit in.
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет:
[snip]
I've just gone through testing.
Some simple data tests show 16 and 32-bits work.
The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame)
My preference is to remove the 24-bit support and keep the 32 bit in.
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет:
[snip]
I've just gone through testing.
Some simple data tests show 16 and 32-bits work.
The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame)
My preference is to remove the 24-bit support and keep the 32 bit in.
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression.
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет:
[snip]
I've just gone through testing.
Some simple data tests show 16 and 32-bits work.
The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame)
My preference is to remove the 24-bit support and keep the 32 bit in.
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression.
I chatted with Sameer about this, so yes the AHUB can repack, but there is a problem with S24_LE where if we try to extract 24-bits we actually get the upper 24-bits and not the lower LSBs in the 32-bit data element. So actually we don't support S24_LE.
Ben do you need 24-bit support or 32-bit or both?
Jon
08.01.2020 14:37, Jon Hunter пишет:
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет:
[snip]
I've just gone through testing.
Some simple data tests show 16 and 32-bits work.
The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame)
My preference is to remove the 24-bit support and keep the 32 bit in.
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression.
I chatted with Sameer about this, so yes the AHUB can repack, but there is a problem with S24_LE where if we try to extract 24-bits we actually get the upper 24-bits and not the lower LSBs in the 32-bit data element. So actually we don't support S24_LE.
Ben do you need 24-bit support or 32-bit or both?
Any updates? Should we revert all the applied patches for now?
On 20/01/2020 16:50, Dmitry Osipenko wrote:
08.01.2020 14:37, Jon Hunter пишет:
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет: > [snip] > > I've just gone through testing. > > Some simple data tests show 16 and 32-bits work. > > The 24 bit case seems to be weird, it looks like the 24-bit expects > 24 bit samples in 32 bit words. I can't see any packing options to > do 24 bit in 24 bit, so we may have to remove 24 bit sample support > (which is a shame) > > My preference is to remove the 24-bit support and keep the 32 bit in. >
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression.
I chatted with Sameer about this, so yes the AHUB can repack, but there is a problem with S24_LE where if we try to extract 24-bits we actually get the upper 24-bits and not the lower LSBs in the 32-bit data element. So actually we don't support S24_LE.
Ben do you need 24-bit support or 32-bit or both?
I think the S24 should work unpacked. The packed just doesn't seem to be an option on tegra2/tegra3 hardware (the manual does not talk about it either).
I will try and get this looked at again on Thursday 23rd and see if I can run some more tests with 24 sample data in the input format and a logic analyser on the output.
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет:
[snip]
I've just gone through testing.
Some simple data tests show 16 and 32-bits work.
The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame)
My preference is to remove the 24-bit support and keep the 32 bit in.
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression. _________________________________
I did a quick test with the following:
sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5
The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on...
On 23/01/2020 19:38, Ben Dooks wrote:
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет:
[snip]
I've just gone through testing.
Some simple data tests show 16 and 32-bits work.
The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame)
My preference is to remove the 24-bit support and keep the 32 bit in.
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression. _________________________________
I did a quick test with the following:
sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5
The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on...
I should have checked pll_a_out0 rate, for 24bit 2ch, I get pll_a_out at which makes:
11289600/(24*2*44100) = 5.3333333333
For some reason the PLL can't get a decent divisor for this.
24.01.2020 00:59, Ben Dooks пишет:
On 23/01/2020 19:38, Ben Dooks wrote:
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет: > [snip] > > I've just gone through testing. > > Some simple data tests show 16 and 32-bits work. > > The 24 bit case seems to be weird, it looks like the 24-bit expects > 24 bit samples in 32 bit words. I can't see any packing options to > do 24 bit in 24 bit, so we may have to remove 24 bit sample support > (which is a shame) > > My preference is to remove the 24-bit support and keep the 32 bit > in. >
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression. _________________________________
I did a quick test with the following:
sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5
The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on...
I should have checked pll_a_out0 rate, for 24bit 2ch, I get pll_a_out at which makes:
11289600/(24*2*44100) = 5.3333333333
For some reason the PLL can't get a decent divisor for this.
Have you tried to adjust the predefined PLLA rate? Please see tegra_clk_init_table in drivers/clk/tegra/clk-tegra30.c. Will be interesting if it works with that.
Sowjanya said that the PLLA rate setup is going to be moved to the audio driver [1], maybe that's what we already need for 24bit.
24.01.2020 01:11, Dmitry Osipenko пишет:
24.01.2020 00:59, Ben Dooks пишет:
On 23/01/2020 19:38, Ben Dooks wrote:
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote: > 05.01.2020 03:04, Ben Dooks пишет: >> [snip] >> >> I've just gone through testing. >> >> Some simple data tests show 16 and 32-bits work. >> >> The 24 bit case seems to be weird, it looks like the 24-bit expects >> 24 bit samples in 32 bit words. I can't see any packing options to >> do 24 bit in 24 bit, so we may have to remove 24 bit sample support >> (which is a shame) >> >> My preference is to remove the 24-bit support and keep the 32 bit >> in. >> > > Interesting.. Jon, could you please confirm that 24bit format isn't > usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression. _________________________________
I did a quick test with the following:
sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5
The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on...
I should have checked pll_a_out0 rate, for 24bit 2ch, I get pll_a_out at which makes:
11289600/(24*2*44100) = 5.3333333333
For some reason the PLL can't get a decent divisor for this.
Have you tried to adjust the predefined PLLA rate? Please see tegra_clk_init_table in drivers/clk/tegra/clk-tegra30.c. Will be interesting if it works with that.
Sowjanya said that the PLLA rate setup is going to be moved to the audio driver [1], maybe that's what we already need for 24bit.
Actually, tegra_asoc_utils_set_rate() sets the PLLA rate, but the values are hardcoded there.
On 23/01/2020 21:59, Ben Dooks wrote:
On 23/01/2020 19:38, Ben Dooks wrote:
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет: > [snip] > > I've just gone through testing. > > Some simple data tests show 16 and 32-bits work. > > The 24 bit case seems to be weird, it looks like the 24-bit expects > 24 bit samples in 32 bit words. I can't see any packing options to > do 24 bit in 24 bit, so we may have to remove 24 bit sample support > (which is a shame) > > My preference is to remove the 24-bit support and keep the 32 bit > in. >
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression. _________________________________
I did a quick test with the following:
sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5
The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on...
I should have checked pll_a_out0 rate, for 24bit 2ch, I get pll_a_out at which makes:
11289600/(24*2*44100) = 5.3333333333
For some reason the PLL can't get a decent divisor for this.
Yes that is going to be a problem. I assume that your codec wants a 256*fs MCLK? Maybe in that case you are better off having the codec drive the bit clock and fsync?
Is 24-bit critical to what you are doing?
Otherwise maybe we should drop the 24-bit support for now and just keep 32-bit.
Jon
On Fri, Jan 24, 2020 at 04:56:41PM +0000, Jon Hunter wrote:
Yes that is going to be a problem. I assume that your codec wants a 256*fs MCLK? Maybe in that case you are better off having the codec drive the bit clock and fsync?
Is 24-bit critical to what you are doing?
Otherwise maybe we should drop the 24-bit support for now and just keep 32-bit.
Removing the support because one particular board has limited clocks isn't good - it'd be better to have components with clocking restrictions impose constraints as needed.
On 24/01/2020 17:00, Mark Brown wrote:
On Fri, Jan 24, 2020 at 04:56:41PM +0000, Jon Hunter wrote:
Yes that is going to be a problem. I assume that your codec wants a 256*fs MCLK? Maybe in that case you are better off having the codec drive the bit clock and fsync?
Would be lovely, but tegra i2s clock slave is still on the list of things I have to get into the kernel (it doesn't work and no-one in the kernel currently uses it...)
Is 24-bit critical to what you are doing?
Otherwise maybe we should drop the 24-bit support for now and just keep 32-bit.
Removing the support because one particular board has limited clocks isn't good - it'd be better to have components with clocking restrictions impose constraints as needed.
On 23/01/2020 19:38, Ben Dooks wrote:
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет:
[snip]
I've just gone through testing.
Some simple data tests show 16 and 32-bits work.
The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame)
My preference is to remove the 24-bit support and keep the 32 bit in.
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression. _________________________________
I did a quick test with the following:
sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5
The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on...
I was looking at using sox to create such as file, but the above command generates a S24_3LE file and not S24_LE file. The codec on Jetson-TK1 supports S24_LE but does not support S24_3LE and so I cannot test this. Anyway, we really need to test S24_LE and not S24_3LE because this is the problem that Dmitry is having.
Ben is S24_3LE what you really need to support?
Dmitry, does the following fix your problem?
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index dbed3c5408e7..92845c4b63f4 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -140,7 +140,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break; - case SNDRV_PCM_FORMAT_S24_LE: + case SNDRV_PCM_FORMAT_S24_3LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_24; audio_bits = TEGRA30_AUDIOCIF_BITS_24; sample_size = 24; @@ -318,7 +318,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE | - SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { @@ -327,7 +327,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE | - SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops,
Jon
On 24/01/2020 16:50, Jon Hunter wrote:
On 23/01/2020 19:38, Ben Dooks wrote:
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет: > [snip] > > I've just gone through testing. > > Some simple data tests show 16 and 32-bits work. > > The 24 bit case seems to be weird, it looks like the 24-bit expects > 24 bit samples in 32 bit words. I can't see any packing options to > do 24 bit in 24 bit, so we may have to remove 24 bit sample support > (which is a shame) > > My preference is to remove the 24-bit support and keep the 32 bit in. >
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression. _________________________________
I did a quick test with the following:
sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5
The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on...
I was looking at using sox to create such as file, but the above command generates a S24_3LE file and not S24_LE file. The codec on Jetson-TK1 supports S24_LE but does not support S24_3LE and so I cannot test this. Anyway, we really need to test S24_LE and not S24_3LE because this is the problem that Dmitry is having.
Ben is S24_3LE what you really need to support?
No, it is S24_LE the format this hardware supports. I wonder if aplay is transforming it.
Plug PCM: Linear conversion PCM (S24_LE) Its setup is: stream : PLAYBACK access : RW_INTERLEAVED format : S24_3LE subformat : STD channels : 2
So I assume aplay has turned the S24_3LE -> S24_LE
On Fri, 24 Jan 2020, Ben Dooks wrote:
So I assume aplay has turned the S24_3LE -> S24_LE
A couple of years ago (so may be inaccurate now) I concluded after some testing that S24_LE was broken in arecord and aplay, at least when it came to .wav files. Meaning that files I recorded with arecord could be played back by aplay, but not in any other application I tried, such as Audacity.
I can try to dig out the gory details, but ISTR it came down to the header(s) in the .wav file being incorrectly filled in with regard to number of bits per sample vs valid bits per sample.
/Ricard
On 24/01/2020 16:50, Jon Hunter wrote:
On 23/01/2020 19:38, Ben Dooks wrote:
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет: > [snip] > > I've just gone through testing. > > Some simple data tests show 16 and 32-bits work. > > The 24 bit case seems to be weird, it looks like the 24-bit expects > 24 bit samples in 32 bit words. I can't see any packing options to > do 24 bit in 24 bit, so we may have to remove 24 bit sample support > (which is a shame) > > My preference is to remove the 24-bit support and keep the 32 bit in. >
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression. _________________________________
I did a quick test with the following:
sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5
The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on...
I was looking at using sox to create such as file, but the above command generates a S24_3LE file and not S24_LE file. The codec on Jetson-TK1 supports S24_LE but does not support S24_3LE and so I cannot test this. Anyway, we really need to test S24_LE and not S24_3LE because this is the problem that Dmitry is having.
Ben is S24_3LE what you really need to support?
I was fairly sure it was saying S24 format, the aplay just prints S24_LE (but seems to hide the implementtjon)
24.01.2020 19:50, Jon Hunter пишет:
On 23/01/2020 19:38, Ben Dooks wrote:
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет: > [snip] > > I've just gone through testing. > > Some simple data tests show 16 and 32-bits work. > > The 24 bit case seems to be weird, it looks like the 24-bit expects > 24 bit samples in 32 bit words. I can't see any packing options to > do 24 bit in 24 bit, so we may have to remove 24 bit sample support > (which is a shame) > > My preference is to remove the 24-bit support and keep the 32 bit in. >
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression. _________________________________
I did a quick test with the following:
sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5
The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on...
I was looking at using sox to create such as file, but the above command generates a S24_3LE file and not S24_LE file. The codec on Jetson-TK1 supports S24_LE but does not support S24_3LE and so I cannot test this. Anyway, we really need to test S24_LE and not S24_3LE because this is the problem that Dmitry is having.
Ben is S24_3LE what you really need to support?
Dmitry, does the following fix your problem?
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index dbed3c5408e7..92845c4b63f4 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -140,7 +140,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break;
case SNDRV_PCM_FORMAT_S24_LE:
case SNDRV_PCM_FORMAT_S24_3LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_24; audio_bits = TEGRA30_AUDIOCIF_BITS_24; sample_size = 24;
@@ -318,7 +318,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .capture = {
@@ -327,7 +327,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops,
Jon
It should solve the problem in my particular case, but I'm not sure that the solution is correct.
The v5.5 kernel is released now with the broken audio and apparently getting 24bit to work won't be trivial (if possible at all). Ben, could you please send a patch to fix v5.5 by removing the S24 support advertisement from the driver?
27.01.2020 22:20, Dmitry Osipenko пишет:
24.01.2020 19:50, Jon Hunter пишет:
On 23/01/2020 19:38, Ben Dooks wrote:
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote: > 05.01.2020 03:04, Ben Dooks пишет: >> [snip] >> >> I've just gone through testing. >> >> Some simple data tests show 16 and 32-bits work. >> >> The 24 bit case seems to be weird, it looks like the 24-bit expects >> 24 bit samples in 32 bit words. I can't see any packing options to >> do 24 bit in 24 bit, so we may have to remove 24 bit sample support >> (which is a shame) >> >> My preference is to remove the 24-bit support and keep the 32 bit in. >> > > Interesting.. Jon, could you please confirm that 24bit format isn't > usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression. _________________________________
I did a quick test with the following:
sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5
The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on...
I was looking at using sox to create such as file, but the above command generates a S24_3LE file and not S24_LE file. The codec on Jetson-TK1 supports S24_LE but does not support S24_3LE and so I cannot test this. Anyway, we really need to test S24_LE and not S24_3LE because this is the problem that Dmitry is having.
Ben is S24_3LE what you really need to support?
Dmitry, does the following fix your problem?
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index dbed3c5408e7..92845c4b63f4 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -140,7 +140,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break;
case SNDRV_PCM_FORMAT_S24_LE:
case SNDRV_PCM_FORMAT_S24_3LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_24; audio_bits = TEGRA30_AUDIOCIF_BITS_24; sample_size = 24;
@@ -318,7 +318,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .capture = {
@@ -327,7 +327,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops,
Jon
It should solve the problem in my particular case, but I'm not sure that the solution is correct.
The v5.5 kernel is released now with the broken audio and apparently getting 24bit to work won't be trivial (if possible at all). Ben, could you please send a patch to fix v5.5 by removing the S24 support advertisement from the driver?
I also suspect that s32 may need some extra patches and thus could be worthwhile to stop advertising it as well.
On 27/01/2020 19:23, Dmitry Osipenko wrote:
27.01.2020 22:20, Dmitry Osipenko пишет:
24.01.2020 19:50, Jon Hunter пишет:
On 23/01/2020 19:38, Ben Dooks wrote:
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote: > > > On 2020-01-05 01:48, Dmitry Osipenko wrote: >> 05.01.2020 03:04, Ben Dooks пишет: >>> [snip] >>> >>> I've just gone through testing. >>> >>> Some simple data tests show 16 and 32-bits work. >>> >>> The 24 bit case seems to be weird, it looks like the 24-bit expects >>> 24 bit samples in 32 bit words. I can't see any packing options to >>> do 24 bit in 24 bit, so we may have to remove 24 bit sample support >>> (which is a shame) >>> >>> My preference is to remove the 24-bit support and keep the 32 bit in. >>> >> >> Interesting.. Jon, could you please confirm that 24bit format isn't >> usable on T30? > > If there is an option of 24 packed into 32, then I think that would > work. > > I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression. _________________________________
I did a quick test with the following:
sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5
The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on...
I was looking at using sox to create such as file, but the above command generates a S24_3LE file and not S24_LE file. The codec on Jetson-TK1 supports S24_LE but does not support S24_3LE and so I cannot test this. Anyway, we really need to test S24_LE and not S24_3LE because this is the problem that Dmitry is having.
Ben is S24_3LE what you really need to support?
Dmitry, does the following fix your problem?
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index dbed3c5408e7..92845c4b63f4 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -140,7 +140,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break;
case SNDRV_PCM_FORMAT_S24_LE:
case SNDRV_PCM_FORMAT_S24_3LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_24; audio_bits = TEGRA30_AUDIOCIF_BITS_24; sample_size = 24;
@@ -318,7 +318,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .capture = {
@@ -327,7 +327,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops,
Jon
It should solve the problem in my particular case, but I'm not sure that the solution is correct.
The v5.5 kernel is released now with the broken audio and apparently getting 24bit to work won't be trivial (if possible at all). Ben, could you please send a patch to fix v5.5 by removing the S24 support advertisement from the driver?
I also suspect that s32 may need some extra patches and thus could be worthwhile to stop advertising it as well.
As far as I am aware that works and we can hit the audio rates for it.
On 28/01/2020 08:59, Ben Dooks wrote:
On 27/01/2020 19:23, Dmitry Osipenko wrote:
27.01.2020 22:20, Dmitry Osipenko пишет:
24.01.2020 19:50, Jon Hunter пишет:
On 23/01/2020 19:38, Ben Dooks wrote:
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет: > On 05/01/2020 10:53, Ben Dooks wrote: >> >> >> On 2020-01-05 01:48, Dmitry Osipenko wrote: >>> 05.01.2020 03:04, Ben Dooks пишет: >>>> [snip] >>>> >>>> I've just gone through testing. >>>> >>>> Some simple data tests show 16 and 32-bits work. >>>> >>>> The 24 bit case seems to be weird, it looks like the 24-bit >>>> expects >>>> 24 bit samples in 32 bit words. I can't see any packing >>>> options to >>>> do 24 bit in 24 bit, so we may have to remove 24 bit sample >>>> support >>>> (which is a shame) >>>> >>>> My preference is to remove the 24-bit support and keep the 32 >>>> bit in. >>>> >>> >>> Interesting.. Jon, could you please confirm that 24bit format >>> isn't >>> usable on T30? >> >> If there is an option of 24 packed into 32, then I think that would >> work. >> >> I can try testing that with raw data on Monday. > > I need to check some things, I assumed 24 was 24 packed bits, it > looks > like the default is 24 in 32 bits so we may be ok. However I need to > re-write my test case which assumed it was 24bits in 3 bytes > (S24_3LE). > > I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression. _________________________________
I did a quick test with the following:
sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5
The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on...
I was looking at using sox to create such as file, but the above command generates a S24_3LE file and not S24_LE file. The codec on Jetson-TK1 supports S24_LE but does not support S24_3LE and so I cannot test this. Anyway, we really need to test S24_LE and not S24_3LE because this is the problem that Dmitry is having.
Ben is S24_3LE what you really need to support?
Dmitry, does the following fix your problem?
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index dbed3c5408e7..92845c4b63f4 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -140,7 +140,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break; - case SNDRV_PCM_FORMAT_S24_LE: + case SNDRV_PCM_FORMAT_S24_3LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_24; audio_bits = TEGRA30_AUDIOCIF_BITS_24; sample_size = 24; @@ -318,7 +318,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE | - SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { @@ -327,7 +327,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE | - SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops,
Jon
It should solve the problem in my particular case, but I'm not sure that the solution is correct.
The v5.5 kernel is released now with the broken audio and apparently getting 24bit to work won't be trivial (if possible at all). Ben, could you please send a patch to fix v5.5 by removing the S24 support advertisement from the driver?
I also suspect that s32 may need some extra patches and thus could be worthwhile to stop advertising it as well.
As far as I am aware that works and we can hit the audio rates for it.
I ran a test on Tegra124 Jetson-TK1 and 24-bit playback seems to work as Ben has indicated. So I don't think it is broken.
Can you try Ben's testcase on Tegra30 (ie. generate a tone using sox and use aplay to play)?
Jon
28.01.2020 16:19, Jon Hunter пишет:
On 28/01/2020 08:59, Ben Dooks wrote:
On 27/01/2020 19:23, Dmitry Osipenko wrote:
27.01.2020 22:20, Dmitry Osipenko пишет:
24.01.2020 19:50, Jon Hunter пишет:
On 23/01/2020 19:38, Ben Dooks wrote:
On 07/01/2020 01:39, Dmitry Osipenko wrote: > 06.01.2020 22:00, Ben Dooks пишет: >> On 05/01/2020 10:53, Ben Dooks wrote: >>> >>> >>> On 2020-01-05 01:48, Dmitry Osipenko wrote: >>>> 05.01.2020 03:04, Ben Dooks пишет: >>>>> [snip] >>>>> >>>>> I've just gone through testing. >>>>> >>>>> Some simple data tests show 16 and 32-bits work. >>>>> >>>>> The 24 bit case seems to be weird, it looks like the 24-bit >>>>> expects >>>>> 24 bit samples in 32 bit words. I can't see any packing >>>>> options to >>>>> do 24 bit in 24 bit, so we may have to remove 24 bit sample >>>>> support >>>>> (which is a shame) >>>>> >>>>> My preference is to remove the 24-bit support and keep the 32 >>>>> bit in. >>>>> >>>> >>>> Interesting.. Jon, could you please confirm that 24bit format >>>> isn't >>>> usable on T30? >>> >>> If there is an option of 24 packed into 32, then I think that would >>> work. >>> >>> I can try testing that with raw data on Monday. >> >> I need to check some things, I assumed 24 was 24 packed bits, it >> looks >> like the default is 24 in 32 bits so we may be ok. However I need to >> re-write my test case which assumed it was 24bits in 3 bytes >> (S24_3LE). >> >> I'll follow up later, > > Okay, the S24_3LE isn't supported by RT5640 codec in my case. I > briefly > looked through the TRM doc and got impression that AHUB could re-pack > data stream into something that codec supports, but maybe it's a > wrong > impression. > _________________________________
I did a quick test with the following:
sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5
The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on...
I was looking at using sox to create such as file, but the above command generates a S24_3LE file and not S24_LE file. The codec on Jetson-TK1 supports S24_LE but does not support S24_3LE and so I cannot test this. Anyway, we really need to test S24_LE and not S24_3LE because this is the problem that Dmitry is having.
Ben is S24_3LE what you really need to support?
Dmitry, does the following fix your problem?
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index dbed3c5408e7..92845c4b63f4 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -140,7 +140,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break; - case SNDRV_PCM_FORMAT_S24_LE: + case SNDRV_PCM_FORMAT_S24_3LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_24; audio_bits = TEGRA30_AUDIOCIF_BITS_24; sample_size = 24; @@ -318,7 +318,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE | - SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { @@ -327,7 +327,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE | - SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops,
Jon
It should solve the problem in my particular case, but I'm not sure that the solution is correct.
The v5.5 kernel is released now with the broken audio and apparently getting 24bit to work won't be trivial (if possible at all). Ben, could you please send a patch to fix v5.5 by removing the S24 support advertisement from the driver?
I also suspect that s32 may need some extra patches and thus could be worthwhile to stop advertising it as well.
As far as I am aware that works and we can hit the audio rates for it.
I ran a test on Tegra124 Jetson-TK1 and 24-bit playback seems to work as Ben has indicated. So I don't think it is broken.
Have you tried to replicate my case by playing the video file?
Can you try Ben's testcase on Tegra30 (ie. generate a tone using sox and use aplay to play)?
Surely I can try, but only if you'll share the sample file with me and give precise instructions how to test it.
On Tue, Jan 28, 2020 at 01:19:17PM +0000, Jon Hunter wrote:
On 28/01/2020 08:59, Ben Dooks wrote:
On 27/01/2020 19:23, Dmitry Osipenko wrote:
27.01.2020 22:20, Dmitry Osipenko пишет:
24.01.2020 19:50, Jon Hunter пишет:
On 23/01/2020 19:38, Ben Dooks wrote:
On 07/01/2020 01:39, Dmitry Osipenko wrote: > 06.01.2020 22:00, Ben Dooks пишет: >> On 05/01/2020 10:53, Ben Dooks wrote:
Please delete unneeded context from mails when replying. Doing this makes it much easier to find your reply in the message, helping ensure it won't be missed by people scrolling through the irrelevant quoted material.
I also suspect that s32 may need some extra patches and thus could be worthwhile to stop advertising it as well.
As far as I am aware that works and we can hit the audio rates for it.
I ran a test on Tegra124 Jetson-TK1 and 24-bit playback seems to work as Ben has indicated. So I don't think it is broken.
Can you try Ben's testcase on Tegra30 (ie. generate a tone using sox and use aplay to play)?
Another test application that's quite useful for this sort of stuff is speaker-test, it generates audio data directly in arbatrary formats and it's part of alsa-utils so if you've got aplay and friends you may already have it already installed.
28.01.2020 18:26, Mark Brown пишет:
On Tue, Jan 28, 2020 at 01:19:17PM +0000, Jon Hunter wrote:
On 28/01/2020 08:59, Ben Dooks wrote:
On 27/01/2020 19:23, Dmitry Osipenko wrote:
27.01.2020 22:20, Dmitry Osipenko пишет: I also suspect that s32 may need some extra patches and thus could be worthwhile to stop advertising it as well.
As far as I am aware that works and we can hit the audio rates for it.
I ran a test on Tegra124 Jetson-TK1 and 24-bit playback seems to work as Ben has indicated. So I don't think it is broken.
Can you try Ben's testcase on Tegra30 (ie. generate a tone using sox and use aplay to play)?
Another test application that's quite useful for this sort of stuff is speaker-test, it generates audio data directly in arbatrary formats and it's part of alsa-utils so if you've got aplay and friends you may already have it already installed.
I tried speaker-test and it doesn't support S24_LE:
# speaker-test -h
speaker-test 1.1.9
Usage: speaker-test [OPTION]... -h,--help help -D,--device playback device -r,--rate stream rate in Hz -c,--channels count of channels in stream -f,--frequency sine wave frequency in Hz -F,--format sample format -b,--buffer ring buffer size in us -p,--period period size in us -P,--nperiods number of periods -t,--test pink=use pink noise, sine=use sine wave, wav=WAV file -l,--nloops specify number of loops to test, 0 = infinite -s,--speaker single speaker test. Values 1=Left, 2=right, etc -w,--wavfile Use the given WAV file as a test sound -W,--wavdir Specify the directory containing WAV files -m,--chmap Specify the channel map to override -X,--force-frequency force frequencies outside the 30-8000hz range -S,--scale Scale of generated test tones in percent (default=80)
Recognized sample formats are: S8 S16_LE S16_BE FLOAT_LE S24_3LE S24_3BE S32_LE S32_BE
On 28/01/2020 13:19, Jon Hunter wrote:
...
I ran a test on Tegra124 Jetson-TK1 and 24-bit playback seems to work as Ben has indicated. So I don't think it is broken.
Actually, it does not work on TK1. Pulseaudio was converting from S24_3LE to S16_LE. If I use plughw to do the conversion it sounds distorted indeed.
Ben what audio codec are you testing with?
Jon
Playing WAVE 'tmp.wav' : Signed 24 bit Little Endian in 3bytes, Rate 44100 Hz, Stereo Plug PCM: Linear conversion PCM (S24_LE) Its setup is: stream : PLAYBACK access : RW_INTERLEAVED format : S24_3LE subformat : STD channels : 2 rate : 44100 exact rate : 44100 (44100/1) msbits : 24 buffer_size : 4096 period_size : 512 period_time : 11609 tstamp_mode : NONE tstamp_type : MONOTONIC period_step : 1 avail_min : 512 period_event : 0 start_threshold : 4096 stop_threshold : 4096 silence_threshold: 0 silence_size : 0 boundary : 1073741824 Slave: Hardware PCM card 0 'NVIDIA Tegra Jetson TK1' device 0 subdevice 0 Its setup is: stream : PLAYBACK access : MMAP_INTERLEAVED format : S24_LE subformat : STD channels : 2 rate : 44100 exact rate : 44100 (44100/1) msbits : 32 buffer_size : 4096 period_size : 512 period_time : 11609 tstamp_mode : NONE tstamp_type : MONOTONIC period_step : 1 avail_min : 512 period_event : 0 start_threshold : 4096 stop_threshold : 4096 silence_threshold: 0 silence_size : 0 boundary : 1073741824 appl_ptr : 0 hw_ptr : 0
On 28/01/2020 18:42, Jon Hunter wrote:
On 28/01/2020 13:19, Jon Hunter wrote:
...
I ran a test on Tegra124 Jetson-TK1 and 24-bit playback seems to work as Ben has indicated. So I don't think it is broken.
Actually, it does not work on TK1. Pulseaudio was converting from S24_3LE to S16_LE. If I use plughw to do the conversion it sounds distorted indeed.
Ben what audio codec are you testing with?
I think it is the sgtl5000
On 27/01/2020 19:20, Dmitry Osipenko wrote:
24.01.2020 19:50, Jon Hunter пишет:
On 23/01/2020 19:38, Ben Dooks wrote:
On 07/01/2020 01:39, Dmitry Osipenko wrote:
06.01.2020 22:00, Ben Dooks пишет:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote: > 05.01.2020 03:04, Ben Dooks пишет: >> [snip] >> >> I've just gone through testing. >> >> Some simple data tests show 16 and 32-bits work. >> >> The 24 bit case seems to be weird, it looks like the 24-bit expects >> 24 bit samples in 32 bit words. I can't see any packing options to >> do 24 bit in 24 bit, so we may have to remove 24 bit sample support >> (which is a shame) >> >> My preference is to remove the 24-bit support and keep the 32 bit in. >> > > Interesting.. Jon, could you please confirm that 24bit format isn't > usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I need to check some things, I assumed 24 was 24 packed bits, it looks like the default is 24 in 32 bits so we may be ok. However I need to re-write my test case which assumed it was 24bits in 3 bytes (S24_3LE).
I'll follow up later,
Okay, the S24_3LE isn't supported by RT5640 codec in my case. I briefly looked through the TRM doc and got impression that AHUB could re-pack data stream into something that codec supports, but maybe it's a wrong impression. _________________________________
I did a quick test with the following:
sox -n -b 16 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 24 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5 sox -n -b 32 -c 2 -r 44100 /tmp/tmp.wav synth sine 500 vol 0.5
The 16 and 32 work fine, the 24 is showing a playback output freq of 440Hz instead of 500Hz... this suggests the clock is off, or there is something else weird going on...
I was looking at using sox to create such as file, but the above command generates a S24_3LE file and not S24_LE file. The codec on Jetson-TK1 supports S24_LE but does not support S24_3LE and so I cannot test this. Anyway, we really need to test S24_LE and not S24_3LE because this is the problem that Dmitry is having.
Ben is S24_3LE what you really need to support?
Dmitry, does the following fix your problem?
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index dbed3c5408e7..92845c4b63f4 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -140,7 +140,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, audio_bits = TEGRA30_AUDIOCIF_BITS_16; sample_size = 16; break;
case SNDRV_PCM_FORMAT_S24_LE:
case SNDRV_PCM_FORMAT_S24_3LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_24; audio_bits = TEGRA30_AUDIOCIF_BITS_24; sample_size = 24;
@@ -318,7 +318,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .capture = {
@@ -327,7 +327,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops,
Jon
It should solve the problem in my particular case, but I'm not sure that the solution is correct.
The v5.5 kernel is released now with the broken audio and apparently getting 24bit to work won't be trivial (if possible at all). Ben, could you please send a patch to fix v5.5 by removing the S24 support advertisement from the driver?
That might be the best for the moment.
As far as my testing so far is that just the audio rate is off . It might be worth putting it in as a config option or run time command option?
On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote:
24.01.2020 19:50, Jon Hunter пишет:
.rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE |
It should solve the problem in my particular case, but I'm not sure that the solution is correct.
If the format implemented by the driver is S24_3LE the driver should advertise S24_3LE.
The v5.5 kernel is released now with the broken audio and apparently getting 24bit to work won't be trivial (if possible at all). Ben, could you please send a patch to fix v5.5 by removing the S24 support advertisement from the driver?
Why is that the best fix rather than just advertising the format implemented by the driver?
I really don't understand why this is all taking so long, this thread just seems to be going round in interminable circles long after it looked like the issue was understood. I have to admit I've not read every single message in the thread but it's difficult to see why it doesn't seem to be making any progress.
28.01.2020 15:13, Mark Brown пишет:
On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote:
24.01.2020 19:50, Jon Hunter пишет:
.rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE |
It should solve the problem in my particular case, but I'm not sure that the solution is correct.
If the format implemented by the driver is S24_3LE the driver should advertise S24_3LE.
It should be S24_LE, but seems we still don't know for sure.
The v5.5 kernel is released now with the broken audio and apparently getting 24bit to work won't be trivial (if possible at all). Ben, could you please send a patch to fix v5.5 by removing the S24 support advertisement from the driver?
Why is that the best fix rather than just advertising the format implemented by the driver?
The currently supported format that is known to work well is S16_LE.
I'm suggesting to drop the S24_LE and S32_LE that were added by the applied patches simply because this series wasn't tested properly before it was sent out and turned out that it doesn't work well.
I really don't understand why this is all taking so long, this thread just seems to be going round in interminable circles long after it looked like the issue was understood. I have to admit I've not read every single message in the thread but it's difficult to see why it doesn't seem to be making any progress.
Ben was trying to make a fix for the introduced problem, but it's not easy as we see now.
Perhaps the best solution should be to revert all of the three applied patches and try again later on, once all current problems will be resolved.
On 28/01/2020 17:42, Dmitry Osipenko wrote:
28.01.2020 15:13, Mark Brown пишет:
On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote:
24.01.2020 19:50, Jon Hunter пишет:
.rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE |
It should solve the problem in my particular case, but I'm not sure that the solution is correct.
If the format implemented by the driver is S24_3LE the driver should advertise S24_3LE.
It should be S24_LE, but seems we still don't know for sure.
Why?
The v5.5 kernel is released now with the broken audio and apparently getting 24bit to work won't be trivial (if possible at all). Ben, could you please send a patch to fix v5.5 by removing the S24 support advertisement from the driver?
Why is that the best fix rather than just advertising the format implemented by the driver?
The currently supported format that is known to work well is S16_LE.
I'm suggesting to drop the S24_LE and S32_LE that were added by the applied patches simply because this series wasn't tested properly before it was sent out and turned out that it doesn't work well.
S32_LE should be fine, however, I do have some concerns about S24_LE.
Jon
28.01.2020 21:19, Jon Hunter пишет:
On 28/01/2020 17:42, Dmitry Osipenko wrote:
28.01.2020 15:13, Mark Brown пишет:
On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote:
24.01.2020 19:50, Jon Hunter пишет:
.rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE |
It should solve the problem in my particular case, but I'm not sure that the solution is correct.
If the format implemented by the driver is S24_3LE the driver should advertise S24_3LE.
It should be S24_LE, but seems we still don't know for sure.
Why?
/I think/ sound should be much more distorted if it was S24_3LE, but maybe I'm wrong.
On 29/01/2020 00:17, Dmitry Osipenko wrote:
28.01.2020 21:19, Jon Hunter пишет:
On 28/01/2020 17:42, Dmitry Osipenko wrote:
28.01.2020 15:13, Mark Brown пишет:
On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote:
24.01.2020 19:50, Jon Hunter пишет:
.rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE |
It should solve the problem in my particular case, but I'm not sure that the solution is correct.
If the format implemented by the driver is S24_3LE the driver should advertise S24_3LE.
It should be S24_LE, but seems we still don't know for sure.
Why?
/I think/ sound should be much more distorted if it was S24_3LE, but maybe I'm wrong.
S24_3LE is IICC the wrong thing and we can't support it on the tegra3
Ben Dooks wrote:
On 29/01/2020 00:17, Dmitry Osipenko wrote:
28.01.2020 21:19, Jon Hunter пишет:
On 28/01/2020 17:42, Dmitry Osipenko wrote:
28.01.2020 15:13, Mark Brown пишет:
On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote:
24.01.2020 19:50, Jon Hunter пишет:
> .rates = SNDRV_PCM_RATE_8000_96000, > .formats = SNDRV_PCM_FMTBIT_S32_LE | > - SNDRV_PCM_FMTBIT_S24_LE | > + SNDRV_PCM_FMTBIT_S24_3LE |
It should solve the problem in my particular case, but I'm not sure that the solution is correct.
If the format implemented by the driver is S24_3LE the driver should advertise S24_3LE.
It should be S24_LE, but seems we still don't know for sure.
Why?
/I think/ sound should be much more distorted if it was S24_3LE, but maybe I'm wrong.
S24_3LE is IICC the wrong thing and we can't support it on the tegra3
There are three ways of arranging 24-bit samples in memory:
S24_3LE: 24-bit samples in 24-bit words without padding S24_LE: 24-bit samples in 32-bit words, aligned to the LSB S32_LE: 24-bit samples in 32-bit words, aligned to the MSB
It is very unlikely that your hardware implements S24_LE.
If a S32_LE driver wants to describe how many bits are actually used, it should install a msbits constraint (snd_pcm_hw_constraint_msbits()).
Regards, Clemens
On 30/01/2020 09:31, Clemens Ladisch wrote:
Ben Dooks wrote:
On 29/01/2020 00:17, Dmitry Osipenko wrote:
28.01.2020 21:19, Jon Hunter пишет:
On 28/01/2020 17:42, Dmitry Osipenko wrote:
28.01.2020 15:13, Mark Brown пишет:
On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote: > 24.01.2020 19:50, Jon Hunter пишет:
>> .rates = SNDRV_PCM_RATE_8000_96000, >> .formats = SNDRV_PCM_FMTBIT_S32_LE | >> - SNDRV_PCM_FMTBIT_S24_LE | >> + SNDRV_PCM_FMTBIT_S24_3LE |
> It should solve the problem in my particular case, but I'm not sure that > the solution is correct.
If the format implemented by the driver is S24_3LE the driver should advertise S24_3LE.
It should be S24_LE, but seems we still don't know for sure.
Why?
/I think/ sound should be much more distorted if it was S24_3LE, but maybe I'm wrong.
S24_3LE is IICC the wrong thing and we can't support it on the tegra3
There are three ways of arranging 24-bit samples in memory:
S24_3LE: 24-bit samples in 24-bit words without padding S24_LE: 24-bit samples in 32-bit words, aligned to the LSB S32_LE: 24-bit samples in 32-bit words, aligned to the MSB
It is very unlikely that your hardware implements S24_LE.
Which is wrong, since this is exactly what the hardware implements.
The DMA fetches 32 bit words, and then the front end dispatches only 24 bits of these to the I2S/TDM
Ben Dooks wrote:
On 30/01/2020 09:31, Clemens Ladisch wrote:
S24_LE: 24-bit samples in 32-bit words, aligned to the LSB S32_LE: 24-bit samples in 32-bit words, aligned to the MSB
It is very unlikely that your hardware implements S24_LE.
Which is wrong, since this is exactly what the hardware implements.
The DMA fetches 32 bit words, and then the front end dispatches only 24 bits of these to the I2S/TDM
Which 24 bits? Is the padding in the first byte (S32_LE) or in the last byte (S24_LE)?
Regards, Clemens
On 2020-01-30 14:58, Clemens Ladisch wrote:
Ben Dooks wrote:
On 30/01/2020 09:31, Clemens Ladisch wrote:
S24_LE: 24-bit samples in 32-bit words, aligned to the LSB S32_LE: 24-bit samples in 32-bit words, aligned to the MSB
It is very unlikely that your hardware implements S24_LE.
Which is wrong, since this is exactly what the hardware implements.
The DMA fetches 32 bit words, and then the front end dispatches only 24 bits of these to the I2S/TDM
Which 24 bits? Is the padding in the first byte (S32_LE) or in the last byte (S24_LE)?
I think the low 24 bits are sent from the 32 bit word.
Ben Dooks wrote:
On 2020-01-30 14:58, Clemens Ladisch wrote:
Ben Dooks wrote:
On 30/01/2020 09:31, Clemens Ladisch wrote:
S24_LE: 24-bit samples in 32-bit words, aligned to the LSB S32_LE: 24-bit samples in 32-bit words, aligned to the MSB
It is very unlikely that your hardware implements S24_LE.
Which is wrong, since this is exactly what the hardware implements.
The DMA fetches 32 bit words, and then the front end dispatches only 24 bits of these to the I2S/TDM
Which 24 bits? Is the padding in the first byte (S32_LE) or in the last byte (S24_LE)?
I think the low 24 bits are sent from the 32 bit word.
This would indeed by S24_LE. If you change the driver to say that it supports _only_ S24_LE, is the data then played correctly?
Regards, Clemens
On 28/01/2020 12:13, Mark Brown wrote:
I really don't understand why this is all taking so long, this thread just seems to be going round in interminable circles long after it looked like the issue was understood. I have to admit I've not read every single message in the thread but it's difficult to see why it doesn't seem to be making any progress.
Sorry about that. On reviewing this with the audio team at NVIDIA, I was told we don't support S24_LE for I2S. The reason being that the crossbar between the DMA and I2S is not able to extract the correct 24-bits from the 32-bit sample to feed to the I2S interface. The Tegra documentation does show support for 24-bits, but not state explicit support for S24_LE.
Now Ben says that he has this working, but I am unable to reproduce this, so before just dropping the S24_LE support, I would like to understand how this is working for Ben in case there is something that we have overlooked here.
Jon
On 29/01/2020 10:49, Jon Hunter wrote:
On 28/01/2020 12:13, Mark Brown wrote:
I really don't understand why this is all taking so long, this thread just seems to be going round in interminable circles long after it looked like the issue was understood. I have to admit I've not read every single message in the thread but it's difficult to see why it doesn't seem to be making any progress.
Sorry about that. On reviewing this with the audio team at NVIDIA, I was told we don't support S24_LE for I2S. The reason being that the crossbar between the DMA and I2S is not able to extract the correct 24-bits from the 32-bit sample to feed to the I2S interface. The Tegra documentation does show support for 24-bits, but not state explicit support for S24_LE.
Now Ben says that he has this working, but I am unable to reproduce this, so before just dropping the S24_LE support, I would like to understand how this is working for Ben in case there is something that we have overlooked here.
Ah, I see that part of the problem is that patches 6 and 7 are yet to be applied and without these the audio is completely distorted because there is a mismatch in the data size between the APBIF and I2S controller. Applying these patches it is not distorted but now I am observing the clocking issue Ben reported and so the tone is not quite right.
Ben, I was able to workaround the clocking issue by making the I2S word clock 64 bits long and not 48.
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index bbf81b5aa723..3c9b4779e61b 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -143,7 +143,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, case SNDRV_PCM_FORMAT_S24_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_24; audio_bits = TEGRA30_AUDIOCIF_BITS_24; - sample_size = 24; + sample_size = 32; break; case SNDRV_PCM_FORMAT_S32_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_32;
For I2S I believe we only care about the edges of the word clock and so we make the overall period of the word clock 64 bit clocks then we no longer have an issue with the bit clock frequency. I assume that this should also be fine for TDM modes as well.
Can you let me know if this works for you?
Cheers Jon
29.01.2020 17:33, Jon Hunter пишет:
On 29/01/2020 10:49, Jon Hunter wrote:
On 28/01/2020 12:13, Mark Brown wrote:
I really don't understand why this is all taking so long, this thread just seems to be going round in interminable circles long after it looked like the issue was understood. I have to admit I've not read every single message in the thread but it's difficult to see why it doesn't seem to be making any progress.
Sorry about that. On reviewing this with the audio team at NVIDIA, I was told we don't support S24_LE for I2S. The reason being that the crossbar between the DMA and I2S is not able to extract the correct 24-bits from the 32-bit sample to feed to the I2S interface. The Tegra documentation does show support for 24-bits, but not state explicit support for S24_LE.
Now Ben says that he has this working, but I am unable to reproduce this, so before just dropping the S24_LE support, I would like to understand how this is working for Ben in case there is something that we have overlooked here.
Ah, I see that part of the problem is that patches 6 and 7 are yet to be applied and without these the audio is completely distorted because there is a mismatch in the data size between the APBIF and I2S controller. Applying these patches it is not distorted but now I am observing the clocking issue Ben reported and so the tone is not quite right.
Ben, I was able to workaround the clocking issue by making the I2S word clock 64 bits long and not 48.
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index bbf81b5aa723..3c9b4779e61b 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -143,7 +143,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, case SNDRV_PCM_FORMAT_S24_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_24; audio_bits = TEGRA30_AUDIOCIF_BITS_24;
sample_size = 24;
sample_size = 32; break; case SNDRV_PCM_FORMAT_S32_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_32;
For I2S I believe we only care about the edges of the word clock and so we make the overall period of the word clock 64 bit clocks then we no longer have an issue with the bit clock frequency. I assume that this should also be fine for TDM modes as well.
Can you let me know if this works for you?
cat /proc/asound/card0/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED format: S24_LE subformat: STD channels: 2 rate: 48000 (48000/1) period_size: 512 buffer_size: 4096
No distortion at all! Jon, thank you very much!
On 29/01/2020 14:33, Jon Hunter wrote:
On 29/01/2020 10:49, Jon Hunter wrote:
On 28/01/2020 12:13, Mark Brown wrote:
I really don't understand why this is all taking so long, this thread just seems to be going round in interminable circles long after it looked like the issue was understood. I have to admit I've not read every single message in the thread but it's difficult to see why it doesn't seem to be making any progress.
Sorry about that. On reviewing this with the audio team at NVIDIA, I was told we don't support S24_LE for I2S. The reason being that the crossbar between the DMA and I2S is not able to extract the correct 24-bits from the 32-bit sample to feed to the I2S interface. The Tegra documentation does show support for 24-bits, but not state explicit support for S24_LE.
Now Ben says that he has this working, but I am unable to reproduce this, so before just dropping the S24_LE support, I would like to understand how this is working for Ben in case there is something that we have overlooked here.
Ah, I see that part of the problem is that patches 6 and 7 are yet to be applied and without these the audio is completely distorted because there is a mismatch in the data size between the APBIF and I2S controller. Applying these patches it is not distorted but now I am observing the clocking issue Ben reported and so the tone is not quite right.
I thought they had been applied? I probably dragged them back in when putting in the support for the test channel on the colibri.
Ben, I was able to workaround the clocking issue by making the I2S word clock 64 bits long and not 48.
Ok, that will work for I2S case, but maybe not TDM? I'd have to check.
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index bbf81b5aa723..3c9b4779e61b 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -143,7 +143,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, case SNDRV_PCM_FORMAT_S24_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_24; audio_bits = TEGRA30_AUDIOCIF_BITS_24;
sample_size = 24;
sample_size = 32; break; case SNDRV_PCM_FORMAT_S32_LE: val = TEGRA30_I2S_CTRL_BIT_SIZE_32;
For I2S I believe we only care about the edges of the word clock and so we make the overall period of the word clock 64 bit clocks then we no longer have an issue with the bit clock frequency. I assume that this should also be fine for TDM modes as well.
Can you let me know if this works for you?
I'll be back in the office next week to test.
On 30/01/2020 08:17, Ben Dooks wrote:
...
I'll be back in the office next week to test.
Any objections to reverting this patch now for v5.6 and pushing to stable for v5.5, then getting this fixed properly for v5.7?
Jon
On 30/01/2020 12:05, Jon Hunter wrote:
On 30/01/2020 08:17, Ben Dooks wrote:
...
I'll be back in the office next week to test.
Any objections to reverting this patch now for v5.6 and pushing to stable for v5.5, then getting this fixed properly for v5.7?
No, as long as it does not drag on too much. The other option is just to remove the announcement of these capabilities.
I think I need to check exactly what got merged and then go and work out a full series.
The original authors and testers left Codethink nearly 2 years ago now.
On 30/01/2020 12:07, Ben Dooks wrote:
On 30/01/2020 12:05, Jon Hunter wrote:
On 30/01/2020 08:17, Ben Dooks wrote:
...
I'll be back in the office next week to test.
Any objections to reverting this patch now for v5.6 and pushing to stable for v5.5, then getting this fixed properly for v5.7?
No, as long as it does not drag on too much.
I won't if you can address the comments previously posted for the other patches :-)
The other option is just to remove the announcement of these capabilities.
This patch is not that big and so we may as well revert.
I think I need to check exactly what got merged and then go and work out a full series.
Looks like 3 of 7 patches were merged. So if we revert this, then there are still 5 that are needed.
Cheers! Jon
On Thu, Jan 30, 2020 at 08:17:37AM +0000, Ben Dooks wrote:
On 29/01/2020 14:33, Jon Hunter wrote:
controller. Applying these patches it is not distorted but now I am observing the clocking issue Ben reported and so the tone is not quite right.
I thought they had been applied? I probably dragged them back in when putting in the support for the test channel on the colibri.
There were review comments from Jon on patch 6 that you never responded to.
On 2020-01-30 13:10, Mark Brown wrote:
On Thu, Jan 30, 2020 at 08:17:37AM +0000, Ben Dooks wrote:
On 29/01/2020 14:33, Jon Hunter wrote:
controller. Applying these patches it is not distorted but now I am observing the clocking issue Ben reported and so the tone is not quite right.
I thought they had been applied? I probably dragged them back in when putting in the support for the test channel on the colibri.
There were review comments from Jon on patch 6 that you never responded to.
Hmm, I may have accidentally deleted those.
I will look to see if I can re-form the series and re-send in the next couple of weeks. I've got no access currently to the machine and having to deal with working from home for the next month or so.
19.03.2020 18:32, Ben Dooks пишет: ...
Hmm, I may have accidentally deleted those.
I will look to see if I can re-form the series and re-send in the next couple of weeks. I've got no access currently to the machine and having to deal with working from home for the next month or so.
Great, looking forward to the new version :)
On 29/01/2020 10:49, Jon Hunter wrote:
On 28/01/2020 12:13, Mark Brown wrote:
I really don't understand why this is all taking so long, this thread just seems to be going round in interminable circles long after it looked like the issue was understood. I have to admit I've not read every single message in the thread but it's difficult to see why it doesn't seem to be making any progress.
Sorry about that. On reviewing this with the audio team at NVIDIA, I was told we don't support S24_LE for I2S. The reason being that the crossbar between the DMA and I2S is not able to extract the correct 24-bits from the 32-bit sample to feed to the I2S interface. The Tegra documentation does show support for 24-bits, but not state explicit support for S24_LE.
Now Ben says that he has this working, but I am unable to reproduce this, so before just dropping the S24_LE support, I would like to understand how this is working for Ben in case there is something that we have overlooked here.
Jon
Let's go back to S24_3LE isn't supportable, S24_LE is
On 28/01/2020 12:13, Mark Brown wrote:
On Mon, Jan 27, 2020 at 10:20:25PM +0300, Dmitry Osipenko wrote:
24.01.2020 19:50, Jon Hunter пишет:
.rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S24_3LE |
It should solve the problem in my particular case, but I'm not sure that the solution is correct.
If the format implemented by the driver is S24_3LE the driver should advertise S24_3LE.
I am fairly sure the format is S24_LE, the tegra3 hardware only supports 24bits padded to 32 bits.
The v5.5 kernel is released now with the broken audio and apparently getting 24bit to work won't be trivial (if possible at all). Ben, could you please send a patch to fix v5.5 by removing the S24 support advertisement from the driver?
Why is that the best fix rather than just advertising the format implemented by the driver?
I really don't understand why this is all taking so long, this thread just seems to be going round in interminable circles long after it looked like the issue was understood. I have to admit I've not read every single message in the thread but it's difficult to see why it doesn't seem to be making any progress.
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет:
[snip]
I've just gone through testing.
Some simple data tests show 16 and 32-bits work.
The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame)
My preference is to remove the 24-bit support and keep the 32 bit in.
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I will check on this. I would have thought that S24_LE (24-bits packed into 32-bit elements) would be fine. Typically we don't support S24_3LE (24-bits in 24-bit elements).
Jon
On 07/01/2020 10:29, Jon Hunter wrote:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет:
[snip]
I've just gone through testing.
Some simple data tests show 16 and 32-bits work.
The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame)
My preference is to remove the 24-bit support and keep the 32 bit in.
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I will check on this. I would have thought that S24_LE (24-bits packed into 32-bit elements) would be fine. Typically we don't support S24_3LE (24-bits in 24-bit elements).
I will have a look again, I thought S24 was 24-in-24, so wrote my test generator code to do that. I'll go and see if I can re-test this as soon as possible (may be Wed/Thu by the time I can get to check it)
On 07/01/2020 10:29, Jon Hunter wrote:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет:
[snip]
I've just gone through testing.
Some simple data tests show 16 and 32-bits work.
The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame)
My preference is to remove the 24-bit support and keep the 32 bit in.
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I will check on this. I would have thought that S24_LE (24-bits packed into 32-bit elements) would be fine. Typically we don't support S24_3LE (24-bits in 24-bit elements).
I've just had to spend time fixing pulseview/sigrok's i2s handling for this, but have run a simple test of S24_LE using a pattern generator and the low level output looks ok.
I will test a bit more tomorrow, but I suspect something else is either getting S24_LE wrong or we have some other issue.
21.01.2020 21:15, Ben Dooks пишет:
On 07/01/2020 10:29, Jon Hunter wrote:
On 05/01/2020 10:53, Ben Dooks wrote:
On 2020-01-05 01:48, Dmitry Osipenko wrote:
05.01.2020 03:04, Ben Dooks пишет:
[snip]
I've just gone through testing.
Some simple data tests show 16 and 32-bits work.
The 24 bit case seems to be weird, it looks like the 24-bit expects 24 bit samples in 32 bit words. I can't see any packing options to do 24 bit in 24 bit, so we may have to remove 24 bit sample support (which is a shame)
My preference is to remove the 24-bit support and keep the 32 bit in.
Interesting.. Jon, could you please confirm that 24bit format isn't usable on T30?
If there is an option of 24 packed into 32, then I think that would work.
I can try testing that with raw data on Monday.
I will check on this. I would have thought that S24_LE (24-bits packed into 32-bit elements) would be fine. Typically we don't support S24_3LE (24-bits in 24-bit elements).
I've just had to spend time fixing pulseview/sigrok's i2s handling for this, but have run a simple test of S24_LE using a pattern generator and the low level output looks ok.
I will test a bit more tomorrow, but I suspect something else is either getting S24_LE wrong or we have some other issue.
Okay, thanks for the update.
From: Edward Cragg edward.cragg@codethink.co.uk
The CIF configuration and clock setting is currently hard coded for 2 channels. Since the hardware is capable of supporting 1-8 channels add support for reading the channel count from the supplied parameters to allow for better TDM support. It seems the original implementation of this driver was fixed at 2 channels for simplicity, and not implementing TDM.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: added is_tdm and channel nr check] [ben.dooks@codethink.co.uk: merge edge control into set-format] [ben.dooks@codethink.co.uk: removed is_tdm and moved edge to hw_params] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk --- v2: - fix the lrclk for dsp-b format --- sound/soc/tegra/tegra30_i2s.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 063f34c882af..fc77e65a3646 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -67,6 +67,7 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, { struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); unsigned int mask = 0, val = 0; + unsigned int ch_mask, ch_val = 0;
switch (fmt & SND_SOC_DAIFMT_INV_MASK) { case SND_SOC_DAIFMT_NB_NF: @@ -75,6 +76,7 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, return -EINVAL; }
+ ch_mask = TEGRA30_I2S_CH_CTRL_EGDE_CTRL_MASK; mask |= TEGRA30_I2S_CTRL_MASTER_ENABLE; switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBS_CFS: @@ -90,10 +92,12 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, TEGRA30_I2S_CTRL_LRCK_MASK; switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_DSP_A: + ch_val = TEGRA30_I2S_CH_CTRL_EGDE_CTRL_NEG_EDGE; val |= TEGRA30_I2S_CTRL_FRAME_FORMAT_FSYNC; val |= TEGRA30_I2S_CTRL_LRCK_L_LOW; break; case SND_SOC_DAIFMT_DSP_B: + ch_val = TEGRA30_I2S_CH_CTRL_EGDE_CTRL_POS_EDGE; val |= TEGRA30_I2S_CTRL_FRAME_FORMAT_FSYNC; val |= TEGRA30_I2S_CTRL_LRCK_R_LOW; break; @@ -115,6 +119,7 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai,
pm_runtime_get_sync(dai->dev); regmap_update_bits(i2s->regmap, TEGRA30_I2S_CTRL, mask, val); + regmap_update_bits(i2s->regmap, TEGRA30_I2S_CH_CTRL, ch_mask, ch_val); pm_runtime_put(dai->dev);
return 0; @@ -127,10 +132,11 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, struct device *dev = dai->dev; struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); unsigned int mask, val, reg; - int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; + int ret, sample_size, srate, i2sclock, bitcnt, audio_bits, channels; struct tegra30_ahub_cif_conf cif_conf;
- if (params_channels(params) != 2) + channels = params_channels(params); + if (channels > 8) return -EINVAL;
mask = TEGRA30_I2S_CTRL_BIT_SIZE_MASK; @@ -157,9 +163,8 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, regmap_update_bits(i2s->regmap, TEGRA30_I2S_CTRL, mask, val);
srate = params_rate(params); - /* Final "* 2" required by Tegra hardware */ - i2sclock = srate * params_channels(params) * sample_size * 2; + i2sclock = srate * channels * sample_size * 2;
bitcnt = (i2sclock / (2 * srate)) - 1; if (bitcnt < 0 || bitcnt > TEGRA30_I2S_TIMING_CHANNEL_BIT_COUNT_MASK_US) @@ -179,8 +184,8 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, regmap_write(i2s->regmap, TEGRA30_I2S_TIMING, val);
cif_conf.threshold = 0; - cif_conf.audio_channels = 2; - cif_conf.client_channels = 2; + cif_conf.audio_channels = channels; + cif_conf.client_channels = channels; cif_conf.audio_bits = audio_bits; cif_conf.client_bits = audio_bits; cif_conf.expand = 0; @@ -315,7 +320,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .playback = { .stream_name = "Playback", .channels_min = 2, - .channels_max = 2, + .channels_max = 8, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S24_LE | @@ -324,7 +329,7 @@ static const struct snd_soc_dai_driver tegra30_i2s_dai_template = { .capture = { .stream_name = "Capture", .channels_min = 2, - .channels_max = 2, + .channels_max = 8, .rates = SNDRV_PCM_RATE_8000_96000, .formats = SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S24_LE |
On 18/10/2019 16:48, Ben Dooks wrote:
From: Edward Cragg edward.cragg@codethink.co.uk
The CIF configuration and clock setting is currently hard coded for 2 channels. Since the hardware is capable of supporting 1-8 channels add support for reading the channel count from the supplied parameters to allow for better TDM support. It seems the original implementation of this driver was fixed at 2 channels for simplicity, and not implementing TDM.
Signed-off-by: Edward Cragg edward.cragg@codethink.co.uk [ben.dooks@codethink.co.uk: added is_tdm and channel nr check] [ben.dooks@codethink.co.uk: merge edge control into set-format] [ben.dooks@codethink.co.uk: removed is_tdm and moved edge to hw_params] Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk
v2:
- fix the lrclk for dsp-b format
sound/soc/tegra/tegra30_i2s.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 063f34c882af..fc77e65a3646 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -67,6 +67,7 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, { struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); unsigned int mask = 0, val = 0;
unsigned int ch_mask, ch_val = 0;
switch (fmt & SND_SOC_DAIFMT_INV_MASK) { case SND_SOC_DAIFMT_NB_NF:
@@ -75,6 +76,7 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, return -EINVAL; }
- ch_mask = TEGRA30_I2S_CH_CTRL_EGDE_CTRL_MASK; mask |= TEGRA30_I2S_CTRL_MASTER_ENABLE; switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBS_CFS:
@@ -90,10 +92,12 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, TEGRA30_I2S_CTRL_LRCK_MASK; switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_DSP_A:
ch_val = TEGRA30_I2S_CH_CTRL_EGDE_CTRL_NEG_EDGE;
Sorry, I just saw the feedback on the previous iteration. I don't think we want to set the polarity but based upon the format that is passed ...
https://nv-tegra.nvidia.com/gitweb/?p=linux-nvidia.git;a=blob;f=sound/soc/te...
Cheers Jon
On Thu, Oct 24, 2019 at 05:12:21PM +0100, Jon Hunter wrote:
On 18/10/2019 16:48, Ben Dooks wrote:
@@ -90,10 +92,12 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, TEGRA30_I2S_CTRL_LRCK_MASK; switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_DSP_A:
ch_val = TEGRA30_I2S_CH_CTRL_EGDE_CTRL_NEG_EDGE;
Sorry, I just saw the feedback on the previous iteration. I don't think we want to set the polarity but based upon the format that is passed ...
The polarity should be set based on the the inversion flags in the format, normally both DSP modes trigger on the rising edge of the LRCLK. The difference is if there's a delay before the first data bit or not.
On 24/10/2019 20:18, Mark Brown wrote:
On Thu, Oct 24, 2019 at 05:12:21PM +0100, Jon Hunter wrote:
On 18/10/2019 16:48, Ben Dooks wrote:
@@ -90,10 +92,12 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, TEGRA30_I2S_CTRL_LRCK_MASK; switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_DSP_A:
ch_val = TEGRA30_I2S_CH_CTRL_EGDE_CTRL_NEG_EDGE;
Sorry, I just saw the feedback on the previous iteration. I don't think we want to set the polarity but based upon the format that is passed ...
The polarity should be set based on the the inversion flags in the format, normally both DSP modes trigger on the rising edge of the LRCLK. The difference is if there's a delay before the first data bit or not.
Yes. Sorry I realise my email was not clear and when I meant format, I was referring to the bits in the format mask part of the format. In the example, I shared we use the inversion bits for the determining the polarity. There was an old version of one of our drivers where we had done this incorrectly.
Cheers Jon
We see odd FIFO overruns with this, we assume the best thing to do is to disable the RX I2S frontend first, and then disable the FIFO that is using it.
This also fixes an issue where using multi-word frames (TDM) have partial samples stuck in the FIFO which then get read out when the next capture is started.
Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk --- sound/soc/tegra/tegra30_i2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index fc77e65a3646..3839e3d955a8 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -236,9 +236,9 @@ static void tegra30_i2s_start_capture(struct tegra30_i2s *i2s)
static void tegra30_i2s_stop_capture(struct tegra30_i2s *i2s) { - tegra30_ahub_disable_rx_fifo(i2s->capture_fifo_cif); regmap_update_bits(i2s->regmap, TEGRA30_I2S_CTRL, TEGRA30_I2S_CTRL_XFER_EN_RX, 0); + tegra30_ahub_disable_rx_fifo(i2s->capture_fifo_cif); }
static int tegra30_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
On 18/10/2019 16:48, Ben Dooks wrote:
We see odd FIFO overruns with this, we assume the best thing to do is to disable the RX I2S frontend first, and then disable the FIFO that is using it.
This also fixes an issue where using multi-word frames (TDM) have partial samples stuck in the FIFO which then get read out when the next capture is started.
Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk
sound/soc/tegra/tegra30_i2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index fc77e65a3646..3839e3d955a8 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -236,9 +236,9 @@ static void tegra30_i2s_start_capture(struct tegra30_i2s *i2s)
static void tegra30_i2s_stop_capture(struct tegra30_i2s *i2s) {
- tegra30_ahub_disable_rx_fifo(i2s->capture_fifo_cif); regmap_update_bits(i2s->regmap, TEGRA30_I2S_CTRL, TEGRA30_I2S_CTRL_XFER_EN_RX, 0);
- tegra30_ahub_disable_rx_fifo(i2s->capture_fifo_cif);
}
static int tegra30_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
Acked-by: Jon Hunter jonathanh@nvidia.com
Thanks! Jon
The patch
ASoC: tegra: disable rx_fifo after disable stream
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 8c05f6af7b7d713e327cd6df5a8889c32fc1c10f Mon Sep 17 00:00:00 2001
From: Ben Dooks ben.dooks@codethink.co.uk Date: Fri, 18 Oct 2019 16:48:30 +0100 Subject: [PATCH] ASoC: tegra: disable rx_fifo after disable stream
We see odd FIFO overruns with this, we assume the best thing to do is to disable the RX I2S frontend first, and then disable the FIFO that is using it.
This also fixes an issue where using multi-word frames (TDM) have partial samples stuck in the FIFO which then get read out when the next capture is started.
Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk Acked-by: Jon Hunter jonathanh@nvidia.com Link: https://lore.kernel.org/r/20191018154833.7560-5-ben.dooks@codethink.co.uk Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/tegra/tegra30_i2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 8f8924060d9d..dbed3c5408e7 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -231,9 +231,9 @@ static void tegra30_i2s_start_capture(struct tegra30_i2s *i2s)
static void tegra30_i2s_stop_capture(struct tegra30_i2s *i2s) { - tegra30_ahub_disable_rx_fifo(i2s->capture_fifo_cif); regmap_update_bits(i2s->regmap, TEGRA30_I2S_CTRL, TEGRA30_I2S_CTRL_XFER_EN_RX, 0); + tegra30_ahub_disable_rx_fifo(i2s->capture_fifo_cif); }
static int tegra30_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
Set the offset to 0 for TDM mode, as per the current setup. Note we also move the data offset programming to the i2s hw_parameters call as per the suggestion from Jon Hunter.
Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk --- v2: - fix the review comments and move the i2s offset setting v3: - fix data-offset for dsp-a and dsp-b --- sound/soc/tegra/tegra30_i2s.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 3839e3d955a8..e99126600fc4 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -66,7 +66,7 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); - unsigned int mask = 0, val = 0; + unsigned int mask = 0, val = 0, data_offset = 1; unsigned int ch_mask, ch_val = 0;
switch (fmt & SND_SOC_DAIFMT_INV_MASK) { @@ -100,6 +100,7 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, ch_val = TEGRA30_I2S_CH_CTRL_EGDE_CTRL_POS_EDGE; val |= TEGRA30_I2S_CTRL_FRAME_FORMAT_FSYNC; val |= TEGRA30_I2S_CTRL_LRCK_R_LOW; + data_offset = 0; break; case SND_SOC_DAIFMT_I2S: val |= TEGRA30_I2S_CTRL_FRAME_FORMAT_LRCK; @@ -120,6 +121,10 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, pm_runtime_get_sync(dai->dev); regmap_update_bits(i2s->regmap, TEGRA30_I2S_CTRL, mask, val); regmap_update_bits(i2s->regmap, TEGRA30_I2S_CH_CTRL, ch_mask, ch_val); + val = (data_offset << TEGRA30_I2S_OFFSET_RX_DATA_OFFSET_SHIFT) | + (data_offset << TEGRA30_I2S_OFFSET_TX_DATA_OFFSET_SHIFT); + regmap_write(i2s->regmap, TEGRA30_I2S_OFFSET, val); + pm_runtime_put(dai->dev);
return 0; @@ -203,11 +208,6 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, }
i2s->soc_data->set_audio_cif(i2s->regmap, reg, &cif_conf); - - val = (1 << TEGRA30_I2S_OFFSET_RX_DATA_OFFSET_SHIFT) | - (1 << TEGRA30_I2S_OFFSET_TX_DATA_OFFSET_SHIFT); - regmap_write(i2s->regmap, TEGRA30_I2S_OFFSET, val); - return 0; }
On 18/10/2019 16:48, Ben Dooks wrote:
Set the offset to 0 for TDM mode, as per the current setup. Note we also
Minor note, that really it is just DSPB mode and not TDM in general. Furthermore, my understanding is that both DSPB and LEFT_J modes have a 0 bit delay and the rest have a 1 bit delay.
Cheers Jon
If the hw_params uses a different bit or channel count, then we need to change both the I2S unit's CIF configuration as well as the APBIF one.
To allow changing the APBIF, add a call to reconfigure the RX or TX FIFO without changing the DMA or allocation, and get the I2S driver to call it once the hw params have been calculate.
Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk --- sound/soc/tegra/tegra30_ahub.c | 115 ++++++++++++++++++--------------- sound/soc/tegra/tegra30_ahub.h | 5 ++ sound/soc/tegra/tegra30_i2s.c | 2 + 3 files changed, 69 insertions(+), 53 deletions(-)
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index 952381260dc3..24bc03428b45 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c @@ -84,12 +84,40 @@ static int tegra30_ahub_runtime_resume(struct device *dev) return 0; }
+int tegra30_ahub_setup_rx_fifo(enum tegra30_ahub_rxcif rxcif, + struct tegra30_ahub_cif_conf *cif_conf) +{ + int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0; + u32 reg, val; + + pm_runtime_get_sync(ahub->dev); + + reg = TEGRA30_AHUB_CHANNEL_CTRL + + (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); + val = tegra30_apbif_read(reg); + val &= ~(TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_MASK | + TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_MASK); + val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_SHIFT) | + TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_EN | + TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_16; + tegra30_apbif_write(reg, val); + + cif_conf->direction = TEGRA30_AUDIOCIF_DIRECTION_RX; + + reg = TEGRA30_AHUB_CIF_RX_CTRL + + (channel * TEGRA30_AHUB_CIF_RX_CTRL_STRIDE); + ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, cif_conf); + + pm_runtime_put(ahub->dev); + return 0; +} +EXPORT_SYMBOL_GPL(tegra30_ahub_setup_rx_fifo); + int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif, char *dmachan, int dmachan_len, dma_addr_t *fiforeg) { int channel; - u32 reg, val; struct tegra30_ahub_cif_conf cif_conf;
channel = find_first_zero_bit(ahub->rx_usage, @@ -104,37 +132,14 @@ int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif, *fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_RXFIFO + (channel * TEGRA30_AHUB_CHANNEL_RXFIFO_STRIDE);
- pm_runtime_get_sync(ahub->dev); + memset(&cif_conf, 0, sizeof(cif_conf));
- reg = TEGRA30_AHUB_CHANNEL_CTRL + - (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); - val = tegra30_apbif_read(reg); - val &= ~(TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_MASK | - TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_MASK); - val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_SHIFT) | - TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_EN | - TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_16; - tegra30_apbif_write(reg, val); - - cif_conf.threshold = 0; cif_conf.audio_channels = 2; cif_conf.client_channels = 2; cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; - cif_conf.expand = 0; - cif_conf.stereo_conv = 0; - cif_conf.replicate = 0; - cif_conf.direction = TEGRA30_AUDIOCIF_DIRECTION_RX; - cif_conf.truncate = 0; - cif_conf.mono_conv = 0; - - reg = TEGRA30_AHUB_CIF_RX_CTRL + - (channel * TEGRA30_AHUB_CIF_RX_CTRL_STRIDE); - ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf); - - pm_runtime_put(ahub->dev);
- return 0; + return tegra30_ahub_setup_rx_fifo(*rxcif, &cif_conf); } EXPORT_SYMBOL_GPL(tegra30_ahub_allocate_rx_fifo);
@@ -186,12 +191,40 @@ int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif) } EXPORT_SYMBOL_GPL(tegra30_ahub_free_rx_fifo);
+int tegra30_ahub_setup_tx_fifo(enum tegra30_ahub_txcif txcif, + struct tegra30_ahub_cif_conf *cif_conf) +{ + int channel = txcif - TEGRA30_AHUB_TXCIF_APBIF_TX0; + u32 reg, val; + + pm_runtime_get_sync(ahub->dev); + + reg = TEGRA30_AHUB_CHANNEL_CTRL + + (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); + val = tegra30_apbif_read(reg); + val &= ~(TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_MASK | + TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_MASK); + val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_SHIFT) | + TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_EN | + TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_16; + tegra30_apbif_write(reg, val); + + cif_conf->direction = TEGRA30_AUDIOCIF_DIRECTION_TX; + + reg = TEGRA30_AHUB_CIF_TX_CTRL + + (channel * TEGRA30_AHUB_CIF_TX_CTRL_STRIDE); + ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, cif_conf); + + pm_runtime_put(ahub->dev); + return 0; +} +EXPORT_SYMBOL_GPL(tegra30_ahub_setup_tx_fifo); + int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif, char *dmachan, int dmachan_len, dma_addr_t *fiforeg) { int channel; - u32 reg, val; struct tegra30_ahub_cif_conf cif_conf;
channel = find_first_zero_bit(ahub->tx_usage, @@ -206,37 +239,13 @@ int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif, *fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_TXFIFO + (channel * TEGRA30_AHUB_CHANNEL_TXFIFO_STRIDE);
- pm_runtime_get_sync(ahub->dev); - - reg = TEGRA30_AHUB_CHANNEL_CTRL + - (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); - val = tegra30_apbif_read(reg); - val &= ~(TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_MASK | - TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_MASK); - val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_SHIFT) | - TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_EN | - TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_16; - tegra30_apbif_write(reg, val); - - cif_conf.threshold = 0; + memset(&cif_conf, 0, sizeof(cif_conf)); cif_conf.audio_channels = 2; cif_conf.client_channels = 2; cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16; - cif_conf.expand = 0; - cif_conf.stereo_conv = 0; - cif_conf.replicate = 0; - cif_conf.direction = TEGRA30_AUDIOCIF_DIRECTION_TX; - cif_conf.truncate = 0; - cif_conf.mono_conv = 0; - - reg = TEGRA30_AHUB_CIF_TX_CTRL + - (channel * TEGRA30_AHUB_CIF_TX_CTRL_STRIDE); - ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf);
- pm_runtime_put(ahub->dev); - - return 0; + return tegra30_ahub_setup_tx_fifo(*txcif, &cif_conf); } EXPORT_SYMBOL_GPL(tegra30_ahub_allocate_tx_fifo);
diff --git a/sound/soc/tegra/tegra30_ahub.h b/sound/soc/tegra/tegra30_ahub.h index 6889c5f23d02..26120aee64b3 100644 --- a/sound/soc/tegra/tegra30_ahub.h +++ b/sound/soc/tegra/tegra30_ahub.h @@ -490,6 +490,11 @@ void tegra30_ahub_set_cif(struct regmap *regmap, unsigned int reg, void tegra124_ahub_set_cif(struct regmap *regmap, unsigned int reg, struct tegra30_ahub_cif_conf *conf);
+extern int tegra30_ahub_setup_tx_fifo(enum tegra30_ahub_txcif txcif, + struct tegra30_ahub_cif_conf *cif_conf); +extern int tegra30_ahub_setup_rx_fifo(enum tegra30_ahub_rxcif, + struct tegra30_ahub_cif_conf *cif_conf); + struct tegra30_ahub_soc_data { u32 mod_list_mask; void (*set_audio_cif)(struct regmap *regmap, diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index e99126600fc4..89ac0c5e1332 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -201,9 +201,11 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream,
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { cif_conf.direction = TEGRA30_AUDIOCIF_DIRECTION_RX; + tegra30_ahub_setup_tx_fifo(i2s->playback_fifo_cif, &cif_conf); reg = TEGRA30_I2S_CIF_RX_CTRL; } else { cif_conf.direction = TEGRA30_AUDIOCIF_DIRECTION_TX; + tegra30_ahub_setup_rx_fifo(i2s->capture_fifo_cif, &cif_conf); reg = TEGRA30_I2S_CIF_TX_CTRL; }
On 18/10/2019 16:48, Ben Dooks wrote:
If the hw_params uses a different bit or channel count, then we need to change both the I2S unit's CIF configuration as well as the APBIF one.
To allow changing the APBIF, add a call to reconfigure the RX or TX FIFO without changing the DMA or allocation, and get the I2S driver to call it once the hw params have been calculate.
Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk
sound/soc/tegra/tegra30_ahub.c | 115 ++++++++++++++++++--------------- sound/soc/tegra/tegra30_ahub.h | 5 ++ sound/soc/tegra/tegra30_i2s.c | 2 + 3 files changed, 69 insertions(+), 53 deletions(-)
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index 952381260dc3..24bc03428b45 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c @@ -84,12 +84,40 @@ static int tegra30_ahub_runtime_resume(struct device *dev) return 0; }
+int tegra30_ahub_setup_rx_fifo(enum tegra30_ahub_rxcif rxcif,
struct tegra30_ahub_cif_conf *cif_conf)
+{
- int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0;
- u32 reg, val;
- pm_runtime_get_sync(ahub->dev);
- reg = TEGRA30_AHUB_CHANNEL_CTRL +
(channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE);
- val = tegra30_apbif_read(reg);
- val &= ~(TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_MASK |
TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_MASK);
- val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_SHIFT) |
TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_EN |
TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_16;
- tegra30_apbif_write(reg, val);
- cif_conf->direction = TEGRA30_AUDIOCIF_DIRECTION_RX;
- reg = TEGRA30_AHUB_CIF_RX_CTRL +
(channel * TEGRA30_AHUB_CIF_RX_CTRL_STRIDE);
- ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, cif_conf);
- pm_runtime_put(ahub->dev);
- return 0;
+} +EXPORT_SYMBOL_GPL(tegra30_ahub_setup_rx_fifo);
int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif, char *dmachan, int dmachan_len, dma_addr_t *fiforeg) { int channel;
u32 reg, val; struct tegra30_ahub_cif_conf cif_conf;
channel = find_first_zero_bit(ahub->rx_usage,
@@ -104,37 +132,14 @@ int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif, *fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_RXFIFO + (channel * TEGRA30_AHUB_CHANNEL_RXFIFO_STRIDE);
- pm_runtime_get_sync(ahub->dev);
- memset(&cif_conf, 0, sizeof(cif_conf));
reg = TEGRA30_AHUB_CHANNEL_CTRL +
(channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE);
val = tegra30_apbif_read(reg);
val &= ~(TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_MASK |
TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_MASK);
val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_SHIFT) |
TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_EN |
TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_16;
tegra30_apbif_write(reg, val);
cif_conf.threshold = 0; cif_conf.audio_channels = 2; cif_conf.client_channels = 2; cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16; cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16;
cif_conf.expand = 0;
cif_conf.stereo_conv = 0;
cif_conf.replicate = 0;
cif_conf.direction = TEGRA30_AUDIOCIF_DIRECTION_RX;
cif_conf.truncate = 0;
cif_conf.mono_conv = 0;
reg = TEGRA30_AHUB_CIF_RX_CTRL +
(channel * TEGRA30_AHUB_CIF_RX_CTRL_STRIDE);
ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf);
pm_runtime_put(ahub->dev);
return 0;
- return tegra30_ahub_setup_rx_fifo(*rxcif, &cif_conf);
I am not sure why it is necessary to call this here now because this is called everytime you call hw_params() right? It seems redundant to me.
Cheers Jon
If the CIF is not configured as 16 or 8 bit, then the packing for 8/16 bits should not be enabled as the hardware only supports 8 or 16 bit packing.
Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk --- sound/soc/tegra/tegra30_ahub.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index 24bc03428b45..0768c6b6dc25 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c @@ -96,10 +96,17 @@ int tegra30_ahub_setup_rx_fifo(enum tegra30_ahub_rxcif rxcif, (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); val = tegra30_apbif_read(reg); val &= ~(TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_MASK | - TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_MASK); - val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_SHIFT) | - TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_EN | - TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_16; + TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_MASK | + TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_EN); + val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_SHIFT); + if (cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_16 || + cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_8) + val |= TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_EN; + if (cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_16) + val |= TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_16; + if (cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_8) + val |= TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_8_4; + tegra30_apbif_write(reg, val);
cif_conf->direction = TEGRA30_AUDIOCIF_DIRECTION_RX; @@ -203,10 +210,16 @@ int tegra30_ahub_setup_tx_fifo(enum tegra30_ahub_txcif txcif, (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); val = tegra30_apbif_read(reg); val &= ~(TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_MASK | - TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_MASK); - val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_SHIFT) | - TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_EN | - TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_16; + TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_MASK | + TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_EN); + val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_SHIFT); + if (cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_16 || + cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_8) + val |= TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_EN; + if (cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_16) + val |= TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_16; + if (cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_8) + val |= TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_8_4; tegra30_apbif_write(reg, val);
cif_conf->direction = TEGRA30_AUDIOCIF_DIRECTION_TX;
On 18/10/2019 16:48, Ben Dooks wrote:
If the CIF is not configured as 16 or 8 bit, then the packing for 8/16 bits should not be enabled as the hardware only supports 8 or 16 bit packing.
Signed-off-by: Ben Dooks ben.dooks@codethink.co.uk
sound/soc/tegra/tegra30_ahub.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index 24bc03428b45..0768c6b6dc25 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c @@ -96,10 +96,17 @@ int tegra30_ahub_setup_rx_fifo(enum tegra30_ahub_rxcif rxcif, (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); val = tegra30_apbif_read(reg); val &= ~(TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_MASK |
TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_MASK);
- val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_SHIFT) |
TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_EN |
TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_16;
TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_MASK |
TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_EN);
val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_SHIFT);
if (cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_16 ||
cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_8)
val |= TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_EN;
if (cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_16)
val |= TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_16;
if (cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_8)
val |= TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_8_4;
tegra30_apbif_write(reg, val);
cif_conf->direction = TEGRA30_AUDIOCIF_DIRECTION_RX;
@@ -203,10 +210,16 @@ int tegra30_ahub_setup_tx_fifo(enum tegra30_ahub_txcif txcif, (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE); val = tegra30_apbif_read(reg); val &= ~(TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_MASK |
TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_MASK);
- val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_SHIFT) |
TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_EN |
TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_16;
TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_MASK |
TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_EN);
val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_SHIFT);
if (cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_16 ||
cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_8)
val |= TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_EN;
if (cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_16)
val |= TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_16;
if (cif_conf->audio_bits == TEGRA30_AUDIOCIF_BITS_8)
val |= TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_8_4;
tegra30_apbif_write(reg, val);
cif_conf->direction = TEGRA30_AUDIOCIF_DIRECTION_TX;
Looks good to me.
Reviewed-by: Jon Hunter jonathanh@nvidia.com
Cheers Jon
participants (6)
-
Ben Dooks
-
Clemens Ladisch
-
Dmitry Osipenko
-
Jon Hunter
-
Mark Brown
-
Ricard Wanderlof