* [PATCH] remoteproc: wcnss: Wait for iris before starting
@ 2018-06-12 16:58 Loic Poulain
2018-06-18 16:50 ` Stephen Boyd
0 siblings, 1 reply; 2+ messages in thread
From: Loic Poulain @ 2018-06-12 16:58 UTC (permalink / raw)
To: bjorn.andersson, ohad; +Cc: linux-remoteproc, linux-arm-msm, Loic Poulain
wcnss_start fails when called by remoteproc before iris probing.
Fix this by adding synchronization/completion on iris assignment.
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
drivers/remoteproc/qcom_wcnss.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c
index b0e07e9..e5fbf91 100644
--- a/drivers/remoteproc/qcom_wcnss.c
+++ b/drivers/remoteproc/qcom_wcnss.c
@@ -86,6 +86,7 @@ struct qcom_wcnss {
struct mutex iris_lock;
struct qcom_iris *iris;
+ struct completion iris_assigned;
struct regulator_bulk_data *vregs;
size_t num_vregs;
@@ -146,6 +147,7 @@ void qcom_wcnss_assign_iris(struct qcom_wcnss *wcnss,
wcnss->iris = iris;
wcnss->use_48mhz_xo = use_48mhz_xo;
+ complete(&wcnss->iris_assigned);
mutex_unlock(&wcnss->iris_lock);
}
@@ -221,6 +223,13 @@ static int wcnss_start(struct rproc *rproc)
struct qcom_wcnss *wcnss = (struct qcom_wcnss *)rproc->priv;
int ret;
+ ret = wait_for_completion_timeout(&wcnss->iris_assigned,
+ msecs_to_jiffies(5000));
+ if (ret == 0) {
+ dev_err(wcnss->dev, "Timeout waiting for iris device\n");
+ return -ENODEV;
+ }
+
mutex_lock(&wcnss->iris_lock);
if (!wcnss->iris) {
dev_err(wcnss->dev, "no iris registered\n");
@@ -496,6 +505,7 @@ static int wcnss_probe(struct platform_device *pdev)
init_completion(&wcnss->start_done);
init_completion(&wcnss->stop_done);
+ init_completion(&wcnss->iris_assigned);
mutex_init(&wcnss->iris_lock);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] remoteproc: wcnss: Wait for iris before starting
2018-06-12 16:58 [PATCH] remoteproc: wcnss: Wait for iris before starting Loic Poulain
@ 2018-06-18 16:50 ` Stephen Boyd
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2018-06-18 16:50 UTC (permalink / raw)
To: Loic Poulain, bjorn.andersson, ohad; +Cc: linux-remoteproc, linux-arm-msm
Quoting Loic Poulain (2018-06-12 09:58:31)
> wcnss_start fails when called by remoteproc before iris probing.
Please add () to functions so we know they're functions and not
variables or something else.
> Fix this by adding synchronization/completion on iris assignment.
>
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
> drivers/remoteproc/qcom_wcnss.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c
> index b0e07e9..e5fbf91 100644
> --- a/drivers/remoteproc/qcom_wcnss.c
> +++ b/drivers/remoteproc/qcom_wcnss.c
> @@ -86,6 +86,7 @@ struct qcom_wcnss {
>
> struct mutex iris_lock;
> struct qcom_iris *iris;
> + struct completion iris_assigned;
>
> struct regulator_bulk_data *vregs;
> size_t num_vregs;
> @@ -146,6 +147,7 @@ void qcom_wcnss_assign_iris(struct qcom_wcnss *wcnss,
>
> wcnss->iris = iris;
> wcnss->use_48mhz_xo = use_48mhz_xo;
> + complete(&wcnss->iris_assigned);
>
> mutex_unlock(&wcnss->iris_lock);
Do you need this mutex anymore then? It looks like assign and start are
synchronized with the completion variable now.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-18 16:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-12 16:58 [PATCH] remoteproc: wcnss: Wait for iris before starting Loic Poulain
2018-06-18 16:50 ` Stephen Boyd
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.