linux-5.0.1/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c
/**
 * _dpu_core_irq_enable - enable core interrupt given by the index
 * @dpu_kms:		Pointer to dpu kms context
 * @irq_idx:		interrupt index
 */
enable core interrupt given by the index
@dpu_kms:            Pointer to dpu kms context
@irq_idx:            interrupt index
enable core interrupt given by the index @dpu_kms : Pointer to dpu kms context @irq_idx : interrupt index
static int _dpu_core_irq_enable(struct dpu_kms *dpu_kms, int irq_idx)
{
	unsigned long irq_flags;
	int ret = 0, enable_count;
	if (!dpu_kms || !dpu_kms->hw_intr ||
			!dpu_kms->irq_obj.enable_counts ||
			!dpu_kms->irq_obj.irq_counts) {
		DPU_ERROR("invalid params\n");
		return -EINVAL;
	}
	if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->irq_idx_tbl_size) {
		DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx);
		return -EINVAL;
	}
	enable_count = atomic_read(&dpu_kms->irq_obj.enable_counts[irq_idx]);
	DRM_DEBUG_KMS("irq_idx=%d enable_count=%d\n", irq_idx, enable_count);
	trace_dpu_core_irq_enable_idx(irq_idx, enable_count);
	if (atomic_inc_return(&dpu_kms->irq_obj.enable_counts[irq_idx]) == 1) {
		ret = dpu_kms->hw_intr->ops.enable_irq(
				dpu_kms->hw_intr,
				irq_idx);
		if (ret)
			DPU_ERROR("Fail to enable IRQ for irq_idx:%d\n",
					irq_idx);
		DPU_DEBUG("irq_idx=%d ret=%d\n", irq_idx, ret);
		spin_lock_irqsave(&dpu_kms->irq_obj.cb_lock, irq_flags);
		if (list_empty(&dpu_kms->irq_obj.irq_cb_tbl[irq_idx]))
			DPU_ERROR("irq_idx=%d enabled with no callback\n",
					irq_idx);
		spin_unlock_irqrestore(&dpu_kms->irq_obj.cb_lock, irq_flags);
	}
	return ret;
}
static int _dpu_core_irq_enable ( struct dpu_kms * dpu_kms , int irq_idx ) { unsigned long irq_flags ; int ret = 0 , enable_count ; if ( ! dpu_kms || ! dpu_kms -> hw_intr || ! dpu_kms -> irq_obj . enable_counts || ! dpu_kms -> irq_obj . irq_counts ) { DPU_ERROR ( " \n " ) ; return - EINVAL ; } if ( irq_idx < 0 || irq_idx >= dpu_kms -> hw_intr -> irq_idx_tbl_size ) { DPU_ERROR ( " \n " , irq_idx ) ; return - EINVAL ; } enable_count = atomic_read ( & dpu_kms -> irq_obj . enable_counts [ irq_idx ] ) ; DRM_DEBUG_KMS ( " \n " , irq_idx , enable_count ) ; trace_dpu_core_irq_enable_idx ( irq_idx , enable_count ) ; if ( atomic_inc_return ( & dpu_kms -> irq_obj . enable_counts [ irq_idx ] ) == 1 ) { ret = dpu_kms -> hw_intr -> ops . enable_irq ( dpu_kms -> hw_intr , irq_idx ) ; if ( ret ) DPU_ERROR ( " \n " , irq_idx ) ; DPU_DEBUG ( " \n " , irq_idx , ret ) ; spin_lock_irqsave ( & dpu_kms -> irq_obj . cb_lock , irq_flags ) ; if ( list_empty ( & dpu_kms -> irq_obj . irq_cb_tbl [ irq_idx ] ) ) DPU_ERROR ( " \n " , irq_idx ) ; spin_unlock_irqrestore ( & dpu_kms -> irq_obj . cb_lock , irq_flags ) ; } return ret ; }
_dpu_core_irq_enable - enable core interrupt given by the index
 @dpu_kms:            Pointer to dpu kms context
 @irq_idx:            interrupt index
_dpu_core_irq_enable - enable core interrupt given by the index @dpu_kms : Pointer to dpu kms context @irq_idx : interrupt index
/* empty callback list but interrupt is enabled */