From c3ff89a2112e11f1def1f7bd31e8f5ab88e56145 Mon Sep 17 00:00:00 2001 From: Shunhua Lan Date: Sat, 13 Apr 2024 17:06:05 +0800 Subject: [PATCH] ASoC: rockchip: sai: add sai wait time init Change-Id: Ia10d66b67968d092c5d2903334b29078f65c8664 Signed-off-by: Shunhua Lan --- sound/soc/rockchip/rockchip_sai.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sound/soc/rockchip/rockchip_sai.c b/sound/soc/rockchip/rockchip_sai.c index 0dc77b2b5f21..d4245b00f3f4 100644 --- a/sound/soc/rockchip/rockchip_sai.c +++ b/sound/soc/rockchip/rockchip_sai.c @@ -1524,6 +1524,22 @@ static const struct snd_dlp_config dconfig = { .get_fifo_count = rockchip_sai_get_fifo_count, }; +static int rockchip_sai_wait_time_init(struct rk_sai_dev *sai) +{ + unsigned int wait_time; + + if (!device_property_read_u32(sai->dev, "rockchip,sai-tx-wait-time-ms", &wait_time)) { + dev_info(sai->dev, "Init TX wait-time-ms: %d\n", wait_time); + sai->wait_time[SNDRV_PCM_STREAM_PLAYBACK] = wait_time; + } + + if (!device_property_read_u32(sai->dev, "rockchip,sai-rx-wait-time-ms", &wait_time)) { + dev_info(sai->dev, "Init RX wait-time-ms: %d\n", wait_time); + sai->wait_time[SNDRV_PCM_STREAM_CAPTURE] = wait_time; + } + return 0; +} + static int rockchip_sai_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; @@ -1543,6 +1559,8 @@ static int rockchip_sai_probe(struct platform_device *pdev) sai->is_master_mode = true; dev_set_drvdata(&pdev->dev, sai); + rockchip_sai_wait_time_init(sai); + sai->rst_h = devm_reset_control_get_optional_exclusive(&pdev->dev, "h"); if (IS_ERR(sai->rst_h)) return PTR_ERR(sai->rst_h);