From d1009bd733a9324baff74611e0635e17fce4dfa2 Mon Sep 17 00:00:00 2001 From: Peter Naulls Date: Tue, 8 Aug 2006 09:10:05 -0300 Subject: [PATCH] V4L/DVB (4361): Cx88: add support for Norwood PCI TV Tuner (non-pro) This patch adds support for Norwood PCI TV Tuner (non-pro) Signed-off-by: Peter Naulls Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/CARDLIST.cx88 | 1 + drivers/media/common/ir-keymaps.c | 48 +++++++++++++++++++++++++ drivers/media/video/cx88/cx88-cards.c | 20 +++++++++++ drivers/media/video/cx88/cx88-core.c | 2 +- drivers/media/video/cx88/cx88-input.c | 17 ++++++++- drivers/media/video/cx88/cx88.h | 1 + include/media/ir-common.h | 1 + 7 files changed, 88 insertions(+), 2 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index d692a35ef1..348b67ddc3 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 @@ -52,3 +52,4 @@ 51 -> WinFast DTV2000 H [107d:665e] 52 -> Geniatech DVB-S [14f1:0084] 53 -> Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DVB-T [0070:1404] + 54 -> Norwood Micro TV Tuner diff --git a/drivers/media/common/ir-keymaps.c b/drivers/media/common/ir-keymaps.c index ca98d94789..ce1281445d 100644 --- a/drivers/media/common/ir-keymaps.c +++ b/drivers/media/common/ir-keymaps.c @@ -1473,3 +1473,51 @@ IR_KEYTAB_TYPE ir_codes_npgtech[IR_KEYTAB_SIZE] = { }; EXPORT_SYMBOL_GPL(ir_codes_npgtech); + +/* Norwood Micro (non-Pro) TV Tuner + By Peter Naulls + Key comments are the functions given in the manual */ +IR_KEYTAB_TYPE ir_codes_norwood[IR_KEYTAB_SIZE] = { + /* Keys 0 to 9 */ + [ 0x20 ] = KEY_0, + [ 0x21 ] = KEY_1, + [ 0x22 ] = KEY_2, + [ 0x23 ] = KEY_3, + [ 0x24 ] = KEY_4, + [ 0x25 ] = KEY_5, + [ 0x26 ] = KEY_6, + [ 0x27 ] = KEY_7, + [ 0x28 ] = KEY_8, + [ 0x29 ] = KEY_9, + + [ 0x78 ] = KEY_TUNER, /* Video Source */ + [ 0x2c ] = KEY_EXIT, /* Open/Close software */ + [ 0x2a ] = KEY_SELECT, /* 2 Digit Select */ + [ 0x69 ] = KEY_AGAIN, /* Recall */ + + [ 0x32 ] = KEY_BRIGHTNESSUP, /* Brightness increase */ + [ 0x33 ] = KEY_BRIGHTNESSDOWN, /* Brightness decrease */ + [ 0x6b ] = KEY_KPPLUS, /* (not named >>>>>) */ + [ 0x6c ] = KEY_KPMINUS, /* (not named <<<<<) */ + + [ 0x2d ] = KEY_MUTE, /* Mute */ + [ 0x30 ] = KEY_VOLUMEUP, /* Volume up */ + [ 0x31 ] = KEY_VOLUMEDOWN, /* Volume down */ + [ 0x60 ] = KEY_CHANNELUP, /* Channel up */ + [ 0x61 ] = KEY_CHANNELDOWN, /* Channel down */ + + [ 0x3f ] = KEY_RECORD, /* Record */ + [ 0x37 ] = KEY_PLAY, /* Play */ + [ 0x36 ] = KEY_PAUSE, /* Pause */ + [ 0x2b ] = KEY_STOP, /* Stop */ + [ 0x67 ] = KEY_FASTFORWARD, /* Foward */ + [ 0x66 ] = KEY_REWIND, /* Rewind */ + [ 0x3e ] = KEY_SEARCH, /* Auto Scan */ + [ 0x2e ] = KEY_CAMERA, /* Capture Video */ + [ 0x6d ] = KEY_MENU, /* Show/Hide Control */ + [ 0x2f ] = KEY_ZOOM, /* Full Screen */ + [ 0x34 ] = KEY_RADIO, /* FM */ + [ 0x65 ] = KEY_POWER, /* Computer power */ +}; + +EXPORT_SYMBOL_GPL(ir_codes_norwood); diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index afd50b465d..83bfcecee2 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -1231,6 +1231,26 @@ struct cx88_board cx88_boards[] = { .gpio0 = 0x84bf, }}, }, + [CX88_BOARD_NORWOOD_MICRO] = { + .name = "Norwood Micro TV Tuner", + .tuner_type = TUNER_TNF_5335MF, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x0709, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x070b, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x070b, + }}, + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 973d3f39b2..d72e177607 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c @@ -105,7 +105,7 @@ static u32* cx88_risc_field(u32 *rp, struct scatterlist *sglist, *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); offset+=bpl; } else { - /* scanline needs to be splitted */ + /* scanline needs to be split */ todo = bpl; *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL| (sg_dma_len(sg)-offset)); diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index c255646489..3049bd5b5a 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -107,7 +107,15 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) (gpio & ir->mask_keydown) ? " down" : "", (gpio & ir->mask_keyup) ? " up" : ""); - if (ir->mask_keydown) { + if (ir->core->board == CX88_BOARD_NORWOOD_MICRO) { + u32 gpio_key = cx_read(MO_GP0_IO); + + data = (data << 4) | ((gpio_key & 0xf0) >> 4); + + ir_input_keydown(ir->input, &ir->ir, data, data); + ir_input_nokey(ir->input, &ir->ir); + + } else if (ir->mask_keydown) { /* bit set on keydown */ if (gpio & ir->mask_keydown) { ir_input_keydown(ir->input, &ir->ir, data, data); @@ -248,6 +256,13 @@ 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_NORWOOD_MICRO: + ir_codes = ir_codes_norwood; + ir->gpio_addr = MO_GP1_IO; + ir->mask_keycode = 0x0e; + ir->mask_keyup = 0x80; + ir->polling = 50; /* ms */ + break; case CX88_BOARD_NPGTECH_REALTV_TOP10FM: ir_codes = ir_codes_npgtech; ir->gpio_addr = MO_GP0_IO; diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index ce441e27f2..0405d6d015 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -198,6 +198,7 @@ extern struct sram_channel cx88_sram_channels[]; #define CX88_BOARD_WINFAST_DTV2000H 51 #define CX88_BOARD_GENIATECH_DVBS 52 #define CX88_BOARD_HAUPPAUGE_HVR3000 53 +#define CX88_BOARD_NORWOOD_MICRO 54 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 7bab09b0ed..f883bc3aa7 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -90,6 +90,7 @@ 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]; +extern IR_KEYTAB_TYPE ir_codes_norwood[IR_KEYTAB_SIZE]; #endif -- 2.39.5