diff options
author | Johannes Stezenbach <devnull@localhost> | 2004-01-05 18:25:59 +0000 |
---|---|---|
committer | Johannes Stezenbach <devnull@localhost> | 2004-01-05 18:25:59 +0000 |
commit | af775cd2887be0c964935d83debb2dd4d9926546 (patch) | |
tree | 44461430a6c71b125bd94295df3836234a953c1d | |
parent | 55306535d34ac2209d4dd76428d2ee388cfe449b (diff) | |
download | mediapointer-dvb-s2-af775cd2887be0c964935d83debb2dd4d9926546.tar.gz mediapointer-dvb-s2-af775cd2887be0c964935d83debb2dd4d9926546.tar.bz2 |
- removed now useless test for current->files in recover_arm()
- coding style / formatting fixes (mostly whitespace)
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110.c | 508 |
1 files changed, 252 insertions, 256 deletions
diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c index 295b25b06..fa83bcd0f 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.c +++ b/linux/drivers/media/dvb/ttpci/av7110.c @@ -74,9 +74,9 @@ static void restart_feeds(struct av7110 *av7110); int av7110_debug = 0; -static int vidmode=CVBS_RGB_OUT; +static int vidmode = CVBS_RGB_OUT; static int pids_off; -static int adac=DVB_ADAC_TI; +static int adac = DVB_ADAC_TI; static int hw_sections = 1; static int rgb_on = 0; @@ -87,13 +87,7 @@ static void recover_arm(struct av7110 *av7110) { DEB_EE(("av7110: %p\n",av7110)); - if (current->files) - bootarm(av7110); - else { - printk("OOPS, no current->files\n"); - reset_arm(av7110); - } - + bootarm(av7110); dvb_delay(100); restart_feeds(av7110); outcom(av7110, COMTYPE_PIDFILTER, SetIR, 1, av7110->ir_config); @@ -104,7 +98,7 @@ static void arm_error(struct av7110 *av7110) DEB_EE(("av7110: %p\n",av7110)); av7110->arm_errors++; - av7110->arm_ready=0; + av7110->arm_ready = 0; recover_arm(av7110); } @@ -115,7 +109,7 @@ static int arm_thread(void *data) DEB_EE(("av7110: %p\n",av7110)); - dvb_kernel_thread_setup ("arm_mon"); + dvb_kernel_thread_setup("arm_mon"); av7110->arm_thread = current; while (!av7110->arm_rmmod && !signal_pending(current)) { @@ -127,22 +121,22 @@ static int arm_thread(void *data) if (down_interruptible(&av7110->dcomlock)) break; - newloops=rdebi(av7110, DEBINOSWAP, STATUS_LOOPS, 0, 2); + newloops = rdebi(av7110, DEBINOSWAP, STATUS_LOOPS, 0, 2); up(&av7110->dcomlock); - if (newloops==av7110->arm_loops) { + if (newloops == av7110->arm_loops) { printk(KERN_ERR "av7110%d: ARM crashed!\n", - av7110->dvb_adapter->num); + av7110->dvb_adapter->num); arm_error(av7110); if (down_interruptible(&av7110->dcomlock)) break; - newloops=rdebi(av7110, DEBINOSWAP, STATUS_LOOPS, 0, 2)-1; + newloops = rdebi(av7110, DEBINOSWAP, STATUS_LOOPS, 0, 2) - 1; up(&av7110->dcomlock); } - av7110->arm_loops=newloops; + av7110->arm_loops = newloops; } av7110->arm_thread = NULL; @@ -156,7 +150,7 @@ static int arm_thread(void *data) * * If we want to support multiple controls we would have to do much more... */ -void av7110_setup_irc_config (struct av7110 *av7110, u32 ir_config) +void av7110_setup_irc_config(struct av7110 *av7110, u32 ir_config) { static struct av7110 *last; @@ -177,13 +171,13 @@ static void (*irc_handler)(u32); void av7110_register_irc_handler(void (*func)(u32)) { - //DEB_EE(("registering %08x\n",func)); + DEB_EE(("registering %08x\n", func)); irc_handler = func; } void av7110_unregister_irc_handler(void (*func)(u32)) { - //DEB_EE(("unregistering %08x\n",func)); + DEB_EE(("unregistering %08x\n", func)); irc_handler = NULL; } @@ -193,7 +187,7 @@ void run_handlers(unsigned long ircom) (*irc_handler)((u32) ircom); } -DECLARE_TASKLET(irtask,run_handlers,0); +DECLARE_TASKLET(irtask, run_handlers, 0); void IR_handle(struct av7110 *av7110, u32 ircom) { @@ -212,25 +206,25 @@ static inline int DvbDmxFilterCallback(u8 * buffer1, size_t buffer1_len, enum dmx_success success, struct av7110 *av7110) { - DEB_INT(("av7110: %p\n",av7110)); + DEB_INT(("av7110: %p\n", av7110)); if (!dvbdmxfilter->feed->demux->dmx.frontend) return 0; - if (dvbdmxfilter->feed->demux->dmx.frontend->source==DMX_MEMORY_FE) + if (dvbdmxfilter->feed->demux->dmx.frontend->source == DMX_MEMORY_FE) return 0; - switch(dvbdmxfilter->type) { + switch (dvbdmxfilter->type) { case DMX_TYPE_SEC: - if ((((buffer1[1]<<8)|buffer1[2])&0xfff)+3!=buffer1_len) + if ((((buffer1[1] << 8) | buffer1[2]) & 0xfff) + 3 != buffer1_len) return 0; if (dvbdmxfilter->doneq) { - struct dmx_section_filter *filter=&dvbdmxfilter->filter; + struct dmx_section_filter *filter = &dvbdmxfilter->filter; int i; - u8 xor, neq=0; + u8 xor, neq = 0; - for (i=0; i<DVB_DEMUX_MASK_MAX; i++) { - xor=filter->filter_value[i]^buffer1[i]; - neq|=dvbdmxfilter->maskandnotmode[i]&xor; + for (i = 0; i < DVB_DEMUX_MASK_MAX; i++) { + xor = filter->filter_value[i] ^ buffer1[i]; + neq |= dvbdmxfilter->maskandnotmode[i] & xor; } if (!neq) return 0; @@ -270,34 +264,34 @@ static inline void print_time(char *s) static void debiirq (unsigned long data) { struct av7110 *av7110 = (struct av7110*) data; - int type=av7110->debitype; - int handle=(type>>8)&0x1f; + int type = av7110->debitype; + int handle = (type >> 8) & 0x1f; // DEB_EE(("av7110: %p\n",av7110)); print_time("debi"); saa7146_write(av7110->dev, IER, - saa7146_read(av7110->dev, IER) & ~MASK_19 ); - saa7146_write(av7110->dev, ISR, MASK_19 ); + saa7146_read(av7110->dev, IER) & ~MASK_19); + saa7146_write(av7110->dev, ISR, MASK_19); - if (type==-1) { + if (type == -1) { printk("DEBI irq oops @ %ld, psr:0x%08x, ssr:0x%08x\n", - jiffies, saa7146_read(av7110->dev,PSR), - saa7146_read(av7110->dev,SSR)); + jiffies, saa7146_read(av7110->dev, PSR), + saa7146_read(av7110->dev, SSR)); spin_lock(&av7110->debilock); ARM_ClearMailBox(av7110); ARM_ClearIrq(av7110); spin_unlock(&av7110->debilock); return; } - av7110->debitype=-1; + av7110->debitype = -1; - switch (type&0xff) { + switch (type & 0xff) { case DATA_TS_RECORD: dvb_dmx_swfilter_packets(&av7110->demux, - (const u8 *)av7110->debi_virt, - av7110->debilen/188); + (const u8 *) av7110->debi_virt, + av7110->debilen / 188); spin_lock(&av7110->debilock); iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2); ARM_ClearMailBox(av7110); @@ -307,7 +301,7 @@ static void debiirq (unsigned long data) case DATA_PES_RECORD: if (av7110->demux.recording) record_cb(&av7110->p2t[handle], - (u8 *)av7110->debi_virt, + (u8 *) av7110->debi_virt, av7110->debilen); spin_lock(&av7110->debilock); iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2); @@ -331,15 +325,15 @@ static void debiirq (unsigned long data) case DATA_CI_GET: { - u8 *data=av7110->debi_virt; - - if ((data[0]<2) && data[2]==0xff) { - int flags=0; - if (data[5]>0) - flags|=CA_CI_MODULE_PRESENT; - if (data[5]>5) - flags|=CA_CI_MODULE_READY; - av7110->ci_slot[data[0]].flags=flags; + u8 *data = av7110->debi_virt; + + if ((data[0] < 2) && data[2] == 0xff) { + int flags = 0; + if (data[5] > 0) + flags |= CA_CI_MODULE_PRESENT; + if (data[5] > 5) + flags |= CA_CI_MODULE_READY; + av7110->ci_slot[data[0]].flags = flags; } else ci_get_data(&av7110->ci_rbuffer, av7110->debi_virt, @@ -360,10 +354,10 @@ static void debiirq (unsigned long data) printk("av7110%d: ", av7110->num); printk("%02x ", *(u8 *)av7110->debi_virt); printk("%02x ", *(1+(u8 *)av7110->debi_virt)); - for (i=2; i<av7110->debilen; i++) - printk("%02x ", (*(i+(unsigned char *)av7110->debi_virt))); - for (i=2; i<av7110->debilen; i++) - printk("%c", chtrans(*(i+(unsigned char *)av7110->debi_virt))); + for (i = 2; i < av7110->debilen; i++) + printk("%02x ", (*(i+(unsigned char *)av7110->debi_virt))); + for (i = 2; i < av7110->debilen; i++) + printk("%c", chtrans(*(i+(unsigned char *)av7110->debi_virt))); printk("\n"); } @@ -375,8 +369,8 @@ static void debiirq (unsigned long data) return; case DATA_DEBUG_MESSAGE: - ((s8*)av7110->debi_virt)[Reserved_SIZE-1]=0; - printk("%s\n", (s8 *)av7110->debi_virt); + ((s8*)av7110->debi_virt)[Reserved_SIZE - 1] = 0; + printk("%s\n", (s8 *) av7110->debi_virt); spin_lock(&av7110->debilock); iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2); ARM_ClearMailBox(av7110); @@ -409,28 +403,28 @@ static void gpioirq (unsigned long data) if (av7110->debitype !=-1) printk("GPIO0 irq oops @ %ld, psr:0x%08x, ssr:0x%08x\n", - jiffies, saa7146_read(av7110->dev,PSR), - saa7146_read(av7110->dev,SSR)); + jiffies, saa7146_read(av7110->dev, PSR), + saa7146_read(av7110->dev, SSR)); spin_lock(&av7110->debilock); ARM_ClearIrq(av7110); saa7146_write(av7110->dev, IER, - saa7146_read(av7110->dev, IER) & ~MASK_19 ); - saa7146_write(av7110->dev, ISR, MASK_19 ); + saa7146_read(av7110->dev, IER) & ~MASK_19); + saa7146_write(av7110->dev, ISR, MASK_19); 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); + rxbuf = irdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2); + txbuf = irdebi(av7110, DEBINOSWAP, TX_BUFF, 0, 2); + len = (av7110->debilen + 3) & ~3; -// DEB_D(("GPIO0 irq %d %d\n", av7110->debitype, av7110->debilen)); +// DEB_D(("GPIO0 irq %d %d\n", av7110->debitype, av7110->debilen)); print_time("gpio"); -// DEB_D(("GPIO0 irq %02x\n", av7110->debitype&0xff)); - switch (av7110->debitype&0xff) { +// DEB_D(("GPIO0 irq %02x\n", av7110->debitype&0xff)); + switch (av7110->debitype & 0xff) { case DATA_TS_PLAY: case DATA_PES_PLAY: @@ -480,35 +474,36 @@ static void gpioirq (unsigned long data) case DATA_CI_PUT: { int avail; - struct dvb_ringbuffer *cibuf=&av7110->ci_wbuffer; + struct dvb_ringbuffer *cibuf = &av7110->ci_wbuffer; - avail=dvb_ringbuffer_avail(cibuf); - if (avail<=2) { + 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) { + 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_SKIP(cibuf, 2); - dvb_ringbuffer_read(cibuf,av7110->debi_virt,len,0); + dvb_ringbuffer_read(cibuf, av7110->debi_virt,len, 0); wake_up(&cibuf->queue); iwdebi(av7110, DEBINOSWAP, TX_LEN, len, 2); iwdebi(av7110, DEBINOSWAP, IRQ_STATE_EXT, len, 2); saa7146_wait_for_debi_done(av7110->dev); saa7146_write(av7110->dev, IER, - saa7146_read(av7110->dev, IER) | MASK_19 ); - if (len<5) len=5; /* we want a real DEBI DMA */ - iwdebi(av7110, DEBISWAB, DPRAM_BASE+txbuf, 0, (len+3)&~3); + saa7146_read(av7110->dev, IER) | MASK_19); + if (len < 5) + len = 5; /* we want a real DEBI DMA */ + iwdebi(av7110, DEBISWAB, DPRAM_BASE + txbuf, 0, (len + 3) & ~3); spin_unlock(&av7110->debilock); return; } @@ -520,19 +515,19 @@ static void gpioirq (unsigned long data) iwdebi(av7110, DEBINOSWAP, TX_BUFF, 0, 2); break; } - len=0; - if (av7110->debitype&0x100) { + len = 0; + if (av7110->debitype & 0x100) { spin_lock(&av7110->aout.lock); len=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) { + if (len <=0 && (av7110->debitype & 0x200) + &&av7110->videostate.play_state != VIDEO_FREEZED) { spin_lock(&av7110->avout.lock); len=pes_play(av7110->debi_virt, &av7110->avout, 2048); spin_unlock(&av7110->avout.lock); } - if (len<=0) { + 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); @@ -543,36 +538,37 @@ static void gpioirq (unsigned long data) iwdebi(av7110, DEBINOSWAP, IRQ_STATE_EXT, len, 2); saa7146_wait_for_debi_done(av7110->dev); saa7146_write(av7110->dev, IER, - saa7146_read(av7110->dev, IER) | MASK_19 ); + saa7146_read(av7110->dev, IER) | MASK_19); - iwdebi(av7110, DEBISWAB, DPRAM_BASE+txbuf, 0, (len+3)&~3); + iwdebi(av7110, DEBISWAB, DPRAM_BASE + txbuf, 0, (len + 3) & ~3); spin_unlock(&av7110->debilock); return; case DATA_BMP_LOAD: - len=av7110->debilen; + len = av7110->debilen; if (!len) { - av7110->bmp_state=BMP_LOADED; + 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); break; } - if (len>av7110->bmplen) - len=av7110->bmplen; - if (len>2*1024) - len=2*1024; + 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; + av7110->bmpp += len; + av7110->bmplen -= len; saa7146_wait_for_debi_done(av7110->dev); saa7146_write(av7110->dev, IER, - saa7146_read(av7110->dev, IER) | MASK_19 ); - if (len<5) len=5; /* we want a real DEBI DMA */ - iwdebi(av7110, DEBISWAB, DPRAM_BASE+txbuf, 0, (len+3)&~3); + saa7146_read(av7110->dev, IER) | MASK_19); + if (len < 5) + len = 5; /* we want a real DEBI DMA */ + iwdebi(av7110, DEBISWAB, DPRAM_BASE+txbuf, 0, (len + 3) & ~3); spin_unlock(&av7110->debilock); return; @@ -581,10 +577,12 @@ static void gpioirq (unsigned long data) case DATA_FSECTION: case DATA_IPMPE: case DATA_PIPING: - if (!len || len>4*1024) { + if (!len || len > 4 * 1024) { iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2); break; - } /* yes, fall through */ + } + /* fall through */ + case DATA_TS_RECORD: case DATA_PES_RECORD: saa7146_wait_for_debi_done(av7110->dev); @@ -596,7 +594,7 @@ static void gpioirq (unsigned long data) case DATA_DEBUG_MESSAGE: saa7146_wait_for_debi_done(av7110->dev); - if (!len || len>0xff) { + if (!len || len > 0xff) { iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2); break; } @@ -618,22 +616,22 @@ static void gpioirq (unsigned long data) break; } ARM_ClearMailBox(av7110); - av7110->debitype=-1; + av7110->debitype = -1; spin_unlock(&av7110->debilock); } #ifdef CONFIG_DVB_AV7110_OSD static int dvb_osd_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, void *parg) + unsigned int cmd, void *parg) { - struct dvb_device *dvbdev=(struct dvb_device *) file->private_data; - struct av7110 *av7110=(struct av7110 *) dvbdev->priv; + struct dvb_device *dvbdev = (struct dvb_device *) file->private_data; + struct av7110 *av7110 = (struct av7110 *) dvbdev->priv; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); - if (cmd==OSD_SEND_CMD) - return OSD_DrawCommand(av7110, (osd_cmd_t *)parg); + if (cmd == OSD_SEND_CMD) + return OSD_DrawCommand(av7110, (osd_cmd_t *) parg); return -EINVAL; } @@ -657,9 +655,9 @@ static struct dvb_device dvbdev_osd = { static inline int SetPIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, - u16 subpid, u16 pcrpid) + u16 subpid, u16 pcrpid) { - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); if (vpid == 0x1fff || apid == 0x1fff || ttpid == 0x1fff || subpid == 0x1fff || pcrpid == 0x1fff) { @@ -677,17 +675,21 @@ static inline int SetPIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, void ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, u16 subpid, u16 pcrpid) { - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); if (down_interruptible(&av7110->pid_mutex)) return; - if (!(vpid&0x8000)) av7110->pids[DMX_PES_VIDEO]=vpid; - if (!(apid&0x8000)) av7110->pids[DMX_PES_AUDIO]=apid; - if (!(ttpid&0x8000)) av7110->pids[DMX_PES_TELETEXT]=ttpid; - if (!(pcrpid&0x8000)) av7110->pids[DMX_PES_PCR]=pcrpid; + if (!(vpid & 0x8000)) + av7110->pids[DMX_PES_VIDEO] = vpid; + if (!(apid & 0x8000)) + av7110->pids[DMX_PES_AUDIO] = apid; + if (!(ttpid & 0x8000)) + av7110->pids[DMX_PES_TELETEXT] = ttpid; + if (!(pcrpid & 0x8000)) + av7110->pids[DMX_PES_PCR] = pcrpid; - av7110->pids[DMX_PES_SUBTITLE]=0; + av7110->pids[DMX_PES_SUBTITLE] = 0; if (av7110->fe_synced) { pcrpid = av7110->pids[DMX_PES_PCR]; @@ -704,77 +706,78 @@ void ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, static int StartHWFilter(struct dvb_demux_filter *dvbdmxfilter) { - struct dvb_demux_feed *dvbdmxfeed=dvbdmxfilter->feed; - struct av7110 *av7110=(struct av7110 *) dvbdmxfeed->demux->priv; + struct dvb_demux_feed *dvbdmxfeed = dvbdmxfilter->feed; + struct av7110 *av7110 = (struct av7110 *) dvbdmxfeed->demux->priv; u16 buf[20]; int ret, i; u16 handle; -// u16 mode=0x0320; +// u16 mode=0x0320; u16 mode=0xb96a; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); - if (dvbdmxfilter->type==DMX_TYPE_SEC) { + if (dvbdmxfilter->type == DMX_TYPE_SEC) { if (hw_sections) { - buf[4]=(dvbdmxfilter->filter.filter_value[0]<<8)| + buf[4] = (dvbdmxfilter->filter.filter_value[0] << 8) | dvbdmxfilter->maskandmode[0]; - for (i=3; i<18; i++) - buf[i+4-2]=(dvbdmxfilter->filter.filter_value[i]<<8)| + for (i = 3; i < 18; i++) + buf[i + 4 - 2] = + (dvbdmxfilter->filter.filter_value[i] << 8) | dvbdmxfilter->maskandmode[i]; - mode=4; + mode = 4; } - } else - if ((dvbdmxfeed->ts_type & TS_PACKET) && - !(dvbdmxfeed->ts_type & TS_PAYLOAD_ONLY)) + } else if ((dvbdmxfeed->ts_type & TS_PACKET) && + !(dvbdmxfeed->ts_type & TS_PAYLOAD_ONLY)) { init_p2t(&av7110->p2t_filter[dvbdmxfilter->index], dvbdmxfeed); + } buf[0] = (COMTYPE_PID_FILTER << 8) + AddPIDFilter; buf[1] = 16; buf[2] = dvbdmxfeed->pid; buf[3] = mode; - ret=CommandRequest(av7110, buf, 20, &handle, 1); - if (ret<0) { + ret = CommandRequest(av7110, buf, 20, &handle, 1); + if (ret < 0) { printk("StartHWFilter error\n"); return ret; } - av7110->handle2filter[handle]=dvbdmxfilter; - dvbdmxfilter->hw_handle=handle; + av7110->handle2filter[handle] = dvbdmxfilter; + dvbdmxfilter->hw_handle = handle; return ret; } static int StopHWFilter(struct dvb_demux_filter *dvbdmxfilter) { - struct av7110 *av7110=(struct av7110 *) dvbdmxfilter->feed->demux->priv; + struct av7110 *av7110 = (struct av7110 *) dvbdmxfilter->feed->demux->priv; u16 buf[3]; u16 answ[2]; int ret; u16 handle; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); - handle=dvbdmxfilter->hw_handle; - if (handle>32) { + handle = dvbdmxfilter->hw_handle; + if (handle > 32) { DEB_S(("dvb: StopHWFilter tried to stop invalid filter %d.\n", handle)); - DEB_S(("dvb: filter type = %d\n", dvbdmxfilter->type)); + DEB_S(("dvb: filter type = %d\n", dvbdmxfilter->type)); return 0; } - av7110->handle2filter[handle]=NULL; + av7110->handle2filter[handle] = NULL; buf[0] = (COMTYPE_PID_FILTER << 8) + DelPIDFilter; buf[1] = 1; buf[2] = handle; - ret=CommandRequest(av7110, buf, 3, answ, 2); + ret = CommandRequest(av7110, buf, 3, answ, 2); if (ret) printk("StopHWFilter error\n"); if (answ[1] != handle) { DEB_S(("dvb: filter %d shutdown error :%d\n", handle, answ[1])); - ret=-1; + ret = -1; } return ret; } @@ -782,74 +785,67 @@ static int StopHWFilter(struct dvb_demux_filter *dvbdmxfilter) static void dvb_feed_start_pid(struct dvb_demux_feed *dvbdmxfeed) { - struct dvb_demux *dvbdmx=dvbdmxfeed->demux; - struct av7110 *av7110=(struct av7110 *) dvbdmx->priv; - u16 *pid=dvbdmx->pids, npids[5]; + struct dvb_demux *dvbdmx = dvbdmxfeed->demux; + struct av7110 *av7110 = (struct av7110 *) dvbdmx->priv; + u16 *pid = dvbdmx->pids, npids[5]; int i; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); - npids[0]=npids[1]=npids[2]=npids[3]=0xffff; - npids[4]=0xffff; - i=dvbdmxfeed->pes_type; - npids[i]=(pid[i]&0x8000) ? 0 : pid[i]; - if ((i==2) && npids[i] && (dvbdmxfeed->ts_type & TS_PACKET)) { - npids[i]=0; + npids[0] = npids[1] = npids[2] = npids[3] = npids[4] = 0xffff; + i = dvbdmxfeed->pes_type; + npids[i] = (pid[i]&0x8000) ? 0 : pid[i]; + if ((i == 2) && npids[i] && (dvbdmxfeed->ts_type & TS_PACKET)) { + npids[i] = 0; ChangePIDs(av7110, npids[1], npids[0], npids[2], npids[3], npids[4]); StartHWFilter(dvbdmxfeed->filter); return; } - if (dvbdmxfeed->pes_type<=2 || dvbdmxfeed->pes_type==4) + if (dvbdmxfeed->pes_type <= 2 || dvbdmxfeed->pes_type == 4) ChangePIDs(av7110, npids[1], npids[0], npids[2], npids[3], npids[4]); - if (dvbdmxfeed->pes_type<2 && npids[0]) + if (dvbdmxfeed->pes_type < 2 && npids[0]) if (av7110->fe_synced) outcom(av7110, COMTYPE_PIDFILTER, Scan, 0); if ((dvbdmxfeed->ts_type & TS_PACKET)) { - if (dvbdmxfeed->pes_type == 0 && - !(dvbdmx->pids[0]&0x8000)) - AV_StartRecord(av7110, RP_AUDIO, - dvbdmxfeed); - if (dvbdmxfeed->pes_type == 1 && - !(dvbdmx->pids[1]&0x8000)) - AV_StartRecord(av7110, RP_VIDEO, - dvbdmxfeed); + if (dvbdmxfeed->pes_type == 0 && !(dvbdmx->pids[0] & 0x8000)) + AV_StartRecord(av7110, RP_AUDIO, dvbdmxfeed); + if (dvbdmxfeed->pes_type == 1 && !(dvbdmx->pids[1] & 0x8000)) + AV_StartRecord(av7110, RP_VIDEO, dvbdmxfeed); } } static void dvb_feed_stop_pid(struct dvb_demux_feed *dvbdmxfeed) { - struct dvb_demux *dvbdmx=dvbdmxfeed->demux; - struct av7110 *av7110=(struct av7110 *) dvbdmx->priv; - u16 *pid=dvbdmx->pids, npids[5]; + struct dvb_demux *dvbdmx = dvbdmxfeed->demux; + struct av7110 *av7110 = (struct av7110 *) dvbdmx->priv; + u16 *pid = dvbdmx->pids, npids[5]; int i; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); - if (dvbdmxfeed->pes_type<=1) { - AV_Stop(av7110, dvbdmxfeed->pes_type ? - RP_VIDEO : RP_AUDIO); + if (dvbdmxfeed->pes_type <= 1) { + AV_Stop(av7110, dvbdmxfeed->pes_type ? RP_VIDEO : RP_AUDIO); if (!av7110->rec_mode) - dvbdmx->recording=0; + dvbdmx->recording = 0; if (!av7110->playing) - dvbdmx->playing=0; + dvbdmx->playing = 0; } - npids[0]=npids[1]=npids[2]=npids[3]=0xffff; - npids[4]=0xffff; - i=dvbdmxfeed->pes_type; + npids[0] = npids[1] = npids[2] = npids[3] = npids[4] = 0xffff; + i = dvbdmxfeed->pes_type; switch (i) { case 2: //teletext if (dvbdmxfeed->ts_type & TS_PACKET) StopHWFilter(dvbdmxfeed->filter); - npids[2]=0; + npids[2] = 0; break; case 0: case 1: case 4: if (!pids_off) return; - npids[i]=(pid[i]&0x8000) ? 0 : pid[i]; + npids[i] = (pid[i]&0x8000) ? 0 : pid[i]; break; } ChangePIDs(av7110, npids[1], npids[0], npids[2], npids[3], npids[4]); @@ -860,7 +856,7 @@ static int av7110_start_feed(struct dvb_demux_feed *feed) struct dvb_demux *demux = feed->demux; struct av7110 *av7110 = (struct av7110 *) demux->priv; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); if (!demux->dmx.frontend) return -EINVAL; @@ -887,24 +883,24 @@ static int av7110_start_feed(struct dvb_demux_feed *feed) dvb_feed_start_pid(feed); break; } - } else - if ((feed->ts_type & TS_PACKET) && - (demux->dmx.frontend->source!=DMX_MEMORY_FE)) - StartHWFilter(feed->filter); + } else if ((feed->ts_type & TS_PACKET) && + (demux->dmx.frontend->source != DMX_MEMORY_FE)) { + StartHWFilter(feed->filter); + } } if (feed->type == DMX_TYPE_SEC) { int i; - for (i=0; i<demux->filternum; i++) { - if (demux->filter[i].state!=DMX_STATE_READY) + for (i = 0; i < demux->filternum; i++) { + if (demux->filter[i].state != DMX_STATE_READY) continue; - if (demux->filter[i].type!=DMX_TYPE_SEC) + if (demux->filter[i].type != DMX_TYPE_SEC) continue; - if (demux->filter[i].filter.parent!=&feed->feed.sec) + if (demux->filter[i].filter.parent != &feed->feed.sec) continue; - demux->filter[i].state=DMX_STATE_GO; - if (demux->dmx.frontend->source!=DMX_MEMORY_FE) + demux->filter[i].state = DMX_STATE_GO; + if (demux->dmx.frontend->source != DMX_MEMORY_FE) StartHWFilter(&demux->filter[i]); } } @@ -918,15 +914,15 @@ static int av7110_stop_feed(struct dvb_demux_feed *feed) struct dvb_demux *demux = feed->demux; struct av7110 *av7110 = (struct av7110 *) demux->priv; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); if (feed->type == DMX_TYPE_TS) { if (feed->ts_type & TS_DECODER) { if (feed->pes_type >= DMX_TS_PES_OTHER || !demux->pesfilter[feed->pes_type]) return -EINVAL; - demux->pids[feed->pes_type]|=0x8000; - demux->pesfilter[feed->pes_type]=0; + demux->pids[feed->pes_type] |= 0x8000; + demux->pesfilter[feed->pes_type] = 0; } if (feed->ts_type & TS_DECODER && feed->pes_type < DMX_TS_PES_OTHER) { @@ -941,10 +937,10 @@ static int av7110_stop_feed(struct dvb_demux_feed *feed) int i; for (i=0; i<demux->filternum; i++) - if (demux->filter[i].state==DMX_STATE_GO && - demux->filter[i].filter.parent==&feed->feed.sec) { - demux->filter[i].state=DMX_STATE_READY; - if (demux->dmx.frontend->source!=DMX_MEMORY_FE) + if (demux->filter[i].state == DMX_STATE_GO && + demux->filter[i].filter.parent == &feed->feed.sec) { + demux->filter[i].state = DMX_STATE_READY; + if (demux->dmx.frontend->source != DMX_MEMORY_FE) StopHWFilter(&demux->filter[i]); } } @@ -955,20 +951,20 @@ static int av7110_stop_feed(struct dvb_demux_feed *feed) static void restart_feeds(struct av7110 *av7110) { - struct dvb_demux *dvbdmx=&av7110->demux; + struct dvb_demux *dvbdmx = &av7110->demux; struct dvb_demux_feed *feed; int mode; int i; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); - mode=av7110->playing; - av7110->playing=0; - av7110->rec_mode=0; + mode = av7110->playing; + av7110->playing = 0; + av7110->rec_mode = 0; - for (i=0; i<dvbdmx->filternum; i++) { - feed=&dvbdmx->feed[i]; - if (feed->state==DMX_STATE_GO) + for (i = 0; i < dvbdmx->filternum; i++) { + feed = &dvbdmx->feed[i]; + if (feed->state == DMX_STATE_GO) av7110_start_feed(feed); } @@ -977,7 +973,7 @@ static void restart_feeds(struct av7110 *av7110) } static int dvb_get_stc(struct dmx_demux *demux, unsigned int num, - uint64_t *stc, unsigned int *base) + uint64_t *stc, unsigned int *base) { int ret; u16 fwstc[4]; @@ -993,7 +989,7 @@ static int dvb_get_stc(struct dmx_demux *demux, unsigned int num, BUG(); av7110 = (struct av7110 *) dvbdemux->priv; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); if (num != 0) return -EINVAL; @@ -1004,10 +1000,10 @@ static int dvb_get_stc(struct dmx_demux *demux, unsigned int num, return -EIO; } DEB_EE(("av7110: fwstc = %04hx %04hx %04hx %04hx\n", - fwstc[0], fwstc[1], fwstc[2], fwstc[3])); + fwstc[0], fwstc[1], fwstc[2], fwstc[3])); *stc = (((uint64_t) ((fwstc[3] & 0x8000) >> 15)) << 32) | - (((uint64_t) fwstc[1]) << 16) | ((uint64_t)fwstc[0]); + (((uint64_t) fwstc[1]) << 16) | ((uint64_t) fwstc[0]); *base = 1; DEB_EE(("av7110: stc = %lu\n", (unsigned long)*stc)); @@ -1020,20 +1016,20 @@ static int dvb_get_stc(struct dmx_demux *demux, unsigned int num, * SEC device file operations ******************************************************************************/ -static int av7110_diseqc_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) +static int av7110_diseqc_ioctl(struct dvb_frontend *fe, unsigned int cmd, void *arg) { struct av7110 *av7110 = fe->before_after_data; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); switch (cmd) { case FE_SET_TONE: switch ((fe_sec_tone_mode_t) arg) { case SEC_TONE_ON: - Set22K (av7110, 1); + Set22K(av7110, 1); break; case SEC_TONE_OFF: - Set22K (av7110, 0); + Set22K(av7110, 0); break; default: return -EINVAL; @@ -1043,12 +1039,12 @@ static int av7110_diseqc_ioctl (struct dvb_frontend *fe, unsigned int cmd, void case FE_DISEQC_SEND_MASTER_CMD: { struct dvb_diseqc_master_cmd *cmd = arg; - SendDiSEqCMsg (av7110, cmd->msg_len, cmd->msg, -1); + SendDiSEqCMsg(av7110, cmd->msg_len, cmd->msg, -1); break; } case FE_DISEQC_SEND_BURST: - SendDiSEqCMsg (av7110, 0, NULL, (unsigned long)arg); + SendDiSEqCMsg(av7110, 0, NULL, (unsigned long) arg); break; default: @@ -1059,11 +1055,11 @@ static int av7110_diseqc_ioctl (struct dvb_frontend *fe, unsigned int cmd, void } -static void av7110_before_after_tune (fe_status_t s, void *data) +static void av7110_before_after_tune(fe_status_t s, void *data) { struct av7110 *av7110 = data; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); av7110->fe_synced = (s & FE_HAS_LOCK) ? 1 : 0; @@ -1091,14 +1087,14 @@ static void av7110_before_after_tune (fe_status_t s, void *data) static int av7110_register(struct av7110 *av7110) { int ret, i; - struct dvb_demux *dvbdemux=&av7110->demux; + struct dvb_demux *dvbdemux = &av7110->demux; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); if (av7110->registered) return -1; - av7110->registered=1; + av7110->registered = 1; dvb_add_frontend_notifier (av7110->dvb_adapter, av7110_before_after_tune, av7110); @@ -1111,8 +1107,8 @@ static int av7110_register(struct av7110 *av7110) dvbdemux->priv = (void *) av7110; - for (i=0; i<32; i++) - av7110->handle2filter[i]=NULL; + for (i = 0; i < 32; i++) + av7110->handle2filter[i] = NULL; dvbdemux->filternum = 32; dvbdemux->feednum = 32; @@ -1166,9 +1162,9 @@ static int av7110_register(struct av7110 *av7110) static void dvb_unregister(struct av7110 *av7110) { - struct dvb_demux *dvbdemux=&av7110->demux; + struct dvb_demux *dvbdemux = &av7110->demux; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); if (!av7110->registered) return; @@ -1184,7 +1180,6 @@ static void dvb_unregister(struct av7110 *av7110) dvb_remove_frontend_notifier (av7110->dvb_adapter, av7110_before_after_tune); - dvb_remove_frontend_ioctls (av7110->dvb_adapter, av7110_diseqc_ioctl, NULL); @@ -1200,15 +1195,15 @@ static void dvb_unregister(struct av7110 *av7110) int i2c_writereg(struct av7110 *av7110, u8 id, u8 reg, u8 val) { - u8 msg[2]={ reg, val }; + u8 msg[2] = { reg, val }; struct dvb_i2c_bus *i2c = av7110->i2c_bus; struct i2c_msg msgs; - msgs.flags=0; - msgs.addr=id/2; - msgs.len=2; - msgs.buf=msg; - return i2c->xfer (i2c, &msgs, 1); + msgs.flags = 0; + msgs.addr = id / 2; + msgs.len = 2; + msgs.buf = msg; + return i2c->xfer(i2c, &msgs, 1); } u8 i2c_readreg(struct av7110 *av7110, u8 id, u8 reg) @@ -1218,18 +1213,18 @@ u8 i2c_readreg(struct av7110 *av7110, u8 id, u8 reg) u8 mm2[] = {0x00}; struct i2c_msg msgs[2]; - msgs[0].flags=0; - msgs[1].flags=I2C_M_RD; - msgs[0].addr=msgs[1].addr=id/2; - mm1[0]=reg; - msgs[0].len=1; msgs[1].len=1; - msgs[0].buf=mm1; msgs[1].buf=mm2; + msgs[0].flags = 0; + msgs[1].flags = I2C_M_RD; + msgs[0].addr = msgs[1].addr = id / 2; + mm1[0] = reg; + msgs[0].len = 1; msgs[1].len = 1; + msgs[0].buf = mm1; msgs[1].buf = mm2; i2c->xfer(i2c, msgs, 2); return mm2[0]; } -static int master_xfer (struct dvb_i2c_bus *i2c, const struct i2c_msg msgs[], int num) +static int master_xfer(struct dvb_i2c_bus *i2c, const struct i2c_msg msgs[], int num) { struct saa7146_dev *dev = i2c->data; return saa7146_i2c_transfer(dev, msgs, num, 6); @@ -1259,15 +1254,15 @@ static int check_firmware(struct av7110* av7110) ptr += 4; /* check dpram file */ - crc = ntohl(*(u32*)ptr); + crc = ntohl(*(u32*) ptr); ptr += 4; - len = ntohl(*(u32*)ptr); + len = ntohl(*(u32*) ptr); ptr += 4; if (len >= 512) { printk("dvb-ttpci: dpram file is way to big.\n"); return -EINVAL; } - if (crc != crc32_le(0,ptr,len)) { + if (crc != crc32_le(0, ptr, len)) { printk("dvb-ttpci: crc32 of dpram file does not match.\n"); return -EINVAL; } @@ -1276,16 +1271,17 @@ static int check_firmware(struct av7110* av7110) ptr += len; /* check root file */ - crc = ntohl(*(u32*)ptr); + crc = ntohl(*(u32*) ptr); ptr += 4; - len = ntohl(*(u32*)ptr); + len = ntohl(*(u32*) ptr); ptr += 4; - if (len <= 200000 || len >= 300000 || len > ((av7110->bin_fw+av7110->size_fw)-ptr) ) { - printk("dvb-ttpci: root file has strange size (%d). aborting.\n",len); + if (len <= 200000 || len >= 300000 || + len > ((av7110->bin_fw + av7110->size_fw) - ptr)) { + printk("dvb-ttpci: root file has strange size (%d). aborting.\n", len); return -EINVAL; } - if( crc != crc32_le(0,ptr,len)) { + if( crc != crc32_le(0, ptr, len)) { printk("dvb-ttpci: crc32 of dpram file does not match.\n"); return -EINVAL; } @@ -1332,18 +1328,19 @@ static int get_firmware(struct av7110* av7110) } #endif -static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *pci_ext) +static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data *pci_ext) { struct av7110 *av7110 = NULL; int ret = 0; - DEB_EE(("dev: %p, av7110: %p\n",dev,av7110)); + DEB_EE(("dev: %p\n", dev)); /* prepare the av7110 device struct */ if (!(av7110 = kmalloc (sizeof (struct av7110), GFP_KERNEL))) { printk ("%s: out of memory!\n", __FUNCTION__); return -ENOMEM; } + DEB_EE(("av7110: %p\n", av7110)); memset(av7110, 0, sizeof(struct av7110)); av7110->card_name = (char*) pci_ext->ext_priv; @@ -1363,11 +1360,11 @@ static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_ saa7146_i2c_adapter_prepare(dev, NULL, SAA7146_I2C_BUS_BIT_RATE_120); /* 275 kHz */ - av7110->i2c_bus = dvb_register_i2c_bus (master_xfer, dev, - av7110->dvb_adapter, 0); + av7110->i2c_bus = dvb_register_i2c_bus(master_xfer, dev, + av7110->dvb_adapter, 0); if (!av7110->i2c_bus) { - dvb_unregister_adapter (av7110->dvb_adapter); + dvb_unregister_adapter(av7110->dvb_adapter); kfree(av7110); return -ENOMEM; } @@ -1394,15 +1391,15 @@ static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_ /* locks for data transfers from/to AV7110 */ spin_lock_init (&av7110->debilock); sema_init(&av7110->dcomlock, 1); - av7110->debilock=SPIN_LOCK_UNLOCKED; - av7110->debitype=-1; + av7110->debilock = SPIN_LOCK_UNLOCKED; + av7110->debitype = -1; /* default OSD window */ - av7110->osdwin=1; + av7110->osdwin = 1; /* ARM "watchdog" */ init_waitqueue_head(&av7110->arm_wait); - av7110->arm_thread=0; + av7110->arm_thread = 0; /* allocate and init buffers */ av7110->debi_virt = pci_alloc_consistent(dev->pci, 8192, @@ -1421,7 +1418,7 @@ static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_ av7110_av_init(av7110); /* init BMP buffer */ - av7110->bmpbuf=av7110->iobuf+AVOUTLEN+AOUTLEN; + av7110->bmpbuf = av7110->iobuf+AVOUTLEN+AOUTLEN; init_waitqueue_head(&av7110->bmpq); av7110_ca_init(av7110); @@ -1446,7 +1443,7 @@ static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_ /* remaining inits according to card and frontend type */ av7110->has_analog_tuner = 0; av7110->current_input = 0; - if (i2c_writereg(av7110, 0x20, 0x00, 0x00)==1) { + if (i2c_writereg(av7110, 0x20, 0x00, 0x00) == 1) { printk ("av7110(%d): Crystal audio DAC detected\n", av7110->dvb_adapter->num); av7110->adac_type = DVB_ADAC_CRYSTAL; @@ -1483,7 +1480,7 @@ static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_ SetVolume(av7110, 0xff, 0xff); - av7110_setup_irc_config (av7110, 0); + av7110_setup_irc_config(av7110, 0); av7110_register(av7110); /* special case DVB-C: these cards have an analog tuner @@ -1494,7 +1491,7 @@ static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_ if (ret) goto err; - printk(KERN_INFO "av7110: found av7110-%d.\n",av7110_num); + printk(KERN_INFO "av7110: found av7110-%d.\n", av7110_num); av7110->device_initialized = 1; av7110_num++; return 0; @@ -1521,7 +1518,7 @@ err: static int av7110_detach (struct saa7146_dev* saa) { struct av7110 *av7110 = (struct av7110*)saa->ext_priv; - DEB_EE(("av7110: %p\n",av7110)); + DEB_EE(("av7110: %p\n", av7110)); if( 0 == av7110->device_initialized ) { return 0; @@ -1529,7 +1526,7 @@ static int av7110_detach (struct saa7146_dev* saa) av7110_exit_v4l(av7110); - av7110->arm_rmmod=1; + av7110->arm_rmmod = 1; wake_up_interruptible(&av7110->arm_wait); while (av7110->arm_thread) @@ -1555,11 +1552,10 @@ static int av7110_detach (struct saa7146_dev* saa) av7110_num--; #ifndef CONFIG_DVB_AV7110_FIRMWARE_FILE - if (NULL != av7110->bin_fw ) { + if (av7110->bin_fw) vfree(av7110->bin_fw); - } #endif - kfree (av7110); + kfree(av7110); saa->ext_priv = NULL; return 0; |