summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorSebastien Guiriec <s-guiriec@ti.com>2011-05-31 09:23:01 +0100
committerAndy Green <andy.green@linaro.org>2011-05-31 11:04:32 +0100
commit8528812967c0f50815849abb9dc936d6a5473359 (patch)
treeb90a35918933ef4b7a77978c2521a0491abc1a1b /sound
parent29cc0bf1d80d4b8cbdfbfbe83eb7418fa16ee20c (diff)
ASoC: McPDM: Update the control of the channels for SW reset
McPDM channels management need to be control in a specific way in order to reset the internal digital filter of the IP for Uplink and downlink channels. Perform a Software reset when we are requestig the module. Change-Id: Ie5d351604d4162eafca0b4ed2ea0d557d6e90998 Signed-off-by: Sebastien Guiriec <s-guiriec@ti.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/omap/omap-mcpdm.c47
-rw-r--r--sound/soc/omap/omap-mcpdm.h5
2 files changed, 44 insertions, 8 deletions
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
index a9763827454..80858e0cfef 100644
--- a/sound/soc/omap/omap-mcpdm.c
+++ b/sound/soc/omap/omap-mcpdm.c
@@ -208,12 +208,21 @@ static void omap_mcpdm_start(struct omap_mcpdm *mcpdm, int stream)
{
int ctrl = omap_mcpdm_read(mcpdm, MCPDM_CTRL);
- if (stream)
+ if (stream) {
+ ctrl |= SW_UP_RST;
+ omap_mcpdm_write(mcpdm, MCPDM_CTRL, ctrl);
ctrl |= mcpdm->up_channels;
- else
+ omap_mcpdm_write(mcpdm, MCPDM_CTRL, ctrl);
+ ctrl &= ~SW_UP_RST;
+ omap_mcpdm_write(mcpdm, MCPDM_CTRL, ctrl);
+ } else {
+ ctrl |= SW_DN_RST;
+ omap_mcpdm_write(mcpdm, MCPDM_CTRL, ctrl);
ctrl |= mcpdm->dn_channels;
-
- omap_mcpdm_write(mcpdm, MCPDM_CTRL, ctrl);
+ omap_mcpdm_write(mcpdm, MCPDM_CTRL, ctrl);
+ ctrl &= ~SW_DN_RST;
+ omap_mcpdm_write(mcpdm, MCPDM_CTRL, ctrl);
+ }
}
/*
@@ -224,12 +233,21 @@ static void omap_mcpdm_stop(struct omap_mcpdm *mcpdm, int stream)
{
int ctrl = omap_mcpdm_read(mcpdm, MCPDM_CTRL);
- if (stream)
+ if (stream) {
+ ctrl |= SW_UP_RST;
+ omap_mcpdm_write(mcpdm, MCPDM_CTRL, ctrl);
ctrl &= ~mcpdm->up_channels;
- else
+ omap_mcpdm_write(mcpdm, MCPDM_CTRL, ctrl);
+ ctrl &= ~SW_UP_RST;
+ omap_mcpdm_write(mcpdm, MCPDM_CTRL, ctrl);
+ } else {
+ ctrl |= SW_DN_RST;
+ omap_mcpdm_write(mcpdm, MCPDM_CTRL, ctrl);
ctrl &= ~mcpdm->dn_channels;
-
- omap_mcpdm_write(mcpdm, MCPDM_CTRL, ctrl);
+ omap_mcpdm_write(mcpdm, MCPDM_CTRL, ctrl);
+ ctrl &= ~SW_DN_RST;
+ omap_mcpdm_write(mcpdm, MCPDM_CTRL, ctrl);
+ }
}
/*
@@ -401,6 +419,7 @@ static int omap_mcpdm_request(struct omap_mcpdm *mcpdm)
struct omap_mcpdm_platform_data *pdata;
int ret;
int ctrl;
+ int attemps = 0;
pdev = to_platform_device(mcpdm->dev);
pdata = pdev->dev.platform_data;
@@ -414,6 +433,18 @@ static int omap_mcpdm_request(struct omap_mcpdm *mcpdm)
}
mcpdm->free = 0;
+ /* Perform SW RESET of McPDM IP */
+ ctrl = omap_mcpdm_read(mcpdm, MCPDM_SYSCONFIG);
+ ctrl |= MCPDM_SOFTRESET;
+ omap_mcpdm_write(mcpdm, MCPDM_SYSCONFIG, ctrl);
+ /* Wait completion of SW RESET */
+ while ((omap_mcpdm_read(mcpdm, MCPDM_SYSCONFIG) & MCPDM_SOFTRESET)) {
+ if (attemps++ > 10000) {
+ udelay(10);
+ dev_err(mcpdm->dev, "Could not RESET McPDM\n");
+ }
+ }
+
/* Disable lines while request is ongoing */
omap_mcpdm_write(mcpdm, MCPDM_CTRL, 0x00);
diff --git a/sound/soc/omap/omap-mcpdm.h b/sound/soc/omap/omap-mcpdm.h
index 986fb67ad5a..2c69956e99e 100644
--- a/sound/soc/omap/omap-mcpdm.h
+++ b/sound/soc/omap/omap-mcpdm.h
@@ -69,6 +69,11 @@
#define DMA_UP_ENABLE 0x2
/*
+ * MCPDM_SYSCONFIG bit fields
+ */
+#define MCPDM_SOFTRESET 0x1
+
+/*
* MCPDM_CTRL bit fields
*/