Skip to content

Commit

Permalink
soc: qcom: pil-loaders: move pil loading of ADSP, SLPI & CDSP to work…
Browse files Browse the repository at this point in the history
…queue

When pil loading done through user space helper, there is a possibility
that signal could be pending on thread that initiated the pil, which would
lead to pil failure. To avoid this issue, move pil loading for ADSP, SLPI
and CDSP to separate workqueue in respective loader drivers.

Change-Id: Ie60a7eba7c52ac1565ce166d0e367379cce0b03e
Signed-off-by: Satya Durga Srinivasu Prabhala <[email protected]>
  • Loading branch information
Satya Durga Srinivasu Prabhala committed Feb 27, 2017
1 parent 25becb4 commit 544dff7
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 12 deletions.
17 changes: 14 additions & 3 deletions drivers/sensors/sensors_ssc.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
Expand Down Expand Up @@ -26,6 +26,8 @@
#include <linux/err.h>
#include <linux/delay.h>
#include <linux/sysfs.h>
#include <linux/workqueue.h>

#include <soc/qcom/subsystem_restart.h>

#define IMAGE_LOAD_CMD 1
Expand Down Expand Up @@ -64,10 +66,11 @@ static struct attribute *attrs[] = {
};

static struct platform_device *slpi_private;
static struct work_struct slpi_ldr_work;

static void slpi_loader_do(struct platform_device *pdev)
static void slpi_load_fw(struct work_struct *slpi_ldr_work)
{

struct platform_device *pdev = slpi_private;
struct slpi_loader_private *priv = NULL;
int ret;
const char *firmware_name = NULL;
Expand Down Expand Up @@ -111,6 +114,12 @@ static void slpi_loader_do(struct platform_device *pdev)
dev_err(&pdev->dev, "%s: SLPI image loading failed\n", __func__);
}

static void slpi_loader_do(struct platform_device *pdev)
{
dev_info(&pdev->dev, "%s: scheduling work to load SLPI fw\n", __func__);
schedule_work(&slpi_ldr_work);
}

static void slpi_loader_unload(struct platform_device *pdev)
{
struct slpi_loader_private *priv = NULL;
Expand Down Expand Up @@ -336,6 +345,8 @@ static int sensors_ssc_probe(struct platform_device *pdev)
goto cdev_add_err;
}

INIT_WORK(&slpi_ldr_work, slpi_load_fw);

return 0;

cdev_add_err:
Expand Down
16 changes: 13 additions & 3 deletions drivers/soc/qcom/qdsp6v2/adsp-loader.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2014, 2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
Expand All @@ -20,6 +20,8 @@
#include <linux/qdsp6v2/apr.h>
#include <linux/of_device.h>
#include <linux/sysfs.h>
#include <linux/workqueue.h>

#include <soc/qcom/subsystem_restart.h>

#define Q6_PIL_GET_DELAY_MS 100
Expand All @@ -44,12 +46,13 @@ static struct attribute *attrs[] = {
NULL,
};

static struct work_struct adsp_ldr_work;
static struct platform_device *adsp_private;
static void adsp_loader_unload(struct platform_device *pdev);

static void adsp_loader_do(struct platform_device *pdev)
static void adsp_load_fw(struct work_struct *adsp_ldr_work)
{

struct platform_device *pdev = adsp_private;
struct adsp_loader_private *priv = NULL;

const char *adsp_dt = "qcom,adsp-state";
Expand Down Expand Up @@ -146,6 +149,11 @@ static void adsp_loader_do(struct platform_device *pdev)
return;
}

static void adsp_loader_do(struct platform_device *pdev)
{
dev_info(&pdev->dev, "%s: scheduling work to load ADSP fw\n", __func__);
schedule_work(&adsp_ldr_work);
}

static ssize_t adsp_boot_store(struct kobject *kobj,
struct kobj_attribute *attr,
Expand Down Expand Up @@ -270,6 +278,8 @@ static int adsp_loader_probe(struct platform_device *pdev)
return ret;
}

INIT_WORK(&adsp_ldr_work, adsp_load_fw);

return 0;
}

Expand Down
22 changes: 16 additions & 6 deletions drivers/soc/qcom/qdsp6v2/cdsp-loader.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2014,2017, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2014, 2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
Expand All @@ -19,6 +19,8 @@
#include <linux/platform_device.h>
#include <linux/of_device.h>
#include <linux/sysfs.h>
#include <linux/workqueue.h>

#include <soc/qcom/subsystem_restart.h>

#define BOOT_CMD 1
Expand Down Expand Up @@ -47,11 +49,12 @@ static struct attribute *attrs[] = {

static u32 cdsp_state = CDSP_SUBSYS_DOWN;
static struct platform_device *cdsp_private;
static struct work_struct cdsp_ldr_work;
static void cdsp_loader_unload(struct platform_device *pdev);

static int cdsp_loader_do(struct platform_device *pdev)
static void cdsp_load_fw(struct work_struct *cdsp_ldr_work)
{

struct platform_device *pdev = cdsp_private;
struct cdsp_loader_private *priv = NULL;

int rc = 0;
Expand Down Expand Up @@ -101,14 +104,19 @@ static int cdsp_loader_do(struct platform_device *pdev)
}

dev_dbg(&pdev->dev, "%s: CDSP image is loaded\n", __func__);
return rc;
return;
}

fail:
dev_err(&pdev->dev, "%s: CDSP image loading failed\n", __func__);
return rc;
return;
}

static void cdsp_loader_do(struct platform_device *pdev)
{
dev_info(&pdev->dev, "%s: scheduling work to load CDSP fw\n", __func__);
schedule_work(&cdsp_ldr_work);
}

static ssize_t cdsp_boot_store(struct kobject *kobj,
struct kobj_attribute *attr,
Expand All @@ -126,7 +134,7 @@ static ssize_t cdsp_boot_store(struct kobject *kobj,
pr_debug("%s: going to call cdsp_loader_do\n", __func__);
cdsp_loader_do(cdsp_private);
} else if (boot == IMAGE_UNLOAD_CMD) {
pr_debug("%s: going to call adsp_unloader\n", __func__);
pr_debug("%s: going to call cdsp_unloader\n", __func__);
cdsp_loader_unload(cdsp_private);
}
return count;
Expand Down Expand Up @@ -238,6 +246,8 @@ static int cdsp_loader_probe(struct platform_device *pdev)
return ret;
}

INIT_WORK(&cdsp_ldr_work, cdsp_load_fw);

return 0;
}

Expand Down

0 comments on commit 544dff7

Please sign in to comment.