diff options
author | Gerd Knorr <devnull@localhost> | 2005-02-16 13:11:55 +0000 |
---|---|---|
committer | Gerd Knorr <devnull@localhost> | 2005-02-16 13:11:55 +0000 |
commit | 95840cd6d7c62cbfcfeb413c75c0b7364ae03667 (patch) | |
tree | dca02285a9cad9bb00212c0536885d98897efc4d | |
parent | e9ba68260349b4194b73b4f9871c7d285bd6a273 (diff) | |
download | mediapointer-dvb-s2-95840cd6d7c62cbfcfeb413c75c0b7364ae03667.tar.gz mediapointer-dvb-s2-95840cd6d7c62cbfcfeb413c75c0b7364ae03667.tar.bz2 |
- move some bits from cx88-input to ir-common.
- blackbird fixes, add new blackbird card.
-rw-r--r-- | linux/drivers/media/common/ir-common.c | 125 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-blackbird.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-cards.c | 31 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-input.c | 106 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88.h | 3 | ||||
-rw-r--r-- | linux/include/media/ir-common.h | 5 |
6 files changed, 156 insertions, 118 deletions
diff --git a/linux/drivers/media/common/ir-common.c b/linux/drivers/media/common/ir-common.c index a640cf2a9..e99775e84 100644 --- a/linux/drivers/media/common/ir-common.c +++ b/linux/drivers/media/common/ir-common.c @@ -1,5 +1,5 @@ /* - * $Id: ir-common.c,v 1.6 2004/12/10 12:33:39 kraxel Exp $ + * $Id: ir-common.c,v 1.7 2005/02/16 13:11:55 kraxel Exp $ * * some common structs and functions to handle infrared remotes via * input layer ... @@ -24,12 +24,7 @@ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/version.h> - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -#include "ir-common.h" -#else #include <media/ir-common.h> -#endif /* -------------------------------------------------------------------------- */ @@ -50,6 +45,7 @@ module_param(debug, int, 0644); /* generic RC5 keytable */ /* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */ +/* used by old (black) Hauppauge remotes */ IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE] = { [ 0x00 ] = KEY_KP0, // 0 [ 0x01 ] = KEY_KP1, // 1 @@ -128,6 +124,49 @@ IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE] = { }; EXPORT_SYMBOL_GPL(ir_codes_empty); +/* Hauppauge: the newer, gray remotes (seems there are multiple + * slightly different versions), shipped with cx88+ivtv cards. + * almost rc5 coding, but some non-standard keys */ +IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = { + [ 0x00 ] = KEY_KP0, // 0 + [ 0x01 ] = KEY_KP1, // 1 + [ 0x02 ] = KEY_KP2, // 2 + [ 0x03 ] = KEY_KP3, // 3 + [ 0x04 ] = KEY_KP4, // 4 + [ 0x05 ] = KEY_KP5, // 5 + [ 0x06 ] = KEY_KP6, // 6 + [ 0x07 ] = KEY_KP7, // 7 + [ 0x08 ] = KEY_KP8, // 8 + [ 0x09 ] = KEY_KP9, // 9 + [ 0x0b ] = KEY_RED, // red button + [ 0x0c ] = KEY_OPTION, // black key without text + [ 0x0d ] = KEY_MENU, // menu + [ 0x0f ] = KEY_MUTE, // mute + [ 0x10 ] = KEY_VOLUMEUP, // volume + + [ 0x11 ] = KEY_VOLUMEDOWN, // volume - + [ 0x1e ] = KEY_NEXT, // skip >| + [ 0x1f ] = KEY_EXIT, // back/exit + [ 0x20 ] = KEY_CHANNELUP, // channel / program + + [ 0x21 ] = KEY_CHANNELDOWN, // channel / program - + [ 0x22 ] = KEY_CHANNEL, // source (old black remote) + [ 0x24 ] = KEY_PREVIOUS, // replay |< + [ 0x25 ] = KEY_ENTER, // OK + [ 0x26 ] = KEY_SLEEP, // minimize (old black remote) + [ 0x29 ] = KEY_BLUE, // blue key + [ 0x2e ] = KEY_GREEN, // green button + [ 0x30 ] = KEY_PAUSE, // pause + [ 0x32 ] = KEY_REWIND, // backward << + [ 0x34 ] = KEY_FASTFORWARD, // forward >> + [ 0x35 ] = KEY_PLAY, // play + [ 0x36 ] = KEY_STOP, // stop + [ 0x37 ] = KEY_RECORD, // recording + [ 0x38 ] = KEY_YELLOW, // yellow key + [ 0x3b ] = KEY_SELECT, // top right button + [ 0x3c ] = KEY_ZOOM, // full + [ 0x3d ] = KEY_POWER, // system power (green button) +}; +EXPORT_SYMBOL(ir_codes_hauppauge_new); + /* -------------------------------------------------------------------------- */ static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) @@ -140,9 +179,7 @@ static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) dprintk(1,"%s: key event code=%d down=%d\n", dev->name,ir->keycode,ir->keypressed); input_report_key(dev,ir->keycode,ir->keypressed); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) input_sync(dev); -#endif } /* -------------------------------------------------------------------------- */ @@ -156,9 +193,7 @@ void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, if (ir_codes) memcpy(ir->ir_codes, ir_codes, sizeof(ir->ir_codes)); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) init_input_dev(dev); -#endif dev->keycode = ir->ir_codes; dev->keycodesize = sizeof(IR_KEYTAB_TYPE); dev->keycodemax = IR_KEYTAB_SIZE; @@ -201,6 +236,8 @@ void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, #endif } +/* -------------------------------------------------------------------------- */ + u32 ir_extract_bits(u32 data, u32 mask) { int mbit, vbit; @@ -218,10 +255,78 @@ u32 ir_extract_bits(u32 data, u32 mask) return value; } +static int inline getbit(u32 *samples, int bit) +{ + return (samples[bit/32] & (1 << (31-(bit%32)))) ? 1 : 0; +} + +/* sump raw samples for visual debugging ;) */ +int ir_dump_samples(u32 *samples, int count) +{ + int i, bit, start; + + printk(KERN_DEBUG "ir samples: "); + start = 0; + for (i = 0; i < count * 32; i++) { + bit = getbit(samples,i); + if (bit) + start = 1; + if (0 == start) + continue; + printk("%s", bit ? "#" : "_"); + } + printk("\n"); + return 0; +} + +/* decode raw samples, biphase coding, used by rc5 for example */ +int ir_decode_biphase(u32 *samples, int count, int low, int high) +{ + int i,last,bit,len,flips; + u32 value; + + /* find start bit (1) */ + for (i = 0; i < 32; i++) { + bit = getbit(samples,i); + if (bit) + break; + } + + /* go decoding */ + len = 0; + flips = 0; + value = 1; + for (; i < count * 32; i++) { + if (len > high) + break; + if (flips > 1) + break; + last = bit; + bit = getbit(samples,i); + if (last == bit) { + len++; + continue; + } + if (len < low) { + len++; + flips++; + continue; + } + value <<= 1; + value |= bit; + flips = 0; + len = 1; + } + return value; +} + EXPORT_SYMBOL_GPL(ir_input_init); EXPORT_SYMBOL_GPL(ir_input_nokey); EXPORT_SYMBOL_GPL(ir_input_keydown); + EXPORT_SYMBOL_GPL(ir_extract_bits); +EXPORT_SYMBOL_GPL(ir_dump_samples); +EXPORT_SYMBOL_GPL(ir_decode_biphase); /* * Local variables: diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c index e66467e7d..b981cd54a 100644 --- a/linux/drivers/media/video/cx88/cx88-blackbird.c +++ b/linux/drivers/media/video/cx88/cx88-blackbird.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-blackbird.c,v 1.24 2005/01/31 11:35:05 kraxel Exp $ + * $Id: cx88-blackbird.c,v 1.25 2005/02/16 13:11:55 kraxel Exp $ * * Support for a cx23416 mpeg encoder via cx2388x host port. * "blackbird" reference design. @@ -857,6 +857,8 @@ static void __devexit blackbird_remove(struct pci_dev *pci_dev) /* common */ cx8802_fini_common(dev); + cx88_core_put(dev->core,dev->pci); + kfree(dev); } static struct pci_device_id cx8802_pci_tbl[] = { diff --git a/linux/drivers/media/video/cx88/cx88-cards.c b/linux/drivers/media/video/cx88/cx88-cards.c index a74ef661d..d9c19d51a 100644 --- a/linux/drivers/media/video/cx88/cx88-cards.c +++ b/linux/drivers/media/video/cx88/cx88-cards.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-cards.c,v 1.63 2005/02/15 15:59:34 kraxel Exp $ + * $Id: cx88-cards.c,v 1.64 2005/02/16 13:11:55 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * card-specific stuff. @@ -558,6 +558,31 @@ struct cx88_board cx88_boards[] = { }, .blackbird = 1, }, + [CX88_BOARD_DIGITALLOGIC_MEC] = { + /* params copied over from Leadtek PVR 2000 */ + .name = "Digital-Logic MICROSPACE Entertainment Center (MEC)", + /* not sure yet about the tuner type */ + .tuner_type = 38, + .tda9887_conf = TDA9887_PRESENT, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x0000bde6, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x0000bde6, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x0000bde6, + }}, + .radio = { + .type = CX88_RADIO, + .gpio0 = 0x0000bd62, + }, + .blackbird = 1, + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); @@ -665,6 +690,10 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x0070, .subdevice = 0x2801, .card = CX88_BOARD_HAUPPAUGE_ROSLYN, + },{ + .subvendor = 0x14F1, + .subdevice = 0x0342, + .card = CX88_BOARD_DIGITALLOGIC_MEC, } }; const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); diff --git a/linux/drivers/media/video/cx88/cx88-input.c b/linux/drivers/media/video/cx88/cx88-input.c index d6266e51a..9029c818e 100644 --- a/linux/drivers/media/video/cx88/cx88-input.c +++ b/linux/drivers/media/video/cx88/cx88-input.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-input.c,v 1.6 2005/02/09 19:27:21 kraxel Exp $ + * $Id: cx88-input.c,v 1.7 2005/02/16 13:11:55 kraxel Exp $ * * Device driver for GPIO attached remote control interfaces * on Conexant 2388x based TV/DVB cards. @@ -73,46 +73,6 @@ static IR_KEYTAB_TYPE ir_codes_dntv_live_dvb_t[IR_KEYTAB_SIZE] = { [ 0x1f ] = KEY_VOLUMEDOWN, // 'volume -' }; -/* Happauge: the newer, gray remote */ -static IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = { - [ 0x00 ] = KEY_KP0, // 0 - [ 0x01 ] = KEY_KP1, // 1 - [ 0x02 ] = KEY_KP2, // 2 - [ 0x03 ] = KEY_KP3, // 3 - [ 0x04 ] = KEY_KP4, // 4 - [ 0x05 ] = KEY_KP5, // 5 - [ 0x06 ] = KEY_KP6, // 6 - [ 0x07 ] = KEY_KP7, // 7 - [ 0x08 ] = KEY_KP8, // 8 - [ 0x09 ] = KEY_KP9, // 9 - [ 0x0b ] = KEY_RED, // red button - [ 0x0c ] = KEY_OPTION, // black key without text - [ 0x0d ] = KEY_MENU, // menu - [ 0x0f ] = KEY_MUTE, // mute - [ 0x10 ] = KEY_VOLUMEUP, // volume + - [ 0x11 ] = KEY_VOLUMEDOWN, // volume - - [ 0x1e ] = KEY_NEXT, // skip >| - [ 0x1f ] = KEY_EXIT, // back/exit - [ 0x20 ] = KEY_CHANNELUP, // channel / program + - [ 0x21 ] = KEY_CHANNELDOWN, // channel / program - - [ 0x22 ] = KEY_CHANNEL, // source (old black remote) - [ 0x24 ] = KEY_PREVIOUS, // replay |< - [ 0x25 ] = KEY_ENTER, // OK - [ 0x26 ] = KEY_SLEEP, // minimize (old black remote) - [ 0x29 ] = KEY_BLUE, // blue key - [ 0x2e ] = KEY_GREEN, // green button - [ 0x30 ] = KEY_PAUSE, // pause - [ 0x32 ] = KEY_REWIND, // backward << - [ 0x34 ] = KEY_FASTFORWARD, // forward >> - [ 0x35 ] = KEY_PLAY, // play - [ 0x36 ] = KEY_STOP, // stop - [ 0x37 ] = KEY_RECORD, // recording - [ 0x38 ] = KEY_YELLOW, // yellow key - [ 0x3b ] = KEY_SELECT, // top right button - [ 0x3c ] = KEY_ZOOM, // full - [ 0x3d ] = KEY_POWER, // system power (green button) -}; - /* ---------------------------------------------------------------------- */ struct cx88_IR { @@ -309,68 +269,6 @@ int cx88_ir_fini(struct cx88_core *core) /* ---------------------------------------------------------------------- */ -static int inline getbit(u32 *samples, int bit) -{ - return (samples[bit/32] & (1 << (31-(bit%32)))) ? 1 : 0; -} - -static int dump_samples(u32 *samples, int count) -{ - int i, bit, start; - - printk(KERN_DEBUG "ir samples @ 4kHz: "); - start = 0; - for (i = 0; i < count * 32; i++) { - bit = getbit(samples,i); - if (bit) - start = 1; - if (0 == start) - continue; - printk("%s", bit ? "#" : "_"); - } - printk("\n"); -} - -static int ir_decode_biphase(u32 *samples, int count, int low, int high) -{ - int i,last,bit,len,flips; - u32 value; - - /* find start bit (1) */ - for (i = 0; i < 32; i++) { - bit = getbit(samples,i); - if (bit) - break; - } - - /* go decoding */ - len = 0; - flips = 0; - value = 1; - for (; i < count * 32; i++) { - if (len > high) - break; - if (flips > 1) - break; - last = bit; - bit = getbit(samples,i); - if (last == bit) { - len++; - continue; - } - if (len < low) { - len++; - flips++; - continue; - } - value <<= 1; - value |= bit; - flips = 0; - len = 1; - } - return value; -} - void cx88_ir_irq(struct cx88_core *core) { struct cx88_IR *ir = core->ir; @@ -402,7 +300,7 @@ void cx88_ir_irq(struct cx88_core *core) for (i = 0; i < ir->scount; i++) ir->samples[i] = ~ir->samples[i]; if (ir_debug) - dump_samples(ir->samples,ir->scount); + ir_dump_samples(ir->samples,ir->scount); /* decode it */ switch (core->board) { diff --git a/linux/drivers/media/video/cx88/cx88.h b/linux/drivers/media/video/cx88/cx88.h index 0e0cdc380..de7547b17 100644 --- a/linux/drivers/media/video/cx88/cx88.h +++ b/linux/drivers/media/video/cx88/cx88.h @@ -1,5 +1,5 @@ /* - * $Id: cx88.h,v 1.52 2005/02/14 16:30:26 kraxel Exp $ + * $Id: cx88.h,v 1.53 2005/02/16 13:11:55 kraxel Exp $ * * v4l2 device driver for cx2388x based TV cards * @@ -161,6 +161,7 @@ extern struct sram_channel cx88_sram_channels[]; #define CX88_BOARD_PCHDTV_HD3000 22 #define CX88_BOARD_DNTV_LIVE_DVB_T 23 #define CX88_BOARD_HAUPPAUGE_ROSLYN 24 +#define CX88_BOARD_DIGITALLOGIC_MEC 25 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, diff --git a/linux/include/media/ir-common.h b/linux/include/media/ir-common.h index f9deb322c..577c37818 100644 --- a/linux/include/media/ir-common.h +++ b/linux/include/media/ir-common.h @@ -1,5 +1,5 @@ /* - * $Id: ir-common.h,v 1.6 2004/09/15 16:15:24 kraxel Exp $ + * $Id: ir-common.h,v 1.7 2005/02/16 13:11:55 kraxel Exp $ * * some common structs and functions to handle infrared remotes via * input layer ... @@ -77,6 +77,7 @@ struct ir_input_state { extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE]; +extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE]; void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, int ir_type, IR_KEYTAB_TYPE *ir_codes); @@ -84,6 +85,8 @@ void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, u32 ir_key, u32 ir_raw); u32 ir_extract_bits(u32 data, u32 mask); +int ir_dump_samples(u32 *samples, int count); +int ir_decode_biphase(u32 *samples, int count, int low, int high); /* * Local variables: |