Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] cx88: make checkpatch happier

This driver is old, and have lots of checkpatch violations.
As we're touching a lot on this driver due to the printk
conversions, let's run checkpatch --fix on it, in order to
solve some of those issues.

Also, do a few manual adjustments:
- remove the FSF address and use the usual coding style
for the initial comments;
- use WARN_ON() instead of BUG_ON();
- remove an unused typedef;
- break a few long lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

+515 -559
+39 -40
drivers/media/pci/cx88/cx88-alsa.c
··· 1 1 /* 2 - * 3 2 * Support for audio capture 4 3 * PCI function #1 of the cx2388x. 5 4 * ··· 17 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 20 * GNU General Public License for more details. 20 - * 21 - * You should have received a copy of the GNU General Public License 22 - * along with this program; if not, write to the Free Software 23 - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 21 */ 25 22 26 23 #include "cx88.h" ··· 113 118 114 119 MODULE_SUPPORTED_DEVICE("{{Conexant,23881},{{Conexant,23882},{{Conexant,23883}"); 115 120 static unsigned int debug; 116 - module_param(debug,int,0644); 117 - MODULE_PARM_DESC(debug,"enable debug messages"); 121 + module_param(debug, int, 0644); 122 + MODULE_PARM_DESC(debug, "enable debug messages"); 118 123 119 124 /**************************************************************************** 120 125 Module specific funtions ··· 127 132 static int _cx88_start_audio_dma(snd_cx88_card_t *chip) 128 133 { 129 134 struct cx88_audio_buffer *buf = chip->buf; 130 - struct cx88_core *core=chip->core; 135 + struct cx88_core *core = chip->core; 131 136 const struct sram_channel *audio_ch = &cx88_sram_channels[SRAM_CH25]; 132 137 133 138 /* Make sure RISC/FIFO are off before changing FIFO/RISC settings */ ··· 172 177 */ 173 178 static int _cx88_stop_audio_dma(snd_cx88_card_t *chip) 174 179 { 175 - struct cx88_core *core=chip->core; 180 + struct cx88_core *core = chip->core; 181 + 176 182 dprintk(1, "Stopping audio DMA\n"); 177 183 178 184 /* stop dma */ ··· 257 261 for (loop = 0; loop < MAX_IRQ_LOOP; loop++) { 258 262 status = cx_read(MO_PCI_INTSTAT) & 259 263 (core->pci_irqmask | PCI_INT_AUDINT); 260 - if (0 == status) 264 + if (status == 0) 261 265 goto out; 262 266 dprintk(3, "cx8801_irq loop %d/%d, status %x\n", 263 267 loop, MAX_IRQ_LOOP, status); ··· 270 274 cx8801_aud_irq(chip); 271 275 } 272 276 273 - if (MAX_IRQ_LOOP == loop) { 277 + if (loop == MAX_IRQ_LOOP) { 274 278 pr_err("IRQ loop detected, disabling interrupts\n"); 275 279 cx_clear(MO_PCI_INTMSK, PCI_INT_AUDINT); 276 280 } ··· 286 290 int i; 287 291 288 292 buf->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT); 289 - if (NULL == buf->vaddr) { 293 + if (buf->vaddr == NULL) { 290 294 dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages); 291 295 return -ENOMEM; 292 296 } ··· 299 303 buf->nr_pages = nr_pages; 300 304 301 305 buf->sglist = vzalloc(buf->nr_pages * sizeof(*buf->sglist)); 302 - if (NULL == buf->sglist) 306 + if (buf->sglist == NULL) 303 307 goto vzalloc_err; 304 308 305 309 sg_init_table(buf->sglist, buf->nr_pages); 306 310 for (i = 0; i < buf->nr_pages; i++) { 307 311 pg = vmalloc_to_page(buf->vaddr + i * PAGE_SIZE); 308 - if (NULL == pg) 312 + if (pg == NULL) 309 313 goto vmalloc_to_page_err; 310 314 sg_set_page(&buf->sglist[i], pg, PAGE_SIZE, 0); 311 315 } ··· 327 331 buf->sglen = dma_map_sg(&dev->pci->dev, buf->sglist, 328 332 buf->nr_pages, PCI_DMA_FROMDEVICE); 329 333 330 - if (0 == buf->sglen) { 334 + if (buf->sglen == 0) { 331 335 pr_warn("%s: cx88_alsa_map_sg failed\n", __func__); 332 336 return -ENOMEM; 333 337 } ··· 362 366 363 367 BUG_ON(!chip->dma_size); 364 368 365 - dprintk(2,"Freeing buffer\n"); 369 + dprintk(2, "Freeing buffer\n"); 366 370 cx88_alsa_dma_unmap(chip); 367 371 cx88_alsa_dma_free(chip->buf); 368 372 if (risc->cpu) ··· 427 431 428 432 if (cx88_sram_channels[SRAM_CH25].fifo_size != DEFAULT_FIFO_SIZE) { 429 433 unsigned int bpl = cx88_sram_channels[SRAM_CH25].fifo_size / 4; 434 + 430 435 bpl &= ~7; /* must be multiple of 8 */ 431 436 runtime->hw.period_bytes_min = bpl; 432 437 runtime->hw.period_bytes_max = bpl; ··· 435 438 436 439 return 0; 437 440 _error: 438 - dprintk(1,"Error opening PCM!\n"); 441 + dprintk(1, "Error opening PCM!\n"); 439 442 return err; 440 443 } 441 444 ··· 450 453 /* 451 454 * hw_params callback 452 455 */ 453 - static int snd_cx88_hw_params(struct snd_pcm_substream * substream, 454 - struct snd_pcm_hw_params * hw_params) 456 + static int snd_cx88_hw_params(struct snd_pcm_substream *substream, 457 + struct snd_pcm_hw_params *hw_params) 455 458 { 456 459 snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); 457 460 ··· 471 474 BUG_ON(chip->num_periods & (chip->num_periods-1)); 472 475 473 476 buf = kzalloc(sizeof(*buf), GFP_KERNEL); 474 - if (NULL == buf) 477 + if (buf == NULL) 475 478 return -ENOMEM; 476 479 477 480 chip->buf = buf; ··· 508 511 /* 509 512 * hw free callback 510 513 */ 511 - static int snd_cx88_hw_free(struct snd_pcm_substream * substream) 514 + static int snd_cx88_hw_free(struct snd_pcm_substream *substream) 512 515 { 513 516 514 517 snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); ··· 542 545 543 546 switch (cmd) { 544 547 case SNDRV_PCM_TRIGGER_START: 545 - err=_cx88_start_audio_dma(chip); 548 + err = _cx88_start_audio_dma(chip); 546 549 break; 547 550 case SNDRV_PCM_TRIGGER_STOP: 548 - err=_cx88_stop_audio_dma(chip); 551 + err = _cx88_stop_audio_dma(chip); 549 552 break; 550 553 default: 551 - err=-EINVAL; 554 + err = -EINVAL; 552 555 break; 553 556 } 554 557 ··· 581 584 unsigned long offset) 582 585 { 583 586 void *pageptr = substream->runtime->dma_area + offset; 587 + 584 588 return vmalloc_to_page(pageptr); 585 589 } 586 590 ··· 636 638 struct snd_ctl_elem_value *value) 637 639 { 638 640 snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); 639 - struct cx88_core *core=chip->core; 641 + struct cx88_core *core = chip->core; 640 642 int vol = 0x3f - (cx_read(AUD_VOL_CTL) & 0x3f), 641 643 bal = cx_read(AUD_BAL_CTL); 642 644 ··· 673 675 struct snd_ctl_elem_value *value) 674 676 { 675 677 snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); 676 - struct cx88_core *core=chip->core; 678 + struct cx88_core *core = chip->core; 677 679 int left, right, v, b; 678 680 int changed = 0; 679 681 u32 old; ··· 812 814 */ 813 815 814 816 static const struct pci_device_id cx88_audio_pci_tbl[] = { 815 - {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, 816 - {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, 817 + {0x14f1, 0x8801, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 818 + {0x14f1, 0x8811, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 817 819 {0, } 818 820 }; 819 821 MODULE_DEVICE_TABLE(pci, cx88_audio_pci_tbl); ··· 828 830 if (chip->irq >= 0) 829 831 free_irq(chip->irq, chip); 830 832 831 - cx88_core_put(chip->core,chip->pci); 833 + cx88_core_put(chip->core, chip->pci); 832 834 833 835 pci_disable_device(chip->pci); 834 836 return 0; ··· 837 839 /* 838 840 * Component Destructor 839 841 */ 840 - static void snd_cx88_dev_free(struct snd_card * card) 842 + static void snd_cx88_dev_free(struct snd_card *card) 841 843 { 842 844 snd_cx88_card_t *chip = card->private_data; 843 845 ··· 870 872 chip = card->private_data; 871 873 872 874 core = cx88_core_get(pci); 873 - if (NULL == core) { 875 + if (core == NULL) { 874 876 err = -EINVAL; 875 877 return err; 876 878 } 877 879 878 - err = pci_set_dma_mask(pci,DMA_BIT_MASK(32)); 880 + err = pci_set_dma_mask(pci, DMA_BIT_MASK(32)); 879 881 if (err) { 880 - dprintk(0, "%s/1: Oops: no 32bit PCI DMA ???\n",core->name); 882 + dprintk(0, "%s/1: Oops: no 32bit PCI DMA ???\n", core->name); 881 883 cx88_core_put(core, pci); 882 884 return err; 883 885 } ··· 906 908 dprintk(1, "ALSA %s/%i: found at %s, rev: %d, irq: %d, latency: %d, mmio: 0x%llx\n", 907 909 core->name, devno, 908 910 pci_name(pci), pci->revision, pci->irq, 909 - pci_lat, (unsigned long long)pci_resource_start(pci,0)); 911 + pci_lat, (unsigned long long)pci_resource_start(pci, 0)); 910 912 911 913 chip->irq = pci->irq; 912 914 synchronize_irq(chip->irq); ··· 962 964 if (core->sd_wm8775) 963 965 snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch, chip)); 964 966 965 - strcpy (card->driver, "CX88x"); 967 + strcpy(card->driver, "CX88x"); 966 968 sprintf(card->shortname, "Conexant CX%x", pci->device); 967 969 sprintf(card->longname, "%s at %#llx", 968 - card->shortname,(unsigned long long)pci_resource_start(pci, 0)); 969 - strcpy (card->mixername, "CX88"); 970 + card->shortname, 971 + (unsigned long long)pci_resource_start(pci, 0)); 972 + strcpy(card->mixername, "CX88"); 970 973 971 - dprintk (0, "%s/%i: ALSA support for cx2388x boards\n", 972 - card->driver,devno); 974 + dprintk(0, "%s/%i: ALSA support for cx2388x boards\n", 975 + card->driver, devno); 973 976 974 977 err = snd_card_register(card); 975 978 if (err < 0) 976 979 goto error; 977 - pci_set_drvdata(pci,card); 980 + pci_set_drvdata(pci, card); 978 981 979 982 devno++; 980 983 return 0;
+45 -49
drivers/media/pci/cx88/cx88-blackbird.c
··· 1 1 /* 2 - * 3 2 * Support for a cx23416 mpeg encoder via cx2388x host port. 4 3 * "blackbird" reference design. 5 4 * ··· 19 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 22 * GNU General Public License for more details. 22 - * 23 - * You should have received a copy of the GNU General Public License 24 - * along with this program; if not, write to the Free Software 25 - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 26 23 */ 27 24 28 25 #include "cx88.h" ··· 41 46 MODULE_VERSION(CX88_VERSION); 42 47 43 48 static unsigned int debug; 44 - module_param(debug,int,0644); 45 - MODULE_PARM_DESC(debug,"enable debug messages [blackbird]"); 49 + module_param(debug, int, 0644); 50 + MODULE_PARM_DESC(debug, "enable debug messages [blackbird]"); 46 51 47 52 #define dprintk(level, fmt, arg...) do { \ 48 53 if (debug + 1 > level) \ ··· 211 216 static int wait_ready_gpio0_bit1(struct cx88_core *core, u32 state) 212 217 { 213 218 unsigned long timeout = jiffies + msecs_to_jiffies(1); 214 - u32 gpio0,need; 219 + u32 gpio0, need; 215 220 216 221 need = state ? 2 : 0; 217 222 for (;;) { 218 223 gpio0 = cx_read(MO_GP0_IO) & 2; 219 224 if (need == gpio0) 220 225 return 0; 221 - if (time_after(jiffies,timeout)) 226 + if (time_after(jiffies, timeout)) 222 227 return -1; 223 228 udelay(1); 224 229 } ··· 237 242 cx_read(P1_MDATA0); 238 243 cx_read(P1_MADDR0); 239 244 240 - return wait_ready_gpio0_bit1(core,1); 245 + return wait_ready_gpio0_bit1(core, 1); 241 246 } 242 247 243 248 static int memory_read(struct cx88_core *core, u32 address, u32 *value) ··· 251 256 cx_writeb(P1_MADDR0, (unsigned int)address); 252 257 cx_read(P1_MADDR0); 253 258 254 - retval = wait_ready_gpio0_bit1(core,1); 259 + retval = wait_ready_gpio0_bit1(core, 1); 255 260 256 261 cx_writeb(P1_MDATA3, 0); 257 262 val = (unsigned char)cx_read(P1_MDATA3) << 24; ··· 278 283 cx_read(P1_RDATA0); 279 284 cx_read(P1_RADDR0); 280 285 281 - return wait_ready_gpio0_bit1(core,1); 286 + return wait_ready_gpio0_bit1(core, 1); 282 287 } 283 288 284 289 ··· 292 297 cx_writeb(P1_RRDWR, 0); 293 298 cx_read(P1_RADDR0); 294 299 295 - retval = wait_ready_gpio0_bit1(core,1); 300 + retval = wait_ready_gpio0_bit1(core, 1); 296 301 val = (unsigned char)cx_read(P1_RDATA0); 297 302 val |= (unsigned char)cx_read(P1_RDATA1) << 8; 298 303 val |= (unsigned char)cx_read(P1_RDATA2) << 16; ··· 311 316 u32 value, flag, retval; 312 317 int i; 313 318 314 - dprintk(1,"%s: 0x%X\n", __func__, command); 319 + dprintk(1, "%s: 0x%X\n", __func__, command); 315 320 316 321 /* this may not be 100% safe if we can't read any memory location 317 322 without side effects */ ··· 349 354 memory_read(dev->core, dev->mailbox, &flag); 350 355 if (0 != (flag & 4)) 351 356 break; 352 - if (time_after(jiffies,timeout)) { 357 + if (time_after(jiffies, timeout)) { 353 358 dprintk(0, "ERROR: API Mailbox timeout %x\n", command); 354 359 return -EIO; 355 360 } ··· 363 368 } 364 369 365 370 memory_read(dev->core, dev->mailbox + 2, &retval); 366 - dprintk(1, "API result = %d\n",retval); 371 + dprintk(1, "API result = %d\n", retval); 367 372 368 373 flag = 0; 369 374 memory_write(dev->core, dev->mailbox, flag); ··· 395 400 396 401 static int blackbird_find_mailbox(struct cx8802_dev *dev) 397 402 { 398 - u32 signature[4]={0x12345678, 0x34567812, 0x56781234, 0x78123456}; 399 - int signaturecnt=0; 403 + u32 signature[4] = {0x12345678, 0x34567812, 0x56781234, 0x78123456}; 404 + int signaturecnt = 0; 400 405 u32 value; 401 406 int i; 402 407 ··· 406 411 signaturecnt++; 407 412 else 408 413 signaturecnt = 0; 409 - if (4 == signaturecnt) { 414 + if (signaturecnt == 4) { 410 415 dprintk(1, "Mailbox signature found\n"); 411 416 return i+1; 412 417 } ··· 454 459 return -EINVAL; 455 460 } 456 461 457 - if (0 != memcmp(firmware->data, magic, 8)) { 462 + if (memcmp(firmware->data, magic, 8) != 0) { 458 463 pr_err("Firmware magic mismatch, wrong file?\n"); 459 464 release_firmware(firmware); 460 465 return -EINVAL; 461 466 } 462 467 463 468 /* transfer to the chip */ 464 - dprintk(1,"Loading firmware ...\n"); 469 + dprintk(1, "Loading firmware ...\n"); 465 470 dataptr = (__le32 *)firmware->data; 466 471 for (i = 0; i < (firmware->size >> 2); i++) { 467 472 value = le32_to_cpu(*dataptr); ··· 529 534 int version; 530 535 int retval; 531 536 532 - dprintk(1,"Initialize codec\n"); 537 + dprintk(1, "Initialize codec\n"); 533 538 retval = blackbird_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); /* ping */ 534 539 if (retval < 0) { 535 540 /* ping was not successful, reset and upload firmware */ ··· 777 782 return 0; 778 783 } 779 784 780 - static int vidioc_enum_fmt_vid_cap (struct file *file, void *priv, 785 + static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, 781 786 struct v4l2_fmtdesc *f) 782 787 { 783 788 if (f->index != 0) ··· 810 815 { 811 816 struct cx8802_dev *dev = video_drvdata(file); 812 817 struct cx88_core *core = dev->core; 813 - unsigned maxw, maxh; 818 + unsigned int maxw, maxh; 814 819 enum v4l2_field field; 815 820 816 821 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; ··· 866 871 return 0; 867 872 } 868 873 869 - static int vidioc_s_frequency (struct file *file, void *priv, 874 + static int vidioc_s_frequency(struct file *file, void *priv, 870 875 const struct v4l2_frequency *f) 871 876 { 872 877 struct cx8802_dev *dev = video_drvdata(file); 873 878 struct cx88_core *core = dev->core; 874 879 bool streaming; 875 880 876 - if (unlikely(UNSET == core->board.tuner_type)) 881 + if (unlikely(core->board.tuner_type == UNSET)) 877 882 return -EINVAL; 878 883 if (unlikely(f->tuner != 0)) 879 884 return -EINVAL; ··· 881 886 if (streaming) 882 887 blackbird_stop_codec(dev); 883 888 884 - cx88_set_freq (core,f); 889 + cx88_set_freq(core, f); 885 890 blackbird_initialize_codec(dev); 886 891 cx88_set_scale(core, core->width, core->height, 887 892 core->field); ··· 890 895 return 0; 891 896 } 892 897 893 - static int vidioc_log_status (struct file *file, void *priv) 898 + static int vidioc_log_status(struct file *file, void *priv) 894 899 { 895 900 struct cx8802_dev *dev = video_drvdata(file); 896 901 struct cx88_core *core = dev->core; ··· 902 907 return 0; 903 908 } 904 909 905 - static int vidioc_enum_input (struct file *file, void *priv, 910 + static int vidioc_enum_input(struct file *file, void *priv, 906 911 struct v4l2_input *i) 907 912 { 908 913 struct cx8802_dev *dev = video_drvdata(file); 909 914 struct cx88_core *core = dev->core; 910 - return cx88_enum_input (core,i); 915 + 916 + return cx88_enum_input(core, i); 911 917 } 912 918 913 - static int vidioc_g_frequency (struct file *file, void *priv, 919 + static int vidioc_g_frequency(struct file *file, void *priv, 914 920 struct v4l2_frequency *f) 915 921 { 916 922 struct cx8802_dev *dev = video_drvdata(file); 917 923 struct cx88_core *core = dev->core; 918 924 919 - if (unlikely(UNSET == core->board.tuner_type)) 925 + if (unlikely(core->board.tuner_type == UNSET)) 920 926 return -EINVAL; 921 927 if (unlikely(f->tuner != 0)) 922 928 return -EINVAL; ··· 928 932 return 0; 929 933 } 930 934 931 - static int vidioc_g_input (struct file *file, void *priv, unsigned int *i) 935 + static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) 932 936 { 933 937 struct cx8802_dev *dev = video_drvdata(file); 934 938 struct cx88_core *core = dev->core; ··· 937 941 return 0; 938 942 } 939 943 940 - static int vidioc_s_input (struct file *file, void *priv, unsigned int i) 944 + static int vidioc_s_input(struct file *file, void *priv, unsigned int i) 941 945 { 942 946 struct cx8802_dev *dev = video_drvdata(file); 943 947 struct cx88_core *core = dev->core; ··· 948 952 return -EINVAL; 949 953 950 954 cx88_newstation(core); 951 - cx88_video_mux(core,i); 955 + cx88_video_mux(core, i); 952 956 return 0; 953 957 } 954 958 955 - static int vidioc_g_tuner (struct file *file, void *priv, 959 + static int vidioc_g_tuner(struct file *file, void *priv, 956 960 struct v4l2_tuner *t) 957 961 { 958 962 struct cx8802_dev *dev = video_drvdata(file); 959 963 struct cx88_core *core = dev->core; 960 964 u32 reg; 961 965 962 - if (unlikely(UNSET == core->board.tuner_type)) 966 + if (unlikely(core->board.tuner_type == UNSET)) 963 967 return -EINVAL; 964 - if (0 != t->index) 968 + if (t->index != 0) 965 969 return -EINVAL; 966 970 967 971 strcpy(t->name, "Television"); ··· 969 973 t->rangehigh = 0xffffffffUL; 970 974 call_all(core, tuner, g_tuner, t); 971 975 972 - cx88_get_stereo(core ,t); 976 + cx88_get_stereo(core, t); 973 977 reg = cx_read(MO_DEVICE_STATUS); 974 978 t->signal = (reg & (1<<5)) ? 0xffff : 0x0000; 975 979 return 0; 976 980 } 977 981 978 - static int vidioc_s_tuner (struct file *file, void *priv, 982 + static int vidioc_s_tuner(struct file *file, void *priv, 979 983 const struct v4l2_tuner *t) 980 984 { 981 985 struct cx8802_dev *dev = video_drvdata(file); 982 986 struct cx88_core *core = dev->core; 983 987 984 - if (UNSET == core->board.tuner_type) 988 + if (core->board.tuner_type == UNSET) 985 989 return -EINVAL; 986 - if (0 != t->index) 990 + if (t->index != 0) 987 991 return -EINVAL; 988 992 989 993 cx88_set_stereo(core, t->audmode, 1); ··· 1007 1011 return cx88_set_tvnorm(core, id); 1008 1012 } 1009 1013 1010 - static const struct v4l2_file_operations mpeg_fops = 1011 - { 1014 + static const struct v4l2_file_operations mpeg_fops = { 1015 + 1012 1016 .owner = THIS_MODULE, 1013 1017 .open = v4l2_fh_open, 1014 1018 .release = vb2_fop_release, ··· 1047 1051 static struct video_device cx8802_mpeg_template = { 1048 1052 .name = "cx8802", 1049 1053 .fops = &mpeg_fops, 1050 - .ioctl_ops = &mpeg_ioctl_ops, 1054 + .ioctl_ops = &mpeg_ioctl_ops, 1051 1055 .tvnorms = CX88_NORMS, 1052 1056 }; 1053 1057 ··· 1132 1136 struct vb2_queue *q; 1133 1137 int err; 1134 1138 1135 - dprintk( 1, "%s\n", __func__); 1136 - dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", 1139 + dprintk(1, "%s\n", __func__); 1140 + dprintk(1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", 1137 1141 core->boardnr, 1138 1142 core->name, 1139 1143 core->pci_bus, ··· 1161 1165 1162 1166 /* initial device configuration: needed ? */ 1163 1167 // init_controls(core); 1164 - cx88_set_tvnorm(core,core->tvnorm); 1165 - cx88_video_mux(core,0); 1168 + cx88_set_tvnorm(core, core->tvnorm); 1169 + cx88_video_mux(core, 0); 1166 1170 cx2341x_handler_set_50hz(&dev->cxhdl, core->height == 576); 1167 1171 cx2341x_handler_setup(&dev->cxhdl); 1168 1172
+40 -45
drivers/media/pci/cx88/cx88-cards.c
··· 1 1 /* 2 - * 3 2 * device driver for Conexant 2388x based TV cards 4 3 * card-specific stuff. 5 4 * ··· 13 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 16 * GNU General Public License for more details. 16 - * 17 - * You should have received a copy of the GNU General Public License 18 - * along with this program; if not, write to the Free Software 19 - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 17 */ 21 18 22 19 #include "cx88.h" ··· 33 38 module_param_array(radio, int, NULL, 0444); 34 39 module_param_array(card, int, NULL, 0444); 35 40 36 - MODULE_PARM_DESC(tuner,"tuner type"); 37 - MODULE_PARM_DESC(radio,"radio tuner type"); 38 - MODULE_PARM_DESC(card,"card type"); 41 + MODULE_PARM_DESC(tuner, "tuner type"); 42 + MODULE_PARM_DESC(radio, "radio tuner type"); 43 + MODULE_PARM_DESC(card, "card type"); 39 44 40 45 static unsigned int latency = UNSET; 41 - module_param(latency,int,0444); 42 - MODULE_PARM_DESC(latency,"pci latency timer"); 46 + module_param(latency, int, 0444); 47 + MODULE_PARM_DESC(latency, "pci latency timer"); 43 48 44 49 static int disable_ir; 45 50 module_param(disable_ir, int, 0444); 46 51 MODULE_PARM_DESC(disable_ir, "Disable IR support"); 47 52 48 - #define dprintk(level,fmt, arg...) do { \ 53 + #define dprintk(level, fmt, arg...) do { \ 49 54 if (cx88_core_debug >= level) \ 50 55 printk(KERN_DEBUG pr_fmt("%s: core:" fmt), \ 51 56 __func__, ##arg); \ ··· 2906 2911 int fm; 2907 2912 const char *name; 2908 2913 } gdi_tuner[] = { 2909 - [ 0x01 ] = { .id = UNSET, 2914 + [0x01] = { .id = UNSET, 2910 2915 .name = "NTSC_M" }, 2911 - [ 0x02 ] = { .id = UNSET, 2916 + [0x02] = { .id = UNSET, 2912 2917 .name = "PAL_B" }, 2913 - [ 0x03 ] = { .id = UNSET, 2918 + [0x03] = { .id = UNSET, 2914 2919 .name = "PAL_I" }, 2915 - [ 0x04 ] = { .id = UNSET, 2920 + [0x04] = { .id = UNSET, 2916 2921 .name = "PAL_D" }, 2917 - [ 0x05 ] = { .id = UNSET, 2922 + [0x05] = { .id = UNSET, 2918 2923 .name = "SECAM" }, 2919 2924 2920 - [ 0x10 ] = { .id = UNSET, 2925 + [0x10] = { .id = UNSET, 2921 2926 .fm = 1, 2922 2927 .name = "TEMIC_4049" }, 2923 - [ 0x11 ] = { .id = TUNER_TEMIC_4136FY5, 2928 + [0x11] = { .id = TUNER_TEMIC_4136FY5, 2924 2929 .name = "TEMIC_4136" }, 2925 - [ 0x12 ] = { .id = UNSET, 2930 + [0x12] = { .id = UNSET, 2926 2931 .name = "TEMIC_4146" }, 2927 2932 2928 - [ 0x20 ] = { .id = TUNER_PHILIPS_FQ1216ME, 2933 + [0x20] = { .id = TUNER_PHILIPS_FQ1216ME, 2929 2934 .fm = 1, 2930 2935 .name = "PHILIPS_FQ1216_MK3" }, 2931 - [ 0x21 ] = { .id = UNSET, .fm = 1, 2936 + [0x21] = { .id = UNSET, .fm = 1, 2932 2937 .name = "PHILIPS_FQ1236_MK3" }, 2933 - [ 0x22 ] = { .id = UNSET, 2938 + [0x22] = { .id = UNSET, 2934 2939 .name = "PHILIPS_FI1236_MK3" }, 2935 - [ 0x23 ] = { .id = UNSET, 2940 + [0x23] = { .id = UNSET, 2936 2941 .name = "PHILIPS_FI1216_MK3" }, 2937 2942 }; 2938 2943 ··· 2942 2947 ? gdi_tuner[eeprom_data[0x0d]].name : NULL; 2943 2948 2944 2949 pr_info("GDI: tuner=%s\n", name ? name : "unknown"); 2945 - if (NULL == name) 2950 + if (name == NULL) 2946 2951 return; 2947 2952 core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id; 2948 2953 core->board.radio.type = gdi_tuner[eeprom_data[0x0d]].fm ? ··· 3162 3167 } 3163 3168 3164 3169 /* ----------------------------------------------------------------------- */ 3165 - /* Tuner callback function. Currently only needed for the Pinnacle * 3170 + /* Tuner callback function. Currently only needed for the Pinnacle * 3166 3171 * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both * 3167 3172 * analog tuner attach (tuner-core.c) and dvb tuner attach (cx88-dvb.c) */ 3168 3173 ··· 3396 3401 3397 3402 memset(&tun_setup, 0, sizeof(tun_setup)); 3398 3403 3399 - if (0 == core->i2c_rc) { 3404 + if (core->i2c_rc == 0) { 3400 3405 core->i2c_client.addr = 0xa0 >> 1; 3401 3406 tveeprom_read(&core->i2c_client, eeprom, sizeof(eeprom)); 3402 3407 } ··· 3404 3409 switch (core->boardnr) { 3405 3410 case CX88_BOARD_HAUPPAUGE: 3406 3411 case CX88_BOARD_HAUPPAUGE_ROSLYN: 3407 - if (0 == core->i2c_rc) 3412 + if (core->i2c_rc == 0) 3408 3413 hauppauge_eeprom(core, eeprom+8); 3409 3414 break; 3410 3415 case CX88_BOARD_GDI: 3411 - if (0 == core->i2c_rc) 3416 + if (core->i2c_rc == 0) 3412 3417 gdi_eeprom(core, eeprom); 3413 3418 break; 3414 3419 case CX88_BOARD_LEADTEK_PVR2000: 3415 3420 case CX88_BOARD_WINFAST_DV2000: 3416 3421 case CX88_BOARD_WINFAST2000XP_EXPERT: 3417 - if (0 == core->i2c_rc) 3422 + if (core->i2c_rc == 0) 3418 3423 leadtek_eeprom(core, eeprom); 3419 3424 break; 3420 3425 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: ··· 3427 3432 case CX88_BOARD_HAUPPAUGE_HVR4000: 3428 3433 case CX88_BOARD_HAUPPAUGE_HVR4000LITE: 3429 3434 case CX88_BOARD_HAUPPAUGE_IRONLY: 3430 - if (0 == core->i2c_rc) 3435 + if (core->i2c_rc == 0) 3431 3436 hauppauge_eeprom(core, eeprom); 3432 3437 break; 3433 3438 case CX88_BOARD_KWORLD_DVBS_100: ··· 3473 3478 cx_write(MO_GP0_IO, 0x00080808); 3474 3479 break; 3475 3480 case CX88_BOARD_ATI_HDTVWONDER: 3476 - if (0 == core->i2c_rc) { 3481 + if (core->i2c_rc == 0) { 3477 3482 /* enable tuner */ 3478 3483 int i; 3479 - static const u8 buffer [][2] = { 3480 - {0x10,0x12}, 3481 - {0x13,0x04}, 3482 - {0x16,0x00}, 3483 - {0x14,0x04}, 3484 - {0x17,0x00} 3484 + static const u8 buffer[][2] = { 3485 + {0x10, 0x12}, 3486 + {0x13, 0x04}, 3487 + {0x16, 0x00}, 3488 + {0x14, 0x04}, 3489 + {0x17, 0x00} 3485 3490 }; 3486 3491 core->i2c_client.addr = 0x0a; 3487 3492 3488 3493 for (i = 0; i < ARRAY_SIZE(buffer); i++) 3489 3494 if (2 != i2c_master_send(&core->i2c_client, 3490 - buffer[i],2)) 3495 + buffer[i], 2)) 3491 3496 pr_warn("Unable to enable tuner(%i).\n", 3492 3497 i); 3493 3498 } ··· 3611 3616 #endif 3612 3617 3613 3618 /* check insmod options */ 3614 - if (UNSET != latency) 3619 + if (latency != UNSET) 3615 3620 lat = latency; 3616 3621 3617 3622 /* apply stuff */ ··· 3620 3625 value |= ctrl; 3621 3626 pci_write_config_byte(pci, CX88X_DEVCTRL, value); 3622 3627 } 3623 - if (UNSET != lat) { 3628 + if (lat != UNSET) { 3624 3629 pr_info("setting pci latency timer to %d\n", 3625 3630 latency); 3626 3631 pci_write_config_byte(pci, PCI_LATENCY_TIMER, latency); ··· 3630 3635 3631 3636 int cx88_get_resources(const struct cx88_core *core, struct pci_dev *pci) 3632 3637 { 3633 - if (request_mem_region(pci_resource_start(pci,0), 3634 - pci_resource_len(pci,0), 3638 + if (request_mem_region(pci_resource_start(pci, 0), 3639 + pci_resource_len(pci, 0), 3635 3640 core->name)) 3636 3641 return 0; 3637 3642 pr_err("func %d: Can't get MMIO memory @ 0x%llx, subsystem: %04x:%04x\n", ··· 3687 3692 return NULL; 3688 3693 } 3689 3694 3690 - if (0 != cx88_get_resources(core, pci)) { 3695 + if (cx88_get_resources(core, pci) != 0) { 3691 3696 v4l2_ctrl_handler_free(&core->video_hdl); 3692 3697 v4l2_ctrl_handler_free(&core->audio_hdl); 3693 3698 v4l2_device_unregister(&core->v4l2_dev); ··· 3719 3724 if (pci->subsystem_vendor == cx88_subids[i].subvendor && 3720 3725 pci->subsystem_device == cx88_subids[i].subdevice) 3721 3726 core->boardnr = cx88_subids[i].card; 3722 - if (UNSET == core->boardnr) { 3727 + if (core->boardnr == UNSET) { 3723 3728 core->boardnr = CX88_BOARD_UNKNOWN; 3724 3729 cx88_card_list(core, pci); 3725 3730 } ··· 3749 3754 cx88_i2c_init(core, pci); 3750 3755 3751 3756 /* load tuner module, if needed */ 3752 - if (UNSET != core->board.tuner_type) { 3757 + if (core->board.tuner_type != UNSET) { 3753 3758 /* Ignore 0x6b and 0x6f on cx88 boards. 3754 3759 * FusionHDTV5 RT Gold has an ir receiver at 0x6b 3755 3760 * and an RTC at 0x6f which can get corrupted if probed. */
+58 -63
drivers/media/pci/cx88/cx88-core.c
··· 1 1 /* 2 - * 3 2 * device driver for Conexant 2388x based TV cards 4 3 * driver core 5 4 * ··· 18 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 21 * GNU General Public License for more details. 21 - * 22 - * You should have received a copy of the GNU General Public License 23 - * along with this program; if not, write to the Free Software 24 - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 22 */ 26 23 27 24 #include "cx88.h" ··· 49 54 MODULE_PARM_DESC(core_debug, "enable debug messages [core]"); 50 55 51 56 static unsigned int nicam; 52 - module_param(nicam,int,0644); 53 - MODULE_PARM_DESC(nicam,"tv audio is nicam"); 57 + module_param(nicam, int, 0644); 58 + MODULE_PARM_DESC(nicam, "tv audio is nicam"); 54 59 55 60 static unsigned int nocomb; 56 - module_param(nocomb,int,0644); 57 - MODULE_PARM_DESC(nocomb,"disable comb filter"); 61 + module_param(nocomb, int, 0644); 62 + MODULE_PARM_DESC(nocomb, "disable comb filter"); 58 63 59 64 #define dprintk0(fmt, arg...) \ 60 65 printk(KERN_DEBUG pr_fmt("%s: core:" fmt), \ ··· 74 79 75 80 /* @lpi: lines per IRQ, or 0 to not generate irqs. Note: IRQ to be 76 81 generated _after_ lpi lines are transferred. */ 77 - static __le32* cx88_risc_field(__le32 *rp, struct scatterlist *sglist, 82 + static __le32 *cx88_risc_field(__le32 *rp, struct scatterlist *sglist, 78 83 unsigned int offset, u32 sync_line, 79 84 unsigned int bpl, unsigned int padding, 80 85 unsigned int lines, unsigned int lpi, bool jump) 81 86 { 82 87 struct scatterlist *sg; 83 - unsigned int line,todo,sol; 88 + unsigned int line, todo, sol; 84 89 85 90 if (jump) { 86 91 (*rp++) = cpu_to_le32(RISC_JUMP); ··· 98 103 offset -= sg_dma_len(sg); 99 104 sg = sg_next(sg); 100 105 } 101 - if (lpi && line>0 && !(line % lpi)) 106 + if (lpi && line > 0 && !(line % lpi)) 102 107 sol = RISC_SOL | RISC_IRQ1 | RISC_CNT_INC; 103 108 else 104 109 sol = RISC_SOL; 105 110 if (bpl <= sg_dma_len(sg)-offset) { 106 111 /* fits into current chunk */ 107 - *(rp++)=cpu_to_le32(RISC_WRITE|sol|RISC_EOL|bpl); 108 - *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); 109 - offset+=bpl; 112 + *(rp++) = cpu_to_le32(RISC_WRITE|sol|RISC_EOL|bpl); 113 + *(rp++) = cpu_to_le32(sg_dma_address(sg)+offset); 114 + offset += bpl; 110 115 } else { 111 116 /* scanline needs to be split */ 112 117 todo = bpl; 113 - *(rp++)=cpu_to_le32(RISC_WRITE|sol| 118 + *(rp++) = cpu_to_le32(RISC_WRITE|sol| 114 119 (sg_dma_len(sg)-offset)); 115 - *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); 120 + *(rp++) = cpu_to_le32(sg_dma_address(sg)+offset); 116 121 todo -= (sg_dma_len(sg)-offset); 117 122 offset = 0; 118 123 sg = sg_next(sg); 119 124 while (todo > sg_dma_len(sg)) { 120 - *(rp++)=cpu_to_le32(RISC_WRITE| 125 + *(rp++) = cpu_to_le32(RISC_WRITE| 121 126 sg_dma_len(sg)); 122 - *(rp++)=cpu_to_le32(sg_dma_address(sg)); 127 + *(rp++) = cpu_to_le32(sg_dma_address(sg)); 123 128 todo -= sg_dma_len(sg); 124 129 sg = sg_next(sg); 125 130 } 126 - *(rp++)=cpu_to_le32(RISC_WRITE|RISC_EOL|todo); 127 - *(rp++)=cpu_to_le32(sg_dma_address(sg)); 131 + *(rp++) = cpu_to_le32(RISC_WRITE|RISC_EOL|todo); 132 + *(rp++) = cpu_to_le32(sg_dma_address(sg)); 128 133 offset += todo; 129 134 } 130 135 offset += padding; ··· 138 143 unsigned int top_offset, unsigned int bottom_offset, 139 144 unsigned int bpl, unsigned int padding, unsigned int lines) 140 145 { 141 - u32 instructions,fields; 146 + u32 instructions, fields; 142 147 __le32 *rp; 143 148 144 149 fields = 0; 145 - if (UNSET != top_offset) 150 + if (top_offset != UNSET) 146 151 fields++; 147 - if (UNSET != bottom_offset) 152 + if (bottom_offset != UNSET) 148 153 fields++; 149 154 150 155 /* estimate risc mem: worst case is one write per page border + ··· 156 161 risc->size = instructions * 8; 157 162 risc->dma = 0; 158 163 risc->cpu = pci_zalloc_consistent(pci, risc->size, &risc->dma); 159 - if (NULL == risc->cpu) 164 + if (risc->cpu == NULL) 160 165 return -ENOMEM; 161 166 162 167 /* write risc instructions */ 163 168 rp = risc->cpu; 164 - if (UNSET != top_offset) 169 + if (top_offset != UNSET) 165 170 rp = cx88_risc_field(rp, sglist, top_offset, 0, 166 171 bpl, padding, lines, 0, true); 167 - if (UNSET != bottom_offset) 172 + if (bottom_offset != UNSET) 168 173 rp = cx88_risc_field(rp, sglist, bottom_offset, 0x200, 169 174 bpl, padding, lines, 0, top_offset == UNSET); 170 175 171 176 /* save pointer to jmp instruction address */ 172 177 risc->jmp = rp; 173 - BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size); 178 + WARN_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); 174 179 return 0; 175 180 } 176 181 ··· 190 195 risc->size = instructions * 8; 191 196 risc->dma = 0; 192 197 risc->cpu = pci_zalloc_consistent(pci, risc->size, &risc->dma); 193 - if (NULL == risc->cpu) 198 + if (risc->cpu == NULL) 194 199 return -ENOMEM; 195 200 196 201 /* write risc instructions */ ··· 199 204 200 205 /* save pointer to jmp instruction address */ 201 206 risc->jmp = rp; 202 - BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size); 207 + WARN_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); 203 208 return 0; 204 209 } 205 210 ··· 335 340 const struct sram_channel *ch, 336 341 unsigned int bpl, u32 risc) 337 342 { 338 - unsigned int i,lines; 343 + unsigned int i, lines; 339 344 u32 cdt; 340 345 341 346 bpl = (bpl + 7) & ~7; /* alignment */ ··· 343 348 lines = ch->fifo_size / bpl; 344 349 if (lines > 6) 345 350 lines = 6; 346 - BUG_ON(lines < 2); 351 + WARN_ON(lines < 2); 347 352 348 353 /* write CDT */ 349 354 for (i = 0; i < lines; i++) ··· 361 366 /* fill registers */ 362 367 cx_write(ch->ptr1_reg, ch->fifo_start); 363 368 cx_write(ch->ptr2_reg, cdt); 364 - cx_write(ch->cnt1_reg, (bpl >> 3) -1); 369 + cx_write(ch->cnt1_reg, (bpl >> 3) - 1); 365 370 cx_write(ch->cnt2_reg, (lines*16) >> 3); 366 371 367 372 dprintk(2, "sram setup %s: bpl=%d lines=%d\n", ch->name, bpl, lines); ··· 374 379 static int cx88_risc_decode(u32 risc) 375 380 { 376 381 static const char * const instr[16] = { 377 - [ RISC_SYNC >> 28 ] = "sync", 378 - [ RISC_WRITE >> 28 ] = "write", 379 - [ RISC_WRITEC >> 28 ] = "writec", 380 - [ RISC_READ >> 28 ] = "read", 381 - [ RISC_READC >> 28 ] = "readc", 382 - [ RISC_JUMP >> 28 ] = "jump", 383 - [ RISC_SKIP >> 28 ] = "skip", 384 - [ RISC_WRITERM >> 28 ] = "writerm", 385 - [ RISC_WRITECM >> 28 ] = "writecm", 386 - [ RISC_WRITECR >> 28 ] = "writecr", 382 + [RISC_SYNC >> 28] = "sync", 383 + [RISC_WRITE >> 28] = "write", 384 + [RISC_WRITEC >> 28] = "writec", 385 + [RISC_READ >> 28] = "read", 386 + [RISC_READC >> 28] = "readc", 387 + [RISC_JUMP >> 28] = "jump", 388 + [RISC_SKIP >> 28] = "skip", 389 + [RISC_WRITERM >> 28] = "writerm", 390 + [RISC_WRITECM >> 28] = "writecm", 391 + [RISC_WRITECR >> 28] = "writecr", 387 392 }; 388 393 static int const incr[16] = { 389 - [ RISC_WRITE >> 28 ] = 2, 390 - [ RISC_JUMP >> 28 ] = 2, 391 - [ RISC_WRITERM >> 28 ] = 3, 392 - [ RISC_WRITECM >> 28 ] = 3, 393 - [ RISC_WRITECR >> 28 ] = 4, 394 + [RISC_WRITE >> 28] = 2, 395 + [RISC_JUMP >> 28] = 2, 396 + [RISC_WRITERM >> 28] = 3, 397 + [RISC_WRITECM >> 28] = 3, 398 + [RISC_WRITECR >> 28] = 4, 394 399 }; 395 400 static const char * const bits[] = { 396 401 "12", "13", "14", "resync", ··· 427 432 "line / byte", 428 433 }; 429 434 u32 risc; 430 - unsigned int i,j,n; 435 + unsigned int i, j, n; 431 436 432 437 dprintk0("%s - dma channel status dump\n", 433 438 ch->name); ··· 640 645 static inline unsigned int norm_htotal(v4l2_std_id norm) 641 646 { 642 647 643 - unsigned int fsc4=norm_fsc8(norm)/2; 648 + unsigned int fsc4 = norm_fsc8(norm)/2; 644 649 645 650 /* returns 4*FSC / vtotal / frames per seconds */ 646 651 return (norm & V4L2_STD_625_50) ? ··· 706 711 } 707 712 if (INPUT(core->input).type == CX88_VMUX_SVIDEO) 708 713 value |= (1 << 13) | (1 << 5); 709 - if (V4L2_FIELD_INTERLACED == field) 714 + if (field == V4L2_FIELD_INTERLACED) 710 715 value |= (1 << 3); // VINT (interlaced vertical scaling) 711 716 if (width < 385) 712 717 value |= (1 << 0); // 3-tap interpolation ··· 737 742 prescale = 5; 738 743 739 744 pll = ofreq * 8 * prescale * (u64)(1 << 20); 740 - do_div(pll,xtal); 745 + do_div(pll, xtal); 741 746 reg = (pll & 0x3ffffff) | (pre[prescale] << 26); 742 747 if (((reg >> 20) & 0x3f) < 14) { 743 748 pr_err("pll out of range\n"); ··· 750 755 for (i = 0; i < 100; i++) { 751 756 reg = cx_read(MO_DEVICE_STATUS); 752 757 if (reg & (1<<2)) { 753 - dprintk(1,"pll locked [pre=%d,ofreq=%d]\n", 754 - prescale,ofreq); 758 + dprintk(1, "pll locked [pre=%d,ofreq=%d]\n", 759 + prescale, ofreq); 755 760 return 0; 756 761 } 757 762 dprintk(1, "pll not locked yet, waiting ...\n"); ··· 858 863 u32 fsc8; 859 864 u32 adc_clock; 860 865 u32 vdec_clock; 861 - u32 step_db,step_dr; 866 + u32 step_db, step_dr; 862 867 u64 tmp64; 863 - u32 bdelay,agcdelay,htotal; 868 + u32 bdelay, agcdelay, htotal; 864 869 u32 cxiformat, cxoformat; 865 870 866 871 if (norm == core->tvnorm) ··· 912 917 dprintk(1, "set_tvnorm: \"%s\" fsc8=%d adc=%d vdec=%d db/dr=%d/%d\n", 913 918 v4l2_norm_to_name(core->tvnorm), fsc8, adc_clock, vdec_clock, 914 919 step_db, step_dr); 915 - set_pll(core,2,vdec_clock); 920 + set_pll(core, 2, vdec_clock); 916 921 917 922 dprintk(1, "set_tvnorm: MO_INPUT_FORMAT 0x%08x [old=0x%08x]\n", 918 923 cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f); ··· 1008 1013 core->name, type, core->board.name); 1009 1014 } 1010 1015 1011 - struct cx88_core* cx88_core_get(struct pci_dev *pci) 1016 + struct cx88_core *cx88_core_get(struct pci_dev *pci) 1012 1017 { 1013 1018 struct cx88_core *core; 1014 1019 ··· 1019 1024 if (PCI_SLOT(pci->devfn) != core->pci_slot) 1020 1025 continue; 1021 1026 1022 - if (0 != cx88_get_resources(core, pci)) { 1027 + if (cx88_get_resources(core, pci) != 0) { 1023 1028 mutex_unlock(&devlist); 1024 1029 return NULL; 1025 1030 } ··· 1029 1034 } 1030 1035 1031 1036 core = cx88_core_create(pci, cx88_devcount); 1032 - if (NULL != core) { 1037 + if (core != NULL) { 1033 1038 cx88_devcount++; 1034 1039 list_add_tail(&core->devlist, &cx88_devlist); 1035 1040 } ··· 1040 1045 1041 1046 void cx88_core_put(struct cx88_core *core, struct pci_dev *pci) 1042 1047 { 1043 - release_mem_region(pci_resource_start(pci,0), 1044 - pci_resource_len(pci,0)); 1048 + release_mem_region(pci_resource_start(pci, 0), 1049 + pci_resource_len(pci, 0)); 1045 1050 1046 1051 if (!atomic_dec_and_test(&core->refcount)) 1047 1052 return; 1048 1053 1049 1054 mutex_lock(&devlist); 1050 1055 cx88_ir_fini(core); 1051 - if (0 == core->i2c_rc) { 1056 + if (core->i2c_rc == 0) { 1052 1057 if (core->i2c_rtc) 1053 1058 i2c_unregister_device(core->i2c_rtc); 1054 1059 i2c_del_adapter(&core->i2c_adap);
+5 -6
drivers/media/pci/cx88/cx88-dsp.c
··· 1 1 /* 2 - * 3 2 * Stereo and SAP detection for cx88 4 3 * 5 4 * Copyright (c) 2009 Marton Balint <cus@fazekas.hu> ··· 12 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 15 * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 16 */ 20 17 21 18 #include "cx88.h" ··· 77 82 u32 t2, t4, t6, t8; 78 83 s32 ret; 79 84 u16 period = x / INT_PI; 85 + 80 86 if (period % 2) 81 87 return -int_cos(x - INT_PI); 82 88 x = x % INT_PI; ··· 107 111 108 112 for (i = 0; i < N; i++) { 109 113 s32 s = x[i] + ((s64)coeff * s_prev / 32768) - s_prev2; 114 + 110 115 s_prev2 = s_prev; 111 116 s_prev = s; 112 117 } ··· 126 129 static u32 freq_magnitude(s16 x[], u32 N, u32 freq) 127 130 { 128 131 u32 sum = int_goertzel(x, N, freq); 132 + 129 133 return (u32)int_sqrt(sum); 130 134 } 131 135 ··· 223 225 s32 sap = freq_magnitude(x, N, FREQ_BTSC_SAP); 224 226 s32 dual_ref = freq_magnitude(x, N, FREQ_BTSC_DUAL_REF); 225 227 s32 dual = freq_magnitude(x, N, FREQ_BTSC_DUAL); 228 + 226 229 dprintk(1, "detect btsc: dual_ref=%d, dual=%d, sap_ref=%d, sap=%d\n", 227 230 dual_ref, dual, sap_ref, sap); 228 231 /* FIXME: Currently not supported */ ··· 306 307 307 308 kfree(samples); 308 309 309 - if (UNSET != ret) 310 + if (ret != UNSET) 310 311 dprintk(1, "stereo/sap detection result:%s%s%s\n", 311 312 (ret & V4L2_TUNER_SUB_MONO) ? " mono" : "", 312 313 (ret & V4L2_TUNER_SUB_STEREO) ? " stereo" : "",
+58 -54
drivers/media/pci/cx88/cx88-dvb.c
··· 1 1 /* 2 - * 3 2 * device driver for Conexant 2388x based TV cards 4 3 * MPEG Transport Stream (DVB) routines 5 4 * ··· 14 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 17 * GNU General Public License for more details. 17 - * 18 - * You should have received a copy of the GNU General Public License 19 - * along with this program; if not, write to the Free Software 20 - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 18 */ 22 19 23 20 #include "cx88.h" ··· 65 70 66 71 static unsigned int debug; 67 72 module_param(debug, int, 0644); 68 - MODULE_PARM_DESC(debug,"enable debug messages [dvb]"); 73 + MODULE_PARM_DESC(debug, "enable debug messages [dvb]"); 69 74 70 75 static unsigned int dvb_buf_tscnt = 32; 71 76 module_param(dvb_buf_tscnt, int, 0644); ··· 168 173 169 174 /* ------------------------------------------------------------------ */ 170 175 171 - static int cx88_dvb_bus_ctrl(struct dvb_frontend* fe, int acquire) 176 + static int cx88_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire) 172 177 { 173 - struct cx8802_dev *dev= fe->dvb->priv; 178 + struct cx8802_dev *dev = fe->dvb->priv; 174 179 struct cx8802_driver *drv = NULL; 175 180 int ret = 0; 176 181 int fe_id; ··· 184 189 mutex_lock(&dev->core->lock); 185 190 drv = cx8802_get_driver(dev, CX88_MPEG_DVB); 186 191 if (drv) { 187 - if (acquire){ 192 + if (acquire) { 188 193 dev->frontends.active_fe_id = fe_id; 189 194 ret = drv->request_acquire(drv); 190 195 } else { ··· 221 226 222 227 /* ------------------------------------------------------------------ */ 223 228 224 - static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) 229 + static int dvico_fusionhdtv_demod_init(struct dvb_frontend *fe) 225 230 { 226 - static const u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; 227 - static const u8 reset [] = { RESET, 0x80 }; 228 - static const u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; 229 - static const u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; 230 - static const u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; 231 + static const u8 clock_config[] = { CLOCK_CTL, 0x38, 0x39 }; 232 + static const u8 reset[] = { RESET, 0x80 }; 233 + static const u8 adc_ctl_1_cfg[] = { ADC_CTL_1, 0x40 }; 234 + static const u8 agc_cfg[] = { AGC_TARGET, 0x24, 0x20 }; 235 + static const u8 gpp_ctl_cfg[] = { GPP_CTL, 0x33 }; 231 236 static const u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; 232 237 233 238 mt352_write(fe, clock_config, sizeof(clock_config)); ··· 243 248 244 249 static int dvico_dual_demod_init(struct dvb_frontend *fe) 245 250 { 246 - static const u8 clock_config [] = { CLOCK_CTL, 0x38, 0x38 }; 247 - static const u8 reset [] = { RESET, 0x80 }; 248 - static const u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; 249 - static const u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 }; 250 - static const u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; 251 + static const u8 clock_config[] = { CLOCK_CTL, 0x38, 0x38 }; 252 + static const u8 reset[] = { RESET, 0x80 }; 253 + static const u8 adc_ctl_1_cfg[] = { ADC_CTL_1, 0x40 }; 254 + static const u8 agc_cfg[] = { AGC_TARGET, 0x28, 0x20 }; 255 + static const u8 gpp_ctl_cfg[] = { GPP_CTL, 0x33 }; 251 256 static const u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; 252 257 253 258 mt352_write(fe, clock_config, sizeof(clock_config)); ··· 262 267 return 0; 263 268 } 264 269 265 - static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe) 270 + static int dntv_live_dvbt_demod_init(struct dvb_frontend *fe) 266 271 { 267 - static const u8 clock_config [] = { 0x89, 0x38, 0x39 }; 268 - static const u8 reset [] = { 0x50, 0x80 }; 269 - static const u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 }; 270 - static const u8 agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF, 272 + static const u8 clock_config[] = { 0x89, 0x38, 0x39 }; 273 + static const u8 reset[] = { 0x50, 0x80 }; 274 + static const u8 adc_ctl_1_cfg[] = { 0x8E, 0x40 }; 275 + static const u8 agc_cfg[] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF, 271 276 0x00, 0xFF, 0x00, 0x40, 0x40 }; 272 277 static const u8 dntv_extra[] = { 0xB5, 0x7A }; 273 278 static const u8 capt_range_cfg[] = { 0x75, 0x32 }; ··· 311 316 }; 312 317 313 318 #if IS_ENABLED(CONFIG_VIDEO_CX88_VP3054) 314 - static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe) 319 + static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend *fe) 315 320 { 316 - static const u8 clock_config [] = { 0x89, 0x38, 0x38 }; 317 - static const u8 reset [] = { 0x50, 0x80 }; 318 - static const u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 }; 319 - static const u8 agc_cfg [] = { 0x67, 0x10, 0x20, 0x00, 0xFF, 0xFF, 321 + static const u8 clock_config[] = { 0x89, 0x38, 0x38 }; 322 + static const u8 reset[] = { 0x50, 0x80 }; 323 + static const u8 adc_ctl_1_cfg[] = { 0x8E, 0x40 }; 324 + static const u8 agc_cfg[] = { 0x67, 0x10, 0x20, 0x00, 0xFF, 0xFF, 320 325 0x00, 0xFF, 0x00, 0x40, 0x40 }; 321 326 static const u8 dntv_extra[] = { 0xB5, 0x7A }; 322 327 static const u8 capt_range_cfg[] = { 0x75, 0x32 }; ··· 373 378 .output_mode = CX22702_SERIAL_OUTPUT, 374 379 }; 375 380 376 - static int or51132_set_ts_param(struct dvb_frontend* fe, int is_punctured) 381 + static int or51132_set_ts_param(struct dvb_frontend *fe, int is_punctured) 377 382 { 378 - struct cx8802_dev *dev= fe->dvb->priv; 383 + struct cx8802_dev *dev = fe->dvb->priv; 384 + 379 385 dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00; 380 386 return 0; 381 387 } ··· 386 390 .set_ts_params = or51132_set_ts_param, 387 391 }; 388 392 389 - static int lgdt330x_pll_rf_set(struct dvb_frontend* fe, int index) 393 + static int lgdt330x_pll_rf_set(struct dvb_frontend *fe, int index) 390 394 { 391 - struct cx8802_dev *dev= fe->dvb->priv; 395 + struct cx8802_dev *dev = fe->dvb->priv; 392 396 struct cx88_core *core = dev->core; 393 397 394 398 dprintk(1, "%s: index = %d\n", __func__, index); ··· 399 403 return 0; 400 404 } 401 405 402 - static int lgdt330x_set_ts_param(struct dvb_frontend* fe, int is_punctured) 406 + static int lgdt330x_set_ts_param(struct dvb_frontend *fe, int is_punctured) 403 407 { 404 - struct cx8802_dev *dev= fe->dvb->priv; 408 + struct cx8802_dev *dev = fe->dvb->priv; 409 + 405 410 if (is_punctured) 406 411 dev->ts_gen_cntrl |= 0x04; 407 412 else ··· 431 434 .set_ts_params = lgdt330x_set_ts_param, 432 435 }; 433 436 434 - static int nxt200x_set_ts_param(struct dvb_frontend* fe, int is_punctured) 437 + static int nxt200x_set_ts_param(struct dvb_frontend *fe, int is_punctured) 435 438 { 436 - struct cx8802_dev *dev= fe->dvb->priv; 439 + struct cx8802_dev *dev = fe->dvb->priv; 440 + 437 441 dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00; 438 442 return 0; 439 443 } ··· 444 446 .set_ts_params = nxt200x_set_ts_param, 445 447 }; 446 448 447 - static int cx24123_set_ts_param(struct dvb_frontend* fe, 449 + static int cx24123_set_ts_param(struct dvb_frontend *fe, 448 450 int is_punctured) 449 451 { 450 - struct cx8802_dev *dev= fe->dvb->priv; 452 + struct cx8802_dev *dev = fe->dvb->priv; 453 + 451 454 dev->ts_gen_cntrl = 0x02; 452 455 return 0; 453 456 } 454 457 455 - static int kworld_dvbs_100_set_voltage(struct dvb_frontend* fe, 458 + static int kworld_dvbs_100_set_voltage(struct dvb_frontend *fe, 456 459 enum fe_sec_voltage voltage) 457 460 { 458 - struct cx8802_dev *dev= fe->dvb->priv; 461 + struct cx8802_dev *dev = fe->dvb->priv; 459 462 struct cx88_core *core = dev->core; 460 463 461 464 if (voltage == SEC_VOLTAGE_OFF) ··· 472 473 static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe, 473 474 enum fe_sec_voltage voltage) 474 475 { 475 - struct cx8802_dev *dev= fe->dvb->priv; 476 + struct cx8802_dev *dev = fe->dvb->priv; 476 477 struct cx88_core *core = dev->core; 477 478 478 479 if (voltage == SEC_VOLTAGE_OFF) { 479 - dprintk(1,"LNB Voltage OFF\n"); 480 + dprintk(1, "LNB Voltage OFF\n"); 480 481 cx_write(MO_GP0_IO, 0x0000efff); 481 482 } 482 483 ··· 488 489 static int tevii_dvbs_set_voltage(struct dvb_frontend *fe, 489 490 enum fe_sec_voltage voltage) 490 491 { 491 - struct cx8802_dev *dev= fe->dvb->priv; 492 + struct cx8802_dev *dev = fe->dvb->priv; 492 493 struct cx88_core *core = dev->core; 493 494 494 495 cx_set(MO_GP0_IO, 0x6040); ··· 687 688 int is_punctured) 688 689 { 689 690 struct cx8802_dev *dev = fe->dvb->priv; 691 + 690 692 dev->ts_gen_cntrl = 0x2; 691 693 692 694 return 0; ··· 697 697 int is_punctured) 698 698 { 699 699 struct cx8802_dev *dev = fe->dvb->priv; 700 + 700 701 dev->ts_gen_cntrl = 0; 701 702 702 703 return 0; ··· 735 734 int is_punctured) 736 735 { 737 736 struct cx8802_dev *dev = fe->dvb->priv; 737 + 738 738 dev->ts_gen_cntrl = 4; 739 739 740 740 return 0; ··· 1007 1005 int mfe_shared = 0; /* bus not shared by default */ 1008 1006 int res = -EINVAL; 1009 1007 1010 - if (0 != core->i2c_rc) { 1008 + if (core->i2c_rc != 0) { 1011 1009 pr_err("no i2c-bus available, cannot attach dvb drivers\n"); 1012 1010 goto frontend_detach; 1013 1011 } ··· 1425 1423 if (attach_xc3028(0x61, dev) < 0) 1426 1424 goto frontend_detach; 1427 1425 break; 1428 - case CX88_BOARD_KWORLD_ATSC_120: 1426 + case CX88_BOARD_KWORLD_ATSC_120: 1429 1427 fe0->dvb.frontend = dvb_attach(s5h1409_attach, 1430 1428 &kworld_atsc_120_config, 1431 1429 &core->i2c_adap); ··· 1619 1617 break; 1620 1618 } 1621 1619 1622 - if ( (NULL == fe0->dvb.frontend) || (fe1 && NULL == fe1->dvb.frontend) ) { 1620 + if ((NULL == fe0->dvb.frontend) || (fe1 && NULL == fe1->dvb.frontend)) { 1623 1621 pr_err("frontend initialization failed\n"); 1624 1622 goto frontend_detach; 1625 1623 } ··· 1655 1653 { 1656 1654 struct cx88_core *core = drv->core; 1657 1655 int err = 0; 1658 - dprintk( 1, "%s\n", __func__); 1656 + 1657 + dprintk(1, "%s\n", __func__); 1659 1658 1660 1659 switch (core->boardnr) { 1661 1660 case CX88_BOARD_HAUPPAUGE_HVR1300: ··· 1720 1717 { 1721 1718 struct cx88_core *core = drv->core; 1722 1719 int err = 0; 1723 - dprintk( 1, "%s\n", __func__); 1720 + 1721 + dprintk(1, "%s\n", __func__); 1724 1722 1725 1723 switch (core->boardnr) { 1726 1724 case CX88_BOARD_HAUPPAUGE_HVR1300: ··· 1744 1740 struct vb2_dvb_frontend *fe; 1745 1741 int i; 1746 1742 1747 - dprintk( 1, "%s\n", __func__); 1748 - dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", 1743 + dprintk(1, "%s\n", __func__); 1744 + dprintk(1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", 1749 1745 core->boardnr, 1750 1746 core->name, 1751 1747 core->pci_bus, ··· 1757 1753 1758 1754 /* If vp3054 isn't enabled, a stub will just return 0 */ 1759 1755 err = vp3054_i2c_probe(dev); 1760 - if (0 != err) 1756 + if (err != 0) 1761 1757 goto fail_core; 1762 1758 1763 1759 /* dvb stuff */ ··· 1815 1811 struct cx88_core *core = drv->core; 1816 1812 struct cx8802_dev *dev = drv->core->dvbdev; 1817 1813 1818 - dprintk( 1, "%s\n", __func__); 1814 + dprintk(1, "%s\n", __func__); 1819 1815 1820 1816 vb2_dvb_unregister_bus(&dev->frontends); 1821 1817
+47 -48
drivers/media/pci/cx88/cx88-i2c.c
··· 1 1 2 2 /* 3 - 4 - cx88-i2c.c -- all the i2c code is here 5 - 6 - Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de) 7 - & Marcus Metzler (mocm@thp.uni-koeln.de) 8 - (c) 2002 Yurij Sysoev <yurij@naturesoft.net> 9 - (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org> 10 - 11 - (c) 2005 Mauro Carvalho Chehab <mchehab@infradead.org> 12 - - Multituner support and i2c address binding 13 - 14 - This program is free software; you can redistribute it and/or modify 15 - it under the terms of the GNU General Public License as published by 16 - the Free Software Foundation; either version 2 of the License, or 17 - (at your option) any later version. 18 - 19 - This program is distributed in the hope that it will be useful, 20 - but WITHOUT ANY WARRANTY; without even the implied warranty of 21 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 - GNU General Public License for more details. 23 - 24 - You should have received a copy of the GNU General Public License 25 - along with this program; if not, write to the Free Software 26 - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 27 - 28 - */ 3 + * 4 + * cx88-i2c.c -- all the i2c code is here 5 + * 6 + * Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de) 7 + * & Marcus Metzler (mocm@thp.uni-koeln.de) 8 + * (c) 2002 Yurij Sysoev <yurij@naturesoft.net> 9 + * (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org> 10 + * 11 + * (c) 2005 Mauro Carvalho Chehab <mchehab@infradead.org> 12 + * - Multituner support and i2c address binding 13 + * 14 + * This program is free software; you can redistribute it and/or modify 15 + * it under the terms of the GNU General Public License as published by 16 + * the Free Software Foundation; either version 2 of the License, or 17 + * (at your option) any later version. 18 + * 19 + * This program is distributed in the hope that it will be useful, 20 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 + * GNU General Public License for more details. 23 + */ 29 24 30 25 #include "cx88.h" 31 26 ··· 33 38 34 39 static unsigned int i2c_debug; 35 40 module_param(i2c_debug, int, 0644); 36 - MODULE_PARM_DESC(i2c_debug,"enable debug messages [i2c]"); 41 + MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); 37 42 38 43 static unsigned int i2c_scan; 39 44 module_param(i2c_scan, int, 0444); 40 - MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); 45 + MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); 41 46 42 47 static unsigned int i2c_udelay = 5; 43 48 module_param(i2c_udelay, int, 0644); ··· 107 112 /* ----------------------------------------------------------------------- */ 108 113 109 114 static const char * const i2c_devs[128] = { 110 - [ 0x1c >> 1 ] = "lgdt330x", 111 - [ 0x86 >> 1 ] = "tda9887/cx22702", 112 - [ 0xa0 >> 1 ] = "eeprom", 113 - [ 0xc0 >> 1 ] = "tuner (analog)", 114 - [ 0xc2 >> 1 ] = "tuner (analog/dvb)", 115 - [ 0xc8 >> 1 ] = "xc5000", 115 + [0x1c >> 1] = "lgdt330x", 116 + [0x86 >> 1] = "tda9887/cx22702", 117 + [0xa0 >> 1] = "eeprom", 118 + [0xc0 >> 1] = "tuner (analog)", 119 + [0xc2 >> 1] = "tuner (analog/dvb)", 120 + [0xc8 >> 1] = "xc5000", 116 121 }; 117 122 118 123 static void do_i2c_scan(const char *name, struct i2c_client *c) 119 124 { 120 125 unsigned char buf; 121 - int i,rc; 126 + int i, rc; 122 127 123 128 for (i = 0; i < ARRAY_SIZE(i2c_devs); i++) { 124 129 c->addr = i; 125 - rc = i2c_master_recv(c,&buf,0); 130 + rc = i2c_master_recv(c, &buf, 0); 126 131 if (rc < 0) 127 132 continue; 128 133 pr_info("i2c scan: found device @ 0x%x [%s]\n", ··· 134 139 int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) 135 140 { 136 141 /* Prevents usage of invalid delay values */ 137 - if (i2c_udelay<5) 138 - i2c_udelay=5; 142 + if (i2c_udelay < 5) 143 + i2c_udelay = 5; 139 144 140 145 core->i2c_algo = cx8800_i2c_algo_template; 141 146 142 147 143 148 core->i2c_adap.dev.parent = &pci->dev; 144 - strlcpy(core->i2c_adap.name,core->name,sizeof(core->i2c_adap.name)); 149 + strlcpy(core->i2c_adap.name, core->name, sizeof(core->i2c_adap.name)); 145 150 core->i2c_adap.owner = THIS_MODULE; 146 151 core->i2c_algo.udelay = i2c_udelay; 147 152 core->i2c_algo.data = core; ··· 150 155 core->i2c_client.adapter = &core->i2c_adap; 151 156 strlcpy(core->i2c_client.name, "cx88xx internal", I2C_NAME_SIZE); 152 157 153 - cx8800_bit_setscl(core,1); 154 - cx8800_bit_setsda(core,1); 158 + cx8800_bit_setscl(core, 1); 159 + cx8800_bit_setsda(core, 1); 155 160 156 161 core->i2c_rc = i2c_bit_add_bus(&core->i2c_adap); 157 - if (0 == core->i2c_rc) { 158 - static u8 tuner_data[] = 159 - { 0x0b, 0xdc, 0x86, 0x52 }; 160 - static struct i2c_msg tuner_msg = 161 - { .flags = 0, .addr = 0xc2 >> 1, .buf = tuner_data, .len = 4 }; 162 + if (core->i2c_rc == 0) { 163 + static u8 tuner_data[] = { 164 + 0x0b, 0xdc, 0x86, 0x52 }; 165 + static struct i2c_msg tuner_msg = { 166 + .flags = 0, 167 + .addr = 0xc2 >> 1, 168 + .buf = tuner_data, 169 + .len = 4 170 + }; 162 171 163 172 dprintk(1, "i2c register ok\n"); 164 - switch( core->boardnr ) { 173 + switch (core->boardnr) { 165 174 case CX88_BOARD_HAUPPAUGE_HVR1300: 166 175 case CX88_BOARD_HAUPPAUGE_HVR3000: 167 176 case CX88_BOARD_HAUPPAUGE_HVR4000: ··· 176 177 break; 177 178 } 178 179 if (i2c_scan) 179 - do_i2c_scan(core->name,&core->i2c_client); 180 + do_i2c_scan(core->name, &core->i2c_client); 180 181 } else 181 182 pr_err("i2c register FAILED\n"); 182 183
+7 -11
drivers/media/pci/cx88/cx88-input.c
··· 16 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 18 * GNU General Public License for more details. 19 - * 20 - * You should have received a copy of the GNU General Public License 21 - * along with this program; if not, write to the Free Software 22 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 19 */ 24 20 25 21 #include "cx88.h" ··· 54 58 u32 mask_keyup; 55 59 }; 56 60 57 - static unsigned ir_samplerate = 4; 61 + static unsigned int ir_samplerate = 4; 58 62 module_param(ir_samplerate, uint, 0444); 59 63 MODULE_PARM_DESC(ir_samplerate, "IR samplerate in kHz, 1 - 20, default 4"); 60 64 ··· 63 67 MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); 64 68 65 69 #define ir_dprintk(fmt, arg...) if (ir_debug) \ 66 - printk(KERN_DEBUG "%s IR: " fmt , ir->core->name , ##arg) 70 + printk(KERN_DEBUG "%s IR: " fmt, ir->core->name, ##arg) 67 71 68 72 #define dprintk(fmt, arg...) if (ir_debug) \ 69 - printk(KERN_DEBUG "cx88 IR: " fmt , ##arg) 73 + printk(KERN_DEBUG "cx88 IR: " fmt, ##arg) 70 74 71 75 /* ---------------------------------------------------------------------- */ 72 76 ··· 93 97 94 98 auxgpio = cx_read(MO_GP1_IO); 95 99 /* Take out the parity part */ 96 - gpio=(gpio & 0x7fd) + (auxgpio & 0xef); 100 + gpio = (gpio & 0x7fd) + (auxgpio & 0xef); 97 101 break; 98 102 case CX88_BOARD_WINFAST_DTV1000: 99 103 case CX88_BOARD_WINFAST_DTV1800H: ··· 508 512 struct cx88_IR *ir = core->ir; 509 513 510 514 /* skip detach on non attached boards */ 511 - if (NULL == ir) 515 + if (ir == NULL) 512 516 return 0; 513 517 514 518 cx88_ir_stop(core); ··· 526 530 { 527 531 struct cx88_IR *ir = core->ir; 528 532 u32 samples; 529 - unsigned todo, bits; 533 + unsigned int todo, bits; 530 534 struct ir_raw_event ev; 531 535 532 536 if (!ir || !ir->sampling) ··· 598 602 const unsigned short *addr_list = default_addr_list; 599 603 const unsigned short *addrp; 600 604 /* Instantiate the IR receiver device, if present */ 601 - if (0 != core->i2c_rc) 605 + if (core->i2c_rc != 0) 602 606 return; 603 607 604 608 memset(&info, 0, sizeof(struct i2c_board_info));
+32 -31
drivers/media/pci/cx88/cx88-mpeg.c
··· 42 42 MODULE_VERSION(CX88_VERSION); 43 43 44 44 static unsigned int debug; 45 - module_param(debug,int,0644); 46 - MODULE_PARM_DESC(debug,"enable debug messages [mpeg]"); 45 + module_param(debug, int, 0644); 46 + MODULE_PARM_DESC(debug, "enable debug messages [mpeg]"); 47 47 48 48 #define dprintk(level, fmt, arg...) do { \ 49 49 if (debug + 1 > level) \ ··· 54 54 #if defined(CONFIG_MODULES) && defined(MODULE) 55 55 static void request_module_async(struct work_struct *work) 56 56 { 57 - struct cx8802_dev *dev=container_of(work, struct cx8802_dev, request_module_wk); 57 + struct cx8802_dev *dev = container_of(work, struct cx8802_dev, request_module_wk); 58 58 59 59 if (dev->core->board.mpeg & CX88_MPEG_DVB) 60 60 request_module("cx88-dvb"); ··· 103 103 104 104 dprintk(1, "core->active_type_id = 0x%08x\n", core->active_type_id); 105 105 106 - if ( (core->active_type_id == CX88_MPEG_DVB) && 107 - (core->board.mpeg & CX88_MPEG_DVB) ) { 106 + if ((core->active_type_id == CX88_MPEG_DVB) && 107 + (core->board.mpeg & CX88_MPEG_DVB)) { 108 108 109 109 dprintk(1, "cx8802_start_dma doing .dvb\n"); 110 110 /* negedge driven & software reset */ ··· 148 148 } 149 149 cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl); 150 150 udelay(100); 151 - } else if ( (core->active_type_id == CX88_MPEG_BLACKBIRD) && 152 - (core->board.mpeg & CX88_MPEG_BLACKBIRD) ) { 151 + } else if ((core->active_type_id == CX88_MPEG_BLACKBIRD) && 152 + (core->board.mpeg & CX88_MPEG_BLACKBIRD)) { 153 153 dprintk(1, "cx8802_start_dma doing .blackbird\n"); 154 154 cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */ 155 155 ··· 185 185 static int cx8802_stop_dma(struct cx8802_dev *dev) 186 186 { 187 187 struct cx88_core *core = dev->core; 188 + 188 189 dprintk(1, "\n"); 189 190 190 191 /* stop dma */ ··· 210 209 return 0; 211 210 212 211 buf = list_entry(q->active.next, struct cx88_buffer, list); 213 - dprintk(2,"restart_queue [%p/%d]: restart dma\n", 212 + dprintk(2, "restart_queue [%p/%d]: restart dma\n", 214 213 buf, buf->vb.vb2_buf.index); 215 214 cx8802_start_dma(dev, q, buf); 216 215 return 0; ··· 255 254 if (list_empty(&cx88q->active)) { 256 255 dprintk(1, "queue is empty - first active\n"); 257 256 list_add_tail(&buf->list, &cx88q->active); 258 - dprintk(1,"[%p/%d] %s - first active\n", 257 + dprintk(1, "[%p/%d] %s - first active\n", 259 258 buf, buf->vb.vb2_buf.index, __func__); 260 259 261 260 } else { ··· 277 276 struct cx88_buffer *buf; 278 277 unsigned long flags; 279 278 280 - spin_lock_irqsave(&dev->slock,flags); 279 + spin_lock_irqsave(&dev->slock, flags); 281 280 while (!list_empty(&q->active)) { 282 281 buf = list_entry(q->active.next, struct cx88_buffer, list); 283 282 list_del(&buf->list); 284 283 vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); 285 284 } 286 - spin_unlock_irqrestore(&dev->slock,flags); 285 + spin_unlock_irqrestore(&dev->slock, flags); 287 286 } 288 287 289 288 void cx8802_cancel_buffers(struct cx8802_dev *dev) ··· 293 292 do_cancel_buffers(dev); 294 293 } 295 294 296 - static const char * cx88_mpeg_irqs[32] = { 295 + static const char *cx88_mpeg_irqs[32] = { 297 296 "ts_risci1", NULL, NULL, NULL, 298 297 "ts_risci2", NULL, NULL, NULL, 299 298 "ts_oflow", NULL, NULL, NULL, ··· 357 356 for (loop = 0; loop < MAX_IRQ_LOOP; loop++) { 358 357 status = cx_read(MO_PCI_INTSTAT) & 359 358 (core->pci_irqmask | PCI_INT_TSINT); 360 - if (0 == status) 359 + if (status == 0) 361 360 goto out; 362 361 dprintk(1, "cx8802_irq\n"); 363 362 dprintk(1, " loop: %d/%d\n", loop, MAX_IRQ_LOOP); ··· 366 365 cx_write(MO_PCI_INTSTAT, status); 367 366 368 367 if (status & core->pci_irqmask) 369 - cx88_core_irq(core,status); 368 + cx88_core_irq(core, status); 370 369 if (status & PCI_INT_TSINT) 371 370 cx8802_mpeg_irq(dev); 372 371 } 373 - if (MAX_IRQ_LOOP == loop) { 372 + if (loop == MAX_IRQ_LOOP) { 374 373 dprintk(0, "clearing mask\n"); 375 374 pr_warn("irq loop -- clearing mask\n"); 376 - cx_write(MO_PCI_INTMSK,0); 375 + cx_write(MO_PCI_INTMSK, 0); 377 376 } 378 377 379 378 out: ··· 389 388 if (pci_enable_device(dev->pci)) 390 389 return -EIO; 391 390 pci_set_master(dev->pci); 392 - err = pci_set_dma_mask(dev->pci,DMA_BIT_MASK(32)); 391 + err = pci_set_dma_mask(dev->pci, DMA_BIT_MASK(32)); 393 392 if (err) { 394 393 pr_err("Oops: no 32bit PCI DMA ???\n"); 395 394 return -EIO; ··· 418 417 cx_set(MO_PCI_INTMSK, core->pci_irqmask); 419 418 420 419 /* everything worked */ 421 - pci_set_drvdata(dev->pci,dev); 420 + pci_set_drvdata(dev->pci, dev); 422 421 return 0; 423 422 } 424 423 ··· 452 451 cx88_shutdown(dev->core); 453 452 454 453 pci_save_state(pci_dev); 455 - if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) { 454 + if (pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)) != 0) { 456 455 pci_disable_device(pci_dev); 457 456 dev->state.disabled = 1; 458 457 } ··· 466 465 int err; 467 466 468 467 if (dev->state.disabled) { 469 - err=pci_enable_device(pci_dev); 468 + err = pci_enable_device(pci_dev); 470 469 if (err) { 471 470 pr_err("can't enable device\n"); 472 471 return err; 473 472 } 474 473 dev->state.disabled = 0; 475 474 } 476 - err=pci_set_power_state(pci_dev, PCI_D0); 475 + err = pci_set_power_state(pci_dev, PCI_D0); 477 476 if (err) { 478 477 pr_err("can't enable device\n"); 479 478 pci_disable_device(pci_dev); ··· 490 489 spin_lock_irqsave(&dev->slock, flags); 491 490 if (!list_empty(&dev->mpegq.active)) { 492 491 pr_info("resume mpeg\n"); 493 - cx8802_restart_queue(dev,&dev->mpegq); 492 + cx8802_restart_queue(dev, &dev->mpegq); 494 493 } 495 494 spin_unlock_irqrestore(&dev->slock, flags); 496 495 497 496 return 0; 498 497 } 499 498 500 - struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype) 499 + struct cx8802_driver *cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype) 501 500 { 502 501 struct cx8802_driver *d; 503 502 ··· 614 613 dev->core->boardnr); 615 614 616 615 /* Bring up a new struct for each driver instance */ 617 - driver = kzalloc(sizeof(*drv),GFP_KERNEL); 616 + driver = kzalloc(sizeof(*drv), GFP_KERNEL); 618 617 if (driver == NULL) { 619 618 err = -ENOMEM; 620 619 goto out; ··· 697 696 698 697 /* general setup */ 699 698 core = cx88_core_get(pci_dev); 700 - if (NULL == core) 699 + if (core == NULL) 701 700 return -EINVAL; 702 701 703 702 pr_info("cx2388x 8802 Driver Manager\n"); ··· 707 706 goto fail_core; 708 707 709 708 err = -ENOMEM; 710 - dev = kzalloc(sizeof(*dev),GFP_KERNEL); 711 - if (NULL == dev) 709 + dev = kzalloc(sizeof(*dev), GFP_KERNEL); 710 + if (dev == NULL) 712 711 goto fail_core; 713 712 dev->pci = pci_dev; 714 713 dev->core = core; ··· 722 721 723 722 INIT_LIST_HEAD(&dev->drvlist); 724 723 mutex_lock(&cx8802_mutex); 725 - list_add_tail(&dev->devlist,&cx8802_devlist); 724 + list_add_tail(&dev->devlist, &cx8802_devlist); 726 725 mutex_unlock(&cx8802_mutex); 727 726 728 727 /* now autoload cx88-dvb or cx88-blackbird */ ··· 733 732 kfree(dev); 734 733 fail_core: 735 734 core->dvbdev = NULL; 736 - cx88_core_put(core,pci_dev); 735 + cx88_core_put(core, pci_dev); 737 736 return err; 738 737 } 739 738 ··· 773 772 774 773 /* common */ 775 774 cx8802_fini_common(dev); 776 - cx88_core_put(dev->core,dev->pci); 775 + cx88_core_put(dev->core, dev->pci); 777 776 kfree(dev); 778 777 } 779 778 ··· 783 782 .device = 0x8802, 784 783 .subvendor = PCI_ANY_ID, 785 784 .subdevice = PCI_ANY_ID, 786 - },{ 785 + }, { 787 786 /* --- end of list --- */ 788 787 } 789 788 };
+1 -12
drivers/media/pci/cx88/cx88-reg.h
··· 576 576 #define RISC_CNT_INC 0x00010000 577 577 #define RISC_CNT_RSVR 0x00020000 578 578 #define RISC_CNT_RESET 0x00030000 579 - #define RISC_JMP_SRP 0x01 579 + #define RISC_JMP_SRP 0x01 580 580 581 581 582 582 /* ---------------------------------------------------------------------- */ ··· 821 821 #define DEFAULT_CONTRAST_NTSC 0x39 822 822 #define DEFAULT_SAT_U_NTSC 0x7F 823 823 #define DEFAULT_SAT_V_NTSC 0x5A 824 - 825 - typedef enum 826 - { 827 - SOURCE_TUNER = 0, 828 - SOURCE_COMPOSITE, 829 - SOURCE_SVIDEO, 830 - SOURCE_OTHER1, 831 - SOURCE_OTHER2, 832 - SOURCE_COMPVIASVIDEO, 833 - SOURCE_CCIR656 834 - } VIDEOSOURCETYPE; 835 824 836 825 #endif /* _CX88_REG_H_ */
+41 -46
drivers/media/pci/cx88/cx88-tvaudio.c
··· 1 1 /* 2 - 3 - cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver 4 - 5 - (c) 2001 Michael Eskin, Tom Zakrajsek [Windows version] 6 - (c) 2002 Yurij Sysoev <yurij@naturesoft.net> 7 - (c) 2003 Gerd Knorr <kraxel@bytesex.org> 8 - 9 - ----------------------------------------------------------------------- 10 - 11 - Lot of voodoo here. Even the data sheet doesn't help to 12 - understand what is going on here, the documentation for the audio 13 - part of the cx2388x chip is *very* bad. 14 - 15 - Some of this comes from party done linux driver sources I got from 16 - [undocumented]. 17 - 18 - Some comes from the dscaler sources, one of the dscaler driver guy works 19 - for Conexant ... 20 - 21 - ----------------------------------------------------------------------- 22 - 23 - This program is free software; you can redistribute it and/or modify 24 - it under the terms of the GNU General Public License as published by 25 - the Free Software Foundation; either version 2 of the License, or 26 - (at your option) any later version. 27 - 28 - This program is distributed in the hope that it will be useful, 29 - but WITHOUT ANY WARRANTY; without even the implied warranty of 30 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 31 - GNU General Public License for more details. 32 - 33 - You should have received a copy of the GNU General Public License 34 - along with this program; if not, write to the Free Software 35 - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 36 - */ 2 + * cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver 3 + * 4 + * (c) 2001 Michael Eskin, Tom Zakrajsek [Windows version] 5 + * (c) 2002 Yurij Sysoev <yurij@naturesoft.net> 6 + * (c) 2003 Gerd Knorr <kraxel@bytesex.org> 7 + * 8 + * ----------------------------------------------------------------------- 9 + * 10 + * Lot of voodoo here. Even the data sheet doesn't help to 11 + * understand what is going on here, the documentation for the audio 12 + * part of the cx2388x chip is *very* bad. 13 + * 14 + * Some of this comes from party done linux driver sources I got from 15 + * [undocumented]. 16 + * 17 + * Some comes from the dscaler sources, one of the dscaler driver guy works 18 + * for Conexant ... 19 + * 20 + * ----------------------------------------------------------------------- 21 + * 22 + * This program is free software; you can redistribute it and/or modify 23 + * it under the terms of the GNU General Public License as published by 24 + * the Free Software Foundation; either version 2 of the License, or 25 + * (at your option) any later version. 26 + * 27 + * This program is distributed in the hope that it will be useful, 28 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 + * GNU General Public License for more details. 31 + */ 37 32 38 33 #include "cx88.h" 39 34 ··· 52 57 MODULE_PARM_DESC(audio_debug, "enable debug messages [audio]"); 53 58 54 59 static unsigned int always_analog; 55 - module_param(always_analog,int,0644); 56 - MODULE_PARM_DESC(always_analog,"force analog audio out"); 60 + module_param(always_analog, int, 0644); 61 + MODULE_PARM_DESC(always_analog, "force analog audio out"); 57 62 58 63 static unsigned int radio_deemphasis; 59 - module_param(radio_deemphasis,int,0644); 64 + module_param(radio_deemphasis, int, 0644); 60 65 MODULE_PARM_DESC(radio_deemphasis, "Radio deemphasis time constant, 0=None, 1=50us (elsewhere), 2=75us (USA)"); 61 66 62 67 #define dprintk(fmt, arg...) do { \ ··· 345 350 { /* end of list */ }, 346 351 }; 347 352 348 - set_audio_start(core,SEL_NICAM); 353 + set_audio_start(core, SEL_NICAM); 349 354 switch (core->tvaudio) { 350 355 case WW_L: 351 356 dprintk("%s SECAM-L NICAM (status: devel)\n", __func__); ··· 765 770 /* set nicam mode - otherwise 766 771 AUD_NICAM_STATUS2 contains wrong values */ 767 772 set_audio_standard_NICAM(core, EN_NICAM_AUTO_STEREO); 768 - if (0 == cx88_detect_nicam(core)) { 773 + if (cx88_detect_nicam(core) == 0) { 769 774 /* fall back to fm / am mono */ 770 775 set_audio_standard_A2(core, EN_A2_FORCE_MONO1); 771 776 core->audiomode_current = V4L2_TUNER_MODE_MONO; ··· 864 869 } 865 870 866 871 /* If software stereo detection is not supported... */ 867 - if (UNSET == t->rxsubchans) { 872 + if (t->rxsubchans == UNSET) { 868 873 t->rxsubchans = V4L2_TUNER_SUB_MONO; 869 874 /* If the hardware itself detected stereo, also return 870 875 stereo as an available subchannel */ 871 - if (V4L2_TUNER_MODE_STEREO == t->audmode) 876 + if (t->audmode == V4L2_TUNER_MODE_STEREO) 872 877 t->rxsubchans |= V4L2_TUNER_SUB_STEREO; 873 878 } 874 879 return; ··· 882 887 if (manual) { 883 888 core->audiomode_manual = mode; 884 889 } else { 885 - if (UNSET != core->audiomode_manual) 890 + if (core->audiomode_manual != UNSET) 886 891 return; 887 892 } 888 893 core->audiomode_current = mode; ··· 910 915 case WW_M: 911 916 case WW_I: 912 917 case WW_L: 913 - if (1 == core->use_nicam) { 918 + if (core->use_nicam == 1) { 914 919 switch (mode) { 915 920 case V4L2_TUNER_MODE_MONO: 916 921 case V4L2_TUNER_MODE_LANG1: ··· 970 975 break; 971 976 } 972 977 973 - if (UNSET != ctl) { 978 + if (ctl != UNSET) { 974 979 dprintk("cx88_set_stereo: mask 0x%x, ctl 0x%x [status=0x%x,ctl=0x%x,vol=0x%x]\n", 975 980 mask, ctl, cx_read(AUD_STATUS), 976 981 cx_read(AUD_CTL), cx_sread(SHADOW_AUD_VOL_CTL)); ··· 1006 1011 memset(&t, 0, sizeof(t)); 1007 1012 cx88_get_stereo(core, &t); 1008 1013 1009 - if (UNSET != core->audiomode_manual) 1014 + if (core->audiomode_manual != UNSET) 1010 1015 /* manually set, don't do anything. */ 1011 1016 continue; 1012 1017
+10 -10
drivers/media/pci/cx88/cx88-vbi.c
··· 8 8 #include <linux/init.h> 9 9 10 10 static unsigned int vbi_debug; 11 - module_param(vbi_debug,int,0644); 12 - MODULE_PARM_DESC(vbi_debug,"enable debug messages [vbi]"); 11 + module_param(vbi_debug, int, 0644); 12 + MODULE_PARM_DESC(vbi_debug, "enable debug messages [vbi]"); 13 13 14 14 #define dprintk(level, fmt, arg...) do { \ 15 15 if (vbi_debug >= level) \ ··· 19 19 20 20 /* ------------------------------------------------------------------ */ 21 21 22 - int cx8800_vbi_fmt (struct file *file, void *priv, 22 + int cx8800_vbi_fmt(struct file *file, void *priv, 23 23 struct v4l2_format *f) 24 24 { 25 25 struct cx8800_dev *dev = video_drvdata(file); ··· 57 57 cx88_sram_channel_setup(dev->core, &cx88_sram_channels[SRAM_CH24], 58 58 VBI_LINE_LENGTH, buf->risc.dma); 59 59 60 - cx_write(MO_VBOS_CONTROL, ( (1 << 18) | // comb filter delay fixup 60 + cx_write(MO_VBOS_CONTROL, ((1 << 18) | // comb filter delay fixup 61 61 (1 << 15) | // enable vbi capture 62 - (1 << 11) )); 62 + (1 << 11))); 63 63 64 64 /* reset counter */ 65 65 cx_write(MO_VBI_GPCNTRL, GP_COUNT_CONTROL_RESET); ··· 70 70 cx_set(MO_VID_INTMSK, 0x0f0088); 71 71 72 72 /* enable capture */ 73 - cx_set(VID_CAPTURE_CONTROL,0x18); 73 + cx_set(VID_CAPTURE_CONTROL, 0x18); 74 74 75 75 /* start dma */ 76 76 cx_set(MO_DEV_CNTRL2, (1<<5)); ··· 87 87 cx_clear(MO_VID_DMACNTRL, 0x88); 88 88 89 89 /* disable capture */ 90 - cx_clear(VID_CAPTURE_CONTROL,0x18); 90 + cx_clear(VID_CAPTURE_CONTROL, 0x18); 91 91 92 92 /* disable irqs */ 93 93 cx_clear(MO_PCI_INTMSK, PCI_INT_VIDINT); ··· 103 103 return 0; 104 104 105 105 buf = list_entry(q->active.next, struct cx88_buffer, list); 106 - dprintk(2,"restart_queue [%p/%d]: restart dma\n", 106 + dprintk(2, "restart_queue [%p/%d]: restart dma\n", 107 107 buf, buf->vb.vb2_buf.index); 108 108 cx8800_start_vbi_dma(dev, q, buf); 109 109 return 0; ··· 179 179 if (list_empty(&q->active)) { 180 180 list_add_tail(&buf->list, &q->active); 181 181 cx8800_start_vbi_dma(dev, q, buf); 182 - dprintk(2,"[%p/%d] vbi_queue - first active\n", 182 + dprintk(2, "[%p/%d] vbi_queue - first active\n", 183 183 buf, buf->vb.vb2_buf.index); 184 184 185 185 } else { ··· 187 187 prev = list_entry(q->active.prev, struct cx88_buffer, list); 188 188 list_add_tail(&buf->list, &q->active); 189 189 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); 190 - dprintk(2,"[%p/%d] buffer_queue - append to active\n", 190 + dprintk(2, "[%p/%d] buffer_queue - append to active\n", 191 191 buf, buf->vb.vb2_buf.index); 192 192 } 193 193 }
+96 -99
drivers/media/pci/cx88/cx88-video.c
··· 19 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 21 * GNU General Public License for more details. 22 - * 23 - * You should have received a copy of the GNU General Public License 24 - * along with this program; if not, write to the Free Software 25 - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 26 22 */ 27 23 28 24 #include "cx88.h" ··· 55 59 module_param_array(vbi_nr, int, NULL, 0444); 56 60 module_param_array(radio_nr, int, NULL, 0444); 57 61 58 - MODULE_PARM_DESC(video_nr,"video device numbers"); 59 - MODULE_PARM_DESC(vbi_nr,"vbi device numbers"); 60 - MODULE_PARM_DESC(radio_nr,"radio device numbers"); 62 + MODULE_PARM_DESC(video_nr, "video device numbers"); 63 + MODULE_PARM_DESC(vbi_nr, "vbi device numbers"); 64 + MODULE_PARM_DESC(radio_nr, "radio device numbers"); 61 65 62 66 static unsigned int video_debug; 63 - module_param(video_debug,int,0644); 64 - MODULE_PARM_DESC(video_debug,"enable debug messages [video]"); 67 + module_param(video_debug, int, 0644); 68 + MODULE_PARM_DESC(video_debug, "enable debug messages [video]"); 65 69 66 70 static unsigned int irq_debug; 67 - module_param(irq_debug,int,0644); 68 - MODULE_PARM_DESC(irq_debug,"enable debug messages [IRQ handler]"); 71 + module_param(irq_debug, int, 0644); 72 + MODULE_PARM_DESC(irq_debug, "enable debug messages [IRQ handler]"); 69 73 70 74 #define dprintk(level, fmt, arg...) do { \ 71 75 if (video_debug >= level) \ ··· 84 88 .cxformat = ColorFormatY8, 85 89 .depth = 8, 86 90 .flags = FORMAT_FLAGS_PACKED, 87 - },{ 91 + }, { 88 92 .name = "15 bpp RGB, le", 89 93 .fourcc = V4L2_PIX_FMT_RGB555, 90 94 .cxformat = ColorFormatRGB15, 91 95 .depth = 16, 92 96 .flags = FORMAT_FLAGS_PACKED, 93 - },{ 97 + }, { 94 98 .name = "15 bpp RGB, be", 95 99 .fourcc = V4L2_PIX_FMT_RGB555X, 96 100 .cxformat = ColorFormatRGB15 | ColorFormatBSWAP, 97 101 .depth = 16, 98 102 .flags = FORMAT_FLAGS_PACKED, 99 - },{ 103 + }, { 100 104 .name = "16 bpp RGB, le", 101 105 .fourcc = V4L2_PIX_FMT_RGB565, 102 106 .cxformat = ColorFormatRGB16, 103 107 .depth = 16, 104 108 .flags = FORMAT_FLAGS_PACKED, 105 - },{ 109 + }, { 106 110 .name = "16 bpp RGB, be", 107 111 .fourcc = V4L2_PIX_FMT_RGB565X, 108 112 .cxformat = ColorFormatRGB16 | ColorFormatBSWAP, 109 113 .depth = 16, 110 114 .flags = FORMAT_FLAGS_PACKED, 111 - },{ 115 + }, { 112 116 .name = "24 bpp RGB, le", 113 117 .fourcc = V4L2_PIX_FMT_BGR24, 114 118 .cxformat = ColorFormatRGB24, 115 119 .depth = 24, 116 120 .flags = FORMAT_FLAGS_PACKED, 117 - },{ 121 + }, { 118 122 .name = "32 bpp RGB, le", 119 123 .fourcc = V4L2_PIX_FMT_BGR32, 120 124 .cxformat = ColorFormatRGB32, 121 125 .depth = 32, 122 126 .flags = FORMAT_FLAGS_PACKED, 123 - },{ 127 + }, { 124 128 .name = "32 bpp RGB, be", 125 129 .fourcc = V4L2_PIX_FMT_RGB32, 126 130 .cxformat = ColorFormatRGB32 | ColorFormatBSWAP | ColorFormatWSWAP, 127 131 .depth = 32, 128 132 .flags = FORMAT_FLAGS_PACKED, 129 - },{ 133 + }, { 130 134 .name = "4:2:2, packed, YUYV", 131 135 .fourcc = V4L2_PIX_FMT_YUYV, 132 136 .cxformat = ColorFormatYUY2, 133 137 .depth = 16, 134 138 .flags = FORMAT_FLAGS_PACKED, 135 - },{ 139 + }, { 136 140 .name = "4:2:2, packed, UYVY", 137 141 .fourcc = V4L2_PIX_FMT_UYVY, 138 142 .cxformat = ColorFormatYUY2 | ColorFormatBSWAP, ··· 141 145 }, 142 146 }; 143 147 144 - static const struct cx8800_fmt* format_by_fourcc(unsigned int fourcc) 148 + static const struct cx8800_fmt *format_by_fourcc(unsigned int fourcc) 145 149 { 146 150 unsigned int i; 147 151 ··· 181 185 .reg = MO_CONTR_BRIGHT, 182 186 .mask = 0x00ff, 183 187 .shift = 0, 184 - },{ 188 + }, { 185 189 .id = V4L2_CID_CONTRAST, 186 190 .minimum = 0, 187 191 .maximum = 0xff, ··· 191 195 .reg = MO_CONTR_BRIGHT, 192 196 .mask = 0xff00, 193 197 .shift = 8, 194 - },{ 198 + }, { 195 199 .id = V4L2_CID_HUE, 196 200 .minimum = 0, 197 201 .maximum = 0xff, ··· 201 205 .reg = MO_HUE, 202 206 .mask = 0x00ff, 203 207 .shift = 0, 204 - },{ 208 + }, { 205 209 /* strictly, this only describes only U saturation. 206 210 * V saturation is handled specially through code. 207 211 */ ··· 266 270 .sreg = SHADOW_AUD_VOL_CTL, 267 271 .mask = (1 << 6), 268 272 .shift = 6, 269 - },{ 273 + }, { 270 274 .id = V4L2_CID_AUDIO_VOLUME, 271 275 .minimum = 0, 272 276 .maximum = 0x3f, ··· 276 280 .sreg = SHADOW_AUD_VOL_CTL, 277 281 .mask = 0x3f, 278 282 .shift = 0, 279 - },{ 283 + }, { 280 284 .id = V4L2_CID_AUDIO_BALANCE, 281 285 .minimum = 0, 282 286 .maximum = 0x7f, ··· 300 304 { 301 305 /* struct cx88_core *core = dev->core; */ 302 306 303 - dprintk(1,"video_mux: %d [vmux=%d,gpio=0x%x,0x%x,0x%x,0x%x]\n", 307 + dprintk(1, "video_mux: %d [vmux=%d,gpio=0x%x,0x%x,0x%x,0x%x]\n", 304 308 input, INPUT(input).vmux, 305 - INPUT(input).gpio0,INPUT(input).gpio1, 306 - INPUT(input).gpio2,INPUT(input).gpio3); 309 + INPUT(input).gpio0, INPUT(input).gpio1, 310 + INPUT(input).gpio2, INPUT(input).gpio3); 307 311 core->input = input; 308 312 cx_andor(MO_INPUT_FORMAT, 0x03 << 14, INPUT(input).vmux << 14); 309 313 cx_write(MO_GP3_IO, INPUT(input).gpio3); ··· 370 374 cx_write(MO_COLOR_CTRL, dev->fmt->cxformat | ColorFormatGamma); 371 375 372 376 /* reset counter */ 373 - cx_write(MO_VIDY_GPCNTRL,GP_COUNT_CONTROL_RESET); 377 + cx_write(MO_VIDY_GPCNTRL, GP_COUNT_CONTROL_RESET); 374 378 q->count = 0; 375 379 376 380 /* enable irqs */ ··· 386 390 cx_set(MO_VID_INTMSK, 0x0f0011); 387 391 388 392 /* enable capture */ 389 - cx_set(VID_CAPTURE_CONTROL,0x06); 393 + cx_set(VID_CAPTURE_CONTROL, 0x06); 390 394 391 395 /* start dma */ 392 396 cx_set(MO_DEV_CNTRL2, (1<<5)); ··· 404 408 cx_clear(MO_VID_DMACNTRL, 0x11); 405 409 406 410 /* disable capture */ 407 - cx_clear(VID_CAPTURE_CONTROL,0x06); 411 + cx_clear(VID_CAPTURE_CONTROL, 0x06); 408 412 409 413 /* disable irqs */ 410 414 cx_clear(MO_PCI_INTMSK, PCI_INT_VIDINT); ··· 419 423 420 424 if (!list_empty(&q->active)) { 421 425 buf = list_entry(q->active.next, struct cx88_buffer, list); 422 - dprintk(2,"restart_queue [%p/%d]: restart dma\n", 426 + dprintk(2, "restart_queue [%p/%d]: restart dma\n", 423 427 buf, buf->vb.vb2_buf.index); 424 428 start_video_dma(dev, q, buf); 425 429 } ··· 488 492 core->height >> 1); 489 493 break; 490 494 } 491 - dprintk(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n", 495 + dprintk(2, "[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n", 492 496 buf, buf->vb.vb2_buf.index, 493 497 core->width, core->height, dev->fmt->depth, dev->fmt->name, 494 498 (unsigned long)buf->risc.dma); ··· 522 526 523 527 if (list_empty(&q->active)) { 524 528 list_add_tail(&buf->list, &q->active); 525 - dprintk(2,"[%p/%d] buffer_queue - first active\n", 529 + dprintk(2, "[%p/%d] buffer_queue - first active\n", 526 530 buf, buf->vb.vb2_buf.index); 527 531 528 532 } else { ··· 664 668 struct cx88_core *core = 665 669 container_of(ctrl->handler, struct cx88_core, audio_hdl); 666 670 const struct cx88_ctrl *cc = ctrl->priv; 667 - u32 value,mask; 671 + u32 value, mask; 668 672 669 673 /* Pass changes onto any WM8775 */ 670 674 if (core->sd_wm8775) { ··· 696 700 value = ((ctrl->val - cc->off) << cc->shift) & cc->mask; 697 701 break; 698 702 } 699 - dprintk(1,"set_control id=0x%X(%s) ctrl=0x%02x, reg=0x%02x val=0x%02x (mask 0x%02x)%s\n", 703 + dprintk(1, "set_control id=0x%X(%s) ctrl=0x%02x, reg=0x%02x val=0x%02x (mask 0x%02x)%s\n", 700 704 ctrl->id, ctrl->name, ctrl->val, cc->reg, value, 701 705 mask, cc->sreg ? " [shadowed]" : ""); 702 706 if (cc->sreg) ··· 737 741 unsigned int maxw, maxh; 738 742 739 743 fmt = format_by_fourcc(f->fmt.pix.pixelformat); 740 - if (NULL == fmt) 744 + if (fmt == NULL) 741 745 return -EINVAL; 742 746 743 747 maxw = norm_maxw(core->tvnorm); ··· 778 782 { 779 783 struct cx8800_dev *dev = video_drvdata(file); 780 784 struct cx88_core *core = dev->core; 781 - int err = vidioc_try_fmt_vid_cap (file,priv,f); 785 + int err = vidioc_try_fmt_vid_cap(file, priv, f); 782 786 783 - if (0 != err) 787 + if (err != 0) 784 788 return err; 785 789 if (vb2_is_busy(&dev->vb2_vidq) || vb2_is_busy(&dev->vb2_vbiq)) 786 790 return -EBUSY; ··· 800 804 801 805 strlcpy(cap->card, core->board.name, sizeof(cap->card)); 802 806 cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; 803 - if (UNSET != core->board.tuner_type) 807 + if (core->board.tuner_type != UNSET) 804 808 cap->device_caps |= V4L2_CAP_TUNER; 805 809 switch (vdev->vfl_type) { 806 810 case VFL_TYPE_RADIO: ··· 832 836 return 0; 833 837 } 834 838 835 - static int vidioc_enum_fmt_vid_cap (struct file *file, void *priv, 839 + static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, 836 840 struct v4l2_fmtdesc *f) 837 841 { 838 842 if (unlikely(f->index >= ARRAY_SIZE(formats))) 839 843 return -EINVAL; 840 844 841 - strlcpy(f->description,formats[f->index].name,sizeof(f->description)); 845 + strlcpy(f->description, formats[f->index].name, sizeof(f->description)); 842 846 f->pixelformat = formats[f->index].fourcc; 843 847 844 848 return 0; ··· 862 866 } 863 867 864 868 /* only one input in this sample driver */ 865 - int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i) 869 + int cx88_enum_input(struct cx88_core *core, struct v4l2_input *i) 866 870 { 867 871 static const char * const iname[] = { 868 - [ CX88_VMUX_COMPOSITE1 ] = "Composite1", 869 - [ CX88_VMUX_COMPOSITE2 ] = "Composite2", 870 - [ CX88_VMUX_COMPOSITE3 ] = "Composite3", 871 - [ CX88_VMUX_COMPOSITE4 ] = "Composite4", 872 - [ CX88_VMUX_SVIDEO ] = "S-Video", 873 - [ CX88_VMUX_TELEVISION ] = "Television", 874 - [ CX88_VMUX_CABLE ] = "Cable TV", 875 - [ CX88_VMUX_DVB ] = "DVB", 876 - [ CX88_VMUX_DEBUG ] = "for debug only", 872 + [CX88_VMUX_COMPOSITE1] = "Composite1", 873 + [CX88_VMUX_COMPOSITE2] = "Composite2", 874 + [CX88_VMUX_COMPOSITE3] = "Composite3", 875 + [CX88_VMUX_COMPOSITE4] = "Composite4", 876 + [CX88_VMUX_SVIDEO] = "S-Video", 877 + [CX88_VMUX_TELEVISION] = "Television", 878 + [CX88_VMUX_CABLE] = "Cable TV", 879 + [CX88_VMUX_DVB] = "DVB", 880 + [CX88_VMUX_DEBUG] = "for debug only", 877 881 }; 878 882 unsigned int n = i->index; 879 883 ··· 882 886 if (0 == INPUT(n).type) 883 887 return -EINVAL; 884 888 i->type = V4L2_INPUT_TYPE_CAMERA; 885 - strcpy(i->name,iname[INPUT(n).type]); 889 + strcpy(i->name, iname[INPUT(n).type]); 886 890 if ((CX88_VMUX_TELEVISION == INPUT(n).type) || 887 891 (CX88_VMUX_CABLE == INPUT(n).type)) { 888 892 i->type = V4L2_INPUT_TYPE_TUNER; ··· 892 896 } 893 897 EXPORT_SYMBOL(cx88_enum_input); 894 898 895 - static int vidioc_enum_input (struct file *file, void *priv, 899 + static int vidioc_enum_input(struct file *file, void *priv, 896 900 struct v4l2_input *i) 897 901 { 898 902 struct cx8800_dev *dev = video_drvdata(file); 899 903 struct cx88_core *core = dev->core; 900 - return cx88_enum_input (core,i); 904 + 905 + return cx88_enum_input(core, i); 901 906 } 902 907 903 - static int vidioc_g_input (struct file *file, void *priv, unsigned int *i) 908 + static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) 904 909 { 905 910 struct cx8800_dev *dev = video_drvdata(file); 906 911 struct cx88_core *core = dev->core; ··· 910 913 return 0; 911 914 } 912 915 913 - static int vidioc_s_input (struct file *file, void *priv, unsigned int i) 916 + static int vidioc_s_input(struct file *file, void *priv, unsigned int i) 914 917 { 915 918 struct cx8800_dev *dev = video_drvdata(file); 916 919 struct cx88_core *core = dev->core; ··· 921 924 return -EINVAL; 922 925 923 926 cx88_newstation(core); 924 - cx88_video_mux(core,i); 927 + cx88_video_mux(core, i); 925 928 return 0; 926 929 } 927 930 928 - static int vidioc_g_tuner (struct file *file, void *priv, 931 + static int vidioc_g_tuner(struct file *file, void *priv, 929 932 struct v4l2_tuner *t) 930 933 { 931 934 struct cx8800_dev *dev = video_drvdata(file); 932 935 struct cx88_core *core = dev->core; 933 936 u32 reg; 934 937 935 - if (unlikely(UNSET == core->board.tuner_type)) 938 + if (unlikely(core->board.tuner_type == UNSET)) 936 939 return -EINVAL; 937 - if (0 != t->index) 940 + if (t->index != 0) 938 941 return -EINVAL; 939 942 940 943 strcpy(t->name, "Television"); ··· 942 945 t->rangehigh = 0xffffffffUL; 943 946 call_all(core, tuner, g_tuner, t); 944 947 945 - cx88_get_stereo(core ,t); 948 + cx88_get_stereo(core, t); 946 949 reg = cx_read(MO_DEVICE_STATUS); 947 950 t->signal = (reg & (1<<5)) ? 0xffff : 0x0000; 948 951 return 0; 949 952 } 950 953 951 - static int vidioc_s_tuner (struct file *file, void *priv, 954 + static int vidioc_s_tuner(struct file *file, void *priv, 952 955 const struct v4l2_tuner *t) 953 956 { 954 957 struct cx8800_dev *dev = video_drvdata(file); 955 958 struct cx88_core *core = dev->core; 956 959 957 - if (UNSET == core->board.tuner_type) 960 + if (core->board.tuner_type == UNSET) 958 961 return -EINVAL; 959 - if (0 != t->index) 962 + if (t->index != 0) 960 963 return -EINVAL; 961 964 962 965 cx88_set_stereo(core, t->audmode, 1); 963 966 return 0; 964 967 } 965 968 966 - static int vidioc_g_frequency (struct file *file, void *priv, 969 + static int vidioc_g_frequency(struct file *file, void *priv, 967 970 struct v4l2_frequency *f) 968 971 { 969 972 struct cx8800_dev *dev = video_drvdata(file); 970 973 struct cx88_core *core = dev->core; 971 974 972 - if (unlikely(UNSET == core->board.tuner_type)) 975 + if (unlikely(core->board.tuner_type == UNSET)) 973 976 return -EINVAL; 974 977 if (f->tuner) 975 978 return -EINVAL; ··· 981 984 return 0; 982 985 } 983 986 984 - int cx88_set_freq (struct cx88_core *core, 987 + int cx88_set_freq(struct cx88_core *core, 985 988 const struct v4l2_frequency *f) 986 989 { 987 990 struct v4l2_frequency new_freq = *f; 988 991 989 - if (unlikely(UNSET == core->board.tuner_type)) 992 + if (unlikely(core->board.tuner_type == UNSET)) 990 993 return -EINVAL; 991 994 if (unlikely(f->tuner != 0)) 992 995 return -EINVAL; ··· 997 1000 core->freq = new_freq.frequency; 998 1001 999 1002 /* When changing channels it is required to reset TVAUDIO */ 1000 - msleep (10); 1003 + usleep_range(10000, 20000); 1001 1004 cx88_set_tvaudio(core); 1002 1005 1003 1006 return 0; 1004 1007 } 1005 1008 EXPORT_SYMBOL(cx88_set_freq); 1006 1009 1007 - static int vidioc_s_frequency (struct file *file, void *priv, 1010 + static int vidioc_s_frequency(struct file *file, void *priv, 1008 1011 const struct v4l2_frequency *f) 1009 1012 { 1010 1013 struct cx8800_dev *dev = video_drvdata(file); ··· 1014 1017 } 1015 1018 1016 1019 #ifdef CONFIG_VIDEO_ADV_DEBUG 1017 - static int vidioc_g_register (struct file *file, void *fh, 1020 + static int vidioc_g_register(struct file *file, void *fh, 1018 1021 struct v4l2_dbg_register *reg) 1019 1022 { 1020 1023 struct cx8800_dev *dev = video_drvdata(file); ··· 1026 1029 return 0; 1027 1030 } 1028 1031 1029 - static int vidioc_s_register (struct file *file, void *fh, 1032 + static int vidioc_s_register(struct file *file, void *fh, 1030 1033 const struct v4l2_dbg_register *reg) 1031 1034 { 1032 1035 struct cx8800_dev *dev = video_drvdata(file); ··· 1041 1044 /* RADIO ESPECIFIC IOCTLS */ 1042 1045 /* ----------------------------------------------------------- */ 1043 1046 1044 - static int radio_g_tuner (struct file *file, void *priv, 1047 + static int radio_g_tuner(struct file *file, void *priv, 1045 1048 struct v4l2_tuner *t) 1046 1049 { 1047 1050 struct cx8800_dev *dev = video_drvdata(file); ··· 1056 1059 return 0; 1057 1060 } 1058 1061 1059 - static int radio_s_tuner (struct file *file, void *priv, 1062 + static int radio_s_tuner(struct file *file, void *priv, 1060 1063 const struct v4l2_tuner *t) 1061 1064 { 1062 1065 struct cx8800_dev *dev = video_drvdata(file); 1063 1066 struct cx88_core *core = dev->core; 1064 1067 1065 - if (0 != t->index) 1068 + if (t->index != 0) 1066 1069 return -EINVAL; 1067 1070 1068 1071 call_all(core, tuner, s_tuner, t); ··· 1129 1132 for (loop = 0; loop < 10; loop++) { 1130 1133 status = cx_read(MO_PCI_INTSTAT) & 1131 1134 (core->pci_irqmask | PCI_INT_VIDINT); 1132 - if (0 == status) 1135 + if (status == 0) 1133 1136 goto out; 1134 1137 cx_write(MO_PCI_INTSTAT, status); 1135 1138 handled = 1; 1136 1139 1137 1140 if (status & core->pci_irqmask) 1138 - cx88_core_irq(core,status); 1141 + cx88_core_irq(core, status); 1139 1142 if (status & PCI_INT_VIDINT) 1140 1143 cx8800_vid_irq(dev); 1141 1144 } 1142 - if (10 == loop) { 1145 + if (loop == 10) { 1143 1146 pr_warn("irq loop -- clearing mask\n"); 1144 - cx_write(MO_PCI_INTMSK,0); 1147 + cx_write(MO_PCI_INTMSK, 0); 1145 1148 } 1146 1149 1147 1150 out: ··· 1151 1154 /* ----------------------------------------------------------- */ 1152 1155 /* exported stuff */ 1153 1156 1154 - static const struct v4l2_file_operations video_fops = 1155 - { 1157 + static const struct v4l2_file_operations video_fops = { 1158 + 1156 1159 .owner = THIS_MODULE, 1157 1160 .open = v4l2_fh_open, 1158 1161 .release = vb2_fop_release, ··· 1194 1197 static const struct video_device cx8800_video_template = { 1195 1198 .name = "cx8800-video", 1196 1199 .fops = &video_fops, 1197 - .ioctl_ops = &video_ioctl_ops, 1200 + .ioctl_ops = &video_ioctl_ops, 1198 1201 .tvnorms = CX88_NORMS, 1199 1202 }; 1200 1203 ··· 1231 1234 .tvnorms = CX88_NORMS, 1232 1235 }; 1233 1236 1234 - static const struct v4l2_file_operations radio_fops = 1235 - { 1237 + static const struct v4l2_file_operations radio_fops = { 1238 + 1236 1239 .owner = THIS_MODULE, 1237 1240 .open = radio_open, 1238 1241 .poll = v4l2_ctrl_poll, ··· 1257 1260 static const struct video_device cx8800_radio_template = { 1258 1261 .name = "cx8800-radio", 1259 1262 .fops = &radio_fops, 1260 - .ioctl_ops = &radio_ioctl_ops, 1263 + .ioctl_ops = &radio_ioctl_ops, 1261 1264 }; 1262 1265 1263 1266 static const struct v4l2_ctrl_ops cx8800_ctrl_vid_ops = { ··· 1286 1289 int err; 1287 1290 int i; 1288 1291 1289 - dev = kzalloc(sizeof(*dev),GFP_KERNEL); 1290 - if (NULL == dev) 1292 + dev = kzalloc(sizeof(*dev), GFP_KERNEL); 1293 + if (dev == NULL) 1291 1294 return -ENOMEM; 1292 1295 1293 1296 /* pci init */ ··· 1297 1300 goto fail_free; 1298 1301 } 1299 1302 core = cx88_core_get(dev->pci); 1300 - if (NULL == core) { 1303 + if (core == NULL) { 1301 1304 err = -EINVAL; 1302 1305 goto fail_free; 1303 1306 } ··· 1312 1315 (unsigned long long)pci_resource_start(pci_dev, 0)); 1313 1316 1314 1317 pci_set_master(pci_dev); 1315 - err = pci_set_dma_mask(pci_dev,DMA_BIT_MASK(32)); 1318 + err = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)); 1316 1319 if (err) { 1317 1320 pr_err("Oops: no 32bit PCI DMA ???\n"); 1318 1321 goto fail_core; ··· 1521 1524 mutex_unlock(&core->lock); 1522 1525 fail_core: 1523 1526 core->v4ldev = NULL; 1524 - cx88_core_put(core,dev->pci); 1527 + cx88_core_put(core, dev->pci); 1525 1528 fail_free: 1526 1529 kfree(dev); 1527 1530 return err; ··· 1552 1555 core->v4ldev = NULL; 1553 1556 1554 1557 /* free memory */ 1555 - cx88_core_put(core,dev->pci); 1558 + cx88_core_put(core, dev->pci); 1556 1559 kfree(dev); 1557 1560 } 1558 1561 ··· 1581 1584 cx88_shutdown(core); 1582 1585 1583 1586 pci_save_state(pci_dev); 1584 - if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) { 1587 + if (pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)) != 0) { 1585 1588 pci_disable_device(pci_dev); 1586 1589 dev->state.disabled = 1; 1587 1590 } ··· 1596 1599 int err; 1597 1600 1598 1601 if (dev->state.disabled) { 1599 - err=pci_enable_device(pci_dev); 1602 + err = pci_enable_device(pci_dev); 1600 1603 if (err) { 1601 1604 pr_err("can't enable device\n"); 1602 1605 return err; ··· 1604 1607 1605 1608 dev->state.disabled = 0; 1606 1609 } 1607 - err= pci_set_power_state(pci_dev, PCI_D0); 1610 + err = pci_set_power_state(pci_dev, PCI_D0); 1608 1611 if (err) { 1609 1612 pr_err("can't set power state\n"); 1610 1613 pci_disable_device(pci_dev); ··· 1625 1628 spin_lock_irqsave(&dev->slock, flags); 1626 1629 if (!list_empty(&dev->vidq.active)) { 1627 1630 pr_info("resume video\n"); 1628 - restart_video_queue(dev,&dev->vidq); 1631 + restart_video_queue(dev, &dev->vidq); 1629 1632 } 1630 1633 if (!list_empty(&dev->vbiq.active)) { 1631 1634 pr_info("resume vbi\n"); 1632 - cx8800_restart_vbi_queue(dev,&dev->vbiq); 1635 + cx8800_restart_vbi_queue(dev, &dev->vbiq); 1633 1636 } 1634 1637 spin_unlock_irqrestore(&dev->slock, flags); 1635 1638 ··· 1645 1648 .device = 0x8800, 1646 1649 .subvendor = PCI_ANY_ID, 1647 1650 .subdevice = PCI_ANY_ID, 1648 - },{ 1651 + }, { 1649 1652 /* --- end of list --- */ 1650 1653 } 1651 1654 };
+19 -25
drivers/media/pci/cx88/cx88-vp3054-i2c.c
··· 1 1 /* 2 - 3 - cx88-vp3054-i2c.c -- support for the secondary I2C bus of the 4 - DNTV Live! DVB-T Pro (VP-3054), wired as: 5 - GPIO[0] -> SCL, GPIO[1] -> SDA 6 - 7 - (c) 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au> 8 - 9 - This program is free software; you can redistribute it and/or modify 10 - it under the terms of the GNU General Public License as published by 11 - the Free Software Foundation; either version 2 of the License, or 12 - (at your option) any later version. 13 - 14 - This program is distributed in the hope that it will be useful, 15 - but WITHOUT ANY WARRANTY; without even the implied warranty of 16 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 - GNU General Public License for more details. 18 - 19 - You should have received a copy of the GNU General Public License 20 - along with this program; if not, write to the Free Software 21 - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 - 23 - */ 2 + * cx88-vp3054-i2c.c -- support for the secondary I2C bus of the 3 + * DNTV Live! DVB-T Pro (VP-3054), wired as: 4 + * GPIO[0] -> SCL, GPIO[1] -> SDA 5 + * 6 + * (c) 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au> 7 + * 8 + * This program is free software; you can redistribute it and/or modify 9 + * it under the terms of the GNU General Public License as published by 10 + * the Free Software Foundation; either version 2 of the License, or 11 + * (at your option) any later version. 12 + * 13 + * This program is distributed in the hope that it will be useful, 14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 + * GNU General Public License for more details. 17 + */ 24 18 25 19 #include "cx88.h" 26 20 #include "cx88-vp3054-i2c.h" ··· 122 128 i2c_set_adapdata(&vp3054_i2c->adap, dev); 123 129 vp3054_i2c->adap.algo_data = &vp3054_i2c->algo; 124 130 125 - vp3054_bit_setscl(dev,1); 126 - vp3054_bit_setsda(dev,1); 131 + vp3054_bit_setscl(dev, 1); 132 + vp3054_bit_setsda(dev, 1); 127 133 128 134 rc = i2c_bit_add_bus(&vp3054_i2c->adap); 129 - if (0 != rc) { 135 + if (rc != 0) { 130 136 pr_err("vp3054_i2c register FAILED\n"); 131 137 132 138 kfree(dev->vp3054);
+17 -20
drivers/media/pci/cx88/cx88.h
··· 13 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 15 * GNU General Public License for more details. 16 - * 17 - * You should have received a copy of the GNU General Public License 18 - * along with this program; if not, write to the Free Software 19 - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 16 */ 21 17 22 18 #ifndef CX88_H ··· 54 58 /* defines and enums */ 55 59 56 60 /* Currently unsupported by the driver: PAL/H, NTSC/Kr, SECAM/LC */ 57 - #define CX88_NORMS (V4L2_STD_ALL \ 61 + #define CX88_NORMS (V4L2_STD_ALL \ 58 62 & ~V4L2_STD_PAL_H \ 59 63 & ~V4L2_STD_NTSC_M_KR \ 60 64 & ~V4L2_STD_SECAM_LC) ··· 362 366 u32 i2c_state, i2c_rc; 363 367 364 368 /* config info -- analog */ 365 - struct v4l2_device v4l2_dev; 369 + struct v4l2_device v4l2_dev; 366 370 struct v4l2_ctrl_handler video_hdl; 367 371 struct v4l2_ctrl *chroma_agc; 368 372 struct v4l2_ctrl_handler audio_hdl; 369 373 struct v4l2_subdev *sd_wm8775; 370 - struct i2c_client *i2c_rtc; 374 + struct i2c_client *i2c_rtc; 371 375 unsigned int boardnr; 372 376 struct cx88_board board; 373 377 ··· 384 388 /* state info */ 385 389 struct task_struct *kthread; 386 390 v4l2_std_id tvnorm; 387 - unsigned width, height; 388 - unsigned field; 391 + unsigned int width, height; 392 + unsigned int field; 389 393 enum cx88_tvaudio tvaudio; 390 394 u32 audiomode_manual; 391 395 u32 audiomode_current; ··· 485 489 486 490 /* pci i/o */ 487 491 struct pci_dev *pci; 488 - unsigned char pci_rev,pci_lat; 492 + unsigned char pci_rev, pci_lat; 489 493 490 494 const struct cx8800_fmt *fmt; 491 495 ··· 548 552 549 553 /* pci i/o */ 550 554 struct pci_dev *pci; 551 - unsigned char pci_rev,pci_lat; 555 + unsigned char pci_rev, pci_lat; 552 556 553 557 /* dma queues */ 554 558 struct cx88_dmaqueue mpegq; ··· 590 594 /* ----------------------------------------------------------- */ 591 595 592 596 #define cx_read(reg) readl(core->lmmio + ((reg)>>2)) 593 - #define cx_write(reg,value) writel((value), core->lmmio + ((reg)>>2)) 594 - #define cx_writeb(reg,value) writeb((value), core->bmmio + (reg)) 597 + #define cx_write(reg, value) writel((value), core->lmmio + ((reg)>>2)) 598 + #define cx_writeb(reg, value) writeb((value), core->bmmio + (reg)) 595 599 596 - #define cx_andor(reg,mask,value) \ 600 + #define cx_andor(reg, mask, value) \ 597 601 writel((readl(core->lmmio+((reg)>>2)) & ~(mask)) |\ 598 602 ((value) & (mask)), core->lmmio+((reg)>>2)) 599 - #define cx_set(reg,bit) cx_andor((reg),(bit),(bit)) 600 - #define cx_clear(reg,bit) cx_andor((reg),(bit),0) 603 + #define cx_set(reg, bit) cx_andor((reg), (bit), (bit)) 604 + #define cx_clear(reg, bit) cx_andor((reg), (bit), 0) 601 605 602 606 #define cx_wait(d) { if (need_resched()) schedule(); else udelay(d); } 603 607 604 608 /* shadow registers */ 605 609 #define cx_sread(sreg) (core->shadow[sreg]) 606 - #define cx_swrite(sreg,reg,value) \ 610 + #define cx_swrite(sreg, reg, value) \ 607 611 (core->shadow[sreg] = value, \ 608 612 writel(core->shadow[sreg], core->lmmio + ((reg)>>2))) 609 - #define cx_sandor(sreg,reg,mask,value) \ 613 + #define cx_sandor(sreg, reg, mask, value) \ 610 614 (core->shadow[sreg] = (core->shadow[sreg] & ~(mask)) | ((value) & (mask)), \ 611 615 writel(core->shadow[sreg], core->lmmio + ((reg)>>2))) 612 616 ··· 663 667 /* cx88-vbi.c */ 664 668 665 669 /* Can be used as g_vbi_fmt, try_vbi_fmt and s_vbi_fmt */ 666 - int cx8800_vbi_fmt (struct file *file, void *priv, 670 + int cx8800_vbi_fmt(struct file *file, void *priv, 667 671 struct v4l2_format *f); 668 672 669 673 /* ··· 704 708 int cx8802_unregister_driver(struct cx8802_driver *drv); 705 709 706 710 /* Caller must hold core->lock */ 707 - struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype); 711 + struct cx8802_driver *cx8802_get_driver(struct cx8802_dev *dev, 712 + enum cx88_board_type btype); 708 713 709 714 /* ----------------------------------------------------------- */ 710 715 /* cx88-dsp.c */