ASoC: codecs: rk_codec_digital: Add CLK_I2C handling

Change-Id: Ia4320952d55840d95ac22ae230d3e264f86e62d0
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
This commit is contained in:
Sugar Zhang
2020-11-11 21:55:43 +08:00
committed by Tao Huang
parent 89654b82e2
commit 271b62097e

View File

@@ -35,6 +35,7 @@ struct rk_codec_digital_priv {
struct regmap *regmap;
struct clk *clk_adc;
struct clk *clk_dac;
struct clk *clk_i2c;
struct clk *pclk;
bool pwmout;
struct reset_control *rc;
@@ -607,11 +608,17 @@ static int rk_codec_digital_runtime_resume(struct device *dev)
ret = clk_prepare_enable(rcd->clk_dac);
if (ret)
goto err_clk;
goto err_adc;
ret = clk_prepare_enable(rcd->clk_i2c);
if (ret)
goto err_dac;
return 0;
err_clk:
err_dac:
clk_disable_unprepare(rcd->clk_dac);
err_adc:
clk_disable_unprepare(rcd->clk_adc);
err:
clk_disable_unprepare(rcd->pclk);
@@ -625,6 +632,7 @@ static int rk_codec_digital_runtime_suspend(struct device *dev)
clk_disable_unprepare(rcd->clk_adc);
clk_disable_unprepare(rcd->clk_dac);
clk_disable_unprepare(rcd->clk_i2c);
clk_disable_unprepare(rcd->pclk);
return 0;
@@ -656,6 +664,11 @@ static int rk_codec_digital_platform_probe(struct platform_device *pdev)
if (IS_ERR(rcd->clk_dac))
return PTR_ERR(rcd->clk_dac);
/* optional on some platform */
rcd->clk_i2c = devm_clk_get_optional(&pdev->dev, "i2c");
if (IS_ERR(rcd->clk_i2c))
return PTR_ERR(rcd->clk_i2c);
rcd->pclk = devm_clk_get(&pdev->dev, "pclk");
if (IS_ERR(rcd->pclk))
return PTR_ERR(rcd->pclk);