Title: [3916] trunk/sound/blackfin/ad1836.c: task [#1726] add ad1836 PM support, re-configure sport in resume callback,enable suspend/ resume in pcm trigger callback
Revision
3916
Author
cliff
Date
2007-11-21 19:01:11 -0600 (Wed, 21 Nov 2007)

Log Message

task [#1726] add ad1836 PM support,re-configure sport in resume callback,enable suspend/resume in pcm trigger callback 

Diffstat

 ad1836.c |   33 +++++++++++++++++++++++++++++----
 1 files changed, 29 insertions(+), 4 deletions(-)

Modified Paths

Diff

Modified: trunk/sound/blackfin/ad1836.c (3915 => 3916)


--- trunk/sound/blackfin/ad1836.c	2007-11-21 14:18:06 UTC (rev 3915)
+++ trunk/sound/blackfin/ad1836.c	2007-11-22 01:01:11 UTC (rev 3916)
@@ -847,7 +847,7 @@
  *************************************************************/
 
 static struct snd_pcm_hardware snd_ad1836_playback_hw = {
-	.info = ( SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER ),
+	.info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_RESUME),
 #ifdef LINPHONE_SETTING
 	.formats =          SNDRV_PCM_FMTBIT_S16_LE,
 	.rates =            SNDRV_PCM_RATE_8000,
@@ -871,7 +871,7 @@
 };
 
 static struct snd_pcm_hardware snd_ad1836_capture_hw = {
-	.info = ( SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER ),
+	.info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_RESUME),
 #ifdef LINPHONE_SETTING
 	.formats =          SNDRV_PCM_FMTBIT_S16_LE,
 	.rates =            SNDRV_PCM_RATE_8000,
@@ -1137,6 +1137,7 @@
 	spin_lock(&chip->ad1836_lock);
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
+	case SNDRV_PCM_TRIGGER_RESUME:
 #ifdef MULTI_SUBSTREAM
 		if (!chip->tx_dma_started) {
 			chip->dma_pos = 0;
@@ -1149,6 +1150,7 @@
 		bf53x_sport_tx_start(chip->sport);
 #endif
 		break;
+	case SNDRV_PCM_TRIGGER_SUSPEND:
 	case SNDRV_PCM_TRIGGER_STOP:
 #ifdef MULTI_SUBSTREAM
 		chip->tx_status &= ~ (1 << index);
@@ -1181,8 +1183,10 @@
 	snd_assert(substream == chip->rx_substream, return -EINVAL);
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
+	case SNDRV_PCM_TRIGGER_RESUME:
 		bf53x_sport_rx_start(chip->sport);
 		break;
+	case SNDRV_PCM_TRIGGER_SUSPEND:
 	case SNDRV_PCM_TRIGGER_STOP:
 		bf53x_sport_rx_stop(chip->sport);
 		break;
@@ -2075,9 +2079,30 @@
 static int snd_ad1836_resume(struct platform_device *pdev)
 {
 	struct snd_card *card = platform_get_drvdata(pdev);
-
+	struct snd_ad1836 *ad1836 = card->private_data;
+	int err = 0;
 	snd_printk_marker();
-
+	/*re-configure sport*/
+#ifdef CONFIG_SND_BLACKFIN_AD1836_TDM
+	err = err || bf53x_sport_config_rx(ad1836->sport, RFSR, 0x1f, 0, 0);
+	err = err || bf53x_sport_config_tx(ad1836->sport, TFSR, 0x1f, 0, 0);
+	/*Set 8 channels and packed */
+	err = err || bf53x_sport_set_multichannel(ad1836->sport, 8, 1);
+	if (err)
+		snd_printk(KERN_ERR "Unable to set sport configuration\n");
+#elif defined(CONFIG_SND_BLACKFIN_AD1836_I2S)
+#ifdef LINPHONE_SETTING
+	/* Set word length to 16 bits */
+	err = err || bf53x_sport_config_rx(ad1836->sport, (RCKFE | RFSR), (RSFSE | 0xf), 0, 0);
+	err = err || bf53x_sport_config_tx(ad1836->sport, (TCKFE | TFSR), (TSFSE | 0xf), 0, 0);
+#else
+	/* Set word length to 24 bits */
+	err = err || bf53x_sport_config_rx(ad1836->sport, (RCKFE | RFSR), (RSFSE | 0x17), 0, 0);
+	err = err || bf53x_sport_config_tx(ad1836->sport, (TCKFE | TFSR), (TSFSE | 0x17), 0, 0);
+#endif
+	if (err)
+		snd_printk(KERN_ERR "Unable to set sport configuration\n");
+#endif
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
 	return 0;
 }
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to