Title: [3883] trunk/sound/soc/blackfin: bug[#3470] move sport initialization code to ac97 module, export some symbols of ac97 module for other modules use,usage: modprobe snd_ad1981;modprobe snd_pcm_oss
Revision
3883
Author
cliff
Date
2007-11-16 01:44:08 -0600 (Fri, 16 Nov 2007)

Log Message

bug[#3470] move sport initialization code to ac97 module,export some symbols of ac97 module for other modules use,usage:modprobe snd_ad1981;modprobe snd_pcm_oss 

Diffstat

 Makefile      |    4 +--
 bf5xx-ac97.c  |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 bf5xx-board.c |   58 ---------------------------------------------------------
 bf5xx-sport.c |   17 +++++++++++++++-
 4 files changed, 77 insertions(+), 61 deletions(-)

Modified Paths

Diff

Modified: trunk/sound/soc/blackfin/Makefile (3882 => 3883)


--- trunk/sound/soc/blackfin/Makefile	2007-11-16 06:55:34 UTC (rev 3882)
+++ trunk/sound/soc/blackfin/Makefile	2007-11-16 07:44:08 UTC (rev 3883)
@@ -9,11 +9,11 @@
 
 # Blackfin Machine Support
 snd-soc-bf548-ezkit-objs := bf548-ezkit.o
-snd-soc-bf5xx-board-objs := bf5xx-board.o
+snd-ad1981-objs := bf5xx-board.o
 snd-soc-bf5xx-wm8750-objs := bf5xx-wm8750.o
 snd-soc-bf5xx-wm8731-objs := bf5xx-wm8731.o
 
 obj-$(CONFIG_SND_BF5XX_SOC_BF548_EZKIT) += snd-soc-bf548-ezkit.o
-obj-$(CONFIG_SND_BF5XX_SOC_BF5xx) += snd-soc-bf5xx-board.o
+obj-$(CONFIG_SND_BF5XX_SOC_BF5xx) += snd-ad1981.o
 obj-$(CONFIG_SND_BF5XX_SOC_WM8750) += snd-soc-bf5xx-wm8750.o
 obj-$(CONFIG_SND_BF5XX_SOC_WM8731) += snd-soc-bf5xx-wm8731.o

Modified: trunk/sound/soc/blackfin/bf5xx-ac97.c (3882 => 3883)


--- trunk/sound/soc/blackfin/bf5xx-ac97.c	2007-11-16 06:55:34 UTC (rev 3882)
+++ trunk/sound/soc/blackfin/bf5xx-ac97.c	2007-11-16 07:44:08 UTC (rev 3883)
@@ -33,8 +33,34 @@
 #include "bf5xx-sport.h"
 #include "bf5xx-ac97.h"
 
+
+#define PIN_REQ_SPORT_0 {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, \
+		 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0}
+
+#define PIN_REQ_SPORT_1 {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS, \
+		 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0}
+
 static int *cmd_count;
+static int sport_num = CONFIG_SND_BF5XX_SPORT_NUM;
 
+static struct sport_param sport_params[2] = {
+	{
+		.dma_rx_chan	= CH_SPORT0_RX,
+		.dma_tx_chan	= CH_SPORT0_TX,
+		.err_irq	= IRQ_SPORT0_ERROR,
+		.regs		= (struct sport_register *)SPORT0_TCR1,
+	},
+	{
+		.dma_rx_chan	= CH_SPORT1_RX,
+		.dma_tx_chan	= CH_SPORT1_TX,
+		.err_irq	= IRQ_SPORT1_ERROR,
+		.regs		= (struct sport_register *)SPORT1_TCR1,
+	}
+};
+
+struct sport_device *sport_handle;
+EXPORT_SYMBOL(sport_handle);
+
 void bf5xx_ac97_pcm32_to_frame(struct ac97_frame *dst, const __u32 *src, \
 		size_t count)
 {
@@ -43,6 +69,7 @@
 		(dst++)->ac97_pcm = *src++;
 	}
 }
+EXPORT_SYMBOL(bf5xx_ac97_pcm32_to_frame);
 
 void bf5xx_ac97_frame_to_pcm32(const struct ac97_frame *src, __u32 *dst, \
 		size_t count)
@@ -51,6 +78,7 @@
 		*(dst++) = (src++)->ac97_pcm;
 	}
 }
+EXPORT_SYMBOL(bf5xx_ac97_frame_to_pcm32);
 
 static unsigned int sport_tx_curr_frag(struct sport_device *sport)
 {
@@ -213,10 +241,41 @@
 
 static int bf5xx_ac97_probe(struct platform_device *pdev)
 {
+	u16 sport_req[][7] = {PIN_REQ_SPORT_0, PIN_REQ_SPORT_1};
 	cmd_count = (int *)get_zeroed_page(GFP_KERNEL);
 	if (cmd_count == NULL)
 		return -ENOMEM;
 
+	if (peripheral_request_list(&sport_req[sport_num][0], "soc-audio")) {
+		printk(KERN_ERR "Requesting Peripherals faild\n");
+		return -EFAULT;
+		}
+
+#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
+	/* Request PB3 as reset pin */
+	if (gpio_request(CONFIG_SND_BF5XX_RESET_GPIO_NUM, "SND_AD198x RESET")) {
+		printk(KERN_ERR "Failed to request GPIO_%d for reset\n",
+				CONFIG_SND_BF5XX_RESET_GPIO_NUM);
+		peripheral_free_list(&sport_req[sport_num][0]);
+		return -1;
+	}
+	gpio_direction_output(CONFIG_SND_BF5XX_RESET_GPIO_NUM);
+	gpio_set_value(CONFIG_SND_BF5XX_RESET_GPIO_NUM, 1);
+#endif
+	sport_handle = sport_init(&sport_params[sport_num], 2, \
+			sizeof(struct ac97_frame), NULL);
+	if (!sport_handle) {
+		peripheral_free_list(&sport_req[sport_num][0]);
+#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
+		gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM);
+#endif
+		return -ENODEV;
+	}
+
+	sport_set_multichannel(sport_handle, 16, 0x1F, 1);
+	sport_config_rx(sport_handle, IRFS, 0xF, 0, (16*16-1));
+	sport_config_tx(sport_handle, ITFS, 0xF, 0, (16*16-1));
+
 	ac_entry = create_proc_entry("driver/sport_ac97", 0600, NULL);
 	ac_entry->read_proc = NULL;
 	ac_entry->write_proc = proc_write;

Modified: trunk/sound/soc/blackfin/bf5xx-board.c (3882 => 3883)


--- trunk/sound/soc/blackfin/bf5xx-board.c	2007-11-16 06:55:34 UTC (rev 3882)
+++ trunk/sound/soc/blackfin/bf5xx-board.c	2007-11-16 07:44:08 UTC (rev 3883)
@@ -31,31 +31,6 @@
 #include "bf5xx-pcm.h"
 #include "bf5xx-ac97.h"
 
-#define PIN_REQ_SPORT_0 {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, \
-		 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0}
-
-#define PIN_REQ_SPORT_1 {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS, \
-		 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0}
-
-static int sport_num = CONFIG_SND_BF5XX_SPORT_NUM;
-
-static struct sport_param sport_params[2] = {
-	{
-		.dma_rx_chan	= CH_SPORT0_RX,
-		.dma_tx_chan	= CH_SPORT0_TX,
-		.err_irq	= IRQ_SPORT0_ERROR,
-		.regs		= (struct sport_register *)SPORT0_TCR1,
-	},
-	{
-		.dma_rx_chan	= CH_SPORT1_RX,
-		.dma_tx_chan	= CH_SPORT1_TX,
-		.err_irq	= IRQ_SPORT1_ERROR,
-		.regs		= (struct sport_register *)SPORT1_TCR1,
-	}
-};
-
-struct sport_device *sport_handle;
-
 static struct snd_soc_machine bf5xx_board;
 
 static int bf5xx_board_startup(struct snd_pcm_substream *substream)
@@ -83,39 +58,6 @@
 
 static int bf5xx_probe(struct platform_device *pdev)
 {
-
-	u16 sport_req[][7] = {PIN_REQ_SPORT_0, PIN_REQ_SPORT_1};
-
-	if (peripheral_request_list(&sport_req[sport_num][0], "soc-audio")) {
-		printk(KERN_ERR "Requesting Peripherals faild\n");
-		return -EFAULT;
-		}
-
-#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
-	/* Request PB3 as reset pin */
-	if (gpio_request(CONFIG_SND_BF5XX_RESET_GPIO_NUM, "SND_AD198x RESET")) {
-		printk(KERN_ERR "Failed to request GPIO_%d for reset\n",
-				CONFIG_SND_BF5XX_RESET_GPIO_NUM);
-		peripheral_free_list(&sport_req[sport_num][0]);
-		return -1;
-	}
-	gpio_direction_output(CONFIG_SND_BF5XX_RESET_GPIO_NUM);
-	gpio_set_value(CONFIG_SND_BF5XX_RESET_GPIO_NUM, 1);
-#endif
-	sport_handle = sport_init(&sport_params[sport_num], 2, \
-			sizeof(struct ac97_frame), NULL);
-	if (!sport_handle) {
-		peripheral_free_list(&sport_req[sport_num][0]);
-#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
-		gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM);
-#endif
-		return -ENODEV;
-	}
-
-	sport_set_multichannel(sport_handle, 16, 0x1F, 1);
-	sport_config_rx(sport_handle, IRFS, 0xF, 0, (16*16-1));
-	sport_config_tx(sport_handle, ITFS, 0xF, 0, (16*16-1));
-
 	return 0;
 }
 

Modified: trunk/sound/soc/blackfin/bf5xx-sport.c (3882 => 3883)


--- trunk/sound/soc/blackfin/bf5xx-sport.c	2007-11-16 06:55:34 UTC (rev 3882)
+++ trunk/sound/soc/blackfin/bf5xx-sport.c	2007-11-16 07:44:08 UTC (rev 3883)
@@ -85,6 +85,7 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(sport_set_multichannel);
 
 int sport_config_rx(struct sport_device *sport, unsigned int rcr1,
 		unsigned int rcr2, unsigned int clkdiv, unsigned int fsdiv)
@@ -101,6 +102,7 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(sport_config_rx);
 
 int sport_config_tx(struct sport_device *sport, unsigned int tcr1,
 		unsigned int tcr2, unsigned int clkdiv, unsigned int fsdiv)
@@ -117,6 +119,7 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(sport_config_tx);
 
 static void setup_desc(struct dmasg *desc, void *buf, int fragcount,
 		size_t fragsize, unsigned int cfg,
@@ -267,6 +270,7 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(sport_rx_start);
 
 int sport_rx_stop(struct sport_device *sport)
 {
@@ -288,6 +292,7 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(sport_rx_stop);
 
 static inline int sport_hook_tx_dummy(struct sport_device *sport)
 {
@@ -347,6 +352,7 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(sport_tx_start);
 
 int sport_tx_stop(struct sport_device *sport)
 {
@@ -367,6 +373,7 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(sport_tx_stop);
 
 static inline int compute_wdsize(size_t wdsize)
 {
@@ -444,6 +451,7 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(sport_config_rx_dma);
 
 int sport_config_tx_dma(struct sport_device *sport, void *buf, \
 		int fragcount, size_t fragsize)
@@ -507,6 +515,7 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(sport_config_tx_dma);
 
 /* setup dummy dma descriptor ring, which don't generate interrupts,
  * the x_modify is set to 0 */
@@ -586,12 +595,14 @@
 
 	return ((unsigned char *)curr - sport->rx_buf);
 }
+EXPORT_SYMBOL(sport_curr_offset_rx);
 
 unsigned long sport_curr_offset_tx(struct sport_device *sport)
 {
 	unsigned long curr = get_dma_curr_addr(sport->dma_tx_chan);
 	return ((unsigned char *)curr - sport->tx_buf);
 }
+EXPORT_SYMBOL(sport_curr_offset_tx);
 
 void incfrag(struct sport_device *sport, int *frag, int tx)
 {
@@ -698,7 +709,6 @@
 {
 	unsigned int tx_stat;
 	struct sport_device *sport = dev_id;
-	unsigned long ptr;
 	pr_debug("%s enter\n", __FUNCTION__);
 	sport_check_status(sport, NULL, NULL, &tx_stat);
 	if (!(tx_stat & DMA_DONE)) {
@@ -749,6 +759,7 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(sport_set_rx_callback);
 
 int sport_set_tx_callback(struct sport_device *sport,
 		void (*tx_callback)(void *), void *tx_data)
@@ -759,6 +770,8 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(sport_set_tx_callback);
+
 int sport_set_err_callback(struct sport_device *sport,
 		void (*err_callback)(void *), void *err_data)
 {
@@ -768,6 +781,7 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(sport_set_err_callback);
 
 struct sport_device *sport_init(struct sport_param *param, unsigned wdsize,
 		unsigned dummy_count, void *private_data)
@@ -861,6 +875,7 @@
 	kfree(sport);
 	return NULL;
 }
+EXPORT_SYMBOL(sport_init);
 
 void sport_done(struct sport_device *sport)
 {
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to