Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 270670
b: refs/heads/master
c: 89b0d55
h: refs/heads/master
v: v3
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed Sep 26, 2011
1 parent 9f142dd commit 9faf969
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: db4aabcc1f2ac32de290510bcc895a960886779d
refs/heads/master: 89b0d550a6800793b917ce2290ddcd55374d7df6
25 changes: 25 additions & 0 deletions trunk/sound/soc/omap/omap-mcpdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ struct omap_mcpdm {
/* McPDM FIFO thresholds */
u32 dn_threshold;
u32 up_threshold;

/* McPDM dn offsets for rx1, and 2 channels */
u32 dn_rx_offset;
};

/*
Expand Down Expand Up @@ -183,6 +186,15 @@ static void omap_mcpdm_open_streams(struct omap_mcpdm *mcpdm)
MCPDM_DN_IRQ_EMPTY | MCPDM_DN_IRQ_FULL |
MCPDM_UP_IRQ_EMPTY | MCPDM_UP_IRQ_FULL);

/* Enable DN RX1/2 offset cancellation feature, if configured */
if (mcpdm->dn_rx_offset) {
u32 dn_offset = mcpdm->dn_rx_offset;

omap_mcpdm_write(mcpdm, MCPDM_REG_DN_OFFSET, dn_offset);
dn_offset |= (MCPDM_DN_OFST_RX1_EN | MCPDM_DN_OFST_RX2_EN);
omap_mcpdm_write(mcpdm, MCPDM_REG_DN_OFFSET, dn_offset);
}

omap_mcpdm_write(mcpdm, MCPDM_REG_FIFO_CTRL_DN, mcpdm->dn_threshold);
omap_mcpdm_write(mcpdm, MCPDM_REG_FIFO_CTRL_UP, mcpdm->up_threshold);

Expand All @@ -209,6 +221,10 @@ static void omap_mcpdm_close_streams(struct omap_mcpdm *mcpdm)

/* Disable DMA request generation for uplink */
omap_mcpdm_write(mcpdm, MCPDM_REG_DMAENABLE_CLR, MCPDM_DMA_UP_ENABLE);

/* Disable RX1/2 offset cancellation */
if (mcpdm->dn_rx_offset)
omap_mcpdm_write(mcpdm, MCPDM_REG_DN_OFFSET, 0);
}

static irqreturn_t omap_mcpdm_irq_handler(int irq, void *dev_id)
Expand Down Expand Up @@ -418,6 +434,15 @@ static struct snd_soc_dai_driver omap_mcpdm_dai = {
.ops = &omap_mcpdm_dai_ops,
};

void omap_mcpdm_configure_dn_offsets(struct snd_soc_pcm_runtime *rtd,
u8 rx1, u8 rx2)
{
struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(rtd->cpu_dai);

mcpdm->dn_rx_offset = MCPDM_DNOFST_RX1(rx1) | MCPDM_DNOFST_RX2(rx2);
}
EXPORT_SYMBOL_GPL(omap_mcpdm_configure_dn_offsets);

static __devinit int asoc_mcpdm_probe(struct platform_device *pdev)
{
struct omap_mcpdm *mcpdm;
Expand Down
12 changes: 12 additions & 0 deletions trunk/sound/soc/omap/omap-mcpdm.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,16 @@
#define MCPDM_UP_THRES_MAX 0xF
#define MCPDM_DN_THRES_MAX 0xF

/*
* MCPDM_DN_OFFSET bit fields
*/

#define MCPDM_DN_OFST_RX1_EN (1 << 0)
#define MCPDM_DNOFST_RX1(x) ((x & 0x1f) << 1)
#define MCPDM_DN_OFST_RX2_EN (1 << 8)
#define MCPDM_DNOFST_RX2(x) ((x & 0x1f) << 9)

void omap_mcpdm_configure_dn_offsets(struct snd_soc_pcm_runtime *rtd,
u8 rx1, u8 rx2);

#endif /* End of __OMAP_MCPDM_H__ */

0 comments on commit 9faf969

Please sign in to comment.