source: scripts/patches/linux-2.6.10-cx88-update.patch @ c0cf39e

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since c0cf39e was 7f65c0e, checked in by Jim Gifford <clfs@…>, 18 years ago

r625@server (orig r623): jim | 2005-10-31 12:43:24 -0800
Final Move

  • Property mode set to 100644
File size: 41.8 KB
  • drivers/media/video/cx88/cx88-cards.c

    Subject: [patch] cx88 update
    
    FIXME: description
    
    Signed-off-by: Gerd Knorr <kraxel@bytesex.org>
    old new  
    11/*
    2  * $Id: cx88-cards.c,v 1.47 2004/11/03 09:04:50 kraxel Exp $
     2 * $Id: cx88-cards.c,v 1.53 2004/12/14 15:33:30 kraxel Exp $
    33 *
    44 * device driver for Conexant 2388x based TV cards
    55 * card-specific stuff.
     
    3232
    3333#include "cx88.h"
    3434#ifdef WITH_DVB
    35 #include "cx22702.h"
     35# include "dvb-pll.h"
     36# include "cx22702.h"
    3637#endif
    3738
    3839/* ------------------------------------------------------------------ */
    struct cx88_board cx88_boards[] = { 
    9192        },
    9293        [CX88_BOARD_PIXELVIEW] = {
    9394                .name           = "PixelView",
    94                 .tuner_type     = UNSET,
     95                .tuner_type     = 5,
    9596                .input          = {{
    9697                        .type   = CX88_VMUX_TELEVISION,
    9798                        .vmux   = 0,
    struct cx88_board cx88_boards[] = { 
    223224                },
    224225        },
    225226        [CX88_BOARD_LEADTEK_PVR2000] = {
     227                // gpio values for PAL version from regspy by DScaler
    226228                .name           = "Leadtek PVR 2000",
    227229                .tuner_type     = 38,
     230                .tda9887_conf   = TDA9887_PRESENT,
    228231                .input          = {{
    229232                        .type   = CX88_VMUX_TELEVISION,
    230233                        .vmux   = 0,
     234                        .gpio0  = 0x0000bde6,
    231235                },{
    232236                        .type   = CX88_VMUX_COMPOSITE1,
    233237                        .vmux   = 1,
     238                        .gpio0  = 0x0000bde6,
    234239                },{
    235240                        .type   = CX88_VMUX_SVIDEO,
    236241                        .vmux   = 2,
     242                        .gpio0  = 0x0000bde6,
    237243                }},
    238244                .radio = {
    239245                        .type   = CX88_RADIO,
     246                        .gpio0  = 0x0000bd62,
    240247                },
    241248                .blackbird = 1,
    242249        },
    struct cx88_board cx88_boards[] = { 
    452459                }},
    453460                .dvb            = 1,
    454461        },
     462        [CX88_BOARD_DNTV_LIVE_DVB_T] = {
     463                .name           = "digitalnow DNTV Live! DVB-T",
     464                .tuner_type     = TUNER_ABSENT,
     465                .input          = {{
     466                        .type   = CX88_VMUX_COMPOSITE1,
     467                        .vmux   = 1,
     468                        .gpio0  = 0x00000700,
     469                        .gpio2  = 0x00000101,
     470                },{
     471                        .type   = CX88_VMUX_SVIDEO,
     472                        .vmux   = 2,
     473                        .gpio0  = 0x00000700,
     474                        .gpio2  = 0x00000101,
     475                }},
     476                .dvb            = 1,
     477        },
    455478};
    456479const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
    457480
    struct cx88_subid cx88_subids[] = { 
    543566                .subvendor = 0x18AC,
    544567                .subdevice = 0xDB10,
    545568                .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
     569        },{
     570                .subvendor = 0x1554,
     571                .subdevice = 0x4811,
     572                .card      = CX88_BOARD_PIXELVIEW,
     573        },{
     574                .subvendor = 0x7063,
     575                .subdevice = 0x3000, /* HD-3000 card */
     576                .card      = CX88_BOARD_PCHDTV_HD3000,
     577        },{
     578                .subvendor = 0x17DE,
     579                .subdevice = 0xA8A6,
     580                .card      = CX88_BOARD_DNTV_LIVE_DVB_T,
    546581        }
    547582};
    548583const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
    static struct { 
    632667        { TUNER_LG_PAL_FM,     "LG TPI8PSB01D"},
    633668        { TUNER_LG_PAL,        "LG TPI8PSB11D"},
    634669        { TUNER_LG_PAL_I_FM,   "LG TAPC-I001D"},
    635         { TUNER_LG_PAL_I,      "LG TAPC-I701D"}
     670        { TUNER_LG_PAL_I,      "LG TAPC-I701D"},
     671        { TUNER_THOMSON_DTT7610,  "DTT-7610"}
    636672};
    637673
    638674static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
    639675{
     676#if 0
    640677        unsigned int blk2,tuner,radio,model;
    641678
    642679        if (eeprom_data[0] != 0x84 || eeprom_data[2] != 0) {
    static void hauppauge_eeprom(struct cx88 
    663700               core->name, model, (tuner < ARRAY_SIZE(hauppauge_tuner)
    664701                                   ? hauppauge_tuner[tuner].name : "?"),
    665702               core->tuner_type, radio ? "yes" : "no");
     703#else
     704        struct tveeprom tv;
     705
     706        tveeprom_hauppauge_analog(&tv, eeprom_data);
     707        core->tuner_type = tv.tuner_type;
     708        core->has_radio  = tv.has_radio;
     709#endif
    666710}
    667711
    668712#ifdef WITH_DVB
    static int hauppauge_eeprom_dvb(struct c 
    670714{
    671715        int model;
    672716        int tuner;
    673         char *tname;
    674717
    675718        /* Make sure we support the board model */
    676719        model = ee[0x1f] << 24 | ee[0x1e] << 16 | ee[0x1d] << 8 | ee[0x1c];
    static int hauppauge_eeprom_dvb(struct c 
    689732        /* Make sure we support the tuner */
    690733        tuner = ee[0x2d];
    691734        switch(tuner) {
    692         case 0x4B:
    693                 tname = "Thomson DTT 7595";
    694                 core->pll_type = PLLTYPE_DTT7595;
    695                 break;
    696         case 0x4C:
    697                 tname = "Thomson DTT 7592";
    698                 core->pll_type = PLLTYPE_DTT7592;
     735        case 0x4B: /* ddt 7595 */
     736        case 0x4C: /* dtt 7592 */
     737                core->pll_desc = &dvb_pll_thomson_dtt759x;
    699738                break;
    700739        default:
    701740                printk("%s: error: unknown hauppauge tuner 0x%02x\n",
    702741                       core->name, tuner);
    703742                return -ENODEV;
    704743        }
    705         printk(KERN_INFO "%s: hauppauge eeprom: model=%d, tuner=%s (%d)\n",
    706                core->name, model, tname, tuner);
     744        printk(KERN_INFO "%s: hauppauge eeprom: model=%d, tuner=%d (%s)\n",
     745               core->name, model, tuner,
     746               core->pll_desc ? core->pll_desc->name : "UNKNOWN");
    707747
    708         core->pll_addr = 0x61;
     748        core->pll_addr   = 0x61;
    709749        core->demod_addr = 0x43;
    710750}
    711751#endif
    static void gdi_eeprom(struct cx88_core  
    763803
    764804/* ----------------------------------------------------------------------- */
    765805
    766 static int
    767 i2c_eeprom(struct i2c_client *c, unsigned char *eedata, int len)
    768 {
    769         unsigned char buf;
    770         int err;
    771 
    772         c->addr = 0xa0 >> 1;
    773         buf = 0;
    774         if (1 != (err = i2c_master_send(c,&buf,1))) {
    775                 printk(KERN_INFO "cx88: Huh, no eeprom present (err=%d)?\n",
    776                        err);
    777                 return -1;
    778         }
    779         if (len != (err = i2c_master_recv(c,eedata,len))) {
    780                 printk(KERN_WARNING "cx88: i2c eeprom read error (err=%d)\n",
    781                        err);
    782                 return -1;
    783         }
    784 #if 0
    785         for (i = 0; i < len; i++) {
    786                 if (0 == (i % 16))
    787                         printk(KERN_INFO "cx88 ee: %02x:",i);
    788                 printk(" %02x",eedata[i]);
    789                 if (15 == (i % 16))
    790                         printk("\n");
    791         }
    792 #endif
    793         return 0;
    794 }
    795 
    796806void cx88_card_list(struct cx88_core *core, struct pci_dev *pci)
    797807{
    798808        int i;
    void cx88_card_setup(struct cx88_core *c 
    823833{
    824834        static u8 eeprom[128];
    825835
     836        if (0 == core->i2c_rc) {
     837                core->i2c_client.addr = 0xa0 >> 1;
     838                tveeprom_read(&core->i2c_client,eeprom,sizeof(eeprom));
     839        }
     840
    826841        switch (core->board) {
    827842        case CX88_BOARD_HAUPPAUGE:
    828843                if (0 == core->i2c_rc)
    829                         i2c_eeprom(&core->i2c_client,eeprom,sizeof(eeprom));
    830                 hauppauge_eeprom(core,eeprom+8);
     844                        hauppauge_eeprom(core,eeprom+8);
    831845                break;
    832846        case CX88_BOARD_GDI:
    833847                if (0 == core->i2c_rc)
    834                         i2c_eeprom(&core->i2c_client,eeprom,sizeof(eeprom));
    835                 gdi_eeprom(core,eeprom);
     848                        gdi_eeprom(core,eeprom);
    836849                break;
    837850        case CX88_BOARD_WINFAST2000XP:
    838851                if (0 == core->i2c_rc)
    839                         i2c_eeprom(&core->i2c_client,eeprom,sizeof(eeprom));
    840                 leadtek_eeprom(core,eeprom);
     852                        leadtek_eeprom(core,eeprom);
     853                break;
     854#ifdef WITH_DVB
     855        case CX88_BOARD_HAUPPAUGE_DVB_T1:
     856                if (0 == core->i2c_rc)
     857                        hauppauge_eeprom_dvb(core,eeprom);
     858                break;
     859        case CX88_BOARD_CONEXANT_DVB_T1:
     860                core->pll_desc   = &dvb_pll_thomson_dtt7579;
     861                core->pll_addr   = 0x60;
     862                core->demod_addr = 0x43;
    841863                break;
    842864        case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
    843865                /* Tuner reset is hooked to  the tuner out of reset */
    void cx88_card_setup(struct cx88_core *c 
    845867                cx_clear(MO_GP0_IO, 0x00000001);
    846868                msleep(1);
    847869                cx_set(MO_GP0_IO, 0x00000101);
     870                core->pll_addr = 0x61;
     871                core->pll_desc = &dvb_pll_lg_z201;
    848872                break;
    849 #ifdef WITH_DVB
    850         case CX88_BOARD_HAUPPAUGE_DVB_T1:
    851                 if (0 == core->i2c_rc)
    852                         i2c_eeprom(&core->i2c_client,eeprom,sizeof(eeprom));
    853                 hauppauge_eeprom_dvb(core,eeprom);
     873        case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
     874                core->pll_addr = 0x60;
     875                core->pll_desc = &dvb_pll_thomson_dtt7579;
    854876                break;
    855         case CX88_BOARD_CONEXANT_DVB_T1:
    856                 core->pll_type   = PLLTYPE_DTT7579;
    857                 core->pll_addr   = 0x60;
    858                 core->demod_addr = 0x43;
     877        case CX88_BOARD_DNTV_LIVE_DVB_T:
     878                cx_set(MO_GP0_IO, 0x00000707);
     879                cx_set(MO_GP2_IO, 0x00000101);
     880                cx_clear(MO_GP2_IO, 0x00000001);
     881                msleep(1);
     882                cx_clear(MO_GP0_IO, 0x00000007);
     883                cx_set(MO_GP2_IO, 0x00000101);
     884                core->pll_addr = 0x61;
     885                core->pll_desc = &dvb_pll_unknown_1;
    859886                break;
    860887#endif
    861888        }
  • drivers/media/video/cx88/cx88-core.c

    old new  
    11/*
    2  * $Id: cx88-core.c,v 1.15 2004/10/25 11:26:36 kraxel Exp $
     2 * $Id: cx88-core.c,v 1.21 2004/12/10 12:33:39 kraxel Exp $
    33 *
    44 * device driver for Conexant 2388x based TV cards
    55 * driver core
     
    2424#include <linux/init.h>
    2525#include <linux/list.h>
    2626#include <linux/module.h>
     27#include <linux/moduleparam.h>
    2728#include <linux/kernel.h>
    2829#include <linux/slab.h>
    2930#include <linux/kmod.h>
    static unsigned int nicam = 0; 
    6263module_param(nicam,int,0644);
    6364MODULE_PARM_DESC(nicam,"tv audio is nicam");
    6465
     66static unsigned int nocomb = 0;
     67module_param(nocomb,int,0644);
     68MODULE_PARM_DESC(nicam,"disable comb filter");
     69
    6570#define dprintk(level,fmt, arg...)      if (core_debug >= level)        \
    6671        printk(KERN_DEBUG "%s: " fmt, core->name , ## arg)
    6772
    int cx88_risc_decode(u32 risc) 
    462467        return incr[risc >> 28] ? incr[risc >> 28] : 1;
    463468}
    464469
     470#if 0 /* currently unused, but useful for debugging */
    465471void cx88_risc_disasm(struct cx88_core *core,
    466472                      struct btcx_riscmem *risc)
    467473{
    void cx88_risc_disasm(struct cx88_core * 
    479485                        break;
    480486        }
    481487}
     488#endif
    482489
    483490void cx88_sram_channel_dump(struct cx88_core *core,
    484491                            struct sram_channel *ch)
    void cx88_print_irqbits(char *name, char 
    579586
    580587/* ------------------------------------------------------------------ */
    581588
    582 void cx88_irq(struct cx88_core *core, u32 status, u32 mask)
     589int cx88_core_irq(struct cx88_core *core, u32 status)
    583590{
    584         cx88_print_irqbits(core->name, "irq pci",
    585                            cx88_pci_irqs, status, mask);
     591        int handled = 0;
     592
     593        if (status & (1<<18)) {
     594                cx88_ir_irq(core);
     595                handled++;
     596        }
     597        if (!handled)
     598                cx88_print_irqbits(core->name, "irq pci",
     599                                   cx88_pci_irqs, status,
     600                                   core->pci_irqmask);
     601        return handled;
    586602}
    587603
    588604void cx88_wakeup(struct cx88_core *core,
    int cx88_set_scale(struct cx88_core *cor 
    800816                value |= (1 << 0); // 3-tap interpolation
    801817        if (width < 193)
    802818                value |= (1 << 1); // 5-tap interpolation
     819        if (nocomb)
     820                value |= (3 << 5); // disable comb filter
    803821
    804822        cx_write(MO_FILTER_EVEN,  value);
    805823        cx_write(MO_FILTER_ODD,   value);
    int cx88_set_tvnorm(struct cx88_core *co 
    969987        cx_write(MO_VBI_PACKET, ((1 << 11) | /* (norm_vdelay(norm)   << 11) | */
    970988                                 norm_vbipack(norm)));
    971989
     990        // this is needed as well to set all tvnorm parameter
     991        cx88_set_scale(core, 320, 240, V4L2_FIELD_INTERLACED);
     992
    972993        // audio
    973994        set_tvaudio(core);
    974995
    struct cx88_core* cx88_core_get(struct p 
    11051126                goto fail_unlock;
    11061127
    11071128        memset(core,0,sizeof(*core));
     1129        atomic_inc(&core->refcount);
    11081130        core->pci_bus  = pci->bus->number;
    11091131        core->pci_slot = PCI_SLOT(pci->devfn);
    1110         atomic_inc(&core->refcount);
     1132        core->pci_irqmask = 0x00fc00;
    11111133
    11121134        core->nr = cx88_devcount++;
    11131135        sprintf(core->name,"cx88[%d]",core->nr);
    struct cx88_core* cx88_core_get(struct p 
    11501172        cx88_reset(core);
    11511173        cx88_i2c_init(core,pci);
    11521174        cx88_card_setup(core);
     1175        cx88_ir_init(core,pci);
     1176        cx_write(MO_PCI_INTMSK, core->pci_irqmask);
    11531177
    11541178        up(&devlist);
    11551179        return core;
    void cx88_core_put(struct cx88_core *cor 
    11701194                return;
    11711195
    11721196        down(&devlist);
     1197        cx88_ir_fini(core);
    11731198        if (0 == core->i2c_rc)
    11741199                i2c_bit_del_bus(&core->i2c_adap);
    11751200        list_del(&core->devlist);
    EXPORT_SYMBOL(cx88_vid_irqs); 
    11871212EXPORT_SYMBOL(cx88_mpeg_irqs);
    11881213EXPORT_SYMBOL(cx88_print_irqbits);
    11891214
    1190 EXPORT_SYMBOL(cx88_irq);
     1215EXPORT_SYMBOL(cx88_core_irq);
    11911216EXPORT_SYMBOL(cx88_wakeup);
    11921217EXPORT_SYMBOL(cx88_reset);
    11931218EXPORT_SYMBOL(cx88_shutdown);
    EXPORT_SYMBOL(cx88_risc_databuffer); 
    11971222EXPORT_SYMBOL(cx88_risc_stopper);
    11981223EXPORT_SYMBOL(cx88_free_buffer);
    11991224
    1200 EXPORT_SYMBOL(cx88_risc_disasm);
    1201 
    12021225EXPORT_SYMBOL(cx88_sram_channels);
    12031226EXPORT_SYMBOL(cx88_sram_channel_setup);
    12041227EXPORT_SYMBOL(cx88_sram_channel_dump);
  • drivers/media/video/cx88/cx88-blackbird.c

    old new  
    11/*
    2  * $Id: cx88-blackbird.c,v 1.17 2004/11/07 13:17:15 kraxel Exp $
     2 * $Id: cx88-blackbird.c,v 1.23 2004/12/10 12:33:39 kraxel Exp $
    33 *
    44 *  Support for a cx23416 mpeg encoder via cx2388x host port.
    55 *  "blackbird" reference design.
     
    2525 */
    2626
    2727#include <linux/module.h>
     28#include <linux/moduleparam.h>
    2829#include <linux/init.h>
    2930#include <linux/fs.h>
    3031#include <linux/delay.h>
    static int register_write(struct cx88_co 
    207208        cx_read(P1_RADDR0);
    208209
    209210        return wait_ready_gpio0_bit1(core,1);
    210 #if 0
    211         udelay(1000); /* without this, things don't go right (subsequent memory_write()'s don't get through */
    212         /* ? would this be safe here? set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1); */
    213 #endif
    214211}
    215212
    216213
    static int blackbird_api_cmd(struct cx88 
    283280        timeout = jiffies + msecs_to_jiffies(10);
    284281        for (;;) {
    285282                memory_read(dev->core, dev->mailbox, &flag);
    286                 if (0 == (flag & 4))
     283                if (0 != (flag & 4))
    287284                        break;
    288285                if (time_after(jiffies,timeout)) {
    289286                        dprintk(0, "ERROR: API Mailbox timeout\n");
    static int blackbird_find_mailbox(struct 
    324321                        signaturecnt = 0;
    325322                if (4 == signaturecnt) {
    326323                        dprintk(1, "Mailbox signature found\n");
    327                         return i;
     324                        return i+1;
    328325                }
    329326        }
    330327        dprintk(0, "Mailbox signature values not found!\n");
    static void blackbird_codec_settings(str 
    427424        blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAMERATE, 1, 0, 0);
    428425
    429426        /* assign frame size */
    430         blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_SIZE, 2, 0, 480, 720);
     427        blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_SIZE, 2, 0,
     428                          dev->height, dev->width);
    431429
    432430        /* assign aspect ratio */
    433431        blackbird_api_cmd(dev, IVTV_API_ASSIGN_ASPECT_RATIO, 1, 0, 2);
    static int mpeg_do_ioctl(struct inode *i 
    629627
    630628                memset(f,0,sizeof(*f));
    631629                f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    632                 f->fmt.pix.width        = 720;
    633                 f->fmt.pix.height       = 576;
     630                f->fmt.pix.width        = dev->width;
     631                f->fmt.pix.height       = dev->height;
    634632                f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
    635633                f->fmt.pix.sizeimage    = 1024 * 512 /* FIXME: BUFFER_SIZE */;
    636634        }
    static int mpeg_open(struct inode *inode 
    694692        file->private_data = fh;
    695693        fh->dev      = dev;
    696694
     695        /* FIXME: locking against other video device */
     696        cx88_set_scale(dev->core, dev->width, dev->height,
     697                       V4L2_FIELD_INTERLACED);
     698       
    697699        videobuf_queue_init(&fh->mpegq, &blackbird_qops,
    698700                            dev->pci, &dev->slock,
    699701                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
    static int mpeg_release(struct inode *in 
    715717        if (fh->mpegq.reading)
    716718                videobuf_read_stop(&fh->mpegq);
    717719
     720        videobuf_mmap_free(&fh->mpegq);
    718721        file->private_data = NULL;
    719722        kfree(fh);
    720723        return 0;
    static int __devinit blackbird_probe(str 
    821824        memset(dev,0,sizeof(*dev));
    822825        dev->pci = pci_dev;
    823826        dev->core = core;
     827        dev->width = 720;
     828        dev->height = 480;
    824829
    825830        err = cx8802_init_common(dev);
    826831        if (0 != err)
  • drivers/media/video/Kconfig

    old new config VIDEO_CX88 
    309309        select VIDEO_BTCX
    310310        select VIDEO_BUF
    311311        select VIDEO_TUNER
     312        select VIDEO_TVEEPROM
    312313        ---help---
    313314          This is a video4linux driver for Conexant 2388x based
    314315          TV cards.
    config VIDEO_CX88 
    318319
    319320config VIDEO_CX88_DVB
    320321        tristate "DVB Support for cx2388x based TV cards"
    321         depends on VIDEO_CX88 && DVB_CORE && BROKEN
     322        depends on VIDEO_CX88 && DVB_CORE
    322323        select VIDEO_BUF_DVB
    323324        ---help---
    324325          This adds support for DVB cards based on the
  • drivers/media/video/cx88/cx88-video.c

    old new  
    11/*
    2  * $Id: cx88-video.c,v 1.46 2004/11/07 14:44:59 kraxel Exp $
     2 * $Id: cx88-video.c,v 1.50 2004/12/10 12:33:39 kraxel Exp $
    33 *
    44 * device driver for Conexant 2388x based TV cards
    55 * video4linux video interface
     
    2424#include <linux/init.h>
    2525#include <linux/list.h>
    2626#include <linux/module.h>
     27#include <linux/moduleparam.h>
    2728#include <linux/kmod.h>
    2829#include <linux/kernel.h>
    2930#include <linux/slab.h>
    static int start_video_dma(struct cx8800 
    428429        q->count = 1;
    429430
    430431        /* enable irqs */
    431         cx_set(MO_PCI_INTMSK, 0x00fc01);
     432        cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x01);
    432433        cx_set(MO_VID_INTMSK, 0x0f0011);
    433434
    434435        /* enable capture */
    static int video_open(struct inode *inod 
    10021003}
    10031004
    10041005static ssize_t
    1005 video_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
     1006video_read(struct file *file, char *data, size_t count, loff_t *ppos)
    10061007{
    10071008        struct cx8800_fh *fh = file->private_data;
    10081009
    static int video_release(struct inode *i 
    10831084                res_free(dev,fh,RESOURCE_VBI);
    10841085        }
    10851086
     1087        videobuf_mmap_free(&fh->vidq);
     1088        videobuf_mmap_free(&fh->vbiq);
    10861089        file->private_data = NULL;
    10871090        kfree(fh);
    10881091        return 0;
    static irqreturn_t cx8800_irq(int irq, v 
    18801883{
    18811884        struct cx8800_dev *dev = dev_id;
    18821885        struct cx88_core *core = dev->core;
    1883         u32 status, mask;
     1886        u32 status;
    18841887        int loop, handled = 0;
    18851888
    18861889        for (loop = 0; loop < 10; loop++) {
    1887                 status = cx_read(MO_PCI_INTSTAT) & (~0x1f | 0x01);
    1888                 mask   = cx_read(MO_PCI_INTMSK);
    1889                 if (0 == (status & mask))
     1890                status = cx_read(MO_PCI_INTSTAT) & (core->pci_irqmask | 0x01);
     1891                if (0 == status)
    18901892                        goto out;
    18911893                cx_write(MO_PCI_INTSTAT, status);
    18921894                handled = 1;
    18931895
    1894                 if (status & mask & ~0x1f)
    1895                         cx88_irq(core,status,mask);
     1896                if (status & core->pci_irqmask)
     1897                        cx88_core_irq(core,status);
    18961898                if (status & 0x01)
    18971899                        cx8800_vid_irq(dev);
    18981900        };
  • drivers/media/video/cx88/cx88-mpeg.c

    old new  
    11/*
    2  * $Id: cx88-mpeg.c,v 1.14 2004/10/25 11:26:36 kraxel Exp $
     2 * $Id: cx88-mpeg.c,v 1.16 2004/12/10 12:33:39 kraxel Exp $
    33 *
    44 *  Support for the mpeg transport stream transfers
    55 *  PCI function #2 of the cx2388x.
     
    2424 */
    2525
    2626#include <linux/module.h>
     27#include <linux/moduleparam.h>
    2728#include <linux/init.h>
    2829#include <linux/device.h>
    2930#include <linux/interrupt.h>
    static int cx8802_start_dma(struct cx880 
    9394        q->count = 1;
    9495
    9596        /* enable irqs */
    96         cx_set(MO_PCI_INTMSK, 0x00fc04);
     97        cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x04);
    9798        cx_write(MO_TS_INTMSK,  0x1f0011);
    9899
    99100        /* start dma */
    static irqreturn_t cx8802_irq(int irq, v 
    292293{
    293294        struct cx8802_dev *dev = dev_id;
    294295        struct cx88_core *core = dev->core;
    295         u32 status, mask;
     296        u32 status;
    296297        int loop, handled = 0;
    297298
    298299        for (loop = 0; loop < 10; loop++) {
    299                 status = cx_read(MO_PCI_INTSTAT) & (~0x1f | 0x04);
    300                 mask   = cx_read(MO_PCI_INTMSK);
    301                 if (0 == (status & mask))
     300                status = cx_read(MO_PCI_INTSTAT) & (core->pci_irqmask | 0x04);
     301                if (0 == status)
    302302                        goto out;
    303303                handled = 1;
    304304                cx_write(MO_PCI_INTSTAT, status);
    305305
    306                 if (status & mask & ~0x1f)
    307                         cx88_irq(core,status,mask);
     306                if (status & core->pci_irqmask)
     307                        cx88_core_irq(core,status);
    308308                if (status & 0x04)
    309309                        cx8802_mpeg_irq(dev);
    310310        };
  • drivers/media/video/cx88/cx88-tvaudio.c

    old new  
    11/*
    2     $Id: cx88-tvaudio.c,v 1.24 2004/10/25 11:51:00 kraxel Exp $
     2    $Id: cx88-tvaudio.c,v 1.26 2004/12/10 12:33:39 kraxel Exp $
    33
    44    cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver
    55
     
    3737*/
    3838
    3939#include <linux/module.h>
     40#include <linux/moduleparam.h>
    4041#include <linux/errno.h>
    4142#include <linux/kernel.h>
    4243#include <linux/slab.h>
  • drivers/media/video/cx88/cx88-dvb.c

    old new  
    11/*
    2  * $Id: cx88-dvb.c,v 1.19 2004/11/07 14:44:59 kraxel Exp $
     2 * $Id: cx88-dvb.c,v 1.21 2004/12/09 12:51:35 kraxel Exp $
    33 *
    44 * device driver for Conexant 2388x based TV cards
    55 * MPEG Transport Stream (DVB) routines
     
    3131#include <linux/suspend.h>
    3232
    3333#include "cx88.h"
     34#include "dvb-pll.h"
    3435#include "cx22702.h"
    3536#include "mt352.h"
    3637#include "mt352_priv.h" /* FIXME */
    static int dvico_fusionhdtv_demod_init(s 
    110111        return 0;
    111112}
    112113
    113 #define IF_FREQUENCYx6 217    /* 6 * 36.16666666667MHz */
    114 
    115 static int lg_z201_pll_set(struct dvb_frontend* fe,
    116                            struct dvb_frontend_parameters* params, u8* pllbuf)
     114static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe)
    117115{
    118         u32 div;
    119         unsigned char cp = 0;
    120         unsigned char bs = 0;
    121 
    122         div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
    123 
    124         if (params->frequency < 542000000) cp = 0xbc;
    125         else if (params->frequency < 830000000) cp = 0xf4;
    126         else cp = 0xfc;
    127 
    128         if (params->frequency == 0) bs = 0x03;
    129         else if (params->frequency < 157500000) bs = 0x01;
    130         else if (params->frequency < 443250000) bs = 0x02;
    131         else bs = 0x04;
    132 
    133         pllbuf[0] = 0xC2; /* Note: non-linux standard PLL I2C address */
    134         pllbuf[1] = div >> 8;
    135         pllbuf[2] = div & 0xff;
    136         pllbuf[3] = cp;
    137         pllbuf[4] = bs;
     116        static u8 clock_config []  = { 0x89, 0x38, 0x39 };
     117        static u8 reset []         = { 0x50, 0x80 };
     118        static u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 };
     119        static u8 agc_cfg []       = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF,
     120                                       0x00, 0xFF, 0x00, 0x40, 0x40 };
     121        static u8 dntv_extra[]     = { 0xB5, 0x7A };
     122        static u8 capt_range_cfg[] = { 0x75, 0x32 };
     123 
     124        mt352_write(fe, clock_config,   sizeof(clock_config));
     125        udelay(2000);
     126        mt352_write(fe, reset,          sizeof(reset));
     127        mt352_write(fe, adc_ctl_1_cfg,  sizeof(adc_ctl_1_cfg));
     128
     129        mt352_write(fe, agc_cfg,        sizeof(agc_cfg));
     130        udelay(2000);
     131        mt352_write(fe, dntv_extra,     sizeof(dntv_extra));
     132        mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
    138133
    139134        return 0;
    140135}
    141136
    142 static int thomson_dtt7579_pll_set(struct dvb_frontend* fe,
    143                                    struct dvb_frontend_parameters* params,
    144                                    u8* pllbuf)
    145 {
    146         u32 div;
    147         unsigned char cp = 0;
    148         unsigned char bs = 0;
    149 
    150         div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
    151 
    152         if (params->frequency < 542000000) cp = 0xb4;
    153         else if (params->frequency < 771000000) cp = 0xbc;
    154         else cp = 0xf4;
    155 
    156         if (params->frequency == 0) bs = 0x03;
    157         else if (params->frequency < 443250000) bs = 0x02;
    158         else bs = 0x08;
    159 
    160         pllbuf[0] = 0xc0; // Note: non-linux standard PLL i2c address
    161         pllbuf[1] = div >> 8;
    162         pllbuf[2] = div & 0xff;
    163         pllbuf[3] = cp;
    164         pllbuf[4] = bs;
    165 
     137static int mt352_pll_set(struct dvb_frontend* fe,
     138                         struct dvb_frontend_parameters* params,
     139                         u8* pllbuf)
     140{
     141        struct cx8802_dev *dev= fe->dvb->priv;
     142
     143        pllbuf[0] = dev->core->pll_addr << 1;
     144        dvb_pll_configure(dev->core->pll_desc, pllbuf+1,
     145                          params->frequency,
     146                          params->u.ofdm.bandwidth);
    166147        return 0;
    167148}
    168149
    169 struct mt352_config dvico_fusionhdtv_dvbt1 = {
     150static struct mt352_config dvico_fusionhdtv = {
    170151        .demod_address = 0x0F,
    171152        .demod_init    = dvico_fusionhdtv_demod_init,
    172         .pll_set       = lg_z201_pll_set,
     153        .pll_set       = mt352_pll_set,
    173154};
    174155
    175 struct mt352_config dvico_fusionhdtv_dvbt_plus = {
    176         .demod_address = 0x0F,
    177         .demod_init    = dvico_fusionhdtv_demod_init,
    178         .pll_set       = thomson_dtt7579_pll_set,
     156static struct mt352_config dntv_live_dvbt_config = {
     157        .demod_address = 0x0f,
     158        .demod_init    = dntv_live_dvbt_demod_init,
     159        .pll_set       = mt352_pll_set,
    179160};
    180161
    181162static int dvb_register(struct cx8802_dev *dev)
    static int dvb_register(struct cx8802_de 
    189170        case CX88_BOARD_CONEXANT_DVB_T1:
    190171                dev->dvb.frontend = cx22702_create(&dev->core->i2c_adap,
    191172                                                   dev->core->pll_addr,
    192                                                    dev->core->pll_type,
     173                                                   dev->core->pll_desc,
    193174                                                   dev->core->demod_addr);
    194175                break;
    195176        case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
    196                 dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv_dvbt1,
     177        case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
     178                dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv,
    197179                                                 &dev->core->i2c_adap);
    198                 if (dev->dvb.frontend) {
    199                         dev->dvb.frontend->ops->info.frequency_min = 174000000;
    200                         dev->dvb.frontend->ops->info.frequency_max = 862000000;
    201                 }
    202180                break;
    203         case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
    204                 dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv_dvbt_plus,
     181        case CX88_BOARD_DNTV_LIVE_DVB_T:
     182                dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config,
    205183                                                 &dev->core->i2c_adap);
    206                 if (dev->dvb.frontend) {
    207                         dev->dvb.frontend->ops->info.frequency_min = 174000000;
    208                         dev->dvb.frontend->ops->info.frequency_max = 862000000;
    209                 }
    210184                break;
    211185        default:
    212186                printk("%s: FIXME: frontend handling not here yet ...\n",
    213187                       dev->core->name);
    214188                break;
    215189        }
    216         if (NULL == dev->dvb.frontend)
     190        if (NULL == dev->dvb.frontend) {
     191                printk("%s: frontend initialization failed\n",dev->core->name);
    217192                return -1;
     193        }
     194
     195        if (dev->core->pll_desc) {
     196                dev->dvb.frontend->ops->info.frequency_min = dev->core->pll_desc->min;
     197                dev->dvb.frontend->ops->info.frequency_max = dev->core->pll_desc->max;
     198        }
    218199
    219200        /* Copy the board name into the DVB structure */
    220201        strlcpy(dev->dvb.frontend->ops->info.name,
    static int dvb_register(struct cx8802_de 
    222203                sizeof(dev->dvb.frontend->ops->info.name));
    223204
    224205        /* register everything */
    225         return videobuf_dvb_register(&dev->dvb);
     206        return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev);
    226207}
    227208
    228209/* ----------------------------------------------------------- */
  • new file linux-2004-12-16/drivers/media/video/cx88/cx88-input.c

    - +  
     1/*
     2 * $Id: cx88-input.c,v 1.3 2004/12/10 12:33:39 kraxel Exp $
     3 *
     4 * Device driver for GPIO attached remote control interfaces
     5 * on Conexant 2388x based TV/DVB cards.
     6 *
     7 * Copyright (c) 2003 Pavel Machek
     8 * Copyright (c) 2004 Gerd Knorr
     9 * Copyright (c) 2004 Chris Pascoe
     10 *
     11 * This program is free software; you can redistribute it and/or modify
     12 * it under the terms of the GNU General Public License as published by
     13 * the Free Software Foundation; either version 2 of the License, or
     14 * (at your option) any later version.
     15 *
     16 * This program is distributed in the hope that it will be useful,
     17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     19 * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
     24 */
     25
     26#include <linux/init.h>
     27#include <linux/delay.h>
     28#include <linux/input.h>
     29#include <linux/pci.h>
     30#include <linux/module.h>
     31#include <linux/moduleparam.h>
     32
     33#include <media/ir-common.h>
     34
     35#include "cx88.h"
     36
     37/* ---------------------------------------------------------------------- */
     38
     39/* DigitalNow DNTV Live DVB-T Remote */
     40static IR_KEYTAB_TYPE ir_codes_dntv_live_dvb_t[IR_KEYTAB_SIZE] = {
     41        [ 0x00 ] = KEY_ESC,         // 'go up a level?'
     42        [ 0x01 ] = KEY_KP1,         // '1'
     43        [ 0x02 ] = KEY_KP2,         // '2'
     44        [ 0x03 ] = KEY_KP3,         // '3'
     45        [ 0x04 ] = KEY_KP4,         // '4'
     46        [ 0x05 ] = KEY_KP5,         // '5'
     47        [ 0x06 ] = KEY_KP6,         // '6'
     48        [ 0x07 ] = KEY_KP7,         // '7'
     49        [ 0x08 ] = KEY_KP8,         // '8'
     50        [ 0x09 ] = KEY_KP9,         // '9'
     51        [ 0x0a ] = KEY_KP0,         // '0'
     52        [ 0x0b ] = KEY_TUNER,       // 'tv/fm'
     53        [ 0x0c ] = KEY_SEARCH,      // 'scan'
     54        [ 0x0d ] = KEY_STOP,        // 'stop'
     55        [ 0x0e ] = KEY_PAUSE,       // 'pause'
     56        [ 0x0f ] = KEY_LIST,        // 'source'
     57
     58        [ 0x10 ] = KEY_MUTE,        // 'mute'
     59        [ 0x11 ] = KEY_REWIND,      // 'backward <<'
     60        [ 0x12 ] = KEY_POWER,       // 'power'
     61        [ 0x13 ] = KEY_S,           // 'snap'
     62        [ 0x14 ] = KEY_AUDIO,       // 'stereo'
     63        [ 0x15 ] = KEY_CLEAR,       // 'reset'
     64        [ 0x16 ] = KEY_PLAY,        // 'play'
     65        [ 0x17 ] = KEY_ENTER,       // 'enter'
     66        [ 0x18 ] = KEY_ZOOM,        // 'full screen'
     67        [ 0x19 ] = KEY_FASTFORWARD, // 'forward >>'
     68        [ 0x1a ] = KEY_CHANNELUP,   // 'channel +'
     69        [ 0x1b ] = KEY_VOLUMEUP,    // 'volume +'
     70        [ 0x1c ] = KEY_INFO,        // 'preview'
     71        [ 0x1d ] = KEY_RECORD,      // 'record'
     72        [ 0x1e ] = KEY_CHANNELDOWN, // 'channel -'
     73        [ 0x1f ] = KEY_VOLUMEDOWN,  // 'volume -'
     74};
     75
     76/* ---------------------------------------------------------------------- */
     77
     78struct cx88_IR {
     79        struct cx88_core        *core;
     80        struct input_dev        input;
     81        struct ir_input_state   ir;
     82        char                    name[32];
     83        char                    phys[32];
     84
     85        /* sample from gpio pin 16 */
     86        int                     sampling;
     87        u32                     samples[16];
     88        int                     scount;
     89        unsigned long           release;
     90
     91        /* poll external decoder */
     92        int                     polling;
     93        struct work_struct      work;
     94        struct timer_list       timer;
     95        u32                     gpio_addr;
     96        u32                     last_gpio;
     97        u32                     mask_keycode;
     98        u32                     mask_keydown;
     99        u32                     mask_keyup;
     100};
     101
     102static int ir_debug = 0;
     103module_param(ir_debug, int, 0644);    /* debug level [IR] */
     104MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
     105
     106#define ir_dprintk(fmt, arg...) if (ir_debug) \
     107        printk(KERN_DEBUG "%s IR: " fmt , ir->core->name, ## arg)
     108
     109/* ---------------------------------------------------------------------- */
     110
     111static void cx88_ir_handle_key(struct cx88_IR *ir)
     112{
     113        struct cx88_core *core = ir->core;
     114        u32 gpio, data;
     115
     116        /* read gpio value */
     117        gpio = cx_read(ir->gpio_addr);
     118        if (ir->polling) {
     119                if (ir->last_gpio == gpio)
     120                        return;
     121                ir->last_gpio = gpio;
     122        }
     123
     124        /* extract data */
     125        data = ir_extract_bits(gpio, ir->mask_keycode);
     126        ir_dprintk("irq gpio=0x%x code=%d | %s%s%s\n",
     127                gpio, data,
     128                ir->polling               ? "poll"  : "irq",
     129                (gpio & ir->mask_keydown) ? " down" : "",
     130                (gpio & ir->mask_keyup)   ? " up"   : "");
     131
     132        if (ir->mask_keydown) {
     133                /* bit set on keydown */
     134                if (gpio & ir->mask_keydown) {
     135                        ir_input_keydown(&ir->input,&ir->ir,data,data);
     136                } else {
     137                        ir_input_nokey(&ir->input,&ir->ir);
     138                }
     139
     140        } else if (ir->mask_keyup) {
     141                /* bit cleared on keydown */
     142                if (0 == (gpio & ir->mask_keyup)) {
     143                        ir_input_keydown(&ir->input,&ir->ir,data,data);
     144                } else {
     145                        ir_input_nokey(&ir->input,&ir->ir);
     146                }
     147
     148        } else {
     149                /* can't disturgissh keydown/up :-/ */
     150                ir_input_keydown(&ir->input,&ir->ir,data,data);
     151                ir_input_nokey(&ir->input,&ir->ir);
     152        }
     153}
     154
     155static void ir_timer(unsigned long data)
     156{
     157        struct cx88_IR *ir = (struct cx88_IR*)data;
     158
     159        schedule_work(&ir->work);
     160}
     161
     162static void cx88_ir_work(void *data)
     163{
     164        struct cx88_IR *ir = data;
     165        unsigned long timeout;
     166
     167        cx88_ir_handle_key(ir);
     168        timeout = jiffies + (ir->polling * HZ / 1000);
     169        mod_timer(&ir->timer, timeout);
     170}
     171
     172/* ---------------------------------------------------------------------- */
     173
     174int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
     175{
     176        struct cx88_IR *ir;
     177        IR_KEYTAB_TYPE *ir_codes = NULL;
     178        int ir_type = IR_TYPE_OTHER;
     179
     180        ir = kmalloc(sizeof(*ir),GFP_KERNEL);
     181        if (NULL == ir)
     182                return -ENOMEM;
     183        memset(ir,0,sizeof(*ir));
     184
     185        /* detect & configure */
     186        switch (core->board) {
     187        case CX88_BOARD_DNTV_LIVE_DVB_T:
     188                ir_codes         = ir_codes_dntv_live_dvb_t;
     189                ir->gpio_addr    = MO_GP1_IO;
     190                ir->mask_keycode = 0x1f;
     191                ir->mask_keyup   = 0x60;
     192                ir->polling      = 50; // ms
     193                break;
     194        case CX88_BOARD_HAUPPAUGE:
     195        case CX88_BOARD_HAUPPAUGE_DVB_T1:
     196                ir_codes         = ir_codes_rc5_tv;
     197                ir_type          = IR_TYPE_RC5;
     198                ir->sampling     = 1;
     199                break;
     200        }
     201        if (NULL == ir_codes) {
     202                kfree(ir);
     203                return -ENODEV;
     204        }
     205
     206        /* init input device */
     207        snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)",
     208                 cx88_boards[core->board].name);
     209        snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0",
     210                 pci_name(pci));
     211
     212        ir_input_init(&ir->input, &ir->ir, ir_type, ir_codes);
     213        ir->input.name = ir->name;
     214        ir->input.phys = ir->phys;
     215        ir->input.id.bustype = BUS_PCI;
     216        ir->input.id.version = 1;
     217        if (pci->subsystem_vendor) {
     218                ir->input.id.vendor  = pci->subsystem_vendor;
     219                ir->input.id.product = pci->subsystem_device;
     220        } else {
     221                ir->input.id.vendor  = pci->vendor;
     222                ir->input.id.product = pci->device;
     223        }
     224
     225        /* record handles to ourself */
     226        ir->core = core;
     227        core->ir = ir;
     228
     229        if (ir->polling) {
     230                INIT_WORK(&ir->work, cx88_ir_work, ir);
     231                init_timer(&ir->timer);
     232                ir->timer.function = ir_timer;
     233                ir->timer.data     = (unsigned long)ir;
     234                schedule_work(&ir->work);
     235        }
     236        if (ir->sampling) {
     237                core->pci_irqmask |= (1<<18);   // IR_SMP_INT
     238                cx_write(MO_DDS_IO, 0xa80a80);  // 4 kHz sample rate
     239                cx_write(MO_DDSCFG_IO,   0x5);  // enable
     240        }
     241
     242        /* all done */
     243        input_register_device(&ir->input);
     244        printk("%s: registered IR remote control\n", core->name);
     245
     246        return 0;
     247}
     248
     249int cx88_ir_fini(struct cx88_core *core)
     250{
     251        struct cx88_IR *ir = core->ir;
     252
     253        /* skip detach on non attached boards */
     254        if (NULL == ir)
     255                return 0;
     256
     257        if (ir->polling) {
     258                del_timer(&ir->timer);
     259                flush_scheduled_work();
     260        }
     261
     262        input_unregister_device(&ir->input);
     263        kfree(ir);
     264
     265        /* done */
     266        core->ir = NULL;
     267        return 0;
     268}
     269
     270/* ---------------------------------------------------------------------- */
     271
     272static int inline getbit(u32 *samples, int bit)
     273{
     274        return (samples[bit/32] & (1 << (31-(bit%32)))) ? 1 : 0;
     275}
     276
     277static int dump_samples(u32 *samples, int count)
     278{
     279        int i, bit, start;
     280
     281        printk(KERN_DEBUG "ir samples @ 4kHz: ");
     282        start = 0;
     283        for (i = 0; i < count * 32; i++) {
     284                bit = getbit(samples,i);
     285                if (bit)
     286                        start = 1;
     287                if (0 == start)
     288                        continue;
     289                printk("%s", bit ? "#" : "_");
     290        }
     291        printk("\n");
     292}
     293
     294static int ir_decode_biphase(u32 *samples, int count, int low, int high)
     295{
     296        int i,last,bit,len,flips;
     297        u32 value;
     298
     299        /* find start bit (1) */
     300        for (i = 0; i < 32; i++) {
     301                bit = getbit(samples,i);
     302                if (bit)
     303                        break;
     304        }
     305
     306        /* go decoding */
     307        len   = 0;
     308        flips = 0;
     309        value = 1;
     310        for (; i < count * 32; i++) {
     311                if (len > high)
     312                        break;
     313                if (flips > 1)
     314                        break;
     315                last = bit;
     316                bit  = getbit(samples,i);
     317                if (last == bit) {
     318                        len++;
     319                        continue;
     320                }
     321                if (len < low) {
     322                        len++;
     323                        flips++;
     324                        continue;
     325                }
     326                value <<= 1;
     327                value |= bit;
     328                flips = 0;
     329                len   = 1;
     330        }
     331        return value;
     332}
     333
     334void cx88_ir_irq(struct cx88_core *core)
     335{
     336        struct cx88_IR *ir = core->ir;
     337        u32 samples,rc5;
     338        int i;
     339
     340        if (NULL == ir)
     341                return;
     342        if (!ir->sampling)
     343                return;
     344
     345        samples = cx_read(MO_SAMPLE_IO);
     346        if (0 != samples  &&  0xffffffff != samples) {
     347                /* record sample data */
     348                if (ir->scount < ARRAY_SIZE(ir->samples))
     349                        ir->samples[ir->scount++] = samples;
     350                return;
     351        }
     352        if (!ir->scount) {
     353                /* nothing to sample */
     354                if (ir->ir.keypressed && time_after(jiffies,ir->release))
     355                        ir_input_nokey(&ir->input,&ir->ir);
     356                return;
     357        }
     358
     359        /* have a complete sample */
     360        if (ir->scount < ARRAY_SIZE(ir->samples))
     361                ir->samples[ir->scount++] = samples;
     362        for (i = 0; i < ir->scount; i++)
     363                ir->samples[i] = ~ir->samples[i];
     364        if (ir_debug)
     365                dump_samples(ir->samples,ir->scount);
     366
     367        /* decode it */
     368        switch (core->board) {
     369        case CX88_BOARD_HAUPPAUGE:
     370        case CX88_BOARD_HAUPPAUGE_DVB_T1:
     371                rc5 = ir_decode_biphase(ir->samples,ir->scount,5,7);
     372                ir_dprintk("biphase decoded: %x\n",rc5);
     373                if ((rc5 & 0xfffff000) != 0x3000)
     374                        break;
     375                ir_input_keydown(&ir->input, &ir->ir, rc5 & 0x3f, rc5);
     376                ir->release = jiffies + msecs_to_jiffies(120);
     377                break;
     378        }
     379
     380        ir->scount = 0;
     381        return;
     382}
     383
     384/* ---------------------------------------------------------------------- */
     385
     386MODULE_AUTHOR("Gerd Knorr, Pavel Machek, Chris Pascoe");
     387MODULE_DESCRIPTION("input driver for cx88 GPIO-based IR remote controls");
     388MODULE_LICENSE("GPL");
     389
     390/*
     391 * Local variables:
     392 * c-basic-offset: 8
     393 * End:
     394 */
  • drivers/media/video/cx88/cx88-vbi.c

    old new  
    11/*
    2  * $Id: cx88-vbi.c,v 1.14 2004/11/07 13:17:15 kraxel Exp $
     2 * $Id: cx88-vbi.c,v 1.16 2004/12/10 12:33:39 kraxel Exp $
    33 */
    44#include <linux/kernel.h>
    55#include <linux/module.h>
     6#include <linux/moduleparam.h>
    67#include <linux/init.h>
    78#include <linux/slab.h>
    89
    int cx8800_start_vbi_dma(struct cx8800_d 
    6465        q->count = 1;
    6566
    6667        /* enable irqs */
    67         cx_set(MO_PCI_INTMSK, 0x00fc01);
     68        cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x01);
    6869        cx_set(MO_VID_INTMSK, 0x0f0088);
    6970
    7071        /* enable capture */
  • drivers/media/video/cx88/cx88.h

    old new  
    11/*
    2  * $Id: cx88.h,v 1.40 2004/11/03 09:04:51 kraxel Exp $
     2 * $Id: cx88.h,v 1.47 2004/12/14 15:33:30 kraxel Exp $
    33 *
    44 * v4l2 device driver for cx2388x based TV cards
    55 *
     
    2727#include <linux/kdev_t.h>
    2828
    2929#include <media/tuner.h>
     30#include <media/tveeprom.h>
    3031#include <media/audiochip.h>
    3132#include <media/video-buf.h>
    3233#include <media/video-buf-dvb.h>
    extern struct sram_channel cx88_sram_cha 
    156157#define CX88_BOARD_CONEXANT_DVB_T1         19
    157158#define CX88_BOARD_PROVIDEO_PV259          20
    158159#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS 21
     160#define CX88_BOARD_PCHDTV_HD3000           22
     161#define CX88_BOARD_DNTV_LIVE_DVB_T         23
    159162
    160163enum cx88_itype {
    161164        CX88_VMUX_COMPOSITE1 = 1,
    struct cx88_core { 
    238241        u32                        __iomem *lmmio;
    239242        u8                         __iomem *bmmio;
    240243        u32                        shadow[SHADOW_MAX];
     244        int                        pci_irqmask;
    241245
    242246        /* i2c i/o */
    243247        struct i2c_adapter         i2c_adap;
    struct cx88_core { 
    252256        unsigned int               has_radio;
    253257
    254258        /* config info -- dvb */
    255         unsigned int               pll_type;
     259        struct dvb_pll_desc        *pll_desc;
    256260        unsigned int               pll_addr;
    257261        unsigned int               demod_addr;
    258262
    struct cx88_core { 
    262266        u32                        tvaudio;
    263267        u32                        input;
    264268        u32                        astat;
     269
     270        /* IR remote control state */
     271        struct cx88_IR             *ir;
    265272};
    266273
    267274struct cx8800_dev;
    struct cx8802_dev { 
    371378        struct list_head           devlist;
    372379        struct video_device        *mpeg_dev;
    373380        u32                        mailbox;
     381        int                        width;
     382        int                        height;
    374383
    375384        /* for dvb only */
    376385        struct videobuf_dvb        dvb;
    extern void cx88_print_irqbits(char *nam 
    411420                               u32 bits, u32 mask);
    412421extern void cx88_print_ioctl(char *name, unsigned int cmd);
    413422
    414 extern void cx88_irq(struct cx88_core *core, u32 status, u32 mask);
     423extern int cx88_core_irq(struct cx88_core *core, u32 status);
    415424extern void cx88_wakeup(struct cx88_core *core,
    416425                        struct cx88_dmaqueue *q, u32 count);
    417426extern void cx88_shutdown(struct cx88_core *core);
    void cx88_set_stereo(struct cx88_core *c 
    508517int cx88_audio_thread(void *data);
    509518
    510519/* ----------------------------------------------------------- */
     520/* cx88-input.c                                                */
     521
     522int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci);
     523int cx88_ir_fini(struct cx88_core *core);
     524void cx88_ir_irq(struct cx88_core *core);
     525
     526/* ----------------------------------------------------------- */
    511527/* cx88-mpeg.c                                                 */
    512528
    513529int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf);
  • drivers/media/video/cx88/Makefile

    old new  
    1 cx88xx-objs     := cx88-cards.o cx88-core.o cx88-i2c.o cx88-tvaudio.o
     1cx88xx-objs     := cx88-cards.o cx88-core.o cx88-i2c.o cx88-tvaudio.o \
     2                   cx88-input.o
    23cx8800-objs     := cx88-video.o cx88-vbi.o
    34cx8802-objs     := cx88-mpeg.o
    45
  • drivers/media/video/cx88/cx88-i2c.c

    old new  
    11/*
    2     $Id: cx88-i2c.c,v 1.18 2004/10/13 10:39:00 kraxel Exp $
     2    $Id: cx88-i2c.c,v 1.19 2004/12/10 12:33:39 kraxel Exp $
    33
    44    cx88-i2c.c  --  all the i2c code is here
    55
     
    2525*/
    2626
    2727#include <linux/module.h>
     28#include <linux/moduleparam.h>
    2829#include <linux/init.h>
    2930
    3031#include <asm/io.h>
Note: See TracBrowser for help on using the repository browser.