aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci/davinci-mcasp.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2014-10-01 09:02:11 -0400
committerMark Brown <broonie@kernel.org>2014-10-01 12:02:07 -0400
commit1cc0c054f380c1c477642b5d9d9d9f697f641dbc (patch)
tree93e9dc632aadb2db40ef2dcb98bb9c02ffc051ed /sound/soc/davinci/davinci-mcasp.c
parent371e07ec837464375fe4d7ef3bd13e13cdfbb458 (diff)
ASoC: davinci-mcasp: Convert the context save/restore to use array
Instead of individual values use an array to store the registers need to be saved on suspend and restored on resume. It is going to be easier to add more registers to save and restore. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/davinci/davinci-mcasp.c')
-rw-r--r--sound/soc/davinci/davinci-mcasp.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index c28508da34cf..63e24449eb89 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -42,14 +42,18 @@
42 42
43#define MCASP_MAX_AFIFO_DEPTH 64 43#define MCASP_MAX_AFIFO_DEPTH 64
44 44
45static u32 context_regs[] = {
46 DAVINCI_MCASP_TXFMCTL_REG,
47 DAVINCI_MCASP_RXFMCTL_REG,
48 DAVINCI_MCASP_TXFMT_REG,
49 DAVINCI_MCASP_RXFMT_REG,
50 DAVINCI_MCASP_ACLKXCTL_REG,
51 DAVINCI_MCASP_ACLKRCTL_REG,
52 DAVINCI_MCASP_PDIR_REG,
53};
54
45struct davinci_mcasp_context { 55struct davinci_mcasp_context {
46 u32 txfmtctl; 56 u32 config_regs[ARRAY_SIZE(context_regs)];
47 u32 rxfmtctl;
48 u32 txfmt;
49 u32 rxfmt;
50 u32 aclkxctl;
51 u32 aclkrctl;
52 u32 pdir;
53}; 57};
54 58
55struct davinci_mcasp { 59struct davinci_mcasp {
@@ -857,14 +861,10 @@ static int davinci_mcasp_suspend(struct snd_soc_dai *dai)
857{ 861{
858 struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); 862 struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
859 struct davinci_mcasp_context *context = &mcasp->context; 863 struct davinci_mcasp_context *context = &mcasp->context;
864 int i;
860 865
861 context->txfmtctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_TXFMCTL_REG); 866 for (i = 0; i < ARRAY_SIZE(context_regs); i++)
862 context->rxfmtctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_RXFMCTL_REG); 867 context->config_regs[i] = mcasp_get_reg(mcasp, context_regs[i]);
863 context->txfmt = mcasp_get_reg(mcasp, DAVINCI_MCASP_TXFMT_REG);
864 context->rxfmt = mcasp_get_reg(mcasp, DAVINCI_MCASP_RXFMT_REG);
865 context->aclkxctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_ACLKXCTL_REG);
866 context->aclkrctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_ACLKRCTL_REG);
867 context->pdir = mcasp_get_reg(mcasp, DAVINCI_MCASP_PDIR_REG);
868 868
869 return 0; 869 return 0;
870} 870}
@@ -873,14 +873,10 @@ static int davinci_mcasp_resume(struct snd_soc_dai *dai)
873{ 873{
874 struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); 874 struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
875 struct davinci_mcasp_context *context = &mcasp->context; 875 struct davinci_mcasp_context *context = &mcasp->context;
876 int i;
876 877
877 mcasp_set_reg(mcasp, DAVINCI_MCASP_TXFMCTL_REG, context->txfmtctl); 878 for (i = 0; i < ARRAY_SIZE(context_regs); i++)
878 mcasp_set_reg(mcasp, DAVINCI_MCASP_RXFMCTL_REG, context->rxfmtctl); 879 mcasp_set_reg(mcasp, context_regs[i], context->config_regs[i]);
879 mcasp_set_reg(mcasp, DAVINCI_MCASP_TXFMT_REG, context->txfmt);
880 mcasp_set_reg(mcasp, DAVINCI_MCASP_RXFMT_REG, context->rxfmt);
881 mcasp_set_reg(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, context->aclkxctl);
882 mcasp_set_reg(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, context->aclkrctl);
883 mcasp_set_reg(mcasp, DAVINCI_MCASP_PDIR_REG, context->pdir);
884 880
885 return 0; 881 return 0;
886} 882}