Commit 21f577b0 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 2d7b4cdb a0a77028
......@@ -28,6 +28,7 @@ properties:
- qcom,sc8180x-adsp-pas
- qcom,sc8180x-cdsp-pas
- qcom,sc8180x-mpss-pas
- qcom,sdm660-adsp-pas
- qcom,sdm845-adsp-pas
- qcom,sdm845-cdsp-pas
- qcom,sdx55-mpss-pas
......
......@@ -833,6 +833,7 @@ static const struct of_device_id adsp_of_match[] = {
{ .compatible = "qcom,sc8180x-adsp-pas", .data = &sm8150_adsp_resource},
{ .compatible = "qcom,sc8180x-cdsp-pas", .data = &sm8150_cdsp_resource},
{ .compatible = "qcom,sc8180x-mpss-pas", .data = &sc8180x_mpss_resource},
{ .compatible = "qcom,sdm660-adsp-pas", .data = &adsp_resource_init},
{ .compatible = "qcom,sdm845-adsp-pas", .data = &adsp_resource_init},
{ .compatible = "qcom,sdm845-cdsp-pas", .data = &cdsp_resource_init},
{ .compatible = "qcom,sdx55-mpss-pas", .data = &sdx55_mpss_resource},
......
......@@ -142,18 +142,6 @@ static const struct wcnss_data pronto_v2_data = {
.num_vregs = 1,
};
void qcom_wcnss_assign_iris(struct qcom_wcnss *wcnss,
struct qcom_iris *iris,
bool use_48mhz_xo)
{
mutex_lock(&wcnss->iris_lock);
wcnss->iris = iris;
wcnss->use_48mhz_xo = use_48mhz_xo;
mutex_unlock(&wcnss->iris_lock);
}
static int wcnss_load(struct rproc *rproc, const struct firmware *fw)
{
struct qcom_wcnss *wcnss = (struct qcom_wcnss *)rproc->priv;
......@@ -639,12 +627,20 @@ static int wcnss_probe(struct platform_device *pdev)
goto detach_pds;
}
wcnss->iris = qcom_iris_probe(&pdev->dev, &wcnss->use_48mhz_xo);
if (IS_ERR(wcnss->iris)) {
ret = PTR_ERR(wcnss->iris);
goto detach_pds;
}
ret = rproc_add(rproc);
if (ret)
goto detach_pds;
goto remove_iris;
return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
return 0;
remove_iris:
qcom_iris_remove(wcnss->iris);
detach_pds:
wcnss_release_pds(wcnss);
free_rproc:
......@@ -657,7 +653,7 @@ static int wcnss_remove(struct platform_device *pdev)
{
struct qcom_wcnss *wcnss = platform_get_drvdata(pdev);
of_platform_depopulate(&pdev->dev);
qcom_iris_remove(wcnss->iris);
rproc_del(wcnss->rproc);
......@@ -686,28 +682,7 @@ static struct platform_driver wcnss_driver = {
},
};
static int __init wcnss_init(void)
{
int ret;
ret = platform_driver_register(&wcnss_driver);
if (ret)
return ret;
ret = platform_driver_register(&qcom_iris_driver);
if (ret)
platform_driver_unregister(&wcnss_driver);
return ret;
}
module_init(wcnss_init);
static void __exit wcnss_exit(void)
{
platform_driver_unregister(&qcom_iris_driver);
platform_driver_unregister(&wcnss_driver);
}
module_exit(wcnss_exit);
module_platform_driver(wcnss_driver);
MODULE_DESCRIPTION("Qualcomm Peripheral Image Loader for Wireless Subsystem");
MODULE_LICENSE("GPL v2");
......@@ -17,9 +17,9 @@ struct wcnss_vreg_info {
bool super_turbo;
};
struct qcom_iris *qcom_iris_probe(struct device *parent, bool *use_48mhz_xo);
void qcom_iris_remove(struct qcom_iris *iris);
int qcom_iris_enable(struct qcom_iris *iris);
void qcom_iris_disable(struct qcom_iris *iris);
void qcom_wcnss_assign_iris(struct qcom_wcnss *wcnss, struct qcom_iris *iris, bool use_48mhz_xo);
#endif
......@@ -17,7 +17,7 @@
#include "qcom_wcnss.h"
struct qcom_iris {
struct device *dev;
struct device dev;
struct clk *xo_clk;
......@@ -75,7 +75,7 @@ int qcom_iris_enable(struct qcom_iris *iris)
ret = clk_prepare_enable(iris->xo_clk);
if (ret) {
dev_err(iris->dev, "failed to enable xo clk\n");
dev_err(&iris->dev, "failed to enable xo clk\n");
goto disable_regulators;
}
......@@ -93,43 +93,90 @@ void qcom_iris_disable(struct qcom_iris *iris)
regulator_bulk_disable(iris->num_vregs, iris->vregs);
}
static int qcom_iris_probe(struct platform_device *pdev)
static const struct of_device_id iris_of_match[] = {
{ .compatible = "qcom,wcn3620", .data = &wcn3620_data },
{ .compatible = "qcom,wcn3660", .data = &wcn3660_data },
{ .compatible = "qcom,wcn3660b", .data = &wcn3680_data },
{ .compatible = "qcom,wcn3680", .data = &wcn3680_data },
{}
};
static void qcom_iris_release(struct device *dev)
{
struct qcom_iris *iris = container_of(dev, struct qcom_iris, dev);
of_node_put(iris->dev.of_node);
kfree(iris);
}
struct qcom_iris *qcom_iris_probe(struct device *parent, bool *use_48mhz_xo)
{
const struct of_device_id *match;
const struct iris_data *data;
struct qcom_wcnss *wcnss;
struct device_node *of_node;
struct qcom_iris *iris;
int ret;
int i;
iris = devm_kzalloc(&pdev->dev, sizeof(struct qcom_iris), GFP_KERNEL);
if (!iris)
return -ENOMEM;
of_node = of_get_child_by_name(parent->of_node, "iris");
if (!of_node) {
dev_err(parent, "No child node \"iris\" found\n");
return ERR_PTR(-EINVAL);
}
iris = kzalloc(sizeof(*iris), GFP_KERNEL);
if (!iris) {
of_node_put(of_node);
return ERR_PTR(-ENOMEM);
}
device_initialize(&iris->dev);
iris->dev.parent = parent;
iris->dev.release = qcom_iris_release;
iris->dev.of_node = of_node;
dev_set_name(&iris->dev, "%s.iris", dev_name(parent));
ret = device_add(&iris->dev);
if (ret) {
put_device(&iris->dev);
return ERR_PTR(ret);
}
match = of_match_device(iris_of_match, &iris->dev);
if (!match) {
dev_err(&iris->dev, "no matching compatible for iris\n");
ret = -EINVAL;
goto err_device_del;
}
data = of_device_get_match_data(&pdev->dev);
wcnss = dev_get_drvdata(pdev->dev.parent);
data = match->data;
iris->xo_clk = devm_clk_get(&pdev->dev, "xo");
iris->xo_clk = devm_clk_get(&iris->dev, "xo");
if (IS_ERR(iris->xo_clk)) {
if (PTR_ERR(iris->xo_clk) != -EPROBE_DEFER)
dev_err(&pdev->dev, "failed to acquire xo clk\n");
return PTR_ERR(iris->xo_clk);
ret = PTR_ERR(iris->xo_clk);
if (ret != -EPROBE_DEFER)
dev_err(&iris->dev, "failed to acquire xo clk\n");
goto err_device_del;
}
iris->num_vregs = data->num_vregs;
iris->vregs = devm_kcalloc(&pdev->dev,
iris->vregs = devm_kcalloc(&iris->dev,
iris->num_vregs,
sizeof(struct regulator_bulk_data),
GFP_KERNEL);
if (!iris->vregs)
return -ENOMEM;
if (!iris->vregs) {
ret = -ENOMEM;
goto err_device_del;
}
for (i = 0; i < iris->num_vregs; i++)
iris->vregs[i].supply = data->vregs[i].name;
ret = devm_regulator_bulk_get(&pdev->dev, iris->num_vregs, iris->vregs);
ret = devm_regulator_bulk_get(&iris->dev, iris->num_vregs, iris->vregs);
if (ret) {
dev_err(&pdev->dev, "failed to get regulators\n");
return ret;
dev_err(&iris->dev, "failed to get regulators\n");
goto err_device_del;
}
for (i = 0; i < iris->num_vregs; i++) {
......@@ -143,34 +190,17 @@ static int qcom_iris_probe(struct platform_device *pdev)
data->vregs[i].load_uA);
}
qcom_wcnss_assign_iris(wcnss, iris, data->use_48mhz_xo);
return 0;
}
*use_48mhz_xo = data->use_48mhz_xo;
static int qcom_iris_remove(struct platform_device *pdev)
{
struct qcom_wcnss *wcnss = dev_get_drvdata(pdev->dev.parent);
return iris;
qcom_wcnss_assign_iris(wcnss, NULL, false);
err_device_del:
device_del(&iris->dev);
return 0;
return ERR_PTR(ret);
}
static const struct of_device_id iris_of_match[] = {
{ .compatible = "qcom,wcn3620", .data = &wcn3620_data },
{ .compatible = "qcom,wcn3660", .data = &wcn3660_data },
{ .compatible = "qcom,wcn3660b", .data = &wcn3680_data },
{ .compatible = "qcom,wcn3680", .data = &wcn3680_data },
{}
};
MODULE_DEVICE_TABLE(of, iris_of_match);
struct platform_driver qcom_iris_driver = {
.probe = qcom_iris_probe,
.remove = qcom_iris_remove,
.driver = {
.name = "qcom-iris",
.of_match_table = iris_of_match,
},
};
void qcom_iris_remove(struct qcom_iris *iris)
{
device_del(&iris->dev);
}
......@@ -2750,8 +2750,8 @@ void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type)
dev_err(&rproc->dev, "crash detected in %s: type %s\n",
rproc->name, rproc_crash_to_string(type));
/* create a new task to handle the error */
schedule_work(&rproc->crash_handler);
/* Have a worker handle the error; ensure system is not suspended */
queue_work(system_freezable_wq, &rproc->crash_handler);
}
EXPORT_SYMBOL(rproc_report_crash);
......
......@@ -15,7 +15,7 @@
* fw_elf_get_class - Get elf class
* @fw: the ELF firmware image
*
* Note that we use and elf32_hdr to access the class since the start of the
* Note that we use elf32_hdr to access the class since the start of the
* struct is the same for both elf class
*
* Return: elf class of the firmware
......
......@@ -369,9 +369,8 @@ enum rsc_handling_status {
* @da_to_va: optional platform hook to perform address translations
* @parse_fw: parse firmware to extract information (e.g. resource table)
* @handle_rsc: optional platform hook to handle vendor resources. Should return
* RSC_HANDLED if resource was handled, RSC_IGNORED if not handled and a
* negative value on error
* @load_rsc_table: load resource table from firmware image
* RSC_HANDLED if resource was handled, RSC_IGNORED if not handled
* and a negative value on error
* @find_loaded_rsc_table: find the loaded resource table from firmware image
* @get_loaded_rsc_table: get resource table installed in memory
* by external entity
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment