Skip to content

Commit 8d9be5c

Browse files
committed
remoteproc: qcom: q6v5: Add interconnect path proxy vote
Many remoteproc instances requires that Linux casts a proxy vote for an interconnect path during boot, until they can do it themselves. Add support for voting for a single path. As this is a shared problem between both PAS and MSS drivers, the path is acquired and votes casted from the common helper code. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Georgi Djakov <djakov@kernel.org> Link: https://lore.kernel.org/r/20220225033224.2238425-1-bjorn.andersson@linaro.org
1 parent 80d6918 commit 8d9be5c

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

drivers/remoteproc/qcom_q6v5.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99
#include <linux/kernel.h>
1010
#include <linux/platform_device.h>
11+
#include <linux/interconnect.h>
1112
#include <linux/interrupt.h>
1213
#include <linux/module.h>
1314
#include <linux/soc/qcom/qcom_aoss.h>
@@ -51,9 +52,17 @@ int qcom_q6v5_prepare(struct qcom_q6v5 *q6v5)
5152
{
5253
int ret;
5354

55+
ret = icc_set_bw(q6v5->path, 0, UINT_MAX);
56+
if (ret < 0) {
57+
dev_err(q6v5->dev, "failed to set bandwidth request\n");
58+
return ret;
59+
}
60+
5461
ret = q6v5_load_state_toggle(q6v5, true);
55-
if (ret)
62+
if (ret) {
63+
icc_set_bw(q6v5->path, 0, 0);
5664
return ret;
65+
}
5766

5867
reinit_completion(&q6v5->start_done);
5968
reinit_completion(&q6v5->stop_done);
@@ -78,6 +87,9 @@ int qcom_q6v5_unprepare(struct qcom_q6v5 *q6v5)
7887
disable_irq(q6v5->handover_irq);
7988
q6v5_load_state_toggle(q6v5, false);
8089

90+
/* Disable interconnect vote, in case handover never happened */
91+
icc_set_bw(q6v5->path, 0, 0);
92+
8193
return !q6v5->handover_issued;
8294
}
8395
EXPORT_SYMBOL_GPL(qcom_q6v5_unprepare);
@@ -160,6 +172,8 @@ static irqreturn_t q6v5_handover_interrupt(int irq, void *data)
160172
if (q6v5->handover)
161173
q6v5->handover(q6v5);
162174

175+
icc_set_bw(q6v5->path, 0, 0);
176+
163177
q6v5->handover_issued = true;
164178

165179
return IRQ_HANDLED;
@@ -332,6 +346,11 @@ int qcom_q6v5_init(struct qcom_q6v5 *q6v5, struct platform_device *pdev,
332346
return load_state ? -ENOMEM : -EINVAL;
333347
}
334348

349+
q6v5->path = devm_of_icc_get(&pdev->dev, NULL);
350+
if (IS_ERR(q6v5->path))
351+
return dev_err_probe(&pdev->dev, PTR_ERR(q6v5->path),
352+
"failed to acquire interconnect path\n");
353+
335354
return 0;
336355
}
337356
EXPORT_SYMBOL_GPL(qcom_q6v5_init);

drivers/remoteproc/qcom_q6v5.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/completion.h>
88
#include <linux/soc/qcom/qcom_aoss.h>
99

10+
struct icc_path;
1011
struct rproc;
1112
struct qcom_smem_state;
1213
struct qcom_sysmon;
@@ -18,6 +19,8 @@ struct qcom_q6v5 {
1819
struct qcom_smem_state *state;
1920
struct qmp *qmp;
2021

22+
struct icc_path *path;
23+
2124
unsigned stop_bit;
2225

2326
int wdog_irq;

0 commit comments

Comments
 (0)