Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 206587
b: refs/heads/master
c: ec63755
h: refs/heads/master
i:
  206585: ddcc0c4
  206583: a0f4f31
v: v3
  • Loading branch information
Raffaele Recalcati authored and Mark Brown committed Jul 6, 2010
1 parent b4da7d2 commit 2b346c2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a4c8ea2ddaed2f461606c2828b19786524b551ac
refs/heads/master: ec6375533748806a1a49dad7ce124cc02886854a
15 changes: 15 additions & 0 deletions trunk/arch/arm/mach-davinci/include/mach/asp.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ struct snd_platform_data {
unsigned sram_size_playback;
unsigned sram_size_capture;

/*
* If McBSP peripheral gets the clock from an external pin,
* there are three chooses, that are MCBSP_CLKX, MCBSP_CLKR
* and MCBSP_CLKS.
* Depending on different hardware connections it is possible
* to use this setting to change the behaviour of McBSP
* driver. The dm365_clk_input_pin enum is available for dm365
*/
int clk_input_pin;

/* McASP specific fields */
int tdm_slots;
u8 op_mode;
Expand All @@ -78,6 +88,11 @@ enum {
MCASP_VERSION_2, /* DA8xx/OMAPL1x */
};

enum dm365_clk_input_pin {
MCBSP_CLKR = 0, /* DM365 */
MCBSP_CLKS,
};

#define INACTIVE_MODE 0
#define TX_MODE 1
#define RX_MODE 2
Expand Down
29 changes: 24 additions & 5 deletions trunk/sound/soc/davinci/davinci-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ static const unsigned char double_fmt[SNDRV_PCM_FORMAT_S32_LE + 1] = {
};

struct davinci_mcbsp_dev {
struct device *dev;
struct davinci_pcm_dma_params dma_params[2];
void __iomem *base;
#define MOD_DSP_A 0
Expand Down Expand Up @@ -153,6 +154,7 @@ struct davinci_mcbsp_dev {

unsigned int fmt;
int clk_div;
int clk_input_pin;
};

static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev *dev,
Expand Down Expand Up @@ -279,11 +281,26 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
DAVINCI_MCBSP_PCR_CLKRM;
break;
case SND_SOC_DAIFMT_CBM_CFS:
/* McBSP CLKR pin is the input for the Sample Rate Generator.
* McBSP FSR and FSX are driven by the Sample Rate Generator. */
pcr = DAVINCI_MCBSP_PCR_SCLKME |
DAVINCI_MCBSP_PCR_FSXM |
DAVINCI_MCBSP_PCR_FSRM;
pcr = DAVINCI_MCBSP_PCR_FSRM | DAVINCI_MCBSP_PCR_FSXM;
/*
* Selection of the clock input pin that is the
* input for the Sample Rate Generator.
* McBSP FSR and FSX are driven by the Sample Rate
* Generator.
*/
switch (dev->clk_input_pin) {
case MCBSP_CLKS:
pcr |= DAVINCI_MCBSP_PCR_CLKXM |
DAVINCI_MCBSP_PCR_CLKRM;
break;
case MCBSP_CLKR:
pcr |= DAVINCI_MCBSP_PCR_SCLKME;
break;
default:
dev_err(dev->dev, "bad clk_input_pin\n");
return -EINVAL;
}

break;
case SND_SOC_DAIFMT_CBM_CFM:
/* codec is master */
Expand Down Expand Up @@ -644,6 +661,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
pdata->sram_size_playback;
dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].sram_size =
pdata->sram_size_capture;
dev->clk_input_pin = pdata->clk_input_pin;
}
dev->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(dev->clk)) {
Expand Down Expand Up @@ -676,6 +694,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
goto err_free_mem;
}
dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start;
dev->dev = &pdev->dev;

davinci_i2s_dai.private_data = dev;
davinci_i2s_dai.capture.dma_data = dev->dma_params;
Expand Down

0 comments on commit 2b346c2

Please sign in to comment.