diff options
author | Xing Zheng <zhengxing@rock-chips.com> | 2016-08-19 09:56:12 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-08-19 11:23:42 -0400 |
commit | e5abe959549ca267d2f6c7b0df1f74a0d8deab40 (patch) | |
tree | 2fc0693c19367f4d38802c652d86ba754795b501 | |
parent | c6eac8a36a845e52ba520060a807044964ad9de5 (diff) |
ASoC: rockchip: Add support rt5514 dsp summy dailink
This patch can attach automaticlly rt5514 spi DAI with driver name "rt5514"
in the snd_soc_find_dai process. Turn this feature on, we can enable the
voice wake up via rt5514 dsp for RK3399 Gru Boards.
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/rockchip/Kconfig | 1 | ||||
-rw-r--r-- | sound/soc/rockchip/rk3399_gru_sound.c | 39 |
2 files changed, 39 insertions, 1 deletions
diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig index 6d3903284a07..d82d763d4854 100644 --- a/sound/soc/rockchip/Kconfig +++ b/sound/soc/rockchip/Kconfig | |||
@@ -49,6 +49,7 @@ config SND_SOC_RK3399_GRU_SOUND | |||
49 | select SND_SOC_MAX98357A | 49 | select SND_SOC_MAX98357A |
50 | select SND_SOC_RT5514 | 50 | select SND_SOC_RT5514 |
51 | select SND_SOC_DA7219 | 51 | select SND_SOC_DA7219 |
52 | select SND_SOC_RT5514_SPI | ||
52 | help | 53 | help |
53 | Say Y or M here if you want to add support multiple codecs for SoC | 54 | Say Y or M here if you want to add support multiple codecs for SoC |
54 | audio on Rockchip RK3399 GRU boards. | 55 | audio on Rockchip RK3399 GRU boards. |
diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index 9933703f7d44..164b6da4f2cf 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c | |||
@@ -230,8 +230,11 @@ enum { | |||
230 | DAILINK_MAX98357A, | 230 | DAILINK_MAX98357A, |
231 | DAILINK_RT5514, | 231 | DAILINK_RT5514, |
232 | DAILINK_DA7219, | 232 | DAILINK_DA7219, |
233 | DAILINK_RT5514_DSP, | ||
233 | }; | 234 | }; |
234 | 235 | ||
236 | #define DAILINK_ENTITIES (DAILINK_DA7219 + 1) | ||
237 | |||
235 | static struct snd_soc_dai_link rockchip_dailinks[] = { | 238 | static struct snd_soc_dai_link rockchip_dailinks[] = { |
236 | [DAILINK_MAX98357A] = { | 239 | [DAILINK_MAX98357A] = { |
237 | .name = "MAX98357A", | 240 | .name = "MAX98357A", |
@@ -261,6 +264,13 @@ static struct snd_soc_dai_link rockchip_dailinks[] = { | |||
261 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | 264 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
262 | SND_SOC_DAIFMT_CBS_CFS, | 265 | SND_SOC_DAIFMT_CBS_CFS, |
263 | }, | 266 | }, |
267 | /* RT5514 DSP for voice wakeup via spi bus */ | ||
268 | [DAILINK_RT5514_DSP] = { | ||
269 | .name = "RT5514 DSP", | ||
270 | .stream_name = "Wake on Voice", | ||
271 | .codec_name = "snd-soc-dummy", | ||
272 | .codec_dai_name = "snd-soc-dummy-dai", | ||
273 | }, | ||
264 | }; | 274 | }; |
265 | 275 | ||
266 | static struct snd_soc_card rockchip_sound_card = { | 276 | static struct snd_soc_card rockchip_sound_card = { |
@@ -276,10 +286,17 @@ static struct snd_soc_card rockchip_sound_card = { | |||
276 | .num_controls = ARRAY_SIZE(rockchip_controls), | 286 | .num_controls = ARRAY_SIZE(rockchip_controls), |
277 | }; | 287 | }; |
278 | 288 | ||
289 | static int rockchip_sound_match_stub(struct device *dev, void *data) | ||
290 | { | ||
291 | return 1; | ||
292 | } | ||
293 | |||
279 | static int rockchip_sound_probe(struct platform_device *pdev) | 294 | static int rockchip_sound_probe(struct platform_device *pdev) |
280 | { | 295 | { |
281 | struct snd_soc_card *card = &rockchip_sound_card; | 296 | struct snd_soc_card *card = &rockchip_sound_card; |
282 | struct device_node *cpu_node; | 297 | struct device_node *cpu_node; |
298 | struct device *dev; | ||
299 | struct device_driver *drv; | ||
283 | int i, ret; | 300 | int i, ret; |
284 | 301 | ||
285 | cpu_node = of_parse_phandle(pdev->dev.of_node, "rockchip,cpu", 0); | 302 | cpu_node = of_parse_phandle(pdev->dev.of_node, "rockchip,cpu", 0); |
@@ -288,7 +305,7 @@ static int rockchip_sound_probe(struct platform_device *pdev) | |||
288 | return -EINVAL; | 305 | return -EINVAL; |
289 | } | 306 | } |
290 | 307 | ||
291 | for (i = 0; i < card->num_links; i++) { | 308 | for (i = 0; i < DAILINK_ENTITIES; i++) { |
292 | rockchip_dailinks[i].platform_of_node = cpu_node; | 309 | rockchip_dailinks[i].platform_of_node = cpu_node; |
293 | rockchip_dailinks[i].cpu_of_node = cpu_node; | 310 | rockchip_dailinks[i].cpu_of_node = cpu_node; |
294 | 311 | ||
@@ -301,6 +318,26 @@ static int rockchip_sound_probe(struct platform_device *pdev) | |||
301 | } | 318 | } |
302 | } | 319 | } |
303 | 320 | ||
321 | /** | ||
322 | * To acquire the spi driver of the rt5514 and set the dai-links names | ||
323 | * for soc_bind_dai_link | ||
324 | */ | ||
325 | drv = driver_find("rt5514", &spi_bus_type); | ||
326 | if (!drv) { | ||
327 | dev_err(&pdev->dev, "Can not find the rt5514 driver at the spi bus\n"); | ||
328 | return -EINVAL; | ||
329 | } | ||
330 | |||
331 | dev = driver_find_device(drv, NULL, NULL, rockchip_sound_match_stub); | ||
332 | if (!dev) { | ||
333 | dev_err(&pdev->dev, "Can not find the rt5514 device\n"); | ||
334 | return -ENODEV; | ||
335 | } | ||
336 | |||
337 | rockchip_dailinks[DAILINK_RT5514_DSP].cpu_name = kstrdup_const(dev_name(dev), GFP_KERNEL); | ||
338 | rockchip_dailinks[DAILINK_RT5514_DSP].cpu_dai_name = kstrdup_const(dev_name(dev), GFP_KERNEL); | ||
339 | rockchip_dailinks[DAILINK_RT5514_DSP].platform_name = kstrdup_const(dev_name(dev), GFP_KERNEL); | ||
340 | |||
304 | card->dev = &pdev->dev; | 341 | card->dev = &pdev->dev; |
305 | platform_set_drvdata(pdev, card); | 342 | platform_set_drvdata(pdev, card); |
306 | 343 | ||