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

Commit aa8b8721 authored by Ravikishore Pampana's avatar Ravikishore Pampana
Browse files

msm: camera: ope: Protect ope hw reset with mutex



In flush or error cases, there is possibility that flush all and
error case can concurrently request for ope reset. This ope reset
process command may execute parallelly and cause list corruption issues.
Add mutex to ope hw before doing the reset.

CRs-Fixed: 2599233
Change-Id: Icd7cb809901a84169ea13d496689904a885b4622
Signed-off-by: default avatarRavikishore Pampana <rpampana@codeaurora.org>
parent b2da4b68
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/of.h>
@@ -44,7 +44,8 @@ static int cam_ope_top_reset(struct ope_hw *ope_hw_info,
	top_reg = ope_hw_info->top_reg;
	top_reg_val = ope_hw_info->top_reg_val;

	init_completion(&ope_top_info.reset_complete);
	mutex_lock(&ope_top_info.ope_hw_mutex);
	reinit_completion(&ope_top_info.reset_complete);

	/* enable interrupt mask */
	cam_io_w_mb(top_reg_val->irq_mask,
@@ -70,6 +71,7 @@ static int cam_ope_top_reset(struct ope_hw *ope_hw_info,
	cam_io_w_mb(top_reg_val->irq_mask,
		ope_hw_info->top_reg->base + top_reg->irq_mask);

	mutex_unlock(&ope_top_info.ope_hw_mutex);
	return rc;
}

+3 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 */

#ifndef OPE_TOP_H
@@ -32,10 +32,12 @@ struct ope_top_ctx {
 * @ope_hw_info:    OPE hardware info
 * @top_ctx:        OPE top context
 * @reset_complete: Reset complete flag
 * @ope_mutex:      OPE hardware mutex
 */
struct ope_top {
	struct ope_hw *ope_hw_info;
	struct ope_top_ctx top_ctx[OPE_CTX_MAX];
	struct completion reset_complete;
	struct mutex      ope_hw_mutex;
};
#endif /* OPE_TOP_H */