Skip to contentSkip to conversation

McBSP changes for OMAP4 platform

PATCH In review Jorge Eduardo Candelaria 5 participants 8 messages May 6, 2010 – May 12, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover McBSP changes for OMAP4 platform

The following patches enable McBSP driver to be used along with the audio driver in SDP4430 and other OMAP4 based boards.

Changes from v1:
- Changed to correct IRQ lines.
- Check if rx_irq is defined, instead of checking if cpu is omap4

Jorge Eduardo Candelaria (2):
ARM: McBSP: Fix request for irq in OMAP4
ARM: OMAP4: Add support for omap4 in McBSP driver

 arch/arm/mach-omap2/mcbsp.c |   12 ++++--------
 arch/arm/plat-omap/mcbsp.c  |   34 +++++++++++++++++++---------------
 2 files changed, 23 insertions(+), 23 deletions(-)
#1 lore raw

PATCH v2 1/2 ARM: McBSP: Fix request for irq in OMAP4

In OMAP4, there is only one irq line for TX and RX paths. Use the correct irq line to avoid errors at runtime.

Also, request irq line only once (instead of requesting for TX and RX).

---
 arch/arm/mach-omap2/mcbsp.c |   12 ++++--------
 arch/arm/plat-omap/mcbsp.c  |   20 ++++++++++++--------
 2 files changed, 16 insertions(+), 16 deletions(-)
arch/arm/mach-omap2/mcbsp.c +4 -8
index 2f3cad6..c293370 100644
@@ -187,32 +187,28 @@ static struct omap_mcbsp_platform_data omap44xx_mcbsp_pdata[] = {
 		.phys_base      = OMAP44XX_MCBSP1_BASE,
 		.dma_rx_sync    = OMAP44XX_DMA_MCBSP1_RX,
 		.dma_tx_sync    = OMAP44XX_DMA_MCBSP1_TX,
-		.rx_irq         = INT_24XX_MCBSP1_IRQ_RX,
-		.tx_irq         = INT_24XX_MCBSP1_IRQ_TX,
+		.tx_irq         = OMAP44XX_IRQ_MCBSP1,
 		.ops            = &omap2_mcbsp_ops,
 	},
 	{
 		.phys_base      = OMAP44XX_MCBSP2_BASE,
 		.dma_rx_sync    = OMAP44XX_DMA_MCBSP2_RX,
 		.dma_tx_sync    = OMAP44XX_DMA_MCBSP2_TX,
-		.rx_irq         = INT_24XX_MCBSP2_IRQ_RX,
-		.tx_irq         = INT_24XX_MCBSP2_IRQ_TX,
+		.tx_irq         = OMAP44XX_IRQ_MCBSP2,
 		.ops            = &omap2_mcbsp_ops,
 	},
 	{
 		.phys_base      = OMAP44XX_MCBSP3_BASE,
 		.dma_rx_sync    = OMAP44XX_DMA_MCBSP3_RX,
 		.dma_tx_sync    = OMAP44XX_DMA_MCBSP3_TX,
-		.rx_irq         = INT_24XX_MCBSP3_IRQ_RX,
-		.tx_irq         = INT_24XX_MCBSP3_IRQ_TX,
+		.tx_irq         = OMAP44XX_IRQ_MCBSP3,
 		.ops            = &omap2_mcbsp_ops,
 	},
 	{
 		.phys_base      = OMAP44XX_MCBSP4_BASE,
 		.dma_rx_sync    = OMAP44XX_DMA_MCBSP4_RX,
 		.dma_tx_sync    = OMAP44XX_DMA_MCBSP4_TX,
-		.rx_irq         = INT_24XX_MCBSP4_IRQ_RX,
-		.tx_irq         = INT_24XX_MCBSP4_IRQ_TX,
+		.tx_irq         = OMAP44XX_IRQ_MCBSP4,
 		.ops            = &omap2_mcbsp_ops,
 	},
 };
arch/arm/plat-omap/mcbsp.c +12 -8
index e1d0440..6696eb6 100644
@@ -724,14 +724,17 @@ int omap_mcbsp_request(unsigned int id)
 			goto err_clk_disable;
 		}
 
-		init_completion(&mcbsp->rx_irq_completion);
-		err = request_irq(mcbsp->rx_irq, omap_mcbsp_rx_irq_handler,
+		if (mcbsp->rx_irq) {
+			init_completion(&mcbsp->rx_irq_completion);
+			err = request_irq(mcbsp->rx_irq,
+					omap_mcbsp_rx_irq_handler,
 					0, "McBSP", (void *)mcbsp);
-		if (err != 0) {
-			dev_err(mcbsp->dev, "Unable to request RX IRQ %d "
-					"for McBSP%d\n", mcbsp->rx_irq,
-					mcbsp->id);
-			goto err_free_irq;
+			if (err != 0) {
+				dev_err(mcbsp->dev, "Unable to request RX IRQ %d "
+						"for McBSP%d\n", mcbsp->rx_irq,
+						mcbsp->id);
+				goto err_free_irq;
+			}
 		}
 	}
 
@@ -781,7 +784,8 @@ void omap_mcbsp_free(unsigned int id)
 
 	if (mcbsp->io_type == OMAP_MCBSP_IRQ_IO) {
 		/* Free IRQs */
-		free_irq(mcbsp->rx_irq, (void *)mcbsp);
+		if (mcbsp->rx_irq)
+			free_irq(mcbsp->rx_irq, (void *)mcbsp);
 		free_irq(mcbsp->tx_irq, (void *)mcbsp);
 	}
 
Signature · 1 line
1.6.3.3
#2 lore raw

PATCH v2 2/2 ARM: McBSP: Add support for omap4 in McBSP driver

McBSP module in OMAP4 needs to be able to set its tx/rx threshold and enable the transmitter/receiver when starting an audio stream.

---
 arch/arm/plat-omap/mcbsp.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/plat-omap/mcbsp.c +7 -7
index 6696eb6..9a0e788 100644
@@ -489,7 +489,7 @@ void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
 {
 	struct omap_mcbsp *mcbsp;
 
-	if (!cpu_is_omap34xx())
+	if (!cpu_is_omap34xx() && !cpu_is_omap44xx())
 		return;
 
 	if (!omap_mcbsp_check_valid_id(id)) {
@@ -511,7 +511,7 @@ void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
 {
 	struct omap_mcbsp *mcbsp;
 
-	if (!cpu_is_omap34xx())
+	if (!cpu_is_omap34xx() && !cpu_is_omap44xx())
 		return;
 
 	if (!omap_mcbsp_check_valid_id(id)) {
@@ -587,7 +587,7 @@ static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
 	 * Enable wakup behavior, smart idle and all wakeups
 	 * REVISIT: some wakeups may be unnecessary
 	 */
-	if (cpu_is_omap34xx()) {
+	if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
 		u16 syscon;
 
 		syscon = MCBSP_READ(mcbsp, SYSCON);
@@ -610,7 +610,7 @@ static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
 	/*
 	 * Disable wakup behavior, smart idle and all wakeups
 	 */
-	if (cpu_is_omap34xx()) {
+	if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
 		u16 syscon;
 
 		syscon = MCBSP_READ(mcbsp, SYSCON);
@@ -859,7 +859,7 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
 		MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7));
 	}
 
-	if (cpu_is_omap2430() || cpu_is_omap34xx()) {
+	if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
 		/* Release the transmitter and receiver */
 		w = MCBSP_READ_CACHE(mcbsp, XCCR);
 		w &= ~(tx ? XDISABLE : 0);
@@ -889,7 +889,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
 
 	/* Reset transmitter */
 	tx &= 1;
-	if (cpu_is_omap2430() || cpu_is_omap34xx()) {
+	if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
 		w = MCBSP_READ_CACHE(mcbsp, XCCR);
 		w |= (tx ? XDISABLE : 0);
 		MCBSP_WRITE(mcbsp, XCCR, w);
@@ -899,7 +899,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
 
 	/* Reset receiver */
 	rx &= 1;
-	if (cpu_is_omap2430() || cpu_is_omap34xx()) {
+	if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx) {
 		w = MCBSP_READ_CACHE(mcbsp, RCCR);
 		w |= (rx ? RDISABLE : 0);
 		MCBSP_WRITE(mcbsp, RCCR, w);
Signature · 1 line
1.6.3.3
Acked-by on v2 1/2
#4 lore raw

Re: [PATCH v2 1/2] ARM: McBSP: Fix request for irq in OMAP4

In reply to Jorge Eduardo Candelaria
Quoted 12 lines · On Wed, 5 May 2010 20:15:45 -0500 Jorge Eduardo Candelaria…

In OMAP4, there is only one irq line for TX and RX paths. Use the correct irq line to avoid errors at runtime.

Also, request irq line only once (instead of requesting for TX and RX).

---
 arch/arm/mach-omap2/mcbsp.c |   12 ++++--------
 arch/arm/plat-omap/mcbsp.c  |   20 ++++++++++++--------
 2 files changed, 16 insertions(+), 16 deletions(-)
#3 lore raw

Re: [PATCH v2 2/2] ARM: McBSP: Add support for omap4 in McBSP driver

In reply to Jorge Eduardo Candelaria
Quoted 6 lines · On Wed, 5 May 2010 20:15:46 -0500 Jorge Eduardo Candelaria…

McBSP module in OMAP4 needs to be able to set its tx/rx threshold and enable the transmitter/receiver when starting an audio stream.

---

...

arch/arm/plat-omap/mcbsp.c void omap_mcbsp_stop(unsigned int id, int tx, int rx) · line 902

Quoted 6 lines
arch/arm/plat-omap/mcbsp.c +1 -1
@@ -899,7 +899,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
 
 	/* Reset receiver */
 	rx &= 1;
-	if (cpu_is_omap2430() || cpu_is_omap34xx()) {
+	if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx) {

Parentheses missing here from cpu_is_omap44xx. Otherwise looks good.

Signature · 1 line
Jarkko
#5 lore raw
In reply to Jorge Eduardo Candelaria

Hi,

Quoted 7 lines · On Thursday 06 May 2010 04:15:44 ext Jorge Eduardo Candelaria wrote:

The following patches enable McBSP driver to be used along with the audio driver in SDP4430 and other OMAP4 based boards.

Changes from v1:
- Changed to correct IRQ lines.
- Check if rx_irq is defined, instead of checking if cpu is omap4

Quoted 7 lines

Jorge Eduardo Candelaria (2):
ARM: McBSP: Fix request for irq in OMAP4
ARM: OMAP4: Add support for omap4 in McBSP driver

 arch/arm/mach-omap2/mcbsp.c |   12 ++++--------
 arch/arm/plat-omap/mcbsp.c  |   34 +++++++++++++++++++---------------
 2 files changed, 23 insertions(+), 23 deletions(-)

Looks good with Jarkko's comment.
However, I'd like to ask Tony, Liam, Jarkko, and Mark the following:
Would it make sense to use the alsa tree for OMAP McBSP related patches, while keeping l-o in CC off course.
If we have patches for mcbsp pending in l-o and in alsa tree, than we are going to have hard times to sort things out when they need to be merged.

I'm asking this, because I will also have some patches for mcbsp, which will need change in arch/ and in sound/ as well.

I know that taking patches to alsa tree for the arch/ is unorthodox, but it will ease up our life in a long run...

What do you think?

Signature · 5 lines
Péter
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw
Quoted 4 lines · Peter Ujfalusi

Looks good with Jarkko's comment.
However, I'd like to ask Tony, Liam, Jarkko, and Mark the following:
Would it make sense to use the alsa tree for OMAP McBSP related patches, while keeping l-o in CC off course.

We've had to do this a few times in the past due to the way the code is split between the two areas. If it makes everyone's life easier I've got no problem with it, though I'll say my standard thing about it being better to keep them on a branch by themselves which can be pulled into both trees in case of any merge issues.

#7 lore raw
In reply to Peter Ujfalusi
Quoted 25 lines · Peter Ujfalusi

Hi,

Quoted 7 lines · On Thursday 06 May 2010 04:15:44 ext Jorge Eduardo Candelaria wrote:

The following patches enable McBSP driver to be used along with the audio driver in SDP4430 and other OMAP4 based boards.

Changes from v1:
- Changed to correct IRQ lines.
- Check if rx_irq is defined, instead of checking if cpu is omap4

Quoted 7 lines

Jorge Eduardo Candelaria (2):
ARM: McBSP: Fix request for irq in OMAP4
ARM: OMAP4: Add support for omap4 in McBSP driver

 arch/arm/mach-omap2/mcbsp.c |   12 ++++--------
 arch/arm/plat-omap/mcbsp.c  |   34 +++++++++++++++++++---------------
 2 files changed, 23 insertions(+), 23 deletions(-)

Looks good with Jarkko's comment.
However, I'd like to ask Tony, Liam, Jarkko, and Mark the following:
Would it make sense to use the alsa tree for OMAP McBSP related patches, while keeping l-o in CC off course.
If we have patches for mcbsp pending in l-o and in alsa tree, than we are going to have hard times to sort things out when they need to be merged.

Quoted 7 lines

I'm asking this, because I will also have some patches for mcbsp, which will need change in arch/ and in sound/ as well.

I know that taking patches to alsa tree for the arch/ is unorthodox, but it will ease up our life in a long run...

What do you think?

I tend to agree here since afaik audio is the primary upstream user of mcbsp on OMAP. We do have queue of audio related mcbsp patches pending atm and merging would be simpler in the ALSA tree atm.

Liam

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk