Skip to content

Commit 544dff7

Browse files
author
Satya Durga Srinivasu Prabhala
committed
soc: qcom: pil-loaders: move pil loading of ADSP, SLPI & CDSP to workqueue
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]>
1 parent 25becb4 commit 544dff7

File tree

3 files changed

+43
-12
lines changed

3 files changed

+43
-12
lines changed

drivers/sensors/sensors_ssc.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
1+
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
22
*
33
* This program is free software; you can redistribute it and/or modify
44
* it under the terms of the GNU General Public License version 2 and
@@ -26,6 +26,8 @@
2626
#include <linux/err.h>
2727
#include <linux/delay.h>
2828
#include <linux/sysfs.h>
29+
#include <linux/workqueue.h>
30+
2931
#include <soc/qcom/subsystem_restart.h>
3032

3133
#define IMAGE_LOAD_CMD 1
@@ -64,10 +66,11 @@ static struct attribute *attrs[] = {
6466
};
6567

6668
static struct platform_device *slpi_private;
69+
static struct work_struct slpi_ldr_work;
6770

68-
static void slpi_loader_do(struct platform_device *pdev)
71+
static void slpi_load_fw(struct work_struct *slpi_ldr_work)
6972
{
70-
73+
struct platform_device *pdev = slpi_private;
7174
struct slpi_loader_private *priv = NULL;
7275
int ret;
7376
const char *firmware_name = NULL;
@@ -111,6 +114,12 @@ static void slpi_loader_do(struct platform_device *pdev)
111114
dev_err(&pdev->dev, "%s: SLPI image loading failed\n", __func__);
112115
}
113116

117+
static void slpi_loader_do(struct platform_device *pdev)
118+
{
119+
dev_info(&pdev->dev, "%s: scheduling work to load SLPI fw\n", __func__);
120+
schedule_work(&slpi_ldr_work);
121+
}
122+
114123
static void slpi_loader_unload(struct platform_device *pdev)
115124
{
116125
struct slpi_loader_private *priv = NULL;
@@ -336,6 +345,8 @@ static int sensors_ssc_probe(struct platform_device *pdev)
336345
goto cdev_add_err;
337346
}
338347

348+
INIT_WORK(&slpi_ldr_work, slpi_load_fw);
349+
339350
return 0;
340351

341352
cdev_add_err:

drivers/soc/qcom/qdsp6v2/adsp-loader.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
2+
* Copyright (c) 2012-2014, 2017, The Linux Foundation. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License version 2 and
@@ -20,6 +20,8 @@
2020
#include <linux/qdsp6v2/apr.h>
2121
#include <linux/of_device.h>
2222
#include <linux/sysfs.h>
23+
#include <linux/workqueue.h>
24+
2325
#include <soc/qcom/subsystem_restart.h>
2426

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

49+
static struct work_struct adsp_ldr_work;
4750
static struct platform_device *adsp_private;
4851
static void adsp_loader_unload(struct platform_device *pdev);
4952

50-
static void adsp_loader_do(struct platform_device *pdev)
53+
static void adsp_load_fw(struct work_struct *adsp_ldr_work)
5154
{
52-
55+
struct platform_device *pdev = adsp_private;
5356
struct adsp_loader_private *priv = NULL;
5457

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

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

150158
static ssize_t adsp_boot_store(struct kobject *kobj,
151159
struct kobj_attribute *attr,
@@ -270,6 +278,8 @@ static int adsp_loader_probe(struct platform_device *pdev)
270278
return ret;
271279
}
272280

281+
INIT_WORK(&adsp_ldr_work, adsp_load_fw);
282+
273283
return 0;
274284
}
275285

drivers/soc/qcom/qdsp6v2/cdsp-loader.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012-2014,2017, The Linux Foundation. All rights reserved.
2+
* Copyright (c) 2012-2014, 2017, The Linux Foundation. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License version 2 and
@@ -19,6 +19,8 @@
1919
#include <linux/platform_device.h>
2020
#include <linux/of_device.h>
2121
#include <linux/sysfs.h>
22+
#include <linux/workqueue.h>
23+
2224
#include <soc/qcom/subsystem_restart.h>
2325

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

4850
static u32 cdsp_state = CDSP_SUBSYS_DOWN;
4951
static struct platform_device *cdsp_private;
52+
static struct work_struct cdsp_ldr_work;
5053
static void cdsp_loader_unload(struct platform_device *pdev);
5154

52-
static int cdsp_loader_do(struct platform_device *pdev)
55+
static void cdsp_load_fw(struct work_struct *cdsp_ldr_work)
5356
{
54-
57+
struct platform_device *pdev = cdsp_private;
5558
struct cdsp_loader_private *priv = NULL;
5659

5760
int rc = 0;
@@ -101,14 +104,19 @@ static int cdsp_loader_do(struct platform_device *pdev)
101104
}
102105

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

107110
fail:
108111
dev_err(&pdev->dev, "%s: CDSP image loading failed\n", __func__);
109-
return rc;
112+
return;
110113
}
111114

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

113121
static ssize_t cdsp_boot_store(struct kobject *kobj,
114122
struct kobj_attribute *attr,
@@ -126,7 +134,7 @@ static ssize_t cdsp_boot_store(struct kobject *kobj,
126134
pr_debug("%s: going to call cdsp_loader_do\n", __func__);
127135
cdsp_loader_do(cdsp_private);
128136
} else if (boot == IMAGE_UNLOAD_CMD) {
129-
pr_debug("%s: going to call adsp_unloader\n", __func__);
137+
pr_debug("%s: going to call cdsp_unloader\n", __func__);
130138
cdsp_loader_unload(cdsp_private);
131139
}
132140
return count;
@@ -238,6 +246,8 @@ static int cdsp_loader_probe(struct platform_device *pdev)
238246
return ret;
239247
}
240248

249+
INIT_WORK(&cdsp_ldr_work, cdsp_load_fw);
250+
241251
return 0;
242252
}
243253

0 commit comments

Comments
 (0)