summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2014-09-29 15:42:25 +0000
committerDarren Etheridge <detheridge@ti.com>2014-09-30 09:08:07 -0500
commitd74e81809b984580594445d825a14637af8263a1 (patch)
treed68d54ad095bb56bb46f686b7f1575bd8bc2b914 /sound
parent7e4752edc4db726e228449cd7d71b664fc331fad (diff)
ASoC: davinci-mcasp: Save and restore the serializer registers on suspend
If the board is suspended to a deep sleep state McASP is going to loose it's context. We also need to save and restore the configuration of the McASP serializers. Since the number of serializers depend on the SoC we need to allocate the memory for them dynamically. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Darren Etheridge <detheridge@ti.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/davinci/davinci-mcasp.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 98bbf36fee4..4ba09b73019 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -58,6 +58,7 @@ struct davinci_mcasp_context {
u32 txtdm;
u32 rfifoctl;
u32 wfifoctl;
+ u32 *xrsrctl;
};
struct davinci_mcasp {
@@ -873,6 +874,7 @@ static int davinci_mcasp_suspend(struct snd_soc_dai *dai)
{
struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
struct davinci_mcasp_context *context = &mcasp->context;
+ int i;
u32 reg;
context->txfmtctl = mcasp_get_reg(mcasp, DAVINCI_MCASP_TXFMCTL_REG);
@@ -896,6 +898,9 @@ static int davinci_mcasp_suspend(struct snd_soc_dai *dai)
reg = mcasp->fifo_base + MCASP_RFIFOCTL_OFFSET;
context->rfifoctl = mcasp_get_reg(mcasp, reg);
}
+ for (i = 0; i < mcasp->num_serializer; i++)
+ context->xrsrctl[i] = mcasp_get_reg(mcasp,
+ DAVINCI_MCASP_XRSRCTL_REG(i));
return 0;
}
@@ -904,6 +909,7 @@ static int davinci_mcasp_resume(struct snd_soc_dai *dai)
{
struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
struct davinci_mcasp_context *context = &mcasp->context;
+ int i;
u32 reg;
mcasp_set_reg(mcasp, DAVINCI_MCASP_TXFMCTL_REG, context->txfmtctl);
@@ -927,6 +933,9 @@ static int davinci_mcasp_resume(struct snd_soc_dai *dai)
reg = mcasp->fifo_base + MCASP_RFIFOCTL_OFFSET;
mcasp_set_reg(mcasp, reg, context->rfifoctl);
}
+ for (i = 0; i < mcasp->num_serializer; i++)
+ mcasp_set_reg(mcasp, DAVINCI_MCASP_XRSRCTL_REG(i),
+ context->xrsrctl[i]);
return 0;
}
@@ -1245,6 +1254,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
mcasp->op_mode = pdata->op_mode;
mcasp->tdm_slots = pdata->tdm_slots;
mcasp->num_serializer = pdata->num_serializer;
+#ifdef CONFIG_PM_SLEEP
+ mcasp->context.xrsrctl = devm_kzalloc(&pdev->dev,
+ sizeof(u32) * mcasp->num_serializer,
+ GFP_KERNEL);
+#endif
mcasp->serial_dir = pdata->serial_dir;
mcasp->version = pdata->version;
mcasp->txnumevt = pdata->txnumevt;