dsp: adsp_loader: Probe only after remoteproc is ready
This change checks whether the adsp remoteproc is ready or not before probing the adsp loader. Since adsp loader is not useful until the adsp remoteproc is ready, defer probe of the driver. Change-Id: I659e67f0207707388c6484e58366637c1809d304 Signed-off-by: Meng Wang <mengw@codeaurora.org>
Este cometimento está contido em:

cometido por
Gerrit - the friendly Code Review server

ascendente
5fa13c2cd8
cometimento
500ce512d1
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2012-2014, 2017-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2012-2014, 2017-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
@@ -135,16 +135,6 @@ static void adsp_load_fw(struct work_struct *adsp_ldr_work)
|
||||
|
||||
load_adsp:
|
||||
{
|
||||
prop = of_find_property(pdev->dev.of_node, "qcom,rproc-handle",
|
||||
&size);
|
||||
if (!prop) {
|
||||
dev_err(&pdev->dev, "Missing remotproc handle\n");
|
||||
goto fail;
|
||||
}
|
||||
rproc_phandle = be32_to_cpup(prop->value);
|
||||
priv->pil_h = rproc_get_by_phandle(rproc_phandle);
|
||||
if (!priv->pil_h)
|
||||
goto fail;
|
||||
adsp_state = spf_core_is_apm_ready();
|
||||
if (adsp_state == SPF_SUBSYS_DOWN) {
|
||||
rc = rproc_boot(priv->pil_h);
|
||||
@@ -239,7 +229,6 @@ static void adsp_loader_unload(struct platform_device *pdev)
|
||||
|
||||
if (priv->pil_h) {
|
||||
rproc_shutdown(priv->pil_h);
|
||||
priv->pil_h = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,14 +325,34 @@ static int adsp_loader_probe(struct platform_device *pdev)
|
||||
int ret = 0;
|
||||
u32 adsp_fuse_not_supported = 0;
|
||||
const char *adsp_fw_name;
|
||||
struct property *prop;
|
||||
int size;
|
||||
phandle rproc_phandle;
|
||||
struct rproc *adsp;
|
||||
|
||||
prop = of_find_property(pdev->dev.of_node, "qcom,rproc-handle",
|
||||
&size);
|
||||
if (!prop) {
|
||||
dev_err(&pdev->dev, "Missing remotproc handle\n");
|
||||
return -ENOPARAM;
|
||||
}
|
||||
rproc_phandle = be32_to_cpup(prop->value);
|
||||
adsp = rproc_get_by_phandle(rproc_phandle);
|
||||
if (!adsp) {
|
||||
dev_err(&pdev->dev, "fail to get rproc\n", __func__);
|
||||
return -EPROBE_DEFER;
|
||||
}
|
||||
|
||||
ret = adsp_loader_init_sysfs(pdev);
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "%s: Error in initing sysfs\n", __func__);
|
||||
rproc_put(adsp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
priv = platform_get_drvdata(pdev);
|
||||
priv->pil_h = adsp;
|
||||
|
||||
/* get adsp variant idx */
|
||||
cell = nvmem_cell_get(&pdev->dev, "adsp_variant");
|
||||
if (IS_ERR_OR_NULL(cell)) {
|
||||
@@ -462,6 +471,7 @@ wqueue:
|
||||
devm_kfree(&pdev->dev, adsp_fw_bit_values);
|
||||
if (adsp_fw_name_array)
|
||||
devm_kfree(&pdev->dev, adsp_fw_name_array);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
Criar uma nova questão referindo esta
Bloquear um utilizador