summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorHolger Waechtler <devnull@localhost>2003-02-13 19:52:51 +0000
committerHolger Waechtler <devnull@localhost>2003-02-13 19:52:51 +0000
commit2a205e6a6e1a42bac744aaa6e6acb104f6429dc7 (patch)
treefc7b261fc43b1abb57e3f36c961fee3aa431f782 /linux/drivers/media
parent8ba93439e4fc296db4f806d7163148af5bb7c0e4 (diff)
downloadmediapointer-dvb-s2-2a205e6a6e1a42bac744aaa6e6acb104f6429dc7.tar.gz
mediapointer-dvb-s2-2a205e6a6e1a42bac744aaa6e6acb104f6429dc7.tar.bz2
outcom sanity checks and code readability review
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/dvb/ttpci-budget/budget.c6
-rw-r--r--linux/drivers/media/dvb/ttpci/av7110.c316
2 files changed, 155 insertions, 167 deletions
diff --git a/linux/drivers/media/dvb/ttpci-budget/budget.c b/linux/drivers/media/dvb/ttpci-budget/budget.c
index e08a50134..699dae456 100644
--- a/linux/drivers/media/dvb/ttpci-budget/budget.c
+++ b/linux/drivers/media/dvb/ttpci-budget/budget.c
@@ -41,11 +41,13 @@ MAKE_BUDGET_INFO(ttbc, "TT-Budget/WinTV-NOVA-C PCI", BUDGET_TT);
MAKE_BUDGET_INFO(ttbt, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT);
MAKE_BUDGET_INFO(ttbci, "TT-Budget/WinTV-NOVA-CI PCI", BUDGET_TT_HW_DISEQC);
MAKE_BUDGET_INFO(satel, "SATELCO Multimedia PCI", BUDGET_TT_HW_DISEQC);
-MAKE_BUDGET_INFO(fs_1_3,"Siemens/Technotrend/Hauppauge PCI rev1.3+Budget_Patch", BUDGET_PATCH);
+/* Uncomment for Budget Patch */
+/*MAKE_BUDGET_INFO(fs_1_3,"Siemens/Technotrend/Hauppauge PCI rev1.3+Budget_Patch", BUDGET_PATCH);*/
static
struct pci_device_id pci_tbl[] = {
-// MAKE_EXTENSION_PCI(fs_1_3,0x13c2, 0x0000), /* Uncomment for Budget Patch */
+ /* Uncomment for Budget Patch */
+ /*MAKE_EXTENSION_PCI(fs_1_3,0x13c2, 0x0000),*/
MAKE_EXTENSION_PCI(ttbs, 0x13c2, 0x1003),
MAKE_EXTENSION_PCI(ttbc, 0x13c2, 0x1004),
MAKE_EXTENSION_PCI(ttbt, 0x13c2, 0x1005),
diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c
index d7766996a..76c1266ff 100644
--- a/linux/drivers/media/dvb/ttpci/av7110.c
+++ b/linux/drivers/media/dvb/ttpci/av7110.c
@@ -702,7 +702,8 @@ void av7110_setup_irc_config (av7110_t *av7110, u32 ir_config)
else
last = av7110;
- outcom(av7110, COMTYPE_PIDFILTER, SetIR, 1, ir_config);
+ if (av7110)
+ outcom(av7110, COMTYPE_PIDFILTER, SetIR, 1, ir_config);
}
static void (*irc_handler)(u32);
@@ -2287,48 +2288,36 @@ inline static void
Set22K(av7110_t *av7110, int state)
{
DEB_EE(("av7110: %p\n",av7110));
-// if (av7110->card_type->type==DVB_CARD_TT_SIEMENS)
- outcom(av7110, COMTYPE_AUDIODAC, (state ? ON22K : OFF22K), 0);
+ outcom(av7110, COMTYPE_AUDIODAC, (state ? ON22K : OFF22K), 0);
}
-inline static int
-SendDiSEqCMsg(av7110_t *av7110, int len, u8 *msg, int burst)
+
+static
+int SendDiSEqCMsg(av7110_t *av7110, int len, u8 *msg, int burst)
{
int i;
+ u16 buf[18] = { ((COMTYPE_AUDIODAC << 8) + SendDiSEqC),
+ 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
DEB_EE(("av7110: %p\n",av7110));
-/*
- switch (av7110->card_type->type) {
- case DVB_CARD_TT_SIEMENS:
-*/
- {
- u16 buf[18] = { ((COMTYPE_AUDIODAC << 8) + SendDiSEqC),
- 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-
- if (len>10)
- len=10;
- buf[1] = len+2;
- buf[2] = len;
-
- if (burst!=-1)
- buf[3]=burst ? 0x01 : 0x00;
+ if (len>10)
+ len=10;
+
+ buf[1] = len+2;
+ buf[2] = len;
+
+ if (burst!=-1)
+ buf[3]=burst ? 0x01 : 0x00;
+ else
+ buf[3]=0xffff;
+
+ for (i=0; i<len; i++)
+ buf[i+4]=msg[i];
+
+ if (SOutCommand(av7110, buf, 18))
+ printk("SendDiSEqCMsg error\n");
- else
- buf[3]=0xffff;
-
- for (i=0; i<len; i++)
- buf[i+4]=msg[i];
-
- if (SOutCommand(av7110, buf, 18))
- printk("SendDiSEqCMsg error\n");
-/*
- break;
- }
- default:
- return -1;
-*/
- }
return 0;
}
@@ -4030,15 +4019,14 @@ int av7110_register(av7110_t *av7110)
av7110->registered=1;
-// if (av7110->card_type->type==DVB_CARD_TT_SIEMENS)
- dvb_add_frontend_notifier (av7110->dvb_adapter,
- av7110_before_after_tune, av7110);
+ dvb_add_frontend_notifier (av7110->dvb_adapter,
+ av7110_before_after_tune, av7110);
+
/**
* init DiSEqC stuff
*/
-// if (av7110->card_type->type==DVB_CARD_TT_SIEMENS)
- dvb_add_frontend_ioctls (av7110->dvb_adapter,
- av7110_diseqc_ioctl, NULL, av7110);
+ dvb_add_frontend_ioctls (av7110->dvb_adapter,
+ av7110_diseqc_ioctl, NULL, av7110);
av7110->audiostate.AV_sync_state=0;
av7110->audiostate.mute_state=0;
@@ -4058,67 +4046,64 @@ int av7110_register(av7110_t *av7110)
av7110->demux_id[5] = av7110->dvb_adapter->num + '0';
dvbdemux->priv = (void *) av7110;
-// if (av7110->card_type->type==DVB_CARD_TT_SIEMENS) {
- for (i=0; i<32; i++)
- av7110->handle2filter[i]=NULL;
-
- dvbdemux->filternum=32;
- dvbdemux->feednum=32;
- dvbdemux->start_feed = av7110_start_feed;
- dvbdemux->stop_feed = av7110_stop_feed;
- dvbdemux->write_to_decoder = av7110_write_to_decoder;
-
- dvbdemux->dmx.vendor="TI";
- dvbdemux->dmx.model="AV7110";
- dvbdemux->dmx.id=av7110->demux_id;
- dvbdemux->dmx.capabilities=(DMX_TS_FILTERING|
- DMX_SECTION_FILTERING|
- DMX_MEMORY_BASED_FILTERING);
-
- dvb_dmx_init(&av7110->demux);
-
-
- dvbfront->id="hw_frontend";
- dvbfront->vendor="VLSI";
- dvbfront->model="DVB Frontend";
- dvbfront->source=DMX_FRONTEND_0;
-
- av7110->dmxdev.filternum=32;
- av7110->dmxdev.demux=&dvbdemux->dmx;
- av7110->dmxdev.capabilities=0;
-
- dvb_dmxdev_init(&av7110->dmxdev, av7110->dvb_adapter);
-// }
+ for (i=0; i<32; i++)
+ av7110->handle2filter[i]=NULL;
+
+ dvbdemux->filternum = 32;
+ dvbdemux->feednum = 32;
+ dvbdemux->start_feed = av7110_start_feed;
+ dvbdemux->stop_feed = av7110_stop_feed;
+ dvbdemux->write_to_decoder = av7110_write_to_decoder;
+ dvbdemux->dmx.vendor = "TI";
+ dvbdemux->dmx.model = "AV7110";
+ dvbdemux->dmx.id = av7110->demux_id;
+ dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING |
+ DMX_MEMORY_BASED_FILTERING);
+
+ dvb_dmx_init(&av7110->demux);
+
+ dvbfront->id = "hw_frontend";
+ dvbfront->vendor = "VLSI";
+ dvbfront->model = "DVB Frontend";
+ dvbfront->source = DMX_FRONTEND_0;
+
+ av7110->dmxdev.filternum = 32;
+ av7110->dmxdev.demux = &dvbdemux->dmx;
+ av7110->dmxdev.capabilities = 0;
+
+ dvb_dmxdev_init(&av7110->dmxdev, av7110->dvb_adapter);
- ret=dvbdemux->dmx.add_frontend(&dvbdemux->dmx,
- &av7110->hw_frontend);
- if (ret<0)
+ ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx,
+ &av7110->hw_frontend);
+ if (ret < 0)
return ret;
- av7110->mem_frontend.id="mem_frontend";
- av7110->mem_frontend.vendor="memory";
- av7110->mem_frontend.model="sw";
- av7110->mem_frontend.source=DMX_MEMORY_FE;
- ret=dvbdemux->dmx.add_frontend(&dvbdemux->dmx,
- &av7110->mem_frontend);
- if (ret<0)
+ av7110->mem_frontend.id = "mem_frontend";
+ av7110->mem_frontend.vendor = "memory";
+ av7110->mem_frontend.model = "sw";
+ av7110->mem_frontend.source = DMX_MEMORY_FE;
+
+ ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &av7110->mem_frontend);
+
+ if (ret < 0)
return ret;
- ret=dvbdemux->dmx.connect_frontend(&dvbdemux->dmx,
- &av7110->hw_frontend);
- if (ret<0)
+ ret = dvbdemux->dmx.connect_frontend(&dvbdemux->dmx,
+ &av7110->hw_frontend);
+ if (ret < 0)
return ret;
-// if (av7110->card_type->type==DVB_CARD_TT_SIEMENS) {
- dvb_register_device(av7110->dvb_adapter, &av7110->video_dev,
- &dvbdev_video, av7110, DVB_DEVICE_VIDEO);
- dvb_register_device(av7110->dvb_adapter, &av7110->audio_dev,
- &dvbdev_audio, av7110, DVB_DEVICE_AUDIO);
- dvb_register_device(av7110->dvb_adapter, &av7110->ca_dev,
+ dvb_register_device(av7110->dvb_adapter, &av7110->video_dev,
+ &dvbdev_video, av7110, DVB_DEVICE_VIDEO);
+
+ dvb_register_device(av7110->dvb_adapter, &av7110->audio_dev,
+ &dvbdev_audio, av7110, DVB_DEVICE_AUDIO);
+
+ dvb_register_device(av7110->dvb_adapter, &av7110->ca_dev,
&dvbdev_ca, av7110, DVB_DEVICE_CA);
#ifdef CONFIG_DVB_AV7110_OSD
- dvb_register_device(av7110->dvb_adapter, &av7110->osd_dev,
- &dvbdev_osd, av7110, DVB_DEVICE_OSD);
+ dvb_register_device(av7110->dvb_adapter, &av7110->osd_dev,
+ &dvbdev_osd, av7110, DVB_DEVICE_OSD);
#endif
#ifdef USE_DVB_DSP
dvb->dsp_dev = dvb_register_dsp(dvb_audio_open,
@@ -4155,20 +4140,18 @@ dvb_unregister(av7110_t *av7110)
dvb_dmxdev_release(&av7110->dmxdev);
dvb_dmx_release(&av7110->demux);
-// if (av7110->card_type->type==DVB_CARD_TT_SIEMENS)
- dvb_remove_frontend_notifier (av7110->dvb_adapter,
- av7110_before_after_tune);
+ dvb_remove_frontend_notifier (av7110->dvb_adapter,
+ av7110_before_after_tune);
dvb_remove_frontend_ioctls (av7110->dvb_adapter,
av7110_diseqc_ioctl, NULL);
-// if (av7110->card_type->type==DVB_CARD_TT_SIEMENS) {
- dvb_unregister_device(av7110->audio_dev);
- dvb_unregister_device(av7110->video_dev);
- dvb_unregister_device(av7110->osd_dev);
- dvb_unregister_device(av7110->ca_dev);
+ dvb_unregister_device(av7110->audio_dev);
+ dvb_unregister_device(av7110->video_dev);
+ dvb_unregister_device(av7110->osd_dev);
+ dvb_unregister_device(av7110->ca_dev);
#ifdef USE_DVB_DSP
- dvb_unregister_dsp(av7110->dsp_dev);
+ dvb_unregister_dsp(av7110->dsp_dev);
#endif
// }
}
@@ -4201,20 +4184,21 @@ int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *p
printk ("%s: out of memory!\n", __FUNCTION__);
return -ENOMEM;
}
- memset(av7110, 0, sizeof(av7110_t));
+
+ memset(av7110, 0, sizeof(av7110_t));
av7110->card_name = (char*)pci_ext->ext_priv;
(av7110_t*)dev->ext_priv = av7110;
DEB_EE(("dev: %p, av7110: %p\n",dev,av7110));
- if( 0 != saa7146_vv_init(dev)) {
+ if (saa7146_vv_init(dev)) {
ERR(("cannot init capture device. skipping.\n"));
kfree(av7110);
return -1;
}
- if( 0 != saa7146_register_device(&av7110->vd, dev, "av7710", VFL_TYPE_GRABBER)) {
+ if (saa7146_register_device(&av7110->vd, dev, "av7710", VFL_TYPE_GRABBER)) {
ERR(("cannot register capture device. skipping.\n"));
saa7146_vv_release(dev);
kfree(av7110);
@@ -4229,7 +4213,9 @@ int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *p
saa7146_write(dev, GPIO_CTRL, 0x500000);
saa7146_i2c_adapter_prepare(dev, NULL, SAA7146_I2C_BUS_BIT_RATE_3200);
- 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) {
saa7146_unregister_device(&av7110->vd, dev);
@@ -4238,6 +4224,7 @@ int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *p
kfree(av7110);
return -ENOMEM;
}
+
saa7146_write(dev, PCI_BT_V1, 0x1c00101f);
saa7146_write(dev, BCS_CTRL, 0x80400040);
@@ -4282,13 +4269,13 @@ int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *p
/* allocate and init buffers */
av7110->debi_virt = pci_alloc_consistent(dev->pci, 8192,
&av7110->debi_bus);
- if (!av7110->debi_virt) {
+ if (!av7110->debi_virt) {
ret = -ENOMEM;
goto err;
}
av7110->iobuf = vmalloc(AVOUTLEN+AOUTLEN+BMPLEN+4*IPACKS);
- if (!av7110->iobuf) {
+ if (!av7110->iobuf) {
ret = -ENOMEM;
goto err;
}
@@ -4309,61 +4296,57 @@ int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *p
/* handle different card types */
/* load firmware into AV7110 cards */
-// if (av7110->card_type->type==DVB_CARD_TT_SIEMENS) {
- bootarm(av7110);
- firmversion(av7110);
- if ((av7110->arm_app&0xffff)<0x2501) {
- printk("av7110: Warning, firmware version 0x%04x is too old. "
- "System might be unstable!\n",
- (av7110->arm_app&0xffff));
- }
- kernel_thread(arm_thread, (void *) av7110, 0);
-// }
- SetVolume(av7110, 0xff, 0xff);
+ bootarm(av7110);
+ firmversion(av7110);
-// if (av7110->card_type->type==DVB_CARD_TT_SIEMENS) {
- VidMode(av7110, vidmode);
+ if ((av7110->arm_app&0xffff)<0x2501)
+ printk ("av7110: Warning, firmware version 0x%04x is too old. "
+ "System might be unstable!\n", av7110->arm_app&0xffff);
- /* remaining inits according to card and frontend type */
+ kernel_thread(arm_thread, (void *) av7110, 0);
- 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;
- i2c_writereg(av7110, 0x20, 0x01, 0xd2);
- i2c_writereg(av7110, 0x20, 0x02, 0x49);
- i2c_writereg(av7110, 0x20, 0x03, 0x00);
- i2c_writereg(av7110, 0x20, 0x04, 0x00);
- }
+ SetVolume(av7110, 0xff, 0xff);
+ VidMode(av7110, vidmode);
+
+ /* remaining inits according to card and frontend type */
+ 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;
+ i2c_writereg(av7110, 0x20, 0x01, 0xd2);
+ i2c_writereg(av7110, 0x20, 0x02, 0x49);
+ i2c_writereg(av7110, 0x20, 0x03, 0x00);
+ i2c_writereg(av7110, 0x20, 0x04, 0x00);
+ }
- /**
- * some special handling for the Siemens DVB-C card...
- */
- if (dev->pci->subsystem_vendor == 0x110a) {
- if (i2c_writereg(av7110, 0x80, 0x0, 0x80)==1) {
- i2c_writereg(av7110, 0x80, 0x0, 0);
- printk("av7110: DVB-C analog module detected, "
- "initializing MSP3400\n");
- ddelay(10);
- msp_writereg(av7110, 0x12, 0x0013, 0x0c00);
- msp_writereg(av7110, 0x12, 0x0000, 0x7f00); // loudspeaker + headphone
- msp_writereg(av7110, 0x12, 0x0008, 0x0220); // loudspeaker source
- msp_writereg(av7110, 0x12, 0x0004, 0x7f00); // loudspeaker volume
- msp_writereg(av7110, 0x12, 0x000a, 0x0220); // SCART 1 source
- msp_writereg(av7110, 0x12, 0x0007, 0x7f00); // SCART 1 volume
- msp_writereg(av7110, 0x12, 0x000d, 0x4800); // prescale SCART
- }
+
+ /**
+ * some special handling for the Siemens DVB-C card...
+ */
+ if (dev->pci->subsystem_vendor == 0x110a) {
+ if (i2c_writereg(av7110, 0x80, 0x0, 0x80)==1) {
+ i2c_writereg(av7110, 0x80, 0x0, 0);
+ printk ("av7110: DVB-C analog module detected, "
+ "initializing MSP3400\n");
+ ddelay(10);
+ msp_writereg(av7110, 0x12, 0x0013, 0x0c00);
+ msp_writereg(av7110, 0x12, 0x0000, 0x7f00); // loudspeaker + headphone
+ msp_writereg(av7110, 0x12, 0x0008, 0x0220); // loudspeaker source
+ msp_writereg(av7110, 0x12, 0x0004, 0x7f00); // loudspeaker volume
+ msp_writereg(av7110, 0x12, 0x000a, 0x0220); // SCART 1 source
+ msp_writereg(av7110, 0x12, 0x0007, 0x7f00); // SCART 1 volume
+ msp_writereg(av7110, 0x12, 0x000d, 0x4800); // prescale SCART
+ }
- // switch DVB SCART on
- outcom(av7110, COMTYPE_AUDIODAC, MainSwitch, 1, 0);
- outcom(av7110, COMTYPE_AUDIODAC, ADSwitch, 1, 1);
-
- //saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // RGB on, SCART pin 16
- //saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // SCARTpin 8
- av7110->adac_type = DVB_ADAC_NONE;
- }
-// }
+
+ // switch DVB SCART on
+ outcom(av7110, COMTYPE_AUDIODAC, MainSwitch, 1, 0);
+ outcom(av7110, COMTYPE_AUDIODAC, ADSwitch, 1, 1);
+ //saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // RGB on, SCART pin 16
+ //saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // SCARTpin 8
+ av7110->adac_type = DVB_ADAC_NONE;
+ }
av7110_setup_irc_config (av7110, 0);
av7110_register(av7110);
@@ -4373,14 +4356,18 @@ int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *p
return 0;
err:
- if( NULL != av7110 ) {
+ if (av7110 )
kfree(av7110);
- }
- /* FIXME: error handling is totally bogus: memory does not get freed ... */
+
+ /* FIXME: error handling is pretty bogus: memory does not get freed...*/
saa7146_unregister_device(&av7110->vd, dev);
saa7146_vv_release(dev);
- dvb_unregister_i2c_bus (master_xfer,av7110->i2c_bus->adapter, av7110->i2c_bus->id);
+
+ dvb_unregister_i2c_bus (master_xfer,av7110->i2c_bus->adapter,
+ av7110->i2c_bus->id);
+
dvb_unregister_adapter (av7110->dvb_adapter);
+
return ret;
}
@@ -4432,15 +4419,14 @@ void av7110_irq(struct saa7146_dev* dev, u32 *isr)
DEB_EE(("dev: %p, av7110: %p\n",dev,av7110));
- if (*isr & MASK_19) {
+ if (*isr & MASK_19)
tasklet_schedule (&av7110->debi_tasklet);
- }
- if (*isr & MASK_03) {
+ if (*isr & MASK_03)
tasklet_schedule (&av7110->gpio_tasklet);
- }
}
+
/* FIXME: these values are experimental values that look better than the
values from the latest "official" driver -- at least for me... (MiHu) */
static