Skip to contentSkip to conversation

ASoC: pxa-ssp: add TISSP mode support

PATCH In review Qiao Zhou 3 participants 11 messages Nov 5, 2013 – Nov 15, 2013

Subsystems (3)
lore
Share & tools
lore

Qiao Zhou

author
#0 lore raw

PATCH 1/1 ASoC: pxa-ssp: add TISSP mode support

add TISSP mode support. with this mode enabled, ssp controller works in TI-ssp protocol automatically and doesn't need to configure sspsp register to set the timing for tx/rx.

---
 include/sound/soc-dai.h |    1 +
 sound/soc/pxa/pxa-ssp.c |    8 ++++++++
 2 files changed, 9 insertions(+), 0 deletions(-)
include/sound/soc-dai.h +1 -0
index ae9a227..43fc5d0 100644
@@ -33,6 +33,7 @@ struct snd_compr_stream;
 #define SND_SOC_DAIFMT_DSP_B		5 /* L data MSB during FRM LRC */
 #define SND_SOC_DAIFMT_AC97		6 /* AC97 */
 #define SND_SOC_DAIFMT_PDM		7 /* Pulse density modulation */
+#define SND_SOC_DAIFMT_SSP		8 /* SSP mode */
 
 /* left and right justified also known as MSB and LSB respectively */
 #define SND_SOC_DAIFMT_MSB		SND_SOC_DAIFMT_LEFT_J
sound/soc/pxa/pxa-ssp.c +8 -0
index a3119a0..effa8d1 100644
@@ -505,6 +505,14 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 		sscr0 |= SSCR0_MOD | SSCR0_PSP;
 		sscr1 |= SSCR1_TRAIL | SSCR1_RWOT;
 		break;
+	/*
+	 * add TISSP protocol support. setting to this mode, ssp controller
+	 * works in TI-ssp mode, and need not set psp register to conf
+	 * detailed timing.
+	 */
+	case SND_SOC_DAIFMT_SSP:
+		sscr0 |= SSCR0_TISSP;
+		sscr1 |= SSCR1_RWOT;
 
 	default:
 		return -EINVAL;
Signature · 1 line
1.7.0.4
maintainer
#1 lore raw
Quoted 3 lines · Qiao Zhou

add TISSP mode support. with this mode enabled, ssp controller works in TI-ssp protocol automatically and doesn't need to configure sspsp register to set the timing for tx/rx.

What is TISSP mode in an audio context?

sound/soc/pxa/pxa-ssp.c static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai, · line 518

Quoted 11 lines
sound/soc/pxa/pxa-ssp.c +8 -0
+	/*
+	 * add TISSP protocol support. setting to this mode, ssp controller
+	 * works in TI-ssp mode, and need not set psp register to conf
+	 * detailed timing.
+	 */
+	case SND_SOC_DAIFMT_SSP:
+		sscr0 |= SSCR0_TISSP;
+		sscr1 |= SSCR1_RWOT;
 
 	default:
 		return -EINVAL;

I don't think this code has been tested...

author
#2 lore raw
Quoted 6 lines · Mark Brown
Quoted 3 lines · Qiao Zhou

add TISSP mode support. with this mode enabled, ssp controller works in TI-ssp protocol automatically and doesn't need to configure sspsp register to set the timing for tx/rx.

What is TISSP mode in an audio context?

It's normal SSP mode, and it has a pulse of one bit clock width, which is the frame start signal. previously it's mainly used for voice call which is mono stream. current I2S or DSP_x format use PSP, which configures the details of transmit/receive timing. we can also use PSP to suit this SSP format. But since the SSP controller provides such HW convenience, so we want to add it. I'm not sure it's proper, and want to ask for suggestions.

Quoted 10 lines
Quoted 10 lines
sound/soc/pxa/pxa-ssp.c +8 -0
+	/*
+	 * add TISSP protocol support. setting to this mode, ssp controller
+	 * works in TI-ssp mode, and need not set psp register to conf
+	 * detailed timing.
+	 */
+	case SND_SOC_DAIFMT_SSP:
+		sscr0 |= SSCR0_TISSP;
+		sscr1 |= SSCR1_RWOT;
Quoted 4 lines
Quoted 2 lines

default:
return -EINVAL;

I don't think this code has been tested...

sorry for missing the "break", will update it. I want to ask suggestions about the logic of this piece of code from mainline and we do test the code logic on our platform.

Quoted 1 line
Signature · 2 lines
Best Regards
Qiao
maintainer
#3 lore raw
Quoted 5 lines · Qiao Zhou
Quoted 1 line · Mark Brown

What is TISSP mode in an audio context?

It's normal SSP mode, and it has a pulse of one bit clock width,

OK, what is SSP mode?

author
#4 lore raw
Quoted 8 lines · Mark Brown
Quoted 5 lines · Qiao Zhou
Quoted 1 line · Mark Brown

What is TISSP mode in an audio context?

It's normal SSP mode, and it has a pulse of one bit clock width,

OK, what is SSP mode?

SSP mode is just one frame format defined in sscr0 register, and there are 3 other mode, such as SPI mode, National Semiconductor Microwire(NSM) mode, Programmable Serial Protocol(PSP) mode.
The SPI/NSM are not used for audio usage, and currently only PSP mode is used pxa-ssp driver. We have the requirement now to support this SSP mode. The benefit is that we don't need to configure detailed timing in transmit/receiving since HW handles it automatically.
The SSP mode is something like the PCM format for mono stream for voice related scenario. In current audio format definition and pxa-ssp driver implementation, I don't find suitable way to handle it. so I add such SSP-format to differentiate it from PSP mode. Do I make a confusion of SSP mode and audio frame format? please help comment. thanks.

Quoted 1 line
Signature · 2 lines
Best Regards
Qiao
maintainer
#5 lore raw
Quoted 8 lines · Qiao Zhou

On 11/08/2013 06:19 PM, Mark Brown wrote:

The SPI/NSM are not used for audio usage, and currently only PSP mode is used pxa-ssp driver. We have the requirement now to support this SSP mode. The benefit is that we don't need to configure detailed timing in transmit/receiving since HW handles it automatically.

Quoted 6 lines

The SSP mode is something like the PCM format for mono stream for voice related scenario. In current audio format definition and pxa-ssp driver implementation, I don't find suitable way to handle it. so I add such SSP-format to differentiate it from PSP mode. Do I make a confusion of SSP mode and audio frame format? please help comment. thanks.

If this is just about programming the hardware better rather than changing the externally visible symbols then as Daniel says it should be handled transparently by the driver, replacing the current code for whatever formats are handled. Normally the same DAI format should be configured for both CODEC and CPU so unless a new format should also be used by CODEC drivers the update ought to be internal to the driver.

author
#6 lore raw
Quoted 16 lines · Mark Brown
Quoted 8 lines · Qiao Zhou

On 11/08/2013 06:19 PM, Mark Brown wrote:

The SPI/NSM are not used for audio usage, and currently only PSP mode is used pxa-ssp driver. We have the requirement now to support this SSP mode. The benefit is that we don't need to configure detailed timing in transmit/receiving since HW handles it automatically.

Quoted 6 lines

The SSP mode is something like the PCM format for mono stream for voice related scenario. In current audio format definition and pxa-ssp driver implementation, I don't find suitable way to handle it. so I add such SSP-format to differentiate it from PSP mode. Do I make a confusion of SSP mode and audio frame format? please help comment. thanks.

Quoted 7 lines

If this is just about programming the hardware better rather than changing the externally visible symbols then as Daniel says it should be handled transparently by the driver, replacing the current code for whatever formats are handled. Normally the same DAI format should be configured for both CODEC and CPU so unless a new format should also be used by CODEC drivers the update ought to be internal to the driver.

Yes, it should be an improvement of current driver. The format is not a new one, and the DSP_A mode is suitable for it. The question here is to handle both PSP and SSP mode here. should I pass another parameter here to support it?

Signature · 2 lines
Best Regards
Qiao
maintainer
#7 lore raw
Quoted 4 lines · Qiao Zhou

Yes, it should be an improvement of current driver. The format is not a new one, and the DSP_A mode is suitable for it. The question here is to handle both PSP and SSP mode here. should I pass another parameter here to support it?

Can't the driver just do whatever is best automatically - why would the user need to configure things?

author
#8 lore raw
Quoted 10 lines · Mark Brown
Quoted 4 lines · Qiao Zhou

Yes, it should be an improvement of current driver. The format is not a new one, and the DSP_A mode is suitable for it. The question here is to handle both PSP and SSP mode here. should I pass another parameter here to support it?

Can't the driver just do whatever is best automatically - why would the user need to configure things?

Hi Mark,

I'll check and replace the PSP mode setting with SSP for DSP_x mode. Thanks a lot for the instruction.

Signature · 2 lines
Best Regards
Qiao
maintainer
#9 lore raw
In reply to Qiao Zhou
Quoted 6 lines · Qiao Zhou
Quoted 5 lines · Mark Brown
Quoted 3 lines · Qiao Zhou

add TISSP mode support. with this mode enabled, ssp controller works in TI-ssp protocol automatically and doesn't need to configure sspsp register to set the timing for tx/rx.

Quoted 8 lines
Quoted 1 line

What is TISSP mode in an audio context?

It's normal SSP mode, and it has a pulse of one bit clock width, which is the frame start signal. previously it's mainly used for voice call which is mono stream. current I2S or DSP_x format use PSP, which configures the details of transmit/receive timing. we can also use PSP to suit this SSP format. But since the SSP controller provides such HW convenience, so we want to add it. I'm not sure it's proper, and want to ask for suggestions.

This sounds like a special case you want to address, rather than something that should be recognized by the core.

The question is what you want to achive here. What kind of peripheral do you have connected to the other side of the PXA, and why does it need this special needle peak on the frame clock rather than a 50% duty-cycle?

Also, I vaguely remember huge problems we had in setting up the SSP controller of a PXA SoC. The SSP IP would do all sort of things instead of what's described in the docs. Which silicon are you working on?

Thanks,
Daniel

author
#10 lore raw
Quoted 16 lines · Daniel Mack
Quoted 6 lines · Qiao Zhou
Quoted 5 lines · Mark Brown
Quoted 3 lines · Qiao Zhou

add TISSP mode support. with this mode enabled, ssp controller works in TI-ssp protocol automatically and doesn't need to configure sspsp register to set the timing for tx/rx.

Quoted 8 lines
Quoted 1 line

What is TISSP mode in an audio context?

It's normal SSP mode, and it has a pulse of one bit clock width, which is the frame start signal. previously it's mainly used for voice call which is mono stream. current I2S or DSP_x format use PSP, which configures the details of transmit/receive timing. we can also use PSP to suit this SSP format. But since the SSP controller provides such HW convenience, so we want to add it. I'm not sure it's proper, and want to ask for suggestions.

Quoted 6 lines

This sounds like a special case you want to address, rather than something that should be recognized by the core.

The question is what you want to achive here. What kind of peripheral do you have connected to the other side of the PXA, and why does it need this special needle peak on the frame clock rather than a 50% duty-cycle?

The frame format is like the DSP Mode A in WM8994 spec, and the peripheral is a normal codec interface for voice call usage, mono-stream, 16 bits. Here I want to add such SSP mode support in pxa-ssp driver, instead of using PSP mode to configure detailed data format in PSP register.
should I handle it under DSP_A case with extra param notifying whether it's SSP mode or PSP mode? on the peripheral side, the configuration of CODEC DAI should be the same.

below are the modes definition in pxa2xx_ssp.h
#define SSCR0_TISSP (1 << 4) /* TI Sync Serial Protocol */
#define SSCR0_PSP (3 << 4) /* PSP - Programmable Serial Protocol */

Quoted 4 lines

Also, I vaguely remember huge problems we had in setting up the SSP controller of a PXA SoC. The SSP IP would do all sort of things instead of what's described in the docs. Which silicon are you working on?

The silicon now I'm working on is pxa-9xx chips, but it's the same back to pxa-3xx chips.

Quoted 5 lines

Thanks,
Daniel

Signature · 2 lines
Best Regards
Qiao