コード例 #1
0
ファイル: i830_irq.c プロジェクト: kzlin129/tt-gpl
static int i830_wait_irq(drm_device_t *dev, int irq_nr)
{
  	drm_i830_private_t *dev_priv = 
	   (drm_i830_private_t *)dev->dev_private;
	DECLARE_WAITQUEUE(entry, current);
	unsigned long end = jiffies + HZ*3;
	int ret = 0;

	DRM_DEBUG("%s\n", __FUNCTION__);

 	if (atomic_read(&dev_priv->irq_received) >= irq_nr)  
 		return 0; 

	dev_priv->sarea_priv->perf_boxes |= I830_BOX_WAIT;

	add_wait_queue(&dev_priv->irq_queue, &entry);

	for (;;) {
		__set_current_state(TASK_INTERRUPTIBLE);
	   	if (atomic_read(&dev_priv->irq_received) >= irq_nr) 
		   break;
		if((signed)(end - jiffies) <= 0) {
			DRM_ERROR("timeout iir %x imr %x ier %x hwstam %x\n",
				  I830_READ16( I830REG_INT_IDENTITY_R ),
				  I830_READ16( I830REG_INT_MASK_R ),
				  I830_READ16( I830REG_INT_ENABLE_R ),
				  I830_READ16( I830REG_HWSTAM ));

		   	ret = -EBUSY;	/* Lockup?  Missed irq? */
			break;
		}
	      	schedule_timeout(HZ*3);
	      	if (signal_pending(current)) {
		   	ret = -EINTR;
			break;
		}
	}

	__set_current_state(TASK_RUNNING);
	remove_wait_queue(&dev_priv->irq_queue, &entry);
	return ret;
}
コード例 #2
0
ファイル: i830_irq.c プロジェクト: PennPanda/linux-repo
irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS)
{
	struct drm_device *dev = (struct drm_device *) arg;
	drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
	u16 temp;

	temp = I830_READ16(I830REG_INT_IDENTITY_R);
	DRM_DEBUG("%x\n", temp);

	if (!(temp & 2))
		return IRQ_NONE;

	I830_WRITE16(I830REG_INT_IDENTITY_R, temp);

	atomic_inc(&dev_priv->irq_received);
	wake_up_interruptible(&dev_priv->irq_queue);

	return IRQ_HANDLED;
}