Title: [5997] trunk/sound/soc: bug[#4710]set constraint only if the value is not 0,change the configuring way for sport
Revision
5997
Author
cliff
Date
2009-01-12 03:39:44 -0600 (Mon, 12 Jan 2009)

Log Message

bug[#4710]set constraint only if the value is not 0,change the configuring way for sport

Modified Paths

Diff

Modified: trunk/sound/soc/blackfin/bf5xx-i2s.c (5996 => 5997)


--- trunk/sound/soc/blackfin/bf5xx-i2s.c	2009-01-12 07:25:44 UTC (rev 5996)
+++ trunk/sound/soc/blackfin/bf5xx-i2s.c	2009-01-12 09:39:44 UTC (rev 5997)
@@ -49,7 +49,7 @@
 	u16 rcr1;
 	u16 tcr2;
 	u16 rcr2;
-	int counter;
+	int configured;
 };
 
 static struct bf5xx_i2s_port bf5xx_i2s;
@@ -132,15 +132,6 @@
 	return ret;
 }
 
-static int bf5xx_i2s_startup(struct snd_pcm_substream *substream)
-{
-	pr_debug("%s enter\n", __func__);
-
-	/*this counter is used for counting how many pcm streams are opened*/
-	bf5xx_i2s.counter++;
-	return 0;
-}
-
 static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream,
 				struct snd_pcm_hw_params *params)
 {
@@ -166,7 +157,7 @@
 		break;
 	}
 
-	if (bf5xx_i2s.counter == 1) {
+	if (!bf5xx_i2s.configured) {
 		/*
 		 * TX and RX are not independent,they are enabled at the
 		 * same time, even if only one side is running. So, we
@@ -188,17 +179,12 @@
 			pr_err("SPORT is busy!\n");
 			return -EBUSY;
 		}
+		bf5xx_i2s.configured = 1;
 	}
 
 	return 0;
 }
 
-static void bf5xx_i2s_shutdown(struct snd_pcm_substream *substream)
-{
-	pr_debug("%s enter\n", __func__);
-	bf5xx_i2s.counter--;
-}
-
 static int bf5xx_i2s_probe(struct platform_device *pdev,
 			   struct snd_soc_dai *dai)
 {
@@ -305,8 +291,6 @@
 		.rates = BF5XX_I2S_RATES,
 		.formats = BF5XX_I2S_FORMATS,},
 	.ops = {
-		.startup   = bf5xx_i2s_startup,
-		.shutdown  = bf5xx_i2s_shutdown,
 		.hw_params = bf5xx_i2s_hw_params,},
 	.dai_ops = {
 		.set_fmt = bf5xx_i2s_set_dai_fmt,

Modified: trunk/sound/soc/codecs/ssm2602.c (5996 => 5997)


--- trunk/sound/soc/codecs/ssm2602.c	2009-01-12 07:25:44 UTC (rev 5996)
+++ trunk/sound/soc/codecs/ssm2602.c	2009-01-12 09:39:44 UTC (rev 5997)
@@ -49,8 +49,8 @@
 /* codec private data */
 struct ssm2602_priv {
 	unsigned int sysclk;
-	struct snd_pcm_substream *master_substream;
-	struct snd_pcm_substream *slave_substream;
+	unsigned int master_rate;
+	unsigned int master_sample_bits;
 };
 
 /*
@@ -330,26 +330,25 @@
 	struct snd_soc_device *socdev = rtd->socdev;
 	struct snd_soc_codec *codec = socdev->codec;
 	struct ssm2602_priv *ssm2602 = codec->private_data;
-	struct snd_pcm_runtime *master_runtime;
 
 	/* The DAI has shared clocks so if we already have a playback or
 	 * capture going then constrain this substream to match it.
 	 */
-	if (ssm2602->master_substream) {
-		master_runtime = ssm2602->master_substream->runtime;
+	if (ssm2602->master_rate) {
 		snd_pcm_hw_constraint_minmax(substream->runtime,
 					     SNDRV_PCM_HW_PARAM_RATE,
-					     master_runtime->rate,
-					     master_runtime->rate);
+					     ssm2602->master_rate,
+					     ssm2602->master_rate);
+	} else
+		ssm2602->master_rate = substream->runtime->rate;
 
+	if (ssm2602->master_sample_bits) {
 		snd_pcm_hw_constraint_minmax(substream->runtime,
 					     SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
-					     master_runtime->sample_bits,
-					     master_runtime->sample_bits);
-
-		ssm2602->slave_substream = substream;
+					     ssm2602->master_sample_bits,
+					     ssm2602->master_sample_bits);
 	} else
-		ssm2602->master_substream = substream;
+		ssm2602->master_sample_bits = substream->runtime->sample_bits;
 
 	return 0;
 }
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to