Commit efb736fb authored by Samuel Holland's avatar Samuel Holland Committed by Mark Brown

ASoC: sun8i-codec: Attach the bus clock to the regmap

When attached to the regmap, the bus clock is automatically enabled as
needed to access device registers. This avoids needing code to manage it
separately in the driver.
Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
Acked-by: default avatarMaxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/20200831034852.18841-9-samuel@sholland.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f30ef55c
...@@ -94,7 +94,6 @@ struct sun8i_codec_quirks { ...@@ -94,7 +94,6 @@ struct sun8i_codec_quirks {
struct sun8i_codec { struct sun8i_codec {
struct regmap *regmap; struct regmap *regmap;
struct clk *clk_module; struct clk *clk_module;
struct clk *clk_bus;
const struct sun8i_codec_quirks *quirks; const struct sun8i_codec_quirks *quirks;
}; };
...@@ -109,12 +108,6 @@ static int sun8i_codec_runtime_resume(struct device *dev) ...@@ -109,12 +108,6 @@ static int sun8i_codec_runtime_resume(struct device *dev)
return ret; return ret;
} }
ret = clk_prepare_enable(scodec->clk_bus);
if (ret) {
dev_err(dev, "Failed to enable the bus clock\n");
goto err_disable_modclk;
}
regcache_cache_only(scodec->regmap, false); regcache_cache_only(scodec->regmap, false);
ret = regcache_sync(scodec->regmap); ret = regcache_sync(scodec->regmap);
...@@ -126,9 +119,6 @@ static int sun8i_codec_runtime_resume(struct device *dev) ...@@ -126,9 +119,6 @@ static int sun8i_codec_runtime_resume(struct device *dev)
return 0; return 0;
err_disable_clk: err_disable_clk:
clk_disable_unprepare(scodec->clk_bus);
err_disable_modclk:
clk_disable_unprepare(scodec->clk_module); clk_disable_unprepare(scodec->clk_module);
return ret; return ret;
...@@ -142,7 +132,6 @@ static int sun8i_codec_runtime_suspend(struct device *dev) ...@@ -142,7 +132,6 @@ static int sun8i_codec_runtime_suspend(struct device *dev)
regcache_mark_dirty(scodec->regmap); regcache_mark_dirty(scodec->regmap);
clk_disable_unprepare(scodec->clk_module); clk_disable_unprepare(scodec->clk_module);
clk_disable_unprepare(scodec->clk_bus);
return 0; return 0;
} }
...@@ -612,20 +601,14 @@ static int sun8i_codec_probe(struct platform_device *pdev) ...@@ -612,20 +601,14 @@ static int sun8i_codec_probe(struct platform_device *pdev)
return PTR_ERR(scodec->clk_module); return PTR_ERR(scodec->clk_module);
} }
scodec->clk_bus = devm_clk_get(&pdev->dev, "bus");
if (IS_ERR(scodec->clk_bus)) {
dev_err(&pdev->dev, "Failed to get the bus clock\n");
return PTR_ERR(scodec->clk_bus);
}
base = devm_platform_ioremap_resource(pdev, 0); base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base)) { if (IS_ERR(base)) {
dev_err(&pdev->dev, "Failed to map the registers\n"); dev_err(&pdev->dev, "Failed to map the registers\n");
return PTR_ERR(base); return PTR_ERR(base);
} }
scodec->regmap = devm_regmap_init_mmio(&pdev->dev, base, scodec->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "bus", base,
&sun8i_codec_regmap_config); &sun8i_codec_regmap_config);
if (IS_ERR(scodec->regmap)) { if (IS_ERR(scodec->regmap)) {
dev_err(&pdev->dev, "Failed to create our regmap\n"); dev_err(&pdev->dev, "Failed to create our regmap\n");
return PTR_ERR(scodec->regmap); return PTR_ERR(scodec->regmap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment