mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-17 17:26:12 +07:00
ASoC: qcom: lpass-cpu: Move ahbix clk to platform specific function
Ahbix clock is optional clock and not needed for all platforms. Move it to lpass-apq8016/ipq806x as it is not needed for sc7180. Signed-off-by: Rohit kumar <rohitkr@codeaurora.org> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/1597402388-14112-3-git-send-email-rohitkr@codeaurora.org Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
1220f6a76e
commit
a503567d70
@ -185,7 +185,33 @@ static int apq8016_lpass_init(struct platform_device *pdev)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drvdata->ahbix_clk = devm_clk_get(dev, "ahbix-clk");
|
||||||
|
if (IS_ERR(drvdata->ahbix_clk)) {
|
||||||
|
dev_err(dev, "error getting ahbix-clk: %ld\n",
|
||||||
|
PTR_ERR(drvdata->ahbix_clk));
|
||||||
|
ret = PTR_ERR(drvdata->ahbix_clk);
|
||||||
|
goto err_ahbix_clk;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = clk_set_rate(drvdata->ahbix_clk, LPASS_AHBIX_CLOCK_FREQUENCY);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(dev, "error setting rate on ahbix_clk: %d\n", ret);
|
||||||
|
goto err_ahbix_clk;
|
||||||
|
}
|
||||||
|
dev_dbg(dev, "set ahbix_clk rate to %lu\n",
|
||||||
|
clk_get_rate(drvdata->ahbix_clk));
|
||||||
|
|
||||||
|
ret = clk_prepare_enable(drvdata->ahbix_clk);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(dev, "error enabling ahbix_clk: %d\n", ret);
|
||||||
|
goto err_ahbix_clk;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_ahbix_clk:
|
||||||
|
clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int apq8016_lpass_exit(struct platform_device *pdev)
|
static int apq8016_lpass_exit(struct platform_device *pdev)
|
||||||
@ -193,6 +219,7 @@ static int apq8016_lpass_exit(struct platform_device *pdev)
|
|||||||
struct lpass_data *drvdata = platform_get_drvdata(pdev);
|
struct lpass_data *drvdata = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks);
|
clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks);
|
||||||
|
clk_disable_unprepare(drvdata->ahbix_clk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -566,8 +566,13 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
|
|||||||
return PTR_ERR(drvdata->lpaif_map);
|
return PTR_ERR(drvdata->lpaif_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (variant->init)
|
if (variant->init) {
|
||||||
variant->init(pdev);
|
ret = variant->init(pdev);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(dev, "error initializing variant: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < variant->num_dai; i++) {
|
for (i = 0; i < variant->num_dai; i++) {
|
||||||
dai_id = variant->dai_driver[i].id;
|
dai_id = variant->dai_driver[i].id;
|
||||||
@ -594,46 +599,22 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drvdata->ahbix_clk = devm_clk_get(dev, "ahbix-clk");
|
|
||||||
if (IS_ERR(drvdata->ahbix_clk)) {
|
|
||||||
dev_err(dev, "error getting ahbix-clk: %ld\n",
|
|
||||||
PTR_ERR(drvdata->ahbix_clk));
|
|
||||||
return PTR_ERR(drvdata->ahbix_clk);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = clk_set_rate(drvdata->ahbix_clk, LPASS_AHBIX_CLOCK_FREQUENCY);
|
|
||||||
if (ret) {
|
|
||||||
dev_err(dev, "error setting rate on ahbix_clk: %d\n", ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
dev_dbg(dev, "set ahbix_clk rate to %lu\n",
|
|
||||||
clk_get_rate(drvdata->ahbix_clk));
|
|
||||||
|
|
||||||
ret = clk_prepare_enable(drvdata->ahbix_clk);
|
|
||||||
if (ret) {
|
|
||||||
dev_err(dev, "error enabling ahbix_clk: %d\n", ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = devm_snd_soc_register_component(dev,
|
ret = devm_snd_soc_register_component(dev,
|
||||||
&lpass_cpu_comp_driver,
|
&lpass_cpu_comp_driver,
|
||||||
variant->dai_driver,
|
variant->dai_driver,
|
||||||
variant->num_dai);
|
variant->num_dai);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "error registering cpu driver: %d\n", ret);
|
dev_err(dev, "error registering cpu driver: %d\n", ret);
|
||||||
goto err_clk;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = asoc_qcom_lpass_platform_register(pdev);
|
ret = asoc_qcom_lpass_platform_register(pdev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "error registering platform driver: %d\n", ret);
|
dev_err(dev, "error registering platform driver: %d\n", ret);
|
||||||
goto err_clk;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
err:
|
||||||
|
|
||||||
err_clk:
|
|
||||||
clk_disable_unprepare(drvdata->ahbix_clk);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_probe);
|
EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_probe);
|
||||||
@ -645,7 +626,6 @@ int asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev)
|
|||||||
if (drvdata->variant->exit)
|
if (drvdata->variant->exit)
|
||||||
drvdata->variant->exit(pdev);
|
drvdata->variant->exit(pdev);
|
||||||
|
|
||||||
clk_disable_unprepare(drvdata->ahbix_clk);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,47 @@ static struct snd_soc_dai_driver ipq806x_lpass_cpu_dai_driver = {
|
|||||||
.ops = &asoc_qcom_lpass_cpu_dai_ops,
|
.ops = &asoc_qcom_lpass_cpu_dai_ops,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int ipq806x_lpass_init(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct lpass_data *drvdata = platform_get_drvdata(pdev);
|
||||||
|
struct device *dev = &pdev->dev;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
drvdata->ahbix_clk = devm_clk_get(dev, "ahbix-clk");
|
||||||
|
if (IS_ERR(drvdata->ahbix_clk)) {
|
||||||
|
dev_err(dev, "error getting ahbix-clk: %ld\n",
|
||||||
|
PTR_ERR(drvdata->ahbix_clk));
|
||||||
|
ret = PTR_ERR(drvdata->ahbix_clk);
|
||||||
|
goto err_ahbix_clk;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = clk_set_rate(drvdata->ahbix_clk, LPASS_AHBIX_CLOCK_FREQUENCY);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(dev, "error setting rate on ahbix_clk: %d\n", ret);
|
||||||
|
goto err_ahbix_clk;
|
||||||
|
}
|
||||||
|
dev_dbg(dev, "set ahbix_clk rate to %lu\n",
|
||||||
|
clk_get_rate(drvdata->ahbix_clk));
|
||||||
|
|
||||||
|
ret = clk_prepare_enable(drvdata->ahbix_clk);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(dev, "error enabling ahbix_clk: %d\n", ret);
|
||||||
|
goto err_ahbix_clk;
|
||||||
|
}
|
||||||
|
|
||||||
|
err_ahbix_clk:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ipq806x_lpass_exit(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct lpass_data *drvdata = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
|
clk_disable_unprepare(drvdata->ahbix_clk);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int ipq806x_lpass_alloc_dma_channel(struct lpass_data *drvdata, int dir)
|
static int ipq806x_lpass_alloc_dma_channel(struct lpass_data *drvdata, int dir)
|
||||||
{
|
{
|
||||||
if (dir == SNDRV_PCM_STREAM_PLAYBACK)
|
if (dir == SNDRV_PCM_STREAM_PLAYBACK)
|
||||||
@ -90,6 +131,8 @@ static struct lpass_variant ipq806x_data = {
|
|||||||
.dai_bit_clk_names = (const char *[]) {
|
.dai_bit_clk_names = (const char *[]) {
|
||||||
"mi2s-bit-clk",
|
"mi2s-bit-clk",
|
||||||
},
|
},
|
||||||
|
.init = ipq806x_lpass_init,
|
||||||
|
.exit = ipq806x_lpass_exit,
|
||||||
.alloc_dma_channel = ipq806x_lpass_alloc_dma_channel,
|
.alloc_dma_channel = ipq806x_lpass_alloc_dma_channel,
|
||||||
.free_dma_channel = ipq806x_lpass_free_dma_channel,
|
.free_dma_channel = ipq806x_lpass_free_dma_channel,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user