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 <zhengxing@rock-chips.com>
This commit is contained in:
Xing Zheng 2018-07-26 15:54:51 +08:00 committed by Tao Huang
parent d6f0e7b388
commit 4f4d129d68

View File

@ -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);