Skip to content

Commit

Permalink
slim-msm: Synchronize SSR callbacks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dilip Kota authored and andi34 committed Jul 29, 2017
1 parent ea8606e commit c5726aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/slimbus/slim-msm-ngd.c
Expand Up @@ -1266,11 +1266,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)
Expand All @@ -1279,7 +1281,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,
Expand Down Expand Up @@ -1433,6 +1437,7 @@ static int __devinit 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;
Expand Down
1 change: 1 addition & 0 deletions drivers/slimbus/slim-msm.h
Expand Up @@ -256,6 +256,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;
Expand Down

0 comments on commit c5726aa

Please sign in to comment.