diff options
author | Davor Emard <devnull@localhost> | 2003-02-15 15:56:42 +0000 |
---|---|---|
committer | Davor Emard <devnull@localhost> | 2003-02-15 15:56:42 +0000 |
commit | b7d208aa516916b1e2726b1363b7002b408fdeef (patch) | |
tree | b4a5e08757b4a12dad43d0ea367159454e1272c5 /linux/drivers/media | |
parent | 172096a1f2d72d7a6e60f9da73e8c6ee58d716f9 (diff) | |
download | mediapointer-dvb-s2-b7d208aa516916b1e2726b1363b7002b408fdeef.tar.gz mediapointer-dvb-s2-b7d208aa516916b1e2726b1363b7002b408fdeef.tar.bz2 |
Replacing tabs with spaces and some code beautifying
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/dvb/ttpci-budget/budget-patch.c | 343 |
1 files changed, 171 insertions, 172 deletions
diff --git a/linux/drivers/media/dvb/ttpci-budget/budget-patch.c b/linux/drivers/media/dvb/ttpci-budget/budget-patch.c index 0f0c27034..7e1cb6d73 100644 --- a/linux/drivers/media/dvb/ttpci-budget/budget-patch.c +++ b/linux/drivers/media/dvb/ttpci-budget/budget-patch.c @@ -43,10 +43,10 @@ MAKE_BUDGET_INFO(fs_1_3,"Siemens/Technotrend/Hauppauge PCI rev1.3+Budget_Patch", static struct pci_device_id pci_tbl[] = { - MAKE_EXTENSION_PCI(fs_1_3,0x13c2, 0x0000), - { - .vendor = 0, - } + MAKE_EXTENSION_PCI(fs_1_3,0x13c2, 0x0000), + { + .vendor = 0, + } }; @@ -56,66 +56,65 @@ struct pci_device_id pci_tbl[] = { typedef enum { - AudioDAC, - CabADAC, - ON22K, - OFF22K, - MainSwitch, - ADSwitch, - SendDiSEqC, - SetRegister + AudioDAC, + CabADAC, + ON22K, + OFF22K, + MainSwitch, + ADSwitch, + SendDiSEqC, + SetRegister } AUDCOM; typedef enum { - COMTYPE_NOCOM, - COMTYPE_PIDFILTER, - COMTYPE_MPEGDECODER, - COMTYPE_OSD, - COMTYPE_BMP, - COMTYPE_ENCODER, - COMTYPE_AUDIODAC, - COMTYPE_REQUEST, - COMTYPE_SYSTEM, - COMTYPE_REC_PLAY, - COMTYPE_COMMON_IF, - COMTYPE_PID_FILTER, - COMTYPE_PES, - COMTYPE_TS, - COMTYPE_VIDEO, - COMTYPE_AUDIO, - COMTYPE_CI_LL, + COMTYPE_NOCOM, + COMTYPE_PIDFILTER, + COMTYPE_MPEGDECODER, + COMTYPE_OSD, + COMTYPE_BMP, + COMTYPE_ENCODER, + COMTYPE_AUDIODAC, + COMTYPE_REQUEST, + COMTYPE_SYSTEM, + COMTYPE_REC_PLAY, + COMTYPE_COMMON_IF, + COMTYPE_PID_FILTER, + COMTYPE_PES, + COMTYPE_TS, + COMTYPE_VIDEO, + COMTYPE_AUDIO, + COMTYPE_CI_LL, } COMTYPE; -static int -wdebi(struct budget_patch *budget, - u32 config, int addr, u32 val, int count) +static +int wdebi(struct budget_patch *budget, u32 config, int addr, u32 val, int count) { struct saa7146_dev *dev=budget->dev; - DEB_EE(("budget: %p\n", budget)); + DEB_EE(("budget: %p\n", budget)); - if (count <= 0 || count > 4) - return -1; + if (count <= 0 || count > 4) + return -1; - saa7146_write(dev, DEBI_CONFIG, config); + saa7146_write(dev, DEBI_CONFIG, config); - saa7146_write(dev, DEBI_AD, val ); - saa7146_write(dev, DEBI_COMMAND, (count << 17) | (addr & 0xffff)); - saa7146_write(dev, MC2, (2 << 16) | 2); + saa7146_write(dev, DEBI_AD, val ); + saa7146_write(dev, DEBI_COMMAND, (count << 17) | (addr & 0xffff)); + saa7146_write(dev, MC2, (2 << 16) | 2); mdelay(5); - return 0; + return 0; } -static int -SOutCommand(struct budget_patch *budget, u16* buf, int length) +static +int SOutCommand(struct budget_patch *budget, u16* buf, int length) { int i; - DEB_EE(("budget: %p\n", budget)); + DEB_EE(("budget: %p\n", budget)); for (i = 2; i < length; i++) wdebi(budget, DEBINOSWAP, COMMAND + 2*i, (u32) buf[i], 2); @@ -130,199 +129,199 @@ SOutCommand(struct budget_patch *budget, u16* buf, int length) } -static void -av7110_Set22K(struct budget_patch *budget, int state) +static +void av7110_set22k(struct budget_patch *budget, int state) { u16 buf[2] = {( COMTYPE_AUDIODAC << 8) | (state ? ON22K : OFF22K), 0}; - DEB_EE(("budget: %p\n", budget)); - SOutCommand(budget, buf, 2); + DEB_EE(("budget: %p\n", budget)); + SOutCommand(budget, buf, 2); } static int av7110_send_diseqc_msg(struct budget_patch *budget, 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 }; + 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(("budget: %p\n", budget)); + DEB_EE(("budget: %p\n", budget)); if (len>10) - len=10; + len=10; - buf[1] = len+2; - buf[2] = len; + buf[1] = len+2; + buf[2] = len; - if (burst != -1) - buf[3]=burst ? 0x01 : 0x00; + if (burst != -1) + buf[3]=burst ? 0x01 : 0x00; else - buf[3]=0xffff; + buf[3]=0xffff; - for (i=0; i<len; i++) - buf[i+4]=msg[i]; + for (i=0; i<len; i++) + buf[i+4]=msg[i]; - SOutCommand(budget, buf, 18); - return 0; + SOutCommand(budget, buf, 18); + return 0; } int budget_patch_diseqc_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) { - struct budget_patch *budget = fe->before_after_data; - - DEB_EE(("budget: %p\n", budget)); - - switch (cmd) { - case FE_SET_TONE: - switch ((fe_sec_tone_mode_t) arg) { - case SEC_TONE_ON: - av7110_Set22K (budget, 1); - break; - case SEC_TONE_OFF: - av7110_Set22K (budget, 0); - break; - default: - return -EINVAL; - } - break; - - case FE_DISEQC_SEND_MASTER_CMD: - { - struct dvb_diseqc_master_cmd *cmd = arg; - - av7110_send_diseqc_msg (budget, cmd->msg_len, cmd->msg, 0); - break; - } + struct budget_patch *budget = fe->before_after_data; + + DEB_EE(("budget: %p\n", budget)); + + switch (cmd) { + case FE_SET_TONE: + switch ((fe_sec_tone_mode_t) arg) { + case SEC_TONE_ON: + av7110_set22k (budget, 1); + break; + case SEC_TONE_OFF: + av7110_set22k (budget, 0); + break; + default: + return -EINVAL; + } + break; + + case FE_DISEQC_SEND_MASTER_CMD: + { + struct dvb_diseqc_master_cmd *cmd = arg; + + av7110_send_diseqc_msg (budget, cmd->msg_len, cmd->msg, 0); + break; + } case FE_DISEQC_SEND_BURST: - av7110_send_diseqc_msg (budget, 0, NULL, (int) arg); - break; + av7110_send_diseqc_msg (budget, 0, NULL, (int) arg); + break; - default: - return -EOPNOTSUPP; - } + default: + return -EOPNOTSUPP; + } - return 0; + return 0; } static int budget_patch_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *info) { - struct budget_patch *budget; - int err; - int cnt; + struct budget_patch *budget; + int err; + int cnt; - if (!(budget = kmalloc (sizeof(struct budget_patch), GFP_KERNEL))) - return -ENOMEM; + if (!(budget = kmalloc (sizeof(struct budget_patch), GFP_KERNEL))) + return -ENOMEM; - DEB_EE(("budget: %p\n",budget)); + DEB_EE(("budget: %p\n",budget)); - if ((err = ttpci_budget_init (budget, dev, info))) { - kfree (budget); - return err; - } + if ((err = ttpci_budget_init (budget, dev, info))) { + kfree (budget); + return err; + } /* -** This code will setup the SAA7146_RPS1 to generate a square -** wave on GPIO3, changing when a field (TS_HEIGHT/2 "lines" of -** TS_WIDTH packets) has been acquired on SAA7146_D1B video port; -** then, this GPIO3 output which is connected to the D1B_VSYNC -** input, will trigger the acquisition of the alternate field -** and so on. -** Currently, the TT_budget / WinTV_Nova cards have two ICs -** (74HCT4040, LVC74) for the generation of this VSYNC signal, -** which seems that can be done perfectly without this :-)). +** This code will setup the SAA7146_RPS1 to generate a square +** wave on GPIO3, changing when a field (TS_HEIGHT/2 "lines" of +** TS_WIDTH packets) has been acquired on SAA7146_D1B video port; +** then, this GPIO3 output which is connected to the D1B_VSYNC +** input, will trigger the acquisition of the alternate field +** and so on. +** Currently, the TT_budget / WinTV_Nova cards have two ICs +** (74HCT4040, LVC74) for the generation of this VSYNC signal, +** which seems that can be done perfectly without this :-)). */ - cnt = 0; // Setup RPS1 "program" (p35) - // Wait reset Source Line Counter Threshold (p36) - dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | RPS_INV | EVT_HS); - // Wait Source Line Counter Threshold (p36) - dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | EVT_HS); - // Set GPIO3=1 (p42) - dev->rps1[cnt++]=cpu_to_le32(CMD_WR_REG_MASK | (GPIO_CTRL>>2)); - dev->rps1[cnt++]=cpu_to_le32(GPIO3_MSK); - dev->rps1[cnt++]=cpu_to_le32(SAA7146_GPIO_OUTHI<<24); - // Wait reset Source Line Counter Threshold (p36) - dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | RPS_INV | EVT_HS); - // Wait Source Line Counter Threshold - dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | EVT_HS); - // Set GPIO3=0 (p42) - dev->rps1[cnt++]=cpu_to_le32(CMD_WR_REG_MASK | (GPIO_CTRL>>2)); - dev->rps1[cnt++]=cpu_to_le32(GPIO3_MSK); - dev->rps1[cnt++]=cpu_to_le32(SAA7146_GPIO_OUTLO<<24); - // Jump to begin of RPS program (p37) - dev->rps1[cnt++]=cpu_to_le32(CMD_JUMP); - dev->rps1[cnt++]=cpu_to_le32(virt_to_bus(&dev->rps1[0])); - - // Fix VSYNC level - saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); - // Set RPS1 Address register to point to RPS code (r108 p42) - saa7146_write(dev, RPS_ADDR1, virt_to_bus(&dev->rps1[0])); - // Set Source Line Counter Threshold, using BRS (rCC p43) - saa7146_write(dev, RPS_THRESH1, ((TS_HEIGHT/2) | MASK_12)); - // Enable RPS1 (rFC p33) - saa7146_write(dev, MC1, (MASK_13 | MASK_29)); - - dvb_add_frontend_ioctls (budget->dvb_adapter, - budget_patch_diseqc_ioctl, NULL, budget); - - dev->ext_priv = budget; - - return 0; + cnt = 0; // Setup RPS1 "program" (p35) + // Wait reset Source Line Counter Threshold (p36) + dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | RPS_INV | EVT_HS); + // Wait Source Line Counter Threshold (p36) + dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | EVT_HS); + // Set GPIO3=1 (p42) + dev->rps1[cnt++]=cpu_to_le32(CMD_WR_REG_MASK | (GPIO_CTRL>>2)); + dev->rps1[cnt++]=cpu_to_le32(GPIO3_MSK); + dev->rps1[cnt++]=cpu_to_le32(SAA7146_GPIO_OUTHI<<24); + // Wait reset Source Line Counter Threshold (p36) + dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | RPS_INV | EVT_HS); + // Wait Source Line Counter Threshold + dev->rps1[cnt++]=cpu_to_le32(CMD_PAUSE | EVT_HS); + // Set GPIO3=0 (p42) + dev->rps1[cnt++]=cpu_to_le32(CMD_WR_REG_MASK | (GPIO_CTRL>>2)); + dev->rps1[cnt++]=cpu_to_le32(GPIO3_MSK); + dev->rps1[cnt++]=cpu_to_le32(SAA7146_GPIO_OUTLO<<24); + // Jump to begin of RPS program (p37) + dev->rps1[cnt++]=cpu_to_le32(CMD_JUMP); + dev->rps1[cnt++]=cpu_to_le32(virt_to_bus(&dev->rps1[0])); + + // Fix VSYNC level + saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); + // Set RPS1 Address register to point to RPS code (r108 p42) + saa7146_write(dev, RPS_ADDR1, virt_to_bus(&dev->rps1[0])); + // Set Source Line Counter Threshold, using BRS (rCC p43) + saa7146_write(dev, RPS_THRESH1, ((TS_HEIGHT/2) | MASK_12)); + // Enable RPS1 (rFC p33) + saa7146_write(dev, MC1, (MASK_13 | MASK_29)); + + dvb_add_frontend_ioctls (budget->dvb_adapter, + budget_patch_diseqc_ioctl, NULL, budget); + + dev->ext_priv = budget; + + return 0; } static int budget_patch_detach (struct saa7146_dev* dev) { - struct budget_patch *budget = (struct budget_patch*) dev->ext_priv; - int err; + struct budget_patch *budget = (struct budget_patch*) dev->ext_priv; + int err; - dvb_remove_frontend_ioctls (budget->dvb_adapter, - budget_patch_diseqc_ioctl, NULL); + dvb_remove_frontend_ioctls (budget->dvb_adapter, + budget_patch_diseqc_ioctl, NULL); - err = ttpci_budget_deinit (budget); + err = ttpci_budget_deinit (budget); - kfree (budget); + kfree (budget); - return err; + return err; } - static int __init budget_patch_init(void) { - if (saa7146_register_extension(&budget_extension)) - return -ENODEV; - - return 0; + if (saa7146_register_extension(&budget_extension)) + return -ENODEV; + + return 0; } static void __exit budget_patch_exit(void) { - DEB_EE((".\n")); - saa7146_unregister_extension(&budget_extension); + DEB_EE((".\n")); + saa7146_unregister_extension(&budget_extension); } + static struct saa7146_extension budget_extension = { - .name = "budget_patch dvb\0", - .flags = 0, - .ext_vv_data = NULL, - - .module = THIS_MODULE, - .pci_tbl = pci_tbl, - .attach = budget_patch_attach, - .detach = budget_patch_detach, - - .irq_mask = MASK_10, - .irq_func = ttpci_budget_irq10_handler, + .name = "budget_patch dvb\0", + .flags = 0, + .ext_vv_data = NULL, + + .module = THIS_MODULE, + .pci_tbl = pci_tbl, + .attach = budget_patch_attach, + .detach = budget_patch_detach, + + .irq_mask = MASK_10, + .irq_func = ttpci_budget_irq10_handler, }; |