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 1/1] ALSA: CA0132 - Ensure SCP packet is little-endian format
Date: Wed, 26 Sep 2012 18:23:59 -0700	[thread overview]
Message-ID: <1348709039-4210-1-git-send-email-ian_minett@creativelabs.com> (raw)

From: Ian Minett <ian_minett@creativelabs.com>

Hi Takashi,
Great - good to hear the previous DSP loader patches are now living in the 
hda-ca0132-dsp branch. This patch is based on that branch, and addresses 
the SCP packet endianness.

>> The firmware does need to be reloaded when the chip loses power, so it 
>> doesn't survive S3.
>OK, we need suspend/resume hooks, too.

Do we need to do anything specific to handle this? The firmware is already 
restored upon S3 by the current caching code.

Thanks,
- Ian

---

The DSP firmware expects the SCP data to be in little-endian
format regardless of the host architecture.

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 2fd3121..4d7cda4 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -28,6 +28,7 @@
 #include <linux/mutex.h>
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <asm/unaligned.h>
 #include <sound/core.h>
 #include "hda_codec.h"
 #include "hda_local.h"
@@ -701,9 +702,13 @@ static int dspio_send(struct hda_codec *codec, unsigned int reg,
 	unsigned int res;
 	int retry = 50;
 
+	/* Handling for Big Endian machine */
+	unsigned int val;
+	put_unaligned_le32(data, &val);
+
 	/* send bits of data specified by reg to dsp */
 	do {
-		res = snd_hda_codec_read(codec, WIDGET_DSP_CTRL, 0, reg, data);
+		res = snd_hda_codec_read(codec, WIDGET_DSP_CTRL, 0, reg, val);
 		if ((res >= 0) && (res != VENDOR_STATUS_DSPIO_BUSY))
 			return res;
 	} while (--retry);
-- 
1.7.4.1

             reply	other threads:[~2012-09-27  1:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-27  1:23 Ian Minett [this message]
2012-10-08  8:15 ` [PATCH 1/1] ALSA: CA0132 - Ensure SCP packet is little-endian format 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=1348709039-4210-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).