Skip to content

Commit 21f577b

Browse files
committed
Merge tag 'rproc-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc
Pull remoteproc updates from Bjorn Andersson: - move the crash recovery worker to the freezable work queue to avoid interaction with other drivers during suspend & resume - fix a couple of typos in comments - add support for handling the audio DSP on SDM660 - fix a race between the Qualcomm wireless subsystem driver and the associated driver for the RF chip * tag 'rproc-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc: remoteproc: q6v5_pas: Add sdm660 ADSP PIL compatible dt-bindings: remoteproc: qcom: adsp: Add SDM660 ADSP remoteproc: use freezable workqueue for crash notifications remoteproc: fix kernel doc for struct rproc_ops remoteproc: fix an typo in fw_elf_get_class code comments remoteproc: qcom: wcnss: Fix race with iris probe
2 parents 2d7b4cd + a0a7702 commit 21f577b

File tree

8 files changed

+96
-90
lines changed

8 files changed

+96
-90
lines changed

Documentation/devicetree/bindings/remoteproc/qcom,adsp.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ properties:
2828
- qcom,sc8180x-adsp-pas
2929
- qcom,sc8180x-cdsp-pas
3030
- qcom,sc8180x-mpss-pas
31+
- qcom,sdm660-adsp-pas
3132
- qcom,sdm845-adsp-pas
3233
- qcom,sdm845-cdsp-pas
3334
- qcom,sdx55-mpss-pas

drivers/remoteproc/qcom_q6v5_pas.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ static const struct of_device_id adsp_of_match[] = {
833833
{ .compatible = "qcom,sc8180x-adsp-pas", .data = &sm8150_adsp_resource},
834834
{ .compatible = "qcom,sc8180x-cdsp-pas", .data = &sm8150_cdsp_resource},
835835
{ .compatible = "qcom,sc8180x-mpss-pas", .data = &sc8180x_mpss_resource},
836+
{ .compatible = "qcom,sdm660-adsp-pas", .data = &adsp_resource_init},
836837
{ .compatible = "qcom,sdm845-adsp-pas", .data = &adsp_resource_init},
837838
{ .compatible = "qcom,sdm845-cdsp-pas", .data = &cdsp_resource_init},
838839
{ .compatible = "qcom,sdx55-mpss-pas", .data = &sdx55_mpss_resource},

drivers/remoteproc/qcom_wcnss.c

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,6 @@ static const struct wcnss_data pronto_v2_data = {
142142
.num_vregs = 1,
143143
};
144144

145-
void qcom_wcnss_assign_iris(struct qcom_wcnss *wcnss,
146-
struct qcom_iris *iris,
147-
bool use_48mhz_xo)
148-
{
149-
mutex_lock(&wcnss->iris_lock);
150-
151-
wcnss->iris = iris;
152-
wcnss->use_48mhz_xo = use_48mhz_xo;
153-
154-
mutex_unlock(&wcnss->iris_lock);
155-
}
156-
157145
static int wcnss_load(struct rproc *rproc, const struct firmware *fw)
158146
{
159147
struct qcom_wcnss *wcnss = (struct qcom_wcnss *)rproc->priv;
@@ -639,12 +627,20 @@ static int wcnss_probe(struct platform_device *pdev)
639627
goto detach_pds;
640628
}
641629

630+
wcnss->iris = qcom_iris_probe(&pdev->dev, &wcnss->use_48mhz_xo);
631+
if (IS_ERR(wcnss->iris)) {
632+
ret = PTR_ERR(wcnss->iris);
633+
goto detach_pds;
634+
}
635+
642636
ret = rproc_add(rproc);
643637
if (ret)
644-
goto detach_pds;
638+
goto remove_iris;
645639

646-
return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
640+
return 0;
647641

642+
remove_iris:
643+
qcom_iris_remove(wcnss->iris);
648644
detach_pds:
649645
wcnss_release_pds(wcnss);
650646
free_rproc:
@@ -657,7 +653,7 @@ static int wcnss_remove(struct platform_device *pdev)
657653
{
658654
struct qcom_wcnss *wcnss = platform_get_drvdata(pdev);
659655

660-
of_platform_depopulate(&pdev->dev);
656+
qcom_iris_remove(wcnss->iris);
661657

662658
rproc_del(wcnss->rproc);
663659

@@ -686,28 +682,7 @@ static struct platform_driver wcnss_driver = {
686682
},
687683
};
688684

689-
static int __init wcnss_init(void)
690-
{
691-
int ret;
692-
693-
ret = platform_driver_register(&wcnss_driver);
694-
if (ret)
695-
return ret;
696-
697-
ret = platform_driver_register(&qcom_iris_driver);
698-
if (ret)
699-
platform_driver_unregister(&wcnss_driver);
700-
701-
return ret;
702-
}
703-
module_init(wcnss_init);
704-
705-
static void __exit wcnss_exit(void)
706-
{
707-
platform_driver_unregister(&qcom_iris_driver);
708-
platform_driver_unregister(&wcnss_driver);
709-
}
710-
module_exit(wcnss_exit);
685+
module_platform_driver(wcnss_driver);
711686

712687
MODULE_DESCRIPTION("Qualcomm Peripheral Image Loader for Wireless Subsystem");
713688
MODULE_LICENSE("GPL v2");

drivers/remoteproc/qcom_wcnss.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ struct wcnss_vreg_info {
1717
bool super_turbo;
1818
};
1919

20+
struct qcom_iris *qcom_iris_probe(struct device *parent, bool *use_48mhz_xo);
21+
void qcom_iris_remove(struct qcom_iris *iris);
2022
int qcom_iris_enable(struct qcom_iris *iris);
2123
void qcom_iris_disable(struct qcom_iris *iris);
2224

23-
void qcom_wcnss_assign_iris(struct qcom_wcnss *wcnss, struct qcom_iris *iris, bool use_48mhz_xo);
24-
2525
#endif

drivers/remoteproc/qcom_wcnss_iris.c

Lines changed: 75 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "qcom_wcnss.h"
1818

1919
struct qcom_iris {
20-
struct device *dev;
20+
struct device dev;
2121

2222
struct clk *xo_clk;
2323

@@ -75,7 +75,7 @@ int qcom_iris_enable(struct qcom_iris *iris)
7575

7676
ret = clk_prepare_enable(iris->xo_clk);
7777
if (ret) {
78-
dev_err(iris->dev, "failed to enable xo clk\n");
78+
dev_err(&iris->dev, "failed to enable xo clk\n");
7979
goto disable_regulators;
8080
}
8181

@@ -93,43 +93,90 @@ void qcom_iris_disable(struct qcom_iris *iris)
9393
regulator_bulk_disable(iris->num_vregs, iris->vregs);
9494
}
9595

96-
static int qcom_iris_probe(struct platform_device *pdev)
96+
static const struct of_device_id iris_of_match[] = {
97+
{ .compatible = "qcom,wcn3620", .data = &wcn3620_data },
98+
{ .compatible = "qcom,wcn3660", .data = &wcn3660_data },
99+
{ .compatible = "qcom,wcn3660b", .data = &wcn3680_data },
100+
{ .compatible = "qcom,wcn3680", .data = &wcn3680_data },
101+
{}
102+
};
103+
104+
static void qcom_iris_release(struct device *dev)
105+
{
106+
struct qcom_iris *iris = container_of(dev, struct qcom_iris, dev);
107+
108+
of_node_put(iris->dev.of_node);
109+
kfree(iris);
110+
}
111+
112+
struct qcom_iris *qcom_iris_probe(struct device *parent, bool *use_48mhz_xo)
97113
{
114+
const struct of_device_id *match;
98115
const struct iris_data *data;
99-
struct qcom_wcnss *wcnss;
116+
struct device_node *of_node;
100117
struct qcom_iris *iris;
101118
int ret;
102119
int i;
103120

104-
iris = devm_kzalloc(&pdev->dev, sizeof(struct qcom_iris), GFP_KERNEL);
105-
if (!iris)
106-
return -ENOMEM;
121+
of_node = of_get_child_by_name(parent->of_node, "iris");
122+
if (!of_node) {
123+
dev_err(parent, "No child node \"iris\" found\n");
124+
return ERR_PTR(-EINVAL);
125+
}
126+
127+
iris = kzalloc(sizeof(*iris), GFP_KERNEL);
128+
if (!iris) {
129+
of_node_put(of_node);
130+
return ERR_PTR(-ENOMEM);
131+
}
132+
133+
device_initialize(&iris->dev);
134+
iris->dev.parent = parent;
135+
iris->dev.release = qcom_iris_release;
136+
iris->dev.of_node = of_node;
137+
138+
dev_set_name(&iris->dev, "%s.iris", dev_name(parent));
139+
140+
ret = device_add(&iris->dev);
141+
if (ret) {
142+
put_device(&iris->dev);
143+
return ERR_PTR(ret);
144+
}
145+
146+
match = of_match_device(iris_of_match, &iris->dev);
147+
if (!match) {
148+
dev_err(&iris->dev, "no matching compatible for iris\n");
149+
ret = -EINVAL;
150+
goto err_device_del;
151+
}
107152

108-
data = of_device_get_match_data(&pdev->dev);
109-
wcnss = dev_get_drvdata(pdev->dev.parent);
153+
data = match->data;
110154

111-
iris->xo_clk = devm_clk_get(&pdev->dev, "xo");
155+
iris->xo_clk = devm_clk_get(&iris->dev, "xo");
112156
if (IS_ERR(iris->xo_clk)) {
113-
if (PTR_ERR(iris->xo_clk) != -EPROBE_DEFER)
114-
dev_err(&pdev->dev, "failed to acquire xo clk\n");
115-
return PTR_ERR(iris->xo_clk);
157+
ret = PTR_ERR(iris->xo_clk);
158+
if (ret != -EPROBE_DEFER)
159+
dev_err(&iris->dev, "failed to acquire xo clk\n");
160+
goto err_device_del;
116161
}
117162

118163
iris->num_vregs = data->num_vregs;
119-
iris->vregs = devm_kcalloc(&pdev->dev,
164+
iris->vregs = devm_kcalloc(&iris->dev,
120165
iris->num_vregs,
121166
sizeof(struct regulator_bulk_data),
122167
GFP_KERNEL);
123-
if (!iris->vregs)
124-
return -ENOMEM;
168+
if (!iris->vregs) {
169+
ret = -ENOMEM;
170+
goto err_device_del;
171+
}
125172

126173
for (i = 0; i < iris->num_vregs; i++)
127174
iris->vregs[i].supply = data->vregs[i].name;
128175

129-
ret = devm_regulator_bulk_get(&pdev->dev, iris->num_vregs, iris->vregs);
176+
ret = devm_regulator_bulk_get(&iris->dev, iris->num_vregs, iris->vregs);
130177
if (ret) {
131-
dev_err(&pdev->dev, "failed to get regulators\n");
132-
return ret;
178+
dev_err(&iris->dev, "failed to get regulators\n");
179+
goto err_device_del;
133180
}
134181

135182
for (i = 0; i < iris->num_vregs; i++) {
@@ -143,34 +190,17 @@ static int qcom_iris_probe(struct platform_device *pdev)
143190
data->vregs[i].load_uA);
144191
}
145192

146-
qcom_wcnss_assign_iris(wcnss, iris, data->use_48mhz_xo);
147-
148-
return 0;
149-
}
193+
*use_48mhz_xo = data->use_48mhz_xo;
150194

151-
static int qcom_iris_remove(struct platform_device *pdev)
152-
{
153-
struct qcom_wcnss *wcnss = dev_get_drvdata(pdev->dev.parent);
195+
return iris;
154196

155-
qcom_wcnss_assign_iris(wcnss, NULL, false);
197+
err_device_del:
198+
device_del(&iris->dev);
156199

157-
return 0;
200+
return ERR_PTR(ret);
158201
}
159202

160-
static const struct of_device_id iris_of_match[] = {
161-
{ .compatible = "qcom,wcn3620", .data = &wcn3620_data },
162-
{ .compatible = "qcom,wcn3660", .data = &wcn3660_data },
163-
{ .compatible = "qcom,wcn3660b", .data = &wcn3680_data },
164-
{ .compatible = "qcom,wcn3680", .data = &wcn3680_data },
165-
{}
166-
};
167-
MODULE_DEVICE_TABLE(of, iris_of_match);
168-
169-
struct platform_driver qcom_iris_driver = {
170-
.probe = qcom_iris_probe,
171-
.remove = qcom_iris_remove,
172-
.driver = {
173-
.name = "qcom-iris",
174-
.of_match_table = iris_of_match,
175-
},
176-
};
203+
void qcom_iris_remove(struct qcom_iris *iris)
204+
{
205+
device_del(&iris->dev);
206+
}

drivers/remoteproc/remoteproc_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,8 +2750,8 @@ void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type)
27502750
dev_err(&rproc->dev, "crash detected in %s: type %s\n",
27512751
rproc->name, rproc_crash_to_string(type));
27522752

2753-
/* create a new task to handle the error */
2754-
schedule_work(&rproc->crash_handler);
2753+
/* Have a worker handle the error; ensure system is not suspended */
2754+
queue_work(system_freezable_wq, &rproc->crash_handler);
27552755
}
27562756
EXPORT_SYMBOL(rproc_report_crash);
27572757

drivers/remoteproc/remoteproc_elf_helpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* fw_elf_get_class - Get elf class
1616
* @fw: the ELF firmware image
1717
*
18-
* Note that we use and elf32_hdr to access the class since the start of the
18+
* Note that we use elf32_hdr to access the class since the start of the
1919
* struct is the same for both elf class
2020
*
2121
* Return: elf class of the firmware

include/linux/remoteproc.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,8 @@ enum rsc_handling_status {
369369
* @da_to_va: optional platform hook to perform address translations
370370
* @parse_fw: parse firmware to extract information (e.g. resource table)
371371
* @handle_rsc: optional platform hook to handle vendor resources. Should return
372-
* RSC_HANDLED if resource was handled, RSC_IGNORED if not handled and a
373-
* negative value on error
374-
* @load_rsc_table: load resource table from firmware image
372+
* RSC_HANDLED if resource was handled, RSC_IGNORED if not handled
373+
* and a negative value on error
375374
* @find_loaded_rsc_table: find the loaded resource table from firmware image
376375
* @get_loaded_rsc_table: get resource table installed in memory
377376
* by external entity

0 commit comments

Comments
 (0)