alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Ian Minett <ian_minett@creativelabs.com>
To: patch@alsa-project.org
Cc: alsa-devel@alsa-project.org, Ian Minett <ian_minett@creativelabs.com>
Subject: [PATCHv2.1-CA0132 HDA Codec 1/1] Draft DSP loader update #2
Date: Tue, 14 Aug 2012 22:50:06 -0700	[thread overview]
Message-ID: <1345009806-3293-1-git-send-email-ian_minett@creativelabs.com> (raw)
In-Reply-To: <s5hobmh9a1f.wl%tiwai@suse.de>

From: Ian Minett <ian_minett@creativelabs.com>

Thanks for the recent feedback - based on that we've updated the recent 
draft patch for adding the DSP loader to patch_ca0132.c :

- move DMA buffer management out (to be handled in hda_intel)
- add call to cleanup DMA
- change start/stop flag to boolean

If the changes look acceptable, do we have enough for us to get started on 
adding the DSP loader updates to patch_ca0132 (working with the 'from scratch' 
CA0132 as you suggested)? 

Please let us know if you can think of anything else that needs to be worked
out, or anything we need to provide for the bus op mods.

Thanks very much,
Ian

Signed-off-by: Ian Minett <ian_minett@creativelabs.com>

diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 45dce9c..0d07445 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -1979,22 +1979,22 @@ static int dma_convert_to_hda_format(
 
 static int dma_set_state(struct dma_engine *dma, enum dma_state state)
 {
-	int cmd;
+	bool cmd;
 
 	CA0132_LOG("dma_set_state state=%d\n", state);
 
 	switch (state) {
 	case DMA_STATE_STOP:
-		cmd = SNDRV_PCM_TRIGGER_STOP;
+		cmd = false;
 		break;
 	case DMA_STATE_RUN:
-		cmd = SNDRV_PCM_TRIGGER_START;
+		cmd = true;
 		break;
 	default:
 		return 0;
 	}
 
-	return load_dsp_trigger(dma->codec->bus, cmd);
+	return snd_hda_codec_load_dsp_trigger(dma->codec, cmd);
 }
 
 static unsigned int dma_get_buffer_size(struct dma_engine *dma)
@@ -2281,10 +2281,8 @@ static int dspxfr_image(struct hda_codec *codec,
 		return -1;
 
 	dma_engine = kzalloc(sizeof(*dma_engine), GFP_KERNEL);
-	if (!dma_engine) {
-		status = -ENOMEM;
-		goto exit;
-	}
+	if (!dma_engine)
+		return -ENOMEM;
 	memset((void*)dma_engine, 0, sizeof(*dma_engine));
 	
 	dma_engine->codec = codec;
@@ -2292,12 +2290,6 @@ static int dspxfr_image(struct hda_codec *codec,
 	dma_engine->m_converter_format = hda_format;
 	dma_engine->m_buffer_size =
 	      ovly ? DSP_DMA_WRITE_BUFLEN_OVLY : DSP_DMA_WRITE_BUFLEN_INIT;
-	dma_engine->m_buffer_addr = kzalloc(dma_engine->m_buffer_size,
-					    GFP_KERNEL);
-	if (!dma_engine->m_buffer_addr) {
-		status = -ENOMEM;
-		goto exit;
-	}
 
 	dma_chan = 0;
 	do {
@@ -2308,11 +2300,11 @@ static int dspxfr_image(struct hda_codec *codec,
 			break;
 		}
 
-		status = load_dsp_prepare(codec->bus, 
-					 dma_engine->m_converter_format,
-					 dma_engine->m_buffer_addr,
-					 dma_engine->m_buffer_size);
-		if (FAILED(status))
+		dma_engine->m_buffer_addr =
+		snd_hda_codec_load_dsp_prepare(codec,
+						dma_engine->m_converter_format,
+						dma_engine->m_buffer_size);
+		if (!dma_engine->m_buffer_addr)
 			break;
 
 		if (ovly) {
@@ -2372,8 +2364,9 @@ static int dspxfr_image(struct hda_codec *codec,
 	if (ovly && (dma_chan != INVALID_DMA_CHANNEL))
 		status = dspio_free_dma_chan(codec, dma_chan);
 
-exit:
-	kfree(dma_engine->m_buffer_addr);
+	snd_hda_codec_load_dsp_cleanup(codec,
+				       dma_engine->m_buffer_addr,
+				       dma_engine->m_buffer_size);
 	kfree(dma_engine);
 
 	return status;
-- 
1.7.4.1

  parent reply	other threads:[~2012-08-15  5:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1342223070-25852-1-git-send-email-ian_minett@creativelabs.com>
2012-07-13 23:44 ` [PATCH - CA0132 HDA Codec 2/2] Change spin_lock()/unlock() to spin_lock_irqsave()/restore() in azx_pcm_trigger(). This prevents deadlock when an interrupt occurs, caused by chip->reg_lock contention ian_minett
2012-07-16 10:18 ` [PATCH - CA0132 HDA Codec 1/2] ALSA: Update Creative CA0132 codec to add DSP features Takashi Iwai
2012-07-25 18:01   ` [PATCHv2 " Ian Minett
2012-07-25 18:01     ` [PATCHv2 - CA0132 HDA Codec 2/2] Change spin_lock()/unlock() to spin_lock_irqsave()/restore() Ian Minett
2012-07-26  8:06     ` [PATCHv2 - CA0132 HDA Codec 1/2] ALSA: Update Creative CA0132 codec to add DSP features Takashi Iwai
     [not found]       ` <OF0CFC3DA9.A9100453-ON88257A48.006BF087-88257A48.006FCB42@cli.creative.com>
2012-07-28  5:57         ` Takashi Iwai
     [not found]           ` <OF301523C9.1A0D8E05-ON88257A4B.0074BC06-88257A4B.007D5630@cli.creative.com>
2012-07-31 15:15             ` Takashi Iwai
2012-08-01  2:38               ` Ian Minett
2012-08-01  5:48                 ` Takashi Iwai
2012-08-04  3:29                   ` Ian Minett
2012-08-04  7:29                     ` Takashi Iwai
2012-08-08  0:27                       ` Ian Minett
2012-08-08  7:22                         ` Takashi Iwai
     [not found]                           ` <1344665872-15537-1-git-send-email-ian_minett@creativelabs.com>
2012-08-11  6:17                             ` [PATCHv2.1-CA0132 HDA Codec 2/2] Add DSP loader code to CA0132 codec Ian Minett
2012-08-11  7:12                               ` Takashi Iwai
2012-08-13 23:04                                 ` Ian Minett
2012-08-15  5:50                                 ` Ian Minett [this message]
2012-08-15  7:06                                   ` [PATCHv2.1-CA0132 HDA Codec 1/1] Draft DSP loader update #2 Takashi Iwai
2012-08-22  1:36                                     ` Ian Minett
2012-08-22 13:39                                       ` Takashi Iwai
2012-08-11  7:19                             ` [PATCHv2.1-CA0132 HDA Codec 1/2] Add DSP loader code to CA0132 codec Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1345009806-3293-1-git-send-email-ian_minett@creativelabs.com \
    --to=ian_minett@creativelabs.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=patch@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).