platform: nvadsp: dfs: add os status checks

Add checks for adsp os running state in adsp_override_freq()
and update_freq(). If adsp os is not running state then
communication with ADSP for freq update will not work. This
could result in failure in updating ADSP CPU frequency.

Bug 200295526
Bug 200322504

Change-Id: Iea25f542b080ac22faf562f35e82ceede43bbc83
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1526340
(cherry picked from commit 2aea120c7c1385e14f36e5fa707594e3ab6e2294)
Reviewed-on: https://git-master.nvidia.com/r/1527565
Reviewed-on: https://git-master.nvidia.com/r/1537337
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Nitin Kumbhar
2017-07-21 17:23:18 +05:30
committed by Laxman Dewangan
parent 5e4dff249f
commit 0081a6e97c

View File

@@ -115,8 +115,14 @@ static DEFINE_MUTEX(policy_mutex);
static bool is_os_running(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct nvadsp_drv_data *drv_data = platform_get_drvdata(pdev);
struct platform_device *pdev;
struct nvadsp_drv_data *drv_data;
if (!dev)
return false;
pdev = to_platform_device(dev);
drv_data = platform_get_drvdata(pdev);
if (!drv_data->adsp_os_running) {
dev_dbg(&pdev->dev, "%s: adsp os is not loaded\n", __func__);
@@ -324,9 +330,14 @@ static unsigned long update_freq(unsigned long freq_khz)
int index;
int ret;
if (!is_os_running(device)) {
dev_err(device, "adsp os is not running\n");
return 0;
}
tfreq_hz = adsp_get_target_freq(freq_khz * 1000, &index);
if (!tfreq_hz) {
dev_info(device, "unable get the target freq\n");
dev_err(device, "unable get the target freq\n");
return 0;
}
@@ -714,6 +725,11 @@ unsigned long adsp_override_freq(unsigned long req_freq_khz)
unsigned long ret_freq = 0, freq;
int index;
if (!is_os_running(device)) {
pr_err("%s: adsp os is not in running state.\n", __func__);
return 0;
}
mutex_lock(&policy_mutex);
freq = req_freq_khz;