diff options
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 39 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.h | 12 |
2 files changed, 51 insertions, 0 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 32ddb7fe5034..cdfe959d6062 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -1251,12 +1251,51 @@ static int davinci_mcasp_remove(struct platform_device *pdev) | |||
1251 | return 0; | 1251 | return 0; |
1252 | } | 1252 | } |
1253 | 1253 | ||
1254 | #ifdef CONFIG_PM_SLEEP | ||
1255 | static int davinci_mcasp_suspend(struct device *dev) | ||
1256 | { | ||
1257 | struct davinci_audio_dev *a = dev_get_drvdata(dev); | ||
1258 | void __iomem *base = a->base; | ||
1259 | |||
1260 | a->context.txfmtctl = mcasp_get_reg(base + DAVINCI_MCASP_TXFMCTL_REG); | ||
1261 | a->context.rxfmtctl = mcasp_get_reg(base + DAVINCI_MCASP_RXFMCTL_REG); | ||
1262 | a->context.txfmt = mcasp_get_reg(base + DAVINCI_MCASP_TXFMT_REG); | ||
1263 | a->context.rxfmt = mcasp_get_reg(base + DAVINCI_MCASP_RXFMT_REG); | ||
1264 | a->context.aclkxctl = mcasp_get_reg(base + DAVINCI_MCASP_ACLKXCTL_REG); | ||
1265 | a->context.aclkrctl = mcasp_get_reg(base + DAVINCI_MCASP_ACLKRCTL_REG); | ||
1266 | a->context.pdir = mcasp_get_reg(base + DAVINCI_MCASP_PDIR_REG); | ||
1267 | |||
1268 | return 0; | ||
1269 | } | ||
1270 | |||
1271 | static int davinci_mcasp_resume(struct device *dev) | ||
1272 | { | ||
1273 | struct davinci_audio_dev *a = dev_get_drvdata(dev); | ||
1274 | void __iomem *base = a->base; | ||
1275 | |||
1276 | mcasp_set_reg(base + DAVINCI_MCASP_TXFMCTL_REG, a->context.txfmtctl); | ||
1277 | mcasp_set_reg(base + DAVINCI_MCASP_RXFMCTL_REG, a->context.rxfmtctl); | ||
1278 | mcasp_set_reg(base + DAVINCI_MCASP_TXFMT_REG, a->context.txfmt); | ||
1279 | mcasp_set_reg(base + DAVINCI_MCASP_RXFMT_REG, a->context.rxfmt); | ||
1280 | mcasp_set_reg(base + DAVINCI_MCASP_ACLKXCTL_REG, a->context.aclkxctl); | ||
1281 | mcasp_set_reg(base + DAVINCI_MCASP_ACLKRCTL_REG, a->context.aclkrctl); | ||
1282 | mcasp_set_reg(base + DAVINCI_MCASP_PDIR_REG, a->context.pdir); | ||
1283 | |||
1284 | return 0; | ||
1285 | } | ||
1286 | #endif | ||
1287 | |||
1288 | SIMPLE_DEV_PM_OPS(davinci_mcasp_pm_ops, | ||
1289 | davinci_mcasp_suspend, | ||
1290 | davinci_mcasp_resume); | ||
1291 | |||
1254 | static struct platform_driver davinci_mcasp_driver = { | 1292 | static struct platform_driver davinci_mcasp_driver = { |
1255 | .probe = davinci_mcasp_probe, | 1293 | .probe = davinci_mcasp_probe, |
1256 | .remove = davinci_mcasp_remove, | 1294 | .remove = davinci_mcasp_remove, |
1257 | .driver = { | 1295 | .driver = { |
1258 | .name = "davinci-mcasp", | 1296 | .name = "davinci-mcasp", |
1259 | .owner = THIS_MODULE, | 1297 | .owner = THIS_MODULE, |
1298 | .pm = &davinci_mcasp_pm_ops, | ||
1260 | .of_match_table = mcasp_dt_ids, | 1299 | .of_match_table = mcasp_dt_ids, |
1261 | }, | 1300 | }, |
1262 | }; | 1301 | }; |
diff --git a/sound/soc/davinci/davinci-mcasp.h b/sound/soc/davinci/davinci-mcasp.h index a9ac0c11da71..a2e27e1c32f3 100644 --- a/sound/soc/davinci/davinci-mcasp.h +++ b/sound/soc/davinci/davinci-mcasp.h | |||
@@ -43,6 +43,18 @@ struct davinci_audio_dev { | |||
43 | /* McASP FIFO related */ | 43 | /* McASP FIFO related */ |
44 | u8 txnumevt; | 44 | u8 txnumevt; |
45 | u8 rxnumevt; | 45 | u8 rxnumevt; |
46 | |||
47 | #ifdef CONFIG_PM_SLEEP | ||
48 | struct { | ||
49 | u32 txfmtctl; | ||
50 | u32 rxfmtctl; | ||
51 | u32 txfmt; | ||
52 | u32 rxfmt; | ||
53 | u32 aclkxctl; | ||
54 | u32 aclkrctl; | ||
55 | u32 pdir; | ||
56 | } context; | ||
57 | #endif | ||
46 | }; | 58 | }; |
47 | 59 | ||
48 | #endif /* DAVINCI_MCASP_H */ | 60 | #endif /* DAVINCI_MCASP_H */ |