aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ice1712/prodigy_hifi.c
diff options
context:
space:
mode:
authorIgor Chernyshev <igor.ch75+alsa at gmail.com>2009-06-25 09:31:07 +0200
committerTakashi Iwai <tiwai@suse.de>2009-06-25 09:31:07 +0200
commitb40e9538124fc9b9333e3eea0fc514da4a185dae (patch)
tree46cc0b55037581e2da8ae88d01164abd60004279 /sound/pci/ice1712/prodigy_hifi.c
parentLinux 2.6.31-rc1 (diff)
downloadlinux-dev-b40e9538124fc9b9333e3eea0fc514da4a185dae.tar.xz
linux-dev-b40e9538124fc9b9333e3eea0fc514da4a185dae.zip
ALSA: ice1724 - Patch for suspend/resume for Audiotrak Prodigy HD2
I've built a small HTPC and had to add suspend/resume support in ice1724 driver. There seem to be 3 existing bugs related to that: https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4413 https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3748 https://bugtrack.alsa-project.org/alsa-bug/view.php?id=2314 Due to hardware (un)availability, I only enabled the fix for Audiotrak Prodigy HD2 card, which is installed in my HTPC. However, most of my code should be reusable in the future on other ice1724-based cards as well (as long as people add card-specific peices of code). The fix is currently based on ALSA 1.0.20 and works on my MythBuntu 9.04 HTPC (using 2.6.28-11 kernel). Signed-off-by: Igor Chernyshev <igor.ch75+alsa at gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ice1712/prodigy_hifi.c')
-rw-r--r--sound/pci/ice1712/prodigy_hifi.c46
1 files changed, 36 insertions, 10 deletions
diff --git a/sound/pci/ice1712/prodigy_hifi.c b/sound/pci/ice1712/prodigy_hifi.c
index 043a93879bd5..c75515f5be6f 100644
--- a/sound/pci/ice1712/prodigy_hifi.c
+++ b/sound/pci/ice1712/prodigy_hifi.c
@@ -1077,7 +1077,7 @@ static int __devinit prodigy_hifi_init(struct snd_ice1712 *ice)
/*
* initialize the chip
*/
-static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice)
+static void ak4396_init(struct snd_ice1712 *ice)
{
static unsigned short ak4396_inits[] = {
AK4396_CTRL1, 0x87, /* I2S Normal Mode, 24 bit */
@@ -1087,9 +1087,37 @@ static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice)
AK4396_RCH_ATT, 0x00,
};
- struct prodigy_hifi_spec *spec;
unsigned int i;
+ /* initialize ak4396 codec */
+ /* reset codec */
+ ak4396_write(ice, AK4396_CTRL1, 0x86);
+ msleep(100);
+ ak4396_write(ice, AK4396_CTRL1, 0x87);
+
+ for (i = 0; i < ARRAY_SIZE(ak4396_inits); i += 2)
+ ak4396_write(ice, ak4396_inits[i], ak4396_inits[i+1]);
+}
+
+#ifdef CONFIG_PM
+static int __devinit prodigy_hd2_resume(struct snd_ice1712 *ice)
+{
+ /* initialize ak4396 codec and restore previous mixer volumes */
+ struct prodigy_hifi_spec *spec = ice->spec;
+ int i;
+ mutex_lock(&ice->gpio_mutex);
+ ak4396_init(ice);
+ for (i = 0; i < 2; i++)
+ ak4396_write(ice, AK4396_LCH_ATT + i, spec->vol[i] & 0xff);
+ mutex_unlock(&ice->gpio_mutex);
+ return 0;
+}
+#endif
+
+static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice)
+{
+ struct prodigy_hifi_spec *spec;
+
ice->vt1720 = 0;
ice->vt1724 = 1;
@@ -1112,14 +1140,12 @@ static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice)
return -ENOMEM;
ice->spec = spec;
- /* initialize ak4396 codec */
- /* reset codec */
- ak4396_write(ice, AK4396_CTRL1, 0x86);
- msleep(100);
- ak4396_write(ice, AK4396_CTRL1, 0x87);
-
- for (i = 0; i < ARRAY_SIZE(ak4396_inits); i += 2)
- ak4396_write(ice, ak4396_inits[i], ak4396_inits[i+1]);
+#ifdef CONFIG_PM
+ ice->pm_resume = &prodigy_hd2_resume;
+ ice->pm_suspend_enabled = 1;
+#endif
+
+ ak4396_init(ice);
return 0;
}