aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/rockchip
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/rockchip')
-rw-r--r--sound/soc/rockchip/Kconfig3
-rw-r--r--sound/soc/rockchip/Makefile2
-rw-r--r--sound/soc/rockchip/rockchip_i2s.c28
3 files changed, 20 insertions, 13 deletions
diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig
index c196a466eef6..78fc159559b0 100644
--- a/sound/soc/rockchip/Kconfig
+++ b/sound/soc/rockchip/Kconfig
@@ -2,11 +2,10 @@ config SND_SOC_ROCKCHIP
2 tristate "ASoC support for Rockchip" 2 tristate "ASoC support for Rockchip"
3 depends on COMPILE_TEST || ARCH_ROCKCHIP 3 depends on COMPILE_TEST || ARCH_ROCKCHIP
4 select SND_SOC_GENERIC_DMAENGINE_PCM 4 select SND_SOC_GENERIC_DMAENGINE_PCM
5 select SND_ROCKCHIP_I2S
6 help 5 help
7 Say Y or M if you want to add support for codecs attached to 6 Say Y or M if you want to add support for codecs attached to
8 the Rockchip SoCs' Audio interfaces. You will also need to 7 the Rockchip SoCs' Audio interfaces. You will also need to
9 select the audio interfaces to support below. 8 select the audio interfaces to support below.
10 9
11config SND_ROCKCHIP_I2S 10config SND_SOC_ROCKCHIP_I2S
12 tristate 11 tristate
diff --git a/sound/soc/rockchip/Makefile b/sound/soc/rockchip/Makefile
index 1006418e1394..b9219092b47f 100644
--- a/sound/soc/rockchip/Makefile
+++ b/sound/soc/rockchip/Makefile
@@ -1,4 +1,4 @@
1# ROCKCHIP Platform Support 1# ROCKCHIP Platform Support
2snd-soc-i2s-objs := rockchip_i2s.o 2snd-soc-i2s-objs := rockchip_i2s.o
3 3
4obj-$(CONFIG_SND_ROCKCHIP_I2S) += snd-soc-i2s.o 4obj-$(CONFIG_SND_SOC_ROCKCHIP_I2S) += snd-soc-i2s.o
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index fb9e05c9f471..033487c9a164 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -244,16 +244,6 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
244 regmap_update_bits(i2s->regmap, I2S_TXCR, I2S_TXCR_VDW_MASK, val); 244 regmap_update_bits(i2s->regmap, I2S_TXCR, I2S_TXCR_VDW_MASK, val);
245 regmap_update_bits(i2s->regmap, I2S_RXCR, I2S_RXCR_VDW_MASK, val); 245 regmap_update_bits(i2s->regmap, I2S_RXCR, I2S_RXCR_VDW_MASK, val);
246 246
247 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
248 dai->playback_dma_data = &i2s->playback_dma_data;
249 regmap_update_bits(i2s->regmap, I2S_DMACR, I2S_DMACR_TDL_MASK,
250 I2S_DMACR_TDL(1) | I2S_DMACR_TDE_ENABLE);
251 } else {
252 dai->capture_dma_data = &i2s->capture_dma_data;
253 regmap_update_bits(i2s->regmap, I2S_DMACR, I2S_DMACR_RDL_MASK,
254 I2S_DMACR_RDL(1) | I2S_DMACR_RDE_ENABLE);
255 }
256
257 return 0; 247 return 0;
258} 248}
259 249
@@ -301,6 +291,16 @@ static int rockchip_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id,
301 return ret; 291 return ret;
302} 292}
303 293
294static int rockchip_i2s_dai_probe(struct snd_soc_dai *dai)
295{
296 struct rk_i2s_dev *i2s = snd_soc_dai_get_drvdata(dai);
297
298 dai->capture_dma_data = &i2s->capture_dma_data;
299 dai->playback_dma_data = &i2s->playback_dma_data;
300
301 return 0;
302}
303
304static const struct snd_soc_dai_ops rockchip_i2s_dai_ops = { 304static const struct snd_soc_dai_ops rockchip_i2s_dai_ops = {
305 .hw_params = rockchip_i2s_hw_params, 305 .hw_params = rockchip_i2s_hw_params,
306 .set_sysclk = rockchip_i2s_set_sysclk, 306 .set_sysclk = rockchip_i2s_set_sysclk,
@@ -309,7 +309,9 @@ static const struct snd_soc_dai_ops rockchip_i2s_dai_ops = {
309}; 309};
310 310
311static struct snd_soc_dai_driver rockchip_i2s_dai = { 311static struct snd_soc_dai_driver rockchip_i2s_dai = {
312 .probe = rockchip_i2s_dai_probe,
312 .playback = { 313 .playback = {
314 .stream_name = "Playback",
313 .channels_min = 2, 315 .channels_min = 2,
314 .channels_max = 8, 316 .channels_max = 8,
315 .rates = SNDRV_PCM_RATE_8000_192000, 317 .rates = SNDRV_PCM_RATE_8000_192000,
@@ -319,6 +321,7 @@ static struct snd_soc_dai_driver rockchip_i2s_dai = {
319 SNDRV_PCM_FMTBIT_S24_LE), 321 SNDRV_PCM_FMTBIT_S24_LE),
320 }, 322 },
321 .capture = { 323 .capture = {
324 .stream_name = "Capture",
322 .channels_min = 2, 325 .channels_min = 2,
323 .channels_max = 2, 326 .channels_max = 2,
324 .rates = SNDRV_PCM_RATE_8000_192000, 327 .rates = SNDRV_PCM_RATE_8000_192000,
@@ -420,6 +423,11 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
420 dev_err(&pdev->dev, "Can't retrieve i2s bus clock\n"); 423 dev_err(&pdev->dev, "Can't retrieve i2s bus clock\n");
421 return PTR_ERR(i2s->hclk); 424 return PTR_ERR(i2s->hclk);
422 } 425 }
426 ret = clk_prepare_enable(i2s->hclk);
427 if (ret) {
428 dev_err(i2s->dev, "hclock enable failed %d\n", ret);
429 return ret;
430 }
423 431
424 i2s->mclk = devm_clk_get(&pdev->dev, "i2s_clk"); 432 i2s->mclk = devm_clk_get(&pdev->dev, "i2s_clk");
425 if (IS_ERR(i2s->mclk)) { 433 if (IS_ERR(i2s->mclk)) {