msm: camera: isp : Fix race condition in close sequence

Serializing reset_hw and reset_irq, to avoid race condition.

Change-Id: I0fd4fc8cfcdef9fe0e0679c3cee44b2dddc7b506
Signed-off-by: Ramesh V <ramev@codeaurora.org>
This commit is contained in:
Ramesh V 2017-05-09 16:57:09 +05:30
parent 3d82d66409
commit cc12a0966b
3 changed files with 9 additions and 0 deletions

View file

@ -638,6 +638,7 @@ int vfe_hw_probe(struct platform_device *pdev)
spin_lock_init(&vfe_dev->shared_data_lock); spin_lock_init(&vfe_dev->shared_data_lock);
spin_lock_init(&vfe_dev->reg_update_lock); spin_lock_init(&vfe_dev->reg_update_lock);
spin_lock_init(&req_history_lock); spin_lock_init(&req_history_lock);
spin_lock_init(&vfe_dev->completion_lock);
media_entity_init(&vfe_dev->subdev.sd.entity, 0, NULL, 0); media_entity_init(&vfe_dev->subdev.sd.entity, 0, NULL, 0);
vfe_dev->subdev.sd.entity.type = MEDIA_ENT_T_V4L2_SUBDEV; vfe_dev->subdev.sd.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
vfe_dev->subdev.sd.entity.group_id = MSM_CAMERA_SUBDEV_VFE; vfe_dev->subdev.sd.entity.group_id = MSM_CAMERA_SUBDEV_VFE;

View file

@ -793,6 +793,7 @@ struct vfe_device {
struct mutex core_mutex; struct mutex core_mutex;
spinlock_t shared_data_lock; spinlock_t shared_data_lock;
spinlock_t reg_update_lock; spinlock_t reg_update_lock;
spinlock_t completion_lock;
/* Tasklet info */ /* Tasklet info */
atomic_t irq_cnt; atomic_t irq_cnt;

View file

@ -437,9 +437,13 @@ void msm_vfe47_clear_status_reg(struct vfe_device *vfe_dev)
void msm_vfe47_process_reset_irq(struct vfe_device *vfe_dev, void msm_vfe47_process_reset_irq(struct vfe_device *vfe_dev,
uint32_t irq_status0, uint32_t irq_status1) uint32_t irq_status0, uint32_t irq_status1)
{ {
unsigned long flags;
if (irq_status0 & (1 << 31)) { if (irq_status0 & (1 << 31)) {
spin_lock_irqsave(&vfe_dev->completion_lock, flags);
complete(&vfe_dev->reset_complete); complete(&vfe_dev->reset_complete);
vfe_dev->reset_pending = 0; vfe_dev->reset_pending = 0;
spin_unlock_irqrestore(&vfe_dev->completion_lock, flags);
} }
} }
@ -750,8 +754,11 @@ long msm_vfe47_reset_hardware(struct vfe_device *vfe_dev,
{ {
long rc = 0; long rc = 0;
uint32_t reset; uint32_t reset;
unsigned long flags;
spin_lock_irqsave(&vfe_dev->completion_lock, flags);
init_completion(&vfe_dev->reset_complete); init_completion(&vfe_dev->reset_complete);
spin_unlock_irqrestore(&vfe_dev->completion_lock, flags);
if (blocking_call) if (blocking_call)
vfe_dev->reset_pending = 1; vfe_dev->reset_pending = 1;