All of lore.kernel.org
 help / color / mirror / Atom feed
* tegra30 tdm audio support
@ 2019-10-18 15:48 ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] 182+ messages in thread

* [alsa-devel] tegra30 tdm audio support
@ 2019-10-18 15:48 ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel

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



_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* [PATCH v5 1/7] ASoC: tegra: add a TDM configuration callback
  2019-10-18 15:48 ` [alsa-devel] " Ben Dooks
@ 2019-10-18 15:48   ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, Ben Dooks, Edward Cragg

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 = {
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [alsa-devel] [PATCH v5 1/7] ASoC: tegra: add a TDM configuration callback
@ 2019-10-18 15:48   ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, Ben Dooks, Edward Cragg

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 = {
-- 
2.23.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-10-18 15:48 ` [alsa-devel] " Ben Dooks
@ 2019-10-18 15:48   ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, Ben Dooks, Edward Cragg

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,
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-10-18 15:48   ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, Ben Dooks, Edward Cragg

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,
-- 
2.23.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [PATCH v5 3/7] ASoC: tegra: i2s: Add support for more than 2 channels
  2019-10-18 15:48 ` [alsa-devel] " Ben Dooks
@ 2019-10-18 15:48   ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, Ben Dooks, Edward Cragg

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 |
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [alsa-devel] [PATCH v5 3/7] ASoC: tegra: i2s: Add support for more than 2 channels
@ 2019-10-18 15:48   ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, Ben Dooks, Edward Cragg

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 |
-- 
2.23.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [PATCH v5 4/7] ASoC: tegra: disable rx_fifo after disable stream
  2019-10-18 15:48 ` [alsa-devel] " Ben Dooks
@ 2019-10-18 15:48   ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, Ben Dooks

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,
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [alsa-devel] [PATCH v5 4/7] ASoC: tegra: disable rx_fifo after disable stream
@ 2019-10-18 15:48   ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, Ben Dooks

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,
-- 
2.23.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [PATCH v5 5/7] ASoC: tegra: set i2s_offset to 0 for tdm
  2019-10-18 15:48 ` [alsa-devel] " Ben Dooks
@ 2019-10-18 15:48   ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, Ben Dooks

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;
 }
 
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [alsa-devel] [PATCH v5 5/7] ASoC: tegra: set i2s_offset to 0 for tdm
@ 2019-10-18 15:48   ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, Ben Dooks

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;
 }
 
-- 
2.23.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [PATCH v5 6/7] ASoC: tegra: config fifos on hw_param changes
  2019-10-18 15:48 ` [alsa-devel] " Ben Dooks
@ 2019-10-18 15:48   ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, Ben Dooks

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;
 	}
 
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [alsa-devel] [PATCH v5 6/7] ASoC: tegra: config fifos on hw_param changes
@ 2019-10-18 15:48   ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, Ben Dooks

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;
 	}
 
-- 
2.23.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [PATCH v5 7/7] ASoC: tegra: take packing settings from the audio cif_config
  2019-10-18 15:48 ` [alsa-devel] " Ben Dooks
@ 2019-10-18 15:48   ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, Ben Dooks

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;
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [alsa-devel] [PATCH v5 7/7] ASoC: tegra: take packing settings from the audio cif_config
@ 2019-10-18 15:48   ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-10-18 15:48 UTC (permalink / raw)
  To: linux-tegra, alsa-devel, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
  Cc: linux-kernel, Ben Dooks

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;
-- 
2.23.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 1/7] ASoC: tegra: add a TDM configuration callback
  2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
@ 2019-10-24 15:50     ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-24 15:50 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg


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

-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 1/7] ASoC: tegra: add a TDM configuration callback
@ 2019-10-24 15:50     ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-24 15:50 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
@ 2019-10-24 15:54     ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-24 15:54 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg



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;
> +		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,

Thanks!

Reviewed-by: Jon Hunter <jonathanh@nvidia.com>

Cheers
Jon


-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-10-24 15:54     ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-24 15:54 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg



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;
> +		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,

Thanks!

Reviewed-by: Jon Hunter <jonathanh@nvidia.com>

Cheers
Jon


-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 3/7] ASoC: tegra: i2s: Add support for more than 2 channels
  2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
@ 2019-10-24 16:12     ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-24 16:12 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg


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/tegra-alt/tegra210_i2s_alt.c;h=24cf3b55326f687aded22b91182df41c5ae188ac;hb=703aa948d2c92b87fd84f367f43a07778ed098b5#l333

Cheers
Jon

-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 3/7] ASoC: tegra: i2s: Add support for more than 2 channels
@ 2019-10-24 16:12     ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-24 16:12 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg


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/tegra-alt/tegra210_i2s_alt.c;h=24cf3b55326f687aded22b91182df41c5ae188ac;hb=703aa948d2c92b87fd84f367f43a07778ed098b5#l333

Cheers
Jon

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 4/7] ASoC: tegra: disable rx_fifo after disable stream
  2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
@ 2019-10-24 16:12     ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-24 16:12 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel


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

-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 4/7] ASoC: tegra: disable rx_fifo after disable stream
@ 2019-10-24 16:12     ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-24 16:12 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 3/7] ASoC: tegra: i2s: Add support for more than 2 channels
  2019-10-24 16:12     ` [alsa-devel] " Jon Hunter
@ 2019-10-24 19:18       ` Mark Brown
  -1 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2019-10-24 19:18 UTC (permalink / raw)
  To: Jon Hunter
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Ben Dooks,
	Thierry Reding, Edward Cragg, linux-tegra


[-- Attachment #1.1: Type: text/plain, Size: 717 bytes --]

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.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 3/7] ASoC: tegra: i2s: Add support for more than 2 channels
@ 2019-10-24 19:18       ` Mark Brown
  0 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2019-10-24 19:18 UTC (permalink / raw)
  To: Jon Hunter
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Ben Dooks,
	Thierry Reding, Edward Cragg, linux-tegra


[-- Attachment #1.1: Type: text/plain, Size: 717 bytes --]

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.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 3/7] ASoC: tegra: i2s: Add support for more than 2 channels
  2019-10-24 19:18       ` [alsa-devel] " Mark Brown
@ 2019-10-25  7:48         ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-25  7:48 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Ben Dooks,
	Thierry Reding, Edward Cragg, linux-tegra


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

-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 3/7] ASoC: tegra: i2s: Add support for more than 2 channels
@ 2019-10-25  7:48         ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-25  7:48 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Ben Dooks,
	Thierry Reding, Edward Cragg, linux-tegra


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 5/7] ASoC: tegra: set i2s_offset to 0 for tdm
  2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
@ 2019-10-25  7:58     ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-25  7:58 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel


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

-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 5/7] ASoC: tegra: set i2s_offset to 0 for tdm
@ 2019-10-25  7:58     ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-25  7:58 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 6/7] ASoC: tegra: config fifos on hw_param changes
  2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
@ 2019-10-25  8:18     ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-25  8:18 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel


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

-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 6/7] ASoC: tegra: config fifos on hw_param changes
@ 2019-10-25  8:18     ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-25  8:18 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 7/7] ASoC: tegra: take packing settings from the audio cif_config
  2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
@ 2019-10-25  8:47     ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-25  8:47 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel


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

-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 7/7] ASoC: tegra: take packing settings from the audio cif_config
@ 2019-10-25  8:47     ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-10-25  8:47 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Applied "ASoC: tegra: add a TDM configuration callback" to the asoc tree
  2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
@ 2019-10-25 10:12     ` Mark Brown
  -1 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2019-10-25 10:12 UTC (permalink / raw)
  To: Edward Cragg
  Cc: linux-kernel, alsa-devel, Mark Brown, Takashi Iwai,
	Liam Girdwood, Jonathan Hunter, Ben Dooks, Thierry Reding,
	linux-tegra

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 = {
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* Applied "ASoC: tegra: disable rx_fifo after disable stream" to the asoc tree
  2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
@ 2019-10-25 10:12     ` Mark Brown
  -1 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2019-10-25 10:12 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood,
	Jon Hunter, Mark Brown, Thierry Reding, linux-tegra

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,
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [alsa-devel] Applied "ASoC: tegra: add a TDM configuration callback" to the asoc tree
@ 2019-10-25 10:12     ` Mark Brown
  0 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2019-10-25 10:12 UTC (permalink / raw)
  To: Edward Cragg
  Cc: linux-kernel, alsa-devel, Mark Brown, Takashi Iwai,
	Liam Girdwood, Jonathan Hunter, Ben Dooks, Thierry Reding,
	linux-tegra

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 = {
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [alsa-devel] Applied "ASoC: tegra: disable rx_fifo after disable stream" to the asoc tree
@ 2019-10-25 10:12     ` Mark Brown
  0 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2019-10-25 10:12 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood,
	Jon Hunter, Mark Brown, Thierry Reding, linux-tegra

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,
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* Applied "ASoC: tegra: Allow 24bit and 32bit samples" to the asoc tree
  2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
@ 2019-10-25 10:12     ` Mark Brown
  -1 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2019-10-25 10:12 UTC (permalink / raw)
  To: Edward Cragg
  Cc: linux-kernel, alsa-devel, Mark Brown, Takashi Iwai,
	Liam Girdwood, Jonathan Hunter, Ben Dooks, Thierry Reding,
	linux-tegra

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,
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* [alsa-devel] Applied "ASoC: tegra: Allow 24bit and 32bit samples" to the asoc tree
@ 2019-10-25 10:12     ` Mark Brown
  0 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2019-10-25 10:12 UTC (permalink / raw)
  To: Edward Cragg
  Cc: linux-kernel, alsa-devel, Mark Brown, Takashi Iwai,
	Liam Girdwood, Jonathan Hunter, Ben Dooks, Thierry Reding,
	linux-tegra

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,
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
@ 2019-11-23 21:09     ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-11-23 21:09 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding,
	Jonathan Hunter
  Cc: linux-kernel, Edward Cragg

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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-11-23 21:09     ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-11-23 21:09 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding,
	Jonathan Hunter
  Cc: linux-kernel, Edward Cragg

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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-11-23 21:09     ` [alsa-devel] " Dmitry Osipenko
@ 2019-11-25 10:37       ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-11-25 10:37 UTC (permalink / raw)
  To: Dmitry Osipenko, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding,
	Jonathan Hunter
  Cc: linux-kernel, Edward Cragg

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?

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-11-25 10:37       ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-11-25 10:37 UTC (permalink / raw)
  To: Dmitry Osipenko, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding,
	Jonathan Hunter
  Cc: linux-kernel, Edward Cragg

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?

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-11-25 10:37       ` [alsa-devel] " Ben Dooks
@ 2019-11-25 17:22         ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-11-25 17:22 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding,
	Jonathan Hunter
  Cc: linux-kernel, Edward Cragg

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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-11-25 17:22         ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-11-25 17:22 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding,
	Jonathan Hunter
  Cc: linux-kernel, Edward Cragg

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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-11-25 17:22         ` [alsa-devel] " Dmitry Osipenko
@ 2019-11-25 17:28           ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-11-25 17:28 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding,
	Jonathan Hunter
  Cc: linux-kernel, Edward Cragg

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_h264.mov
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-11-25 17:28           ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-11-25 17:28 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding,
	Jonathan Hunter
  Cc: linux-kernel, Edward Cragg

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_h264.mov
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-11-25 17:28           ` [alsa-devel] " Dmitry Osipenko
@ 2019-12-19 21:21             ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-12-19 21:21 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding,
	Jonathan Hunter
  Cc: linux-kernel, Edward Cragg

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_h264.mov
> 

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?
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-12-19 21:21             ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-12-19 21:21 UTC (permalink / raw)
  To: Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding,
	Jonathan Hunter
  Cc: linux-kernel, Edward Cragg

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_h264.mov
> 

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?
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-12-19 21:21             ` [alsa-devel] " Dmitry Osipenko
@ 2019-12-20 10:56               ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-12-20 10:56 UTC (permalink / raw)
  To: Dmitry Osipenko, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding,
	Jonathan Hunter
  Cc: linux-kernel, Edward Cragg

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_h264.mov
>>
> 
> 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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-12-20 10:56               ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-12-20 10:56 UTC (permalink / raw)
  To: Dmitry Osipenko, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding,
	Jonathan Hunter
  Cc: linux-kernel, Edward Cragg

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_h264.mov
>>
> 
> 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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-11-25 17:28           ` [alsa-devel] " Dmitry Osipenko
@ 2019-12-20 11:30             ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-12-20 11:30 UTC (permalink / raw)
  To: Dmitry Osipenko, Ben Dooks, linux-tegra, alsa-devel,
	Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Thierry Reding
  Cc: linux-kernel, Edward Cragg


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_h264.mov

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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-12-20 11:30             ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-12-20 11:30 UTC (permalink / raw)
  To: Dmitry Osipenko, Ben Dooks, linux-tegra, alsa-devel,
	Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Thierry Reding
  Cc: linux-kernel, Edward Cragg


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_h264.mov

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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-12-20 11:30             ` [alsa-devel] " Jon Hunter
@ 2019-12-20 11:38               ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-12-20 11:38 UTC (permalink / raw)
  To: Jon Hunter, Dmitry Osipenko, linux-tegra, alsa-devel,
	Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Thierry Reding
  Cc: linux-kernel, Edward Cragg

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_h264.mov
> 
> 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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-12-20 11:38               ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-12-20 11:38 UTC (permalink / raw)
  To: Jon Hunter, Dmitry Osipenko, linux-tegra, alsa-devel,
	Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Thierry Reding
  Cc: linux-kernel, Edward Cragg

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_h264.mov
> 
> 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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-12-20 11:38               ` [alsa-devel] " Ben Dooks
@ 2019-12-20 13:57                 ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-12-20 13:57 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko, linux-tegra, alsa-devel,
	Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Thierry Reding
  Cc: linux-kernel, Edward Cragg


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_h264.mov
>>>
>>
>> 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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-12-20 13:57                 ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2019-12-20 13:57 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko, linux-tegra, alsa-devel,
	Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Thierry Reding
  Cc: linux-kernel, Edward Cragg


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_h264.mov
>>>
>>
>> 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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-12-20 13:57                 ` [alsa-devel] " Jon Hunter
@ 2019-12-20 14:43                   ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-12-20 14:43 UTC (permalink / raw)
  To: Jon Hunter, Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg

[-- Attachment #1: Type: text/plain, Size: 6871 bytes --]

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_h264.mov
>>>>
>>>
>>> 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.

[-- Attachment #2: works.txt --]
[-- Type: text/plain, Size: 12117 bytes --]

Works
-----

# cat /sys/class/i2c-dev/i2c-2/name
7000d000.i2c

...
	i2c@7000d000 {
		clock-frequency = <100000>;
		status = "okay";

		rt5640: rt5640@1c {
			compatible = "realtek,rt5640";
			reg = <0x1c>;

			interrupt-parent = <&gpio>;
			interrupts = <TEGRA_GPIO(W, 3) IRQ_TYPE_EDGE_FALLING>;

			realtek,dmic1-data-pin = <1>;
			realtek,dmic2-data-pin = <0>;
			realtek,in1-differential;
		};
...

# cat /proc/asound/card0/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 1024
buffer_size: 8192

# trace-cmd record -e regmap:*
# trace-cmd report

CPU 0 is empty
CPU 1 is empty
cpus=4
             mpv-308   [002]   171.268104: regmap_cache_only:    70080000.ahub flag=0
             mpv-308   [002]   171.268116: regmap_cache_only:    70080000.ahub flag=0
             mpv-308   [002]   171.268131: regmap_cache_only:    70080400.i2s flag=0
             mpv-308   [002]   171.272549: regmap_reg_read_cache: 2-001c reg=64 val=0
             mpv-308   [002]   171.272556: regmap_reg_read_cache: 2-001c reg=80 val=0
             mpv-308   [002]   171.272564: regmap_reg_read_cache: 2-001c reg=70 val=8000
             mpv-308   [002]   171.272567: regmap_reg_read_cache: 2-001c reg=70 val=8000
             mpv-308   [002]   171.272569: regmap_reg_read_cache: 2-001c reg=73 val=1114
             mpv-308   [002]   171.272572: regmap_reg_write:     2-001c reg=73 val=114
             mpv-308   [002]   171.272581: regmap_hw_write_start: 2-001c reg=73 count=1
             mpv-308   [002]   171.273332: regmap_hw_write_done: 2-001c reg=73 count=1
             mpv-308   [002]   171.273379: regmap_reg_read_cache: 70080400.i2s reg=0 val=400
             mpv-308   [002]   171.273382: regmap_reg_write:     70080400.i2s reg=0 val=403
             mpv-308   [002]   171.273395: regmap_reg_write:     70080400.i2s reg=4 val=1f
             mpv-308   [002]   171.273398: regmap_reg_write:     70080400.i2s reg=14 val=1013304
             mpv-308   [002]   171.273401: regmap_reg_write:     70080400.i2s reg=8 val=10001
    kworker/u8:2-145   [003]   171.273992: regmap_reg_read_cache: 2-001c reg=63 val=0
    kworker/u8:2-145   [003]   171.273999: regmap_reg_write:     2-001c reg=63 val=a810
    kworker/u8:2-145   [003]   171.274006: regmap_hw_write_start: 2-001c reg=63 count=1
    kworker/u8:2-145   [003]   171.274478: regmap_hw_write_done: 2-001c reg=63 count=1
    kworker/u8:2-145   [003]   171.286067: regmap_reg_read_cache: 2-001c reg=63 val=a810
    kworker/u8:2-145   [003]   171.286076: regmap_reg_write:     2-001c reg=63 val=e818
    kworker/u8:2-145   [003]   171.286083: regmap_hw_write_start: 2-001c reg=63 count=1
    kworker/u8:2-145   [003]   171.286568: regmap_hw_write_done: 2-001c reg=63 count=1
    kworker/u8:2-145   [003]   171.286575: regmap_reg_read_cache: 2-001c reg=fa val=3f01
    kworker/u8:2-145   [003]   171.286577: regmap_reg_read_cache: 2-001c reg=93 val=3030
             mpv-308   [002]   171.286643: regmap_reg_read_cache: 2-001c reg=61 val=0
             mpv-308   [002]   171.286647: regmap_reg_write:     2-001c reg=61 val=9800
             mpv-308   [002]   171.286650: regmap_hw_write_start: 2-001c reg=61 count=1
             mpv-308   [002]   171.287345: regmap_hw_write_done: 2-001c reg=61 count=1
             mpv-308   [002]   171.287379: regmap_reg_read_cache: 2-001c reg=63 val=e818
             mpv-308   [002]   171.287381: regmap_reg_write:     2-001c reg=63 val=e8d8
             mpv-308   [002]   171.287384: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-308   [002]   171.287845: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-308   [002]   171.287875: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.289021: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-308   [002]   171.289025: regmap_reg_read:      2-001c reg=6a val=23
             mpv-308   [002]   171.289027: regmap_reg_write:     2-001c reg=6a val=24
             mpv-308   [002]   171.289029: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.289561: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-308   [002]   171.289565: regmap_hw_read_start: 2-001c reg=6c count=1
             mpv-308   [002]   171.290174: regmap_hw_read_done:  2-001c reg=6c count=1
             mpv-308   [002]   171.290177: regmap_reg_read:      2-001c reg=124 val=420
             mpv-308   [002]   171.290180: regmap_reg_write:     2-001c reg=124 val=220
             mpv-308   [002]   171.290185: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.290800: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-308   [002]   171.290804: regmap_reg_read:      2-001c reg=6a val=24
             mpv-308   [002]   171.290807: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-308   [002]   171.291300: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-308   [002]   171.291333: regmap_reg_read_cache: 2-001c reg=8f val=1100
             mpv-308   [002]   171.291335: regmap_reg_write:     2-001c reg=8f val=3100
             mpv-308   [002]   171.291339: regmap_hw_write_start: 2-001c reg=8f count=1
             mpv-308   [002]   171.291802: regmap_hw_write_done: 2-001c reg=8f count=1
             mpv-308   [002]   171.291830: regmap_reg_read_cache: 2-001c reg=8e val=4
             mpv-308   [002]   171.291833: regmap_reg_write:     2-001c reg=8e val=9
             mpv-308   [002]   171.291838: regmap_hw_write_start: 2-001c reg=8e count=1
             mpv-308   [002]   171.292433: regmap_hw_write_done: 2-001c reg=8e count=1
             mpv-308   [002]   171.292461: regmap_reg_write:     2-001c reg=177 val=9f00
             mpv-308   [002]   171.292466: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.293274: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-308   [002]   171.293278: regmap_reg_read:      2-001c reg=6a val=24
             mpv-308   [002]   171.293281: regmap_reg_write:     2-001c reg=6a val=77
             mpv-308   [002]   171.293284: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.293894: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-308   [002]   171.293897: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-308   [002]   171.294484: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-308   [002]   171.294510: regmap_reg_read_cache: 2-001c reg=63 val=e8d8
             mpv-308   [002]   171.294513: regmap_reg_write:     2-001c reg=63 val=a8d0
             mpv-308   [002]   171.294516: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-308   [002]   171.294976: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-308   [002]   171.295001: regmap_reg_read_cache: 2-001c reg=63 val=a8d0
             mpv-308   [002]   171.295004: regmap_reg_write:     2-001c reg=63 val=a8f0
             mpv-308   [002]   171.295006: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-308   [002]   171.295680: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-308   [002]   171.306100: regmap_reg_read_cache: 2-001c reg=63 val=a8f0
             mpv-308   [002]   171.306108: regmap_reg_write:     2-001c reg=63 val=e8f8
             mpv-308   [002]   171.306114: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-308   [002]   171.306885: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-308   [002]   171.306954: regmap_reg_read_cache: 2-001c reg=8f val=3100
             mpv-308   [002]   171.306957: regmap_reg_write:     2-001c reg=8f val=1140
             mpv-308   [002]   171.306961: regmap_hw_write_start: 2-001c reg=8f count=1
             mpv-308   [002]   171.307532: regmap_hw_write_done: 2-001c reg=8f count=1
             mpv-308   [002]   171.307559: regmap_reg_read_cache: 2-001c reg=91 val=c00
             mpv-308   [002]   171.307561: regmap_reg_write:     2-001c reg=91 val=e00
             mpv-308   [002]   171.307564: regmap_hw_write_start: 2-001c reg=91 count=1
             mpv-308   [002]   171.308068: regmap_hw_write_done: 2-001c reg=91 count=1
             mpv-308   [002]   171.308093: regmap_reg_read_cache: 2-001c reg=90 val=646
             mpv-308   [002]   171.308096: regmap_reg_write:     2-001c reg=90 val=737
             mpv-308   [002]   171.308099: regmap_hw_write_start: 2-001c reg=90 count=1
             mpv-308   [002]   171.308573: regmap_hw_write_done: 2-001c reg=90 count=1
             mpv-308   [002]   171.308600: regmap_reg_write:     2-001c reg=137 val=1c00
             mpv-308   [002]   171.308607: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.309204: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-308   [002]   171.309212: regmap_reg_read:      2-001c reg=6a val=77
             mpv-308   [002]   171.309215: regmap_reg_write:     2-001c reg=6a val=37
             mpv-308   [002]   171.309217: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.309994: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-308   [002]   171.309999: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-308   [002]   171.310714: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-308   [002]   171.310747: regmap_reg_read_cache: 2-001c reg=8e val=9
             mpv-308   [002]   171.310750: regmap_reg_write:     2-001c reg=8e val=5
             mpv-308   [002]   171.310755: regmap_hw_write_start: 2-001c reg=8e count=1
             mpv-308   [002]   171.311331: regmap_hw_write_done: 2-001c reg=8e count=1
             mpv-308   [002]   171.311361: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.312384: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-308   [002]   171.312388: regmap_reg_read:      2-001c reg=6a val=37
             mpv-308   [002]   171.312391: regmap_reg_write:     2-001c reg=6a val=24
             mpv-308   [002]   171.312394: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.312891: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-308   [002]   171.312897: regmap_hw_read_start: 2-001c reg=6c count=1
             mpv-308   [002]   171.313657: regmap_hw_read_done:  2-001c reg=6c count=1
             mpv-308   [002]   171.313661: regmap_reg_read:      2-001c reg=124 val=220
             mpv-308   [002]   171.313664: regmap_reg_write:     2-001c reg=124 val=420
             mpv-308   [002]   171.313667: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.314977: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-308   [002]   171.314984: regmap_reg_read:      2-001c reg=6a val=24
             mpv-308   [002]   171.314990: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-308   [002]   171.315479: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-308   [002]   171.315519: regmap_reg_read_cache: 2-001c reg=2 val=cbcb
             mpv-308   [002]   171.315522: regmap_reg_write:     2-001c reg=2 val=4b4b
             mpv-308   [002]   171.315525: regmap_hw_write_start: 2-001c reg=2 count=1
             mpv-308   [002]   171.316002: regmap_hw_write_done: 2-001c reg=2 count=1
          mpv/ao-318   [003]   171.744407: regmap_reg_read_cache: 70080000.ahub reg=0 val=70777
          mpv/ao-318   [003]   171.744424: regmap_reg_write:     70080000.ahub reg=0 val=80070777
          mpv/ao-318   [003]   171.744433: regmap_reg_read_cache: 70080400.i2s reg=0 val=403
          mpv/ao-318   [003]   171.744435: regmap_reg_write:     70080400.i2s reg=0 val=80000403
             mpv-308   [002]   173.755178: regmap_reg_read_cache: 70080000.ahub reg=0 val=80070777
             mpv-308   [002]   173.755188: regmap_reg_write:     70080000.ahub reg=0 val=70777
             mpv-308   [002]   173.755196: regmap_reg_read_cache: 70080400.i2s reg=0 val=80000403
             mpv-308   [002]   173.755198: regmap_reg_write:     70080400.i2s reg=0 val=403

[-- Attachment #3: broken.txt --]
[-- Type: text/plain, Size: 12382 bytes --]

Broken
------

# cat /sys/class/i2c-dev/i2c-2/name
7000d000.i2c

...
	i2c@7000d000 {
		clock-frequency = <100000>;
		status = "okay";

		rt5640: rt5640@1c {
			compatible = "realtek,rt5640";
			reg = <0x1c>;

			interrupt-parent = <&gpio>;
			interrupts = <TEGRA_GPIO(W, 3) IRQ_TYPE_EDGE_FALLING>;

			realtek,dmic1-data-pin = <1>;
			realtek,dmic2-data-pin = <0>;
			realtek,in1-differential;
		};
...

# 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

# trace-cmd record -e regmap:*
# trace-cmd report

CPU 0 is empty
CPU 1 is empty
cpus=4
             mpv-281   [002]    40.227541: regmap_cache_only:    70080000.ahub flag=0
             mpv-281   [002]    40.227554: regmap_cache_only:    70080000.ahub flag=0
             mpv-281   [002]    40.227572: regmap_cache_only:    70080400.i2s flag=0
             mpv-281   [002]    40.236905: regmap_reg_read_cache: 2-001c reg=64 val=0
             mpv-281   [002]    40.236921: regmap_reg_read_cache: 2-001c reg=80 val=0
             mpv-281   [002]    40.236931: regmap_reg_read_cache: 2-001c reg=70 val=8000
             mpv-281   [002]    40.236935: regmap_reg_read_cache: 2-001c reg=70 val=8000
             mpv-281   [002]    40.236939: regmap_reg_write:     2-001c reg=70 val=8008
             mpv-281   [002]    40.236950: regmap_hw_write_start: 2-001c reg=70 count=1
             mpv-281   [002]    40.237776: regmap_hw_write_done: 2-001c reg=70 count=1
             mpv-281   [002]    40.237828: regmap_reg_read_cache: 2-001c reg=73 val=1114
             mpv-281   [002]    40.237831: regmap_reg_write:     2-001c reg=73 val=8114
             mpv-281   [002]    40.237836: regmap_hw_write_start: 2-001c reg=73 count=1
             mpv-281   [002]    40.241723: regmap_hw_write_done: 2-001c reg=73 count=1
             mpv-281   [002]    40.241794: regmap_reg_read_cache: 70080400.i2s reg=0 val=400
             mpv-281   [002]    40.241798: regmap_reg_write:     70080400.i2s reg=0 val=405
             mpv-281   [002]    40.241817: regmap_reg_write:     70080400.i2s reg=4 val=2f
             mpv-281   [002]    40.241820: regmap_reg_write:     70080400.i2s reg=14 val=1015504
             mpv-281   [002]    40.241823: regmap_reg_write:     70080400.i2s reg=8 val=10001
    kworker/u8:1-36    [003]    40.242987: regmap_reg_read_cache: 2-001c reg=63 val=0
    kworker/u8:1-36    [003]    40.242992: regmap_reg_write:     2-001c reg=63 val=a810
    kworker/u8:1-36    [003]    40.243002: regmap_hw_write_start: 2-001c reg=63 count=1
    kworker/u8:1-36    [003]    40.243519: regmap_hw_write_done: 2-001c reg=63 count=1
    kworker/u8:1-36    [003]    40.256915: regmap_reg_read_cache: 2-001c reg=63 val=a810
    kworker/u8:1-36    [003]    40.256924: regmap_reg_write:     2-001c reg=63 val=e818
    kworker/u8:1-36    [003]    40.256933: regmap_hw_write_start: 2-001c reg=63 count=1
    kworker/u8:1-36    [003]    40.257590: regmap_hw_write_done: 2-001c reg=63 count=1
    kworker/u8:1-36    [003]    40.257597: regmap_reg_read_cache: 2-001c reg=fa val=3f01
    kworker/u8:1-36    [003]    40.257600: regmap_reg_read_cache: 2-001c reg=93 val=3030
             mpv-281   [002]    40.257670: regmap_reg_read_cache: 2-001c reg=61 val=0
             mpv-281   [002]    40.257674: regmap_reg_write:     2-001c reg=61 val=9800
             mpv-281   [002]    40.257678: regmap_hw_write_start: 2-001c reg=61 count=1
             mpv-281   [002]    40.258409: regmap_hw_write_done: 2-001c reg=61 count=1
             mpv-281   [002]    40.258448: regmap_reg_read_cache: 2-001c reg=63 val=e818
             mpv-281   [002]    40.258451: regmap_reg_write:     2-001c reg=63 val=e8d8
             mpv-281   [002]    40.258454: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-281   [002]    40.259701: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-281   [002]    40.259751: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.260357: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-281   [002]    40.260361: regmap_reg_read:      2-001c reg=6a val=23
             mpv-281   [002]    40.260365: regmap_reg_write:     2-001c reg=6a val=24
             mpv-281   [002]    40.260367: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.260881: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-281   [002]    40.260885: regmap_hw_read_start: 2-001c reg=6c count=1
             mpv-281   [002]    40.263245: regmap_hw_read_done:  2-001c reg=6c count=1
             mpv-281   [002]    40.263251: regmap_reg_read:      2-001c reg=124 val=420
             mpv-281   [002]    40.263255: regmap_reg_write:     2-001c reg=124 val=220
             mpv-281   [002]    40.263260: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.264325: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-281   [002]    40.264330: regmap_reg_read:      2-001c reg=6a val=24
             mpv-281   [002]    40.264334: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-281   [002]    40.264827: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-281   [002]    40.264859: regmap_reg_read_cache: 2-001c reg=8f val=1100
             mpv-281   [002]    40.264867: regmap_reg_write:     2-001c reg=8f val=3100
             mpv-281   [002]    40.264871: regmap_hw_write_start: 2-001c reg=8f count=1
             mpv-281   [002]    40.265939: regmap_hw_write_done: 2-001c reg=8f count=1
             mpv-281   [002]    40.265976: regmap_reg_read_cache: 2-001c reg=8e val=4
             mpv-281   [002]    40.265981: regmap_reg_write:     2-001c reg=8e val=9
             mpv-281   [002]    40.265986: regmap_hw_write_start: 2-001c reg=8e count=1
             mpv-281   [002]    40.267142: regmap_hw_write_done: 2-001c reg=8e count=1
             mpv-281   [002]    40.267172: regmap_reg_write:     2-001c reg=177 val=9f00
             mpv-281   [002]    40.267182: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.267842: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-281   [002]    40.267845: regmap_reg_read:      2-001c reg=6a val=24
             mpv-281   [002]    40.267848: regmap_reg_write:     2-001c reg=6a val=77
             mpv-281   [002]    40.267851: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.268937: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-281   [002]    40.268943: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-281   [002]    40.269454: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-281   [002]    40.269484: regmap_reg_read_cache: 2-001c reg=63 val=e8d8
             mpv-281   [002]    40.269487: regmap_reg_write:     2-001c reg=63 val=a8d0
             mpv-281   [002]    40.269490: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-281   [002]    40.270012: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-281   [002]    40.271740: regmap_reg_read_cache: 2-001c reg=63 val=a8d0
             mpv-281   [002]    40.271748: regmap_reg_write:     2-001c reg=63 val=a8f0
             mpv-281   [002]    40.271753: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-281   [002]    40.272240: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-281   [002]    40.286888: regmap_reg_read_cache: 2-001c reg=63 val=a8f0
             mpv-281   [002]    40.286901: regmap_reg_write:     2-001c reg=63 val=e8f8
             mpv-281   [002]    40.286917: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-281   [002]    40.287748: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-281   [002]    40.287841: regmap_reg_read_cache: 2-001c reg=8f val=3100
             mpv-281   [002]    40.287844: regmap_reg_write:     2-001c reg=8f val=1140
             mpv-281   [002]    40.287847: regmap_hw_write_start: 2-001c reg=8f count=1
             mpv-281   [002]    40.288310: regmap_hw_write_done: 2-001c reg=8f count=1
             mpv-281   [002]    40.288339: regmap_reg_read_cache: 2-001c reg=91 val=c00
             mpv-281   [002]    40.288341: regmap_reg_write:     2-001c reg=91 val=e00
             mpv-281   [002]    40.288344: regmap_hw_write_start: 2-001c reg=91 count=1
             mpv-281   [002]    40.288808: regmap_hw_write_done: 2-001c reg=91 count=1
             mpv-281   [002]    40.288838: regmap_reg_read_cache: 2-001c reg=90 val=646
             mpv-281   [002]    40.288840: regmap_reg_write:     2-001c reg=90 val=737
             mpv-281   [002]    40.288844: regmap_hw_write_start: 2-001c reg=90 count=1
             mpv-281   [002]    40.289792: regmap_hw_write_done: 2-001c reg=90 count=1
             mpv-281   [002]    40.289828: regmap_reg_write:     2-001c reg=137 val=1c00
             mpv-281   [002]    40.289837: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.291772: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-281   [002]    40.291782: regmap_reg_read:      2-001c reg=6a val=77
             mpv-281   [002]    40.291788: regmap_reg_write:     2-001c reg=6a val=37
             mpv-281   [002]    40.291792: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.292320: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-281   [002]    40.292324: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-281   [002]    40.293579: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-281   [002]    40.293616: regmap_reg_read_cache: 2-001c reg=8e val=9
             mpv-281   [002]    40.293618: regmap_reg_write:     2-001c reg=8e val=5
             mpv-281   [002]    40.293623: regmap_hw_write_start: 2-001c reg=8e count=1
             mpv-281   [002]    40.294179: regmap_hw_write_done: 2-001c reg=8e count=1
             mpv-281   [002]    40.294211: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.295183: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-281   [002]    40.295187: regmap_reg_read:      2-001c reg=6a val=37
             mpv-281   [002]    40.295194: regmap_reg_write:     2-001c reg=6a val=24
             mpv-281   [002]    40.295196: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.296301: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-281   [002]    40.296308: regmap_hw_read_start: 2-001c reg=6c count=1
             mpv-281   [002]    40.298769: regmap_hw_read_done:  2-001c reg=6c count=1
             mpv-281   [002]    40.298777: regmap_reg_read:      2-001c reg=124 val=220
             mpv-281   [002]    40.298784: regmap_reg_write:     2-001c reg=124 val=420
             mpv-281   [002]    40.298790: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.299542: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-281   [002]    40.299549: regmap_reg_read:      2-001c reg=6a val=24
             mpv-281   [002]    40.299555: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-281   [002]    40.300054: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-281   [002]    40.300107: regmap_reg_read_cache: 2-001c reg=2 val=cbcb
             mpv-281   [002]    40.300110: regmap_reg_write:     2-001c reg=2 val=4b4b
             mpv-281   [002]    40.300115: regmap_hw_write_start: 2-001c reg=2 count=1
             mpv-281   [002]    40.300756: regmap_hw_write_done: 2-001c reg=2 count=1
          mpv/ao-290   [003]    40.721759: regmap_reg_read_cache: 70080000.ahub reg=0 val=70777
          mpv/ao-290   [003]    40.721776: regmap_reg_write:     70080000.ahub reg=0 val=80070777
          mpv/ao-290   [003]    40.721787: regmap_reg_read_cache: 70080400.i2s reg=0 val=405
          mpv/ao-290   [003]    40.721789: regmap_reg_write:     70080400.i2s reg=0 val=80000405
             mpv-281   [002]    41.693159: regmap_reg_read_cache: 70080000.ahub reg=0 val=80070777
             mpv-281   [002]    41.693185: regmap_reg_write:     70080000.ahub reg=0 val=70777
             mpv-281   [002]    41.693200: regmap_reg_read_cache: 70080400.i2s reg=0 val=80000405
             mpv-281   [002]    41.693203: regmap_reg_write:     70080400.i2s reg=0 val=405

[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-12-20 14:43                   ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-12-20 14:43 UTC (permalink / raw)
  To: Jon Hunter, Ben Dooks, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg

[-- Attachment #1: Type: text/plain, Size: 6871 bytes --]

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_h264.mov
>>>>
>>>
>>> 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.

[-- Attachment #2: works.txt --]
[-- Type: text/plain, Size: 12117 bytes --]

Works
-----

# cat /sys/class/i2c-dev/i2c-2/name
7000d000.i2c

...
	i2c@7000d000 {
		clock-frequency = <100000>;
		status = "okay";

		rt5640: rt5640@1c {
			compatible = "realtek,rt5640";
			reg = <0x1c>;

			interrupt-parent = <&gpio>;
			interrupts = <TEGRA_GPIO(W, 3) IRQ_TYPE_EDGE_FALLING>;

			realtek,dmic1-data-pin = <1>;
			realtek,dmic2-data-pin = <0>;
			realtek,in1-differential;
		};
...

# cat /proc/asound/card0/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 1024
buffer_size: 8192

# trace-cmd record -e regmap:*
# trace-cmd report

CPU 0 is empty
CPU 1 is empty
cpus=4
             mpv-308   [002]   171.268104: regmap_cache_only:    70080000.ahub flag=0
             mpv-308   [002]   171.268116: regmap_cache_only:    70080000.ahub flag=0
             mpv-308   [002]   171.268131: regmap_cache_only:    70080400.i2s flag=0
             mpv-308   [002]   171.272549: regmap_reg_read_cache: 2-001c reg=64 val=0
             mpv-308   [002]   171.272556: regmap_reg_read_cache: 2-001c reg=80 val=0
             mpv-308   [002]   171.272564: regmap_reg_read_cache: 2-001c reg=70 val=8000
             mpv-308   [002]   171.272567: regmap_reg_read_cache: 2-001c reg=70 val=8000
             mpv-308   [002]   171.272569: regmap_reg_read_cache: 2-001c reg=73 val=1114
             mpv-308   [002]   171.272572: regmap_reg_write:     2-001c reg=73 val=114
             mpv-308   [002]   171.272581: regmap_hw_write_start: 2-001c reg=73 count=1
             mpv-308   [002]   171.273332: regmap_hw_write_done: 2-001c reg=73 count=1
             mpv-308   [002]   171.273379: regmap_reg_read_cache: 70080400.i2s reg=0 val=400
             mpv-308   [002]   171.273382: regmap_reg_write:     70080400.i2s reg=0 val=403
             mpv-308   [002]   171.273395: regmap_reg_write:     70080400.i2s reg=4 val=1f
             mpv-308   [002]   171.273398: regmap_reg_write:     70080400.i2s reg=14 val=1013304
             mpv-308   [002]   171.273401: regmap_reg_write:     70080400.i2s reg=8 val=10001
    kworker/u8:2-145   [003]   171.273992: regmap_reg_read_cache: 2-001c reg=63 val=0
    kworker/u8:2-145   [003]   171.273999: regmap_reg_write:     2-001c reg=63 val=a810
    kworker/u8:2-145   [003]   171.274006: regmap_hw_write_start: 2-001c reg=63 count=1
    kworker/u8:2-145   [003]   171.274478: regmap_hw_write_done: 2-001c reg=63 count=1
    kworker/u8:2-145   [003]   171.286067: regmap_reg_read_cache: 2-001c reg=63 val=a810
    kworker/u8:2-145   [003]   171.286076: regmap_reg_write:     2-001c reg=63 val=e818
    kworker/u8:2-145   [003]   171.286083: regmap_hw_write_start: 2-001c reg=63 count=1
    kworker/u8:2-145   [003]   171.286568: regmap_hw_write_done: 2-001c reg=63 count=1
    kworker/u8:2-145   [003]   171.286575: regmap_reg_read_cache: 2-001c reg=fa val=3f01
    kworker/u8:2-145   [003]   171.286577: regmap_reg_read_cache: 2-001c reg=93 val=3030
             mpv-308   [002]   171.286643: regmap_reg_read_cache: 2-001c reg=61 val=0
             mpv-308   [002]   171.286647: regmap_reg_write:     2-001c reg=61 val=9800
             mpv-308   [002]   171.286650: regmap_hw_write_start: 2-001c reg=61 count=1
             mpv-308   [002]   171.287345: regmap_hw_write_done: 2-001c reg=61 count=1
             mpv-308   [002]   171.287379: regmap_reg_read_cache: 2-001c reg=63 val=e818
             mpv-308   [002]   171.287381: regmap_reg_write:     2-001c reg=63 val=e8d8
             mpv-308   [002]   171.287384: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-308   [002]   171.287845: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-308   [002]   171.287875: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.289021: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-308   [002]   171.289025: regmap_reg_read:      2-001c reg=6a val=23
             mpv-308   [002]   171.289027: regmap_reg_write:     2-001c reg=6a val=24
             mpv-308   [002]   171.289029: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.289561: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-308   [002]   171.289565: regmap_hw_read_start: 2-001c reg=6c count=1
             mpv-308   [002]   171.290174: regmap_hw_read_done:  2-001c reg=6c count=1
             mpv-308   [002]   171.290177: regmap_reg_read:      2-001c reg=124 val=420
             mpv-308   [002]   171.290180: regmap_reg_write:     2-001c reg=124 val=220
             mpv-308   [002]   171.290185: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.290800: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-308   [002]   171.290804: regmap_reg_read:      2-001c reg=6a val=24
             mpv-308   [002]   171.290807: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-308   [002]   171.291300: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-308   [002]   171.291333: regmap_reg_read_cache: 2-001c reg=8f val=1100
             mpv-308   [002]   171.291335: regmap_reg_write:     2-001c reg=8f val=3100
             mpv-308   [002]   171.291339: regmap_hw_write_start: 2-001c reg=8f count=1
             mpv-308   [002]   171.291802: regmap_hw_write_done: 2-001c reg=8f count=1
             mpv-308   [002]   171.291830: regmap_reg_read_cache: 2-001c reg=8e val=4
             mpv-308   [002]   171.291833: regmap_reg_write:     2-001c reg=8e val=9
             mpv-308   [002]   171.291838: regmap_hw_write_start: 2-001c reg=8e count=1
             mpv-308   [002]   171.292433: regmap_hw_write_done: 2-001c reg=8e count=1
             mpv-308   [002]   171.292461: regmap_reg_write:     2-001c reg=177 val=9f00
             mpv-308   [002]   171.292466: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.293274: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-308   [002]   171.293278: regmap_reg_read:      2-001c reg=6a val=24
             mpv-308   [002]   171.293281: regmap_reg_write:     2-001c reg=6a val=77
             mpv-308   [002]   171.293284: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.293894: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-308   [002]   171.293897: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-308   [002]   171.294484: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-308   [002]   171.294510: regmap_reg_read_cache: 2-001c reg=63 val=e8d8
             mpv-308   [002]   171.294513: regmap_reg_write:     2-001c reg=63 val=a8d0
             mpv-308   [002]   171.294516: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-308   [002]   171.294976: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-308   [002]   171.295001: regmap_reg_read_cache: 2-001c reg=63 val=a8d0
             mpv-308   [002]   171.295004: regmap_reg_write:     2-001c reg=63 val=a8f0
             mpv-308   [002]   171.295006: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-308   [002]   171.295680: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-308   [002]   171.306100: regmap_reg_read_cache: 2-001c reg=63 val=a8f0
             mpv-308   [002]   171.306108: regmap_reg_write:     2-001c reg=63 val=e8f8
             mpv-308   [002]   171.306114: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-308   [002]   171.306885: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-308   [002]   171.306954: regmap_reg_read_cache: 2-001c reg=8f val=3100
             mpv-308   [002]   171.306957: regmap_reg_write:     2-001c reg=8f val=1140
             mpv-308   [002]   171.306961: regmap_hw_write_start: 2-001c reg=8f count=1
             mpv-308   [002]   171.307532: regmap_hw_write_done: 2-001c reg=8f count=1
             mpv-308   [002]   171.307559: regmap_reg_read_cache: 2-001c reg=91 val=c00
             mpv-308   [002]   171.307561: regmap_reg_write:     2-001c reg=91 val=e00
             mpv-308   [002]   171.307564: regmap_hw_write_start: 2-001c reg=91 count=1
             mpv-308   [002]   171.308068: regmap_hw_write_done: 2-001c reg=91 count=1
             mpv-308   [002]   171.308093: regmap_reg_read_cache: 2-001c reg=90 val=646
             mpv-308   [002]   171.308096: regmap_reg_write:     2-001c reg=90 val=737
             mpv-308   [002]   171.308099: regmap_hw_write_start: 2-001c reg=90 count=1
             mpv-308   [002]   171.308573: regmap_hw_write_done: 2-001c reg=90 count=1
             mpv-308   [002]   171.308600: regmap_reg_write:     2-001c reg=137 val=1c00
             mpv-308   [002]   171.308607: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.309204: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-308   [002]   171.309212: regmap_reg_read:      2-001c reg=6a val=77
             mpv-308   [002]   171.309215: regmap_reg_write:     2-001c reg=6a val=37
             mpv-308   [002]   171.309217: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.309994: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-308   [002]   171.309999: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-308   [002]   171.310714: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-308   [002]   171.310747: regmap_reg_read_cache: 2-001c reg=8e val=9
             mpv-308   [002]   171.310750: regmap_reg_write:     2-001c reg=8e val=5
             mpv-308   [002]   171.310755: regmap_hw_write_start: 2-001c reg=8e count=1
             mpv-308   [002]   171.311331: regmap_hw_write_done: 2-001c reg=8e count=1
             mpv-308   [002]   171.311361: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.312384: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-308   [002]   171.312388: regmap_reg_read:      2-001c reg=6a val=37
             mpv-308   [002]   171.312391: regmap_reg_write:     2-001c reg=6a val=24
             mpv-308   [002]   171.312394: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.312891: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-308   [002]   171.312897: regmap_hw_read_start: 2-001c reg=6c count=1
             mpv-308   [002]   171.313657: regmap_hw_read_done:  2-001c reg=6c count=1
             mpv-308   [002]   171.313661: regmap_reg_read:      2-001c reg=124 val=220
             mpv-308   [002]   171.313664: regmap_reg_write:     2-001c reg=124 val=420
             mpv-308   [002]   171.313667: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-308   [002]   171.314977: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-308   [002]   171.314984: regmap_reg_read:      2-001c reg=6a val=24
             mpv-308   [002]   171.314990: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-308   [002]   171.315479: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-308   [002]   171.315519: regmap_reg_read_cache: 2-001c reg=2 val=cbcb
             mpv-308   [002]   171.315522: regmap_reg_write:     2-001c reg=2 val=4b4b
             mpv-308   [002]   171.315525: regmap_hw_write_start: 2-001c reg=2 count=1
             mpv-308   [002]   171.316002: regmap_hw_write_done: 2-001c reg=2 count=1
          mpv/ao-318   [003]   171.744407: regmap_reg_read_cache: 70080000.ahub reg=0 val=70777
          mpv/ao-318   [003]   171.744424: regmap_reg_write:     70080000.ahub reg=0 val=80070777
          mpv/ao-318   [003]   171.744433: regmap_reg_read_cache: 70080400.i2s reg=0 val=403
          mpv/ao-318   [003]   171.744435: regmap_reg_write:     70080400.i2s reg=0 val=80000403
             mpv-308   [002]   173.755178: regmap_reg_read_cache: 70080000.ahub reg=0 val=80070777
             mpv-308   [002]   173.755188: regmap_reg_write:     70080000.ahub reg=0 val=70777
             mpv-308   [002]   173.755196: regmap_reg_read_cache: 70080400.i2s reg=0 val=80000403
             mpv-308   [002]   173.755198: regmap_reg_write:     70080400.i2s reg=0 val=403

[-- Attachment #3: broken.txt --]
[-- Type: text/plain, Size: 12382 bytes --]

Broken
------

# cat /sys/class/i2c-dev/i2c-2/name
7000d000.i2c

...
	i2c@7000d000 {
		clock-frequency = <100000>;
		status = "okay";

		rt5640: rt5640@1c {
			compatible = "realtek,rt5640";
			reg = <0x1c>;

			interrupt-parent = <&gpio>;
			interrupts = <TEGRA_GPIO(W, 3) IRQ_TYPE_EDGE_FALLING>;

			realtek,dmic1-data-pin = <1>;
			realtek,dmic2-data-pin = <0>;
			realtek,in1-differential;
		};
...

# 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

# trace-cmd record -e regmap:*
# trace-cmd report

CPU 0 is empty
CPU 1 is empty
cpus=4
             mpv-281   [002]    40.227541: regmap_cache_only:    70080000.ahub flag=0
             mpv-281   [002]    40.227554: regmap_cache_only:    70080000.ahub flag=0
             mpv-281   [002]    40.227572: regmap_cache_only:    70080400.i2s flag=0
             mpv-281   [002]    40.236905: regmap_reg_read_cache: 2-001c reg=64 val=0
             mpv-281   [002]    40.236921: regmap_reg_read_cache: 2-001c reg=80 val=0
             mpv-281   [002]    40.236931: regmap_reg_read_cache: 2-001c reg=70 val=8000
             mpv-281   [002]    40.236935: regmap_reg_read_cache: 2-001c reg=70 val=8000
             mpv-281   [002]    40.236939: regmap_reg_write:     2-001c reg=70 val=8008
             mpv-281   [002]    40.236950: regmap_hw_write_start: 2-001c reg=70 count=1
             mpv-281   [002]    40.237776: regmap_hw_write_done: 2-001c reg=70 count=1
             mpv-281   [002]    40.237828: regmap_reg_read_cache: 2-001c reg=73 val=1114
             mpv-281   [002]    40.237831: regmap_reg_write:     2-001c reg=73 val=8114
             mpv-281   [002]    40.237836: regmap_hw_write_start: 2-001c reg=73 count=1
             mpv-281   [002]    40.241723: regmap_hw_write_done: 2-001c reg=73 count=1
             mpv-281   [002]    40.241794: regmap_reg_read_cache: 70080400.i2s reg=0 val=400
             mpv-281   [002]    40.241798: regmap_reg_write:     70080400.i2s reg=0 val=405
             mpv-281   [002]    40.241817: regmap_reg_write:     70080400.i2s reg=4 val=2f
             mpv-281   [002]    40.241820: regmap_reg_write:     70080400.i2s reg=14 val=1015504
             mpv-281   [002]    40.241823: regmap_reg_write:     70080400.i2s reg=8 val=10001
    kworker/u8:1-36    [003]    40.242987: regmap_reg_read_cache: 2-001c reg=63 val=0
    kworker/u8:1-36    [003]    40.242992: regmap_reg_write:     2-001c reg=63 val=a810
    kworker/u8:1-36    [003]    40.243002: regmap_hw_write_start: 2-001c reg=63 count=1
    kworker/u8:1-36    [003]    40.243519: regmap_hw_write_done: 2-001c reg=63 count=1
    kworker/u8:1-36    [003]    40.256915: regmap_reg_read_cache: 2-001c reg=63 val=a810
    kworker/u8:1-36    [003]    40.256924: regmap_reg_write:     2-001c reg=63 val=e818
    kworker/u8:1-36    [003]    40.256933: regmap_hw_write_start: 2-001c reg=63 count=1
    kworker/u8:1-36    [003]    40.257590: regmap_hw_write_done: 2-001c reg=63 count=1
    kworker/u8:1-36    [003]    40.257597: regmap_reg_read_cache: 2-001c reg=fa val=3f01
    kworker/u8:1-36    [003]    40.257600: regmap_reg_read_cache: 2-001c reg=93 val=3030
             mpv-281   [002]    40.257670: regmap_reg_read_cache: 2-001c reg=61 val=0
             mpv-281   [002]    40.257674: regmap_reg_write:     2-001c reg=61 val=9800
             mpv-281   [002]    40.257678: regmap_hw_write_start: 2-001c reg=61 count=1
             mpv-281   [002]    40.258409: regmap_hw_write_done: 2-001c reg=61 count=1
             mpv-281   [002]    40.258448: regmap_reg_read_cache: 2-001c reg=63 val=e818
             mpv-281   [002]    40.258451: regmap_reg_write:     2-001c reg=63 val=e8d8
             mpv-281   [002]    40.258454: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-281   [002]    40.259701: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-281   [002]    40.259751: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.260357: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-281   [002]    40.260361: regmap_reg_read:      2-001c reg=6a val=23
             mpv-281   [002]    40.260365: regmap_reg_write:     2-001c reg=6a val=24
             mpv-281   [002]    40.260367: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.260881: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-281   [002]    40.260885: regmap_hw_read_start: 2-001c reg=6c count=1
             mpv-281   [002]    40.263245: regmap_hw_read_done:  2-001c reg=6c count=1
             mpv-281   [002]    40.263251: regmap_reg_read:      2-001c reg=124 val=420
             mpv-281   [002]    40.263255: regmap_reg_write:     2-001c reg=124 val=220
             mpv-281   [002]    40.263260: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.264325: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-281   [002]    40.264330: regmap_reg_read:      2-001c reg=6a val=24
             mpv-281   [002]    40.264334: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-281   [002]    40.264827: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-281   [002]    40.264859: regmap_reg_read_cache: 2-001c reg=8f val=1100
             mpv-281   [002]    40.264867: regmap_reg_write:     2-001c reg=8f val=3100
             mpv-281   [002]    40.264871: regmap_hw_write_start: 2-001c reg=8f count=1
             mpv-281   [002]    40.265939: regmap_hw_write_done: 2-001c reg=8f count=1
             mpv-281   [002]    40.265976: regmap_reg_read_cache: 2-001c reg=8e val=4
             mpv-281   [002]    40.265981: regmap_reg_write:     2-001c reg=8e val=9
             mpv-281   [002]    40.265986: regmap_hw_write_start: 2-001c reg=8e count=1
             mpv-281   [002]    40.267142: regmap_hw_write_done: 2-001c reg=8e count=1
             mpv-281   [002]    40.267172: regmap_reg_write:     2-001c reg=177 val=9f00
             mpv-281   [002]    40.267182: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.267842: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-281   [002]    40.267845: regmap_reg_read:      2-001c reg=6a val=24
             mpv-281   [002]    40.267848: regmap_reg_write:     2-001c reg=6a val=77
             mpv-281   [002]    40.267851: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.268937: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-281   [002]    40.268943: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-281   [002]    40.269454: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-281   [002]    40.269484: regmap_reg_read_cache: 2-001c reg=63 val=e8d8
             mpv-281   [002]    40.269487: regmap_reg_write:     2-001c reg=63 val=a8d0
             mpv-281   [002]    40.269490: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-281   [002]    40.270012: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-281   [002]    40.271740: regmap_reg_read_cache: 2-001c reg=63 val=a8d0
             mpv-281   [002]    40.271748: regmap_reg_write:     2-001c reg=63 val=a8f0
             mpv-281   [002]    40.271753: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-281   [002]    40.272240: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-281   [002]    40.286888: regmap_reg_read_cache: 2-001c reg=63 val=a8f0
             mpv-281   [002]    40.286901: regmap_reg_write:     2-001c reg=63 val=e8f8
             mpv-281   [002]    40.286917: regmap_hw_write_start: 2-001c reg=63 count=1
             mpv-281   [002]    40.287748: regmap_hw_write_done: 2-001c reg=63 count=1
             mpv-281   [002]    40.287841: regmap_reg_read_cache: 2-001c reg=8f val=3100
             mpv-281   [002]    40.287844: regmap_reg_write:     2-001c reg=8f val=1140
             mpv-281   [002]    40.287847: regmap_hw_write_start: 2-001c reg=8f count=1
             mpv-281   [002]    40.288310: regmap_hw_write_done: 2-001c reg=8f count=1
             mpv-281   [002]    40.288339: regmap_reg_read_cache: 2-001c reg=91 val=c00
             mpv-281   [002]    40.288341: regmap_reg_write:     2-001c reg=91 val=e00
             mpv-281   [002]    40.288344: regmap_hw_write_start: 2-001c reg=91 count=1
             mpv-281   [002]    40.288808: regmap_hw_write_done: 2-001c reg=91 count=1
             mpv-281   [002]    40.288838: regmap_reg_read_cache: 2-001c reg=90 val=646
             mpv-281   [002]    40.288840: regmap_reg_write:     2-001c reg=90 val=737
             mpv-281   [002]    40.288844: regmap_hw_write_start: 2-001c reg=90 count=1
             mpv-281   [002]    40.289792: regmap_hw_write_done: 2-001c reg=90 count=1
             mpv-281   [002]    40.289828: regmap_reg_write:     2-001c reg=137 val=1c00
             mpv-281   [002]    40.289837: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.291772: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-281   [002]    40.291782: regmap_reg_read:      2-001c reg=6a val=77
             mpv-281   [002]    40.291788: regmap_reg_write:     2-001c reg=6a val=37
             mpv-281   [002]    40.291792: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.292320: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-281   [002]    40.292324: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-281   [002]    40.293579: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-281   [002]    40.293616: regmap_reg_read_cache: 2-001c reg=8e val=9
             mpv-281   [002]    40.293618: regmap_reg_write:     2-001c reg=8e val=5
             mpv-281   [002]    40.293623: regmap_hw_write_start: 2-001c reg=8e count=1
             mpv-281   [002]    40.294179: regmap_hw_write_done: 2-001c reg=8e count=1
             mpv-281   [002]    40.294211: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.295183: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-281   [002]    40.295187: regmap_reg_read:      2-001c reg=6a val=37
             mpv-281   [002]    40.295194: regmap_reg_write:     2-001c reg=6a val=24
             mpv-281   [002]    40.295196: regmap_hw_write_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.296301: regmap_hw_write_done: 2-001c reg=6a count=1
             mpv-281   [002]    40.296308: regmap_hw_read_start: 2-001c reg=6c count=1
             mpv-281   [002]    40.298769: regmap_hw_read_done:  2-001c reg=6c count=1
             mpv-281   [002]    40.298777: regmap_reg_read:      2-001c reg=124 val=220
             mpv-281   [002]    40.298784: regmap_reg_write:     2-001c reg=124 val=420
             mpv-281   [002]    40.298790: regmap_hw_read_start: 2-001c reg=6a count=1
             mpv-281   [002]    40.299542: regmap_hw_read_done:  2-001c reg=6a count=1
             mpv-281   [002]    40.299549: regmap_reg_read:      2-001c reg=6a val=24
             mpv-281   [002]    40.299555: regmap_hw_write_start: 2-001c reg=6c count=1
             mpv-281   [002]    40.300054: regmap_hw_write_done: 2-001c reg=6c count=1
             mpv-281   [002]    40.300107: regmap_reg_read_cache: 2-001c reg=2 val=cbcb
             mpv-281   [002]    40.300110: regmap_reg_write:     2-001c reg=2 val=4b4b
             mpv-281   [002]    40.300115: regmap_hw_write_start: 2-001c reg=2 count=1
             mpv-281   [002]    40.300756: regmap_hw_write_done: 2-001c reg=2 count=1
          mpv/ao-290   [003]    40.721759: regmap_reg_read_cache: 70080000.ahub reg=0 val=70777
          mpv/ao-290   [003]    40.721776: regmap_reg_write:     70080000.ahub reg=0 val=80070777
          mpv/ao-290   [003]    40.721787: regmap_reg_read_cache: 70080400.i2s reg=0 val=405
          mpv/ao-290   [003]    40.721789: regmap_reg_write:     70080400.i2s reg=0 val=80000405
             mpv-281   [002]    41.693159: regmap_reg_read_cache: 70080000.ahub reg=0 val=80070777
             mpv-281   [002]    41.693185: regmap_reg_write:     70080000.ahub reg=0 val=70777
             mpv-281   [002]    41.693200: regmap_reg_read_cache: 70080400.i2s reg=0 val=80000405
             mpv-281   [002]    41.693203: regmap_reg_write:     70080400.i2s reg=0 val=405

[-- Attachment #4: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-12-20 14:43                   ` [alsa-devel] " Dmitry Osipenko
@ 2019-12-20 14:56                     ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-12-20 14:56 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter, linux-tegra, alsa-devel,
	Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Thierry Reding
  Cc: linux-kernel, Edward Cragg

[-- Attachment #1: Type: text/plain, Size: 7365 bytes --]

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_h264.mov
>>>>>
>>>>
>>>> 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?


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

[-- Attachment #2: 0002-ASoC-tegra-take-packing-settings-from-the-audio-cif_.patch --]
[-- Type: text/x-patch, Size: 2845 bytes --]

From 5b5add6595c03e09ac183b787264d40ca356f491 Mon Sep 17 00:00:00 2001
From: Ben Dooks <ben.dooks@codethink.co.uk>
Date: Tue, 16 Apr 2019 14:34:48 +0100
Subject: [PATCH 2/2] ASoC: tegra: take packing settings from the audio
 cif_config

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;
-- 
2.24.0


[-- Attachment #3: 0001-ASoC-tegra-config-fifos-on-hw_param-changes.patch --]
[-- Type: text/x-patch, Size: 7847 bytes --]

From b2e14a9cc4c07d2dfdb5aa4269b55910d46a04d0 Mon Sep 17 00:00:00 2001
From: Ben Dooks <ben.dooks@codethink.co.uk>
Date: Tue, 4 Oct 2016 16:31:53 +0100
Subject: [PATCH 1/2] ASoC: tegra: config fifos on hw_param changes

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;
 	}
 
-- 
2.24.0


[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-12-20 14:56                     ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-12-20 14:56 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter, linux-tegra, alsa-devel,
	Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Thierry Reding
  Cc: linux-kernel, Edward Cragg

[-- Attachment #1: Type: text/plain, Size: 7365 bytes --]

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_h264.mov
>>>>>
>>>>
>>>> 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?


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

[-- Attachment #2: 0002-ASoC-tegra-take-packing-settings-from-the-audio-cif_.patch --]
[-- Type: text/x-patch, Size: 2845 bytes --]

From 5b5add6595c03e09ac183b787264d40ca356f491 Mon Sep 17 00:00:00 2001
From: Ben Dooks <ben.dooks@codethink.co.uk>
Date: Tue, 16 Apr 2019 14:34:48 +0100
Subject: [PATCH 2/2] ASoC: tegra: take packing settings from the audio
 cif_config

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;
-- 
2.24.0


[-- Attachment #3: 0001-ASoC-tegra-config-fifos-on-hw_param-changes.patch --]
[-- Type: text/x-patch, Size: 7847 bytes --]

From b2e14a9cc4c07d2dfdb5aa4269b55910d46a04d0 Mon Sep 17 00:00:00 2001
From: Ben Dooks <ben.dooks@codethink.co.uk>
Date: Tue, 4 Oct 2016 16:31:53 +0100
Subject: [PATCH 1/2] ASoC: tegra: config fifos on hw_param changes

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;
 	}
 
-- 
2.24.0


[-- Attachment #4: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-12-20 14:56                     ` [alsa-devel] " Ben Dooks
@ 2019-12-20 15:02                       ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-12-20 15:02 UTC (permalink / raw)
  To: Ben Dooks, Jon Hunter, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg

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_h264.mov
>>>>>>
>>>>>>
>>>>>
>>>>> 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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-12-20 15:02                       ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-12-20 15:02 UTC (permalink / raw)
  To: Ben Dooks, Jon Hunter, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg

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_h264.mov
>>>>>>
>>>>>>
>>>>>
>>>>> 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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-12-20 15:02                       ` [alsa-devel] " Dmitry Osipenko
@ 2019-12-20 15:25                         ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-12-20 15:25 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter, linux-tegra, alsa-devel,
	Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Thierry Reding
  Cc: linux-kernel, Edward Cragg

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_h264.mov
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> 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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-12-20 15:25                         ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-12-20 15:25 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter, linux-tegra, alsa-devel,
	Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Thierry Reding
  Cc: linux-kernel, Edward Cragg

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_h264.mov
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> 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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-12-20 15:25                         ` [alsa-devel] " Ben Dooks
@ 2019-12-20 16:40                           ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-12-20 16:40 UTC (permalink / raw)
  To: Ben Dooks, Jon Hunter, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg

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_h264.mov
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> 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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-12-20 16:40                           ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-12-20 16:40 UTC (permalink / raw)
  To: Ben Dooks, Jon Hunter, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg

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_h264.mov
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> 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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-12-20 16:40                           ` [alsa-devel] " Dmitry Osipenko
@ 2019-12-20 17:06                             ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-12-20 17:06 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter, linux-tegra, alsa-devel,
	Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Thierry Reding
  Cc: linux-kernel, Edward Cragg

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_h264.mov
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> 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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-12-20 17:06                             ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2019-12-20 17:06 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter, linux-tegra, alsa-devel,
	Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Thierry Reding
  Cc: linux-kernel, Edward Cragg

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_h264.mov
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> 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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-12-20 17:06                             ` [alsa-devel] " Ben Dooks
@ 2019-12-22 17:08                               ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-12-22 17:08 UTC (permalink / raw)
  To: Ben Dooks, Jon Hunter, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg

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_h264.mov
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2019-12-22 17:08                               ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2019-12-22 17:08 UTC (permalink / raw)
  To: Ben Dooks, Jon Hunter, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg

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_h264.mov
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2019-12-22 17:08                               ` [alsa-devel] " Dmitry Osipenko
@ 2020-01-05  0:04                                 ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-05  0:04 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter, linux-tegra, alsa-devel,
	Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Thierry Reding
  Cc: linux-kernel, Edward Cragg

[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.

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-05  0:04                                 ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-05  0:04 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter, linux-tegra, alsa-devel,
	Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
	Thierry Reding
  Cc: linux-kernel, Edward Cragg

[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.

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-05  0:04                                 ` [alsa-devel] " Ben Dooks
@ 2020-01-05  1:48                                   ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-05  1:48 UTC (permalink / raw)
  To: Ben Dooks, Jon Hunter, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg

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?
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-05  1:48                                   ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-05  1:48 UTC (permalink / raw)
  To: Ben Dooks, Jon Hunter, linux-tegra, alsa-devel, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, Mark Brown, Thierry Reding
  Cc: linux-kernel, Edward Cragg

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?
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-05  1:48                                   ` [alsa-devel] " Dmitry Osipenko
@ 2020-01-05 10:53                                     ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-05 10:53 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra,
	Jon Hunter



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.

-- 
Ben

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-05 10:53                                     ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-05 10:53 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra,
	Jon Hunter



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.

-- 
Ben

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-05 10:53                                     ` [alsa-devel] " Ben Dooks
@ 2020-01-06 19:00                                       ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-06 19:00 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra,
	Jon Hunter

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,



-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-06 19:00                                       ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-06 19:00 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra,
	Jon Hunter

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,



-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-06 19:00                                       ` [alsa-devel] " Ben Dooks
@ 2020-01-07  1:39                                         ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-07  1:39 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra,
	Jon Hunter

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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-07  1:39                                         ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-07  1:39 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra,
	Jon Hunter

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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-05 10:53                                     ` [alsa-devel] " Ben Dooks
@ 2020-01-07 10:29                                       ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-07 10:29 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-07 10:29                                       ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-07 10:29 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-07 10:29                                       ` [alsa-devel] " Jon Hunter
@ 2020-01-07 10:35                                         ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-07 10:35 UTC (permalink / raw)
  To: Jon Hunter, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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)

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-07 10:35                                         ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-07 10:35 UTC (permalink / raw)
  To: Jon Hunter, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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)

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-07  1:39                                         ` [alsa-devel] " Dmitry Osipenko
@ 2020-01-08 11:37                                           ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-08 11:37 UTC (permalink / raw)
  To: Dmitry Osipenko, Ben Dooks
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-08 11:37                                           ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-08 11:37 UTC (permalink / raw)
  To: Dmitry Osipenko, Ben Dooks
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-08 11:37                                           ` [alsa-devel] " Jon Hunter
@ 2020-01-20 16:50                                               ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-20 16:50 UTC (permalink / raw)
  To: Jon Hunter, Ben Dooks
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Takashi Iwai, Liam Girdwood,
	Jaroslav Kysela, Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

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?

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-20 16:50                                               ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-20 16:50 UTC (permalink / raw)
  To: Jon Hunter, Ben Dooks
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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?
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-20 16:50                                               ` [alsa-devel] " Dmitry Osipenko
@ 2020-01-20 17:36                                                   ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-20 17:36 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Takashi Iwai, Liam Girdwood,
	Jaroslav Kysela, Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-20 17:36                                                   ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-20 17:36 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-07 10:29                                       ` [alsa-devel] " Jon Hunter
@ 2020-01-21 18:15                                           ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-21 18:15 UTC (permalink / raw)
  To: Jon Hunter, Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-21 18:15                                           ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-21 18:15 UTC (permalink / raw)
  To: Jon Hunter, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-21 18:15                                           ` Ben Dooks
@ 2020-01-21 18:54                                               ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-21 18:54 UTC (permalink / raw)
  To: Ben Dooks, Jon Hunter
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

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.

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-21 18:54                                               ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-21 18:54 UTC (permalink / raw)
  To: Ben Dooks, Jon Hunter
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-07  1:39                                         ` [alsa-devel] " Dmitry Osipenko
@ 2020-01-23 19:38                                             ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-23 19:38 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, 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 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...

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-23 19:38                                             ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-23 19:38 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra,
	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 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...

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-23 19:38                                             ` Ben Dooks
@ 2020-01-23 21:59                                                 ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-23 21:59 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, 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 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.

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-23 21:59                                                 ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-23 21:59 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra,
	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 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.

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-23 21:59                                                 ` Ben Dooks
@ 2020-01-23 22:11                                                     ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-23 22:11 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Jon Hunter

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.

[1] https://lkml.org/lkml/2020/1/21/744

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-23 22:11                                                     ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-23 22:11 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra,
	Jon Hunter

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.

[1] https://lkml.org/lkml/2020/1/21/744
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-23 22:11                                                     ` Dmitry Osipenko
@ 2020-01-24  4:31                                                         ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-24  4:31 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Jon Hunter

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.
> 
> [1] https://lkml.org/lkml/2020/1/21/744

Actually, tegra_asoc_utils_set_rate() sets the PLLA rate, but the values
are hardcoded there.

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-24  4:31                                                         ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-24  4:31 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra,
	Jon Hunter

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.
> 
> [1] https://lkml.org/lkml/2020/1/21/744

Actually, tegra_asoc_utils_set_rate() sets the PLLA rate, but the values
are hardcoded there.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-23 19:38                                             ` Ben Dooks
@ 2020-01-24 16:50                                                 ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-24 16:50 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA


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

-- 
nvpublic

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-24 16:50                                                 ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-24 16:50 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-23 21:59                                                 ` Ben Dooks
@ 2020-01-24 16:56                                                     ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-24 16:56 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA


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

-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-24 16:56                                                     ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-24 16:56 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-24 16:50                                                 ` Jon Hunter
@ 2020-01-24 17:00                                                     ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-24 17:00 UTC (permalink / raw)
  To: Jon Hunter, Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

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



-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-24 17:00                                                     ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-24 17:00 UTC (permalink / raw)
  To: Jon Hunter, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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



-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-24 16:56                                                     ` Jon Hunter
@ 2020-01-24 17:00                                                         ` Mark Brown
  -1 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2020-01-24 17:00 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Ben Dooks, Dmitry Osipenko,
	linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 538 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-24 17:00                                                         ` Mark Brown
  0 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2020-01-24 17:00 UTC (permalink / raw)
  To: Jon Hunter
  Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood, Ben Dooks,
	Thierry Reding, Edward Cragg, linux-tegra, Dmitry Osipenko


[-- Attachment #1.1: Type: text/plain, Size: 538 bytes --]

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.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-24 17:00                                                         ` Mark Brown
@ 2020-01-24 17:03                                                             ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-24 17:03 UTC (permalink / raw)
  To: Mark Brown, Jon Hunter
  Cc: Dmitry Osipenko, linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

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.
> 


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-24 17:03                                                             ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-24 17:03 UTC (permalink / raw)
  To: Mark Brown, Jon Hunter
  Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood,
	Thierry Reding, Edward Cragg, linux-tegra, Dmitry Osipenko

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.
> 


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-24 16:50                                                 ` Jon Hunter
@ 2020-01-24 17:06                                                     ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-24 17:06 UTC (permalink / raw)
  To: Jon Hunter, Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

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)



-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-24 17:06                                                     ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-24 17:06 UTC (permalink / raw)
  To: Jon Hunter, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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)



-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-24 16:50                                                 ` Jon Hunter
@ 2020-01-27 19:20                                                     ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-27 19:20 UTC (permalink / raw)
  To: Jon Hunter, Ben Dooks
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

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?

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-27 19:20                                                     ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-27 19:20 UTC (permalink / raw)
  To: Jon Hunter, Ben Dooks
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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?
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-27 19:20                                                     ` Dmitry Osipenko
@ 2020-01-27 19:23                                                         ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-27 19:23 UTC (permalink / raw)
  To: Jon Hunter, Ben Dooks
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

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.

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-27 19:23                                                         ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-27 19:23 UTC (permalink / raw)
  To: Jon Hunter, Ben Dooks
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-24 17:00                                                     ` Ben Dooks
@ 2020-01-28  7:49                                                         ` Ricard Wanderlof
  -1 siblings, 0 replies; 182+ messages in thread
From: Ricard Wanderlof @ 2020-01-28  7:49 UTC (permalink / raw)
  To: Ben Dooks
  Cc: Jon Hunter, Dmitry Osipenko,
	linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA


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
-- 
Ricard Wolf Wanderlof                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-28  7:49                                                         ` Ricard Wanderlof
  0 siblings, 0 replies; 182+ messages in thread
From: Ricard Wanderlof @ 2020-01-28  7:49 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra,
	Dmitry Osipenko, Jon Hunter


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
-- 
Ricard Wolf Wanderlof                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-27 19:20                                                     ` Dmitry Osipenko
@ 2020-01-28  8:58                                                       ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-28  8:58 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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?


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-28  8:58                                                       ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-28  8:58 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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?


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-27 19:23                                                         ` Dmitry Osipenko
@ 2020-01-28  8:59                                                           ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-28  8:59 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-28  8:59                                                           ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-28  8:59 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-27 19:20                                                     ` Dmitry Osipenko
@ 2020-01-28 12:13                                                         ` Mark Brown
  -1 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2020-01-28 12:13 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Jon Hunter, Ben Dooks,
	linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-28 12:13                                                         ` Mark Brown
  0 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2020-01-28 12:13 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood, Ben Dooks,
	Thierry Reding, Edward Cragg, linux-tegra, Jon Hunter


[-- Attachment #1.1: Type: text/plain, Size: 1209 bytes --]

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.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-28  8:59                                                           ` [alsa-devel] " Ben Dooks
@ 2020-01-28 13:19                                                               ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-28 13:19 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA


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

-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-28 13:19                                                               ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-28 13:19 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-28 13:19                                                               ` Jon Hunter
@ 2020-01-28 15:25                                                                   ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-28 15:25 UTC (permalink / raw)
  To: Jon Hunter, Ben Dooks
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

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.

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-28 15:25                                                                   ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-28 15:25 UTC (permalink / raw)
  To: Jon Hunter, Ben Dooks
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-28 13:19                                                               ` Jon Hunter
@ 2020-01-28 15:26                                                                   ` Mark Brown
  -1 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2020-01-28 15:26 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Ben Dooks, Dmitry Osipenko,
	linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1370 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-28 15:26                                                                   ` Mark Brown
  0 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2020-01-28 15:26 UTC (permalink / raw)
  To: Jon Hunter
  Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood, Ben Dooks,
	Thierry Reding, Edward Cragg, linux-tegra, Dmitry Osipenko


[-- Attachment #1.1: Type: text/plain, Size: 1370 bytes --]

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.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-28 12:13                                                         ` Mark Brown
@ 2020-01-28 17:42                                                             ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-28 17:42 UTC (permalink / raw)
  To: Mark Brown
  Cc: Jon Hunter, Ben Dooks,
	linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

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.

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-28 17:42                                                             ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-28 17:42 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood, Ben Dooks,
	Thierry Reding, Edward Cragg, linux-tegra, Jon Hunter

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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-28 15:26                                                                   ` Mark Brown
@ 2020-01-28 17:45                                                                       ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-28 17:45 UTC (permalink / raw)
  To: Mark Brown, Jon Hunter
  Cc: Ben Dooks, linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

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

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-28 17:45                                                                       ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-28 17:45 UTC (permalink / raw)
  To: Mark Brown, Jon Hunter
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Ben Dooks,
	Thierry Reding, Edward Cragg, linux-tegra

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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-28 17:42                                                             ` Dmitry Osipenko
@ 2020-01-28 18:19                                                                 ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-28 18:19 UTC (permalink / raw)
  To: Dmitry Osipenko, Mark Brown
  Cc: Ben Dooks, linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA


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

-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-28 18:19                                                                 ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-28 18:19 UTC (permalink / raw)
  To: Dmitry Osipenko, Mark Brown
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Ben Dooks,
	Thierry Reding, Edward Cragg, linux-tegra


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-28 13:19                                                               ` Jon Hunter
@ 2020-01-28 18:42                                                                   ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-28 18:42 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA


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


-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-28 18:42                                                                   ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-28 18:42 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra


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


-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-28 18:19                                                                 ` Jon Hunter
@ 2020-01-29  0:17                                                                     ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-29  0:17 UTC (permalink / raw)
  To: Jon Hunter, Mark Brown
  Cc: Ben Dooks, linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

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.

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-29  0:17                                                                     ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-29  0:17 UTC (permalink / raw)
  To: Jon Hunter, Mark Brown
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Ben Dooks,
	Thierry Reding, Edward Cragg, linux-tegra

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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-28 12:13                                                         ` Mark Brown
@ 2020-01-29 10:49                                                             ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-29 10:49 UTC (permalink / raw)
  To: Mark Brown, Dmitry Osipenko
  Cc: Ben Dooks, linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA


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

-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-29 10:49                                                             ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-29 10:49 UTC (permalink / raw)
  To: Mark Brown, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Ben Dooks,
	Thierry Reding, Edward Cragg, linux-tegra


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-29 10:49                                                             ` Jon Hunter
@ 2020-01-29 14:33                                                                 ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-29 14:33 UTC (permalink / raw)
  To: Mark Brown, Dmitry Osipenko
  Cc: Ben Dooks, linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA


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

-- 
nvpublic

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-29 14:33                                                                 ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-29 14:33 UTC (permalink / raw)
  To: Mark Brown, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai, Ben Dooks,
	Thierry Reding, Edward Cragg, linux-tegra


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-29 14:33                                                                 ` Jon Hunter
@ 2020-01-29 15:22                                                                     ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-29 15:22 UTC (permalink / raw)
  To: Jon Hunter, Mark Brown, Ben Dooks
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

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!

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-29 15:22                                                                     ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-01-29 15:22 UTC (permalink / raw)
  To: Jon Hunter, Mark Brown, Ben Dooks
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra

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!
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-28 12:13                                                         ` Mark Brown
@ 2020-01-29 17:52                                                             ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-29 17:52 UTC (permalink / raw)
  To: Mark Brown, Dmitry Osipenko
  Cc: Jon Hunter, linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

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.
> 


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-29 17:52                                                             ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-29 17:52 UTC (permalink / raw)
  To: Mark Brown, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood,
	Thierry Reding, Edward Cragg, linux-tegra, Jon Hunter

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.
> 


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-28 18:42                                                                   ` Jon Hunter
@ 2020-01-30  8:04                                                                       ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-30  8:04 UTC (permalink / raw)
  To: Jon Hunter, Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

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


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-30  8:04                                                                       ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-30  8:04 UTC (permalink / raw)
  To: Jon Hunter, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Mark Brown, Thierry Reding, Edward Cragg, linux-tegra

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


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re:
  2020-01-29  0:17                                                                     ` Dmitry Osipenko
@ 2020-01-30  8:05                                                                         ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-30  8:05 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter, Mark Brown
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

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				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] (no subject)
@ 2020-01-30  8:05                                                                         ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-30  8:05 UTC (permalink / raw)
  To: Dmitry Osipenko, Jon Hunter, Mark Brown
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra

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				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-29 10:49                                                             ` Jon Hunter
@ 2020-01-30  8:06                                                                 ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-30  8:06 UTC (permalink / raw)
  To: Jon Hunter, Mark Brown, Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

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


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-30  8:06                                                                 ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-30  8:06 UTC (permalink / raw)
  To: Jon Hunter, Mark Brown, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra

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


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-29 14:33                                                                 ` Jon Hunter
@ 2020-01-30  8:17                                                                     ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-30  8:17 UTC (permalink / raw)
  To: Jon Hunter, Mark Brown, Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

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.

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-30  8:17                                                                     ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-30  8:17 UTC (permalink / raw)
  To: Jon Hunter, Mark Brown, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra

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.

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: (no subject)
  2020-01-30  8:05                                                                         ` [alsa-devel] (no subject) Ben Dooks
@ 2020-01-30  9:31                                                                           ` Clemens Ladisch
  -1 siblings, 0 replies; 182+ messages in thread
From: Clemens Ladisch @ 2020-01-30  9:31 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko, Jon Hunter, Mark Brown
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra

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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] (no subject)
@ 2020-01-30  9:31                                                                           ` Clemens Ladisch
  0 siblings, 0 replies; 182+ messages in thread
From: Clemens Ladisch @ 2020-01-30  9:31 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko, Jon Hunter, Mark Brown
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra

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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] (no subject)
  2020-01-30  9:31                                                                           ` [alsa-devel] " Clemens Ladisch
@ 2020-01-30  9:39                                                                               ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-30  9:39 UTC (permalink / raw)
  To: Clemens Ladisch, Dmitry Osipenko, Jon Hunter, Mark Brown
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

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				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] (no subject)
@ 2020-01-30  9:39                                                                               ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-30  9:39 UTC (permalink / raw)
  To: Clemens Ladisch, Dmitry Osipenko, Jon Hunter, Mark Brown
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra

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				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-30  8:17                                                                     ` Ben Dooks
@ 2020-01-30 12:05                                                                         ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-30 12:05 UTC (permalink / raw)
  To: Ben Dooks, Mark Brown, Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA


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

-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-30 12:05                                                                         ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-30 12:05 UTC (permalink / raw)
  To: Ben Dooks, Mark Brown, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-30 12:05                                                                         ` Jon Hunter
@ 2020-01-30 12:07                                                                             ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-30 12:07 UTC (permalink / raw)
  To: Jon Hunter, Mark Brown, Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-30 12:07                                                                             ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-30 12:07 UTC (permalink / raw)
  To: Jon Hunter, Mark Brown, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra

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.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-30 12:07                                                                             ` Ben Dooks
@ 2020-01-30 13:09                                                                                 ` Jon Hunter
  -1 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-30 13:09 UTC (permalink / raw)
  To: Ben Dooks, Mark Brown, Dmitry Osipenko
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA


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

-- 
nvpublic

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-30 13:09                                                                                 ` Jon Hunter
  0 siblings, 0 replies; 182+ messages in thread
From: Jon Hunter @ 2020-01-30 13:09 UTC (permalink / raw)
  To: Ben Dooks, Mark Brown, Dmitry Osipenko
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra


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

-- 
nvpublic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-30  8:17                                                                     ` Ben Dooks
@ 2020-01-30 13:10                                                                         ` Mark Brown
  -1 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2020-01-30 13:10 UTC (permalink / raw)
  To: Ben Dooks
  Cc: Jon Hunter, Dmitry Osipenko,
	linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 471 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-01-30 13:10                                                                         ` Mark Brown
  0 siblings, 0 replies; 182+ messages in thread
From: Mark Brown @ 2020-01-30 13:10 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra, Dmitry Osipenko,
	Jon Hunter


[-- Attachment #1.1: Type: text/plain, Size: 471 bytes --]

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.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] (no subject)
  2020-01-30  9:39                                                                               ` Ben Dooks
@ 2020-01-30 14:58                                                                                   ` Clemens Ladisch
  -1 siblings, 0 replies; 182+ messages in thread
From: Clemens Ladisch @ 2020-01-30 14:58 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko, Jon Hunter, Mark Brown
  Cc: linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

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

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] (no subject)
@ 2020-01-30 14:58                                                                                   ` Clemens Ladisch
  0 siblings, 0 replies; 182+ messages in thread
From: Clemens Ladisch @ 2020-01-30 14:58 UTC (permalink / raw)
  To: Ben Dooks, Dmitry Osipenko, Jon Hunter, Mark Brown
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra

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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] (no subject)
  2020-01-30 14:58                                                                                   ` Clemens Ladisch
@ 2020-01-31 10:50                                                                                       ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-31 10:50 UTC (permalink / raw)
  To: Clemens Ladisch
  Cc: Dmitry Osipenko, Jon Hunter, Mark Brown,
	linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA



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.

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] (no subject)
@ 2020-01-31 10:50                                                                                       ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-01-31 10:50 UTC (permalink / raw)
  To: Clemens Ladisch
  Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood,
	Jon Hunter, Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra, Dmitry Osipenko



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.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: (no subject)
  2020-01-31 10:50                                                                                       ` Ben Dooks
@ 2020-01-31 11:03                                                                                         ` Clemens Ladisch
  -1 siblings, 0 replies; 182+ messages in thread
From: Clemens Ladisch @ 2020-01-31 11:03 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood,
	Jon Hunter, Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra, Dmitry Osipenko

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

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] (no subject)
@ 2020-01-31 11:03                                                                                         ` Clemens Ladisch
  0 siblings, 0 replies; 182+ messages in thread
From: Clemens Ladisch @ 2020-01-31 11:03 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood,
	Jon Hunter, Mark Brown, Thierry Reding, Edward Cragg,
	linux-tegra, Dmitry Osipenko

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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-01-30 13:10                                                                         ` Mark Brown
@ 2020-03-19 15:32                                                                             ` Ben Dooks
  -1 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-03-19 15:32 UTC (permalink / raw)
  To: Mark Brown
  Cc: Jon Hunter, Dmitry Osipenko,
	linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA



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.

-- 
Ben

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-03-19 15:32                                                                             ` Ben Dooks
  0 siblings, 0 replies; 182+ messages in thread
From: Ben Dooks @ 2020-03-19 15:32 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel, alsa-devel, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra, Dmitry Osipenko,
	Jon Hunter



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.

-- 
Ben

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
  2020-03-19 15:32                                                                             ` Ben Dooks
@ 2020-03-20 14:18                                                                                 ` Dmitry Osipenko
  -1 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-03-20 14:18 UTC (permalink / raw)
  To: Ben Dooks, Mark Brown
  Cc: Jon Hunter, linux-kernel-81qHHgoATdFT9dQujB1mzip2UmYkHbXO,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Liam Girdwood, Takashi Iwai,
	Thierry Reding, Edward Cragg, linux-tegra-u79uwXL29TY76Z2rM5mHXA

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 :)

^ permalink raw reply	[flat|nested] 182+ messages in thread

* Re: [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples
@ 2020-03-20 14:18                                                                                 ` Dmitry Osipenko
  0 siblings, 0 replies; 182+ messages in thread
From: Dmitry Osipenko @ 2020-03-20 14:18 UTC (permalink / raw)
  To: Ben Dooks, Mark Brown
  Cc: linux-kernel, alsa-devel, Takashi Iwai, Liam Girdwood,
	Thierry Reding, Edward Cragg, linux-tegra, Jon Hunter

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 :)

^ permalink raw reply	[flat|nested] 182+ messages in thread

end of thread, other threads:[~2020-03-20 14:19 UTC | newest]

Thread overview: 182+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 15:48 tegra30 tdm audio support Ben Dooks
2019-10-18 15:48 ` [alsa-devel] " Ben Dooks
2019-10-18 15:48 ` [PATCH v5 1/7] ASoC: tegra: add a TDM configuration callback Ben Dooks
2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
2019-10-24 15:50   ` Jon Hunter
2019-10-24 15:50     ` [alsa-devel] " Jon Hunter
2019-10-25 10:12   ` Applied "ASoC: tegra: add a TDM configuration callback" to the asoc tree Mark Brown
2019-10-25 10:12     ` [alsa-devel] " Mark Brown
2019-10-18 15:48 ` [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples Ben Dooks
2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
2019-10-24 15:54   ` Jon Hunter
2019-10-24 15:54     ` [alsa-devel] " Jon Hunter
2019-10-25 10:12   ` Applied "ASoC: tegra: Allow 24bit and 32bit samples" to the asoc tree Mark Brown
2019-10-25 10:12     ` [alsa-devel] " Mark Brown
2019-11-23 21:09   ` [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples Dmitry Osipenko
2019-11-23 21:09     ` [alsa-devel] " Dmitry Osipenko
2019-11-25 10:37     ` Ben Dooks
2019-11-25 10:37       ` [alsa-devel] " Ben Dooks
2019-11-25 17:22       ` Dmitry Osipenko
2019-11-25 17:22         ` [alsa-devel] " Dmitry Osipenko
2019-11-25 17:28         ` Dmitry Osipenko
2019-11-25 17:28           ` [alsa-devel] " Dmitry Osipenko
2019-12-19 21:21           ` Dmitry Osipenko
2019-12-19 21:21             ` [alsa-devel] " Dmitry Osipenko
2019-12-20 10:56             ` Ben Dooks
2019-12-20 10:56               ` [alsa-devel] " Ben Dooks
2019-12-20 11:30           ` Jon Hunter
2019-12-20 11:30             ` [alsa-devel] " Jon Hunter
2019-12-20 11:38             ` Ben Dooks
2019-12-20 11:38               ` [alsa-devel] " Ben Dooks
2019-12-20 13:57               ` Jon Hunter
2019-12-20 13:57                 ` [alsa-devel] " Jon Hunter
2019-12-20 14:43                 ` Dmitry Osipenko
2019-12-20 14:43                   ` [alsa-devel] " Dmitry Osipenko
2019-12-20 14:56                   ` Ben Dooks
2019-12-20 14:56                     ` [alsa-devel] " Ben Dooks
2019-12-20 15:02                     ` Dmitry Osipenko
2019-12-20 15:02                       ` [alsa-devel] " Dmitry Osipenko
2019-12-20 15:25                       ` Ben Dooks
2019-12-20 15:25                         ` [alsa-devel] " Ben Dooks
2019-12-20 16:40                         ` Dmitry Osipenko
2019-12-20 16:40                           ` [alsa-devel] " Dmitry Osipenko
2019-12-20 17:06                           ` Ben Dooks
2019-12-20 17:06                             ` [alsa-devel] " Ben Dooks
2019-12-22 17:08                             ` Dmitry Osipenko
2019-12-22 17:08                               ` [alsa-devel] " Dmitry Osipenko
2020-01-05  0:04                               ` Ben Dooks
2020-01-05  0:04                                 ` [alsa-devel] " Ben Dooks
2020-01-05  1:48                                 ` Dmitry Osipenko
2020-01-05  1:48                                   ` [alsa-devel] " Dmitry Osipenko
2020-01-05 10:53                                   ` Ben Dooks
2020-01-05 10:53                                     ` [alsa-devel] " Ben Dooks
2020-01-06 19:00                                     ` [Linux-kernel] " Ben Dooks
2020-01-06 19:00                                       ` [alsa-devel] " Ben Dooks
2020-01-07  1:39                                       ` Dmitry Osipenko
2020-01-07  1:39                                         ` [alsa-devel] " Dmitry Osipenko
2020-01-08 11:37                                         ` Jon Hunter
2020-01-08 11:37                                           ` [alsa-devel] " Jon Hunter
     [not found]                                           ` <07cd66dc-1a6c-6b49-55a9-1420fe235161-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-01-20 16:50                                             ` Dmitry Osipenko
2020-01-20 16:50                                               ` [alsa-devel] " Dmitry Osipenko
     [not found]                                               ` <ebfaa0d3-1236-cac4-4bd8-4456a171d773-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-01-20 17:36                                                 ` Ben Dooks
2020-01-20 17:36                                                   ` [alsa-devel] " Ben Dooks
     [not found]                                         ` <a2744ea0-cf6d-d083-75e6-853746195001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-01-23 19:38                                           ` Ben Dooks
2020-01-23 19:38                                             ` Ben Dooks
     [not found]                                             ` <28cafc56-095b-68c6-638d-270608a2983f-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2020-01-23 21:59                                               ` Ben Dooks
2020-01-23 21:59                                                 ` Ben Dooks
     [not found]                                                 ` <9b3a0cdd-34c7-ecb4-4a26-268fd4a63041-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2020-01-23 22:11                                                   ` Dmitry Osipenko
2020-01-23 22:11                                                     ` Dmitry Osipenko
     [not found]                                                     ` <76a6a818-ab60-45eb-a85e-fa3090266d6f-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-01-24  4:31                                                       ` Dmitry Osipenko
2020-01-24  4:31                                                         ` Dmitry Osipenko
2020-01-24 16:56                                                   ` Jon Hunter
2020-01-24 16:56                                                     ` Jon Hunter
     [not found]                                                     ` <26aeb591-e770-5e6a-5ee4-05414ae4ddc6-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-01-24 17:00                                                       ` Mark Brown
2020-01-24 17:00                                                         ` Mark Brown
     [not found]                                                         ` <20200124170059.GB4918-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2020-01-24 17:03                                                           ` Ben Dooks
2020-01-24 17:03                                                             ` Ben Dooks
2020-01-24 16:50                                               ` Jon Hunter
2020-01-24 16:50                                                 ` Jon Hunter
     [not found]                                                 ` <3d8544be-af20-f382-85fd-32183365267b-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-01-24 17:00                                                   ` Ben Dooks
2020-01-24 17:00                                                     ` Ben Dooks
     [not found]                                                     ` <318f0256-fe6d-c34d-4deb-74540fca8d0d-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2020-01-28  7:49                                                       ` Ricard Wanderlof
2020-01-28  7:49                                                         ` Ricard Wanderlof
2020-01-24 17:06                                                   ` Ben Dooks
2020-01-24 17:06                                                     ` Ben Dooks
2020-01-27 19:20                                                   ` Dmitry Osipenko
2020-01-27 19:20                                                     ` Dmitry Osipenko
     [not found]                                                     ` <1b3c2af4-510e-306c-749a-efffc994b20a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-01-27 19:23                                                       ` Dmitry Osipenko
2020-01-27 19:23                                                         ` Dmitry Osipenko
2020-01-28  8:59                                                         ` Ben Dooks
2020-01-28  8:59                                                           ` [alsa-devel] " Ben Dooks
     [not found]                                                           ` <62cea895-c1f1-a833-b63c-050642bb8a79-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2020-01-28 13:19                                                             ` Jon Hunter
2020-01-28 13:19                                                               ` Jon Hunter
     [not found]                                                               ` <d6bb92e2-16ba-3c00-2f07-e741ecaa5ec8-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-01-28 15:25                                                                 ` Dmitry Osipenko
2020-01-28 15:25                                                                   ` Dmitry Osipenko
2020-01-28 15:26                                                                 ` Mark Brown
2020-01-28 15:26                                                                   ` Mark Brown
     [not found]                                                                   ` <20200128152632.GF4689-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2020-01-28 17:45                                                                     ` Dmitry Osipenko
2020-01-28 17:45                                                                       ` Dmitry Osipenko
2020-01-28 18:42                                                                 ` Jon Hunter
2020-01-28 18:42                                                                   ` Jon Hunter
     [not found]                                                                   ` <7d9a06b5-c001-2d01-f999-10ccd1195ebe-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-01-30  8:04                                                                     ` Ben Dooks
2020-01-30  8:04                                                                       ` Ben Dooks
2020-01-28 12:13                                                       ` Mark Brown
2020-01-28 12:13                                                         ` Mark Brown
     [not found]                                                         ` <20200128121315.GD4689-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2020-01-28 17:42                                                           ` Dmitry Osipenko
2020-01-28 17:42                                                             ` Dmitry Osipenko
     [not found]                                                             ` <047c8caa-e715-5295-9794-67ff3e10cea2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-01-28 18:19                                                               ` Jon Hunter
2020-01-28 18:19                                                                 ` Jon Hunter
     [not found]                                                                 ` <70f344bf-f991-606c-55ab-bdadea27d233-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-01-29  0:17                                                                   ` Dmitry Osipenko
2020-01-29  0:17                                                                     ` Dmitry Osipenko
     [not found]                                                                     ` <2ff97414-f0a5-7224-0e53-6cad2ed0ccd2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-01-30  8:05                                                                       ` Ben Dooks
2020-01-30  8:05                                                                         ` [alsa-devel] (no subject) Ben Dooks
2020-01-30  9:31                                                                         ` Clemens Ladisch
2020-01-30  9:31                                                                           ` [alsa-devel] " Clemens Ladisch
     [not found]                                                                           ` <96ed04cb-24ab-7e4d-bd44-6a4bb7c046ac-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>
2020-01-30  9:39                                                                             ` Ben Dooks
2020-01-30  9:39                                                                               ` Ben Dooks
     [not found]                                                                               ` <8161fc88-fa8c-ec92-cc14-1caa5c6f2fe7-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2020-01-30 14:58                                                                                 ` Clemens Ladisch
2020-01-30 14:58                                                                                   ` Clemens Ladisch
     [not found]                                                                                   ` <182fd434-f15a-f049-1ba1-83bd864b4590-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>
2020-01-31 10:50                                                                                     ` Ben Dooks
2020-01-31 10:50                                                                                       ` Ben Dooks
2020-01-31 11:03                                                                                       ` Clemens Ladisch
2020-01-31 11:03                                                                                         ` [alsa-devel] " Clemens Ladisch
2020-01-29 10:49                                                           ` [alsa-devel] [Linux-kernel] [PATCH v5 2/7] ASoC: tegra: Allow 24bit and 32bit samples Jon Hunter
2020-01-29 10:49                                                             ` Jon Hunter
     [not found]                                                             ` <4b90efd2-5d0c-84df-961d-80cee288e0d4-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-01-29 14:33                                                               ` Jon Hunter
2020-01-29 14:33                                                                 ` Jon Hunter
     [not found]                                                                 ` <586ea2b9-c204-2bd1-f8e2-875e0974e42d-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-01-29 15:22                                                                   ` Dmitry Osipenko
2020-01-29 15:22                                                                     ` Dmitry Osipenko
2020-01-30  8:17                                                                   ` Ben Dooks
2020-01-30  8:17                                                                     ` Ben Dooks
     [not found]                                                                     ` <fe002ec7-ae6e-f770-b82a-49237e0b29c6-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2020-01-30 12:05                                                                       ` Jon Hunter
2020-01-30 12:05                                                                         ` Jon Hunter
     [not found]                                                                         ` <c01e6e09-d3ed-7c39-5a66-e25950f8bdcc-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-01-30 12:07                                                                           ` Ben Dooks
2020-01-30 12:07                                                                             ` Ben Dooks
     [not found]                                                                             ` <5898e2ed-1773-8f8f-b26b-d4613a8ad4de-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2020-01-30 13:09                                                                               ` Jon Hunter
2020-01-30 13:09                                                                                 ` Jon Hunter
2020-01-30 13:10                                                                       ` Mark Brown
2020-01-30 13:10                                                                         ` Mark Brown
     [not found]                                                                         ` <20200130131039.GC6682-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2020-03-19 15:32                                                                           ` Ben Dooks
2020-03-19 15:32                                                                             ` Ben Dooks
     [not found]                                                                             ` <1df9cc13ea636502ac09191523ff0669-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2020-03-20 14:18                                                                               ` Dmitry Osipenko
2020-03-20 14:18                                                                                 ` Dmitry Osipenko
2020-01-30  8:06                                                               ` Ben Dooks
2020-01-30  8:06                                                                 ` Ben Dooks
2020-01-29 17:52                                                           ` Ben Dooks
2020-01-29 17:52                                                             ` Ben Dooks
2020-01-28  8:58                                                     ` Ben Dooks
2020-01-28  8:58                                                       ` [alsa-devel] " Ben Dooks
2020-01-07 10:29                                     ` Jon Hunter
2020-01-07 10:29                                       ` [alsa-devel] " Jon Hunter
2020-01-07 10:35                                       ` Ben Dooks
2020-01-07 10:35                                         ` [alsa-devel] " Ben Dooks
     [not found]                                       ` <eb90ee78-e462-401a-de60-4a9bfc2a00c4-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-01-21 18:15                                         ` Ben Dooks
2020-01-21 18:15                                           ` Ben Dooks
     [not found]                                           ` <9fc97644-b679-ef9f-41ca-1d3a5f296f3a-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2020-01-21 18:54                                             ` Dmitry Osipenko
2020-01-21 18:54                                               ` Dmitry Osipenko
2019-10-18 15:48 ` [PATCH v5 3/7] ASoC: tegra: i2s: Add support for more than 2 channels Ben Dooks
2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
2019-10-24 16:12   ` Jon Hunter
2019-10-24 16:12     ` [alsa-devel] " Jon Hunter
2019-10-24 19:18     ` Mark Brown
2019-10-24 19:18       ` [alsa-devel] " Mark Brown
2019-10-25  7:48       ` Jon Hunter
2019-10-25  7:48         ` [alsa-devel] " Jon Hunter
2019-10-18 15:48 ` [PATCH v5 4/7] ASoC: tegra: disable rx_fifo after disable stream Ben Dooks
2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
2019-10-24 16:12   ` Jon Hunter
2019-10-24 16:12     ` [alsa-devel] " Jon Hunter
2019-10-25 10:12   ` Applied "ASoC: tegra: disable rx_fifo after disable stream" to the asoc tree Mark Brown
2019-10-25 10:12     ` [alsa-devel] " Mark Brown
2019-10-18 15:48 ` [PATCH v5 5/7] ASoC: tegra: set i2s_offset to 0 for tdm Ben Dooks
2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
2019-10-25  7:58   ` Jon Hunter
2019-10-25  7:58     ` [alsa-devel] " Jon Hunter
2019-10-18 15:48 ` [PATCH v5 6/7] ASoC: tegra: config fifos on hw_param changes Ben Dooks
2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
2019-10-25  8:18   ` Jon Hunter
2019-10-25  8:18     ` [alsa-devel] " Jon Hunter
2019-10-18 15:48 ` [PATCH v5 7/7] ASoC: tegra: take packing settings from the audio cif_config Ben Dooks
2019-10-18 15:48   ` [alsa-devel] " Ben Dooks
2019-10-25  8:47   ` Jon Hunter
2019-10-25  8:47     ` [alsa-devel] " Jon Hunter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.