diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2012-07-17 03:16:44 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-07-17 04:55:47 -0400 |
commit | 5dd250728aa4cad49cfa18eb8ed11ba470ce382a (patch) | |
tree | 186ccaab175f383e80e82c3d3f187fe1d5d161f8 /sound/isa | |
parent | b4e2a16f992288f1c5cddda1948c53ba3dde9cb3 (diff) |
ALSA: snd-opti9xx: Implement suspend/resume
Implement suspend/resume support for Opti 92x and 93x chips.
Tested with Opti 929A+AD1848 and Opti 931.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa')
-rw-r--r-- | sound/isa/opti9xx/opti92x-ad1848.c | 67 |
1 files changed, 63 insertions, 4 deletions
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index ecc68dfe7b54..d7ce0125dcf2 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -136,8 +136,8 @@ struct snd_opti9xx { | |||
136 | #ifdef OPTi93X | 136 | #ifdef OPTi93X |
137 | unsigned long mc_indir_index; | 137 | unsigned long mc_indir_index; |
138 | struct resource *res_mc_indir; | 138 | struct resource *res_mc_indir; |
139 | struct snd_wss *codec; | ||
140 | #endif /* OPTi93X */ | 139 | #endif /* OPTi93X */ |
140 | struct snd_wss *codec; | ||
141 | unsigned long pwd_reg; | 141 | unsigned long pwd_reg; |
142 | 142 | ||
143 | spinlock_t lock; | 143 | spinlock_t lock; |
@@ -870,9 +870,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
870 | &codec); | 870 | &codec); |
871 | if (error < 0) | 871 | if (error < 0) |
872 | return error; | 872 | return error; |
873 | #ifdef OPTi93X | ||
874 | chip->codec = codec; | 873 | chip->codec = codec; |
875 | #endif | ||
876 | error = snd_wss_pcm(codec, 0, &pcm); | 874 | error = snd_wss_pcm(codec, 0, &pcm); |
877 | if (error < 0) | 875 | if (error < 0) |
878 | return error; | 876 | return error; |
@@ -1053,11 +1051,55 @@ static int __devexit snd_opti9xx_isa_remove(struct device *devptr, | |||
1053 | return 0; | 1051 | return 0; |
1054 | } | 1052 | } |
1055 | 1053 | ||
1054 | #ifdef CONFIG_PM | ||
1055 | static int snd_opti9xx_suspend(struct snd_card *card) | ||
1056 | { | ||
1057 | struct snd_opti9xx *chip = card->private_data; | ||
1058 | |||
1059 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | ||
1060 | chip->codec->suspend(chip->codec); | ||
1061 | return 0; | ||
1062 | } | ||
1063 | |||
1064 | static int snd_opti9xx_resume(struct snd_card *card) | ||
1065 | { | ||
1066 | struct snd_opti9xx *chip = card->private_data; | ||
1067 | int error, xdma2; | ||
1068 | #if defined(CS4231) || defined(OPTi93X) | ||
1069 | xdma2 = dma2; | ||
1070 | #else | ||
1071 | xdma2 = -1; | ||
1072 | #endif | ||
1073 | |||
1074 | error = snd_opti9xx_configure(chip, port, irq, dma1, xdma2, | ||
1075 | mpu_port, mpu_irq); | ||
1076 | if (error) | ||
1077 | return error; | ||
1078 | chip->codec->resume(chip->codec); | ||
1079 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | ||
1080 | return 0; | ||
1081 | } | ||
1082 | |||
1083 | static int snd_opti9xx_isa_suspend(struct device *dev, unsigned int n, | ||
1084 | pm_message_t state) | ||
1085 | { | ||
1086 | return snd_opti9xx_suspend(dev_get_drvdata(dev)); | ||
1087 | } | ||
1088 | |||
1089 | static int snd_opti9xx_isa_resume(struct device *dev, unsigned int n) | ||
1090 | { | ||
1091 | return snd_opti9xx_resume(dev_get_drvdata(dev)); | ||
1092 | } | ||
1093 | #endif | ||
1094 | |||
1056 | static struct isa_driver snd_opti9xx_driver = { | 1095 | static struct isa_driver snd_opti9xx_driver = { |
1057 | .match = snd_opti9xx_isa_match, | 1096 | .match = snd_opti9xx_isa_match, |
1058 | .probe = snd_opti9xx_isa_probe, | 1097 | .probe = snd_opti9xx_isa_probe, |
1059 | .remove = __devexit_p(snd_opti9xx_isa_remove), | 1098 | .remove = __devexit_p(snd_opti9xx_isa_remove), |
1060 | /* FIXME: suspend/resume */ | 1099 | #ifdef CONFIG_PM |
1100 | .suspend = snd_opti9xx_isa_suspend, | ||
1101 | .resume = snd_opti9xx_isa_resume, | ||
1102 | #endif | ||
1061 | .driver = { | 1103 | .driver = { |
1062 | .name = DEV_NAME | 1104 | .name = DEV_NAME |
1063 | }, | 1105 | }, |
@@ -1123,12 +1165,29 @@ static void __devexit snd_opti9xx_pnp_remove(struct pnp_card_link * pcard) | |||
1123 | snd_opti9xx_pnp_is_probed = 0; | 1165 | snd_opti9xx_pnp_is_probed = 0; |
1124 | } | 1166 | } |
1125 | 1167 | ||
1168 | #ifdef CONFIG_PM | ||
1169 | static int snd_opti9xx_pnp_suspend(struct pnp_card_link *pcard, | ||
1170 | pm_message_t state) | ||
1171 | { | ||
1172 | return snd_opti9xx_suspend(pnp_get_card_drvdata(pcard)); | ||
1173 | } | ||
1174 | |||
1175 | static int snd_opti9xx_pnp_resume(struct pnp_card_link *pcard) | ||
1176 | { | ||
1177 | return snd_opti9xx_resume(pnp_get_card_drvdata(pcard)); | ||
1178 | } | ||
1179 | #endif | ||
1180 | |||
1126 | static struct pnp_card_driver opti9xx_pnpc_driver = { | 1181 | static struct pnp_card_driver opti9xx_pnpc_driver = { |
1127 | .flags = PNP_DRIVER_RES_DISABLE, | 1182 | .flags = PNP_DRIVER_RES_DISABLE, |
1128 | .name = "opti9xx", | 1183 | .name = "opti9xx", |
1129 | .id_table = snd_opti9xx_pnpids, | 1184 | .id_table = snd_opti9xx_pnpids, |
1130 | .probe = snd_opti9xx_pnp_probe, | 1185 | .probe = snd_opti9xx_pnp_probe, |
1131 | .remove = __devexit_p(snd_opti9xx_pnp_remove), | 1186 | .remove = __devexit_p(snd_opti9xx_pnp_remove), |
1187 | #ifdef CONFIG_PM | ||
1188 | .suspend = snd_opti9xx_pnp_suspend, | ||
1189 | .resume = snd_opti9xx_pnp_resume, | ||
1190 | #endif | ||
1132 | }; | 1191 | }; |
1133 | #endif | 1192 | #endif |
1134 | 1193 | ||