From a5f383efa7380989c67ffc0ac67dc4f08dfd4cdf Mon Sep 17 00:00:00 2001 From: Asha T Date: Tue, 11 Jun 2019 12:50:29 +0530 Subject: [PATCH] tegra-alt: i2s: Modified i2s clock handling Renamed i2s clock parent's property name in DT and changed this driver to reflect the same. Sync related clock usage is broken as of now. So DTs have removed sync related entries. Modified driver code to not result in error due to absence of sync clocks Bug 200515690 Change-Id: Ifa32dc35b7fbda23574a576597c9cc9e79b00ada Signed-off-by: Asha T Reviewed-on: https://git-master.nvidia.com/r/2137230 Reviewed-by: Sameer Pujar GVS: Gerrit_Virtual_Submit Reviewed-by: Sharad Gupta Reviewed-by: mobile promotions Tested-by: mobile promotions --- sound/soc/tegra-alt/tegra210_i2s_alt.c | 40 +++++++++++--------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/sound/soc/tegra-alt/tegra210_i2s_alt.c b/sound/soc/tegra-alt/tegra210_i2s_alt.c index 62648c2f..a634d605 100644 --- a/sound/soc/tegra-alt/tegra210_i2s_alt.c +++ b/sound/soc/tegra-alt/tegra210_i2s_alt.c @@ -79,18 +79,18 @@ static int tegra210_i2s_set_clock_rate(struct device *dev, int clock_rate) if (((val & TEGRA210_I2S_CTRL_MASTER_EN_MASK) == TEGRA210_I2S_CTRL_MASTER_EN)) { - ret = clk_set_rate(i2s->clk_i2s_sync, clock_rate); - if (ret) { - dev_err(dev, "Can't set I2S sync clock rate\n"); - return ret; - } - - ret = clk_set_parent(i2s->clk_audio_sync, - i2s->clk_i2s_sync); - if (ret) { - dev_err(dev, - "Can't set parent of i2s audio sync clock\n"); - return ret; + if (!(IS_ERR(i2s->clk_i2s_sync)) && !(IS_ERR(i2s->clk_audio_sync))) { + ret = clk_set_rate(i2s->clk_i2s_sync, clock_rate); + if (ret) { + dev_err(dev, "Can't set I2S sync clock rate\n"); + return ret; + } + ret = clk_set_parent(i2s->clk_audio_sync, + i2s->clk_i2s_sync); + if (ret) { + dev_err(dev, "Can't set parent of i2s audio sync clock\n"); + return ret; + } } ret = clk_set_parent(i2s->clk_i2s, i2s->clk_i2s_source); @@ -1078,20 +1078,14 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev) } i2s->clk_i2s_sync = devm_clk_get(&pdev->dev, "ext_audio_sync"); - if (IS_ERR(i2s->clk_i2s_sync)) { - dev_err(&pdev->dev, "Can't retrieve i2s_sync clock\n"); - ret = PTR_ERR(i2s->clk_i2s_sync); - goto err; - } + if (IS_ERR(i2s->clk_i2s_sync)) + dev_dbg(&pdev->dev, "Can't retrieve i2s_sync clock\n"); i2s->clk_audio_sync = devm_clk_get(&pdev->dev, "audio_sync"); - if (IS_ERR(i2s->clk_audio_sync)) { - dev_err(&pdev->dev, "Can't retrieve audio sync clock\n"); - ret = PTR_ERR(i2s->clk_audio_sync); - goto err; - } + if (IS_ERR(i2s->clk_audio_sync)) + dev_dbg(&pdev->dev, "Can't retrieve audio sync clock\n"); - i2s->clk_i2s_source = devm_clk_get(&pdev->dev, "pll_a_out0"); + i2s->clk_i2s_source = devm_clk_get(&pdev->dev, "i2s_clk_parent"); if (IS_ERR(i2s->clk_i2s_source)) { dev_err(&pdev->dev, "Can't retrieve pll_a_out0 clock\n"); ret = PTR_ERR(i2s->clk_i2s_source);