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: [PATCH 10/10] ALSA: Remove unnecessary struct hda_stream_format from CA0132
Date: Thu, 20 Sep 2012 20:29:21 -0700	[thread overview]
Message-ID: <1348198161-9256-11-git-send-email-ian_minett@creativelabs.com> (raw)
In-Reply-To: <1348198161-9256-1-git-send-email-ian_minett@creativelabs.com>

From: Ian Minett <ian_minett@creativelabs.com>


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 7a0425f..5c6a056 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -356,13 +356,6 @@ enum dsp_download_state {
 	DSP_DOWNLOADED      = 2
 };
 
-struct hda_stream_format {
-	unsigned int   sample_rate;
-	unsigned short valid_bits_per_sample;
-	unsigned short container_size;
-	unsigned short number_channels;
-};
-
 /* retrieve parameters from hda format */
 #define get_hdafmt_chs(fmt)	(fmt & 0xf)
 #define get_hdafmt_bits(fmt)	((fmt >> 4) & 0x7)
@@ -1585,16 +1578,17 @@ enum dma_state {
 };
 
 static int dma_convert_to_hda_format(
-		struct hda_stream_format *stream_format,
+		unsigned int sample_rate,
+		unsigned short channels,
 		unsigned short *hda_format)
 {
 	unsigned int format_val;
 
 	format_val = snd_hda_calc_stream_format(
-				stream_format->sample_rate,
-				stream_format->number_channels,
+				sample_rate,
+				channels,
 				SNDRV_PCM_FORMAT_S32_LE,
-				stream_format->container_size, 0);
+				32, 0);
 
 	if (hda_format)
 		*hda_format = (unsigned short)format_val;
@@ -1940,14 +1934,17 @@ static int dspxfr_one_seg(struct hda_codec *codec,
  * @fls_data: pointer to a fast load image
  * @reloc: Relocation address for loading single-segment overlays, or 0 for
  *	   no relocation
- * @format: format of the stream used for DSP download
+ * @sample_rate: sampling rate of the stream used for DSP download
+ * @number_channels: channels of the stream used for DSP download
  * @ovly: TRUE if overlay format is required
  *
  * Returns zero or a negative error code.
  */
 static int dspxfr_image(struct hda_codec *codec,
 			const struct dsp_image_seg *fls_data,
-			unsigned int reloc, struct hda_stream_format *format,
+			unsigned int reloc,
+			unsigned int sample_rate,
+			unsigned short channels,
 			bool ovly)
 {
 	struct ca0132_spec *spec = codec->spec;
@@ -1976,7 +1973,7 @@ static int dspxfr_image(struct hda_codec *codec,
 	}
 
 	dma_engine->codec = codec;
-	dma_convert_to_hda_format(format, &hda_format);
+	dma_convert_to_hda_format(sample_rate, channels, &hda_format);
 	dma_engine->m_converter_format = hda_format;
 	dma_engine->buf_size = (ovly ? DSP_DMA_WRITE_BUFLEN_OVLY :
 			DSP_DMA_WRITE_BUFLEN_INIT) * 2;
@@ -2104,7 +2101,8 @@ static int dspload_image(struct hda_codec *codec,
 			int router_chans)
 {
 	int status = 0;
-	struct hda_stream_format stream_format;
+	unsigned int sample_rate;
+	unsigned short channels;
 
 	snd_printdd(KERN_INFO "---- dspload_image begin ------");
 	if (router_chans == 0) {
@@ -2114,17 +2112,14 @@ static int dspload_image(struct hda_codec *codec,
 			router_chans = DMA_OVERLAY_FRAME_SIZE_NWORDS;
 	}
 
-	stream_format.sample_rate = 48000;
-	stream_format.number_channels = (unsigned short)router_chans;
+	sample_rate = 48000;
+	channels = (unsigned short)router_chans;
 
-	while (stream_format.number_channels > 16) {
-		stream_format.sample_rate *= 2;
-		stream_format.number_channels /= 2;
+	while (channels > 16) {
+		sample_rate *= 2;
+		channels /= 2;
 	}
 
-	stream_format.container_size = 32;
-	stream_format.valid_bits_per_sample = 32;
-
 	do {
 		snd_printdd(KERN_INFO "Ready to program DMA");
 		if (!ovly)
@@ -2134,7 +2129,8 @@ static int dspload_image(struct hda_codec *codec,
 			break;
 
 		snd_printdd(KERN_INFO "dsp_reset() complete");
-		status = dspxfr_image(codec, fls, reloc, &stream_format, ovly);
+		status = dspxfr_image(codec, fls, reloc, sample_rate, channels,
+				      ovly);
 
 		if (status < 0)
 			break;
-- 
1.7.4.1

  parent reply	other threads:[~2012-09-21  3:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21  3:29 [PATCH 0/10] ALSA: Add DSP firmware loader (v3) Ian Minett
2012-09-21  3:29 ` [PATCH 01/10] ALSA: Make snd_sgbuf_get_{ptr|addr}() available for non-SG cases Ian Minett
2012-09-21  3:29 ` [PATCH 02/10] ALSA: Add new DSP loader callback routines Ian Minett
2012-09-21  3:29 ` [PATCH 03/10] ALSA: Add CA0132 register definitions file Ian Minett
2012-09-21  3:29 ` [PATCH 04/10] ALSA: Add DSP firmware enums and defs to CA0132 codec Ian Minett
2012-09-21  3:29 ` [PATCH 05/10] ALSA: Update CA0132 codec to load DSP firmware binary Ian Minett
2012-09-21  3:29 ` [PATCH 06/10] ALSA: Add firmware caching to CA0132 codec Ian Minett
2012-09-25 11:26   ` Mark Brown
2012-10-08  7:49     ` Takashi Iwai
2012-10-08  8:01       ` Mark Brown
2012-10-08  8:07         ` Takashi Iwai
2012-09-21  3:29 ` [PATCH 07/10] ALSA: Add comments and descriptions to CA0132 functions Ian Minett
2012-09-21  3:29 ` [PATCH 08/10] ALSA: Change return value for load_dsp_prepare() to -ENOSYS Ian Minett
2012-09-21  3:29 ` [PATCH 09/10] ALSA: Update chipio functions and DSP write wait timeout Ian Minett
2012-09-21  3:29 ` Ian Minett [this message]
2012-09-21  8:14 ` [PATCH 0/10] ALSA: Add DSP firmware loader (v3) 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=1348198161-9256-11-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).