* [PATCH] remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators
@ 2022-07-13 15:28 Abel Vesa
2022-07-13 16:45 ` Manivannan Sadhasivam
2022-07-18 22:59 ` (subset) " Bjorn Andersson
0 siblings, 2 replies; 3+ messages in thread
From: Abel Vesa @ 2022-07-13 15:28 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Mathieu Poirier
Cc: linux-arm-msm, linux-remoteproc, Linux Kernel Mailing List,
Abel Vesa
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>
---
drivers/remoteproc/qcom_q6v5_pas.c | 32 +++++++++++++++++++-----------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
index 6ae39c5653b1..3c3affaff7ac 100644
--- a/drivers/remoteproc/qcom_q6v5_pas.c
+++ b/drivers/remoteproc/qcom_q6v5_pas.c
@@ -185,13 +185,17 @@ static int adsp_start(struct rproc *rproc)
if (ret)
goto disable_xo_clk;
- ret = regulator_enable(adsp->cx_supply);
- if (ret)
- goto disable_aggre2_clk;
+ if (adsp->cx_supply) {
+ ret = regulator_enable(adsp->cx_supply);
+ if (ret)
+ goto disable_aggre2_clk;
+ }
- ret = regulator_enable(adsp->px_supply);
- if (ret)
- goto disable_cx_supply;
+ if (adsp->px_supply) {
+ ret = regulator_enable(adsp->px_supply);
+ if (ret)
+ goto disable_cx_supply;
+ }
ret = qcom_scm_pas_auth_and_reset(adsp->pas_id);
if (ret) {
@@ -212,9 +216,11 @@ static int adsp_start(struct rproc *rproc)
return 0;
disable_px_supply:
- regulator_disable(adsp->px_supply);
+ if (adsp->px_supply)
+ regulator_disable(adsp->px_supply);
disable_cx_supply:
- regulator_disable(adsp->cx_supply);
+ if (adsp->cx_supply)
+ regulator_disable(adsp->cx_supply);
disable_aggre2_clk:
clk_disable_unprepare(adsp->aggre2_clk);
disable_xo_clk:
@@ -231,8 +237,10 @@ static void qcom_pas_handover(struct qcom_q6v5 *q6v5)
{
struct qcom_adsp *adsp = container_of(q6v5, struct qcom_adsp, q6v5);
- regulator_disable(adsp->px_supply);
- regulator_disable(adsp->cx_supply);
+ if (adsp->px_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->xo);
adsp_pds_disable(adsp, adsp->proxy_pds, adsp->proxy_pd_count);
@@ -326,13 +334,13 @@ static int adsp_init_clock(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))
return PTR_ERR(adsp->cx_supply);
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);
}
--
2.34.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators
2022-07-13 15:28 [PATCH] remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators Abel Vesa
@ 2022-07-13 16:45 ` Manivannan Sadhasivam
2022-07-18 22:59 ` (subset) " Bjorn Andersson
1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2022-07-13 16:45 UTC (permalink / raw)
To: Abel Vesa
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Mathieu Poirier,
linux-arm-msm, linux-remoteproc, Linux Kernel Mailing List
On Wed, Jul 13, 2022 at 06:28:35PM +0300, Abel Vesa wrote:
> Use _get_optional as some platforms might not provide the px
> and cx regulators.
But this makes no failure for platforms that really needs these regulators and
not defined in devicetree. But at the same time, the driver should trust
the devicetree anyway and not try to validate it.
So I think this is fine.
> 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>
Thanks,
Mani
> ---
> drivers/remoteproc/qcom_q6v5_pas.c | 32 +++++++++++++++++++-----------
> 1 file changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
> index 6ae39c5653b1..3c3affaff7ac 100644
> --- a/drivers/remoteproc/qcom_q6v5_pas.c
> +++ b/drivers/remoteproc/qcom_q6v5_pas.c
> @@ -185,13 +185,17 @@ static int adsp_start(struct rproc *rproc)
> if (ret)
> goto disable_xo_clk;
>
> - ret = regulator_enable(adsp->cx_supply);
> - if (ret)
> - goto disable_aggre2_clk;
> + if (adsp->cx_supply) {
> + ret = regulator_enable(adsp->cx_supply);
> + if (ret)
> + goto disable_aggre2_clk;
> + }
>
> - ret = regulator_enable(adsp->px_supply);
> - if (ret)
> - goto disable_cx_supply;
> + if (adsp->px_supply) {
> + ret = regulator_enable(adsp->px_supply);
> + if (ret)
> + goto disable_cx_supply;
> + }
>
> ret = qcom_scm_pas_auth_and_reset(adsp->pas_id);
> if (ret) {
> @@ -212,9 +216,11 @@ static int adsp_start(struct rproc *rproc)
> return 0;
>
> disable_px_supply:
> - regulator_disable(adsp->px_supply);
> + if (adsp->px_supply)
> + regulator_disable(adsp->px_supply);
> disable_cx_supply:
> - regulator_disable(adsp->cx_supply);
> + if (adsp->cx_supply)
> + regulator_disable(adsp->cx_supply);
> disable_aggre2_clk:
> clk_disable_unprepare(adsp->aggre2_clk);
> disable_xo_clk:
> @@ -231,8 +237,10 @@ static void qcom_pas_handover(struct qcom_q6v5 *q6v5)
> {
> struct qcom_adsp *adsp = container_of(q6v5, struct qcom_adsp, q6v5);
>
> - regulator_disable(adsp->px_supply);
> - regulator_disable(adsp->cx_supply);
> + if (adsp->px_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->xo);
> adsp_pds_disable(adsp, adsp->proxy_pds, adsp->proxy_pd_count);
> @@ -326,13 +334,13 @@ static int adsp_init_clock(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))
> return PTR_ERR(adsp->cx_supply);
>
> 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);
> }
>
> --
> 2.34.3
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: (subset) [PATCH] remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators
2022-07-13 15:28 [PATCH] remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators Abel Vesa
2022-07-13 16:45 ` Manivannan Sadhasivam
@ 2022-07-18 22:59 ` Bjorn Andersson
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2022-07-18 22:59 UTC (permalink / raw)
To: konrad.dybcio, agross, abel.vesa, mathieu.poirier
Cc: linux-remoteproc, linux-arm-msm, Linux Kernel Mailing List
On Wed, 13 Jul 2022 18:28:35 +0300, Abel Vesa wrote:
> 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
>
> [...]
Applied, thanks!
[1/1] remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators
commit: 726ab322d3541cfd056ac938cd7e2e441dd7779e
Best regards,
--
Bjorn Andersson <bjorn.andersson@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-18 22:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-13 15:28 [PATCH] remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators Abel Vesa
2022-07-13 16:45 ` Manivannan Sadhasivam
2022-07-18 22:59 ` (subset) " Bjorn Andersson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox