>From 4235ede8483cb177ff26d7344699a6481a222cc7 Mon Sep 17 00:00:00 2001
From: Petr Cvek <petrcvekcz@gmail.com>
Date: Fri, 3 Aug 2018 06:21:41 +0200
Subject: [PATCH] ASoC pxa magician testing

---
 sound/arm/pxa2xx-pcm-lib.c |  23 +++++-
 sound/core/pcm_dmaengine.c |   7 ++
 sound/core/pcm_native.c    |  97 +++++++++++++----------
 sound/soc/codecs/uda1380.c |  56 +++++++++-----
 sound/soc/pxa/magician.c   | 152 +++++++++++++++++++------------------
 sound/soc/pxa/pxa-ssp.c    | 139 ++++++++++++++++++++++++++++++++-
 sound/soc/pxa/pxa2xx-i2s.c |  49 ++++++++++++
 sound/soc/soc-core.c       |  15 ++++
 sound/soc/soc-pcm.c        |  25 ++++++
 9 files changed, 428 insertions(+), 135 deletions(-)

diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c
index 7931789d4a9f..1a3affb0b691 100644
--- a/sound/arm/pxa2xx-pcm-lib.c
+++ b/sound/arm/pxa2xx-pcm-lib.c
@@ -29,7 +29,7 @@ static const struct snd_pcm_hardware pxa2xx_pcm_hardware = {
 	.period_bytes_max	= 8192 - 32,
 	.periods_min		= 1,
 	.periods_max		= 256,
-	.buffer_bytes_max	= 128 * 1024,
+	.buffer_bytes_max	= 16 * 1024,	//original value fails to allocate (128 * 1024 too big)
 	.fifo_size		= 32,
 };
 
@@ -42,23 +42,29 @@ int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
 	struct dma_slave_config config;
 	int ret;
 
+pr_info("pxa2xx_pcm_hw_params A1\n");
 	dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
 	if (!dma_params)
 		return 0;
 
+pr_info("pxa2xx_pcm_hw_params A2\n");
 	ret = snd_hwparams_to_dma_slave_config(substream, params, &config);
 	if (ret)
 		return ret;
 
+pr_info("pxa2xx_pcm_hw_params A3\n");
 	snd_dmaengine_pcm_set_config_from_dai_data(substream,
 			snd_soc_dai_get_dma_data(rtd->cpu_dai, substream),
 			&config);
 
+pr_info("pxa2xx_pcm_hw_params A4\n");
 	ret = dmaengine_slave_config(chan, &config);
 	if (ret)
 		return ret;
 
+pr_info("pxa2xx_pcm_hw_params A5\n");
 	snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
+pr_info("pxa2xx_pcm_hw_params A6 fin\n");
 
 	return 0;
 }
@@ -99,10 +105,13 @@ int pxa2xx_pcm_open(struct snd_pcm_substream *substream)
 
 	runtime->hw = pxa2xx_pcm_hardware;
 
+pr_info("pxa2xx_pcm_open B1\n");
+
 	dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
 	if (!dma_params)
 		return 0;
 
+pr_info("pxa2xx_pcm_open B2\n");
 	/*
 	 * For mysterious reasons (and despite what the manual says)
 	 * playback samples are lost if the DMA count is not a multiple
@@ -113,15 +122,19 @@ int pxa2xx_pcm_open(struct snd_pcm_substream *substream)
 	if (ret)
 		return ret;
 
+pr_info("B3\n");
+
 	ret = snd_pcm_hw_constraint_step(runtime, 0,
 		SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 32);
 	if (ret)
 		return ret;
+pr_info("B4\n");
 
 	ret = snd_pcm_hw_constraint_integer(runtime,
 					    SNDRV_PCM_HW_PARAM_PERIODS);
 	if (ret < 0)
 		return ret;
+pr_info("B5 fin?\n");
 
 	return snd_dmaengine_pcm_open(
 		substream, dma_request_slave_channel(rtd->cpu_dai->dev,
@@ -185,13 +198,18 @@ int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd)
 	struct snd_pcm *pcm = rtd->pcm;
 	int ret;
 
+pr_info("C1 pxa2xx_soc_pcm_new\n");
+
 	ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
+pr_info("C2 from dma_coerce_mask_and_coherent %i\n",ret);
 	if (ret)
 		return ret;
 
+
 	if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
 		ret = pxa2xx_pcm_preallocate_dma_buffer(pcm,
 			SNDRV_PCM_STREAM_PLAYBACK);
+pr_info("C3play from pxa2xx_pcm_preallocate_dma_buffer %i\n",ret);
 		if (ret)
 			goto out;
 	}
@@ -199,6 +217,9 @@ int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd)
 	if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
 		ret = pxa2xx_pcm_preallocate_dma_buffer(pcm,
 			SNDRV_PCM_STREAM_CAPTURE);
+pr_info("C4capt from pxa2xx_pcm_preallocate_dma_buffer %i\n",ret);
+
+		//WTF konstrukce
 		if (ret)
 			goto out;
 	}
diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c
index 8eb58c709b14..124952e8a3f4 100644
--- a/sound/core/pcm_dmaengine.c
+++ b/sound/core/pcm_dmaengine.c
@@ -18,6 +18,9 @@
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  *
  */
+
+#define DEBUG 1
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/dmaengine.h>
@@ -369,11 +372,15 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close);
 int snd_dmaengine_pcm_close_release_chan(struct snd_pcm_substream *substream)
 {
 	struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream);
+pr_info("GGG1 %i\n",prtd->dma_chan->client_count);
 
 	dmaengine_synchronize(prtd->dma_chan);
+pr_info("GGG2\n");
 	dma_release_channel(prtd->dma_chan);
+pr_info("GGG3\n");
 	kfree(prtd);
 
+pr_info("GGG4\n");
 	return 0;
 }
 EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close_release_chan);
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 66c90f486af9..57a66a5dd21d 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -990,7 +990,7 @@ static int snd_pcm_channel_info(struct snd_pcm_substream *substream,
 {
 	struct snd_pcm_runtime *runtime;
 	unsigned int channel;
-	
+
 	channel = info->channel;
 	runtime = substream->runtime;
 	snd_pcm_stream_lock_irq(substream);
@@ -1011,7 +1011,7 @@ static int snd_pcm_channel_info_user(struct snd_pcm_substream *substream,
 {
 	struct snd_pcm_channel_info info;
 	int res;
-	
+
 	if (copy_from_user(&info, _info, sizeof(info)))
 		return -EFAULT;
 	res = snd_pcm_channel_info(substream, &info);
@@ -1111,7 +1111,7 @@ static int snd_pcm_action_single(const struct action_ops *ops,
 				 int state)
 {
 	int res;
-	
+
 	res = ops->pre_action(substream, state);
 	if (res < 0)
 		return res;
@@ -1221,7 +1221,7 @@ static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state)
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	snd_pcm_trigger_tstamp(substream);
 	runtime->hw_ptr_jiffies = jiffies;
-	runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) / 
+	runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) /
 							    runtime->rate;
 	runtime->status->state = state;
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
@@ -1909,7 +1909,7 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
 {
 	struct snd_pcm_runtime *runtime;
 	int result = 0;
-	
+
 	if (PCM_RUNTIME_CHECK(substream))
 		return -ENXIO;
 	runtime = substream->runtime;
@@ -2145,7 +2145,7 @@ static int snd_pcm_hw_rule_rate(struct snd_pcm_hw_params *params,
 	return snd_interval_list(hw_param_interval(params, rule->var),
 				 snd_pcm_known_rates.count,
 				 snd_pcm_known_rates.list, hw->rates);
-}		
+}
 
 static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params,
 					    struct snd_pcm_hw_rule *rule)
@@ -2158,7 +2158,7 @@ static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params,
 	t.openmax = 0;
 	t.integer = 1;
 	return snd_interval_refine(hw_param_interval(params, rule->var), &t);
-}		
+}
 
 int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream)
 {
@@ -2185,98 +2185,98 @@ int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream)
 				   SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
 				  snd_pcm_hw_rule_sample_bits, NULL,
-				  SNDRV_PCM_HW_PARAM_FORMAT, 
+				  SNDRV_PCM_HW_PARAM_FORMAT,
 				  SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
 				  snd_pcm_hw_rule_div, NULL,
 				  SNDRV_PCM_HW_PARAM_FRAME_BITS, SNDRV_PCM_HW_PARAM_CHANNELS, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS,
 				  snd_pcm_hw_rule_mul, NULL,
 				  SNDRV_PCM_HW_PARAM_SAMPLE_BITS, SNDRV_PCM_HW_PARAM_CHANNELS, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS,
 				  snd_pcm_hw_rule_mulkdiv, (void*) 8,
 				  SNDRV_PCM_HW_PARAM_PERIOD_BYTES, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS,
 				  snd_pcm_hw_rule_mulkdiv, (void*) 8,
 				  SNDRV_PCM_HW_PARAM_BUFFER_BYTES, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
 				  snd_pcm_hw_rule_div, NULL,
 				  SNDRV_PCM_HW_PARAM_FRAME_BITS, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
 				  snd_pcm_hw_rule_mulkdiv, (void*) 1000000,
 				  SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_PERIOD_TIME, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
 				  snd_pcm_hw_rule_mulkdiv, (void*) 1000000,
 				  SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_BUFFER_TIME, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS,
 				  snd_pcm_hw_rule_div, NULL,
 				  SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
 				  snd_pcm_hw_rule_div, NULL,
 				  SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_PERIODS, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
 				  snd_pcm_hw_rule_mulkdiv, (void*) 8,
 				  SNDRV_PCM_HW_PARAM_PERIOD_BYTES, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
 				  snd_pcm_hw_rule_muldivk, (void*) 1000000,
 				  SNDRV_PCM_HW_PARAM_PERIOD_TIME, SNDRV_PCM_HW_PARAM_RATE, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
 				  snd_pcm_hw_rule_mul, NULL,
 				  SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_PERIODS, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
 				  snd_pcm_hw_rule_mulkdiv, (void*) 8,
 				  SNDRV_PCM_HW_PARAM_BUFFER_BYTES, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
 				  snd_pcm_hw_rule_muldivk, (void*) 1000000,
 				  SNDRV_PCM_HW_PARAM_BUFFER_TIME, SNDRV_PCM_HW_PARAM_RATE, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
 				  snd_pcm_hw_rule_muldivk, (void*) 8,
 				  SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
 				  snd_pcm_hw_rule_muldivk, (void*) 8,
 				  SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME,
 				  snd_pcm_hw_rule_mulkdiv, (void*) 1000000,
 				  SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_RATE, -1);
 	if (err < 0)
 		return err;
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME,
 				  snd_pcm_hw_rule_mulkdiv, (void*) 1000000,
 				  SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_RATE, -1);
 	if (err < 0)
@@ -2340,7 +2340,7 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)
 	if (err < 0)
 		return err;
 
-	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 
+	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
 				  snd_pcm_hw_rule_buffer_bytes_max, substream,
 				  SNDRV_PCM_HW_PARAM_BUFFER_BYTES, -1);
 	if (err < 0)
@@ -2354,7 +2354,7 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)
 	}
 
 	if (!(hw->rates & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))) {
-		err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, 
+		err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
 					  snd_pcm_hw_rule_rate, hw,
 					  SNDRV_PCM_HW_PARAM_RATE, -1);
 		if (err < 0)
@@ -2374,11 +2374,17 @@ static void pcm_release_private(struct snd_pcm_substream *substream)
 
 void snd_pcm_release_substream(struct snd_pcm_substream *substream)
 {
+
+pr_info("DDD1 snd_pcm_release_substream %i\n",substream->ref_count);
+
 	substream->ref_count--;
 	if (substream->ref_count > 0)
 		return;
 
+pr_info("DDD2\n");
+
 	snd_pcm_drop(substream);
+pr_info("DDD3\n");
 	if (substream->hw_opened) {
 		if (substream->ops->hw_free &&
 		    substream->runtime->status->state != SNDRV_PCM_STATE_OPEN)
@@ -2386,13 +2392,16 @@ void snd_pcm_release_substream(struct snd_pcm_substream *substream)
 		substream->ops->close(substream);
 		substream->hw_opened = 0;
 	}
+pr_info("DDD4\n");
 	if (pm_qos_request_active(&substream->latency_pm_qos_req))
 		pm_qos_remove_request(&substream->latency_pm_qos_req);
 	if (substream->pcm_release) {
 		substream->pcm_release(substream);
 		substream->pcm_release = NULL;
 	}
+pr_info("DDD5\n");
 	snd_pcm_detach_substream(substream);
+pr_info("DDD6\n");
 }
 EXPORT_SYMBOL(snd_pcm_release_substream);
 
@@ -2555,18 +2564,28 @@ static int snd_pcm_release(struct inode *inode, struct file *file)
 	struct snd_pcm_substream *substream;
 	struct snd_pcm_file *pcm_file;
 
+pr_info("CCC1 snd_pcm_release\n");
+
 	pcm_file = file->private_data;
 	substream = pcm_file->substream;
+pr_info("CCC2\n");
 	if (snd_BUG_ON(!substream))
 		return -ENXIO;
 	pcm = substream->pcm;
 	mutex_lock(&pcm->open_mutex);
+pr_info("CCC3\n");
 	snd_pcm_release_substream(substream);
+pr_info("CCC4\n");
 	kfree(pcm_file);
+pr_info("CCC5\n");
 	mutex_unlock(&pcm->open_mutex);
+pr_info("CCC6\n");
 	wake_up(&pcm->open_wait);
+pr_info("CCC7\n");
 	module_put(pcm->card->module);
+pr_info("CCC8\n");
 	snd_card_file_remove(pcm->card, file);
+pr_info("CCC9\n");
 	return 0;
 }
 
@@ -2682,7 +2701,7 @@ static int snd_pcm_hwsync(struct snd_pcm_substream *substream)
 	snd_pcm_stream_unlock_irq(substream);
 	return err;
 }
-		
+
 static int snd_pcm_delay(struct snd_pcm_substream *substream,
 			 snd_pcm_sframes_t *delay)
 {
@@ -2698,7 +2717,7 @@ static int snd_pcm_delay(struct snd_pcm_substream *substream,
 		*delay = n;
 	return err;
 }
-		
+
 static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream,
 			    struct snd_pcm_sync_ptr __user *_sync_ptr)
 {
@@ -2712,7 +2731,7 @@ static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream,
 	if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags)))
 		return -EFAULT;
 	if (copy_from_user(&sync_ptr.c.control, &(_sync_ptr->c.control), sizeof(struct snd_pcm_mmap_control)))
-		return -EFAULT;	
+		return -EFAULT;
 	status = runtime->status;
 	control = runtime->control;
 	if (sync_ptr.flags & SNDRV_PCM_SYNC_PTR_HWSYNC) {
@@ -2750,7 +2769,7 @@ static int snd_pcm_tstamp(struct snd_pcm_substream *substream, int __user *_arg)
 {
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	int arg;
-	
+
 	if (get_user(arg, _arg))
 		return -EFAULT;
 	if (arg < 0 || arg > SNDRV_PCM_TSTAMP_TYPE_LAST)
@@ -2970,7 +2989,7 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream,
 {
 	snd_pcm_uframes_t *frames = arg;
 	snd_pcm_sframes_t result;
-	
+
 	switch (cmd) {
 	case SNDRV_PCM_IOCTL_FORWARD:
 	{
@@ -3181,7 +3200,7 @@ static vm_fault_t snd_pcm_mmap_status_fault(struct vm_fault *vmf)
 {
 	struct snd_pcm_substream *substream = vmf->vma->vm_private_data;
 	struct snd_pcm_runtime *runtime;
-	
+
 	if (substream == NULL)
 		return VM_FAULT_SIGBUS;
 	runtime = substream->runtime;
@@ -3217,7 +3236,7 @@ static vm_fault_t snd_pcm_mmap_control_fault(struct vm_fault *vmf)
 {
 	struct snd_pcm_substream *substream = vmf->vma->vm_private_data;
 	struct snd_pcm_runtime *runtime;
-	
+
 	if (substream == NULL)
 		return VM_FAULT_SIGBUS;
 	runtime = substream->runtime;
@@ -3309,7 +3328,7 @@ static vm_fault_t snd_pcm_mmap_data_fault(struct vm_fault *vmf)
 	unsigned long offset;
 	struct page * page;
 	size_t dma_bytes;
-	
+
 	if (substream == NULL)
 		return VM_FAULT_SIGBUS;
 	runtime = substream->runtime;
@@ -3452,9 +3471,9 @@ EXPORT_SYMBOL(snd_pcm_mmap_data);
 static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area)
 {
 	struct snd_pcm_file * pcm_file;
-	struct snd_pcm_substream *substream;	
+	struct snd_pcm_substream *substream;
 	unsigned long offset;
-	
+
 	pcm_file = file->private_data;
 	substream = pcm_file->substream;
 	if (PCM_RUNTIME_CHECK(substream))
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c
index 584a032b3cb1..5cd0e4e5d471 100644
--- a/sound/soc/codecs/uda1380.c
+++ b/sound/soc/codecs/uda1380.c
@@ -140,6 +140,8 @@ static void uda1380_sync_cache(struct snd_soc_component *component)
 	u8 data[3];
 	u16 *cache = uda1380->reg_cache;
 
+pr_info("D1 uda1380_sync_cache\n");
+
 	/* Sync reg_cache with the hardware */
 	for (reg = 0; reg < UDA1380_MVOL; reg++) {
 		data[0] = reg;
@@ -149,6 +151,9 @@ static void uda1380_sync_cache(struct snd_soc_component *component)
 			dev_err(component->dev, "%s: write to reg 0x%x failed\n",
 				__func__, reg);
 	}
+
+pr_info("D2 fin\n");
+
 }
 
 static int uda1380_reset(struct snd_soc_component *component)
@@ -203,8 +208,8 @@ static const char *uda1380_deemp[] = {
 };
 static const char *uda1380_input_sel[] = {
 	"Line",
-	"Mic + Line R",
 	"Line L",
+	"Mic + Line R",
 	"Mic",
 };
 static const char *uda1380_output_sel[] = {
@@ -227,8 +232,8 @@ static const char *uda1380_sel_ns[] = {
 };
 static const char *uda1380_mix_control[] = {
 	"off",
-	"PCM only",
 	"before sound processing",
+	"PCM only",
 	"after sound processing"
 };
 static const char *uda1380_sdet_setting[] = {
@@ -423,6 +428,8 @@ static int uda1380_set_dai_fmt_both(struct snd_soc_dai *codec_dai,
 	struct snd_soc_component *component = codec_dai->component;
 	int iface;
 
+pr_info("E1 uda1380_set_dai_fmt_both\n");
+
 	/* set up DAI based upon fmt */
 	iface = uda1380_read_reg_cache(component, UDA1380_IFACE);
 	iface &= ~(R01_SFORI_MASK | R01_SIM | R01_SFORO_MASK);
@@ -437,11 +444,13 @@ static int uda1380_set_dai_fmt_both(struct snd_soc_dai *codec_dai,
 	case SND_SOC_DAIFMT_MSB:
 		iface |= R01_SFORI_MSB | R01_SFORO_MSB;
 	}
+pr_info("E2\n");
 
 	/* DATAI is slave only, so in single-link mode, this has to be slave */
 	if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS)
 		return -EINVAL;
 
+pr_info("E3 fin\n");
 	uda1380_write_reg_cache(component, UDA1380_IFACE, iface);
 
 	return 0;
@@ -453,10 +462,14 @@ static int uda1380_set_dai_fmt_playback(struct snd_soc_dai *codec_dai,
 	struct snd_soc_component *component = codec_dai->component;
 	int iface;
 
+pr_info("F1 uda1380_set_dai_fmt_playback\n");
+
 	/* set up DAI based upon fmt */
 	iface = uda1380_read_reg_cache(component, UDA1380_IFACE);
 	iface &= ~R01_SFORI_MASK;
 
+pr_info("F2\n");
+
 	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 	case SND_SOC_DAIFMT_I2S:
 		iface |= R01_SFORI_I2S;
@@ -468,11 +481,15 @@ static int uda1380_set_dai_fmt_playback(struct snd_soc_dai *codec_dai,
 		iface |= R01_SFORI_MSB;
 	}
 
+pr_info("F3\n");
+
 	/* DATAI is slave only, so this has to be slave */
 	if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS)
 		return -EINVAL;
+pr_info("F4\n");
 
 	uda1380_write(component, UDA1380_IFACE, iface);
+pr_info("F5 fin\n");
 
 	return 0;
 }
@@ -513,6 +530,8 @@ static int uda1380_trigger(struct snd_pcm_substream *substream, int cmd,
 	struct uda1380_priv *uda1380 = snd_soc_component_get_drvdata(component);
 	int mixer = uda1380_read_reg_cache(component, UDA1380_MIXER);
 
+pr_info("G1 uda1380_trigger\n");
+
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
@@ -527,6 +546,9 @@ static int uda1380_trigger(struct snd_pcm_substream *substream, int cmd,
 		schedule_work(&uda1380->work);
 		break;
 	}
+
+pr_info("G2 fin\n");
+
 	return 0;
 }
 
@@ -537,6 +559,8 @@ static int uda1380_pcm_hw_params(struct snd_pcm_substream *substream,
 	struct snd_soc_component *component = dai->component;
 	u16 clk = uda1380_read_reg_cache(component, UDA1380_CLK);
 
+pr_info("H1 uda1380_pcm_hw_params\n");
+
 	/* set WSPLL power and divider if running from this clock */
 	if (clk & R00_DAC_CLK) {
 		int rate = params_rate(params);
@@ -559,12 +583,19 @@ static int uda1380_pcm_hw_params(struct snd_pcm_substream *substream,
 		uda1380_write(component, UDA1380_PM, R02_PON_PLL | pm);
 	}
 
+pr_info("H2\n");
+
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
 		clk |= R00_EN_DAC | R00_EN_INT;
 	else
 		clk |= R00_EN_ADC | R00_EN_DEC;
 
+pr_info("H3\n");
+
 	uda1380_write(component, UDA1380_CLK, clk);
+
+pr_info("H4 fin\n");
+
 	return 0;
 }
 
@@ -654,22 +685,8 @@ static const struct snd_soc_dai_ops uda1380_dai_ops_capture = {
 };
 
 static struct snd_soc_dai_driver uda1380_dai[] = {
-{
-	.name = "uda1380-hifi",
-	.playback = {
-		.stream_name = "Playback",
-		.channels_min = 1,
-		.channels_max = 2,
-		.rates = UDA1380_RATES,
-		.formats = SNDRV_PCM_FMTBIT_S16_LE,},
-	.capture = {
-		.stream_name = "Capture",
-		.channels_min = 1,
-		.channels_max = 2,
-		.rates = UDA1380_RATES,
-		.formats = SNDRV_PCM_FMTBIT_S16_LE,},
-	.ops = &uda1380_dai_ops,
-},
+// NOTICE first field of the array was unused and in
+// certain versions didn't work with magician
 { /* playback only - dual interface */
 	.name = "uda1380-hifi-playback",
 	.playback = {
@@ -783,6 +800,9 @@ static int uda1380_i2c_probe(struct i2c_client *i2c,
 
 	ret = devm_snd_soc_register_component(&i2c->dev,
 			&soc_component_dev_uda1380, uda1380_dai, ARRAY_SIZE(uda1380_dai));
+
+pr_info("uda1380_i2c_probe ret=%i\n",ret);
+
 	return ret;
 }
 
diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c
index 935a248e5bf6..2c83c8ef8eb7 100644
--- a/sound/soc/pxa/magician.c
+++ b/sound/soc/pxa/magician.c
@@ -44,7 +44,10 @@ static int magician_in_sel = MAGICIAN_MIC;
 static void magician_ext_control(struct snd_soc_dapm_context *dapm)
 {
 
+pr_info("I1 magician_ext_control\n");
+
 	snd_soc_dapm_mutex_lock(dapm);
+pr_info("I2\n");
 
 	if (magician_spk_switch)
 		snd_soc_dapm_enable_pin_unlocked(dapm, "Speaker");
@@ -54,6 +57,7 @@ static void magician_ext_control(struct snd_soc_dapm_context *dapm)
 		snd_soc_dapm_enable_pin_unlocked(dapm, "Headphone Jack");
 	else
 		snd_soc_dapm_disable_pin_unlocked(dapm, "Headphone Jack");
+pr_info("I3\n");
 
 	switch (magician_in_sel) {
 	case MAGICIAN_MIC:
@@ -65,10 +69,13 @@ static void magician_ext_control(struct snd_soc_dapm_context *dapm)
 		snd_soc_dapm_enable_pin_unlocked(dapm, "Headset Mic");
 		break;
 	}
+pr_info("I4\n");
 
 	snd_soc_dapm_sync_unlocked(dapm);
 
+pr_info("I5\n");
 	snd_soc_dapm_mutex_unlock(dapm);
+pr_info("I6 fin\n");
 }
 
 static int magician_startup(struct snd_pcm_substream *substream)
@@ -93,11 +100,14 @@ static int magician_playback_hw_params(struct snd_pcm_substream *substream,
 	unsigned int width;
 	int ret = 0;
 
+pr_info("J1 magician_playback_hw_params\n");
+
 	/* set codec DAI configuration */
 	ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_MSB |
 			SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
 	if (ret < 0)
 		return ret;
+pr_info("J2\n");
 
 	/* set cpu DAI configuration */
 	ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_A |
@@ -105,17 +115,22 @@ static int magician_playback_hw_params(struct snd_pcm_substream *substream,
 	if (ret < 0)
 		return ret;
 
+pr_info("J3\n");
 	width = snd_pcm_format_physical_width(params_format(params));
 	ret = snd_soc_dai_set_tdm_slot(cpu_dai, 1, 0, 1, width);
 	if (ret < 0)
 		return ret;
 
+pr_info("J4\n");
+
 	/* set audio clock as clock source */
 	ret = snd_soc_dai_set_sysclk(cpu_dai, PXA_SSP_CLK_AUDIO, 0,
 			SND_SOC_CLOCK_OUT);
 	if (ret < 0)
 		return ret;
 
+pr_info("J5 fin\n");
+
 	return 0;
 }
 
@@ -175,11 +190,18 @@ static int magician_set_hp(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
 
+pr_info("K1 magician_set_hp\n");
+
 	if (magician_hp_switch == ucontrol->value.integer.value[0])
 		return 0;
 
+pr_info("K2\n");
+
 	magician_hp_switch = ucontrol->value.integer.value[0];
 	magician_ext_control(&card->dapm);
+
+pr_info("K3 fin\n");
+
 	return 1;
 }
 
@@ -195,11 +217,16 @@ static int magician_set_spk(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
 
+pr_info("L1 magician_set_spk %i\n",ucontrol->value.integer.value[0]);
+
 	if (magician_spk_switch == ucontrol->value.integer.value[0])
 		return 0;
 
+pr_info("L2\n");
 	magician_spk_switch = ucontrol->value.integer.value[0];
+pr_info("L3\n");
 	magician_ext_control(&card->dapm);
+pr_info("L4 fin\n");
 	return 1;
 }
 
@@ -213,11 +240,17 @@ static int magician_get_input(struct snd_kcontrol *kcontrol,
 static int magician_set_input(struct snd_kcontrol *kcontrol,
 			      struct snd_ctl_elem_value *ucontrol)
 {
+
+pr_info("M1 magician_set_input\n");
+
 	if (magician_in_sel == ucontrol->value.enumerated.item[0])
 		return 0;
 
+pr_info("M2\n");
+
 	magician_in_sel = ucontrol->value.enumerated.item[0];
 
+pr_info("M3\n");
 	switch (magician_in_sel) {
 	case MAGICIAN_MIC:
 		gpio_set_value(EGPIO_MAGICIAN_IN_SEL1, 1);
@@ -226,13 +259,20 @@ static int magician_set_input(struct snd_kcontrol *kcontrol,
 		gpio_set_value(EGPIO_MAGICIAN_IN_SEL1, 0);
 	}
 
+pr_info("M4 fin\n");
 	return 1;
 }
 
 static int magician_spk_power(struct snd_soc_dapm_widget *w,
 				struct snd_kcontrol *k, int event)
 {
+
+pr_info("N1 magician_spk_power\n");
+
 	gpio_set_value(EGPIO_MAGICIAN_SPK_POWER, SND_SOC_DAPM_EVENT_ON(event));
+
+pr_info("N2 fin\n");
+
 	return 0;
 }
 
@@ -292,22 +332,24 @@ static const struct snd_kcontrol_new uda1380_magician_controls[] = {
 /* magician digital audio interface glue - connects codec <--> CPU */
 static struct snd_soc_dai_link magician_dai[] = {
 {
-	.name = "uda1380",
+	.name = "uda1380_playback",
 	.stream_name = "UDA1380 Playback",
 	.cpu_dai_name = "pxa-ssp-dai.0",
 	.codec_dai_name = "uda1380-hifi-playback",
 	.platform_name = "pxa-pcm-audio",
 	.codec_name = "uda1380-codec.0-0018",
 	.ops = &magician_playback_ops,
+	.playback_only = true,
 },
 {
-	.name = "uda1380",
+	.name = "uda1380_capture",
 	.stream_name = "UDA1380 Capture",
 	.cpu_dai_name = "pxa2xx-i2s",
 	.codec_dai_name = "uda1380-hifi-capture",
 	.platform_name = "pxa-pcm-audio",
 	.codec_name = "uda1380-codec.0-0018",
 	.ops = &magician_capture_ops,
+	.capture_only   = true,
 }
 };
 
@@ -324,109 +366,71 @@ static struct snd_soc_card snd_soc_card_magician = {
 	.num_dapm_widgets = ARRAY_SIZE(uda1380_dapm_widgets),
 	.dapm_routes = audio_map,
 	.num_dapm_routes = ARRAY_SIZE(audio_map),
-	.fully_routed = true,
-};
-
-static struct platform_device *magician_snd_device;
-
-/*
- * FIXME: move into magician board file once merged into the pxa tree
- */
-static struct uda1380_platform_data uda1380_info = {
-	.gpio_power = EGPIO_MAGICIAN_CODEC_POWER,
-	.gpio_reset = EGPIO_MAGICIAN_CODEC_RESET,
-	.dac_clk    = UDA1380_DAC_CLK_WSPLL,
+	.fully_routed = true,	//no change if false
 };
 
-static struct i2c_board_info i2c_board_info[] = {
-	{
-		I2C_BOARD_INFO("uda1380", 0x18),
-		.platform_data = &uda1380_info,
-	},
-};
-
-static int __init magician_init(void)
-{
+static int magician_audio_probe(struct platform_device *pdev){
 	int ret;
-	struct i2c_adapter *adapter;
-	struct i2c_client *client;
 
-	if (!machine_is_magician())
-		return -ENODEV;
+pr_info("magician_audio_probe AAA1\n");
 
-	adapter = i2c_get_adapter(0);
-	if (!adapter)
-		return -ENODEV;
-	client = i2c_new_device(adapter, i2c_board_info);
-	i2c_put_adapter(adapter);
-	if (!client)
-		return -ENODEV;
+	snd_soc_card_magician.dev = &pdev->dev;
 
-	ret = gpio_request(EGPIO_MAGICIAN_SPK_POWER, "SPK_POWER");
+	ret = devm_gpio_request(&pdev->dev, EGPIO_MAGICIAN_SPK_POWER, "SPK_POWER");
 	if (ret)
-		goto err_request_spk;
-	ret = gpio_request(EGPIO_MAGICIAN_EP_POWER, "EP_POWER");
+		goto err_pdev;
+	ret = devm_gpio_request(&pdev->dev, EGPIO_MAGICIAN_EP_POWER, "EP_POWER");
 	if (ret)
-		goto err_request_ep;
-	ret = gpio_request(EGPIO_MAGICIAN_MIC_POWER, "MIC_POWER");
+		goto err_pdev;
+	ret = devm_gpio_request(&pdev->dev, EGPIO_MAGICIAN_MIC_POWER, "MIC_POWER");
 	if (ret)
-		goto err_request_mic;
-	ret = gpio_request(EGPIO_MAGICIAN_IN_SEL0, "IN_SEL0");
+		goto err_pdev;
+	ret = devm_gpio_request(&pdev->dev, EGPIO_MAGICIAN_IN_SEL0, "IN_SEL0");
 	if (ret)
-		goto err_request_in_sel0;
-	ret = gpio_request(EGPIO_MAGICIAN_IN_SEL1, "IN_SEL1");
+		goto err_pdev;
+	ret = devm_gpio_request(&pdev->dev, EGPIO_MAGICIAN_IN_SEL1, "IN_SEL1");
 	if (ret)
-		goto err_request_in_sel1;
+		goto err_pdev;
 
 	gpio_set_value(EGPIO_MAGICIAN_IN_SEL0, 0);
 
-	magician_snd_device = platform_device_alloc("soc-audio", -1);
-	if (!magician_snd_device) {
-		ret = -ENOMEM;
-		goto err_pdev;
-	}
+	platform_set_drvdata(pdev, &snd_soc_card_magician);
 
-	platform_set_drvdata(magician_snd_device, &snd_soc_card_magician);
-	ret = platform_device_add(magician_snd_device);
+	ret = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_magician);
+	pr_info("magician_audio_probe devm_snd_soc_register_card ret=%i\n",ret);
 	if (ret) {
-		platform_device_put(magician_snd_device);
+pr_err("devm_snd_soc_register_card() failed: %d (EEXIST=-17, EPROBE_DEFER=-517)\n", ret);
 		goto err_pdev;
 	}
 
-	return 0;
+pr_info("magician_audio_probe ALL OK\n");
 
+	return 0;
 err_pdev:
-	gpio_free(EGPIO_MAGICIAN_IN_SEL1);
-err_request_in_sel1:
-	gpio_free(EGPIO_MAGICIAN_IN_SEL0);
-err_request_in_sel0:
-	gpio_free(EGPIO_MAGICIAN_MIC_POWER);
-err_request_mic:
-	gpio_free(EGPIO_MAGICIAN_EP_POWER);
-err_request_ep:
-	gpio_free(EGPIO_MAGICIAN_SPK_POWER);
-err_request_spk:
 	return ret;
 }
 
-static void __exit magician_exit(void)
-{
-	platform_device_unregister(magician_snd_device);
-
+static int magician_audio_remove(struct platform_device *pdev){
 	gpio_set_value(EGPIO_MAGICIAN_SPK_POWER, 0);
 	gpio_set_value(EGPIO_MAGICIAN_EP_POWER, 0);
 	gpio_set_value(EGPIO_MAGICIAN_MIC_POWER, 0);
 
-	gpio_free(EGPIO_MAGICIAN_IN_SEL1);
-	gpio_free(EGPIO_MAGICIAN_IN_SEL0);
-	gpio_free(EGPIO_MAGICIAN_MIC_POWER);
-	gpio_free(EGPIO_MAGICIAN_EP_POWER);
-	gpio_free(EGPIO_MAGICIAN_SPK_POWER);
+pr_info("exiting magician SoC driver\n");
+	return 0;
 }
 
-module_init(magician_init);
-module_exit(magician_exit);
+static struct platform_driver magician_audio_driver = {
+    .driver     = {
+        .name   = "magician-audio",
+        .owner  = THIS_MODULE,
+    },
+    .probe      = magician_audio_probe,
+    .remove     = magician_audio_remove,
+};
+
+module_platform_driver(magician_audio_driver);
 
 MODULE_AUTHOR("Philipp Zabel");
 MODULE_DESCRIPTION("ALSA SoC Magician");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:magician-audio");
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 69033e1a84e6..f20d5ce30ebc 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -14,6 +14,8 @@
  *  o Test network mode for > 16bit sample size
  */
 
+#define DEBUG 1
+
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -69,8 +71,14 @@ static void pxa_ssp_enable(struct ssp_device *ssp)
 {
 	uint32_t sscr0;
 
+pr_info("U1 pxa_ssp_enable\n");
+
+
 	sscr0 = __raw_readl(ssp->mmio_base + SSCR0) | SSCR0_SSE;
 	__raw_writel(sscr0, ssp->mmio_base + SSCR0);
+
+pr_info("U2 fin\n");
+
 }
 
 static void pxa_ssp_disable(struct ssp_device *ssp)
@@ -84,10 +92,16 @@ static void pxa_ssp_disable(struct ssp_device *ssp)
 static void pxa_ssp_set_dma_params(struct ssp_device *ssp, int width4,
 			int out, struct snd_dmaengine_dai_dma_data *dma)
 {
+
+pr_info("V1 pxa_ssp_set_dma_params\n");
+
 	dma->addr_width = width4 ? DMA_SLAVE_BUSWIDTH_4_BYTES :
 				   DMA_SLAVE_BUSWIDTH_2_BYTES;
 	dma->maxburst = 16;
 	dma->addr = ssp->phys_base + SSDR;
+
+pr_info("V2 fin\n");
+
 }
 
 static int pxa_ssp_startup(struct snd_pcm_substream *substream,
@@ -98,19 +112,25 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream,
 	struct snd_dmaengine_dai_dma_data *dma;
 	int ret = 0;
 
+pr_info("W1 pxa_ssp_startup\n");
+
+
 	if (!cpu_dai->active) {
 		clk_prepare_enable(ssp->clk);
 		pxa_ssp_disable(ssp);
 	}
+pr_info("W2\n");
 
 	dma = kzalloc(sizeof(struct snd_dmaengine_dai_dma_data), GFP_KERNEL);
 	if (!dma)
 		return -ENOMEM;
 	dma->chan_name = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
 		"tx" : "rx";
+pr_info("W3\n");
 
 	snd_soc_dai_set_dma_data(cpu_dai, substream, dma);
 
+pr_info("W4 fin %i\n",ret);
 	return ret;
 }
 
@@ -120,13 +140,20 @@ static void pxa_ssp_shutdown(struct snd_pcm_substream *substream,
 	struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai);
 	struct ssp_device *ssp = priv->ssp;
 
+pr_info("WWW1 pxa_ssp_shutdown\n");
+
 	if (!cpu_dai->active) {
+pr_info("WWW2\n");
 		pxa_ssp_disable(ssp);
+pr_info("WWW3\n");
 		clk_disable_unprepare(ssp->clk);
+pr_info("WWW4\n");
 	}
 
 	kfree(snd_soc_dai_get_dma_data(cpu_dai, substream));
+pr_info("WWW5\n");
 	snd_soc_dai_set_dma_data(cpu_dai, substream, NULL);
+pr_info("WWW6\n");
 }
 
 #ifdef CONFIG_PM
@@ -182,6 +209,9 @@ static int pxa_ssp_resume(struct snd_soc_dai *cpu_dai)
  */
 static void pxa_ssp_set_scr(struct ssp_device *ssp, u32 div)
 {
+
+pr_info("X1 pxa_ssp_set_scr\n");
+
 	u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0);
 
 	if (ssp->type == PXA25x_SSP) {
@@ -192,6 +222,9 @@ static void pxa_ssp_set_scr(struct ssp_device *ssp, u32 div)
 		sscr0 |= (div - 1) << 8;     /* 1..4096 */
 	}
 	pxa_ssp_write_reg(ssp, SSCR0, sscr0);
+
+pr_info("X2 fin\n");
+
 }
 
 /*
@@ -203,6 +236,9 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 	struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai);
 	struct ssp_device *ssp = priv->ssp;
 
+pr_info("Y1 pxa_ssp_set_dai_sysclk\n");
+
+
 	u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0) &
 		~(SSCR0_ECS | SSCR0_NCS | SSCR0_MOD | SSCR0_ACS);
 
@@ -221,6 +257,8 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 		clk_id = PXA_SSP_CLK_EXT;
 	}
 
+pr_info("Y2 sscr0=%08x\n",sscr0);
+
 	dev_dbg(&ssp->pdev->dev,
 		"pxa_ssp_set_dai_sysclk id: %d, clk_id %d, freq %u\n",
 		cpu_dai->id, clk_id, freq);
@@ -228,6 +266,7 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 	switch (clk_id) {
 	case PXA_SSP_CLK_NET_PLL:
 		sscr0 |= SSCR0_MOD;
+pr_info("Y2b BUG\n");
 		break;
 	case PXA_SSP_CLK_PLL:
 		/* Internal PLL is fixed */
@@ -243,6 +282,8 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 	case PXA_SSP_CLK_NET:
 		priv->sysclk = freq;
 		sscr0 |= SSCR0_NCS | SSCR0_MOD;
+pr_info("Y2c BUG\n");
+
 		break;
 	case PXA_SSP_CLK_AUDIO:
 		priv->sysclk = 0;
@@ -253,6 +294,8 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 		return -ENODEV;
 	}
 
+pr_info("Y3\n");
+
 	/* The SSP clock must be disabled when changing SSP clock mode
 	 * on PXA2xx.  On PXA3xx it must be enabled when doing so. */
 	if (ssp->type != PXA3xx_SSP)
@@ -261,6 +304,8 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 	if (ssp->type != PXA3xx_SSP)
 		clk_prepare_enable(ssp->clk);
 
+pr_info("Y4 fin\n");
+
 	return 0;
 }
 
@@ -270,11 +315,18 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 static int pxa_ssp_set_pll(struct ssp_priv *priv, unsigned int freq)
 {
 	struct ssp_device *ssp = priv->ssp;
+
+pr_info("Z1 pxa_ssp_set_pll\n");
+
 	u32 ssacd = pxa_ssp_read_reg(ssp, SSACD) & ~0x70;
 
+pr_info("Z2\n");
+
 	if (ssp->type == PXA3xx_SSP)
 		pxa_ssp_write_reg(ssp, SSACDD, 0);
 
+pr_info("Z3!!!!!!!!!! %i\n",freq);
+
 	switch (freq) {
 	case 5622000:
 		break;
@@ -323,8 +375,12 @@ static int pxa_ssp_set_pll(struct ssp_priv *priv, unsigned int freq)
 		return -EINVAL;
 	}
 
+pr_info("Z4\n");
+
 	pxa_ssp_write_reg(ssp, SSACD, ssacd);
 
+pr_info("Z5 fin\n");
+
 	return 0;
 }
 
@@ -338,15 +394,24 @@ static int pxa_ssp_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai,
 	struct ssp_device *ssp = priv->ssp;
 	u32 sscr0;
 
+pr_info("ZZZ1 pxa_ssp_set_dai_tdm_slot\n");
+
 	sscr0 = pxa_ssp_read_reg(ssp, SSCR0);
+
+pr_info("ZZZ2 %08x\n",sscr0);
+
 	sscr0 &= ~(SSCR0_MOD | SSCR0_SlotsPerFrm(8) | SSCR0_EDSS | SSCR0_DSS);
 
+pr_info("ZZZ3 %08x\n",sscr0);
+
 	/* set slot width */
 	if (slot_width > 16)
 		sscr0 |= SSCR0_EDSS | SSCR0_DataSize(slot_width - 16);
 	else
 		sscr0 |= SSCR0_DataSize(slot_width);
 
+pr_info("ZZZ4 %08x\n",sscr0);
+
 	if (slots > 1) {
 		/* enable network mode */
 		sscr0 |= SSCR0_MOD;
@@ -357,7 +422,12 @@ static int pxa_ssp_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai,
 		/* set active slot mask */
 		pxa_ssp_write_reg(ssp, SSTSA, tx_mask);
 		pxa_ssp_write_reg(ssp, SSRSA, rx_mask);
+	} else {
+		//sscr0 &= ~SSCR0_MOD;
 	}
+
+pr_info("ZZZ5 %08x\n",sscr0);
+
 	pxa_ssp_write_reg(ssp, SSCR0, sscr0);
 
 	return 0;
@@ -407,6 +477,8 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 		return -EINVAL;
 	}
 
+pr_info("!!!!! pxa_ssp_set_dai_fmt %i\n",fmt );
+
 	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 	case SND_SOC_DAIFMT_I2S:
 	case SND_SOC_DAIFMT_DSP_A:
@@ -487,8 +559,13 @@ static int pxa_ssp_configure_dai_fmt(struct ssp_priv *priv)
 	case SND_SOC_DAIFMT_DSP_A:
 		sspsp |= SSPSP_FSRT;
 		/* fall through */
+pr_info("!!XXX1a %08x\n",sscr0);
+
 	case SND_SOC_DAIFMT_DSP_B:
 		sscr0 |= SSCR0_MOD | SSCR0_PSP;
+
+pr_info("!!XXX1b %08x\n",sscr0);
+
 		sscr1 |= SSCR1_TRAIL | SSCR1_RWOT;
 		break;
 
@@ -559,7 +636,11 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
 	int bclk = rate * chn * (width / 8);
 	int ret;
 
+pr_info("AA1 pxa_ssp_hw_params\n");
+
+
 	dma_data = snd_soc_dai_get_dma_data(cpu_dai, substream);
+pr_info("AA2\n");
 
 	/* Network mode with one active slot (ttsa == 1) can be used
 	 * to force 16-bit frame width on the wire (for S16_LE), even
@@ -569,17 +650,24 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
 		((chn == 2) && (ttsa != 1)) || (width == 32),
 		substream->stream == SNDRV_PCM_STREAM_PLAYBACK, dma_data);
 
+pr_info("AA3\n");
+
 	/* we can only change the settings if the port is not in use */
 	if (pxa_ssp_read_reg(ssp, SSCR0) & SSCR0_SSE)
 		return 0;
+pr_info("AA4\n");
 
 	ret = pxa_ssp_configure_dai_fmt(priv);
 	if (ret < 0)
 		return ret;
 
+pr_info("AA5\n");
+
 	/* clear selected SSP bits */
 	sscr0 = pxa_ssp_read_reg(ssp, SSCR0) & ~(SSCR0_DSS | SSCR0_EDSS);
 
+pr_info("AA6 0x%08x\n",sscr0);
+
 	/* bit size */
 	switch (params_format(params)) {
 	case SNDRV_PCM_FORMAT_S16_LE:
@@ -594,8 +682,13 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
 		sscr0 |= (SSCR0_EDSS | SSCR0_DataSize(16));
 		break;
 	}
+
+pr_info("AA7\n");
+
 	pxa_ssp_write_reg(ssp, SSCR0, sscr0);
 
+pr_info("AA8 %i\n",bclk);
+
 	if (sscr0 & SSCR0_ACS) {
 		ret = pxa_ssp_set_pll(priv, bclk);
 
@@ -604,14 +697,19 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
 		 * all is fine. Otherwise, look up the closest rate
 		 * from the table and also set the dividers.
 		 */
+pr_info("AA8b %i\n",ret);
 
 		if (ret < 0) {
 			const struct pxa_ssp_clock_mode *m;
 			int ssacd, acds;
 
 			for (m = pxa_ssp_clock_modes; m->rate; m++) {
-				if (m->rate == rate)
+				if (m->rate == rate) {
+
+pr_info("AA8b rate=%i ?= %i\n",rate,m->rate);
+
 					break;
+				}
 			}
 
 			if (!m->rate)
@@ -623,7 +721,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
 			if (width == 32)
 				acds--;
 
-			ret = pxa_ssp_set_pll(priv, bclk);
+			ret = pxa_ssp_set_pll(priv, m->pll);
 			if (ret < 0)
 				return ret;
 
@@ -642,6 +740,8 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
 		pxa_ssp_set_scr(ssp, bclk / rate);
 	}
 
+pr_info("AA9\n");
+
 	switch (priv->dai_fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 	case SND_SOC_DAIFMT_I2S:
 	       sspsp = pxa_ssp_read_reg(ssp, SSPSP);
@@ -681,16 +781,23 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
 		break;
 	}
 
+pr_info("AA10 ttsa=%08x\n",ttsa);
+
 	/* When we use a network mode, we always require TDM slots
 	 * - complain loudly and fail if they've not been set up yet.
 	 */
 	if ((sscr0 & SSCR0_MOD) && !ttsa) {
 		dev_err(&ssp->pdev->dev, "No TDM timeslot configured\n");
-		return -EINVAL;
+		//return -EINVAL;
+
 	}
 
+pr_info("AA11\n");
+
 	dump_registers(ssp);
 
+pr_info("AA12 fin\n");
+
 	return 0;
 }
 
@@ -702,9 +809,14 @@ static void pxa_ssp_set_running_bit(struct snd_pcm_substream *substream,
 	uint32_t sspsp = pxa_ssp_read_reg(ssp, SSPSP);
 	uint32_t sssr = pxa_ssp_read_reg(ssp, SSSR);
 
+pr_info("AB1 pxa_ssp_set_running_bit\n");
+
+
 	if (value && (sscr0 & SSCR0_SSE))
 		pxa_ssp_write_reg(ssp, SSCR0, sscr0 & ~SSCR0_SSE);
 
+pr_info("AB2\n");
+
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		if (value)
 			sscr1 |= SSCR1_TSRE;
@@ -717,13 +829,20 @@ static void pxa_ssp_set_running_bit(struct snd_pcm_substream *substream,
 			sscr1 &= ~SSCR1_RSRE;
 	}
 
+pr_info("AB3\n");
+
 	pxa_ssp_write_reg(ssp, SSCR1, sscr1);
 
+pr_info("AB4\n");
+
 	if (value) {
 		pxa_ssp_write_reg(ssp, SSSR, sssr);
 		pxa_ssp_write_reg(ssp, SSPSP, sspsp);
 		pxa_ssp_write_reg(ssp, SSCR0, sscr0 | SSCR0_SSE);
 	}
+
+pr_info("AB5 fin\n");
+
 }
 
 static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd,
@@ -734,6 +853,8 @@ static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd,
 	struct ssp_device *ssp = priv->ssp;
 	int val;
 
+pr_info("AC1 pxa_ssp_trigger\n");
+
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_RESUME:
 		pxa_ssp_enable(ssp);
@@ -760,8 +881,12 @@ static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd,
 		ret = -EINVAL;
 	}
 
+pr_info("AC2\n");
+
 	dump_registers(ssp);
 
+pr_info("AC3 fin %i\n",ret);
+
 	return ret;
 }
 
@@ -771,10 +896,14 @@ static int pxa_ssp_probe(struct snd_soc_dai *dai)
 	struct ssp_priv *priv;
 	int ret;
 
+pr_info("AD1 pxa_ssp_probe\n");
+
 	priv = kzalloc(sizeof(struct ssp_priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
+pr_info("AD2\n");
+
 	if (dev->of_node) {
 		struct device_node *ssp_handle;
 
@@ -807,8 +936,12 @@ static int pxa_ssp_probe(struct snd_soc_dai *dai)
 		}
 	}
 
+pr_info("AD3\n");
+
 	priv->dai_fmt = (unsigned int) -1;
+pr_info("AD4\n");
 	snd_soc_dai_set_drvdata(dai, priv);
+pr_info("AD5 fin\n");
 
 	return 0;
 
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c
index 42820121e5b9..9d9b14adccb3 100644
--- a/sound/soc/pxa/pxa2xx-i2s.c
+++ b/sound/soc/pxa/pxa2xx-i2s.c
@@ -102,12 +102,17 @@ static int pxa2xx_i2s_startup(struct snd_pcm_substream *substream,
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
 
+pr_info("O1 pxa2xx_i2s_startup\n");
+
+
 	if (IS_ERR(clk_i2s))
 		return PTR_ERR(clk_i2s);
 
+pr_info("O2\n");
 	if (!cpu_dai->active)
 		SACR0 = 0;
 
+pr_info("O3 fin\n");
 	return 0;
 }
 
@@ -116,15 +121,24 @@ static int pxa_i2s_wait(void)
 {
 	int i;
 
+pr_info("P1 pxa_i2s_wait\n");
+
 	/* flush the Rx FIFO */
 	for (i = 0; i < 16; i++)
 		SADR;
+
+pr_info("P2 fin\n");
+
 	return 0;
 }
 
 static int pxa2xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 		unsigned int fmt)
 {
+
+pr_info("Q1 pxa2xx_i2s_set_dai_fmt\n");
+
+
 	/* interface format */
 	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 	case SND_SOC_DAIFMT_I2S:
@@ -135,6 +149,8 @@ static int pxa2xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 		break;
 	}
 
+pr_info("Q2\n");
+
 	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
 	case SND_SOC_DAIFMT_CBS_CFS:
 		pxa_i2s.master = 1;
@@ -145,6 +161,9 @@ static int pxa2xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 	default:
 		break;
 	}
+
+pr_info("Q3 fin\n");
+
 	return 0;
 }
 
@@ -163,19 +182,33 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream,
 {
 	struct snd_dmaengine_dai_dma_data *dma_data;
 
+pr_info("R1 pxa2xx_i2s_hw_params\n");
+
+
 	if (WARN_ON(IS_ERR(clk_i2s)))
 		return -EINVAL;
+
+pr_info("R2\n");
+
 	clk_prepare_enable(clk_i2s);
+pr_info("R3\n");
 	clk_ena = 1;
+pr_info("R4\n");
 	pxa_i2s_wait();
 
+pr_info("R5\n");
+
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
 		dma_data = &pxa2xx_i2s_pcm_stereo_out;
 	else
 		dma_data = &pxa2xx_i2s_pcm_stereo_in;
 
+pr_info("R6\n");
+
 	snd_soc_dai_set_dma_data(dai, substream, dma_data);
 
+pr_info("R7\n");
+
 	/* is port used by another stream */
 	if (!(SACR0 & SACR0_ENB)) {
 		SACR0 = 0;
@@ -185,11 +218,16 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream,
 		SACR0 |= SACR0_RFTH(14) | SACR0_TFTH(1);
 		SACR1 |= pxa_i2s.fmt;
 	}
+
+pr_info("R8\n");
+
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
 		SAIMR |= SAIMR_TFS;
 	else
 		SAIMR |= SAIMR_RFS;
 
+pr_info("R9\n");
+
 	switch (params_rate(params)) {
 	case 8000:
 		SADIV = 0x48;
@@ -214,6 +252,8 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream,
 		break;
 	}
 
+pr_info("R10 fin\n");
+
 	return 0;
 }
 
@@ -222,6 +262,8 @@ static int pxa2xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
 {
 	int ret = 0;
 
+pr_info("S1 pxa2xx_i2s_trigger\n");
+
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
 		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
@@ -240,6 +282,8 @@ static int pxa2xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
 		ret = -EINVAL;
 	}
 
+pr_info("S2 fin %i\n",ret);
+
 	return ret;
 }
 
@@ -300,6 +344,9 @@ static int pxa2xx_i2s_resume(struct snd_soc_dai *dai)
 
 static int pxa2xx_i2s_probe(struct snd_soc_dai *dai)
 {
+
+pr_info("T1 pxa2xx_i2s_probe\n");
+
 	clk_i2s = clk_get(dai->dev, "I2SCLK");
 	if (IS_ERR(clk_i2s))
 		return PTR_ERR(clk_i2s);
@@ -320,6 +367,8 @@ static int pxa2xx_i2s_probe(struct snd_soc_dai *dai)
 	snd_soc_dai_init_dma_data(dai, &pxa2xx_i2s_pcm_stereo_out,
 		&pxa2xx_i2s_pcm_stereo_in);
 
+pr_info("T2 fin ok\n");
+
 	return 0;
 }
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 81b27923303d..b794cfb583f4 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -17,6 +17,8 @@
 //   o Add more codecs and platforms to ensure good API coverage.
 //   o Support TDM on PCM and I2S
 
+#define DEBUG 1
+
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
@@ -1531,12 +1533,14 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
 	rtd->pmdown_time = pmdown_time;
 
 	ret = soc_probe_dai(cpu_dai, order);
+pr_info("JJJ1 soc_probe_link_dais %i\n",ret);
 	if (ret)
 		return ret;
 
 	/* probe the CODEC DAI */
 	for (i = 0; i < rtd->num_codecs; i++) {
 		ret = soc_probe_dai(rtd->codec_dais[i], order);
+pr_info("JJJ2 %i %i\n",i,ret);
 		if (ret)
 			return ret;
 	}
@@ -1548,6 +1552,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
 	/* do machine specific initialization */
 	if (dai_link->init) {
 		ret = dai_link->init(rtd);
+pr_info("JJJ3 %i\n",ret);
 		if (ret < 0) {
 			dev_err(card->dev, "ASoC: failed to init %s: %d\n",
 				dai_link->name, ret);
@@ -1559,6 +1564,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
 		snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt);
 
 	ret = soc_post_component_init(rtd, dai_link->name);
+pr_info("JJJ4 %i\n",ret);
 	if (ret)
 		return ret;
 
@@ -1581,6 +1587,8 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
 		if (!component->driver->use_dai_pcm_id)
 			continue;
 
+pr_info("JJJ5\n");
+
 		if (rtd->dai_link->no_pcm)
 			num += component->driver->be_pcm_base;
 		else
@@ -1590,6 +1598,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
 	if (cpu_dai->driver->compress_new) {
 		/*create compress_device"*/
 		ret = cpu_dai->driver->compress_new(rtd, num);
+pr_info("JJJ6 %i\n",ret);
 		if (ret < 0) {
 			dev_err(card->dev, "ASoC: can't create compress %s\n",
 					 dai_link->stream_name);
@@ -1599,18 +1608,23 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
 
 		if (!dai_link->params) {
 			/* create the pcm */
+
 			ret = soc_new_pcm(rtd, num);
+pr_info("JJJ7 from soc_new_pcm %i\n",ret);
+
 			if (ret < 0) {
 				dev_err(card->dev, "ASoC: can't create pcm %s :%d\n",
 				       dai_link->stream_name, ret);
 				return ret;
 			}
 			ret = soc_link_dai_pcm_new(&cpu_dai, 1, rtd);
+pr_info("JJJ8 from soc_link_dai_pcm_new %i\n",ret);
 			if (ret < 0)
 				return ret;
 			ret = soc_link_dai_pcm_new(rtd->codec_dais,
 						   rtd->num_codecs, rtd);
 			if (ret < 0)
+pr_info("JJJ9 from soc_link_dai_pcm_new %i\n",ret);
 				return ret;
 		} else {
 			INIT_DELAYED_WORK(&rtd->delayed_work,
@@ -1618,6 +1632,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
 
 			/* link the DAI widgets */
 			ret = soc_link_dai_widgets(card, dai_link, rtd);
+pr_info("JJJ10 from soc_link_dai_widgets %i\n",ret);
 			if (ret)
 				return ret;
 		}
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 98be04b543ae..8998d20c7807 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -10,6 +10,8 @@
 // Authors: Liam Girdwood <lrg@ti.com>
 //          Mark Brown <broonie@opensource.wolfsonmicro.com>
 
+#define DEBUG 1
+
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/delay.h>
@@ -449,6 +451,8 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream,
 	struct snd_soc_rtdcom_list *rtdcom;
 	struct snd_soc_component *component;
 
+pr_info("FFF1 soc_pcm_components_close\n");
+
 	for_each_rtdcom(rtd, rtdcom) {
 		component = rtdcom->component;
 
@@ -459,7 +463,10 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream,
 		    !component->driver->ops->close)
 			continue;
 
+pr_info("FFF2 %s\n",substream->name);
+
 		component->driver->ops->close(substream);
+pr_info("FFF3\n");
 	}
 
 	return 0;
@@ -692,10 +699,13 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
 	struct snd_soc_dai *codec_dai;
 	int i;
+pr_info("EEE1 soc_pcm_close\n");
 
 	mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
 
+pr_info("EEE2\n");
 	snd_soc_runtime_deactivate(rtd, substream->stream);
+pr_info("EEE3\n");
 
 	/* clear the corresponding DAIs rate when inactive */
 	if (!cpu_dai->active)
@@ -706,12 +716,16 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 		if (!codec_dai->active)
 			codec_dai->rate = 0;
 	}
+pr_info("EEE4\n");
 
 	snd_soc_dai_digital_mute(cpu_dai, 1, substream->stream);
+pr_info("EEE5\n");
 
 	if (cpu_dai->driver->ops->shutdown)
 		cpu_dai->driver->ops->shutdown(substream, cpu_dai);
 
+pr_info("EEE6\n");
+
 	for (i = 0; i < rtd->num_codecs; i++) {
 		codec_dai = rtd->codec_dais[i];
 		if (codec_dai->driver->ops->shutdown)
@@ -721,7 +735,9 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 	if (rtd->dai_link->ops->shutdown)
 		rtd->dai_link->ops->shutdown(substream);
 
+pr_info("EEE7\n");
 	soc_pcm_components_close(substream, NULL);
+pr_info("EEE8\n");
 
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		if (snd_soc_runtime_ignore_pmdown_time(rtd)) {
@@ -742,6 +758,8 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 					  SND_SOC_DAPM_STREAM_STOP);
 	}
 
+pr_info("EEE9\n");
+
 	mutex_unlock(&rtd->pcm_mutex);
 
 	for_each_rtdcom(rtd, rtdcom) {
@@ -751,12 +769,15 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 		pm_runtime_put_autosuspend(component->dev);
 	}
 
+pr_info("EEE10\n");
+
 	for (i = 0; i < rtd->num_codecs; i++) {
 		if (!rtd->codec_dais[i]->active)
 			pinctrl_pm_select_sleep_state(rtd->codec_dais[i]->dev);
 	}
 	if (!cpu_dai->active)
 		pinctrl_pm_select_sleep_state(cpu_dai->dev);
+pr_info("EEE11\n");
 
 	return 0;
 }
@@ -3075,6 +3096,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
 				(rtd->num_codecs > 1) ?
 				"multicodec" : rtd->codec_dai->name, num);
 
+pr_info("!!!HHH1 soc_new_pcm %i %i\n",playback,capture);
 		ret = snd_pcm_new(rtd->card->snd_card, new_name, num, playback,
 			capture, &pcm);
 	}
@@ -3153,7 +3175,10 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
 		if (!component->driver->pcm_new)
 			continue;
 
+// NOTICE pxa2xx_soc_pcm_new called here, contains pxa2xx_pcm_preallocate_dma_buffer
+pr_info("!!!HHH2\n");
 		ret = component->driver->pcm_new(rtd);
+pr_info("!!!HHH3 %i\n",ret);
 		if (ret < 0) {
 			dev_err(component->dev,
 				"ASoC: pcm constructor failed: %d\n",
-- 
2.18.0

