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 03:31:07 -0400
committerTakashi Iwai <tiwai@suse.de>2009-06-25 03:31:07 -0400
commitb40e9538124fc9b9333e3eea0fc514da4a185dae (patch)
tree46cc0b55037581e2da8ae88d01164abd60004279 /sound/pci/ice1712/prodigy_hifi.c
parent28d0325ce6e0a52f53d8af687e6427fee59004d3 (diff)
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)
1077/* 1077/*
1078 * initialize the chip 1078 * initialize the chip
1079 */ 1079 */
1080static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice) 1080static void ak4396_init(struct snd_ice1712 *ice)
1081{ 1081{
1082 static unsigned short ak4396_inits[] = { 1082 static unsigned short ak4396_inits[] = {
1083 AK4396_CTRL1, 0x87, /* I2S Normal Mode, 24 bit */ 1083 AK4396_CTRL1, 0x87, /* I2S Normal Mode, 24 bit */
@@ -1087,9 +1087,37 @@ static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice)
1087 AK4396_RCH_ATT, 0x00, 1087 AK4396_RCH_ATT, 0x00,
1088 }; 1088 };
1089 1089
1090 struct prodigy_hifi_spec *spec;
1091 unsigned int i; 1090 unsigned int i;
1092 1091
1092 /* initialize ak4396 codec */
1093 /* reset codec */
1094 ak4396_write(ice, AK4396_CTRL1, 0x86);
1095 msleep(100);
1096 ak4396_write(ice, AK4396_CTRL1, 0x87);
1097
1098 for (i = 0; i < ARRAY_SIZE(ak4396_inits); i += 2)
1099 ak4396_write(ice, ak4396_inits[i], ak4396_inits[i+1]);
1100}
1101
1102#ifdef CONFIG_PM
1103static int __devinit prodigy_hd2_resume(struct snd_ice1712 *ice)
1104{
1105 /* initialize ak4396 codec and restore previous mixer volumes */
1106 struct prodigy_hifi_spec *spec = ice->spec;
1107 int i;
1108 mutex_lock(&ice->gpio_mutex);
1109 ak4396_init(ice);
1110 for (i = 0; i < 2; i++)
1111 ak4396_write(ice, AK4396_LCH_ATT + i, spec->vol[i] & 0xff);
1112 mutex_unlock(&ice->gpio_mutex);
1113 return 0;
1114}
1115#endif
1116
1117static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice)
1118{
1119 struct prodigy_hifi_spec *spec;
1120
1093 ice->vt1720 = 0; 1121 ice->vt1720 = 0;
1094 ice->vt1724 = 1; 1122 ice->vt1724 = 1;
1095 1123
@@ -1112,14 +1140,12 @@ static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice)
1112 return -ENOMEM; 1140 return -ENOMEM;
1113 ice->spec = spec; 1141 ice->spec = spec;
1114 1142
1115 /* initialize ak4396 codec */ 1143#ifdef CONFIG_PM
1116 /* reset codec */ 1144 ice->pm_resume = &prodigy_hd2_resume;
1117 ak4396_write(ice, AK4396_CTRL1, 0x86); 1145 ice->pm_suspend_enabled = 1;
1118 msleep(100); 1146#endif
1119 ak4396_write(ice, AK4396_CTRL1, 0x87); 1147
1120 1148 ak4396_init(ice);
1121 for (i = 0; i < ARRAY_SIZE(ak4396_inits); i += 2)
1122 ak4396_write(ice, ak4396_inits[i], ak4396_inits[i+1]);
1123 1149
1124 return 0; 1150 return 0;
1125} 1151}