Skip to content

Commit 6ecfe06

Browse files
committed
remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators
Bugzilla: https://bugzilla.redhat.com/2150444 commit 3f52d11 Author: Abel Vesa <abel.vesa@linaro.org> Date: Wed Jul 13 18:28:35 2022 +0300 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: Abel Vesa <abel.vesa@linaro.org> Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220713152835.3848875-1-abel.vesa@linaro.org Signed-off-by: Eric Chanudet <echanude@redhat.com>
1 parent 103a443 commit 6ecfe06

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

drivers/remoteproc/qcom_q6v5_pas.c

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,17 @@ static int adsp_start(struct rproc *rproc)
206206
if (ret)
207207
goto disable_xo_clk;
208208

209-
ret = regulator_enable(adsp->cx_supply);
210-
if (ret)
211-
goto disable_aggre2_clk;
209+
if (adsp->cx_supply) {
210+
ret = regulator_enable(adsp->cx_supply);
211+
if (ret)
212+
goto disable_aggre2_clk;
213+
}
212214

213-
ret = regulator_enable(adsp->px_supply);
214-
if (ret)
215-
goto disable_cx_supply;
215+
if (adsp->px_supply) {
216+
ret = regulator_enable(adsp->px_supply);
217+
if (ret)
218+
goto disable_cx_supply;
219+
}
216220

217221
ret = qcom_scm_pas_auth_and_reset(adsp->pas_id);
218222
if (ret) {
@@ -233,9 +237,11 @@ static int adsp_start(struct rproc *rproc)
233237
return 0;
234238

235239
disable_px_supply:
236-
regulator_disable(adsp->px_supply);
240+
if (adsp->px_supply)
241+
regulator_disable(adsp->px_supply);
237242
disable_cx_supply:
238-
regulator_disable(adsp->cx_supply);
243+
if (adsp->cx_supply)
244+
regulator_disable(adsp->cx_supply);
239245
disable_aggre2_clk:
240246
clk_disable_unprepare(adsp->aggre2_clk);
241247
disable_xo_clk:
@@ -252,8 +258,10 @@ static void qcom_pas_handover(struct qcom_q6v5 *q6v5)
252258
{
253259
struct qcom_adsp *adsp = container_of(q6v5, struct qcom_adsp, q6v5);
254260

255-
regulator_disable(adsp->px_supply);
256-
regulator_disable(adsp->cx_supply);
261+
if (adsp->px_supply)
262+
regulator_disable(adsp->px_supply);
263+
if (adsp->cx_supply)
264+
regulator_disable(adsp->cx_supply);
257265
clk_disable_unprepare(adsp->aggre2_clk);
258266
clk_disable_unprepare(adsp->xo);
259267
adsp_pds_disable(adsp, adsp->proxy_pds, adsp->proxy_pd_count);
@@ -353,13 +361,13 @@ static int adsp_init_clock(struct qcom_adsp *adsp)
353361

354362
static int adsp_init_regulator(struct qcom_adsp *adsp)
355363
{
356-
adsp->cx_supply = devm_regulator_get(adsp->dev, "cx");
364+
adsp->cx_supply = devm_regulator_get_optional(adsp->dev, "cx");
357365
if (IS_ERR(adsp->cx_supply))
358366
return PTR_ERR(adsp->cx_supply);
359367

360368
regulator_set_load(adsp->cx_supply, 100000);
361369

362-
adsp->px_supply = devm_regulator_get(adsp->dev, "px");
370+
adsp->px_supply = devm_regulator_get_optional(adsp->dev, "px");
363371
return PTR_ERR_OR_ZERO(adsp->px_supply);
364372
}
365373

0 commit comments

Comments
 (0)