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

Commit 83fb16d4 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: isp: Protect access to module_cfg register with lock"

parents bfffb26f 9bf08751
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -197,6 +197,7 @@ struct msm_vfe_core_ops {
		uint32_t *irq1_mask);
	void (*get_rdi_wm_mask)(struct vfe_device *vfe_dev,
		uint32_t *rdi_wm_mask);
	bool (*is_module_cfg_lock_needed)(uint32_t reg_offset);
};
struct msm_vfe_stats_ops {
	int (*get_stats_idx)(enum msm_isp_stats_type stats_type);
+8 −0
Original line number Diff line number Diff line
@@ -1282,6 +1282,12 @@ static void msm_vfe32_stats_cfg_ub(struct vfe_device *vfe_dev)
	return;
}

static bool msm_vfe32_is_module_cfg_lock_needed(
	uint32_t reg_offset)
{
	return false;
}

static void msm_vfe32_stats_enable_module(struct vfe_device *vfe_dev,
	uint32_t stats_mask, uint8_t enable)
{
@@ -1503,6 +1509,8 @@ struct msm_vfe_hardware_info vfe32_hw_info = {
			.get_error_mask = msm_vfe32_get_error_mask,
			.process_error_status = msm_vfe32_process_error_status,
			.get_overflow_mask = msm_vfe32_get_overflow_mask,
			.is_module_cfg_lock_needed =
				msm_vfe32_is_module_cfg_lock_needed,
		},
		.stats_ops = {
			.get_stats_idx = msm_vfe32_get_stats_idx,
+18 −0
Original line number Diff line number Diff line
@@ -1918,11 +1918,21 @@ static void msm_vfe40_stats_update_cgc_override(struct vfe_device *vfe_dev,
	msm_camera_io_w(module_cfg, vfe_dev->vfe_base + 0x974);
}

static bool msm_vfe40_is_module_cfg_lock_needed(
	uint32_t reg_offset)
{
	if (reg_offset == 0x18)
		return true;
	else
		return false;
}

static void msm_vfe40_stats_enable_module(struct vfe_device *vfe_dev,
	uint32_t stats_mask, uint8_t enable)
{
	int i;
	uint32_t module_cfg, module_cfg_mask = 0;
	unsigned long flags;

	for (i = 0; i < VFE40_NUM_STATS_TYPE; i++) {
		if ((stats_mask >> i) & 0x1) {
@@ -1948,12 +1958,18 @@ static void msm_vfe40_stats_enable_module(struct vfe_device *vfe_dev,
		}
	}

	/*
	 * For vfe40 stats and other modules share module_cfg register.
	 * Hence need to Grab lock.
	 */
	spin_lock_irqsave(&vfe_dev->shared_data_lock, flags);
	module_cfg = msm_camera_io_r(vfe_dev->vfe_base + 0x18);
	if (enable)
		module_cfg |= module_cfg_mask;
	else
		module_cfg &= ~module_cfg_mask;
	msm_camera_io_w(module_cfg, vfe_dev->vfe_base + 0x18);
	spin_unlock_irqrestore(&vfe_dev->shared_data_lock, flags);
}

static void msm_vfe40_stats_update_ping_pong_addr(
@@ -2165,6 +2181,8 @@ struct msm_vfe_hardware_info vfe40_hw_info = {
			.get_halt_restart_mask =
				msm_vfe40_get_halt_restart_mask,
			.process_error_status = msm_vfe40_process_error_status,
			.is_module_cfg_lock_needed =
				msm_vfe40_is_module_cfg_lock_needed,
		},
		.stats_ops = {
			.get_stats_idx = msm_vfe40_get_stats_idx,
+18 −0
Original line number Diff line number Diff line
@@ -1658,12 +1658,22 @@ static void msm_vfe44_stats_cfg_ub(struct vfe_device *vfe_dev)
	}
}

static bool msm_vfe44_is_module_cfg_lock_needed(
	uint32_t reg_offset)
{
	if (reg_offset == 0x18)
		return true;
	else
		return false;
}

static void msm_vfe44_stats_enable_module(struct vfe_device *vfe_dev,
	uint32_t stats_mask, uint8_t enable)
{
	int i;
	uint32_t module_cfg, module_cfg_mask = 0;
	uint32_t stats_cfg, stats_cfg_mask = 0;
	unsigned long flags;

	for (i = 0; i < VFE44_NUM_STATS_TYPE; i++) {
		if ((stats_mask >> i) & 0x1) {
@@ -1692,12 +1702,18 @@ static void msm_vfe44_stats_enable_module(struct vfe_device *vfe_dev,
		}
	}

	/*
	 * For vfe44 stats and other modules share module_cfg register.
	 * Hence need to Grab lock.
	 */
	spin_lock_irqsave(&vfe_dev->shared_data_lock, flags);
	module_cfg = msm_camera_io_r(vfe_dev->vfe_base + 0x18);
	if (enable)
		module_cfg |= module_cfg_mask;
	else
		module_cfg &= ~module_cfg_mask;
	msm_camera_io_w(module_cfg, vfe_dev->vfe_base + 0x18);
	spin_unlock_irqrestore(&vfe_dev->shared_data_lock, flags);

	stats_cfg = msm_camera_io_r(vfe_dev->vfe_base + 0x888);
	if (enable)
@@ -1969,6 +1985,8 @@ struct msm_vfe_hardware_info vfe44_hw_info = {
			.get_halt_restart_mask =
				msm_vfe44_get_halt_restart_mask,
			.process_error_status = msm_vfe44_process_error_status,
			.is_module_cfg_lock_needed =
				msm_vfe44_is_module_cfg_lock_needed,
		},
		.stats_ops = {
			.get_stats_idx = msm_vfe44_get_stats_idx,
+8 −0
Original line number Diff line number Diff line
@@ -1786,6 +1786,12 @@ static void msm_vfe46_stats_update_cgc_override(struct vfe_device *vfe_dev,
	msm_camera_io_w(module_cfg, vfe_dev->vfe_base + 0x30);
}

static bool msm_vfe46_is_module_cfg_lock_needed(
	uint32_t reg_offset)
{
	return false;
}

static void msm_vfe46_stats_enable_module(struct vfe_device *vfe_dev,
	uint32_t stats_mask, uint8_t enable)
{
@@ -2055,6 +2061,8 @@ struct msm_vfe_hardware_info vfe46_hw_info = {
			.get_halt_restart_mask =
				msm_vfe46_get_halt_restart_mask,
			.process_error_status = msm_vfe46_process_error_status,
			.is_module_cfg_lock_needed =
				msm_vfe46_is_module_cfg_lock_needed,
		},
		.stats_ops = {
			.get_stats_idx = msm_vfe46_get_stats_idx,
Loading