msm: camera: cci: Fix CCI Timeout during burst_read concurrency

During burst read concurrency, is_burst_read variable not updated
properly leading to missing th_complete signal. is_burst_read variable
updated per master to avoid concurrency issue.

CRs-Fixed: 2962232
Change-Id: Id741d48e0b9a6987b4aa7bc7361daf555d9bc587
Signed-off-by: Anil Kumar Kanakanti <akanakan@codeaurora.org>
This commit is contained in:
Anil Kumar Kanakanti 2021-06-01 19:56:41 +05:30
commit 0c570733ee
4 changed files with 11 additions and 12 deletions

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
@ -985,6 +985,7 @@ static int32_t cam_cci_burst_read(struct v4l2_subdev *sd,
}
mutex_lock(&cci_dev->cci_master_info[master].mutex_q[queue]);
cci_dev->is_burst_read[master] = true;
reinit_completion(&cci_dev->cci_master_info[master].report_q[queue]);
soc_info = &cci_dev->soc_info;
@ -1256,6 +1257,7 @@ static int32_t cam_cci_read(struct v4l2_subdev *sd,
}
mutex_lock(&cci_dev->cci_master_info[master].mutex_q[queue]);
cci_dev->is_burst_read[master] = false;
reinit_completion(&cci_dev->cci_master_info[master].report_q[queue]);
soc_info = &cci_dev->soc_info;
@ -1622,7 +1624,7 @@ static int32_t cam_cci_read_bytes_v_1_2(struct v4l2_subdev *sd,
else
read_cfg->num_byte = read_bytes;
cci_dev->is_burst_read = false;
cci_dev->is_burst_read[master] = false;
rc = cam_cci_read(sd, c_ctrl);
if (rc) {
CAM_ERR(CAM_CCI, "failed to read rc:%d", rc);
@ -1639,7 +1641,6 @@ static int32_t cam_cci_read_bytes_v_1_2(struct v4l2_subdev *sd,
} while (read_bytes);
ERROR:
cci_dev->is_burst_read = false;
return rc;
}
@ -1704,10 +1705,8 @@ static int32_t cam_cci_read_bytes(struct v4l2_subdev *sd,
read_cfg->num_byte = read_bytes;
if (read_cfg->num_byte >= CCI_READ_MAX) {
cci_dev->is_burst_read = true;
rc = cam_cci_burst_read(sd, c_ctrl);
} else {
cci_dev->is_burst_read = false;
rc = cam_cci_read(sd, c_ctrl);
}
if (rc) {
@ -1726,7 +1725,6 @@ static int32_t cam_cci_read_bytes(struct v4l2_subdev *sd,
} while (read_bytes);
ERROR:
cci_dev->is_burst_read = false;
return rc;
}

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
*/
#include "cam_cci_dev.h"
@ -112,7 +112,7 @@ irqreturn_t cam_cci_irq(int irq_num, void *data)
(!rd_done_th_assert)) {
cci_dev->cci_master_info[MASTER_0].status = 0;
rd_done_th_assert = true;
if (cci_dev->is_burst_read)
if (cci_dev->is_burst_read[MASTER_0])
complete(
&cci_dev->cci_master_info[MASTER_0].th_complete);
complete(&cci_dev->cci_master_info[MASTER_0].rd_done);
@ -168,7 +168,7 @@ irqreturn_t cam_cci_irq(int irq_num, void *data)
(!rd_done_th_assert)) {
cci_dev->cci_master_info[MASTER_1].status = 0;
rd_done_th_assert = true;
if (cci_dev->is_burst_read)
if (cci_dev->is_burst_read[MASTER_1])
complete(
&cci_dev->cci_master_info[MASTER_1].th_complete);
complete(&cci_dev->cci_master_info[MASTER_1].rd_done);

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
*/
#ifndef _CAM_CCI_DEV_H_
@ -224,7 +224,7 @@ struct cci_device {
uint32_t cpas_handle;
uint32_t irq_status1;
spinlock_t lock_status;
bool is_burst_read;
bool is_burst_read[MASTER_MAX];
uint32_t irqs_disabled;
struct mutex init_mutex;
uint64_t dump_en;

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
*/
#include "cam_cci_dev.h"
@ -76,6 +76,7 @@ static int cam_cci_init_master(struct cci_device *cci_dev,
cci_dev->cci_master_info[master].status = 0;
cci_dev->cci_master_info[master].is_initilized = true;
cci_dev->is_burst_read[master] = false;
}
return 0;