Skip to content

Commit

Permalink
ASoC: Pandora: Pass SRG input clock frequency to the OMAP McBSP DAI
Browse files Browse the repository at this point in the history
Upcoming change to omap-mcbsp.c require that machine drivers using OMAP
as a DAI master to pass sample rate generator input clock frequency to
the omap-mcbsp.c DAI driver.

Pandora is using 256*Fs output from the TWL4030 codec as an input clock to
the McBSP sample rate generator.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Tested-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Jarkko Nikula authored and Mark Brown committed Nov 9, 2009
1 parent c939e5c commit 9e5d86f
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions sound/soc/omap/omap3pandora.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@

#define PREFIX "ASoC omap3pandora: "

static int omap3pandora_cmn_hw_params(struct snd_soc_dai *codec_dai,
struct snd_soc_dai *cpu_dai, unsigned int fmt)
static int omap3pandora_cmn_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, unsigned int fmt)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
int ret;

/* Set codec DAI configuration */
Expand All @@ -68,8 +71,9 @@ static int omap3pandora_cmn_hw_params(struct snd_soc_dai *codec_dai,
}

/* Set McBSP clock to external */
ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_SYSCLK_CLKS_EXT, 0,
SND_SOC_CLOCK_IN);
ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_SYSCLK_CLKS_EXT,
256 * params_rate(params),
SND_SOC_CLOCK_IN);
if (ret < 0) {
pr_err(PREFIX "can't set cpu system clock\n");
return ret;
Expand All @@ -87,11 +91,7 @@ static int omap3pandora_cmn_hw_params(struct snd_soc_dai *codec_dai,
static int omap3pandora_out_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;

return omap3pandora_cmn_hw_params(codec_dai, cpu_dai,
return omap3pandora_cmn_hw_params(substream, params,
SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_IB_NF |
SND_SOC_DAIFMT_CBS_CFS);
Expand All @@ -100,11 +100,7 @@ static int omap3pandora_out_hw_params(struct snd_pcm_substream *substream,
static int omap3pandora_in_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;

return omap3pandora_cmn_hw_params(codec_dai, cpu_dai,
return omap3pandora_cmn_hw_params(substream, params,
SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS);
Expand Down

0 comments on commit 9e5d86f

Please sign in to comment.