The patch number 8628 was added via Mauro Carvalho Chehab <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Mauro Carvalho Chehab  <[EMAIL PROTECTED]>
bttv: Add support for Encore ENLTV2-FM


Thanks to Sistema Fenix (http://www.sistemafenix.com.br/) and CDI Brasil
(www.cdibrasil.com.br/) for sponsoring this development.

Priority: normal

Signed-off-by: Gilberto <[EMAIL PROTECTED]>
Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>


---

 linux/Documentation/video4linux/CARDLIST.bttv |    1 
 linux/drivers/media/common/ir-keymaps.c       |   57 +++++++++++++++-
 linux/drivers/media/video/bt8xx/bttv-cards.c  |   27 +++++++
 linux/drivers/media/video/bt8xx/bttv-input.c  |   62 +++++++++++++++++-
 linux/drivers/media/video/bt8xx/bttv.h        |    2 
 linux/include/media/ir-common.h               |    1 
 6 files changed, 141 insertions(+), 9 deletions(-)

diff -r daa4c346de08 -r fcf263987edf 
linux/Documentation/video4linux/CARDLIST.bttv
--- a/linux/Documentation/video4linux/CARDLIST.bttv     Tue Aug 05 10:12:35 
2008 -0300
+++ b/linux/Documentation/video4linux/CARDLIST.bttv     Tue Aug 05 10:14:13 
2008 -0300
@@ -150,3 +150,4 @@ 149 -> Typhoon TV-Tuner PCI (50684)
 149 -> Typhoon TV-Tuner PCI (50684)
 150 -> Geovision GV-600                                    [008a:763c]
 151 -> Kozumi KTV-01C
+152 -> Encore ENL TV-FM-2                                  [1000:1801]
diff -r daa4c346de08 -r fcf263987edf linux/drivers/media/common/ir-keymaps.c
--- a/linux/drivers/media/common/ir-keymaps.c   Tue Aug 05 10:12:35 2008 -0300
+++ b/linux/drivers/media/common/ir-keymaps.c   Tue Aug 05 10:14:13 2008 -0300
@@ -1842,11 +1842,60 @@ IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_
        [ 0x41 ] = KEY_GREEN,           /* AP2 */
        [ 0x47 ] = KEY_YELLOW,          /* AP3 */
        [ 0x57 ] = KEY_BLUE,            /* AP4 */
-
-
-};
-
+};
 EXPORT_SYMBOL_GPL(ir_codes_encore_enltv);
+
+/* Encore ENLTV2-FM  - silver plastic - "Wand Media" written at the botton
+    Mauro Carvalho Chehab <[EMAIL PROTECTED]> */
+IR_KEYTAB_TYPE ir_codes_encore_enltv2[IR_KEYTAB_SIZE] = {
+       [0x4c] = KEY_POWER2,
+       [0x4a] = KEY_TUNER,
+       [0x40] = KEY_1,
+       [0x60] = KEY_2,
+       [0x50] = KEY_3,
+       [0x70] = KEY_4,
+       [0x48] = KEY_5,
+       [0x68] = KEY_6,
+       [0x58] = KEY_7,
+       [0x78] = KEY_8,
+       [0x44] = KEY_9,
+       [0x54] = KEY_0,
+
+       [0x64] = KEY_LAST,              /* +100 */
+       [0x4e] = KEY_AGAIN,             /* Recall */
+
+       [0x6c] = KEY_SWITCHVIDEOMODE,   /* Video Source */
+       [0x5e] = KEY_MENU,
+       [0x56] = KEY_SCREEN,
+       [0x7a] = KEY_SETUP,
+
+       [0x46] = KEY_MUTE,
+       [0x5c] = KEY_MODE,              /* Stereo */
+       [0x74] = KEY_INFO,
+       [0x7c] = KEY_CLEAR,
+
+       [0x55] = KEY_UP,
+       [0x49] = KEY_DOWN,
+       [0x7e] = KEY_LEFT,
+       [0x59] = KEY_RIGHT,
+       [0x6a] = KEY_ENTER,
+
+       [0x42] = KEY_VOLUMEUP,
+       [0x62] = KEY_VOLUMEDOWN,
+       [0x52] = KEY_CHANNELUP,
+       [0x72] = KEY_CHANNELDOWN,
+
+       [0x41] = KEY_RECORD,
+       [0x51] = KEY_SHUFFLE,   /* Snapshot */
+       [0x75] = KEY_TIME,      /* Timeshift */
+       [0x71] = KEY_TV2,       /* PIP */
+
+       [0x45] = KEY_REWIND,
+       [0x6f] = KEY_PAUSE,
+       [0x7d] = KEY_FORWARD,
+       [0x79] = KEY_STOP,
+};
+EXPORT_SYMBOL_GPL(ir_codes_encore_enltv2);
 
 /* for the Technotrend 1500 bundled remotes (grey and black): */
 IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE] = {
diff -r daa4c346de08 -r fcf263987edf 
linux/drivers/media/video/bt8xx/bttv-cards.c
--- a/linux/drivers/media/video/bt8xx/bttv-cards.c      Tue Aug 05 10:12:35 
2008 -0300
+++ b/linux/drivers/media/video/bt8xx/bttv-cards.c      Tue Aug 05 10:14:13 
2008 -0300
@@ -309,7 +309,7 @@ static struct CARD {
        { 0x00261822, BTTV_BOARD_TWINHAN_DST,   "DNTV Live! Mini "},
        { 0xd200dbc0, BTTV_BOARD_DVICO_FUSIONHDTV_2,    "DViCO FusionHDTV 2" },
        { 0x763c008a, BTTV_BOARD_GEOVISION_GV600,       "GeoVision GV-600" },
-
+       { 0x18011000, BTTV_BOARD_ENLTV_FM_2,    "Encore ENL TV-FM-2" },
        { 0, -1, NULL }
 };
 
@@ -3069,6 +3069,31 @@ struct tvcard bttv_tvcards[] = {
                .has_radio      = 1,
                .has_remote     = 1,
        },
+       [BTTV_BOARD_ENLTV_FM_2] = {
+               /* Encore TV Tuner Pro ENL TV-FM-2
+                  Mauro Carvalho Chehab <[EMAIL PROTECTED] */
+               .name           = "Encore ENL TV-FM-2",
+               .video_inputs   = 3,
+               .audio_inputs   = 1,
+               .tuner          = 0,
+               .svhs           = 2,
+               /* bit 6          -> IR disabled
+                  bit 18/17 = 00 -> mute
+                              01 -> enable external audio input
+                              10 -> internal audio input (mono?)
+                              11 -> internal audio input
+                */
+               .gpiomask       = 0x060040,
+               .muxsel         = { 2, 3, 3 },
+               .gpiomux        = { 0x60000, 0x60000, 0x20000, 0x20000 },
+               .gpiomute       = 0,
+               .tuner_type     = TUNER_TCL_MF02GIP_5N,
+               .tuner_addr     = ADDR_UNSET,
+               .radio_addr     = ADDR_UNSET,
+               .pll            = PLL_28,
+               .has_radio      = 1,
+               .has_remote     = 1,
+       }
 };
 
 static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
diff -r daa4c346de08 -r fcf263987edf 
linux/drivers/media/video/bt8xx/bttv-input.c
--- a/linux/drivers/media/video/bt8xx/bttv-input.c      Tue Aug 05 10:12:35 
2008 -0300
+++ b/linux/drivers/media/video/bt8xx/bttv-input.c      Tue Aug 05 10:14:13 
2008 -0300
@@ -28,8 +28,8 @@
 #include "bttvp.h"
 
 
-static int debug;
-module_param(debug, int, 0644);    /* debug level (0,1,2) */
+static int ir_debug;
+module_param(ir_debug, int, 0644);
 static int repeat_delay = 500;
 module_param(repeat_delay, int, 0644);
 static int repeat_period = 33;
@@ -39,6 +39,12 @@ module_param(ir_rc5_remote_gap, int, 064
 module_param(ir_rc5_remote_gap, int, 0644);
 static int ir_rc5_key_timeout = 200;
 module_param(ir_rc5_key_timeout, int, 0644);
+
+#undef dprintk
+#define dprintk(arg...) do {   \
+       if (ir_debug >= 1)      \
+               printk(arg);    \
+} while (0)
 
 #define DEVNAME "bttv-input"
 
@@ -79,6 +85,45 @@ static void ir_handle_key(struct bttv *b
 
 }
 
+static void ir_enltv_handle_key(struct bttv *btv)
+{
+       struct card_ir *ir = btv->remote;
+       u32 gpio, data, keyup;
+
+       /* read gpio value */
+       gpio = bttv_gpio_read(&btv->c);
+
+       /* extract data */
+       data = ir_extract_bits(gpio, ir->mask_keycode);
+
+       /* Check if it is keyup */
+       keyup = (gpio & ir->mask_keyup) ? 1 << 31 : 0;
+
+       if ((ir->last_gpio & 0x7f) != data) {
+               dprintk(KERN_INFO DEVNAME ": gpio=0x%x code=%d | %s\n",
+                       gpio, data,
+                       (gpio & ir->mask_keyup) ? " up" : "up/down");
+
+               ir_input_keydown(ir->dev, &ir->ir, data, data);
+               if (keyup)
+                       ir_input_nokey(ir->dev, &ir->ir);
+       } else {
+               if ((ir->last_gpio & 1 << 31) == keyup)
+                       return;
+
+               dprintk(KERN_INFO DEVNAME ":(cnt) gpio=0x%x code=%d | %s\n",
+                       gpio, data,
+                       (gpio & ir->mask_keyup) ? " up" : "down");
+
+               if (keyup)
+                       ir_input_nokey(ir->dev, &ir->ir);
+               else
+                       ir_input_keydown(ir->dev, &ir->ir, data, data);
+       }
+
+       ir->last_gpio = data | keyup;
+}
+
 void bttv_input_irq(struct bttv *btv)
 {
        struct card_ir *ir = btv->remote;
@@ -92,7 +137,10 @@ static void bttv_input_timer(unsigned lo
        struct bttv *btv = (struct bttv*)data;
        struct card_ir *ir = btv->remote;
 
-       ir_handle_key(btv);
+       if (btv->c.type == BTTV_BOARD_ENLTV_FM_2)
+               ir_enltv_handle_key(btv);
+       else
+               ir_handle_key(btv);
        mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling));
 }
 
@@ -284,6 +332,14 @@ int bttv_input_init(struct bttv *btv)
                ir->mask_keyup   = 0x006000;
                ir->polling      = 50; /* ms */
                break;
+       case BTTV_BOARD_ENLTV_FM_2:
+               ir_codes         = ir_codes_encore_enltv2;
+               ir->mask_keycode = 0x00fd00;
+               ir->mask_keyup   = 0x000080;
+               ir->polling      = 1; /* ms */
+               ir->last_gpio    = ir_extract_bits(bttv_gpio_read(&btv->c),
+                                                  ir->mask_keycode);
+               break;
        }
        if (NULL == ir_codes) {
                dprintk(KERN_INFO "Ooops: IR config error [card=%d]\n", 
btv->c.type);
diff -r daa4c346de08 -r fcf263987edf linux/drivers/media/video/bt8xx/bttv.h
--- a/linux/drivers/media/video/bt8xx/bttv.h    Tue Aug 05 10:12:35 2008 -0300
+++ b/linux/drivers/media/video/bt8xx/bttv.h    Tue Aug 05 10:14:13 2008 -0300
@@ -177,7 +177,7 @@
 #define BTTV_BOARD_TYPHOON_TVTUNERPCI     0x95
 #define BTTV_BOARD_GEOVISION_GV600        0x96
 #define BTTV_BOARD_KOZUMI_KTV_01C          0x97
-
+#define BTTV_BOARD_ENLTV_FM_2             0x98
 
 /* more card-specific defines */
 #define PT2254_L_CHANNEL 0x10
diff -r daa4c346de08 -r fcf263987edf linux/include/media/ir-common.h
--- a/linux/include/media/ir-common.h   Tue Aug 05 10:12:35 2008 -0300
+++ b/linux/include/media/ir-common.h   Tue Aug 05 10:14:13 2008 -0300
@@ -144,6 +144,7 @@ extern IR_KEYTAB_TYPE ir_codes_budget_ci
 extern IR_KEYTAB_TYPE ir_codes_budget_ci_old[IR_KEYTAB_SIZE];
 extern IR_KEYTAB_TYPE ir_codes_asus_pc39[IR_KEYTAB_SIZE];
 extern IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_KEYTAB_SIZE];
+extern IR_KEYTAB_TYPE ir_codes_encore_enltv2[IR_KEYTAB_SIZE];
 extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE];
 extern IR_KEYTAB_TYPE ir_codes_fusionhdtv_mce[IR_KEYTAB_SIZE];
 extern IR_KEYTAB_TYPE ir_codes_behold[IR_KEYTAB_SIZE];


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/fcf263987edf8402be73166acaada3234d1192b7

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to