Title: [7150] branches/2009R1/sound/soc/blackfin: [!no_src_qa!] bug[#5429]sending out remaining data according to the runtime bus type
Revision
7150
Author
cliff
Date
2009-08-11 00:26:28 -0400 (Tue, 11 Aug 2009)

Log Message

[!no_src_qa!] bug[#5429]sending out remaining data according to the runtime bus type

Modified Paths

Diff

Modified: branches/2009R1/sound/soc/blackfin/bf5xx-ac97.c (7149 => 7150)


--- branches/2009R1/sound/soc/blackfin/bf5xx-ac97.c	2009-08-11 04:25:15 UTC (rev 7149)
+++ branches/2009R1/sound/soc/blackfin/bf5xx-ac97.c	2009-08-11 04:26:28 UTC (rev 7150)
@@ -372,6 +372,7 @@
 		ret = -ENODEV;
 		goto sport_err;
 	}
+	sport_handle->bus_type = SPORT_AC97;
 	/*SPORT works in TDM mode to simulate AC97 transfers*/
 #if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT)
 	ret = sport_set_multichannel(sport_handle, 16, 0x3FF, 1);

Modified: branches/2009R1/sound/soc/blackfin/bf5xx-i2s.c (7149 => 7150)


--- branches/2009R1/sound/soc/blackfin/bf5xx-i2s.c	2009-08-11 04:25:15 UTC (rev 7149)
+++ branches/2009R1/sound/soc/blackfin/bf5xx-i2s.c	2009-08-11 04:26:28 UTC (rev 7150)
@@ -207,7 +207,7 @@
 		peripheral_free_list(&sport_req[sport_num][0]);
 		return -ENODEV;
 	}
-
+	sport_handle->bus_type = SPORT_I2S;
 	return 0;
 }
 

Modified: branches/2009R1/sound/soc/blackfin/bf5xx-sport.c (7149 => 7150)


--- branches/2009R1/sound/soc/blackfin/bf5xx-sport.c	2009-08-11 04:25:15 UTC (rev 7149)
+++ branches/2009R1/sound/soc/blackfin/bf5xx-sport.c	2009-08-11 04:26:28 UTC (rev 7150)
@@ -166,6 +166,8 @@
 
 static int sport_stop(struct sport_device *sport)
 {
+	unsigned long flags;
+	u16 dummy, stat;
 	sport->regs->tcr1 &= ~TSPEN;
 	sport->regs->rcr1 &= ~RSPEN;
 	SSYNC();
@@ -173,31 +175,30 @@
 	disable_dma(sport->dma_rx_chan);
 	disable_dma(sport->dma_tx_chan);
 	SSYNC();
-#if (defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE))
-	unsigned long flags;
-	u16 dummy, stat;
-	/* Send out remaining data in TX fifo.The remaining data
-	 * only affects ac97 mode obviously,and may not work for
-	 * other audio interfaces due to lack sync signal.
-	 */
-	local_irq_save(flags);
-	sport->regs->rcr1 |= RSPEN;
-	sport->regs->tcr1 |= TSPEN;
-	SSYNC();
-	stat = *(volatile u16 *)(&sport->regs->stat);
-	while (!(stat & TUVF)) {
-		if (stat & RXNE)
-			dummy = *(volatile u16 *)(&sport->regs->rx);
+
+	if (sport->bus_type == SPORT_AC97) {
+		/* Send out remaining data in TX fifo.The remaining data
+		 * only affects ac97 mode obviously,and may not work for
+		 * other audio interfaces due to lack sync signal.
+		 */
+		local_irq_save(flags);
+		sport->regs->rcr1 |= RSPEN;
+		sport->regs->tcr1 |= TSPEN;
+		SSYNC();
 		stat = *(volatile u16 *)(&sport->regs->stat);
+		while (!(stat & TUVF)) {
+			if (stat & RXNE)
+				dummy = *(volatile u16 *)(&sport->regs->rx);
+			stat = *(volatile u16 *)(&sport->regs->stat);
+		}
+		sport->regs->tcr1 &= ~TSPEN;
+		sport->regs->rcr1 &= ~RSPEN;
+		SSYNC();
+		local_irq_restore(flags);
+		stat = get_dma_curr_irqstat(sport->dma_tx_chan);
+		if (stat & (DMA_DONE  | DMA_ERR))
+			clear_dma_irqstat(sport->dma_tx_chan);
 	}
-	sport->regs->tcr1 &= ~TSPEN;
-	sport->regs->rcr1 &= ~RSPEN;
-	SSYNC();
-	local_irq_restore(flags);
-	stat = get_dma_curr_irqstat(sport->dma_tx_chan);
-	if (stat & (DMA_DONE  | DMA_ERR))
-		clear_dma_irqstat(sport->dma_tx_chan);
-#endif
 	return 0;
 }
 
@@ -382,6 +383,9 @@
 
 int sport_tx_stop(struct sport_device *sport)
 {
+	struct dmasg *desc;
+	unsigned long flags;
+
 	if (!sport->tx_run)
 		return 0;
 	if (sport->rx_run) {
@@ -389,18 +393,16 @@
 		sport_hook_tx_dummy(sport);
 	} else {
 		/* Both rx and tx dma stopped */
-#if (defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE))
-		struct dmasg *desc;
-		unsigned long flags;
+		if (sport->bus_type == SPORT_AC97) {
 
-		local_irq_save(flags);
-		desc = (struct dmasg *)get_dma_next_desc_ptr(sport->dma_tx_chan);
-		memset((char *)desc->start_addr, 0, sport->tx_fragsize);
-		local_irq_restore(flags);
-		while ((unsigned long)(get_dma_curr_desc_ptr(sport->dma_tx_chan) -\
-			sizeof(struct dmasg)) != (unsigned long)desc)
-			continue;
-#endif
+			local_irq_save(flags);
+			desc = (struct dmasg *)get_dma_next_desc_ptr(sport->dma_tx_chan);
+			memset((char *)desc->start_addr, 0, sport->tx_fragsize);
+			local_irq_restore(flags);
+			while ((unsigned long)(get_dma_curr_desc_ptr(sport->dma_tx_chan) -\
+				sizeof(struct dmasg)) != (unsigned long)desc)
+				continue;
+		}
 		sport_stop(sport);
 		sport->curr_rx_desc = NULL;
 		sport->curr_tx_desc = NULL;

Modified: branches/2009R1/sound/soc/blackfin/bf5xx-sport.h (7149 => 7150)


--- branches/2009R1/sound/soc/blackfin/bf5xx-sport.h	2009-08-11 04:25:15 UTC (rev 7149)
+++ branches/2009R1/sound/soc/blackfin/bf5xx-sport.h	2009-08-11 04:26:28 UTC (rev 7150)
@@ -35,6 +35,11 @@
 #include <linux/workqueue.h>
 #include <asm/dma.h>
 
+enum sport_bus_type {
+	SPORT_AC97 = 0,
+	SPORT_I2S,
+};
+
 struct sport_register {
 	u16 tcr1;	u16 reserved0;
 	u16 tcr2;	u16 reserved1;
@@ -126,6 +131,7 @@
 	int tx_delay_pos;
 	int once;
 #endif
+	enum sport_bus_type bus_type;
 	void *private_data;
 };
 
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to