diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-04-25 05:34:54 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-25 06:19:31 -0400 |
commit | d9ca8e76f3cdbd86032808aa1af237b8a3d99eac (patch) | |
tree | c2f97c53247c930d0d72e2d072dec8e59bc906ce /sound/soc/blackfin | |
parent | e05854ddaa012f3369884acf61ec9953285404b4 (diff) |
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>
Diffstat (limited to 'sound/soc/blackfin')
-rw-r--r-- | sound/soc/blackfin/bf5xx-ssm2602.c | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/sound/soc/blackfin/bf5xx-ssm2602.c b/sound/soc/blackfin/bf5xx-ssm2602.c index df3ac73f8778..911edbab1345 100644 --- a/sound/soc/blackfin/bf5xx-ssm2602.c +++ b/sound/soc/blackfin/bf5xx-ssm2602.c | |||
@@ -44,16 +44,8 @@ | |||
44 | 44 | ||
45 | static struct snd_soc_card bf5xx_ssm2602; | 45 | static struct snd_soc_card bf5xx_ssm2602; |
46 | 46 | ||
47 | static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream, | 47 | static int bf5xx_ssm2602_dai_init(struct snd_soc_pcm_runtime *rtd) |
48 | struct snd_pcm_hw_params *params) | ||
49 | { | 48 | { |
50 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
51 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
52 | unsigned int clk = 0; | ||
53 | int ret = 0; | ||
54 | |||
55 | pr_debug("%s rate %d format %x\n", __func__, params_rate(params), | ||
56 | params_format(params)); | ||
57 | /* | 49 | /* |
58 | * If you are using a crystal source which frequency is not 12MHz | 50 | * If you are using a crystal source which frequency is not 12MHz |
59 | * then modify the below case statement with frequency of the crystal. | 51 | * 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, | |||
61 | * If you are using the SPORT to generate clocking then this is | 53 | * If you are using the SPORT to generate clocking then this is |
62 | * where to do it. | 54 | * where to do it. |
63 | */ | 55 | */ |
64 | 56 | return snd_soc_dai_set_sysclk(rtd->codec_dai, SSM2602_SYSCLK, 12000000, | |
65 | switch (params_rate(params)) { | ||
66 | case 8000: | ||
67 | case 16000: | ||
68 | case 48000: | ||
69 | case 96000: | ||
70 | case 11025: | ||
71 | case 22050: | ||
72 | case 44100: | ||
73 | clk = 12000000; | ||
74 | break; | ||
75 | } | ||
76 | |||
77 | ret = snd_soc_dai_set_sysclk(codec_dai, SSM2602_SYSCLK, clk, | ||
78 | SND_SOC_CLOCK_IN); | 57 | SND_SOC_CLOCK_IN); |
79 | if (ret < 0) | ||
80 | return ret; | ||
81 | |||
82 | return 0; | ||
83 | } | 58 | } |
84 | 59 | ||
85 | static struct snd_soc_ops bf5xx_ssm2602_ops = { | ||
86 | .hw_params = bf5xx_ssm2602_hw_params, | ||
87 | }; | ||
88 | |||
89 | /* CODEC is master for BCLK and LRC in this configuration. */ | 60 | /* CODEC is master for BCLK and LRC in this configuration. */ |
90 | #define BF5XX_SSM2602_DAIFMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | \ | 61 | #define BF5XX_SSM2602_DAIFMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | \ |
91 | SND_SOC_DAIFMT_CBM_CFM) | 62 | SND_SOC_DAIFMT_CBM_CFM) |
@@ -98,7 +69,7 @@ static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = { | |||
98 | .codec_dai_name = "ssm2602-hifi", | 69 | .codec_dai_name = "ssm2602-hifi", |
99 | .platform_name = "bfin-i2s-pcm-audio", | 70 | .platform_name = "bfin-i2s-pcm-audio", |
100 | .codec_name = "ssm2602.0-001b", | 71 | .codec_name = "ssm2602.0-001b", |
101 | .ops = &bf5xx_ssm2602_ops, | 72 | .init = bf5xx_ssm2602_dai_init, |
102 | }, | 73 | }, |
103 | { | 74 | { |
104 | .name = "ssm2602", | 75 | .name = "ssm2602", |
@@ -107,7 +78,7 @@ static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = { | |||
107 | .codec_dai_name = "ssm2602-hifi", | 78 | .codec_dai_name = "ssm2602-hifi", |
108 | .platform_name = "bfin-i2s-pcm-audio", | 79 | .platform_name = "bfin-i2s-pcm-audio", |
109 | .codec_name = "ssm2602.0-001b", | 80 | .codec_name = "ssm2602.0-001b", |
110 | .ops = &bf5xx_ssm2602_ops, | 81 | .init = bf5xx_ssm2602_dai_init, |
111 | }, | 82 | }, |
112 | }; | 83 | }; |
113 | 84 | ||