From 4f4d129d68580ea0143f848038ab65da5d779e2b Mon Sep 17 00:00:00 2001 From: Xing Zheng Date: Thu, 26 Jul 2018 15:54:51 +0800 Subject: [PATCH] ASoC: rk3308_codec: add support 'rockchip,delay-start-play-ms' property It may be that many amplifiers have a long startup delay. If the playback is too early before the amplifier is turned on and stable, it may cause loss of audio data. Therefore, we need to delay playback according to different amplifier performance. Change-Id: I7d54f89217df560a68c080e82313eb2399d44b0a Signed-off-by: Xing Zheng --- sound/soc/codecs/rk3308_codec.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c index fb92c353599e..9894d816b303 100644 --- a/sound/soc/codecs/rk3308_codec.c +++ b/sound/soc/codecs/rk3308_codec.c @@ -149,6 +149,7 @@ struct rk3308_codec_priv { u32 i2s_sdis[ADC_LR_GROUP_MAX]; u32 to_i2s_grps; u32 delay_loopback_handle_ms; + u32 delay_start_play_ms; int which_i2s; int irq; int adc_grp0_using_linein; @@ -1001,6 +1002,9 @@ static int rk3308_mute_stream(struct snd_soc_dai *dai, int mute, int stream) rk3308_speaker_ctl(rk3308, 1); else if (rk3308->dac_output == DAC_HPOUT) rk3308_headphone_ctl(rk3308, 1); + + if (rk3308->delay_start_play_ms) + msleep(rk3308->delay_start_play_ms); #endif for (dgain = 0x7; dgain >= 0x2; dgain--) { /* @@ -3830,6 +3834,10 @@ static int rk3308_platform_probe(struct platform_device *pdev) ret = of_property_read_u32(np, "rockchip,delay-loopback-handle-ms", &rk3308->delay_loopback_handle_ms); + rk3308->delay_start_play_ms = 0; + ret = of_property_read_u32(np, "rockchip,delay-start-play-ms", + &rk3308->delay_start_play_ms); + rk3308->loopback_grp = NOT_USED; ret = of_property_read_u32(np, "rockchip,loopback-grp", &rk3308->loopback_grp);