ASoC: rockchip: multicodecs: fix hang suspend with acodec and vad

There is only one snd_soc_card instance, the parameters that
include card name are overwritten, so that the DUT will be
hung during suspend that dues to snd_power_wait enter twice
because it find the incorrect node name "/vad-sound":

[   14.129501] snd_power_wait, state: 0x0000, np name: /vad-sound
...
[   14.133063] snd_power_wait, state: 0x0300, np name: /vad-sound

Then the "rockchip,rk3308-vad" has been off (SNDRV_CTL_POWER_D3 0x0300),
and enter endless loop in snd_power_wait().

Therefore, we need create independent snd_soc_cards
for multi-codecs, and find the corrent card name
during suspend:

[    8.939576] snd_power_wait, state: 0x0000, card name: /vad-sound
...
[    8.941472] snd_power_wait, state: 0x0000, card name: /acodec-sound

Change-Id: Id30e25eaa4bf5c39284e32e772dca2e9c3cb96b1
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
This commit is contained in:
Xing Zheng
2018-06-05 21:32:00 +08:00
committed by Tao Huang
parent 671409fa78
commit 1461253dc2

View File

@@ -36,6 +36,7 @@
#define DEFAULT_MCLK_FS 256
struct multicodecs_data {
struct snd_soc_card snd_card;
unsigned int mclk_fs;
bool codec_hp_det;
};
@@ -104,18 +105,11 @@ static struct snd_soc_dai_link rk_dailink = {
SND_SOC_DAIFMT_CBS_CFS,
};
static struct snd_soc_card snd_soc_card_rk = {
.name = "rk-multicodecs-sound",
.dai_link = &rk_dailink,
.num_links = 1,
.num_aux_devs = 0,
};
static int rk_multicodecs_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = &snd_soc_card_rk;
struct snd_soc_card *card;
struct device_node *np = pdev->dev.of_node;
struct snd_soc_dai_link *link = card->dai_link;
struct snd_soc_dai_link *link;
struct snd_soc_dai_link_component *codecs;
struct multicodecs_data *mc_data;
struct of_phandle_args args;
@@ -124,6 +118,11 @@ static int rk_multicodecs_probe(struct platform_device *pdev)
int count;
int ret = 0, i = 0, idx = 0;
mc_data = devm_kzalloc(&pdev->dev, sizeof(*mc_data), GFP_KERNEL);
if (!mc_data)
return -ENOMEM;
card = &mc_data->snd_card;
card->dev = &pdev->dev;
/* Parse the card name from DT */
@@ -131,9 +130,10 @@ static int rk_multicodecs_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
mc_data = devm_kzalloc(&pdev->dev, sizeof(*mc_data), GFP_KERNEL);
if (!mc_data)
return -ENOMEM;
link = &rk_dailink;
card->dai_link = &rk_dailink;
card->num_links = 1;
card->num_aux_devs = 0;
count = of_count_phandle_with_args(np, "rockchip,codec", NULL);
if (count < 0 || count > MAX_CODECS)