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

Commit c0c8730b authored by Ziyu Jian's avatar Ziyu Jian
Browse files

msm: camera: cci: Add mutex_q lock for cci_init



cci_write is being executed meanwhile cci_init is called,
which will maybe cause cci timeout since cci_init will do
reset operation. So add the mutex_q lock which is used by
cci_write into cci_init.

Change-Id: I81c67f27205f4250f08ca7ab38799f6454578dbd
Signed-off-by: default avatarZiyu Jian <ziyujiang@codeaurora.org>
parent 5a914572
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, 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
@@ -51,6 +51,10 @@ int cam_cci_init(struct v4l2_subdev *sd,
		CAM_DBG(CAM_CCI, "master %d", master);
		if (master < MASTER_MAX && master >= 0) {
			mutex_lock(&cci_dev->cci_master_info[master].mutex);
			mutex_lock(&cci_dev->
				cci_master_info[master].mutex_q[QUEUE_0]);
			mutex_lock(&cci_dev->
				cci_master_info[master].mutex_q[QUEUE_1]);
			flush_workqueue(cci_dev->write_wq[master]);
			/* Re-initialize the completion */
			reinit_completion(
@@ -73,6 +77,10 @@ int cam_cci_init(struct v4l2_subdev *sd,
				CCI_TIMEOUT);
			if (rc <= 0)
				CAM_ERR(CAM_CCI, "wait failed %d", rc);
			mutex_unlock(&cci_dev->
				cci_master_info[master].mutex_q[QUEUE_1]);
			mutex_unlock(&cci_dev->
				cci_master_info[master].mutex_q[QUEUE_0]);
			mutex_unlock(&cci_dev->cci_master_info[master].mutex);
		}
		return 0;