aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorCliff Cai <cliff.cai@analog.com>2008-09-27 10:30:15 -0400
committerTakashi Iwai <tiwai@suse.de>2008-10-12 20:16:18 -0400
commit333926803557ee43568ebd9ae17b868d60e77a62 (patch)
tree5f811c1b85a7bac4be1bbbfcd814afb5a1b339df /sound
parent0e77e78410245894e5ebde30dc68ced6daa81bce (diff)
ALSA: ASoC Blackfin: add I2S DAI support for AD73311
Signed-off-by: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/blackfin/bf5xx-i2s.c47
1 files changed, 33 insertions, 14 deletions
diff --git a/sound/soc/blackfin/bf5xx-i2s.c b/sound/soc/blackfin/bf5xx-i2s.c
index 43a4092eeb89..827587f08180 100644
--- a/sound/soc/blackfin/bf5xx-i2s.c
+++ b/sound/soc/blackfin/bf5xx-i2s.c
@@ -70,6 +70,13 @@ static struct sport_param sport_params[2] = {
70 } 70 }
71}; 71};
72 72
73static u16 sport_req[][7] = {
74 { P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
75 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0},
76 { P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
77 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0},
78};
79
73static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, 80static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
74 unsigned int fmt) 81 unsigned int fmt)
75{ 82{
@@ -78,6 +85,14 @@ static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
78 /* interface format:support I2S,slave mode */ 85 /* interface format:support I2S,slave mode */
79 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 86 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
80 case SND_SOC_DAIFMT_I2S: 87 case SND_SOC_DAIFMT_I2S:
88 bf5xx_i2s.tcr1 |= TFSR | TCKFE;
89 bf5xx_i2s.rcr1 |= RFSR | RCKFE;
90 bf5xx_i2s.tcr2 |= TSFSE;
91 bf5xx_i2s.rcr2 |= RSFSE;
92 break;
93 case SND_SOC_DAIFMT_DSP_A:
94 bf5xx_i2s.tcr1 |= TFSR;
95 bf5xx_i2s.rcr1 |= RFSR;
81 break; 96 break;
82 case SND_SOC_DAIFMT_LEFT_J: 97 case SND_SOC_DAIFMT_LEFT_J:
83 ret = -EINVAL; 98 ret = -EINVAL;
@@ -127,14 +142,17 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream,
127 case SNDRV_PCM_FORMAT_S16_LE: 142 case SNDRV_PCM_FORMAT_S16_LE:
128 bf5xx_i2s.tcr2 |= 15; 143 bf5xx_i2s.tcr2 |= 15;
129 bf5xx_i2s.rcr2 |= 15; 144 bf5xx_i2s.rcr2 |= 15;
145 sport_handle->wdsize = 2;
130 break; 146 break;
131 case SNDRV_PCM_FORMAT_S24_LE: 147 case SNDRV_PCM_FORMAT_S24_LE:
132 bf5xx_i2s.tcr2 |= 23; 148 bf5xx_i2s.tcr2 |= 23;
133 bf5xx_i2s.rcr2 |= 23; 149 bf5xx_i2s.rcr2 |= 23;
150 sport_handle->wdsize = 3;
134 break; 151 break;
135 case SNDRV_PCM_FORMAT_S32_LE: 152 case SNDRV_PCM_FORMAT_S32_LE:
136 bf5xx_i2s.tcr2 |= 31; 153 bf5xx_i2s.tcr2 |= 31;
137 bf5xx_i2s.rcr2 |= 31; 154 bf5xx_i2s.rcr2 |= 31;
155 sport_handle->wdsize = 4;
138 break; 156 break;
139 } 157 }
140 158
@@ -145,17 +163,17 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream,
145 * need to configure both of them at the time when the first 163 * need to configure both of them at the time when the first
146 * stream is opened. 164 * stream is opened.
147 * 165 *
148 * CPU DAI format:I2S, slave mode. 166 * CPU DAI:slave mode.
149 */ 167 */
150 ret = sport_config_rx(sport_handle, RFSR | RCKFE, 168 ret = sport_config_rx(sport_handle, bf5xx_i2s.rcr1,
151 RSFSE|bf5xx_i2s.rcr2, 0, 0); 169 bf5xx_i2s.rcr2, 0, 0);
152 if (ret) { 170 if (ret) {
153 pr_err("SPORT is busy!\n"); 171 pr_err("SPORT is busy!\n");
154 return -EBUSY; 172 return -EBUSY;
155 } 173 }
156 174
157 ret = sport_config_tx(sport_handle, TFSR | TCKFE, 175 ret = sport_config_tx(sport_handle, bf5xx_i2s.tcr1,
158 TSFSE|bf5xx_i2s.tcr2, 0, 0); 176 bf5xx_i2s.tcr2, 0, 0);
159 if (ret) { 177 if (ret) {
160 pr_err("SPORT is busy!\n"); 178 pr_err("SPORT is busy!\n");
161 return -EBUSY; 179 return -EBUSY;
@@ -174,13 +192,6 @@ static void bf5xx_i2s_shutdown(struct snd_pcm_substream *substream)
174static int bf5xx_i2s_probe(struct platform_device *pdev, 192static int bf5xx_i2s_probe(struct platform_device *pdev,
175 struct snd_soc_dai *dai) 193 struct snd_soc_dai *dai)
176{ 194{
177 u16 sport_req[][7] = {
178 { P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
179 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0},
180 { P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
181 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0},
182 };
183
184 pr_debug("%s enter\n", __func__); 195 pr_debug("%s enter\n", __func__);
185 if (peripheral_request_list(&sport_req[sport_num][0], "soc-audio")) { 196 if (peripheral_request_list(&sport_req[sport_num][0], "soc-audio")) {
186 pr_err("Requesting Peripherals failed\n"); 197 pr_err("Requesting Peripherals failed\n");
@@ -198,6 +209,13 @@ static int bf5xx_i2s_probe(struct platform_device *pdev,
198 return 0; 209 return 0;
199} 210}
200 211
212static void bf5xx_i2s_remove(struct platform_device *pdev,
213 struct snd_soc_dai *dai)
214{
215 pr_debug("%s enter\n", __func__);
216 peripheral_free_list(&sport_req[sport_num][0]);
217}
218
201#ifdef CONFIG_PM 219#ifdef CONFIG_PM
202static int bf5xx_i2s_suspend(struct platform_device *dev, 220static int bf5xx_i2s_suspend(struct platform_device *dev,
203 struct snd_soc_dai *dai) 221 struct snd_soc_dai *dai)
@@ -263,15 +281,16 @@ struct snd_soc_dai bf5xx_i2s_dai = {
263 .id = 0, 281 .id = 0,
264 .type = SND_SOC_DAI_I2S, 282 .type = SND_SOC_DAI_I2S,
265 .probe = bf5xx_i2s_probe, 283 .probe = bf5xx_i2s_probe,
284 .remove = bf5xx_i2s_remove,
266 .suspend = bf5xx_i2s_suspend, 285 .suspend = bf5xx_i2s_suspend,
267 .resume = bf5xx_i2s_resume, 286 .resume = bf5xx_i2s_resume,
268 .playback = { 287 .playback = {
269 .channels_min = 2, 288 .channels_min = 1,
270 .channels_max = 2, 289 .channels_max = 2,
271 .rates = BF5XX_I2S_RATES, 290 .rates = BF5XX_I2S_RATES,
272 .formats = BF5XX_I2S_FORMATS,}, 291 .formats = BF5XX_I2S_FORMATS,},
273 .capture = { 292 .capture = {
274 .channels_min = 2, 293 .channels_min = 1,
275 .channels_max = 2, 294 .channels_max = 2,
276 .rates = BF5XX_I2S_RATES, 295 .rates = BF5XX_I2S_RATES,
277 .formats = BF5XX_I2S_FORMATS,}, 296 .formats = BF5XX_I2S_FORMATS,},