diff options
| author | Misael Lopez Cruz <misael.lopez@ti.com> | 2011-05-31 09:23:00 +0100 |
|---|---|---|
| committer | Andy Green <andy.green@linaro.org> | 2011-05-31 11:04:31 +0100 |
| commit | ecf526d697c4ae19bdd0412329de44c04f3fccf9 (patch) | |
| tree | 9102e2a354727d0ff5bb3064edaf3924fb3ce017 /sound | |
| parent | 79a407cf9c34c314497a737cd45dfc2546af07c8 (diff) | |
ASoC: McPDM: Add offset cancellation
McPDM interface supports an offset cancellation feature
to eliminate the offset of the analog headset downlink
path. External audio companion chip should provide
the offset values. Offset values are fixed in this
implementation.
Change-Id: Iafbdb719b5d693bdae707717224c4be503567eeb
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Diffstat (limited to 'sound')
| -rw-r--r-- | sound/soc/omap/omap-mcpdm.c | 21 | ||||
| -rw-r--r-- | sound/soc/omap/omap-mcpdm.h | 5 |
2 files changed, 15 insertions, 11 deletions
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index 67ce00149c7..f420ad001e3 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c @@ -69,6 +69,10 @@ struct omap_mcpdm { int up_channels; int dl_active; int ul_active; + + /* DC offset */ + int dl1_offset; + int dl2_offset; }; static struct omap_mcpdm_link omap_mcpdm_links[] = { @@ -455,24 +459,25 @@ static void omap_mcpdm_free(struct omap_mcpdm *mcpdm) /* Enable/disable DC offset cancelation for the analog * headset path (PDM channels 1 and 2). */ -static int omap_mcpdm_set_offset(struct omap_mcpdm *mcpdm, - int offset1, int offset2) +static int omap_mcpdm_set_offset(struct omap_mcpdm *mcpdm) { int offset; - if ((offset1 > DN_OFST_MAX) || (offset2 > DN_OFST_MAX)) + if ((mcpdm->dl1_offset > DN_OFST_MAX) || + (mcpdm->dl2_offset > DN_OFST_MAX)) return -EINVAL; - offset = (offset1 << DN_OFST_RX1) | (offset2 << DN_OFST_RX2); + offset = (mcpdm->dl1_offset << DN_OFST_RX1) | + (mcpdm->dl2_offset << DN_OFST_RX2); /* offset cancellation for channel 1 */ - if (offset1) + if (mcpdm->dl1_offset) offset |= DN_OFST_RX1_EN; else offset &= ~DN_OFST_RX1_EN; /* offset cancellation for channel 2 */ - if (offset2) + if (mcpdm->dl2_offset) offset |= DN_OFST_RX2_EN; else offset &= ~DN_OFST_RX2_EN; @@ -681,6 +686,10 @@ static __devinit int asoc_mcpdm_probe(struct platform_device *pdev) mcpdm->dev = &pdev->dev; + /* TODO: values will be different per device, read from FS */ + mcpdm->dl1_offset = 0x1F; + mcpdm->dl2_offset = 0x1F; + ret = snd_soc_register_dais(&pdev->dev, omap_mcpdm_dai, ARRAY_SIZE(omap_mcpdm_dai)); if (ret == 0) diff --git a/sound/soc/omap/omap-mcpdm.h b/sound/soc/omap/omap-mcpdm.h index d9b5fd6bdf1..986fb67ad5a 100644 --- a/sound/soc/omap/omap-mcpdm.h +++ b/sound/soc/omap/omap-mcpdm.h @@ -123,9 +123,4 @@ struct omap_mcpdm_link { int channels; }; -struct omap_mcpdm; - -extern int omap_mcpdm_set_offset(struct omap_mcpdm *mcpdm, - int offset1, int offset2); - #endif /* End of __OMAP_MCPDM_H__ */ |
