Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ondrej Zary <linux@rainbow-software.org>
To: alsa-devel@alsa-project.org
Subject: [PATCH 2/2] snd-ice1712: Add suspend support for M-Audio ICE1712-based cards
Date: Sun, 30 Mar 2014 23:37:31 +0200	[thread overview]
Message-ID: <1396215451-24128-2-git-send-email-linux@rainbow-software.org> (raw)
In-Reply-To: <1396215451-24128-1-git-send-email-linux@rainbow-software.org>

Add suspend support for M-Audio cards based on ICE1712 chip.
Tested with M-Audio Audiophile 24/96. S/PDIF will probably not work.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
 sound/pci/ice1712/delta.c |   30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
index 9e28cc1..c19ae72 100644
--- a/sound/pci/ice1712/delta.c
+++ b/sound/pci/ice1712/delta.c
@@ -575,6 +575,30 @@ static struct snd_ak4xxx_private akm_vx442_priv = {
 	.mask_flags = 0,
 };
 
+#ifdef CONFIG_PM_SLEEP
+static int snd_ice1712_delta_resume(struct snd_ice1712 *ice)
+{
+	unsigned char akm_backup[AK4XXX_IMAGE_SIZE];
+	/* init codec and restore registers */
+	if (ice->akm_codecs) {
+		memcpy(akm_backup, ice->akm->images, sizeof(akm_backup));
+		snd_akm4xxx_init(ice->akm);
+		memcpy(ice->akm->images, akm_backup, sizeof(akm_backup));
+		snd_akm4xxx_reset(ice->akm, 0);
+	}
+
+	return 0;
+}
+
+static int snd_ice1712_delta_suspend(struct snd_ice1712 *ice)
+{
+	if (ice->akm_codecs) /* reset & mute codec */
+		snd_akm4xxx_reset(ice->akm, 1);
+
+	return 0;
+}
+#endif
+
 static int snd_ice1712_delta_init(struct snd_ice1712 *ice)
 {
 	int err;
@@ -621,7 +645,11 @@ static int snd_ice1712_delta_init(struct snd_ice1712 *ice)
 		ice->num_total_adcs = 4;
 		break;
 	}
-
+#ifdef CONFIG_PM_SLEEP
+	ice->pm_resume = snd_ice1712_delta_resume;
+	ice->pm_suspend = snd_ice1712_delta_suspend;
+	ice->pm_suspend_enabled = 1;
+#endif
 	/* initialize the SPI clock to high */
 	tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
 	tmp |= ICE1712_DELTA_AP_CCLK;
-- 
Ondrej Zary

  reply	other threads:[~2014-03-30 21:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-30 21:37 [PATCH 1/2] snd-ice1712: add suspend support for ICE1712 chip Ondrej Zary
2014-03-30 21:37 ` Ondrej Zary [this message]
2014-03-31 10:32 ` 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=1396215451-24128-2-git-send-email-linux@rainbow-software.org \
    --to=linux@rainbow-software.org \
    --cc=alsa-devel@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