All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: ti: davinci-mcasp: Fixes for multi serializer setup
@ 2019-06-20  9:20 Peter Ujfalusi
  2019-06-20  9:20 ` [PATCH 1/2] ASoC: ti: davinci-mcasp: Set unused serializers as INACTIVE Peter Ujfalusi
  2019-06-20  9:20 ` [PATCH 2/2] ASoC: ti: davinci-mcasp: Fix slot mask settings when using multiple AXRs Peter Ujfalusi
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Ujfalusi @ 2019-06-20  9:20 UTC (permalink / raw)
  To: broonie, lgirdwood; +Cc: alsa-devel, misael.lopez, jsarha

Hi,

Now that I have access to a board with codec using multiple digital inputs and
outputs (pcm3168a) I found these two issues with the McASP driver:

- unused pins needs to be set as inactive
- the tdm mask is not set correctly when multiple serializers are enabled and
  needed

Regards,
Peter
---
Peter Ujfalusi (2):
  ASoC: ti: davinci-mcasp: Set unused serializers as INACTIVE
  ASoC: ti: davinci-mcasp: Fix slot mask settings when using multiple
    AXRs

 sound/soc/ti/davinci-mcasp.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* [PATCH 1/2] ASoC: ti: davinci-mcasp: Set unused serializers as INACTIVE
  2019-06-20  9:20 [PATCH 0/2] ASoC: ti: davinci-mcasp: Fixes for multi serializer setup Peter Ujfalusi
@ 2019-06-20  9:20 ` Peter Ujfalusi
  2019-06-20 13:32   ` Applied "ASoC: ti: davinci-mcasp: Set unused serializers as INACTIVE" to the asoc tree Mark Brown
  2019-06-20  9:20 ` [PATCH 2/2] ASoC: ti: davinci-mcasp: Fix slot mask settings when using multiple AXRs Peter Ujfalusi
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Ujfalusi @ 2019-06-20  9:20 UTC (permalink / raw)
  To: broonie, lgirdwood; +Cc: alsa-devel, misael.lopez, jsarha

Unused serializers needs to be configured as INACTIVE, otherwise they will
underflow/overflow when multiple serializers are connected, but some are
not needed for the given stream.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 sound/soc/ti/davinci-mcasp.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index a8378d223a9e..8bec0dc4f754 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -848,14 +848,15 @@ static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
 					rx_ser < max_active_serializers) {
 			clear_bit(PIN_BIT_AXR(i), &mcasp->pdir);
 			rx_ser++;
-		} else if (mcasp->serial_dir[i] == INACTIVE_MODE) {
+		} else {
+			/* Inactive or unused pin, set it to inactive */
 			mcasp_mod_bits(mcasp, DAVINCI_MCASP_XRSRCTL_REG(i),
 				       SRMOD_INACTIVE, SRMOD_MASK);
-			clear_bit(PIN_BIT_AXR(i), &mcasp->pdir);
-		} else if (mcasp->serial_dir[i] == TX_MODE) {
-			/* Unused TX pins, clear PDIR  */
-			mcasp_mod_bits(mcasp, DAVINCI_MCASP_XRSRCTL_REG(i),
-				       mcasp->dismod, DISMOD_MASK);
+			/* If unused, set DISMOD for the pin */
+			if (mcasp->serial_dir[i] != INACTIVE_MODE)
+				mcasp_mod_bits(mcasp,
+					       DAVINCI_MCASP_XRSRCTL_REG(i),
+					       mcasp->dismod, DISMOD_MASK);
 			clear_bit(PIN_BIT_AXR(i), &mcasp->pdir);
 		}
 	}
@@ -965,6 +966,7 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream,
 		for (i = 0; i < active_slots; i++)
 			mask |= (1 << i);
 	}
+
 	mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, TX_ASYNC);
 
 	if (!mcasp->dat_port)
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* [PATCH 2/2] ASoC: ti: davinci-mcasp: Fix slot mask settings when using multiple AXRs
  2019-06-20  9:20 [PATCH 0/2] ASoC: ti: davinci-mcasp: Fixes for multi serializer setup Peter Ujfalusi
  2019-06-20  9:20 ` [PATCH 1/2] ASoC: ti: davinci-mcasp: Set unused serializers as INACTIVE Peter Ujfalusi
@ 2019-06-20  9:20 ` Peter Ujfalusi
  2019-06-20 13:32   ` Applied "ASoC: ti: davinci-mcasp: Fix slot mask settings when using multiple AXRs" to the asoc tree Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Ujfalusi @ 2019-06-20  9:20 UTC (permalink / raw)
  To: broonie, lgirdwood; +Cc: alsa-devel, misael.lopez, jsarha

If multiple serializers are connected in the system and the number of
channels will need to use more than one serializer the mask to enable the
serializers were left to 0 if tdm_mask is provided

Fixes: dd55ff8346a97 ("ASoC: davinci-mcasp: Add set_tdm_slots() support")

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 sound/soc/ti/davinci-mcasp.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index 8bec0dc4f754..62222915d632 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -946,14 +946,13 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream,
 		active_slots = hweight32(mcasp->tdm_mask[stream]);
 		active_serializers = (channels + active_slots - 1) /
 			active_slots;
-		if (active_serializers == 1) {
+		if (active_serializers == 1)
 			active_slots = channels;
-			for (i = 0; i < total_slots; i++) {
-				if ((1 << i) & mcasp->tdm_mask[stream]) {
-					mask |= (1 << i);
-					if (--active_slots <= 0)
-						break;
-				}
+		for (i = 0; i < total_slots; i++) {
+			if ((1 << i) & mcasp->tdm_mask[stream]) {
+				mask |= (1 << i);
+				if (--active_slots <= 0)
+					break;
 			}
 		}
 	} else {
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Applied "ASoC: ti: davinci-mcasp: Set unused serializers as INACTIVE" to the asoc tree
  2019-06-20  9:20 ` [PATCH 1/2] ASoC: ti: davinci-mcasp: Set unused serializers as INACTIVE Peter Ujfalusi
@ 2019-06-20 13:32   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2019-06-20 13:32 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: alsa-devel, Mark Brown, lgirdwood, jsarha, misael.lopez

The patch

   ASoC: ti: davinci-mcasp: Set unused serializers as INACTIVE

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3

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 5dd17a3c3ed545f73b8bf7754efd5f6125bf7531 Mon Sep 17 00:00:00 2001
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
Date: Thu, 20 Jun 2019 12:20:01 +0300
Subject: [PATCH] ASoC: ti: davinci-mcasp: Set unused serializers as INACTIVE

Unused serializers needs to be configured as INACTIVE, otherwise they will
underflow/overflow when multiple serializers are connected, but some are
not needed for the given stream.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/ti/davinci-mcasp.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index a8378d223a9e..8bec0dc4f754 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -848,14 +848,15 @@ static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
 					rx_ser < max_active_serializers) {
 			clear_bit(PIN_BIT_AXR(i), &mcasp->pdir);
 			rx_ser++;
-		} else if (mcasp->serial_dir[i] == INACTIVE_MODE) {
+		} else {
+			/* Inactive or unused pin, set it to inactive */
 			mcasp_mod_bits(mcasp, DAVINCI_MCASP_XRSRCTL_REG(i),
 				       SRMOD_INACTIVE, SRMOD_MASK);
-			clear_bit(PIN_BIT_AXR(i), &mcasp->pdir);
-		} else if (mcasp->serial_dir[i] == TX_MODE) {
-			/* Unused TX pins, clear PDIR  */
-			mcasp_mod_bits(mcasp, DAVINCI_MCASP_XRSRCTL_REG(i),
-				       mcasp->dismod, DISMOD_MASK);
+			/* If unused, set DISMOD for the pin */
+			if (mcasp->serial_dir[i] != INACTIVE_MODE)
+				mcasp_mod_bits(mcasp,
+					       DAVINCI_MCASP_XRSRCTL_REG(i),
+					       mcasp->dismod, DISMOD_MASK);
 			clear_bit(PIN_BIT_AXR(i), &mcasp->pdir);
 		}
 	}
@@ -965,6 +966,7 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream,
 		for (i = 0; i < active_slots; i++)
 			mask |= (1 << i);
 	}
+
 	mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, TX_ASYNC);
 
 	if (!mcasp->dat_port)
-- 
2.20.1

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

* Applied "ASoC: ti: davinci-mcasp: Fix slot mask settings when using multiple AXRs" to the asoc tree
  2019-06-20  9:20 ` [PATCH 2/2] ASoC: ti: davinci-mcasp: Fix slot mask settings when using multiple AXRs Peter Ujfalusi
@ 2019-06-20 13:32   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2019-06-20 13:32 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: alsa-devel, Mark Brown, lgirdwood, jsarha, misael.lopez

The patch

   ASoC: ti: davinci-mcasp: Fix slot mask settings when using multiple AXRs

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3

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 fd14f4436fd47d5418023c90e933e66d3645552e Mon Sep 17 00:00:00 2001
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
Date: Thu, 20 Jun 2019 12:20:02 +0300
Subject: [PATCH] ASoC: ti: davinci-mcasp: Fix slot mask settings when using
 multiple AXRs

If multiple serializers are connected in the system and the number of
channels will need to use more than one serializer the mask to enable the
serializers were left to 0 if tdm_mask is provided

Fixes: dd55ff8346a97 ("ASoC: davinci-mcasp: Add set_tdm_slots() support")

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/ti/davinci-mcasp.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index 8bec0dc4f754..62222915d632 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -946,14 +946,13 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream,
 		active_slots = hweight32(mcasp->tdm_mask[stream]);
 		active_serializers = (channels + active_slots - 1) /
 			active_slots;
-		if (active_serializers == 1) {
+		if (active_serializers == 1)
 			active_slots = channels;
-			for (i = 0; i < total_slots; i++) {
-				if ((1 << i) & mcasp->tdm_mask[stream]) {
-					mask |= (1 << i);
-					if (--active_slots <= 0)
-						break;
-				}
+		for (i = 0; i < total_slots; i++) {
+			if ((1 << i) & mcasp->tdm_mask[stream]) {
+				mask |= (1 << i);
+				if (--active_slots <= 0)
+					break;
 			}
 		}
 	} else {
-- 
2.20.1

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

end of thread, other threads:[~2019-06-20 13:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20  9:20 [PATCH 0/2] ASoC: ti: davinci-mcasp: Fixes for multi serializer setup Peter Ujfalusi
2019-06-20  9:20 ` [PATCH 1/2] ASoC: ti: davinci-mcasp: Set unused serializers as INACTIVE Peter Ujfalusi
2019-06-20 13:32   ` Applied "ASoC: ti: davinci-mcasp: Set unused serializers as INACTIVE" to the asoc tree Mark Brown
2019-06-20  9:20 ` [PATCH 2/2] ASoC: ti: davinci-mcasp: Fix slot mask settings when using multiple AXRs Peter Ujfalusi
2019-06-20 13:32   ` Applied "ASoC: ti: davinci-mcasp: Fix slot mask settings when using multiple AXRs" to the asoc tree Mark Brown

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.