Commit Graph

19 Commits

Author SHA1 Message Date
Douglas Anderson
8eae6c2585 ASoC: rockchip: Allocate enough memory so we don't overflow routes
In the recent commit d9f9c167ed ("ASoC: rockchip: Init dapm routes
dynamically") we improperly allocated memory for the card->dapm_routes
causing us to overflow the allocation on every boot.  Oops.

Let's allocate the correct amount of memory.  We'll also add a check
to make sure that we don't overrun memory even if we encounter some
sort of weird device tree.

Fixes: d9f9c167ed ("ASoC: rockchip: Init dapm routes dynamically")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-10-04 11:30:17 +01:00
Jeffy Chen
7e0dc9aeae ASoC: rockchip: Use bus_type to distinguish rt5514 dsp from rt5514 codec
Currently rt5514 dsp and rt5514 codec are sharing the same compatible.
Use bus_type to distinguish rt5514 dsp from rt5514 codec.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-09-19 14:12:56 +01:00
Jeffy Chen
d9f9c167ed ASoC: rockchip: Init dapm routes dynamically
Currently we are using a fixed list of dapm routes.

Init dapm routes dynamically when parsing dailinks, since we are
supporting optional codecs.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-09-19 14:12:56 +01:00
Mark Brown
e9331ee9b1 Linux 4.14-rc1
-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJZvaoiAAoJEHm+PkMAQRiGuJYH/RGTTuKgmKOVwJOE+qHh+m5n
 sNpCCp7kxZq+3wyE9Ze6ea0Qku8OfT8Qy86Nrydg216P/eK8B7TL63mx4mLvLs6+
 xyTupMBcZ596uREcPXkHFMwQb0tfmAjUikuQ5Oh/iNjdBAXFEjJJyj7q9sNXUyUj
 y0mIXliay47IOT7r1YIZD9/LRpBnjZYfqKI1ZzmBe0xI2UARutnhAIhvQ8fkkAAH
 24GqLnSoGkp2C9hqPut8RoS8tGpZ1cDShlq5IwayL4aGD3s46I6wXNF7s8ByLDaD
 i14EeNCUntLOdA5Z+LJzX9+MhElRbqbcLwExdIcHi3yQGRUZqBKXmOG9Bm2ZdtQ=
 =yCOD
 -----END PGP SIGNATURE-----

Merge tag 'v4.14-rc1' into asoc-rockchip

Linux 4.14-rc1
2017-09-19 14:12:47 +01:00
Jeffy Chen
e7251484f3 ASoC: rockchip: Add dapm route for HDMI
Add dapm route for DP codec.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-09-19 13:26:48 +01:00
Jeffy Chen
cc9fee8e1a ASoC: rockchip: Add dapm route for DMic
Add dapm route for DMIC codec.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-09-19 13:26:45 +01:00
Jeffy Chen
1fe165b7e9 ASoC: rockchip: constify snd_soc_ops structures
Add const to dp/dmic snd_soc_ops.

Fixes: 626d84db64 (ASoC: rockchip: Add support for DMIC codec)
Fixes: 3313faf105 (ASoC: rockchip: Add support for DP codec)
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-30 16:12:53 +01:00
Jeffy Chen
626d84db64 ASoC: rockchip: Add support for DMIC codec
Add support for optional dmic codec.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-29 20:12:01 +01:00
Jeffy Chen
3313faf105 ASoC: rockchip: Add support for DP codec
Add support for optional cdn dp codec.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-29 20:09:46 +01:00
Jeffy Chen
0d52954ffe ASoC: rockchip: Parse dai links from dts
Refactor rockchip_sound_probe, parse dai links from dts instead of
hard coding them.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-29 20:09:10 +01:00
Jeffy Chen
72cfb0f20c ASoC: rockchip: Use codec of_node and dai_name for rt5514 dsp
Currently we are using codec name for rt5514 dsp dai link, use codec
of_node instead.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-29 20:08:13 +01:00
Jeffy Chen
f628c4ed3d ASoC: rockchip: Correct 'dmic-delay' property name
The 'dmic-delay' property name is different with the dt-binding.

So correct it with 'dmic-wakeup-delay-ms'.

Fixes: 3a6f9dce61 (ASoC: rk3399_gru_sound: fix recording pop at first attempt)
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-22 17:20:32 +01:00
Donglin Peng
dc94d245a5 ASoC: rockchip: Remove unnecessary function call
First of all,the address of pdev->dev is assigned to card->dev,then
the function platform_set_drvdata copies the value the variable card
to pdev->dev.driver_data, but when calling snd_soc_register_card,the
function dev_set_drvdata(card->dev, card) will also do the same copy
operation,so i think that the former copy operation can be removed.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 17:13:20 +01:00
Julia Lawall
705e9994a4 ASoC: rockchip: constify snd_soc_ops structures
Check for snd_soc_ops structures that are only stored in the ops field of a
snd_soc_dai_link structure.  This field is declared const, so snd_soc_ops
structures that have this property can be declared as const also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct snd_soc_ops i@p = { ... };

@ok1@
identifier r.i;
struct snd_soc_dai_link e;
position p;
@@
e.ops = &i@p;

@ok2@
identifier r.i, e;
position p;
@@
struct snd_soc_dai_link e[] = { ..., { .ops = &i@p, }, ..., };

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct snd_soc_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct snd_soc_ops i = { ... };
// </smpl>

The effect on the layout of the .o files is shown by the following output
of the size command, first before then after the transformation:

   text    data     bss     dec     hex filename
   5027    2488     416    7931    1efb sound/soc/rockchip/rk3399_gru_sound.o
   5219    2312     416    7947    1f0b sound/soc/rockchip/rk3399_gru_sound.o

   text    data     bss     dec     hex filename
   3499    1648     384    5531    159b sound/soc/rockchip/rockchip_max98090.o
   3563    1584     384    5531    159b sound/soc/rockchip/rockchip_max98090.o

   text    data     bss     dec     hex filename
   3455    1536     384    5375    14ff sound/soc/rockchip/rockchip_rt5645.o
   3519    1480     384    5383    1507 sound/soc/rockchip/rockchip_rt5645.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-24 18:33:17 +01:00
Wei Yongjun
818f768319 ASoC: rk3399_gru_sound: Fix non static symbol warning
Fixes the following sparse warning:

sound/soc/rockchip/rk3399_gru_sound.c:41:14: warning:
 symbol 'rt5514_dmic_delay' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-24 18:28:22 +01:00
Wonjoon Lee
3a6f9dce61 ASoC: rk3399_gru_sound: fix recording pop at first attempt
Pop happens when mclk applied but dmic's own boot-time
Specify dmic delay times in dt to make sure
clocks are ready earlier than dmic working

Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-24 19:11:04 +01:00
Cheng-Yi Chiang
22b93eaf55 ASoC: rockchip: Support headset button function on rk3399
Set the mapping between button and media key event.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-16 11:53:16 +01:00
Xing Zheng
e5abe95954 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>
2016-08-19 16:23:42 +01:00
Xing Zheng
c6eac8a36a ASoC: rockchip: Add machine driver for RK3399 GRU Boards
Because we need to support the multiple codecs (MAX98357A/RT5514/DA7219)
on the RK3399 GRU boards, this patch can help us to support these codecs.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08 11:55:10 +01:00