Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 599d7811 authored by Kyle Yan's avatar Kyle Yan Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: qcom: pil-loaders: move pil loading of ADSP & CDSP to workqueue" into msm-4.9

parents 3de2453c 07169fd3
Loading
Loading
Loading
Loading
+12 −3
Original line number Original line Diff line number Diff line
/*
/*
 * 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
 * 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
 * it under the terms of the GNU General Public License version 2 and
@@ -20,6 +20,8 @@
#include <linux/qdsp6v2/apr.h>
#include <linux/qdsp6v2/apr.h>
#include <linux/of_device.h>
#include <linux/of_device.h>
#include <linux/sysfs.h>
#include <linux/sysfs.h>
#include <linux/workqueue.h>

#include <soc/qcom/subsystem_restart.h>
#include <soc/qcom/subsystem_restart.h>


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


static struct work_struct adsp_ldr_work;
static struct platform_device *adsp_private;
static struct platform_device *adsp_private;
static void adsp_loader_unload(struct platform_device *pdev);
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;
	struct adsp_loader_private *priv = NULL;


	const char *adsp_dt = "qcom,adsp-state";
	const char *adsp_dt = "qcom,adsp-state";
@@ -146,6 +149,10 @@ static void adsp_loader_do(struct platform_device *pdev)
	dev_err(&pdev->dev, "%s: Q6 image loading failed\n", __func__);
	dev_err(&pdev->dev, "%s: Q6 image loading failed\n", __func__);
}
}


static void adsp_loader_do(struct platform_device *pdev)
{
	schedule_work(&adsp_ldr_work);
}


static ssize_t adsp_boot_store(struct kobject *kobj,
static ssize_t adsp_boot_store(struct kobject *kobj,
	struct kobj_attribute *attr,
	struct kobj_attribute *attr,
@@ -272,6 +279,8 @@ static int adsp_loader_probe(struct platform_device *pdev)
		return ret;
		return ret;
	}
	}


	INIT_WORK(&adsp_ldr_work, adsp_load_fw);

	return 0;
	return 0;
}
}


+13 −4
Original line number Original line Diff line number Diff line
@@ -19,6 +19,8 @@
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/of_device.h>
#include <linux/of_device.h>
#include <linux/sysfs.h>
#include <linux/sysfs.h>
#include <linux/workqueue.h>

#include <soc/qcom/subsystem_restart.h>
#include <soc/qcom/subsystem_restart.h>


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


static u32 cdsp_state = CDSP_SUBSYS_DOWN;
static u32 cdsp_state = CDSP_SUBSYS_DOWN;
static struct platform_device *cdsp_private;
static struct platform_device *cdsp_private;
static struct work_struct cdsp_ldr_work;
static void cdsp_loader_unload(struct platform_device *pdev);
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;
	struct cdsp_loader_private *priv = NULL;


	int rc = 0;
	int rc = 0;
@@ -99,14 +103,17 @@ static int cdsp_loader_do(struct platform_device *pdev)
		}
		}


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


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


static void cdsp_loader_do(struct platform_device *pdev)
{
	schedule_work(&cdsp_ldr_work);
}


static ssize_t cdsp_boot_store(struct kobject *kobj,
static ssize_t cdsp_boot_store(struct kobject *kobj,
	struct kobj_attribute *attr,
	struct kobj_attribute *attr,
@@ -124,7 +131,7 @@ static ssize_t cdsp_boot_store(struct kobject *kobj,
		pr_debug("%s: going to call cdsp_loader_do\n", __func__);
		pr_debug("%s: going to call cdsp_loader_do\n", __func__);
		cdsp_loader_do(cdsp_private);
		cdsp_loader_do(cdsp_private);
	} else if (boot == IMAGE_UNLOAD_CMD) {
	} 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);
		cdsp_loader_unload(cdsp_private);
	}
	}
	return count;
	return count;
@@ -236,6 +243,8 @@ static int cdsp_loader_probe(struct platform_device *pdev)
		return ret;
		return ret;
	}
	}


	INIT_WORK(&cdsp_ldr_work, cdsp_load_fw);

	return 0;
	return 0;
}
}