diff options
| -rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index f837b0a4f6f4..0518ff2d960c 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
| @@ -741,6 +741,41 @@ static const struct snd_soc_dai_ops davinci_mcasp_dai_ops = { | |||
| 741 | .set_sysclk = davinci_mcasp_set_sysclk, | 741 | .set_sysclk = davinci_mcasp_set_sysclk, |
| 742 | }; | 742 | }; |
| 743 | 743 | ||
| 744 | #ifdef CONFIG_PM_SLEEP | ||
| 745 | static int davinci_mcasp_suspend(struct snd_soc_dai *dai) | ||
| 746 | { | ||
| 747 | struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); | ||
| 748 | |||
| 749 | mcasp->context.txfmtctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_TXFMCTL_REG); | ||
| 750 | mcasp->context.rxfmtctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_RXFMCTL_REG); | ||
| 751 | mcasp->context.txfmt = mcasp_get_reg(mcasp, DAVINCI_MCASP_TXFMT_REG); | ||
| 752 | mcasp->context.rxfmt = mcasp_get_reg(mcasp, DAVINCI_MCASP_RXFMT_REG); | ||
| 753 | mcasp->context.aclkxctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_ACLKXCTL_REG); | ||
| 754 | mcasp->context.aclkrctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_ACLKRCTL_REG); | ||
| 755 | mcasp->context.pdir = mcasp_get_reg(mcasp, DAVINCI_MCASP_PDIR_REG); | ||
| 756 | |||
| 757 | return 0; | ||
| 758 | } | ||
| 759 | |||
| 760 | static int davinci_mcasp_resume(struct snd_soc_dai *dai) | ||
| 761 | { | ||
| 762 | struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); | ||
| 763 | |||
| 764 | mcasp_set_reg(mcasp, DAVINCI_MCASP_TXFMCTL_REG, mcasp->context.txfmtctl); | ||
| 765 | mcasp_set_reg(mcasp, DAVINCI_MCASP_RXFMCTL_REG, mcasp->context.rxfmtctl); | ||
| 766 | mcasp_set_reg(mcasp, DAVINCI_MCASP_TXFMT_REG, mcasp->context.txfmt); | ||
| 767 | mcasp_set_reg(mcasp, DAVINCI_MCASP_RXFMT_REG, mcasp->context.rxfmt); | ||
| 768 | mcasp_set_reg(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, mcasp->context.aclkxctl); | ||
| 769 | mcasp_set_reg(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, mcasp->context.aclkrctl); | ||
| 770 | mcasp_set_reg(mcasp, DAVINCI_MCASP_PDIR_REG, mcasp->context.pdir); | ||
| 771 | |||
| 772 | return 0; | ||
| 773 | } | ||
| 774 | #else | ||
| 775 | #define davinci_mcasp_suspend NULL | ||
| 776 | #define davinci_mcasp_resume NULL | ||
| 777 | #endif | ||
| 778 | |||
| 744 | #define DAVINCI_MCASP_RATES SNDRV_PCM_RATE_8000_192000 | 779 | #define DAVINCI_MCASP_RATES SNDRV_PCM_RATE_8000_192000 |
| 745 | 780 | ||
| 746 | #define DAVINCI_MCASP_PCM_FMTS (SNDRV_PCM_FMTBIT_S8 | \ | 781 | #define DAVINCI_MCASP_PCM_FMTS (SNDRV_PCM_FMTBIT_S8 | \ |
| @@ -757,6 +792,8 @@ static const struct snd_soc_dai_ops davinci_mcasp_dai_ops = { | |||
| 757 | static struct snd_soc_dai_driver davinci_mcasp_dai[] = { | 792 | static struct snd_soc_dai_driver davinci_mcasp_dai[] = { |
| 758 | { | 793 | { |
| 759 | .name = "davinci-mcasp.0", | 794 | .name = "davinci-mcasp.0", |
| 795 | .suspend = davinci_mcasp_suspend, | ||
| 796 | .resume = davinci_mcasp_resume, | ||
| 760 | .playback = { | 797 | .playback = { |
| 761 | .channels_min = 2, | 798 | .channels_min = 2, |
| 762 | .channels_max = 32 * 16, | 799 | .channels_max = 32 * 16, |
| @@ -1149,49 +1186,12 @@ static int davinci_mcasp_remove(struct platform_device *pdev) | |||
| 1149 | return 0; | 1186 | return 0; |
| 1150 | } | 1187 | } |
| 1151 | 1188 | ||
| 1152 | #ifdef CONFIG_PM_SLEEP | ||
| 1153 | static int davinci_mcasp_suspend(struct device *dev) | ||
| 1154 | { | ||
| 1155 | struct davinci_mcasp *mcasp = dev_get_drvdata(dev); | ||
| 1156 | |||
| 1157 | mcasp->context.txfmtctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_TXFMCTL_REG); | ||
| 1158 | mcasp->context.rxfmtctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_RXFMCTL_REG); | ||
| 1159 | mcasp->context.txfmt = mcasp_get_reg(mcasp, DAVINCI_MCASP_TXFMT_REG); | ||
| 1160 | mcasp->context.rxfmt = mcasp_get_reg(mcasp, DAVINCI_MCASP_RXFMT_REG); | ||
| 1161 | mcasp->context.aclkxctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_ACLKXCTL_REG); | ||
| 1162 | mcasp->context.aclkrctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_ACLKRCTL_REG); | ||
| 1163 | mcasp->context.pdir = mcasp_get_reg(mcasp, DAVINCI_MCASP_PDIR_REG); | ||
| 1164 | |||
| 1165 | return 0; | ||
| 1166 | } | ||
| 1167 | |||
| 1168 | static int davinci_mcasp_resume(struct device *dev) | ||
| 1169 | { | ||
| 1170 | struct davinci_mcasp *mcasp = dev_get_drvdata(dev); | ||
| 1171 | |||
| 1172 | mcasp_set_reg(mcasp, DAVINCI_MCASP_TXFMCTL_REG, mcasp->context.txfmtctl); | ||
| 1173 | mcasp_set_reg(mcasp, DAVINCI_MCASP_RXFMCTL_REG, mcasp->context.rxfmtctl); | ||
| 1174 | mcasp_set_reg(mcasp, DAVINCI_MCASP_TXFMT_REG, mcasp->context.txfmt); | ||
| 1175 | mcasp_set_reg(mcasp, DAVINCI_MCASP_RXFMT_REG, mcasp->context.rxfmt); | ||
| 1176 | mcasp_set_reg(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, mcasp->context.aclkxctl); | ||
| 1177 | mcasp_set_reg(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, mcasp->context.aclkrctl); | ||
| 1178 | mcasp_set_reg(mcasp, DAVINCI_MCASP_PDIR_REG, mcasp->context.pdir); | ||
| 1179 | |||
| 1180 | return 0; | ||
| 1181 | } | ||
| 1182 | #endif | ||
| 1183 | |||
| 1184 | SIMPLE_DEV_PM_OPS(davinci_mcasp_pm_ops, | ||
| 1185 | davinci_mcasp_suspend, | ||
| 1186 | davinci_mcasp_resume); | ||
| 1187 | |||
| 1188 | static struct platform_driver davinci_mcasp_driver = { | 1189 | static struct platform_driver davinci_mcasp_driver = { |
| 1189 | .probe = davinci_mcasp_probe, | 1190 | .probe = davinci_mcasp_probe, |
| 1190 | .remove = davinci_mcasp_remove, | 1191 | .remove = davinci_mcasp_remove, |
| 1191 | .driver = { | 1192 | .driver = { |
| 1192 | .name = "davinci-mcasp", | 1193 | .name = "davinci-mcasp", |
| 1193 | .owner = THIS_MODULE, | 1194 | .owner = THIS_MODULE, |
| 1194 | .pm = &davinci_mcasp_pm_ops, | ||
| 1195 | .of_match_table = mcasp_dt_ids, | 1195 | .of_match_table = mcasp_dt_ids, |
| 1196 | }, | 1196 | }, |
| 1197 | }; | 1197 | }; |
