mirror of
https://github.com/torvalds/linux.git
synced 2024-11-08 05:01:48 +00:00
ASoC: bf5xx-ssm2602: Setup sysclock in init callback
The sysclock is fixed, so just set it up once in the init callback instead of setting it repeatably in the hw_params callback. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
e05854ddaa
commit
d9ca8e76f3
@ -44,16 +44,8 @@
|
|||||||
|
|
||||||
static struct snd_soc_card bf5xx_ssm2602;
|
static struct snd_soc_card bf5xx_ssm2602;
|
||||||
|
|
||||||
static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream,
|
static int bf5xx_ssm2602_dai_init(struct snd_soc_pcm_runtime *rtd)
|
||||||
struct snd_pcm_hw_params *params)
|
|
||||||
{
|
{
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
|
||||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
|
||||||
unsigned int clk = 0;
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
pr_debug("%s rate %d format %x\n", __func__, params_rate(params),
|
|
||||||
params_format(params));
|
|
||||||
/*
|
/*
|
||||||
* If you are using a crystal source which frequency is not 12MHz
|
* If you are using a crystal source which frequency is not 12MHz
|
||||||
* then modify the below case statement with frequency of the crystal.
|
* then modify the below case statement with frequency of the crystal.
|
||||||
@ -61,31 +53,10 @@ static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream,
|
|||||||
* If you are using the SPORT to generate clocking then this is
|
* If you are using the SPORT to generate clocking then this is
|
||||||
* where to do it.
|
* where to do it.
|
||||||
*/
|
*/
|
||||||
|
return snd_soc_dai_set_sysclk(rtd->codec_dai, SSM2602_SYSCLK, 12000000,
|
||||||
switch (params_rate(params)) {
|
|
||||||
case 8000:
|
|
||||||
case 16000:
|
|
||||||
case 48000:
|
|
||||||
case 96000:
|
|
||||||
case 11025:
|
|
||||||
case 22050:
|
|
||||||
case 44100:
|
|
||||||
clk = 12000000;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = snd_soc_dai_set_sysclk(codec_dai, SSM2602_SYSCLK, clk,
|
|
||||||
SND_SOC_CLOCK_IN);
|
SND_SOC_CLOCK_IN);
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct snd_soc_ops bf5xx_ssm2602_ops = {
|
|
||||||
.hw_params = bf5xx_ssm2602_hw_params,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* CODEC is master for BCLK and LRC in this configuration. */
|
/* CODEC is master for BCLK and LRC in this configuration. */
|
||||||
#define BF5XX_SSM2602_DAIFMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | \
|
#define BF5XX_SSM2602_DAIFMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | \
|
||||||
SND_SOC_DAIFMT_CBM_CFM)
|
SND_SOC_DAIFMT_CBM_CFM)
|
||||||
@ -98,7 +69,7 @@ static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = {
|
|||||||
.codec_dai_name = "ssm2602-hifi",
|
.codec_dai_name = "ssm2602-hifi",
|
||||||
.platform_name = "bfin-i2s-pcm-audio",
|
.platform_name = "bfin-i2s-pcm-audio",
|
||||||
.codec_name = "ssm2602.0-001b",
|
.codec_name = "ssm2602.0-001b",
|
||||||
.ops = &bf5xx_ssm2602_ops,
|
.init = bf5xx_ssm2602_dai_init,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "ssm2602",
|
.name = "ssm2602",
|
||||||
@ -107,7 +78,7 @@ static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = {
|
|||||||
.codec_dai_name = "ssm2602-hifi",
|
.codec_dai_name = "ssm2602-hifi",
|
||||||
.platform_name = "bfin-i2s-pcm-audio",
|
.platform_name = "bfin-i2s-pcm-audio",
|
||||||
.codec_name = "ssm2602.0-001b",
|
.codec_name = "ssm2602.0-001b",
|
||||||
.ops = &bf5xx_ssm2602_ops,
|
.init = bf5xx_ssm2602_dai_init,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user