From 680543c5d2756ad3496f8ef197ba8825b78d6840 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Mon, 22 May 2006 07:44:02 -0300 Subject: [PATCH] V4L/DVB (4038): New cx88 card #50: NPG Tech RealTV Added support for a new cx88 card, including it's remote Signed-off-by: Ricardo Cerqueira Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/CARDLIST.cx88 | 1 + drivers/media/common/ir-keymaps.c | 44 +++++++++++++++++++++++++ drivers/media/video/cx88/cx88-cards.c | 27 +++++++++++++++ drivers/media/video/cx88/cx88-input.c | 31 +++++++++++++++-- drivers/media/video/cx88/cx88.h | 1 + include/media/ir-common.h | 1 + 6 files changed, 102 insertions(+), 3 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 249885c6c66..f6b0936c2fd 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 @@ -48,3 +48,4 @@ 47 -> pcHDTV HD5500 HDTV [7063:5500] 48 -> Kworld MCE 200 Deluxe [17de:0841] 49 -> PixelView PlayTV P7000 [1554:4813] + 50 -> NPG Tech Real TV [14f1:0842] diff --git a/drivers/media/common/ir-keymaps.c b/drivers/media/common/ir-keymaps.c index 8f4a067afdb..b655d8787ca 100644 --- a/drivers/media/common/ir-keymaps.c +++ b/drivers/media/common/ir-keymaps.c @@ -1412,3 +1412,47 @@ IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = { }; EXPORT_SYMBOL_GPL(ir_codes_hauppauge_new); + +IR_KEYTAB_TYPE ir_codes_npgtech[IR_KEYTAB_SIZE] = { + [ 0x1d ] = KEY_SWITCHVIDEOMODE, /* switch inputs */ + [ 0x2a ] = KEY_FRONT, + + [ 0x3e ] = KEY_1, + [ 0x02 ] = KEY_2, + [ 0x06 ] = KEY_3, + [ 0x0a ] = KEY_4, + [ 0x0e ] = KEY_5, + [ 0x12 ] = KEY_6, + [ 0x16 ] = KEY_7, + [ 0x1a ] = KEY_8, + [ 0x1e ] = KEY_9, + [ 0x3a ] = KEY_0, + [ 0x22 ] = KEY_NUMLOCK, /* -/-- */ + [ 0x20 ] = KEY_REFRESH, + + [ 0x03 ] = KEY_BRIGHTNESSDOWN, + [ 0x28 ] = KEY_AUDIO, + [ 0x3c ] = KEY_UP, + [ 0x3f ] = KEY_LEFT, + [ 0x2e ] = KEY_MUTE, + [ 0x3b ] = KEY_RIGHT, + [ 0x00 ] = KEY_DOWN, + [ 0x07 ] = KEY_BRIGHTNESSUP, + [ 0x2c ] = KEY_TEXT, + + [ 0x37 ] = KEY_RECORD, + [ 0x17 ] = KEY_PLAY, + [ 0x13 ] = KEY_PAUSE, + [ 0x26 ] = KEY_STOP, + [ 0x18 ] = KEY_FASTFORWARD, + [ 0x14 ] = KEY_REWIND, + [ 0x33 ] = KEY_ZOOM, + [ 0x32 ] = KEY_KEYBOARD, + [ 0x30 ] = KEY_GOTO, /* Pointing arrow */ + [ 0x36 ] = KEY_MACRO, /* Maximize/Minimize (yellow) */ + [ 0x0b ] = KEY_RADIO, + [ 0x10 ] = KEY_POWER, + +}; + +EXPORT_SYMBOL_GPL(ir_codes_npgtech); diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 16cd6434f2b..04ef1ccfb67 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -1148,6 +1148,29 @@ struct cx88_board cx88_boards[] = { }}, .blackbird = 1, }, + [CX88_BOARD_NPGTECH_REALTV] = { + .name = "NPG Tech Real TV", + .tuner_type = TUNER_LG_PAL_NEW_TAPC, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x0788, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x078b, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + }}, + .radio = { + .type = CX88_RADIO, + .gpio0 = 0x074a, + }, + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); @@ -1381,6 +1404,10 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x1554, .subdevice = 0x4813, .card = CX88_BOARD_PIXELVIEW_PLAYTV_P7000, + },{ + .subvendor = 0x14f1, + .subdevice = 0x0842, + .card = CX88_BOARD_NPGTECH_REALTV, }, }; const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 78a63b7dd38..4bd86c4fd1b 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -70,14 +70,33 @@ MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); static void cx88_ir_handle_key(struct cx88_IR *ir) { struct cx88_core *core = ir->core; - u32 gpio, data; + u32 gpio, data, auxgpio; /* read gpio value */ gpio = cx_read(ir->gpio_addr); + if (core->board == CX88_BOARD_NPGTECH_REALTV) { + /* This board apparently uses a combination of 2 GPIO + to represent the keys. Additionally, the second GPIO + can be used for parity. + + Example: + + for key "5" + gpio = 0x758, auxgpio = 0xe5 or 0xf5 + for key "Power" + gpio = 0x758, auxgpio = 0xed or 0xfd + */ + + auxgpio = cx_read(MO_GP1_IO); + /* Take out the parity part */ + gpio+=(auxgpio & 0xef); + } else + auxgpio = gpio; + if (ir->polling) { - if (ir->last_gpio == gpio) + if (ir->last_gpio == auxgpio) return; - ir->last_gpio = gpio; + ir->last_gpio = auxgpio; } /* extract data */ @@ -228,6 +247,12 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) ir_type = IR_TYPE_PD; ir->sampling = 0xff00; /* address */ break; + case CX88_BOARD_NPGTECH_REALTV: + ir_codes = ir_codes_npgtech; + ir->gpio_addr = MO_GP0_IO; + ir->mask_keycode = 0xfa; + ir->polling = 50; /* ms */ + break; } if (NULL == ir_codes) { diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 663def46f67..5df6e41852b 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -192,6 +192,7 @@ extern struct sram_channel cx88_sram_channels[]; #define CX88_BOARD_PCHDTV_HD5500 47 #define CX88_BOARD_KWORLD_MCE200_DELUXE 48 #define CX88_BOARD_PIXELVIEW_PLAYTV_P7000 49 +#define CX88_BOARD_NPGTECH_REALTV 50 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, diff --git a/include/media/ir-common.h b/include/media/ir-common.h index f0beace1f92..7bab09b0ed4 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -89,6 +89,7 @@ extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_pinnacle_color[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE]; +extern IR_KEYTAB_TYPE ir_codes_npgtech[IR_KEYTAB_SIZE]; #endif -- 2.32.0.93.g670b81a890