slim-msm : Synchronize SSR callbacks

Subsystem will restart within short timeframe.
Synchronise subsytem up/down callback notifications
to avoid functionality failures.
Use mutex locks to achieve synchronization.

Change-Id: I5881c7d468507bb8402a2e9f8178b9c31e57e8a5
Signed-off-by: Dilip Kota <dkota@codeaurora.org>
This commit is contained in:
Dilip Kota 2016-03-21 11:28:51 +05:30 committed by Shreyas Narayan
parent 8e423c27f0
commit d22bc5b5a8
2 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2016,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
@ -1295,11 +1295,13 @@ static void ngd_adsp_down(struct work_struct *work)
struct slim_controller *ctrl = &dev->ctrl;
struct slim_device *sbdev;
mutex_lock(&dev->ssr_lock);
ngd_slim_enable(dev, false);
/* device up should be called again after SSR */
list_for_each_entry(sbdev, &ctrl->devs, dev_list)
slim_report_absent(sbdev);
SLIM_INFO(dev, "SLIM ADSP SSR (DOWN) done\n");
mutex_unlock(&dev->ssr_lock);
}
static void ngd_adsp_up(struct work_struct *work)
@ -1308,7 +1310,9 @@ static void ngd_adsp_up(struct work_struct *work)
container_of(work, struct msm_slim_qmi, ssr_up);
struct msm_slim_ctrl *dev =
container_of(qmi, struct msm_slim_ctrl, qmi);
mutex_lock(&dev->ssr_lock);
ngd_slim_enable(dev, true);
mutex_unlock(&dev->ssr_lock);
}
static ssize_t show_mask(struct device *device, struct device_attribute *attr,
@ -1462,6 +1466,7 @@ static int ngd_slim_probe(struct platform_device *pdev)
init_completion(&dev->ctrl_up);
mutex_init(&dev->tx_lock);
mutex_init(&dev->tx_buf_lock);
mutex_init(&dev->ssr_lock);
spin_lock_init(&dev->rx_lock);
dev->ee = 1;
dev->irq = irq->start;

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2016,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
@ -258,6 +258,7 @@ struct msm_slim_ctrl {
struct clk *hclk;
struct mutex tx_lock;
struct mutex tx_buf_lock;
struct mutex ssr_lock;
u8 pgdla;
enum msm_slim_msgq use_rx_msgqs;
enum msm_slim_msgq use_tx_msgqs;