Merge tag 'close-range-openat2-v5.11' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / drivers / remoteproc / qcom_q6v5_pas.c
index 3837f23..ee58622 100644 (file)
@@ -33,6 +33,7 @@ struct adsp_data {
        int crash_reason_smem;
        const char *firmware_name;
        int pas_id;
+       unsigned int minidump_id;
        bool has_aggre2_clk;
        bool auto_boot;
 
@@ -63,6 +64,7 @@ struct qcom_adsp {
        int proxy_pd_count;
 
        int pas_id;
+       unsigned int minidump_id;
        int crash_reason_smem;
        bool has_aggre2_clk;
        const char *info_name;
@@ -81,6 +83,13 @@ struct qcom_adsp {
        struct qcom_sysmon *sysmon;
 };
 
+static void adsp_minidump(struct rproc *rproc)
+{
+       struct qcom_adsp *adsp = rproc->priv;
+
+       qcom_minidump(rproc, adsp->minidump_id);
+}
+
 static int adsp_pds_enable(struct qcom_adsp *adsp, struct device **pds,
                           size_t pd_count)
 {
@@ -90,8 +99,11 @@ static int adsp_pds_enable(struct qcom_adsp *adsp, struct device **pds,
        for (i = 0; i < pd_count; i++) {
                dev_pm_genpd_set_performance_state(pds[i], INT_MAX);
                ret = pm_runtime_get_sync(pds[i]);
-               if (ret < 0)
+               if (ret < 0) {
+                       pm_runtime_put_noidle(pds[i]);
+                       dev_pm_genpd_set_performance_state(pds[i], 0);
                        goto unroll_pd_votes;
+               }
        }
 
        return 0;
@@ -214,7 +226,7 @@ static int adsp_stop(struct rproc *rproc)
        int handover;
        int ret;
 
-       ret = qcom_q6v5_request_stop(&adsp->q6v5);
+       ret = qcom_q6v5_request_stop(&adsp->q6v5, adsp->sysmon);
        if (ret == -ETIMEDOUT)
                dev_err(adsp->dev, "timed out on wait\n");
 
@@ -258,6 +270,15 @@ static const struct rproc_ops adsp_ops = {
        .panic = adsp_panic,
 };
 
+static const struct rproc_ops adsp_minidump_ops = {
+       .start = adsp_start,
+       .stop = adsp_stop,
+       .da_to_va = adsp_da_to_va,
+       .load = adsp_load,
+       .panic = adsp_panic,
+       .coredump = adsp_minidump,
+};
+
 static int adsp_init_clock(struct qcom_adsp *adsp)
 {
        int ret;
@@ -383,6 +404,7 @@ static int adsp_probe(struct platform_device *pdev)
        struct qcom_adsp *adsp;
        struct rproc *rproc;
        const char *fw_name;
+       const struct rproc_ops *ops = &adsp_ops;
        int ret;
 
        desc = of_device_get_match_data(&pdev->dev);
@@ -398,8 +420,11 @@ static int adsp_probe(struct platform_device *pdev)
        if (ret < 0 && ret != -EINVAL)
                return ret;
 
-       rproc = rproc_alloc(&pdev->dev, pdev->name, &adsp_ops,
-                           fw_name, sizeof(*adsp));
+       if (desc->minidump_id)
+               ops = &adsp_minidump_ops;
+
+       rproc = rproc_alloc(&pdev->dev, pdev->name, ops, fw_name, sizeof(*adsp));
+
        if (!rproc) {
                dev_err(&pdev->dev, "unable to allocate remoteproc\n");
                return -ENOMEM;
@@ -411,6 +436,7 @@ static int adsp_probe(struct platform_device *pdev)
        adsp = (struct qcom_adsp *)rproc->priv;
        adsp->dev = &pdev->dev;
        adsp->rproc = rproc;
+       adsp->minidump_id = desc->minidump_id;
        adsp->pas_id = desc->pas_id;
        adsp->has_aggre2_clk = desc->has_aggre2_clk;
        adsp->info_name = desc->sysmon_name;
@@ -607,6 +633,7 @@ static const struct adsp_data mpss_resource_init = {
        .crash_reason_smem = 421,
        .firmware_name = "modem.mdt",
        .pas_id = 4,
+       .minidump_id = 3,
        .has_aggre2_clk = false,
        .auto_boot = false,
        .active_pd_names = (char*[]){