Merge "msm: camera: icp: Protect a5 init/deinit calls" into camera-kernel.lnx.5.0

This commit is contained in:
Savita Patted
2021-07-06 08:58:21 -07:00
committed by Gerrit - the friendly Code Review server

View File

@@ -203,6 +203,13 @@ int cam_a5_init_hw(void *device_priv,
return -EINVAL; return -EINVAL;
} }
spin_lock_irqsave(&a5_dev->hw_lock, flags);
if (a5_dev->hw_state == CAM_HW_STATE_POWER_UP) {
spin_unlock_irqrestore(&a5_dev->hw_lock, flags);
return 0;
}
spin_unlock_irqrestore(&a5_dev->hw_lock, flags);
a5_soc_info = soc_info->soc_private; a5_soc_info = soc_info->soc_private;
cpas_vote.ahb_vote.type = CAM_VOTE_ABSOLUTE; cpas_vote.ahb_vote.type = CAM_VOTE_ABSOLUTE;
@@ -277,7 +284,10 @@ int cam_a5_deinit_hw(void *device_priv,
} }
spin_lock_irqsave(&a5_dev->hw_lock, flags); spin_lock_irqsave(&a5_dev->hw_lock, flags);
a5_dev->hw_state = CAM_HW_STATE_POWER_DOWN; if (a5_dev->hw_state == CAM_HW_STATE_POWER_DOWN) {
spin_unlock_irqrestore(&a5_dev->hw_lock, flags);
return 0;
}
spin_unlock_irqrestore(&a5_dev->hw_lock, flags); spin_unlock_irqrestore(&a5_dev->hw_lock, flags);
rc = cam_a5_disable_soc_resources(soc_info); rc = cam_a5_disable_soc_resources(soc_info);
@@ -291,6 +301,10 @@ int cam_a5_deinit_hw(void *device_priv,
core_info->cpas_start = false; core_info->cpas_start = false;
} }
spin_lock_irqsave(&a5_dev->hw_lock, flags);
a5_dev->hw_state = CAM_HW_STATE_POWER_DOWN;
spin_unlock_irqrestore(&a5_dev->hw_lock, flags);
return rc; return rc;
} }