All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] ASoC: ti: davinci-mcasp: Fix the DIT mode and OMAP4 support
@ 2021-07-04 15:04 ` Peter Ujfalusi
  0 siblings, 0 replies; 23+ messages in thread
From: Peter Ujfalusi @ 2021-07-04 15:04 UTC (permalink / raw)
  To: broonie, tony; +Cc: alsa-devel, lgirdwood, linux-omap, hns

Hi,

it has been on my todo list for several years to support McASP on OMAP4 devices.
For Galaxy Nexus we had an omap-mcasp driver (which was mostly a stripped down
davinci-mcasp driver) to support what was needed on that specific phone + it's
dock for S/PDIF (48KHz, 16bit, stereo).

Not many (if any) device available to test the DIT mode of McASP.
I have used BeagleBone White (McASP1 AXR3 can be routed to a pin) to get the
S/PDIF mode working then PandaES for OMAP4 support (on PandaES the gpio_121 is
not used and the signal is routed to expansion J6 pin14)

In theory the McASP in OMAP5 should be working after this series, but the OMAP5
TRM is not public and I do not have one to check the addresses and see if there
is a way to test it on omap5-uevm.

Mark, Tony:
The ASoC and dts patches can go via separate tree I felt that it is better if
they are together, at least initially.

Nikolaus: fyi, this might be useful for Pyra?

Regards,
Péter
---
Peter Ujfalusi (5):
  ASoC: ti: davinci-mcasp: Fix DIT mode support
  ASoC: dt-bindings: davinci-mcasp: Add compatible string for OMAP4
  ASoC: ti: davinci-mcasp: Add support for the OMAP4 version of McASP
  ARM: dts: omap4-l4-abe: Correct sidle modes for McASP
  ARM: dts: omap4-l4-abe: Add McASP configuration

 .../bindings/sound/davinci-mcasp-audio.txt    |   1 +
 arch/arm/boot/dts/omap4-l4-abe.dtsi           |  39 ++--
 include/linux/platform_data/davinci_asp.h     |   1 +
 sound/soc/ti/Kconfig                          |   1 +
 sound/soc/ti/davinci-mcasp.c                  | 168 +++++++++++++++---
 5 files changed, 168 insertions(+), 42 deletions(-)

-- 
2.32.0


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

* [PATCH 0/5] ASoC: ti: davinci-mcasp: Fix the DIT mode and OMAP4 support
@ 2021-07-04 15:04 ` Peter Ujfalusi
  0 siblings, 0 replies; 23+ messages in thread
From: Peter Ujfalusi @ 2021-07-04 15:04 UTC (permalink / raw)
  To: broonie, tony; +Cc: hns, alsa-devel, linux-omap, lgirdwood

Hi,

it has been on my todo list for several years to support McASP on OMAP4 devices.
For Galaxy Nexus we had an omap-mcasp driver (which was mostly a stripped down
davinci-mcasp driver) to support what was needed on that specific phone + it's
dock for S/PDIF (48KHz, 16bit, stereo).

Not many (if any) device available to test the DIT mode of McASP.
I have used BeagleBone White (McASP1 AXR3 can be routed to a pin) to get the
S/PDIF mode working then PandaES for OMAP4 support (on PandaES the gpio_121 is
not used and the signal is routed to expansion J6 pin14)

In theory the McASP in OMAP5 should be working after this series, but the OMAP5
TRM is not public and I do not have one to check the addresses and see if there
is a way to test it on omap5-uevm.

Mark, Tony:
The ASoC and dts patches can go via separate tree I felt that it is better if
they are together, at least initially.

Nikolaus: fyi, this might be useful for Pyra?

Regards,
Péter
---
Peter Ujfalusi (5):
  ASoC: ti: davinci-mcasp: Fix DIT mode support
  ASoC: dt-bindings: davinci-mcasp: Add compatible string for OMAP4
  ASoC: ti: davinci-mcasp: Add support for the OMAP4 version of McASP
  ARM: dts: omap4-l4-abe: Correct sidle modes for McASP
  ARM: dts: omap4-l4-abe: Add McASP configuration

 .../bindings/sound/davinci-mcasp-audio.txt    |   1 +
 arch/arm/boot/dts/omap4-l4-abe.dtsi           |  39 ++--
 include/linux/platform_data/davinci_asp.h     |   1 +
 sound/soc/ti/Kconfig                          |   1 +
 sound/soc/ti/davinci-mcasp.c                  | 168 +++++++++++++++---
 5 files changed, 168 insertions(+), 42 deletions(-)

-- 
2.32.0


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

* [PATCH 1/5] ASoC: ti: davinci-mcasp: Fix DIT mode support
  2021-07-04 15:04 ` Peter Ujfalusi
@ 2021-07-04 15:04   ` Peter Ujfalusi
  -1 siblings, 0 replies; 23+ messages in thread
From: Peter Ujfalusi @ 2021-07-04 15:04 UTC (permalink / raw)
  To: broonie, tony; +Cc: alsa-devel, lgirdwood, linux-omap, hns

The DIT mode support has not been tested due to lack of platform where it
can be tested.
To be able to use the McASP on OMAP4/5 (only supporting DIT mode) we need
to have DIT mode working in the McASP driver on a know platform.
After hacking around (on BBW, mcasp1.axr1 can be routed out for this) it
appeared that DIT mode is broken.

This patch fixes it up and 16/24 bit audio works along with passthrough,
but I have only tested with DTS example and test files.

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

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index 017a5a5e56cd..e56a22c28467 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -83,6 +83,8 @@ struct davinci_mcasp {
 	struct snd_pcm_substream *substreams[2];
 	unsigned int dai_fmt;
 
+	u32 iec958_status;
+
 	/* Audio can not be enabled due to missing parameter(s) */
 	bool	missing_audio_param;
 
@@ -757,6 +759,9 @@ static int davinci_mcasp_set_tdm_slot(struct snd_soc_dai *dai,
 {
 	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
 
+	if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE)
+		return 0;
+
 	dev_dbg(mcasp->dev,
 		 "%s() tx_mask 0x%08x rx_mask 0x%08x slots %d width %d\n",
 		 __func__, tx_mask, rx_mask, slots, slot_width);
@@ -827,6 +832,20 @@ static int davinci_config_channel_size(struct davinci_mcasp *mcasp,
 		mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, RXROT(rx_rotate),
 			       RXROT(7));
 		mcasp_set_reg(mcasp, DAVINCI_MCASP_RXMASK_REG, mask);
+	} else {
+		/*
+		 * according to the TRM it should be TXROT=0, this one works:
+		 * 16 bit to 23-8 (TXROT=6, rotate 24 bits)
+		 * 24 bit to 23-0 (TXROT=0, rotate 0 bits)
+		 *
+		 * TXROT = 0 only works with 24bit samples
+		 */
+		tx_rotate = (sample_width / 4 + 2) & 0x7;
+
+		mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXROT(tx_rotate),
+			       TXROT(7));
+		mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXSSZ(15),
+			       TXSSZ(0x0F));
 	}
 
 	mcasp_set_reg(mcasp, DAVINCI_MCASP_TXMASK_REG, mask);
@@ -841,7 +860,7 @@ static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
 	int i;
 	u8 tx_ser = 0;
 	u8 rx_ser = 0;
-	u8 slots = mcasp->tdm_slots;
+	u8 slots = mcasp->op_mode == DAVINCI_MCASP_DIT_MODE ? 384 : mcasp->tdm_slots;
 	u8 max_active_serializers = (channels + slots - 1) / slots;
 	u8 max_rx_serializers, max_tx_serializers;
 	int active_serializers, numevt;
@@ -1031,16 +1050,18 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream,
 static int mcasp_dit_hw_param(struct davinci_mcasp *mcasp,
 			      unsigned int rate)
 {
-	u32 cs_value = 0;
-	u8 *cs_bytes = (u8*) &cs_value;
+	u8 *cs_bytes = (u8 *)&mcasp->iec958_status;
 
-	/* Set the TX format : 24 bit right rotation, 32 bit slot, Pad 0
-	   and LSB first */
-	mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXROT(6) | TXSSZ(15));
+	if (!mcasp->dat_port)
+		mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXSEL);
+	else
+		mcasp_clr_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXSEL);
 
 	/* Set TX frame synch : DIT Mode, 1 bit width, internal, rising edge */
 	mcasp_set_reg(mcasp, DAVINCI_MCASP_TXFMCTL_REG, AFSXE | FSXMOD(0x180));
 
+	mcasp_set_reg(mcasp, DAVINCI_MCASP_TXMASK_REG, 0xFFFF);
+
 	/* Set the TX tdm : for all the slots */
 	mcasp_set_reg(mcasp, DAVINCI_MCASP_TXTDM_REG, 0xFFFFFFFF);
 
@@ -1049,16 +1070,8 @@ static int mcasp_dit_hw_param(struct davinci_mcasp *mcasp,
 
 	mcasp_clr_bits(mcasp, DAVINCI_MCASP_XEVTCTL_REG, TXDATADMADIS);
 
-	/* Only 44100 and 48000 are valid, both have the same setting */
-	mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXDIV(3));
-
-	/* Enable the DIT */
-	mcasp_set_bits(mcasp, DAVINCI_MCASP_TXDITCTL_REG, DITEN);
-
 	/* Set S/PDIF channel status bits */
-	cs_bytes[0] = IEC958_AES0_CON_NOT_COPYRIGHT;
-	cs_bytes[1] = IEC958_AES1_CON_PCM_CODER;
-
+	cs_bytes[3] &= ~IEC958_AES3_CON_FS;
 	switch (rate) {
 	case 22050:
 		cs_bytes[3] |= IEC958_AES3_CON_FS_22050;
@@ -1088,12 +1101,15 @@ static int mcasp_dit_hw_param(struct davinci_mcasp *mcasp,
 		cs_bytes[3] |= IEC958_AES3_CON_FS_192000;
 		break;
 	default:
-		printk(KERN_WARNING "unsupported sampling rate: %d\n", rate);
+		dev_err(mcasp->dev, "unsupported sampling rate: %d\n", rate);
 		return -EINVAL;
 	}
 
-	mcasp_set_reg(mcasp, DAVINCI_MCASP_DITCSRA_REG, cs_value);
-	mcasp_set_reg(mcasp, DAVINCI_MCASP_DITCSRB_REG, cs_value);
+	mcasp_set_reg(mcasp, DAVINCI_MCASP_DITCSRA_REG, mcasp->iec958_status);
+	mcasp_set_reg(mcasp, DAVINCI_MCASP_DITCSRB_REG, mcasp->iec958_status);
+
+	/* Enable the DIT */
+	mcasp_set_bits(mcasp, DAVINCI_MCASP_TXDITCTL_REG, DITEN);
 
 	return 0;
 }
@@ -1237,12 +1253,18 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
 		int slots = mcasp->tdm_slots;
 		int rate = params_rate(params);
 		int sbits = params_width(params);
+		unsigned int bclk_target;
 
 		if (mcasp->slot_width)
 			sbits = mcasp->slot_width;
 
+		if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE)
+			bclk_target = rate * sbits * slots;
+		else
+			bclk_target = rate * 128;
+
 		davinci_mcasp_calc_clk_div(mcasp, mcasp->sysclk_freq,
-					   rate * sbits * slots, true);
+					   bclk_target, true);
 	}
 
 	ret = mcasp_common_hw_param(mcasp, substream->stream,
@@ -1598,6 +1620,77 @@ static const struct snd_soc_dai_ops davinci_mcasp_dai_ops = {
 	.set_tdm_slot	= davinci_mcasp_set_tdm_slot,
 };
 
+static int davinci_mcasp_iec958_info(struct snd_kcontrol *kcontrol,
+				     struct snd_ctl_elem_info *uinfo)
+{
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
+	uinfo->count = 1;
+
+	return 0;
+}
+
+static int davinci_mcasp_iec958_get(struct snd_kcontrol *kcontrol,
+				    struct snd_ctl_elem_value *uctl)
+{
+	struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol);
+	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(cpu_dai);
+
+	memcpy(uctl->value.iec958.status, &mcasp->iec958_status,
+	       sizeof(mcasp->iec958_status));
+
+	return 0;
+}
+
+static int davinci_mcasp_iec958_put(struct snd_kcontrol *kcontrol,
+				    struct snd_ctl_elem_value *uctl)
+{
+	struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol);
+	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(cpu_dai);
+
+	memcpy(&mcasp->iec958_status, uctl->value.iec958.status,
+	       sizeof(mcasp->iec958_status));
+
+	return 0;
+}
+
+static int davinci_mcasp_iec958_con_mask_get(struct snd_kcontrol *kcontrol,
+					     struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol);
+	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(cpu_dai);
+
+	memset(ucontrol->value.iec958.status, 0xff, sizeof(mcasp->iec958_status));
+	return 0;
+}
+
+static const struct snd_kcontrol_new davinci_mcasp_iec958_ctls[] = {
+	{
+		.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+			   SNDRV_CTL_ELEM_ACCESS_VOLATILE),
+		.iface = SNDRV_CTL_ELEM_IFACE_PCM,
+		.name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
+		.info = davinci_mcasp_iec958_info,
+		.get = davinci_mcasp_iec958_get,
+		.put = davinci_mcasp_iec958_put,
+	}, {
+		.access = SNDRV_CTL_ELEM_ACCESS_READ,
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK),
+		.info = davinci_mcasp_iec958_info,
+		.get = davinci_mcasp_iec958_con_mask_get,
+	},
+};
+
+static void davinci_mcasp_init_iec958_status(struct davinci_mcasp *mcasp)
+{
+	unsigned char *cs = (u8 *)&mcasp->iec958_status;
+
+	cs[0] = IEC958_AES0_CON_NOT_COPYRIGHT | IEC958_AES0_CON_EMPHASIS_NONE;
+	cs[1] = IEC958_AES1_CON_PCM_CODER;
+	cs[2] = IEC958_AES2_CON_SOURCE_UNSPEC | IEC958_AES2_CON_CHANNEL_UNSPEC;
+	cs[3] = IEC958_AES3_CON_CLOCK_1000PPM;
+}
+
 static int davinci_mcasp_dai_probe(struct snd_soc_dai *dai)
 {
 	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
@@ -1605,6 +1698,12 @@ static int davinci_mcasp_dai_probe(struct snd_soc_dai *dai)
 	dai->playback_dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
 	dai->capture_dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE];
 
+	if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE) {
+		davinci_mcasp_init_iec958_status(mcasp);
+		snd_soc_add_dai_controls(dai, davinci_mcasp_iec958_ctls,
+					 ARRAY_SIZE(davinci_mcasp_iec958_ctls));
+	}
+
 	return 0;
 }
 
@@ -1651,7 +1750,8 @@ static struct snd_soc_dai_driver davinci_mcasp_dai[] = {
 			.channels_min	= 1,
 			.channels_max	= 384,
 			.rates		= DAVINCI_MCASP_RATES,
-			.formats	= DAVINCI_MCASP_PCM_FMTS,
+			.formats	= SNDRV_PCM_FMTBIT_S16_LE |
+					  SNDRV_PCM_FMTBIT_S24_LE,
 		},
 		.ops 		= &davinci_mcasp_dai_ops,
 	},
@@ -1871,6 +1971,8 @@ static int davinci_mcasp_get_config(struct davinci_mcasp *mcasp,
 		} else {
 			mcasp->tdm_slots = pdata->tdm_slots;
 		}
+	} else {
+		mcasp->tdm_slots = 32;
 	}
 
 	mcasp->num_serializer = pdata->num_serializer;
-- 
2.32.0


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

* [PATCH 1/5] ASoC: ti: davinci-mcasp: Fix DIT mode support
@ 2021-07-04 15:04   ` Peter Ujfalusi
  0 siblings, 0 replies; 23+ messages in thread
From: Peter Ujfalusi @ 2021-07-04 15:04 UTC (permalink / raw)
  To: broonie, tony; +Cc: hns, alsa-devel, linux-omap, lgirdwood

The DIT mode support has not been tested due to lack of platform where it
can be tested.
To be able to use the McASP on OMAP4/5 (only supporting DIT mode) we need
to have DIT mode working in the McASP driver on a know platform.
After hacking around (on BBW, mcasp1.axr1 can be routed out for this) it
appeared that DIT mode is broken.

This patch fixes it up and 16/24 bit audio works along with passthrough,
but I have only tested with DTS example and test files.

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

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index 017a5a5e56cd..e56a22c28467 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -83,6 +83,8 @@ struct davinci_mcasp {
 	struct snd_pcm_substream *substreams[2];
 	unsigned int dai_fmt;
 
+	u32 iec958_status;
+
 	/* Audio can not be enabled due to missing parameter(s) */
 	bool	missing_audio_param;
 
@@ -757,6 +759,9 @@ static int davinci_mcasp_set_tdm_slot(struct snd_soc_dai *dai,
 {
 	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
 
+	if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE)
+		return 0;
+
 	dev_dbg(mcasp->dev,
 		 "%s() tx_mask 0x%08x rx_mask 0x%08x slots %d width %d\n",
 		 __func__, tx_mask, rx_mask, slots, slot_width);
@@ -827,6 +832,20 @@ static int davinci_config_channel_size(struct davinci_mcasp *mcasp,
 		mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, RXROT(rx_rotate),
 			       RXROT(7));
 		mcasp_set_reg(mcasp, DAVINCI_MCASP_RXMASK_REG, mask);
+	} else {
+		/*
+		 * according to the TRM it should be TXROT=0, this one works:
+		 * 16 bit to 23-8 (TXROT=6, rotate 24 bits)
+		 * 24 bit to 23-0 (TXROT=0, rotate 0 bits)
+		 *
+		 * TXROT = 0 only works with 24bit samples
+		 */
+		tx_rotate = (sample_width / 4 + 2) & 0x7;
+
+		mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXROT(tx_rotate),
+			       TXROT(7));
+		mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXSSZ(15),
+			       TXSSZ(0x0F));
 	}
 
 	mcasp_set_reg(mcasp, DAVINCI_MCASP_TXMASK_REG, mask);
@@ -841,7 +860,7 @@ static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
 	int i;
 	u8 tx_ser = 0;
 	u8 rx_ser = 0;
-	u8 slots = mcasp->tdm_slots;
+	u8 slots = mcasp->op_mode == DAVINCI_MCASP_DIT_MODE ? 384 : mcasp->tdm_slots;
 	u8 max_active_serializers = (channels + slots - 1) / slots;
 	u8 max_rx_serializers, max_tx_serializers;
 	int active_serializers, numevt;
@@ -1031,16 +1050,18 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream,
 static int mcasp_dit_hw_param(struct davinci_mcasp *mcasp,
 			      unsigned int rate)
 {
-	u32 cs_value = 0;
-	u8 *cs_bytes = (u8*) &cs_value;
+	u8 *cs_bytes = (u8 *)&mcasp->iec958_status;
 
-	/* Set the TX format : 24 bit right rotation, 32 bit slot, Pad 0
-	   and LSB first */
-	mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXROT(6) | TXSSZ(15));
+	if (!mcasp->dat_port)
+		mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXSEL);
+	else
+		mcasp_clr_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXSEL);
 
 	/* Set TX frame synch : DIT Mode, 1 bit width, internal, rising edge */
 	mcasp_set_reg(mcasp, DAVINCI_MCASP_TXFMCTL_REG, AFSXE | FSXMOD(0x180));
 
+	mcasp_set_reg(mcasp, DAVINCI_MCASP_TXMASK_REG, 0xFFFF);
+
 	/* Set the TX tdm : for all the slots */
 	mcasp_set_reg(mcasp, DAVINCI_MCASP_TXTDM_REG, 0xFFFFFFFF);
 
@@ -1049,16 +1070,8 @@ static int mcasp_dit_hw_param(struct davinci_mcasp *mcasp,
 
 	mcasp_clr_bits(mcasp, DAVINCI_MCASP_XEVTCTL_REG, TXDATADMADIS);
 
-	/* Only 44100 and 48000 are valid, both have the same setting */
-	mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXDIV(3));
-
-	/* Enable the DIT */
-	mcasp_set_bits(mcasp, DAVINCI_MCASP_TXDITCTL_REG, DITEN);
-
 	/* Set S/PDIF channel status bits */
-	cs_bytes[0] = IEC958_AES0_CON_NOT_COPYRIGHT;
-	cs_bytes[1] = IEC958_AES1_CON_PCM_CODER;
-
+	cs_bytes[3] &= ~IEC958_AES3_CON_FS;
 	switch (rate) {
 	case 22050:
 		cs_bytes[3] |= IEC958_AES3_CON_FS_22050;
@@ -1088,12 +1101,15 @@ static int mcasp_dit_hw_param(struct davinci_mcasp *mcasp,
 		cs_bytes[3] |= IEC958_AES3_CON_FS_192000;
 		break;
 	default:
-		printk(KERN_WARNING "unsupported sampling rate: %d\n", rate);
+		dev_err(mcasp->dev, "unsupported sampling rate: %d\n", rate);
 		return -EINVAL;
 	}
 
-	mcasp_set_reg(mcasp, DAVINCI_MCASP_DITCSRA_REG, cs_value);
-	mcasp_set_reg(mcasp, DAVINCI_MCASP_DITCSRB_REG, cs_value);
+	mcasp_set_reg(mcasp, DAVINCI_MCASP_DITCSRA_REG, mcasp->iec958_status);
+	mcasp_set_reg(mcasp, DAVINCI_MCASP_DITCSRB_REG, mcasp->iec958_status);
+
+	/* Enable the DIT */
+	mcasp_set_bits(mcasp, DAVINCI_MCASP_TXDITCTL_REG, DITEN);
 
 	return 0;
 }
@@ -1237,12 +1253,18 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
 		int slots = mcasp->tdm_slots;
 		int rate = params_rate(params);
 		int sbits = params_width(params);
+		unsigned int bclk_target;
 
 		if (mcasp->slot_width)
 			sbits = mcasp->slot_width;
 
+		if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE)
+			bclk_target = rate * sbits * slots;
+		else
+			bclk_target = rate * 128;
+
 		davinci_mcasp_calc_clk_div(mcasp, mcasp->sysclk_freq,
-					   rate * sbits * slots, true);
+					   bclk_target, true);
 	}
 
 	ret = mcasp_common_hw_param(mcasp, substream->stream,
@@ -1598,6 +1620,77 @@ static const struct snd_soc_dai_ops davinci_mcasp_dai_ops = {
 	.set_tdm_slot	= davinci_mcasp_set_tdm_slot,
 };
 
+static int davinci_mcasp_iec958_info(struct snd_kcontrol *kcontrol,
+				     struct snd_ctl_elem_info *uinfo)
+{
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
+	uinfo->count = 1;
+
+	return 0;
+}
+
+static int davinci_mcasp_iec958_get(struct snd_kcontrol *kcontrol,
+				    struct snd_ctl_elem_value *uctl)
+{
+	struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol);
+	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(cpu_dai);
+
+	memcpy(uctl->value.iec958.status, &mcasp->iec958_status,
+	       sizeof(mcasp->iec958_status));
+
+	return 0;
+}
+
+static int davinci_mcasp_iec958_put(struct snd_kcontrol *kcontrol,
+				    struct snd_ctl_elem_value *uctl)
+{
+	struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol);
+	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(cpu_dai);
+
+	memcpy(&mcasp->iec958_status, uctl->value.iec958.status,
+	       sizeof(mcasp->iec958_status));
+
+	return 0;
+}
+
+static int davinci_mcasp_iec958_con_mask_get(struct snd_kcontrol *kcontrol,
+					     struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol);
+	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(cpu_dai);
+
+	memset(ucontrol->value.iec958.status, 0xff, sizeof(mcasp->iec958_status));
+	return 0;
+}
+
+static const struct snd_kcontrol_new davinci_mcasp_iec958_ctls[] = {
+	{
+		.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+			   SNDRV_CTL_ELEM_ACCESS_VOLATILE),
+		.iface = SNDRV_CTL_ELEM_IFACE_PCM,
+		.name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
+		.info = davinci_mcasp_iec958_info,
+		.get = davinci_mcasp_iec958_get,
+		.put = davinci_mcasp_iec958_put,
+	}, {
+		.access = SNDRV_CTL_ELEM_ACCESS_READ,
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK),
+		.info = davinci_mcasp_iec958_info,
+		.get = davinci_mcasp_iec958_con_mask_get,
+	},
+};
+
+static void davinci_mcasp_init_iec958_status(struct davinci_mcasp *mcasp)
+{
+	unsigned char *cs = (u8 *)&mcasp->iec958_status;
+
+	cs[0] = IEC958_AES0_CON_NOT_COPYRIGHT | IEC958_AES0_CON_EMPHASIS_NONE;
+	cs[1] = IEC958_AES1_CON_PCM_CODER;
+	cs[2] = IEC958_AES2_CON_SOURCE_UNSPEC | IEC958_AES2_CON_CHANNEL_UNSPEC;
+	cs[3] = IEC958_AES3_CON_CLOCK_1000PPM;
+}
+
 static int davinci_mcasp_dai_probe(struct snd_soc_dai *dai)
 {
 	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
@@ -1605,6 +1698,12 @@ static int davinci_mcasp_dai_probe(struct snd_soc_dai *dai)
 	dai->playback_dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
 	dai->capture_dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE];
 
+	if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE) {
+		davinci_mcasp_init_iec958_status(mcasp);
+		snd_soc_add_dai_controls(dai, davinci_mcasp_iec958_ctls,
+					 ARRAY_SIZE(davinci_mcasp_iec958_ctls));
+	}
+
 	return 0;
 }
 
@@ -1651,7 +1750,8 @@ static struct snd_soc_dai_driver davinci_mcasp_dai[] = {
 			.channels_min	= 1,
 			.channels_max	= 384,
 			.rates		= DAVINCI_MCASP_RATES,
-			.formats	= DAVINCI_MCASP_PCM_FMTS,
+			.formats	= SNDRV_PCM_FMTBIT_S16_LE |
+					  SNDRV_PCM_FMTBIT_S24_LE,
 		},
 		.ops 		= &davinci_mcasp_dai_ops,
 	},
@@ -1871,6 +1971,8 @@ static int davinci_mcasp_get_config(struct davinci_mcasp *mcasp,
 		} else {
 			mcasp->tdm_slots = pdata->tdm_slots;
 		}
+	} else {
+		mcasp->tdm_slots = 32;
 	}
 
 	mcasp->num_serializer = pdata->num_serializer;
-- 
2.32.0


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

* [PATCH 2/5] ASoC: dt-bindings: davinci-mcasp: Add compatible string for OMAP4
  2021-07-04 15:04 ` Peter Ujfalusi
@ 2021-07-04 15:04   ` Peter Ujfalusi
  -1 siblings, 0 replies; 23+ messages in thread
From: Peter Ujfalusi @ 2021-07-04 15:04 UTC (permalink / raw)
  To: broonie, tony; +Cc: alsa-devel, lgirdwood, linux-omap, hns

OMAP4 has one McASP instance with single serializer and supporting only
DIT mode.
According to the TRM the DAT port needs to be accessed as specific offset
compared to other devices where access to any part of the DAT region is
valid.
To handle this constraint we need to introduce a new compatiple string for
OMAP4.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
---
 Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
index c483dcec01f8..bd863bd69501 100644
--- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
+++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
@@ -6,6 +6,7 @@ Required properties:
 	"ti,da830-mcasp-audio"	: for both DA830 & DA850 platforms
 	"ti,am33xx-mcasp-audio"	: for AM33xx platforms (AM33xx, AM43xx, TI81xx)
 	"ti,dra7-mcasp-audio"	: for DRA7xx platforms
+	"ti,omap4-mcasp-audio"	: for OMAP4
 
 - reg : Should contain reg specifiers for the entries in the reg-names property.
 - reg-names : Should contain:
-- 
2.32.0


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

* [PATCH 2/5] ASoC: dt-bindings: davinci-mcasp: Add compatible string for OMAP4
@ 2021-07-04 15:04   ` Peter Ujfalusi
  0 siblings, 0 replies; 23+ messages in thread
From: Peter Ujfalusi @ 2021-07-04 15:04 UTC (permalink / raw)
  To: broonie, tony; +Cc: hns, alsa-devel, linux-omap, lgirdwood

OMAP4 has one McASP instance with single serializer and supporting only
DIT mode.
According to the TRM the DAT port needs to be accessed as specific offset
compared to other devices where access to any part of the DAT region is
valid.
To handle this constraint we need to introduce a new compatiple string for
OMAP4.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
---
 Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
index c483dcec01f8..bd863bd69501 100644
--- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
+++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
@@ -6,6 +6,7 @@ Required properties:
 	"ti,da830-mcasp-audio"	: for both DA830 & DA850 platforms
 	"ti,am33xx-mcasp-audio"	: for AM33xx platforms (AM33xx, AM43xx, TI81xx)
 	"ti,dra7-mcasp-audio"	: for DRA7xx platforms
+	"ti,omap4-mcasp-audio"	: for OMAP4
 
 - reg : Should contain reg specifiers for the entries in the reg-names property.
 - reg-names : Should contain:
-- 
2.32.0


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

* [PATCH 3/5] ASoC: ti: davinci-mcasp: Add support for the OMAP4 version of McASP
  2021-07-04 15:04 ` Peter Ujfalusi
@ 2021-07-04 15:04   ` Peter Ujfalusi
  -1 siblings, 0 replies; 23+ messages in thread
From: Peter Ujfalusi @ 2021-07-04 15:04 UTC (permalink / raw)
  To: broonie, tony; +Cc: alsa-devel, lgirdwood, linux-omap, hns

From: Peter Ujfalusi <peter.ujfalusi@ti.com>

There is a single McASP on OMAP4 (and OMAP5) which is configured to only
support DIT playback mode on a single serializer.

Add 0x200 offset to DAT port address as the TRM suggests it.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 include/linux/platform_data/davinci_asp.h |  1 +
 sound/soc/ti/Kconfig                      |  1 +
 sound/soc/ti/davinci-mcasp.c              | 26 ++++++++++++++++++++---
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h
index 5d1fb0d78a22..76b13ef67562 100644
--- a/include/linux/platform_data/davinci_asp.h
+++ b/include/linux/platform_data/davinci_asp.h
@@ -96,6 +96,7 @@ enum {
 	MCASP_VERSION_2,	/* DA8xx/OMAPL1x */
 	MCASP_VERSION_3,        /* TI81xx/AM33xx */
 	MCASP_VERSION_4,	/* DRA7xxx */
+	MCASP_VERSION_OMAP,	/* OMAP4/5 */
 };
 
 enum mcbsp_clk_input_pin {
diff --git a/sound/soc/ti/Kconfig b/sound/soc/ti/Kconfig
index 698d7bc84dcf..1d9fe3fca193 100644
--- a/sound/soc/ti/Kconfig
+++ b/sound/soc/ti/Kconfig
@@ -35,6 +35,7 @@ config SND_SOC_DAVINCI_MCASP
 	  various Texas Instruments SoCs like:
 	  - daVinci devices
 	  - Sitara line of SoCs (AM335x, AM438x, etc)
+	  - OMAP4
 	  - DRA7x devices
 	  - Keystone devices
 	  - K3 devices (am654, j721e)
diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index e56a22c28467..f453728d2afc 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -1788,6 +1788,12 @@ static struct davinci_mcasp_pdata dra7_mcasp_pdata = {
 	.version = MCASP_VERSION_4,
 };
 
+static struct davinci_mcasp_pdata omap_mcasp_pdata = {
+	.tx_dma_offset = 0x200,
+	.rx_dma_offset = 0,
+	.version = MCASP_VERSION_OMAP,
+};
+
 static const struct of_device_id mcasp_dt_ids[] = {
 	{
 		.compatible = "ti,dm646x-mcasp-audio",
@@ -1805,6 +1811,10 @@ static const struct of_device_id mcasp_dt_ids[] = {
 		.compatible = "ti,dra7-mcasp-audio",
 		.data = &dra7_mcasp_pdata,
 	},
+	{
+		.compatible = "ti,omap4-mcasp-audio",
+		.data = &omap_mcasp_pdata,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mcasp_dt_ids);
@@ -2344,10 +2354,17 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 
 	dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
 	dma_data->filter_data = "tx";
-	if (dat)
+	if (dat) {
 		dma_data->addr = dat->start;
-	else
+		/*
+		 * According to the TRM there should be 0x200 offset added to
+		 * the DAT port address
+		 */
+		if (mcasp->version == MCASP_VERSION_OMAP)
+			dma_data->addr += davinci_mcasp_txdma_offset(mcasp->pdata);
+	} else {
 		dma_data->addr = mem->start + davinci_mcasp_txdma_offset(mcasp->pdata);
+	}
 
 
 	/* RX is not valid in DIT mode */
@@ -2412,7 +2429,10 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 		ret = edma_pcm_platform_register(&pdev->dev);
 		break;
 	case PCM_SDMA:
-		ret = sdma_pcm_platform_register(&pdev->dev, "tx", "rx");
+		if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE)
+			ret = sdma_pcm_platform_register(&pdev->dev, "tx", "rx");
+		else
+			ret = sdma_pcm_platform_register(&pdev->dev, "tx", NULL);
 		break;
 	case PCM_UDMA:
 		ret = udma_pcm_platform_register(&pdev->dev);
-- 
2.32.0


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

* [PATCH 3/5] ASoC: ti: davinci-mcasp: Add support for the OMAP4 version of McASP
@ 2021-07-04 15:04   ` Peter Ujfalusi
  0 siblings, 0 replies; 23+ messages in thread
From: Peter Ujfalusi @ 2021-07-04 15:04 UTC (permalink / raw)
  To: broonie, tony; +Cc: hns, alsa-devel, linux-omap, lgirdwood

From: Peter Ujfalusi <peter.ujfalusi@ti.com>

There is a single McASP on OMAP4 (and OMAP5) which is configured to only
support DIT playback mode on a single serializer.

Add 0x200 offset to DAT port address as the TRM suggests it.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 include/linux/platform_data/davinci_asp.h |  1 +
 sound/soc/ti/Kconfig                      |  1 +
 sound/soc/ti/davinci-mcasp.c              | 26 ++++++++++++++++++++---
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h
index 5d1fb0d78a22..76b13ef67562 100644
--- a/include/linux/platform_data/davinci_asp.h
+++ b/include/linux/platform_data/davinci_asp.h
@@ -96,6 +96,7 @@ enum {
 	MCASP_VERSION_2,	/* DA8xx/OMAPL1x */
 	MCASP_VERSION_3,        /* TI81xx/AM33xx */
 	MCASP_VERSION_4,	/* DRA7xxx */
+	MCASP_VERSION_OMAP,	/* OMAP4/5 */
 };
 
 enum mcbsp_clk_input_pin {
diff --git a/sound/soc/ti/Kconfig b/sound/soc/ti/Kconfig
index 698d7bc84dcf..1d9fe3fca193 100644
--- a/sound/soc/ti/Kconfig
+++ b/sound/soc/ti/Kconfig
@@ -35,6 +35,7 @@ config SND_SOC_DAVINCI_MCASP
 	  various Texas Instruments SoCs like:
 	  - daVinci devices
 	  - Sitara line of SoCs (AM335x, AM438x, etc)
+	  - OMAP4
 	  - DRA7x devices
 	  - Keystone devices
 	  - K3 devices (am654, j721e)
diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index e56a22c28467..f453728d2afc 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -1788,6 +1788,12 @@ static struct davinci_mcasp_pdata dra7_mcasp_pdata = {
 	.version = MCASP_VERSION_4,
 };
 
+static struct davinci_mcasp_pdata omap_mcasp_pdata = {
+	.tx_dma_offset = 0x200,
+	.rx_dma_offset = 0,
+	.version = MCASP_VERSION_OMAP,
+};
+
 static const struct of_device_id mcasp_dt_ids[] = {
 	{
 		.compatible = "ti,dm646x-mcasp-audio",
@@ -1805,6 +1811,10 @@ static const struct of_device_id mcasp_dt_ids[] = {
 		.compatible = "ti,dra7-mcasp-audio",
 		.data = &dra7_mcasp_pdata,
 	},
+	{
+		.compatible = "ti,omap4-mcasp-audio",
+		.data = &omap_mcasp_pdata,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mcasp_dt_ids);
@@ -2344,10 +2354,17 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 
 	dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
 	dma_data->filter_data = "tx";
-	if (dat)
+	if (dat) {
 		dma_data->addr = dat->start;
-	else
+		/*
+		 * According to the TRM there should be 0x200 offset added to
+		 * the DAT port address
+		 */
+		if (mcasp->version == MCASP_VERSION_OMAP)
+			dma_data->addr += davinci_mcasp_txdma_offset(mcasp->pdata);
+	} else {
 		dma_data->addr = mem->start + davinci_mcasp_txdma_offset(mcasp->pdata);
+	}
 
 
 	/* RX is not valid in DIT mode */
@@ -2412,7 +2429,10 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 		ret = edma_pcm_platform_register(&pdev->dev);
 		break;
 	case PCM_SDMA:
-		ret = sdma_pcm_platform_register(&pdev->dev, "tx", "rx");
+		if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE)
+			ret = sdma_pcm_platform_register(&pdev->dev, "tx", "rx");
+		else
+			ret = sdma_pcm_platform_register(&pdev->dev, "tx", NULL);
 		break;
 	case PCM_UDMA:
 		ret = udma_pcm_platform_register(&pdev->dev);
-- 
2.32.0


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

* [PATCH 4/5] ARM: dts: omap4-l4-abe: Correct sidle modes for McASP
  2021-07-04 15:04 ` Peter Ujfalusi
@ 2021-07-04 15:04   ` Peter Ujfalusi
  -1 siblings, 0 replies; 23+ messages in thread
From: Peter Ujfalusi @ 2021-07-04 15:04 UTC (permalink / raw)
  To: broonie, tony; +Cc: alsa-devel, lgirdwood, linux-omap, hns

McASP only supports  Force-idle, No-idle and Smart-idle modes

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
---
 arch/arm/boot/dts/omap4-l4-abe.dtsi | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-l4-abe.dtsi b/arch/arm/boot/dts/omap4-l4-abe.dtsi
index a9573d441dea..8287fdaa526e 100644
--- a/arch/arm/boot/dts/omap4-l4-abe.dtsi
+++ b/arch/arm/boot/dts/omap4-l4-abe.dtsi
@@ -192,8 +192,7 @@ target-module@28000 {			/* 0x40128000, ap 8 08.0 */
 			reg-names = "rev", "sysc";
 			ti,sysc-sidle = <SYSC_IDLE_FORCE>,
 					<SYSC_IDLE_NO>,
-					<SYSC_IDLE_SMART>,
-					<SYSC_IDLE_SMART_WKUP>;
+					<SYSC_IDLE_SMART>;
 			/* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
 			clocks = <&abe_clkctrl OMAP4_MCASP_CLKCTRL 0>;
 			clock-names = "fck";
-- 
2.32.0


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

* [PATCH 4/5] ARM: dts: omap4-l4-abe: Correct sidle modes for McASP
@ 2021-07-04 15:04   ` Peter Ujfalusi
  0 siblings, 0 replies; 23+ messages in thread
From: Peter Ujfalusi @ 2021-07-04 15:04 UTC (permalink / raw)
  To: broonie, tony; +Cc: hns, alsa-devel, linux-omap, lgirdwood

McASP only supports  Force-idle, No-idle and Smart-idle modes

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
---
 arch/arm/boot/dts/omap4-l4-abe.dtsi | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-l4-abe.dtsi b/arch/arm/boot/dts/omap4-l4-abe.dtsi
index a9573d441dea..8287fdaa526e 100644
--- a/arch/arm/boot/dts/omap4-l4-abe.dtsi
+++ b/arch/arm/boot/dts/omap4-l4-abe.dtsi
@@ -192,8 +192,7 @@ target-module@28000 {			/* 0x40128000, ap 8 08.0 */
 			reg-names = "rev", "sysc";
 			ti,sysc-sidle = <SYSC_IDLE_FORCE>,
 					<SYSC_IDLE_NO>,
-					<SYSC_IDLE_SMART>,
-					<SYSC_IDLE_SMART_WKUP>;
+					<SYSC_IDLE_SMART>;
 			/* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
 			clocks = <&abe_clkctrl OMAP4_MCASP_CLKCTRL 0>;
 			clock-names = "fck";
-- 
2.32.0


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

* [PATCH 5/5] ARM: dts: omap4-l4-abe: Add McASP configuration
  2021-07-04 15:04 ` Peter Ujfalusi
@ 2021-07-04 15:04   ` Peter Ujfalusi
  -1 siblings, 0 replies; 23+ messages in thread
From: Peter Ujfalusi @ 2021-07-04 15:04 UTC (permalink / raw)
  To: broonie, tony; +Cc: alsa-devel, lgirdwood, linux-omap, hns

OMAP4 has a single McASP instance with single serializer and locked for DIT
mode.
To be able to enable the support the following fixes needed:
- Add the DAT port ranges to the target module's ranges
- SIDLE mode must be disabled as it is not working with McASP
 most likely module integration issue with McASP

We can already fill in the op-mode and serial-dir  for McASP as it only
supports this configuration, but keep the module disabled as there is no
known device available where it is used.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
---
 arch/arm/boot/dts/omap4-l4-abe.dtsi | 38 +++++++++++++++--------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-l4-abe.dtsi b/arch/arm/boot/dts/omap4-l4-abe.dtsi
index 8287fdaa526e..a8d66240d17d 100644
--- a/arch/arm/boot/dts/omap4-l4-abe.dtsi
+++ b/arch/arm/boot/dts/omap4-l4-abe.dtsi
@@ -186,36 +186,38 @@ mcbsp3: mcbsp@0 {
 		};
 
 		target-module@28000 {			/* 0x40128000, ap 8 08.0 */
+							/* 0x4012a000, ap 10 0a.0 */
 			compatible = "ti,sysc-mcasp", "ti,sysc";
 			reg = <0x28000 0x4>,
 			      <0x28004 0x4>;
 			reg-names = "rev", "sysc";
 			ti,sysc-sidle = <SYSC_IDLE_FORCE>,
-					<SYSC_IDLE_NO>,
-					<SYSC_IDLE_SMART>;
+					<SYSC_IDLE_NO>;
 			/* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
 			clocks = <&abe_clkctrl OMAP4_MCASP_CLKCTRL 0>;
 			clock-names = "fck";
 			#address-cells = <1>;
 			#size-cells = <1>;
 			ranges = <0x0 0x28000 0x1000>,
-				 <0x49028000 0x49028000 0x1000>;
-
-			/*
-			 * Child device unsupported by davinci-mcasp. At least
-			 * RX path is disabled for omap4, and only DIT mode
-			 * works with no I2S. See also old Android kernel
-			 * omap-mcasp driver for more information.
-			 */
-		};
-
-		target-module@2a000 {			/* 0x4012a000, ap 10 0a.0 */
-			compatible = "ti,sysc";
-			status = "disabled";
-			#address-cells = <1>;
-			#size-cells = <1>;
-			ranges = <0x0 0x2a000 0x1000>,
+				 <0x49028000 0x49028000 0x1000>,
+				 <0x2000 0x2a000 0x1000>,
 				 <0x4902a000 0x4902a000 0x1000>;
+
+			mcasp0: mcasp@0 {
+				compatible = "ti,omap4-mcasp-audio";
+				reg = <0x0 0x2000>,
+				      <0x4902a000 0x1000>;	/* L3 data port */
+				reg-names = "mpu","dat";
+				interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-names = "tx";
+				dmas = <&sdma 8>;
+				dma-names = "tx";
+				clocks = <&abe_clkctrl OMAP4_MCASP_CLKCTRL 0>;
+				clock-names = "fck";
+				op-mode = <1>;	/* MCASP_DIT_MODE */
+				serial-dir = < 1 >; /* 1 TX serializers */
+				status = "disabled";
+			};
 		};
 
 		target-module@2e000 {			/* 0x4012e000, ap 12 0c.0 */
-- 
2.32.0


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

* [PATCH 5/5] ARM: dts: omap4-l4-abe: Add McASP configuration
@ 2021-07-04 15:04   ` Peter Ujfalusi
  0 siblings, 0 replies; 23+ messages in thread
From: Peter Ujfalusi @ 2021-07-04 15:04 UTC (permalink / raw)
  To: broonie, tony; +Cc: hns, alsa-devel, linux-omap, lgirdwood

OMAP4 has a single McASP instance with single serializer and locked for DIT
mode.
To be able to enable the support the following fixes needed:
- Add the DAT port ranges to the target module's ranges
- SIDLE mode must be disabled as it is not working with McASP
 most likely module integration issue with McASP

We can already fill in the op-mode and serial-dir  for McASP as it only
supports this configuration, but keep the module disabled as there is no
known device available where it is used.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
---
 arch/arm/boot/dts/omap4-l4-abe.dtsi | 38 +++++++++++++++--------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-l4-abe.dtsi b/arch/arm/boot/dts/omap4-l4-abe.dtsi
index 8287fdaa526e..a8d66240d17d 100644
--- a/arch/arm/boot/dts/omap4-l4-abe.dtsi
+++ b/arch/arm/boot/dts/omap4-l4-abe.dtsi
@@ -186,36 +186,38 @@ mcbsp3: mcbsp@0 {
 		};
 
 		target-module@28000 {			/* 0x40128000, ap 8 08.0 */
+							/* 0x4012a000, ap 10 0a.0 */
 			compatible = "ti,sysc-mcasp", "ti,sysc";
 			reg = <0x28000 0x4>,
 			      <0x28004 0x4>;
 			reg-names = "rev", "sysc";
 			ti,sysc-sidle = <SYSC_IDLE_FORCE>,
-					<SYSC_IDLE_NO>,
-					<SYSC_IDLE_SMART>;
+					<SYSC_IDLE_NO>;
 			/* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
 			clocks = <&abe_clkctrl OMAP4_MCASP_CLKCTRL 0>;
 			clock-names = "fck";
 			#address-cells = <1>;
 			#size-cells = <1>;
 			ranges = <0x0 0x28000 0x1000>,
-				 <0x49028000 0x49028000 0x1000>;
-
-			/*
-			 * Child device unsupported by davinci-mcasp. At least
-			 * RX path is disabled for omap4, and only DIT mode
-			 * works with no I2S. See also old Android kernel
-			 * omap-mcasp driver for more information.
-			 */
-		};
-
-		target-module@2a000 {			/* 0x4012a000, ap 10 0a.0 */
-			compatible = "ti,sysc";
-			status = "disabled";
-			#address-cells = <1>;
-			#size-cells = <1>;
-			ranges = <0x0 0x2a000 0x1000>,
+				 <0x49028000 0x49028000 0x1000>,
+				 <0x2000 0x2a000 0x1000>,
 				 <0x4902a000 0x4902a000 0x1000>;
+
+			mcasp0: mcasp@0 {
+				compatible = "ti,omap4-mcasp-audio";
+				reg = <0x0 0x2000>,
+				      <0x4902a000 0x1000>;	/* L3 data port */
+				reg-names = "mpu","dat";
+				interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-names = "tx";
+				dmas = <&sdma 8>;
+				dma-names = "tx";
+				clocks = <&abe_clkctrl OMAP4_MCASP_CLKCTRL 0>;
+				clock-names = "fck";
+				op-mode = <1>;	/* MCASP_DIT_MODE */
+				serial-dir = < 1 >; /* 1 TX serializers */
+				status = "disabled";
+			};
 		};
 
 		target-module@2e000 {			/* 0x4012e000, ap 12 0c.0 */
-- 
2.32.0


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

* Re: [PATCH 0/5] ASoC: ti: davinci-mcasp: Fix the DIT mode and OMAP4 support
  2021-07-04 15:04 ` Peter Ujfalusi
@ 2021-07-05 13:32   ` H. Nikolaus Schaller
  -1 siblings, 0 replies; 23+ messages in thread
From: H. Nikolaus Schaller @ 2021-07-05 13:32 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: Mark Brown, tony, alsa-devel, lgirdwood, linux-omap

Hi Péter,

> Am 04.07.2021 um 17:04 schrieb Peter Ujfalusi <peter.ujfalusi@gmail.com>:
> 
> Hi,
> 
> it has been on my todo list for several years to support McASP on OMAP4 devices.
> For Galaxy Nexus we had an omap-mcasp driver (which was mostly a stripped down
> davinci-mcasp driver) to support what was needed on that specific phone + it's
> dock for S/PDIF (48KHz, 16bit, stereo).
> 
> Not many (if any) device available to test the DIT mode of McASP.
> I have used BeagleBone White (McASP1 AXR3 can be routed to a pin) to get the
> S/PDIF mode working then PandaES for OMAP4 support (on PandaES the gpio_121 is
> not used and the signal is routed to expansion J6 pin14)
> 
> In theory the McASP in OMAP5 should be working after this series, but the OMAP5
> TRM is not public and I do not have one to check the addresses and see if there
> is a way to test it on omap5-uevm.
> 
> Mark, Tony:
> The ASoC and dts patches can go via separate tree I felt that it is better if
> they are together, at least initially.
> 
> Nikolaus: fyi, this might be useful for Pyra?

Yes, definitively.

I just wonder how compatible it is with the "old" omap-mcasp driver we carry
along for the Pyra:

https://git.goldelico.com/?p=letux-kernel.git;a=blob;f=sound/soc/ti/omap-mcasp.c;h=24d839a24f34ec02456176744d3690016592b5a3;hb=7789ab635e56a2fd9fe04ca2e9ccfeaccb8e0f52

Does it now have additional functionality or robustness?
And does it need changes of the OMAP5 device tree?

And also important seems to be the ABE/AESS integration where we so far failed
to make it work again on more recent kernels. Our most recent patch set is here:

https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/aess-v5

Anyways I am happy to see a little progress on the omap4/5 audio subsystem.

BR and thanks,
Nikolaus



> 
> Regards,
> Péter
> ---
> Peter Ujfalusi (5):
>  ASoC: ti: davinci-mcasp: Fix DIT mode support
>  ASoC: dt-bindings: davinci-mcasp: Add compatible string for OMAP4
>  ASoC: ti: davinci-mcasp: Add support for the OMAP4 version of McASP
>  ARM: dts: omap4-l4-abe: Correct sidle modes for McASP
>  ARM: dts: omap4-l4-abe: Add McASP configuration
> 
> .../bindings/sound/davinci-mcasp-audio.txt    |   1 +
> arch/arm/boot/dts/omap4-l4-abe.dtsi           |  39 ++--
> include/linux/platform_data/davinci_asp.h     |   1 +
> sound/soc/ti/Kconfig                          |   1 +
> sound/soc/ti/davinci-mcasp.c                  | 168 +++++++++++++++---
> 5 files changed, 168 insertions(+), 42 deletions(-)
> 
> -- 
> 2.32.0
> 


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

* Re: [PATCH 0/5] ASoC: ti: davinci-mcasp: Fix the DIT mode and OMAP4 support
@ 2021-07-05 13:32   ` H. Nikolaus Schaller
  0 siblings, 0 replies; 23+ messages in thread
From: H. Nikolaus Schaller @ 2021-07-05 13:32 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: tony, alsa-devel, Mark Brown, lgirdwood, linux-omap

Hi Péter,

> Am 04.07.2021 um 17:04 schrieb Peter Ujfalusi <peter.ujfalusi@gmail.com>:
> 
> Hi,
> 
> it has been on my todo list for several years to support McASP on OMAP4 devices.
> For Galaxy Nexus we had an omap-mcasp driver (which was mostly a stripped down
> davinci-mcasp driver) to support what was needed on that specific phone + it's
> dock for S/PDIF (48KHz, 16bit, stereo).
> 
> Not many (if any) device available to test the DIT mode of McASP.
> I have used BeagleBone White (McASP1 AXR3 can be routed to a pin) to get the
> S/PDIF mode working then PandaES for OMAP4 support (on PandaES the gpio_121 is
> not used and the signal is routed to expansion J6 pin14)
> 
> In theory the McASP in OMAP5 should be working after this series, but the OMAP5
> TRM is not public and I do not have one to check the addresses and see if there
> is a way to test it on omap5-uevm.
> 
> Mark, Tony:
> The ASoC and dts patches can go via separate tree I felt that it is better if
> they are together, at least initially.
> 
> Nikolaus: fyi, this might be useful for Pyra?

Yes, definitively.

I just wonder how compatible it is with the "old" omap-mcasp driver we carry
along for the Pyra:

https://git.goldelico.com/?p=letux-kernel.git;a=blob;f=sound/soc/ti/omap-mcasp.c;h=24d839a24f34ec02456176744d3690016592b5a3;hb=7789ab635e56a2fd9fe04ca2e9ccfeaccb8e0f52

Does it now have additional functionality or robustness?
And does it need changes of the OMAP5 device tree?

And also important seems to be the ABE/AESS integration where we so far failed
to make it work again on more recent kernels. Our most recent patch set is here:

https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/aess-v5

Anyways I am happy to see a little progress on the omap4/5 audio subsystem.

BR and thanks,
Nikolaus



> 
> Regards,
> Péter
> ---
> Peter Ujfalusi (5):
>  ASoC: ti: davinci-mcasp: Fix DIT mode support
>  ASoC: dt-bindings: davinci-mcasp: Add compatible string for OMAP4
>  ASoC: ti: davinci-mcasp: Add support for the OMAP4 version of McASP
>  ARM: dts: omap4-l4-abe: Correct sidle modes for McASP
>  ARM: dts: omap4-l4-abe: Add McASP configuration
> 
> .../bindings/sound/davinci-mcasp-audio.txt    |   1 +
> arch/arm/boot/dts/omap4-l4-abe.dtsi           |  39 ++--
> include/linux/platform_data/davinci_asp.h     |   1 +
> sound/soc/ti/Kconfig                          |   1 +
> sound/soc/ti/davinci-mcasp.c                  | 168 +++++++++++++++---
> 5 files changed, 168 insertions(+), 42 deletions(-)
> 
> -- 
> 2.32.0
> 


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

* Re: [PATCH 0/5] ASoC: ti: davinci-mcasp: Fix the DIT mode and OMAP4 support
  2021-07-05 13:32   ` H. Nikolaus Schaller
@ 2021-07-05 14:10     ` Péter Ujfalusi
  -1 siblings, 0 replies; 23+ messages in thread
From: Péter Ujfalusi @ 2021-07-05 14:10 UTC (permalink / raw)
  To: H. Nikolaus Schaller; +Cc: Mark Brown, tony, alsa-devel, lgirdwood, linux-omap

Hi Nikolaus,

On 05/07/2021 16:32, H. Nikolaus Schaller wrote:
> Hi Péter,
> 
>> Am 04.07.2021 um 17:04 schrieb Peter Ujfalusi <peter.ujfalusi@gmail.com>:
>>
>> Hi,
>>
>> it has been on my todo list for several years to support McASP on OMAP4 devices.
>> For Galaxy Nexus we had an omap-mcasp driver (which was mostly a stripped down
>> davinci-mcasp driver) to support what was needed on that specific phone + it's
>> dock for S/PDIF (48KHz, 16bit, stereo).
>>
>> Not many (if any) device available to test the DIT mode of McASP.
>> I have used BeagleBone White (McASP1 AXR3 can be routed to a pin) to get the
>> S/PDIF mode working then PandaES for OMAP4 support (on PandaES the gpio_121 is
>> not used and the signal is routed to expansion J6 pin14)
>>
>> In theory the McASP in OMAP5 should be working after this series, but the OMAP5
>> TRM is not public and I do not have one to check the addresses and see if there
>> is a way to test it on omap5-uevm.
>>
>> Mark, Tony:
>> The ASoC and dts patches can go via separate tree I felt that it is better if
>> they are together, at least initially.
>>
>> Nikolaus: fyi, this might be useful for Pyra?
> 
> Yes, definitively.
> 
> I just wonder how compatible it is with the "old" omap-mcasp driver we carry
> along for the Pyra:
> 
> https://git.goldelico.com/?p=letux-kernel.git;a=blob;f=sound/soc/ti/omap-mcasp.c;h=24d839a24f34ec02456176744d3690016592b5a3;hb=7789ab635e56a2fd9fe04ca2e9ccfeaccb8e0f52
> 
> Does it now have additional functionality or robustness?

The davinci-mcasp with series does work on OMAP4. I could not made the
omap-mcasp working. I have picked the driver from pyra in hopes that it
is working so I will ahve a stable base.
Have you tested it?

the omap-mcasp supports only 48KHz and 16bit, no passthrough, no 24bit,
all is hardwired for the Galaxy Nexus setup, afaik.

The davinci-mcasp should be better all around, I think the PM side is
also more robust.

The other point is that I would not accept the omap-mcasp driver
upstream. The IP is the same so the driver should be also...

> And does it need changes of the OMAP5 device tree?

In a similar way as the dts patches in this series.
fwiw:
https://github.com/omap-audio/linux-audio/commit/2f0a632db0b52321f1fc3623d088a741aeb72ef7
is the patch I have for PandaES to get S/PDIF working.

> And also important seems to be the ABE/AESS integration where we so far failed
> to make it work again on more recent kernels.

The McASP is not routed via ABE/AESS, it has been always handled outside
of the firmware, so it is just a simple link outside.

> Our most recent patch set is here:
> 
> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/aess-v5

Yes, I'm following it ;)

> Anyways I am happy to see a little progress on the omap4/5 audio subsystem.

It is in maintenance mode as there is not much of an interest outside of
a small group of people, but I try to help to get it better for Pyra.

> BR and thanks,
> Nikolaus
> 
> 
> 
>>
>> Regards,
>> Péter
>> ---
>> Peter Ujfalusi (5):
>>  ASoC: ti: davinci-mcasp: Fix DIT mode support
>>  ASoC: dt-bindings: davinci-mcasp: Add compatible string for OMAP4
>>  ASoC: ti: davinci-mcasp: Add support for the OMAP4 version of McASP
>>  ARM: dts: omap4-l4-abe: Correct sidle modes for McASP
>>  ARM: dts: omap4-l4-abe: Add McASP configuration
>>
>> .../bindings/sound/davinci-mcasp-audio.txt    |   1 +
>> arch/arm/boot/dts/omap4-l4-abe.dtsi           |  39 ++--
>> include/linux/platform_data/davinci_asp.h     |   1 +
>> sound/soc/ti/Kconfig                          |   1 +
>> sound/soc/ti/davinci-mcasp.c                  | 168 +++++++++++++++---
>> 5 files changed, 168 insertions(+), 42 deletions(-)
>>
>> -- 
>> 2.32.0
>>
> 

-- 
Péter

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

* Re: [PATCH 0/5] ASoC: ti: davinci-mcasp: Fix the DIT mode and OMAP4 support
@ 2021-07-05 14:10     ` Péter Ujfalusi
  0 siblings, 0 replies; 23+ messages in thread
From: Péter Ujfalusi @ 2021-07-05 14:10 UTC (permalink / raw)
  To: H. Nikolaus Schaller; +Cc: tony, alsa-devel, Mark Brown, lgirdwood, linux-omap

Hi Nikolaus,

On 05/07/2021 16:32, H. Nikolaus Schaller wrote:
> Hi Péter,
> 
>> Am 04.07.2021 um 17:04 schrieb Peter Ujfalusi <peter.ujfalusi@gmail.com>:
>>
>> Hi,
>>
>> it has been on my todo list for several years to support McASP on OMAP4 devices.
>> For Galaxy Nexus we had an omap-mcasp driver (which was mostly a stripped down
>> davinci-mcasp driver) to support what was needed on that specific phone + it's
>> dock for S/PDIF (48KHz, 16bit, stereo).
>>
>> Not many (if any) device available to test the DIT mode of McASP.
>> I have used BeagleBone White (McASP1 AXR3 can be routed to a pin) to get the
>> S/PDIF mode working then PandaES for OMAP4 support (on PandaES the gpio_121 is
>> not used and the signal is routed to expansion J6 pin14)
>>
>> In theory the McASP in OMAP5 should be working after this series, but the OMAP5
>> TRM is not public and I do not have one to check the addresses and see if there
>> is a way to test it on omap5-uevm.
>>
>> Mark, Tony:
>> The ASoC and dts patches can go via separate tree I felt that it is better if
>> they are together, at least initially.
>>
>> Nikolaus: fyi, this might be useful for Pyra?
> 
> Yes, definitively.
> 
> I just wonder how compatible it is with the "old" omap-mcasp driver we carry
> along for the Pyra:
> 
> https://git.goldelico.com/?p=letux-kernel.git;a=blob;f=sound/soc/ti/omap-mcasp.c;h=24d839a24f34ec02456176744d3690016592b5a3;hb=7789ab635e56a2fd9fe04ca2e9ccfeaccb8e0f52
> 
> Does it now have additional functionality or robustness?

The davinci-mcasp with series does work on OMAP4. I could not made the
omap-mcasp working. I have picked the driver from pyra in hopes that it
is working so I will ahve a stable base.
Have you tested it?

the omap-mcasp supports only 48KHz and 16bit, no passthrough, no 24bit,
all is hardwired for the Galaxy Nexus setup, afaik.

The davinci-mcasp should be better all around, I think the PM side is
also more robust.

The other point is that I would not accept the omap-mcasp driver
upstream. The IP is the same so the driver should be also...

> And does it need changes of the OMAP5 device tree?

In a similar way as the dts patches in this series.
fwiw:
https://github.com/omap-audio/linux-audio/commit/2f0a632db0b52321f1fc3623d088a741aeb72ef7
is the patch I have for PandaES to get S/PDIF working.

> And also important seems to be the ABE/AESS integration where we so far failed
> to make it work again on more recent kernels.

The McASP is not routed via ABE/AESS, it has been always handled outside
of the firmware, so it is just a simple link outside.

> Our most recent patch set is here:
> 
> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/aess-v5

Yes, I'm following it ;)

> Anyways I am happy to see a little progress on the omap4/5 audio subsystem.

It is in maintenance mode as there is not much of an interest outside of
a small group of people, but I try to help to get it better for Pyra.

> BR and thanks,
> Nikolaus
> 
> 
> 
>>
>> Regards,
>> Péter
>> ---
>> Peter Ujfalusi (5):
>>  ASoC: ti: davinci-mcasp: Fix DIT mode support
>>  ASoC: dt-bindings: davinci-mcasp: Add compatible string for OMAP4
>>  ASoC: ti: davinci-mcasp: Add support for the OMAP4 version of McASP
>>  ARM: dts: omap4-l4-abe: Correct sidle modes for McASP
>>  ARM: dts: omap4-l4-abe: Add McASP configuration
>>
>> .../bindings/sound/davinci-mcasp-audio.txt    |   1 +
>> arch/arm/boot/dts/omap4-l4-abe.dtsi           |  39 ++--
>> include/linux/platform_data/davinci_asp.h     |   1 +
>> sound/soc/ti/Kconfig                          |   1 +
>> sound/soc/ti/davinci-mcasp.c                  | 168 +++++++++++++++---
>> 5 files changed, 168 insertions(+), 42 deletions(-)
>>
>> -- 
>> 2.32.0
>>
> 

-- 
Péter

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

* Re: [PATCH 1/5] ASoC: ti: davinci-mcasp: Fix DIT mode support
  2021-07-04 15:04   ` Peter Ujfalusi
  (?)
@ 2021-07-05 14:38   ` kernel test robot
  -1 siblings, 0 replies; 23+ messages in thread
From: kernel test robot @ 2021-07-05 14:38 UTC (permalink / raw)
  To: kbuild-all

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

Hi Peter,

I love your patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[also build test WARNING on robh/for-next omap/for-next linus/master v5.13 next-20210701]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Peter-Ujfalusi/ASoC-ti-davinci-mcasp-Fix-the-DIT-mode-and-OMAP4-support/20210704-230253
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: riscv-randconfig-r021-20210705 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 3f9bf9f42a9043e20c6d2a74dd4f47a90a7e2b41)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/085675d5332885fb340fcf97f4ed826259c5fb0d
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Peter-Ujfalusi/ASoC-ti-davinci-mcasp-Fix-the-DIT-mode-and-OMAP4-support/20210704-230253
        git checkout 085675d5332885fb340fcf97f4ed826259c5fb0d
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> sound/soc/ti/davinci-mcasp.c:863:56: warning: implicit conversion from 'int' to 'u8' (aka 'unsigned char') changes value from 384 to 128 [-Wconstant-conversion]
           u8 slots = mcasp->op_mode == DAVINCI_MCASP_DIT_MODE ? 384 : mcasp->tdm_slots;
              ~~~~~                                              ^~~
   1 warning generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for LOCKDEP
   Depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT && (FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86)
   Selected by
   - LOCK_STAT && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
   - DEBUG_LOCK_ALLOC && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT


vim +863 sound/soc/ti/davinci-mcasp.c

   855	
   856	static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
   857					 int period_words, int channels)
   858	{
   859		struct snd_dmaengine_dai_dma_data *dma_data = &mcasp->dma_data[stream];
   860		int i;
   861		u8 tx_ser = 0;
   862		u8 rx_ser = 0;
 > 863		u8 slots = mcasp->op_mode == DAVINCI_MCASP_DIT_MODE ? 384 : mcasp->tdm_slots;
   864		u8 max_active_serializers = (channels + slots - 1) / slots;
   865		u8 max_rx_serializers, max_tx_serializers;
   866		int active_serializers, numevt;
   867		u32 reg;
   868		/* Default configuration */
   869		if (mcasp->version < MCASP_VERSION_3)
   870			mcasp_set_bits(mcasp, DAVINCI_MCASP_PWREMUMGT_REG, MCASP_SOFT);
   871	
   872		if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
   873			mcasp_set_reg(mcasp, DAVINCI_MCASP_TXSTAT_REG, 0xFFFFFFFF);
   874			mcasp_clr_bits(mcasp, DAVINCI_MCASP_XEVTCTL_REG, TXDATADMADIS);
   875			max_tx_serializers = max_active_serializers;
   876			max_rx_serializers =
   877				mcasp->active_serializers[SNDRV_PCM_STREAM_CAPTURE];
   878		} else {
   879			mcasp_set_reg(mcasp, DAVINCI_MCASP_RXSTAT_REG, 0xFFFFFFFF);
   880			mcasp_clr_bits(mcasp, DAVINCI_MCASP_REVTCTL_REG, RXDATADMADIS);
   881			max_tx_serializers =
   882				mcasp->active_serializers[SNDRV_PCM_STREAM_PLAYBACK];
   883			max_rx_serializers = max_active_serializers;
   884		}
   885	
   886		for (i = 0; i < mcasp->num_serializer; i++) {
   887			mcasp_set_bits(mcasp, DAVINCI_MCASP_XRSRCTL_REG(i),
   888				       mcasp->serial_dir[i]);
   889			if (mcasp->serial_dir[i] == TX_MODE &&
   890						tx_ser < max_tx_serializers) {
   891				mcasp_mod_bits(mcasp, DAVINCI_MCASP_XRSRCTL_REG(i),
   892					       mcasp->dismod, DISMOD_MASK);
   893				set_bit(PIN_BIT_AXR(i), &mcasp->pdir);
   894				tx_ser++;
   895			} else if (mcasp->serial_dir[i] == RX_MODE &&
   896						rx_ser < max_rx_serializers) {
   897				clear_bit(PIN_BIT_AXR(i), &mcasp->pdir);
   898				rx_ser++;
   899			} else {
   900				/* Inactive or unused pin, set it to inactive */
   901				mcasp_mod_bits(mcasp, DAVINCI_MCASP_XRSRCTL_REG(i),
   902					       SRMOD_INACTIVE, SRMOD_MASK);
   903				/* If unused, set DISMOD for the pin */
   904				if (mcasp->serial_dir[i] != INACTIVE_MODE)
   905					mcasp_mod_bits(mcasp,
   906						       DAVINCI_MCASP_XRSRCTL_REG(i),
   907						       mcasp->dismod, DISMOD_MASK);
   908				clear_bit(PIN_BIT_AXR(i), &mcasp->pdir);
   909			}
   910		}
   911	
   912		if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
   913			active_serializers = tx_ser;
   914			numevt = mcasp->txnumevt;
   915			reg = mcasp->fifo_base + MCASP_WFIFOCTL_OFFSET;
   916		} else {
   917			active_serializers = rx_ser;
   918			numevt = mcasp->rxnumevt;
   919			reg = mcasp->fifo_base + MCASP_RFIFOCTL_OFFSET;
   920		}
   921	
   922		if (active_serializers < max_active_serializers) {
   923			dev_warn(mcasp->dev, "stream has more channels (%d) than are "
   924				 "enabled in mcasp (%d)\n", channels,
   925				 active_serializers * slots);
   926			return -EINVAL;
   927		}
   928	
   929		/* AFIFO is not in use */
   930		if (!numevt) {
   931			/* Configure the burst size for platform drivers */
   932			if (active_serializers > 1) {
   933				/*
   934				 * If more than one serializers are in use we have one
   935				 * DMA request to provide data for all serializers.
   936				 * For example if three serializers are enabled the DMA
   937				 * need to transfer three words per DMA request.
   938				 */
   939				dma_data->maxburst = active_serializers;
   940			} else {
   941				dma_data->maxburst = 0;
   942			}
   943	
   944			goto out;
   945		}
   946	
   947		if (period_words % active_serializers) {
   948			dev_err(mcasp->dev, "Invalid combination of period words and "
   949				"active serializers: %d, %d\n", period_words,
   950				active_serializers);
   951			return -EINVAL;
   952		}
   953	
   954		/*
   955		 * Calculate the optimal AFIFO depth for platform side:
   956		 * The number of words for numevt need to be in steps of active
   957		 * serializers.
   958		 */
   959		numevt = (numevt / active_serializers) * active_serializers;
   960	
   961		while (period_words % numevt && numevt > 0)
   962			numevt -= active_serializers;
   963		if (numevt <= 0)
   964			numevt = active_serializers;
   965	
   966		mcasp_mod_bits(mcasp, reg, active_serializers, NUMDMA_MASK);
   967		mcasp_mod_bits(mcasp, reg, NUMEVT(numevt), NUMEVT_MASK);
   968	
   969		/* Configure the burst size for platform drivers */
   970		if (numevt == 1)
   971			numevt = 0;
   972		dma_data->maxburst = numevt;
   973	
   974	out:
   975		mcasp->active_serializers[stream] = active_serializers;
   976	
   977		return 0;
   978	}
   979	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33655 bytes --]

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

* Re: [PATCH 1/5] ASoC: ti: davinci-mcasp: Fix DIT mode support
  2021-07-04 15:04   ` Peter Ujfalusi
@ 2021-07-05 14:58     ` Péter Ujfalusi
  -1 siblings, 0 replies; 23+ messages in thread
From: Péter Ujfalusi @ 2021-07-05 14:58 UTC (permalink / raw)
  To: broonie, tony; +Cc: alsa-devel, lgirdwood, linux-omap, hns

Hi,

On 04/07/2021 18:04, Peter Ujfalusi wrote:
> The DIT mode support has not been tested due to lack of platform where it
> can be tested.
> To be able to use the McASP on OMAP4/5 (only supporting DIT mode) we need
> to have DIT mode working in the McASP driver on a know platform.
> After hacking around (on BBW, mcasp1.axr1 can be routed out for this) it
> appeared that DIT mode is broken.
> 
> This patch fixes it up and 16/24 bit audio works along with passthrough,
> but I have only tested with DTS example and test files.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
> ---
>  sound/soc/ti/davinci-mcasp.c | 142 ++++++++++++++++++++++++++++++-----
>  1 file changed, 122 insertions(+), 20 deletions(-)
> 
> diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
> index 017a5a5e56cd..e56a22c28467 100644
> --- a/sound/soc/ti/davinci-mcasp.c
> +++ b/sound/soc/ti/davinci-mcasp.c
> @@ -83,6 +83,8 @@ struct davinci_mcasp {
>  	struct snd_pcm_substream *substreams[2];
>  	unsigned int dai_fmt;
>  
> +	u32 iec958_status;
> +
>  	/* Audio can not be enabled due to missing parameter(s) */
>  	bool	missing_audio_param;
>  
> @@ -757,6 +759,9 @@ static int davinci_mcasp_set_tdm_slot(struct snd_soc_dai *dai,
>  {
>  	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
>  
> +	if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE)
> +		return 0;
> +
>  	dev_dbg(mcasp->dev,
>  		 "%s() tx_mask 0x%08x rx_mask 0x%08x slots %d width %d\n",
>  		 __func__, tx_mask, rx_mask, slots, slot_width);
> @@ -827,6 +832,20 @@ static int davinci_config_channel_size(struct davinci_mcasp *mcasp,
>  		mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, RXROT(rx_rotate),
>  			       RXROT(7));
>  		mcasp_set_reg(mcasp, DAVINCI_MCASP_RXMASK_REG, mask);
> +	} else {
> +		/*
> +		 * according to the TRM it should be TXROT=0, this one works:
> +		 * 16 bit to 23-8 (TXROT=6, rotate 24 bits)
> +		 * 24 bit to 23-0 (TXROT=0, rotate 0 bits)
> +		 *
> +		 * TXROT = 0 only works with 24bit samples
> +		 */
> +		tx_rotate = (sample_width / 4 + 2) & 0x7;
> +
> +		mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXROT(tx_rotate),
> +			       TXROT(7));
> +		mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXSSZ(15),
> +			       TXSSZ(0x0F));
>  	}
>  
>  	mcasp_set_reg(mcasp, DAVINCI_MCASP_TXMASK_REG, mask);
> @@ -841,7 +860,7 @@ static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
>  	int i;
>  	u8 tx_ser = 0;
>  	u8 rx_ser = 0;
> -	u8 slots = mcasp->tdm_slots;
> +	u8 slots = mcasp->op_mode == DAVINCI_MCASP_DIT_MODE ? 384 : mcasp->tdm_slots;

This is wrong.
384 will not fit to u8...
I wonder why I don't saw this...

-- 
Péter

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

* Re: [PATCH 1/5] ASoC: ti: davinci-mcasp: Fix DIT mode support
@ 2021-07-05 14:58     ` Péter Ujfalusi
  0 siblings, 0 replies; 23+ messages in thread
From: Péter Ujfalusi @ 2021-07-05 14:58 UTC (permalink / raw)
  To: broonie, tony; +Cc: hns, alsa-devel, linux-omap, lgirdwood

Hi,

On 04/07/2021 18:04, Peter Ujfalusi wrote:
> The DIT mode support has not been tested due to lack of platform where it
> can be tested.
> To be able to use the McASP on OMAP4/5 (only supporting DIT mode) we need
> to have DIT mode working in the McASP driver on a know platform.
> After hacking around (on BBW, mcasp1.axr1 can be routed out for this) it
> appeared that DIT mode is broken.
> 
> This patch fixes it up and 16/24 bit audio works along with passthrough,
> but I have only tested with DTS example and test files.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
> ---
>  sound/soc/ti/davinci-mcasp.c | 142 ++++++++++++++++++++++++++++++-----
>  1 file changed, 122 insertions(+), 20 deletions(-)
> 
> diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
> index 017a5a5e56cd..e56a22c28467 100644
> --- a/sound/soc/ti/davinci-mcasp.c
> +++ b/sound/soc/ti/davinci-mcasp.c
> @@ -83,6 +83,8 @@ struct davinci_mcasp {
>  	struct snd_pcm_substream *substreams[2];
>  	unsigned int dai_fmt;
>  
> +	u32 iec958_status;
> +
>  	/* Audio can not be enabled due to missing parameter(s) */
>  	bool	missing_audio_param;
>  
> @@ -757,6 +759,9 @@ static int davinci_mcasp_set_tdm_slot(struct snd_soc_dai *dai,
>  {
>  	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
>  
> +	if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE)
> +		return 0;
> +
>  	dev_dbg(mcasp->dev,
>  		 "%s() tx_mask 0x%08x rx_mask 0x%08x slots %d width %d\n",
>  		 __func__, tx_mask, rx_mask, slots, slot_width);
> @@ -827,6 +832,20 @@ static int davinci_config_channel_size(struct davinci_mcasp *mcasp,
>  		mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, RXROT(rx_rotate),
>  			       RXROT(7));
>  		mcasp_set_reg(mcasp, DAVINCI_MCASP_RXMASK_REG, mask);
> +	} else {
> +		/*
> +		 * according to the TRM it should be TXROT=0, this one works:
> +		 * 16 bit to 23-8 (TXROT=6, rotate 24 bits)
> +		 * 24 bit to 23-0 (TXROT=0, rotate 0 bits)
> +		 *
> +		 * TXROT = 0 only works with 24bit samples
> +		 */
> +		tx_rotate = (sample_width / 4 + 2) & 0x7;
> +
> +		mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXROT(tx_rotate),
> +			       TXROT(7));
> +		mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXSSZ(15),
> +			       TXSSZ(0x0F));
>  	}
>  
>  	mcasp_set_reg(mcasp, DAVINCI_MCASP_TXMASK_REG, mask);
> @@ -841,7 +860,7 @@ static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
>  	int i;
>  	u8 tx_ser = 0;
>  	u8 rx_ser = 0;
> -	u8 slots = mcasp->tdm_slots;
> +	u8 slots = mcasp->op_mode == DAVINCI_MCASP_DIT_MODE ? 384 : mcasp->tdm_slots;

This is wrong.
384 will not fit to u8...
I wonder why I don't saw this...

-- 
Péter

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

* Re: [PATCH 0/5] ASoC: ti: davinci-mcasp: Fix the DIT mode and OMAP4 support
  2021-07-05 14:10     ` Péter Ujfalusi
@ 2021-07-05 15:33       ` H. Nikolaus Schaller
  -1 siblings, 0 replies; 23+ messages in thread
From: H. Nikolaus Schaller @ 2021-07-05 15:33 UTC (permalink / raw)
  To: Péter Ujfalusi; +Cc: Mark Brown, tony, alsa-devel, lgirdwood, linux-omap



> Am 05.07.2021 um 16:10 schrieb Péter Ujfalusi <peter.ujfalusi@gmail.com>:
> 
> Hi Nikolaus,
> 
>> 
>> Yes, definitively.
>> 
>> I just wonder how compatible it is with the "old" omap-mcasp driver we carry
>> along for the Pyra:
>> 
>> https://git.goldelico.com/?p=letux-kernel.git;a=blob;f=sound/soc/ti/omap-mcasp.c;h=24d839a24f34ec02456176744d3690016592b5a3;hb=7789ab635e56a2fd9fe04ca2e9ccfeaccb8e0f52
>> 
>> Does it now have additional functionality or robustness?
> 
> The davinci-mcasp with series does work on OMAP4. I could not made the
> omap-mcasp working. I have picked the driver from pyra in hopes that it
> is working so I will ahve a stable base.
> Have you tested it?

AFAIR it was not tested. e have the sound system working (with some glitches)
but that goes through McPDM I think.

> 
> the omap-mcasp supports only 48KHz and 16bit, no passthrough, no 24bit,
> all is hardwired for the Galaxy Nexus setup, afaik.
> 
> The davinci-mcasp should be better all around, I think the PM side is
> also more robust.
> 
> The other point is that I would not accept the omap-mcasp driver
> upstream. The IP is the same so the driver should be also...

:)

> 
>> And does it need changes of the OMAP5 device tree?
> 
> In a similar way as the dts patches in this series.
> fwiw:
> https://github.com/omap-audio/linux-audio/commit/2f0a632db0b52321f1fc3623d088a741aeb72ef7
> is the patch I have for PandaES to get S/PDIF working.

If I find a little time it should not be difficult to replace your
new driver and fix the DTS in our ABE/AESS branch.

> 
>> And also important seems to be the ABE/AESS integration where we so far failed
>> to make it work again on more recent kernels.
> 
> The McASP is not routed via ABE/AESS, it has been always handled outside
> of the firmware, so it is just a simple link outside.

Ah, ok. Makes it easier to test :)

> 
>> Our most recent patch set is here:
>> 
>> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/aess-v5
> 
> Yes, I'm following it ;)
> 
>> Anyways I am happy to see a little progress on the omap4/5 audio subsystem.
> 
> It is in maintenance mode as there is not much of an interest outside of
> a small group of people, but I try to help to get it better for Pyra.

And a lot of public information has been lost (OMAPpedia). But there are some backups:

https://web.archive.org/web/20181111114134/http://omappedia.org/wiki/Audio_Drive_Arch

BR and thanks,
Nikolaus



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

* Re: [PATCH 0/5] ASoC: ti: davinci-mcasp: Fix the DIT mode and OMAP4 support
@ 2021-07-05 15:33       ` H. Nikolaus Schaller
  0 siblings, 0 replies; 23+ messages in thread
From: H. Nikolaus Schaller @ 2021-07-05 15:33 UTC (permalink / raw)
  To: Péter Ujfalusi; +Cc: tony, alsa-devel, Mark Brown, lgirdwood, linux-omap



> Am 05.07.2021 um 16:10 schrieb Péter Ujfalusi <peter.ujfalusi@gmail.com>:
> 
> Hi Nikolaus,
> 
>> 
>> Yes, definitively.
>> 
>> I just wonder how compatible it is with the "old" omap-mcasp driver we carry
>> along for the Pyra:
>> 
>> https://git.goldelico.com/?p=letux-kernel.git;a=blob;f=sound/soc/ti/omap-mcasp.c;h=24d839a24f34ec02456176744d3690016592b5a3;hb=7789ab635e56a2fd9fe04ca2e9ccfeaccb8e0f52
>> 
>> Does it now have additional functionality or robustness?
> 
> The davinci-mcasp with series does work on OMAP4. I could not made the
> omap-mcasp working. I have picked the driver from pyra in hopes that it
> is working so I will ahve a stable base.
> Have you tested it?

AFAIR it was not tested. e have the sound system working (with some glitches)
but that goes through McPDM I think.

> 
> the omap-mcasp supports only 48KHz and 16bit, no passthrough, no 24bit,
> all is hardwired for the Galaxy Nexus setup, afaik.
> 
> The davinci-mcasp should be better all around, I think the PM side is
> also more robust.
> 
> The other point is that I would not accept the omap-mcasp driver
> upstream. The IP is the same so the driver should be also...

:)

> 
>> And does it need changes of the OMAP5 device tree?
> 
> In a similar way as the dts patches in this series.
> fwiw:
> https://github.com/omap-audio/linux-audio/commit/2f0a632db0b52321f1fc3623d088a741aeb72ef7
> is the patch I have for PandaES to get S/PDIF working.

If I find a little time it should not be difficult to replace your
new driver and fix the DTS in our ABE/AESS branch.

> 
>> And also important seems to be the ABE/AESS integration where we so far failed
>> to make it work again on more recent kernels.
> 
> The McASP is not routed via ABE/AESS, it has been always handled outside
> of the firmware, so it is just a simple link outside.

Ah, ok. Makes it easier to test :)

> 
>> Our most recent patch set is here:
>> 
>> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/aess-v5
> 
> Yes, I'm following it ;)
> 
>> Anyways I am happy to see a little progress on the omap4/5 audio subsystem.
> 
> It is in maintenance mode as there is not much of an interest outside of
> a small group of people, but I try to help to get it better for Pyra.

And a lot of public information has been lost (OMAPpedia). But there are some backups:

https://web.archive.org/web/20181111114134/http://omappedia.org/wiki/Audio_Drive_Arch

BR and thanks,
Nikolaus



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

* Re: [PATCH 1/5] ASoC: ti: davinci-mcasp: Fix DIT mode support
  2021-07-05 14:58     ` Péter Ujfalusi
@ 2021-07-05 15:50       ` Mark Brown
  -1 siblings, 0 replies; 23+ messages in thread
From: Mark Brown @ 2021-07-05 15:50 UTC (permalink / raw)
  To: Péter Ujfalusi; +Cc: tony, alsa-devel, lgirdwood, linux-omap, hns

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

On Mon, Jul 05, 2021 at 05:58:04PM +0300, Péter Ujfalusi wrote:
> On 04/07/2021 18:04, Peter Ujfalusi wrote:

> > +	u8 slots = mcasp->op_mode == DAVINCI_MCASP_DIT_MODE ? 384 : mcasp->tdm_slots;

> This is wrong.
> 384 will not fit to u8...
> I wonder why I don't saw this...

Or the compiler for that matter...

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

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

* Re: [PATCH 1/5] ASoC: ti: davinci-mcasp: Fix DIT mode support
@ 2021-07-05 15:50       ` Mark Brown
  0 siblings, 0 replies; 23+ messages in thread
From: Mark Brown @ 2021-07-05 15:50 UTC (permalink / raw)
  To: Péter Ujfalusi; +Cc: tony, hns, alsa-devel, linux-omap, lgirdwood

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

On Mon, Jul 05, 2021 at 05:58:04PM +0300, Péter Ujfalusi wrote:
> On 04/07/2021 18:04, Peter Ujfalusi wrote:

> > +	u8 slots = mcasp->op_mode == DAVINCI_MCASP_DIT_MODE ? 384 : mcasp->tdm_slots;

> This is wrong.
> 384 will not fit to u8...
> I wonder why I don't saw this...

Or the compiler for that matter...

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

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

end of thread, other threads:[~2021-07-05 15:52 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-04 15:04 [PATCH 0/5] ASoC: ti: davinci-mcasp: Fix the DIT mode and OMAP4 support Peter Ujfalusi
2021-07-04 15:04 ` Peter Ujfalusi
2021-07-04 15:04 ` [PATCH 1/5] ASoC: ti: davinci-mcasp: Fix DIT mode support Peter Ujfalusi
2021-07-04 15:04   ` Peter Ujfalusi
2021-07-05 14:38   ` kernel test robot
2021-07-05 14:58   ` Péter Ujfalusi
2021-07-05 14:58     ` Péter Ujfalusi
2021-07-05 15:50     ` Mark Brown
2021-07-05 15:50       ` Mark Brown
2021-07-04 15:04 ` [PATCH 2/5] ASoC: dt-bindings: davinci-mcasp: Add compatible string for OMAP4 Peter Ujfalusi
2021-07-04 15:04   ` Peter Ujfalusi
2021-07-04 15:04 ` [PATCH 3/5] ASoC: ti: davinci-mcasp: Add support for the OMAP4 version of McASP Peter Ujfalusi
2021-07-04 15:04   ` Peter Ujfalusi
2021-07-04 15:04 ` [PATCH 4/5] ARM: dts: omap4-l4-abe: Correct sidle modes for McASP Peter Ujfalusi
2021-07-04 15:04   ` Peter Ujfalusi
2021-07-04 15:04 ` [PATCH 5/5] ARM: dts: omap4-l4-abe: Add McASP configuration Peter Ujfalusi
2021-07-04 15:04   ` Peter Ujfalusi
2021-07-05 13:32 ` [PATCH 0/5] ASoC: ti: davinci-mcasp: Fix the DIT mode and OMAP4 support H. Nikolaus Schaller
2021-07-05 13:32   ` H. Nikolaus Schaller
2021-07-05 14:10   ` Péter Ujfalusi
2021-07-05 14:10     ` Péter Ujfalusi
2021-07-05 15:33     ` H. Nikolaus Schaller
2021-07-05 15:33       ` H. Nikolaus Schaller

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.