Commit 3f52d118 authored by Abel Vesa's avatar Abel Vesa Committed by Bjorn Andersson

remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators

Use _get_optional as some platforms might not provide the px
and cx regulators. This avoids printing the following for each
unavailable regulator:

[    4.350229] qcom_q6v5_pas 5c00000.remoteproc: supply cx not found,
using dummy regulator
[    4.374224] qcom_q6v5_pas 5c00000.remoteproc: supply px not found,
using dummy regulator
Signed-off-by: default avatarAbel Vesa <abel.vesa@linaro.org>
Acked-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220713152835.3848875-1-abel.vesa@linaro.org
parent fd75c2d0
...@@ -206,13 +206,17 @@ static int adsp_start(struct rproc *rproc) ...@@ -206,13 +206,17 @@ static int adsp_start(struct rproc *rproc)
if (ret) if (ret)
goto disable_xo_clk; goto disable_xo_clk;
ret = regulator_enable(adsp->cx_supply); if (adsp->cx_supply) {
if (ret) ret = regulator_enable(adsp->cx_supply);
goto disable_aggre2_clk; if (ret)
goto disable_aggre2_clk;
}
ret = regulator_enable(adsp->px_supply); if (adsp->px_supply) {
if (ret) ret = regulator_enable(adsp->px_supply);
goto disable_cx_supply; if (ret)
goto disable_cx_supply;
}
ret = qcom_scm_pas_auth_and_reset(adsp->pas_id); ret = qcom_scm_pas_auth_and_reset(adsp->pas_id);
if (ret) { if (ret) {
...@@ -233,9 +237,11 @@ static int adsp_start(struct rproc *rproc) ...@@ -233,9 +237,11 @@ static int adsp_start(struct rproc *rproc)
return 0; return 0;
disable_px_supply: disable_px_supply:
regulator_disable(adsp->px_supply); if (adsp->px_supply)
regulator_disable(adsp->px_supply);
disable_cx_supply: disable_cx_supply:
regulator_disable(adsp->cx_supply); if (adsp->cx_supply)
regulator_disable(adsp->cx_supply);
disable_aggre2_clk: disable_aggre2_clk:
clk_disable_unprepare(adsp->aggre2_clk); clk_disable_unprepare(adsp->aggre2_clk);
disable_xo_clk: disable_xo_clk:
...@@ -252,8 +258,10 @@ static void qcom_pas_handover(struct qcom_q6v5 *q6v5) ...@@ -252,8 +258,10 @@ static void qcom_pas_handover(struct qcom_q6v5 *q6v5)
{ {
struct qcom_adsp *adsp = container_of(q6v5, struct qcom_adsp, q6v5); struct qcom_adsp *adsp = container_of(q6v5, struct qcom_adsp, q6v5);
regulator_disable(adsp->px_supply); if (adsp->px_supply)
regulator_disable(adsp->cx_supply); regulator_disable(adsp->px_supply);
if (adsp->cx_supply)
regulator_disable(adsp->cx_supply);
clk_disable_unprepare(adsp->aggre2_clk); clk_disable_unprepare(adsp->aggre2_clk);
clk_disable_unprepare(adsp->xo); clk_disable_unprepare(adsp->xo);
adsp_pds_disable(adsp, adsp->proxy_pds, adsp->proxy_pd_count); adsp_pds_disable(adsp, adsp->proxy_pds, adsp->proxy_pd_count);
...@@ -353,13 +361,13 @@ static int adsp_init_clock(struct qcom_adsp *adsp) ...@@ -353,13 +361,13 @@ static int adsp_init_clock(struct qcom_adsp *adsp)
static int adsp_init_regulator(struct qcom_adsp *adsp) static int adsp_init_regulator(struct qcom_adsp *adsp)
{ {
adsp->cx_supply = devm_regulator_get(adsp->dev, "cx"); adsp->cx_supply = devm_regulator_get_optional(adsp->dev, "cx");
if (IS_ERR(adsp->cx_supply)) if (IS_ERR(adsp->cx_supply))
return PTR_ERR(adsp->cx_supply); return PTR_ERR(adsp->cx_supply);
regulator_set_load(adsp->cx_supply, 100000); regulator_set_load(adsp->cx_supply, 100000);
adsp->px_supply = devm_regulator_get(adsp->dev, "px"); adsp->px_supply = devm_regulator_get_optional(adsp->dev, "px");
return PTR_ERR_OR_ZERO(adsp->px_supply); return PTR_ERR_OR_ZERO(adsp->px_supply);
} }
......
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