diff options
Diffstat (limited to 'sound/pci/ice1712/prodigy_hifi.c')
-rw-r--r-- | sound/pci/ice1712/prodigy_hifi.c | 46 |
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 | */ |
1080 | static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice) | 1080 | static 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 | ||
1103 | static 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 | |||
1117 | static 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 | } |