IR_handle(av7110, swahw32(irdebi(av7110, DEBINOSWAP, Reserved, 0, 4))); 
if (av7110->ir_handler) av7110->ir_handler(av7110, swahw32(irdebi(av7110, DEBINOSWAP, Reserved, 0, 4))); 
static void gpioirq(unsigned long data){	struct av7110 *av7110 = (struct av7110 *) data;	u32 rxbuf, txbuf;	int len;	if (av7110->debitype != -1)		/* we shouldn't get any irq while a debi xfer is running */		printk("dvb-ttpci: GPIO0 irq oops @ %ld, psr:0x%08x, ssr:0x%08x\n",		       jiffies, saa7146_read(av7110->dev, PSR),		       saa7146_read(av7110->dev, SSR));	if (saa7146_wait_for_debi_done(av7110->dev, 0)) {		printk(KERN_ERR "%s: saa7146_wait_for_debi_done timed out\n", __FUNCTION__);		BUG(); /* maybe we should try resetting the debi? */	}	spin_lock(&av7110->debilock);	ARM_ClearIrq(av7110);	/* see what the av7110 wants */	av7110->debitype = irdebi(av7110, DEBINOSWAP, IRQ_STATE, 0, 2);	av7110->debilen  = irdebi(av7110, DEBINOSWAP, IRQ_STATE_EXT, 0, 2);	rxbuf = irdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2);	txbuf = irdebi(av7110, DEBINOSWAP, TX_BUFF, 0, 2);	len = (av7110->debilen + 3) & ~3;	print_time("gpio");	dprintk(8, "GPIO0 irq 0x%04x %d\n", av7110->debitype, av7110->debilen);	switch (av7110->debitype & 0xff) {	case DATA_TS_PLAY:	case DATA_PES_PLAY:		break;	case DATA_MPEG_VIDEO_EVENT:	{		u32 h_ar;		struct video_event event;		av7110->video_size.w = irdebi(av7110, DEBINOSWAP, STATUS_MPEG_WIDTH, 0, 2);		h_ar = irdebi(av7110, DEBINOSWAP, STATUS_MPEG_HEIGHT_AR, 0, 2);		iwdebi(av7110, DEBINOSWAP, IRQ_STATE_EXT, 0, 2);		iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2);		av7110->video_size.h = h_ar & 0xfff;		dprintk(8, "GPIO0 irq: DATA_MPEG_VIDEO_EVENT: w/h/ar = %u/%u/%u\n",			av7110->video_size.w,			av7110->video_size.h,			av7110->video_size.aspect_ratio);		event.type = VIDEO_EVENT_SIZE_CHANGED;		event.u.size.w = av7110->video_size.w;		event.u.size.h = av7110->video_size.h;		switch ((h_ar >> 12) & 0xf)		{		case 3:			av7110->video_size.aspect_ratio = VIDEO_FORMAT_16_9;			event.u.size.aspect_ratio = VIDEO_FORMAT_16_9;			av7110->videostate.video_format = VIDEO_FORMAT_16_9;			break;		case 4:			av7110->video_size.aspect_ratio = VIDEO_FORMAT_221_1;			event.u.size.aspect_ratio = VIDEO_FORMAT_221_1;			av7110->videostate.video_format = VIDEO_FORMAT_221_1;			break;		default:			av7110->video_size.aspect_ratio = VIDEO_FORMAT_4_3;			event.u.size.aspect_ratio = VIDEO_FORMAT_4_3;			av7110->videostate.video_format = VIDEO_FORMAT_4_3;		}		dvb_video_add_event(av7110, &event);		break;	}	case DATA_CI_PUT:	{		int avail;		struct dvb_ringbuffer *cibuf = &av7110->ci_wbuffer;		avail = dvb_ringbuffer_avail(cibuf);		if (avail <= 2) {			iwdebi(av7110, DEBINOSWAP, IRQ_STATE_EXT, 0, 2);			iwdebi(av7110, DEBINOSWAP, TX_LEN, 0, 2);			iwdebi(av7110, DEBINOSWAP, TX_BUFF, 0, 2);			break;		}		len = DVB_RINGBUFFER_PEEK(cibuf, 0) << 8;		len |= DVB_RINGBUFFER_PEEK(cibuf, 1);		if (avail < len + 2) {			iwdebi(av7110, DEBINOSWAP, IRQ_STATE_EXT, 0, 2);			iwdebi(av7110, DEBINOSWAP, TX_LEN, 0, 2);			iwdebi(av7110, DEBINOSWAP, TX_BUFF, 0, 2);			break;		}		DVB_RINGBUFFER_SKIP(cibuf, 2);		dvb_ringbuffer_read(cibuf, av7110->debi_virt, len, 0);		iwdebi(av7110, DEBINOSWAP, TX_LEN, len, 2);		iwdebi(av7110, DEBINOSWAP, IRQ_STATE_EXT, len, 2);		dprintk(8, "DMA: CI\n");		start_debi_dma(av7110, DEBI_WRITE, DPRAM_BASE + txbuf, len);		spin_unlock(&av7110->debilock);		wake_up(&cibuf->queue);		return;	}	case DATA_MPEG_PLAY:		if (!av7110->playing) {			iwdebi(av7110, DEBINOSWAP, IRQ_STATE_EXT, 0, 2);			iwdebi(av7110, DEBINOSWAP, TX_LEN, 0, 2);			iwdebi(av7110, DEBINOSWAP, TX_BUFF, 0, 2);			break;		}		len = 0;		if (av7110->debitype & 0x100) {			spin_lock(&av7110->aout.lock);			len = av7110_pes_play(av7110->debi_virt, &av7110->aout, 2048);			spin_unlock(&av7110->aout.lock);		}		if (len <= 0 && (av7110->debitype & 0x200)		    &&av7110->videostate.play_state != VIDEO_FREEZED) {			spin_lock(&av7110->avout.lock);			len = av7110_pes_play(av7110->debi_virt, &av7110->avout, 2048);			spin_unlock(&av7110->avout.lock);		}		if (len <= 0) {			iwdebi(av7110, DEBINOSWAP, IRQ_STATE_EXT, 0, 2);			iwdebi(av7110, DEBINOSWAP, TX_LEN, 0, 2);			iwdebi(av7110, DEBINOSWAP, TX_BUFF, 0, 2);			break;		}		dprintk(8, "GPIO0 PES_PLAY len=%04x\n", len);		iwdebi(av7110, DEBINOSWAP, TX_LEN, len, 2);		iwdebi(av7110, DEBINOSWAP, IRQ_STATE_EXT, len, 2);		dprintk(8, "DMA: MPEG_PLAY\n");		start_debi_dma(av7110, DEBI_WRITE, DPRAM_BASE + txbuf, len);		spin_unlock(&av7110->debilock);		return;	case DATA_BMP_LOAD:		len = av7110->debilen;		dprintk(8, "gpio DATA_BMP_LOAD len %d\n", len);		if (!len) {			av7110->bmp_state = BMP_LOADED;			iwdebi(av7110, DEBINOSWAP, IRQ_STATE_EXT, 0, 2);			iwdebi(av7110, DEBINOSWAP, TX_LEN, 0, 2);			iwdebi(av7110, DEBINOSWAP, TX_BUFF, 0, 2);			wake_up(&av7110->bmpq);			dprintk(8, "gpio DATA_BMP_LOAD done\n");			break;		}		if (len > av7110->bmplen)			len = av7110->bmplen;		if (len > 2 * 1024)			len = 2 * 1024;		iwdebi(av7110, DEBINOSWAP, TX_LEN, len, 2);		iwdebi(av7110, DEBINOSWAP, IRQ_STATE_EXT, len, 2);		memcpy(av7110->debi_virt, av7110->bmpbuf+av7110->bmpp, len);		av7110->bmpp += len;		av7110->bmplen -= len;		dprintk(8, "gpio DATA_BMP_LOAD DMA len %d\n", len);		start_debi_dma(av7110, DEBI_WRITE, DPRAM_BASE+txbuf, len);		spin_unlock(&av7110->debilock);		return;	case DATA_CI_GET:	case DATA_COMMON_INTERFACE:	case DATA_FSECTION:	case DATA_IPMPE:	case DATA_PIPING:		if (!len || len > 4 * 1024) {			iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2);			break;		}		/* fall through */	case DATA_TS_RECORD:	case DATA_PES_RECORD:		dprintk(8, "DMA: TS_REC etc.\n");		start_debi_dma(av7110, DEBI_READ, DPRAM_BASE+rxbuf, len);		spin_unlock(&av7110->debilock);		return;	case DATA_DEBUG_MESSAGE:		if (!len || len > 0xff) {			iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2);			break;		}		start_debi_dma(av7110, DEBI_READ, Reserved, len);		spin_unlock(&av7110->debilock);		return;	case DATA_IRCOMMAND:		IR_handle(av7110,			  swahw32(irdebi(av7110, DEBINOSWAP, Reserved, 0, 4)));		iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2);		break;	default:		printk("dvb-ttpci: gpioirq unknown type=%d len=%d\n",		       av7110->debitype, av7110->debilen);		break;	}	av7110->debitype = -1;	ARM_ClearMailBox(av7110);	spin_unlock(&av7110->debilock);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/03388ae30260475650bab24223151397afb72ec9/av7110.c/clean/drivers/media/dvb/ttpci/av7110.c