All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] saa7134: Add support for Snazio TvPVR PRO
@ 2014-02-08  6:14 GEORGE
  0 siblings, 0 replies; 10+ messages in thread
From: GEORGE @ 2014-02-08  6:14 UTC (permalink / raw)
  To: linux-media

From: POJAR GEORGE <geoubuntu <at> gmail.com>
Date: Fri, 7 Feb 2014 21:34:41 +0200
Subject: [PATCH] saa7134: Add support for Snazio TvPVR PRO

Signed-off-by: POJAR GEORGE <geoubuntu <at> gmail.com>
---

diff -ruN a/drivers/media/pci/saa7134/saa7134-cards.c 
b/drivers/media/pci/saa7134/saa7134-cards.c
--- a/drivers/media/pci/saa7134/saa7134-cards.c    2013-04-09 
06:45:51.000000000 +0300
+++ b/drivers/media/pci/saa7134/saa7134-cards.c    2014-02-08 
06:25:21.604675000 +0200
@@ -5827,7 +5827,37 @@
              .gpio = 0x0000800,
          },
      },
-
+    [SAA7134_BOARD_SNAZIO_TVPVR_PRO] = {
+        .name           = "SnaZio TvPVR PRO",
+        .audio_clock    = 0x00187de7,
+        .tuner_type     = TUNER_PHILIPS_TDA8290,
+        .radio_type     = UNSET,
+        .tuner_addr     = ADDR_UNSET,
+        .radio_addr     = ADDR_UNSET,
+        .gpiomask       = 1 << 21,
+        .inputs         = {{
+            .name = name_tv,
+            .vmux = 1,
+            .amux = TV,
+            .gpio = 0x0000000,
+            .tv   = 1,
+        },{
+            .name = name_comp1,     /* Composite input */
+            .vmux = 3,
+            .amux = LINE2,
+            .gpio = 0x0000000,
+        },{
+            .name = name_svideo,    /* S-Video input */
+            .vmux = 8,
+            .amux = LINE2,
+            .gpio = 0x0000000,
+        }},
+        .radio = {
+            .name = name_radio,
+            .amux = TV,
+            .gpio = 0x0200000,
+        },
+    },
  };

  const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -7080,6 +7110,24 @@
          .subdevice    = 0x2055, /* AverTV Satellite Hybrid+FM A706 */
          .driver_data  = SAA7134_BOARD_AVERMEDIA_A706,
      }, {
+        .vendor       = PCI_VENDOR_ID_PHILIPS,
+        .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+        .subvendor    = 0x1779,
+        .subdevice    = 0x13cf,
+        .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+    }, {
+        .vendor       = PCI_VENDOR_ID_PHILIPS,
+        .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+        .subvendor    = 0x1779,
+        .subdevice    = 0x13d0,
+        .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+    }, {
+        .vendor       = PCI_VENDOR_ID_PHILIPS,
+        .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+        .subvendor    = 0x1779,
+        .subdevice    = 0x13d1,
+        .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+    }, {
          /* --- boards without eeprom + subsystem ID --- */
          .vendor       = PCI_VENDOR_ID_PHILIPS,
          .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -7608,6 +7656,7 @@
      case SAA7134_BOARD_BEHOLD_H7:
      case SAA7134_BOARD_BEHOLD_A7:
      case SAA7134_BOARD_KWORLD_PC150U:
+    case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
          dev->has_remote = SAA7134_REMOTE_I2C;
          break;
      case SAA7134_BOARD_AVERMEDIA_A169_B:
diff -ruN a/drivers/media/pci/saa7134/saa7134.h 
b/drivers/media/pci/saa7134/saa7134.h
--- a/drivers/media/pci/saa7134/saa7134.h    2014-01-08 
06:45:52.000000000 +0200
+++ b/drivers/media/pci/saa7134/saa7134.h    2014-02-08 
06:18:58.816686000 +0200
@@ -338,6 +338,7 @@
  #define SAA7134_BOARD_ASUSTeK_PS3_100      190
  #define SAA7134_BOARD_HAWELL_HW_9004V1      191
  #define SAA7134_BOARD_AVERMEDIA_A706        192
+#define SAA7134_BOARD_SNAZIO_TVPVR_PRO      193

  #define SAA7134_MAXBOARDS 32
  #define SAA7134_INPUT_MAX 8
diff -ruN a/drivers/media/pci/saa7134/saa7134-input.c 
b/drivers/media/pci/saa7134/saa7134-input.c
--- a/drivers/media/pci/saa7134/saa7134-input.c    2013-04-09 
06:45:51.000000000 +0300
+++ b/drivers/media/pci/saa7134/saa7134-input.c    2014-02-08 
07:39:22.560543000 +0200
@@ -258,6 +258,54 @@
      return 1;
  }

+/* copied and modified from get_key_msi_tvanywhere_plus() */
+static int get_key_snazio_tvpvr_pro(struct IR_i2c *ir, u32 *ir_key,
+                       u32 *ir_raw)
+{
+    unsigned char b;
+    int gpio;
+
+    /* <dev> is needed to access GPIO. Used by the saa_readl macro. */
+    struct saa7134_dev *dev = ir->c->adapter->algo_data;
+    if (dev == NULL) {
+        i2cdprintk("get_key_snazio_tvpvr_pro: "
+               "ir->c->adapter->algo_data is NULL!\n");
+        return -EIO;
+    }
+
+    /* rising SAA7134_GPIO_GPRESCAN reads the status */
+
+    saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
+    saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
+
+    gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
+
+    /* GPIO&0x40 is pulsed low when a button is pressed. Don't do
+       I2C receive if gpio&0x40 is not low. */
+
+    if (gpio & 0x40)
+        return 0;       /* No button press */
+
+    /* GPIO says there is a button press. Get it. */
+
+    if (1 != i2c_master_recv(ir->c, &b, 1)) {
+        i2cdprintk("read error\n");
+        return -EIO;
+    }
+
+    /* No button press */
+
+    if (b == 0xff)
+        return 0;
+
+    /* Button pressed */
+
+    dprintk("get_key_snazio_tvpvr_pro: Key = 0x%02X\n", b);
+    *ir_key = b;
+    *ir_raw = b;
+    return 1;
+}
+
  static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
  {
      unsigned char b;
@@ -1006,6 +1054,22 @@
          dev->init_data.ir_codes = RC_MAP_FLYDVB;
          info.addr = 0x0b;
          break;
+    case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
+        /* copied and modified from MSI TV@nywhere Plus */
+        dev->init_data.name = "SnaZio TvPVR PRO";
+        dev->init_data.get_key = get_key_snazio_tvpvr_pro;
+        dev->init_data.ir_codes = RC_MAP_SNAZIO_TVPVR_PRO;
+        dev->init_data.polling_interval = 50;
+        info.addr = 0x30;
+        /* MSI TV@nywhere Plus controller doesn't seem to
+           respond to probes unless we read something from
+           an existing device. Weird...
+           REVISIT: might no longer be needed */
+        rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1);
+        dprintk("probe 0x%02x @ %s: %s\n",
+            msg_msi.addr, dev->i2c_adap.name,
+            (1 == rc) ? "yes" : "no");
+        break;
      default:
          dprintk("No I2C IR support for board %x\n", dev->board);
          return;
diff -ruN a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
--- a/drivers/media/rc/keymaps/Makefile    2013-12-11 06:45:50.000000000 
+0200
+++ b/drivers/media/rc/keymaps/Makefile    2014-02-08 06:01:00.552718000 
+0200
@@ -81,6 +81,7 @@
              rc-real-audio-220-32-keys.o \
              rc-reddo.o \
              rc-snapstream-firefly.o \
+            rc-snazio-tvpvr-pro.o \
              rc-streamzap.o \
              rc-tbs-nec.o \
              rc-technisat-usb2.o \
diff -ruN a/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c 
b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
--- a/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c    1970-01-01 
02:00:00.000000000 +0200
+++ b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c    2014-02-08 
06:00:28.292719000 +0200
@@ -0,0 +1,111 @@
+/* msi-tvanywhere-plus.h - Keytable for msi_tvanywhere_plus Remote 
Controller
+ *
+ * keymap imported from ir-keymaps.c
+ *
+ * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+/*
+  Keycodes for remote on the SnaZio TvPVR PRO.
+  POJAR GEORGE <geoubuntu@gmail.com>
+*/
+
+static struct rc_map_table snazio_tvpvr_pro[] = {
+
+/*  ---- Remote Button Layout ----
+
+    POWER   SOURCE  SCAN    MUTE
+    TV/FM   1       2       3
+    |>      4       5       6
+    <|      7       8       9
+    ^^UP    0       +       RECALL
+    vvDN    RECORD  STOP    PLAY
+
+    MINIMIZE          ZOOM
+
+          CH+
+      VOL-                   VOL+
+          CH-
+
+    SNAPSHOT           MTS
+
+     <<      FUNC    >>     RESET
+*/
+
+    { 0x01, KEY_1 },        /* 1 */
+    { 0x0b, KEY_2 },        /* 2 */
+    { 0x1b, KEY_3 },        /* 3 */
+    { 0x05, KEY_4 },        /* 4 */
+    { 0x09, KEY_5 },        /* 5 */
+    { 0x15, KEY_6 },        /* 6 */
+    { 0x06, KEY_7 },        /* 7 */
+    { 0x0a, KEY_8 },        /* 8 */
+    { 0x12, KEY_9 },        /* 9 */
+    { 0x02, KEY_0 },        /* 0 */
+    { 0x10, KEY_KPPLUS },        /* + */
+    { 0x13, KEY_AGAIN },        /* Recall */
+
+    { 0x1e, KEY_POWER },        /* Power */
+    { 0x07, KEY_VIDEO },        /* Source */
+    { 0x1c, KEY_SEARCH },        /* Scan */
+    { 0x18, KEY_MUTE },        /* Mute */
+
+    { 0x03, KEY_RADIO },        /* TV/FM */
+
+    { 0x3f, KEY_RIGHT },        /* |> and Ch+ */
+    { 0x37, KEY_LEFT },        /* <| and Ch- */
+    { 0x2c, KEY_UP },        /* ^^Up and >> */
+    { 0x24, KEY_DOWN },        /* vvDn and << */
+
+    { 0x00, KEY_RECORD },        /* Record */
+    { 0x08, KEY_STOP },        /* Stop */
+    { 0x11, KEY_PLAY },        /* Play */
+
+    { 0x0f, KEY_CLOSE },        /* Minimize */
+    { 0x19, KEY_ZOOM },        /* Zoom */
+    { 0x1a, KEY_CAMERA },        /* Snapshot */
+    { 0x0d, KEY_LANGUAGE },        /* MTS */
+
+    { 0x14, KEY_VOLUMEDOWN },    /* Vol- */
+    { 0x16, KEY_VOLUMEUP },        /* Vol+ */
+    { 0x17, KEY_CHANNELDOWN },    /* Ch- */
+    { 0x1f, KEY_CHANNELUP },    /* Ch+ */
+
+    { 0x04, KEY_REWIND },        /* << */
+    { 0x0e, KEY_MENU },        /* Function */
+    { 0x0c, KEY_FASTFORWARD },    /* >> */
+    { 0x1d, KEY_RESTART },        /* Reset */
+};
+
+static struct rc_map_list snazio_tvpvr_pro_map = {
+    .map = {
+        .scan    = snazio_tvpvr_pro,
+        .size    = ARRAY_SIZE(snazio_tvpvr_pro),
+        .rc_type = RC_TYPE_UNKNOWN,
+        .name    = RC_MAP_SNAZIO_TVPVR_PRO,
+    }
+};
+
+static int __init init_rc_map_snazio_tvpvr_pro(void)
+{
+    return rc_map_register(&snazio_tvpvr_pro_map);
+}
+
+static void __exit exit_rc_map_snazio_tvpvr_pro(void)
+{
+    rc_map_unregister(&snazio_tvpvr_pro_map);
+}
+
+module_init(init_rc_map_snazio_tvpvr_pro)
+module_exit(exit_rc_map_snazio_tvpvr_pro)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("POJAR GEORGE <geoubuntu@gmail.com>");
diff -ruN a/include/media/rc-map.h b/include/media/rc-map.h
--- a/include/media/rc-map.h    2014-02-08 06:45:59.000000000 +0200
+++ b/include/media/rc-map.h    2014-02-08 06:08:47.896704000 +0200
@@ -177,6 +177,7 @@
  #define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
  #define RC_MAP_REDDO                     "rc-reddo"
  #define RC_MAP_SNAPSTREAM_FIREFLY        "rc-snapstream-firefly"
+#define RC_MAP_SNAZIO_TVPVR_PRO          "rc-snazio-tvpvr-pro"
  #define RC_MAP_STREAMZAP                 "rc-streamzap"
  #define RC_MAP_TBS_NEC                   "rc-tbs-nec"
  #define RC_MAP_TECHNISAT_USB2            "rc-technisat-usb2"

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] saa7134: Add support for Snazio TvPVR PRO
@ 2016-02-14 21:23 GEORGE
  0 siblings, 0 replies; 10+ messages in thread
From: GEORGE @ 2016-02-14 21:23 UTC (permalink / raw)
  To: linux-media

Signed-off-by: POJAR GEORGE <geoubuntu <at> gmail.com>
---

diff --git a/Documentation/video4linux/CARDLIST.saa7134 
b/Documentation/video4linux/CARDLIST.saa7134
index 2821020..2e11644 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -194,3 +194,4 @@
  193 -> WIS Voyager or compatible                [1905:7007]
  194 -> AverMedia AverTV/505                     [1461:a10a]
  195 -> Leadtek Winfast TV2100 FM                [107d:6f3a]
+196 -> SnaZio* TvPVR PRO                        [1779:13cf]
diff --git a/drivers/media/pci/saa7134/saa7134-cards.c 
b/drivers/media/pci/saa7134/saa7134-cards.c
index 9a2fdc7..612cb89 100644
--- a/drivers/media/pci/saa7134/saa7134-cards.c
+++ b/drivers/media/pci/saa7134/saa7134-cards.c
@@ -5733,6 +5733,36 @@ struct saa7134_board saa7134_boards[] = {
  			.gpio = 0x08,
  		},
  	},
+	[SAA7134_BOARD_SNAZIO_TVPVR_PRO] = {
+		.name           = "SnaZio* TVPVR PRO",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_PHILIPS_TDA8290,
+		.radio_type     = UNSET,
+		.tuner_addr     = ADDR_UNSET,
+		.radio_addr     = ADDR_UNSET,
+		.gpiomask       = 1 << 21,
+		.inputs         = {{
+			.type = SAA7134_INPUT_TV,
+			.vmux = 1,
+			.amux = TV,
+			.gpio = 0x0000000,
+		},{
+			.type = SAA7134_INPUT_COMPOSITE1,
+			.vmux = 3,
+			.amux = LINE2,
+			.gpio = 0x0000000,
+		},{
+			.type = SAA7134_INPUT_SVIDEO,
+			.vmux = 8,
+			.amux = LINE2,
+			.gpio = 0x0000000,
+		}},
+		.radio = {
+			.type = SAA7134_INPUT_RADIO,
+			.amux = TV,
+			.gpio = 0x0200000,
+		},
+	},

  };

@@ -7004,6 +7034,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
  		.subdevice    = 0x6f3a,
  		.driver_data  = SAA7134_BOARD_LEADTEK_WINFAST_TV2100_FM,
  	}, {
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+		.subvendor    = 0x1779, /* V One Multimedia PTE Ltd */
+		.subdevice    = 0x13cf,
+		.driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+	}, {
  		/* --- boards without eeprom + subsystem ID --- */
  		.vendor       = PCI_VENDOR_ID_PHILIPS,
  		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -7534,6 +7570,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
  	case SAA7134_BOARD_BEHOLD_H7:
  	case SAA7134_BOARD_BEHOLD_A7:
  	case SAA7134_BOARD_KWORLD_PC150U:
+	case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
  		dev->has_remote = SAA7134_REMOTE_I2C;
  		break;
  	case SAA7134_BOARD_AVERMEDIA_A169_B:
diff --git a/drivers/media/pci/saa7134/saa7134-input.c 
b/drivers/media/pci/saa7134/saa7134-input.c
index 69d32d3..f62cbd9 100644
--- a/drivers/media/pci/saa7134/saa7134-input.c
+++ b/drivers/media/pci/saa7134/saa7134-input.c
@@ -975,6 +975,25 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
  			msg_msi.addr, dev->i2c_adap.name,
  			(1 == rc) ? "yes" : "no");
  		break;
+	case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
+		dev->init_data.name = "SnaZio* TVPVR PRO";
+		dev->init_data.get_key = get_key_msi_tvanywhere_plus;
+		dev->init_data.ir_codes = RC_MAP_MSI_TVANYWHERE_PLUS;
+		/*
+		 * MSI TV@nyware Plus requires more frequent polling
+		 * otherwise it will miss some keypresses
+		 */
+		dev->init_data.polling_interval = 50;
+		info.addr = 0x30;
+		/* MSI TV@nywhere Plus controller doesn't seem to
+		   respond to probes unless we read something from
+		   an existing device. Weird...
+		   REVISIT: might no longer be needed */
+		rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1);
+		input_dbg("probe 0x%02x @ %s: %s\n",
+			msg_msi.addr, dev->i2c_adap.name,
+			(1 == rc) ? "yes" : "no");
+		break;
  	case SAA7134_BOARD_KWORLD_PC150U:
  		/* copied and modified from MSI TV@nywhere Plus */
  		dev->init_data.name = "Kworld PC150-U";
diff --git a/drivers/media/pci/saa7134/saa7134.h 
b/drivers/media/pci/saa7134/saa7134.h
index 8936568..69a9bbf 100644
--- a/drivers/media/pci/saa7134/saa7134.h
+++ b/drivers/media/pci/saa7134/saa7134.h
@@ -343,6 +343,7 @@ struct saa7134_card_ir {
  #define SAA7134_BOARD_WIS_VOYAGER           193
  #define SAA7134_BOARD_AVERMEDIA_505         194
  #define SAA7134_BOARD_LEADTEK_WINFAST_TV2100_FM 195
+#define SAA7134_BOARD_SNAZIO_TVPVR_PRO      196

  #define SAA7134_MAXBOARDS 32
  #define SAA7134_INPUT_MAX 8
--

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] saa7134: Add support for SnaZio TvPVR PRO
  2014-02-10  5:28     ` Antti Palosaari
@ 2014-03-11 14:49       ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 10+ messages in thread
From: Mauro Carvalho Chehab @ 2014-03-11 14:49 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: GEORGE, Anca Emanuel, linux-media

Em Mon, 10 Feb 2014 07:28:31 +0200
Antti Palosaari <crope@iki.fi> escreveu:

> Moikka!
> 
> On 10.02.2014 01:44, GEORGE wrote:
> 
> > b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
> > new file mode 100644
> > index 0000000..44f0c81
> > --- /dev/null
> > +++ b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
> > @@ -0,0 +1,116 @@
> > +/* rc-snazio-tvpvr-pro.h - Keytable for snazio_tvpvr_pro Remote Controller
> > + *
> > + * keymap imported from ir-keymaps.c
> > + *
> > + * Copyright (c) 2010 by Mauro Carvalho Chehab
> > + * Copyright (c) 2014 by POJAR GEORGE <geoubuntu@gmail.com>
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License as published by
> > + * the Free Software Foundation; either version 2 of the License, or
> > + * (at your option) any later version.
> > + */
> > +
> > +#include <media/rc-map.h>
> > +#include <linux/module.h>
> > +
> > +/*
> > +  Keycodes for remote on the SnaZio TvPVR PRO.
> > +  POJAR GEORGE <geoubuntu@gmail.com>
> > +*/
> > +
> > +static struct rc_map_table snazio_tvpvr_pro[] = {
> > +
> > +/*  ---- Remote Button Layout ----
> > +
> > +    POWER   SOURCE  SCAN    MUTE
> > +    TV/FM   1       2       3
> > +    |>      4       5       6
> > +    <|      7       8       9
> > +    ^^UP    0       +       RECALL
> > +    vvDN    RECORD  STOP    PLAY
> > +
> > +    MINIMIZE          ZOOM
> > +
> > +          CH+
> > +      VOL-                   VOL+
> > +          CH-
> > +
> > +    SNAPSHOT           MTS
> > +
> > +     <<      FUNC    >>     RESET
> > +*/
> > +
> > +    { 0x01, KEY_1 },        /* 1 */
> > +    { 0x0b, KEY_2 },        /* 2 */
> > +    { 0x1b, KEY_3 },        /* 3 */
> > +    { 0x05, KEY_4 },        /* 4 */
> > +    { 0x09, KEY_5 },        /* 5 */
> > +    { 0x15, KEY_6 },        /* 6 */
> > +    { 0x06, KEY_7 },        /* 7 */
> > +    { 0x0a, KEY_8 },        /* 8 */
> > +    { 0x12, KEY_9 },        /* 9 */
> > +    { 0x02, KEY_0 },        /* 0 */
> > +    { 0x10, KEY_KPPLUS },        /* + */
> > +    { 0x13, KEY_AGAIN },        /* Recall */

Clearly, your emailer is doing something wrong here, replacing tabs by
white spaces.

That prevents us to be apply to apply it.

Also, please see the Antti comments below.

> > +
> > +    { 0x1e, KEY_POWER },        /* Power */
> > +    { 0x07, KEY_VIDEO },        /* Source */
> > +    { 0x1c, KEY_SEARCH },        /* Scan */
> > +    { 0x18, KEY_MUTE },        /* Mute */
> > +
> > +    { 0x03, KEY_RADIO },        /* TV/FM */
> > +    /* The next four keys are duplicates that appear to send the
> > +       same IR code as Ch+, Ch-, >>, and << .  The raw code assigned
> > +       to them is the actual code + 0x20 - they will never be
> > +       detected as such unless some way is discovered to distinguish
> > +       these buttons from those that have the same code. */
> > +    { 0x3f, KEY_RIGHT },        /* |> and Ch+ */
> > +    { 0x37, KEY_LEFT },        /* <| and Ch- */
> > +    { 0x2c, KEY_UP },        /* ^^Up and >> */
> > +    { 0x24, KEY_DOWN },        /* vvDn and << */
> > +
> > +    { 0x00, KEY_RECORD },        /* Record */
> > +    { 0x08, KEY_STOP },        /* Stop */
> > +    { 0x11, KEY_PLAY },        /* Play */
> > +
> > +    { 0x0f, KEY_CLOSE },        /* Minimize */
> > +    { 0x19, KEY_ZOOM },        /* Zoom */
> > +    { 0x1a, KEY_CAMERA },        /* Snapshot */
> > +    { 0x0d, KEY_LANGUAGE },        /* MTS */
> > +
> > +    { 0x14, KEY_VOLUMEDOWN },    /* Vol- */
> > +    { 0x16, KEY_VOLUMEUP },        /* Vol+ */
> > +    { 0x17, KEY_CHANNELDOWN },    /* Ch- */
> > +    { 0x1f, KEY_CHANNELUP },    /* Ch+ */
> > +
> > +    { 0x04, KEY_REWIND },        /* << */
> > +    { 0x0e, KEY_MENU },        /* Function */
> > +    { 0x0c, KEY_FASTFORWARD },    /* >> */
> > +    { 0x1d, KEY_RESTART },        /* Reset */
> > +};
> > +
> > +static struct rc_map_list snazio_tvpvr_pro_map = {
> > +    .map = {
> > +        .scan    = snazio_tvpvr_pro,
> > +        .size    = ARRAY_SIZE(snazio_tvpvr_pro),
> > +        .rc_type = RC_TYPE_UNKNOWN,    /* Legacy IR type */
> > +        .name    = RC_MAP_SNAZIO_TVPVR_PRO,
> > +    }
> > +};
> > +
> > +static int __init init_rc_map_snazio_tvpvr_pro(void)
> > +{
> > +    return rc_map_register(&snazio_tvpvr_pro_map);
> > +}
> > +
> > +static void __exit exit_rc_map_snazio_tvpvr_pro(void)
> > +{
> > +    rc_map_unregister(&snazio_tvpvr_pro_map);
> > +}
> > +
> > +module_init(init_rc_map_snazio_tvpvr_pro)
> > +module_exit(exit_rc_map_snazio_tvpvr_pro)
> > +
> > +MODULE_LICENSE("GPL");
> > +MODULE_AUTHOR("POJAR GEORGE <geoubuntu@gmail.com>");
> > diff --git a/include/media/rc-map.h b/include/media/rc-map.h
> > index e5aa240..b802af4 100644
> > --- a/include/media/rc-map.h
> > +++ b/include/media/rc-map.h
> > @@ -177,6 +177,7 @@ void rc_map_init(void);
> >   #define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
> >   #define RC_MAP_REDDO                     "rc-reddo"
> >   #define RC_MAP_SNAPSTREAM_FIREFLY        "rc-snapstream-firefly"
> > +#define RC_MAP_SNAZIO_TVPVR_PRO          "rc-snazio-tvpvr-pro"
> >   #define RC_MAP_STREAMZAP                 "rc-streamzap"
> >   #define RC_MAP_TBS_NEC                   "rc-tbs-nec"
> >   #define RC_MAP_TECHNISAT_USB2            "rc-technisat-usb2"
> 
> That remote controller is same than rc-msi-tvanywhere-plus.c. If there 
> is still some reason you need to duplicate it (like one keycode mapped 
> differently), please add comment to file "this is almost similar than 
> that keymap X, but for the reason Y we need to define new table".
> 
> rc-pixelview.c seems to be also rather similar.
> 
> Do you have some other receiver which returns full scan code? That 
> keytable should be converted to some standard rc type (NEC?)
> 
> regards
> Antti
> 


-- 

Regards,
Mauro

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] saa7134: Add support for SnaZio TvPVR PRO
  2014-02-09 23:44   ` GEORGE
  2014-02-09 23:52     ` GEORGE
@ 2014-02-10  5:28     ` Antti Palosaari
  2014-03-11 14:49       ` Mauro Carvalho Chehab
  1 sibling, 1 reply; 10+ messages in thread
From: Antti Palosaari @ 2014-02-10  5:28 UTC (permalink / raw)
  To: GEORGE, Anca Emanuel; +Cc: linux-media

Moikka!

On 10.02.2014 01:44, GEORGE wrote:

> b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
> new file mode 100644
> index 0000000..44f0c81
> --- /dev/null
> +++ b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
> @@ -0,0 +1,116 @@
> +/* rc-snazio-tvpvr-pro.h - Keytable for snazio_tvpvr_pro Remote Controller
> + *
> + * keymap imported from ir-keymaps.c
> + *
> + * Copyright (c) 2010 by Mauro Carvalho Chehab
> + * Copyright (c) 2014 by POJAR GEORGE <geoubuntu@gmail.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <media/rc-map.h>
> +#include <linux/module.h>
> +
> +/*
> +  Keycodes for remote on the SnaZio TvPVR PRO.
> +  POJAR GEORGE <geoubuntu@gmail.com>
> +*/
> +
> +static struct rc_map_table snazio_tvpvr_pro[] = {
> +
> +/*  ---- Remote Button Layout ----
> +
> +    POWER   SOURCE  SCAN    MUTE
> +    TV/FM   1       2       3
> +    |>      4       5       6
> +    <|      7       8       9
> +    ^^UP    0       +       RECALL
> +    vvDN    RECORD  STOP    PLAY
> +
> +    MINIMIZE          ZOOM
> +
> +          CH+
> +      VOL-                   VOL+
> +          CH-
> +
> +    SNAPSHOT           MTS
> +
> +     <<      FUNC    >>     RESET
> +*/
> +
> +    { 0x01, KEY_1 },        /* 1 */
> +    { 0x0b, KEY_2 },        /* 2 */
> +    { 0x1b, KEY_3 },        /* 3 */
> +    { 0x05, KEY_4 },        /* 4 */
> +    { 0x09, KEY_5 },        /* 5 */
> +    { 0x15, KEY_6 },        /* 6 */
> +    { 0x06, KEY_7 },        /* 7 */
> +    { 0x0a, KEY_8 },        /* 8 */
> +    { 0x12, KEY_9 },        /* 9 */
> +    { 0x02, KEY_0 },        /* 0 */
> +    { 0x10, KEY_KPPLUS },        /* + */
> +    { 0x13, KEY_AGAIN },        /* Recall */
> +
> +    { 0x1e, KEY_POWER },        /* Power */
> +    { 0x07, KEY_VIDEO },        /* Source */
> +    { 0x1c, KEY_SEARCH },        /* Scan */
> +    { 0x18, KEY_MUTE },        /* Mute */
> +
> +    { 0x03, KEY_RADIO },        /* TV/FM */
> +    /* The next four keys are duplicates that appear to send the
> +       same IR code as Ch+, Ch-, >>, and << .  The raw code assigned
> +       to them is the actual code + 0x20 - they will never be
> +       detected as such unless some way is discovered to distinguish
> +       these buttons from those that have the same code. */
> +    { 0x3f, KEY_RIGHT },        /* |> and Ch+ */
> +    { 0x37, KEY_LEFT },        /* <| and Ch- */
> +    { 0x2c, KEY_UP },        /* ^^Up and >> */
> +    { 0x24, KEY_DOWN },        /* vvDn and << */
> +
> +    { 0x00, KEY_RECORD },        /* Record */
> +    { 0x08, KEY_STOP },        /* Stop */
> +    { 0x11, KEY_PLAY },        /* Play */
> +
> +    { 0x0f, KEY_CLOSE },        /* Minimize */
> +    { 0x19, KEY_ZOOM },        /* Zoom */
> +    { 0x1a, KEY_CAMERA },        /* Snapshot */
> +    { 0x0d, KEY_LANGUAGE },        /* MTS */
> +
> +    { 0x14, KEY_VOLUMEDOWN },    /* Vol- */
> +    { 0x16, KEY_VOLUMEUP },        /* Vol+ */
> +    { 0x17, KEY_CHANNELDOWN },    /* Ch- */
> +    { 0x1f, KEY_CHANNELUP },    /* Ch+ */
> +
> +    { 0x04, KEY_REWIND },        /* << */
> +    { 0x0e, KEY_MENU },        /* Function */
> +    { 0x0c, KEY_FASTFORWARD },    /* >> */
> +    { 0x1d, KEY_RESTART },        /* Reset */
> +};
> +
> +static struct rc_map_list snazio_tvpvr_pro_map = {
> +    .map = {
> +        .scan    = snazio_tvpvr_pro,
> +        .size    = ARRAY_SIZE(snazio_tvpvr_pro),
> +        .rc_type = RC_TYPE_UNKNOWN,    /* Legacy IR type */
> +        .name    = RC_MAP_SNAZIO_TVPVR_PRO,
> +    }
> +};
> +
> +static int __init init_rc_map_snazio_tvpvr_pro(void)
> +{
> +    return rc_map_register(&snazio_tvpvr_pro_map);
> +}
> +
> +static void __exit exit_rc_map_snazio_tvpvr_pro(void)
> +{
> +    rc_map_unregister(&snazio_tvpvr_pro_map);
> +}
> +
> +module_init(init_rc_map_snazio_tvpvr_pro)
> +module_exit(exit_rc_map_snazio_tvpvr_pro)
> +
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("POJAR GEORGE <geoubuntu@gmail.com>");
> diff --git a/include/media/rc-map.h b/include/media/rc-map.h
> index e5aa240..b802af4 100644
> --- a/include/media/rc-map.h
> +++ b/include/media/rc-map.h
> @@ -177,6 +177,7 @@ void rc_map_init(void);
>   #define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
>   #define RC_MAP_REDDO                     "rc-reddo"
>   #define RC_MAP_SNAPSTREAM_FIREFLY        "rc-snapstream-firefly"
> +#define RC_MAP_SNAZIO_TVPVR_PRO          "rc-snazio-tvpvr-pro"
>   #define RC_MAP_STREAMZAP                 "rc-streamzap"
>   #define RC_MAP_TBS_NEC                   "rc-tbs-nec"
>   #define RC_MAP_TECHNISAT_USB2            "rc-technisat-usb2"

That remote controller is same than rc-msi-tvanywhere-plus.c. If there 
is still some reason you need to duplicate it (like one keycode mapped 
differently), please add comment to file "this is almost similar than 
that keymap X, but for the reason Y we need to define new table".

rc-pixelview.c seems to be also rather similar.

Do you have some other receiver which returns full scan code? That 
keytable should be converted to some standard rc type (NEC?)

regards
Antti

-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] saa7134: Add support for SnaZio TvPVR PRO
  2014-02-09 23:44   ` GEORGE
@ 2014-02-09 23:52     ` GEORGE
  2014-02-10  5:28     ` Antti Palosaari
  1 sibling, 0 replies; 10+ messages in thread
From: GEORGE @ 2014-02-09 23:52 UTC (permalink / raw)
  To: Anca Emanuel; +Cc: linux-media

Screenshot with lspci -vnn output:
http://imgur.com/RnKkQCj

On 10.02.2014 01:44, GEORGE wrote:
> git clone git://linuxtv.org/media_build.git
> cd media_build
> make -C linux/ download
> make -C linux/ untar
>
>
> git send-email --to "linux-media@vger.kernel.org" 
> 0001-Adding-debugging-level-for-printk.patch
>
> V One Multimedia Pte Ltd
>
>
> The hardware working:
>
> Tested:
> TV: http://imgur.com/Kz37m9e
> RADIO: http://imgur.com/Y8p7caM
> REMOTE: http://imgur.com/FpC3u1c
> ALSA: http://imgur.com/1co2JF1
>
> I do not know how to add PCI vendor id for this card:
> "V One Multimedia Limited" to be printed in "lspci -vnn" command"
>
> Subsystem: V One Multimedia Limited [1779:13cf]
>
> now show up:
>
> Subsystem: Device [1779:13cf]
>
> I changed the first patch, reason: there is an error in the line 
> (double "int" typed):
>
> "static int int __init init_rc_map_snazio_tvpvr_pro(void)":
>
> From 90db67edcae832d68006a8bae7c9856bf87de071 Mon Sep 17 00:00:00 2001
> From: POJAR GEORGE <geoubuntu@gmail.com>
> Date: Sun, 9 Feb 2014 21:25:55 +0200
> Subject: [PATCH] saa7134: Add support for SnaZio TvPVR PRO
>
> Signed-off-by: POJAR GEORGE <geoubuntu@gmail.com>
> ---
>  Documentation/video4linux/CARDLIST.saa7134     |   1 +
>  drivers/media/pci/saa7134/saa7134-cards.c      |  51 ++++++++++-
>  drivers/media/pci/saa7134/saa7134-input.c      |  62 +++++++++++++
>  drivers/media/pci/saa7134/saa7134.h            |   1 +
>  drivers/media/rc/keymaps/Makefile              |   1 +
>  drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c | 116 
> +++++++++++++++++++++++++
>  include/media/rc-map.h                         |   1 +
>  7 files changed, 232 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
>
> diff --git a/Documentation/video4linux/CARDLIST.saa7134 
> b/Documentation/video4linux/CARDLIST.saa7134
> index 8df17d0..32e4353 100644
> --- a/Documentation/video4linux/CARDLIST.saa7134
> +++ b/Documentation/video4linux/CARDLIST.saa7134
> @@ -191,3 +191,4 @@
>  190 -> Asus My Cinema PS3-100                   [1043:48cd]
>  191 -> Hawell HW-9004V1
>  192 -> AverMedia AverTV Satellite Hybrid+FM A706 [1461:2055]
> +193 -> SnaZio TvPVR PRO [0x1779:0x13cf,0x1779:0x13d0,0x1779:0x13d1]
> diff --git a/drivers/media/pci/saa7134/saa7134-cards.c 
> b/drivers/media/pci/saa7134/saa7134-cards.c
> index d45e7f6..3476785 100644
> --- a/drivers/media/pci/saa7134/saa7134-cards.c
> +++ b/drivers/media/pci/saa7134/saa7134-cards.c
> @@ -5827,7 +5827,37 @@ struct saa7134_board saa7134_boards[] = {
>              .gpio = 0x0000800,
>          },
>      },
> -
> +    [SAA7134_BOARD_SNAZIO_TVPVR_PRO] = {
> +        .name           = "SnaZio TvPVR PRO",
> +        .audio_clock    = 0x00187de7,
> +        .tuner_type     = TUNER_PHILIPS_TDA8290,
> +        .radio_type     = UNSET,
> +        .tuner_addr     = ADDR_UNSET,
> +        .radio_addr     = ADDR_UNSET,
> +        .gpiomask       = 1 << 21,
> +        .inputs         = {{
> +            .name = name_tv,
> +            .vmux = 1,
> +            .amux = TV,
> +            .gpio = 0x0000000,
> +            .tv   = 1,
> +        }, {
> +            .name = name_comp1,     /* Composite input */
> +            .vmux = 3,
> +            .amux = LINE2,
> +            .gpio = 0x0000000,
> +        }, {
> +            .name = name_svideo,    /* S-Video input */
> +            .vmux = 8,
> +            .amux = LINE2,
> +            .gpio = 0x0000000,
> +        } },
> +        .radio = {
> +            .name = name_radio,
> +            .amux = TV,
> +            .gpio = 0x0200000,
> +        },
> +    },
>  };
>
>  const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
> @@ -7080,6 +7110,24 @@ struct pci_device_id saa7134_pci_tbl[] = {
>          .subdevice    = 0x2055, /* AverTV Satellite Hybrid+FM A706 */
>          .driver_data  = SAA7134_BOARD_AVERMEDIA_A706,
>      }, {
> +        .vendor       = PCI_VENDOR_ID_PHILIPS,
> +        .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
> +        .subvendor    = 0x1779,
> +        .subdevice    = 0x13cf,
> +        .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
> +    }, {
> +        .vendor       = PCI_VENDOR_ID_PHILIPS,
> +        .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
> +        .subvendor    = 0x1779,
> +        .subdevice    = 0x13d0,
> +        .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
> +    }, {
> +        .vendor       = PCI_VENDOR_ID_PHILIPS,
> +        .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
> +        .subvendor    = 0x1779,
> +        .subdevice    = 0x13d1,
> +        .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
> +    }, {
>          /* --- boards without eeprom + subsystem ID --- */
>          .vendor       = PCI_VENDOR_ID_PHILIPS,
>          .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
> @@ -7608,6 +7656,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
>      case SAA7134_BOARD_BEHOLD_H7:
>      case SAA7134_BOARD_BEHOLD_A7:
>      case SAA7134_BOARD_KWORLD_PC150U:
> +    case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
>          dev->has_remote = SAA7134_REMOTE_I2C;
>          break;
>      case SAA7134_BOARD_AVERMEDIA_A169_B:
> diff --git a/drivers/media/pci/saa7134/saa7134-input.c 
> b/drivers/media/pci/saa7134/saa7134-input.c
> index 6f43126..62ccc7d 100644
> --- a/drivers/media/pci/saa7134/saa7134-input.c
> +++ b/drivers/media/pci/saa7134/saa7134-input.c
> @@ -416,6 +416,53 @@ static int get_key_pinnacle_color(struct IR_i2c 
> *ir, u32 *ir_key, u32 *ir_raw)
>      return get_key_pinnacle(ir, ir_key, ir_raw, 2, 0x80, 0x88);
>  }
>
> +/* copied and modified from get_key_msi_tvanywhere_plus() */
> +static int get_key_snazio_tvpvr_pro(struct IR_i2c *ir, u32 *ir_key, 
> u32 *ir_raw)
> +{
> +    unsigned char b;
> +    unsigned int gpio;
> +
> +    /* <dev> is needed to access GPIO. Used by the saa_readl macro. */
> +    struct saa7134_dev *dev = ir->c->adapter->algo_data;
> +    if (dev == NULL) {
> +        i2cdprintk("get_key_snazio_tvpvr_pro: "
> +               "ir->c->adapter->algo_data is NULL!\n");
> +        return -EIO;
> +    }
> +
> +    /* rising SAA7134_GPIO_GPRESCAN reads the status */
> +
> +    saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
> +    saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
> +
> +    gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
> +
> +    /* GPIO&0x100 is pulsed low when a button is pressed. Don't do
> +       I2C receive if gpio&0x100 is not low. */
> +
> +    if (gpio & 0x100)
> +        return 0;       /* No button press */
> +
> +    /* GPIO says there is a button press. Get it. */
> +
> +    if (1 != i2c_master_recv(ir->c, &b, 1)) {
> +        i2cdprintk("read error\n");
> +        return -EIO;
> +    }
> +
> +    /* No button press */
> +
> +    if (b == 0xff)
> +        return 0;
> +
> +    /* Button pressed */
> +
> +    dprintk("get_key_snazio_tvpvr_pro: Key = 0x%02X\n", b);
> +    *ir_key = b;
> +    *ir_raw = b;
> +    return 1;
> +}
> +
>  void saa7134_input_irq(struct saa7134_dev *dev)
>  {
>      struct saa7134_card_ir *ir;
> @@ -1006,6 +1053,21 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
>          dev->init_data.ir_codes = RC_MAP_FLYDVB;
>          info.addr = 0x0b;
>          break;
> +    case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
> +        /* copied and modified from MSI TV@nywhere Plus */
> +        dev->init_data.name = "SnaZio TvPVR PRO";
> +        dev->init_data.get_key = get_key_snazio_tvpvr_pro;
> +        dev->init_data.ir_codes = RC_MAP_SNAZIO_TVPVR_PRO;
> +        info.addr = 0x30;
> +        /* MSI TV@nywhere Plus controller doesn't seem to
> +           respond to probes unless we read something from
> +           an existing device. Weird...
> +           REVISIT: might no longer be needed */
> +        rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1);
> +        dprintk("probe 0x%02x @ %s: %s\n",
> +            msg_msi.addr, dev->i2c_adap.name,
> +            (1 == rc) ? "yes" : "no");
> +        break;
>      default:
>          dprintk("No I2C IR support for board %x\n", dev->board);
>          return;
> diff --git a/drivers/media/pci/saa7134/saa7134.h 
> b/drivers/media/pci/saa7134/saa7134.h
> index 2474e84..28b083f 100644
> --- a/drivers/media/pci/saa7134/saa7134.h
> +++ b/drivers/media/pci/saa7134/saa7134.h
> @@ -338,6 +338,7 @@ struct saa7134_card_ir {
>  #define SAA7134_BOARD_ASUSTeK_PS3_100      190
>  #define SAA7134_BOARD_HAWELL_HW_9004V1      191
>  #define SAA7134_BOARD_AVERMEDIA_A706        192
> +#define SAA7134_BOARD_SNAZIO_TVPVR_PRO      193
>
>  #define SAA7134_MAXBOARDS 32
>  #define SAA7134_INPUT_MAX 8
> diff --git a/drivers/media/rc/keymaps/Makefile 
> b/drivers/media/rc/keymaps/Makefile
> index 0b8c549..72b2e45 100644
> --- a/drivers/media/rc/keymaps/Makefile
> +++ b/drivers/media/rc/keymaps/Makefile
> @@ -81,6 +81,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
>              rc-real-audio-220-32-keys.o \
>              rc-reddo.o \
>              rc-snapstream-firefly.o \
> +            rc-snazio-tvpvr-pro.o \
>              rc-streamzap.o \
>              rc-tbs-nec.o \
>              rc-technisat-usb2.o \
> diff --git a/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c 
> b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
> new file mode 100644
> index 0000000..44f0c81
> --- /dev/null
> +++ b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
> @@ -0,0 +1,116 @@
> +/* rc-snazio-tvpvr-pro.h - Keytable for snazio_tvpvr_pro Remote 
> Controller
> + *
> + * keymap imported from ir-keymaps.c
> + *
> + * Copyright (c) 2010 by Mauro Carvalho Chehab
> + * Copyright (c) 2014 by POJAR GEORGE <geoubuntu@gmail.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <media/rc-map.h>
> +#include <linux/module.h>
> +
> +/*
> +  Keycodes for remote on the SnaZio TvPVR PRO.
> +  POJAR GEORGE <geoubuntu@gmail.com>
> +*/
> +
> +static struct rc_map_table snazio_tvpvr_pro[] = {
> +
> +/*  ---- Remote Button Layout ----
> +
> +    POWER   SOURCE  SCAN    MUTE
> +    TV/FM   1       2       3
> +    |>      4       5       6
> +    <|      7       8       9
> +    ^^UP    0       +       RECALL
> +    vvDN    RECORD  STOP    PLAY
> +
> +    MINIMIZE          ZOOM
> +
> +          CH+
> +      VOL-                   VOL+
> +          CH-
> +
> +    SNAPSHOT           MTS
> +
> +     <<      FUNC    >>     RESET
> +*/
> +
> +    { 0x01, KEY_1 },        /* 1 */
> +    { 0x0b, KEY_2 },        /* 2 */
> +    { 0x1b, KEY_3 },        /* 3 */
> +    { 0x05, KEY_4 },        /* 4 */
> +    { 0x09, KEY_5 },        /* 5 */
> +    { 0x15, KEY_6 },        /* 6 */
> +    { 0x06, KEY_7 },        /* 7 */
> +    { 0x0a, KEY_8 },        /* 8 */
> +    { 0x12, KEY_9 },        /* 9 */
> +    { 0x02, KEY_0 },        /* 0 */
> +    { 0x10, KEY_KPPLUS },        /* + */
> +    { 0x13, KEY_AGAIN },        /* Recall */
> +
> +    { 0x1e, KEY_POWER },        /* Power */
> +    { 0x07, KEY_VIDEO },        /* Source */
> +    { 0x1c, KEY_SEARCH },        /* Scan */
> +    { 0x18, KEY_MUTE },        /* Mute */
> +
> +    { 0x03, KEY_RADIO },        /* TV/FM */
> +    /* The next four keys are duplicates that appear to send the
> +       same IR code as Ch+, Ch-, >>, and << .  The raw code assigned
> +       to them is the actual code + 0x20 - they will never be
> +       detected as such unless some way is discovered to distinguish
> +       these buttons from those that have the same code. */
> +    { 0x3f, KEY_RIGHT },        /* |> and Ch+ */
> +    { 0x37, KEY_LEFT },        /* <| and Ch- */
> +    { 0x2c, KEY_UP },        /* ^^Up and >> */
> +    { 0x24, KEY_DOWN },        /* vvDn and << */
> +
> +    { 0x00, KEY_RECORD },        /* Record */
> +    { 0x08, KEY_STOP },        /* Stop */
> +    { 0x11, KEY_PLAY },        /* Play */
> +
> +    { 0x0f, KEY_CLOSE },        /* Minimize */
> +    { 0x19, KEY_ZOOM },        /* Zoom */
> +    { 0x1a, KEY_CAMERA },        /* Snapshot */
> +    { 0x0d, KEY_LANGUAGE },        /* MTS */
> +
> +    { 0x14, KEY_VOLUMEDOWN },    /* Vol- */
> +    { 0x16, KEY_VOLUMEUP },        /* Vol+ */
> +    { 0x17, KEY_CHANNELDOWN },    /* Ch- */
> +    { 0x1f, KEY_CHANNELUP },    /* Ch+ */
> +
> +    { 0x04, KEY_REWIND },        /* << */
> +    { 0x0e, KEY_MENU },        /* Function */
> +    { 0x0c, KEY_FASTFORWARD },    /* >> */
> +    { 0x1d, KEY_RESTART },        /* Reset */
> +};
> +
> +static struct rc_map_list snazio_tvpvr_pro_map = {
> +    .map = {
> +        .scan    = snazio_tvpvr_pro,
> +        .size    = ARRAY_SIZE(snazio_tvpvr_pro),
> +        .rc_type = RC_TYPE_UNKNOWN,    /* Legacy IR type */
> +        .name    = RC_MAP_SNAZIO_TVPVR_PRO,
> +    }
> +};
> +
> +static int __init init_rc_map_snazio_tvpvr_pro(void)
> +{
> +    return rc_map_register(&snazio_tvpvr_pro_map);
> +}
> +
> +static void __exit exit_rc_map_snazio_tvpvr_pro(void)
> +{
> +    rc_map_unregister(&snazio_tvpvr_pro_map);
> +}
> +
> +module_init(init_rc_map_snazio_tvpvr_pro)
> +module_exit(exit_rc_map_snazio_tvpvr_pro)
> +
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("POJAR GEORGE <geoubuntu@gmail.com>");
> diff --git a/include/media/rc-map.h b/include/media/rc-map.h
> index e5aa240..b802af4 100644
> --- a/include/media/rc-map.h
> +++ b/include/media/rc-map.h
> @@ -177,6 +177,7 @@ void rc_map_init(void);
>  #define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
>  #define RC_MAP_REDDO                     "rc-reddo"
>  #define RC_MAP_SNAPSTREAM_FIREFLY        "rc-snapstream-firefly"
> +#define RC_MAP_SNAZIO_TVPVR_PRO          "rc-snazio-tvpvr-pro"
>  #define RC_MAP_STREAMZAP                 "rc-streamzap"
>  #define RC_MAP_TBS_NEC                   "rc-tbs-nec"
>  #define RC_MAP_TECHNISAT_USB2            "rc-technisat-usb2"


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] saa7134: Add support for SnaZio TvPVR PRO
  2014-02-09 16:29 ` Anca Emanuel
@ 2014-02-09 23:44   ` GEORGE
  2014-02-09 23:52     ` GEORGE
  2014-02-10  5:28     ` Antti Palosaari
  0 siblings, 2 replies; 10+ messages in thread
From: GEORGE @ 2014-02-09 23:44 UTC (permalink / raw)
  To: Anca Emanuel; +Cc: linux-media

git clone git://linuxtv.org/media_build.git
cd media_build
make -C linux/ download
make -C linux/ untar


git send-email --to "linux-media@vger.kernel.org" 
0001-Adding-debugging-level-for-printk.patch

V One Multimedia Pte Ltd


The hardware working:

Tested:
TV: http://imgur.com/Kz37m9e
RADIO: http://imgur.com/Y8p7caM
REMOTE: http://imgur.com/FpC3u1c
ALSA: http://imgur.com/1co2JF1

I do not know how to add PCI vendor id for this card:
"V One Multimedia Limited" to be printed in "lspci -vnn" command"

Subsystem: V One Multimedia Limited [1779:13cf]

now show up:

Subsystem: Device [1779:13cf]

I changed the first patch, reason: there is an error in the line (double 
"int" typed):

"static int int __init init_rc_map_snazio_tvpvr_pro(void)":

 From 90db67edcae832d68006a8bae7c9856bf87de071 Mon Sep 17 00:00:00 2001
From: POJAR GEORGE <geoubuntu@gmail.com>
Date: Sun, 9 Feb 2014 21:25:55 +0200
Subject: [PATCH] saa7134: Add support for SnaZio TvPVR PRO

Signed-off-by: POJAR GEORGE <geoubuntu@gmail.com>
---
  Documentation/video4linux/CARDLIST.saa7134     |   1 +
  drivers/media/pci/saa7134/saa7134-cards.c      |  51 ++++++++++-
  drivers/media/pci/saa7134/saa7134-input.c      |  62 +++++++++++++
  drivers/media/pci/saa7134/saa7134.h            |   1 +
  drivers/media/rc/keymaps/Makefile              |   1 +
  drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c | 116 
+++++++++++++++++++++++++
  include/media/rc-map.h                         |   1 +
  7 files changed, 232 insertions(+), 1 deletion(-)
  create mode 100644 drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c

diff --git a/Documentation/video4linux/CARDLIST.saa7134 
b/Documentation/video4linux/CARDLIST.saa7134
index 8df17d0..32e4353 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -191,3 +191,4 @@
  190 -> Asus My Cinema PS3-100                   [1043:48cd]
  191 -> Hawell HW-9004V1
  192 -> AverMedia AverTV Satellite Hybrid+FM A706 [1461:2055]
+193 -> SnaZio TvPVR PRO [0x1779:0x13cf,0x1779:0x13d0,0x1779:0x13d1]
diff --git a/drivers/media/pci/saa7134/saa7134-cards.c 
b/drivers/media/pci/saa7134/saa7134-cards.c
index d45e7f6..3476785 100644
--- a/drivers/media/pci/saa7134/saa7134-cards.c
+++ b/drivers/media/pci/saa7134/saa7134-cards.c
@@ -5827,7 +5827,37 @@ struct saa7134_board saa7134_boards[] = {
              .gpio = 0x0000800,
          },
      },
-
+    [SAA7134_BOARD_SNAZIO_TVPVR_PRO] = {
+        .name           = "SnaZio TvPVR PRO",
+        .audio_clock    = 0x00187de7,
+        .tuner_type     = TUNER_PHILIPS_TDA8290,
+        .radio_type     = UNSET,
+        .tuner_addr     = ADDR_UNSET,
+        .radio_addr     = ADDR_UNSET,
+        .gpiomask       = 1 << 21,
+        .inputs         = {{
+            .name = name_tv,
+            .vmux = 1,
+            .amux = TV,
+            .gpio = 0x0000000,
+            .tv   = 1,
+        }, {
+            .name = name_comp1,     /* Composite input */
+            .vmux = 3,
+            .amux = LINE2,
+            .gpio = 0x0000000,
+        }, {
+            .name = name_svideo,    /* S-Video input */
+            .vmux = 8,
+            .amux = LINE2,
+            .gpio = 0x0000000,
+        } },
+        .radio = {
+            .name = name_radio,
+            .amux = TV,
+            .gpio = 0x0200000,
+        },
+    },
  };

  const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -7080,6 +7110,24 @@ struct pci_device_id saa7134_pci_tbl[] = {
          .subdevice    = 0x2055, /* AverTV Satellite Hybrid+FM A706 */
          .driver_data  = SAA7134_BOARD_AVERMEDIA_A706,
      }, {
+        .vendor       = PCI_VENDOR_ID_PHILIPS,
+        .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+        .subvendor    = 0x1779,
+        .subdevice    = 0x13cf,
+        .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+    }, {
+        .vendor       = PCI_VENDOR_ID_PHILIPS,
+        .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+        .subvendor    = 0x1779,
+        .subdevice    = 0x13d0,
+        .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+    }, {
+        .vendor       = PCI_VENDOR_ID_PHILIPS,
+        .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+        .subvendor    = 0x1779,
+        .subdevice    = 0x13d1,
+        .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+    }, {
          /* --- boards without eeprom + subsystem ID --- */
          .vendor       = PCI_VENDOR_ID_PHILIPS,
          .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -7608,6 +7656,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
      case SAA7134_BOARD_BEHOLD_H7:
      case SAA7134_BOARD_BEHOLD_A7:
      case SAA7134_BOARD_KWORLD_PC150U:
+    case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
          dev->has_remote = SAA7134_REMOTE_I2C;
          break;
      case SAA7134_BOARD_AVERMEDIA_A169_B:
diff --git a/drivers/media/pci/saa7134/saa7134-input.c 
b/drivers/media/pci/saa7134/saa7134-input.c
index 6f43126..62ccc7d 100644
--- a/drivers/media/pci/saa7134/saa7134-input.c
+++ b/drivers/media/pci/saa7134/saa7134-input.c
@@ -416,6 +416,53 @@ static int get_key_pinnacle_color(struct IR_i2c 
*ir, u32 *ir_key, u32 *ir_raw)
      return get_key_pinnacle(ir, ir_key, ir_raw, 2, 0x80, 0x88);
  }

+/* copied and modified from get_key_msi_tvanywhere_plus() */
+static int get_key_snazio_tvpvr_pro(struct IR_i2c *ir, u32 *ir_key, u32 
*ir_raw)
+{
+    unsigned char b;
+    unsigned int gpio;
+
+    /* <dev> is needed to access GPIO. Used by the saa_readl macro. */
+    struct saa7134_dev *dev = ir->c->adapter->algo_data;
+    if (dev == NULL) {
+        i2cdprintk("get_key_snazio_tvpvr_pro: "
+               "ir->c->adapter->algo_data is NULL!\n");
+        return -EIO;
+    }
+
+    /* rising SAA7134_GPIO_GPRESCAN reads the status */
+
+    saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
+    saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
+
+    gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
+
+    /* GPIO&0x100 is pulsed low when a button is pressed. Don't do
+       I2C receive if gpio&0x100 is not low. */
+
+    if (gpio & 0x100)
+        return 0;       /* No button press */
+
+    /* GPIO says there is a button press. Get it. */
+
+    if (1 != i2c_master_recv(ir->c, &b, 1)) {
+        i2cdprintk("read error\n");
+        return -EIO;
+    }
+
+    /* No button press */
+
+    if (b == 0xff)
+        return 0;
+
+    /* Button pressed */
+
+    dprintk("get_key_snazio_tvpvr_pro: Key = 0x%02X\n", b);
+    *ir_key = b;
+    *ir_raw = b;
+    return 1;
+}
+
  void saa7134_input_irq(struct saa7134_dev *dev)
  {
      struct saa7134_card_ir *ir;
@@ -1006,6 +1053,21 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
          dev->init_data.ir_codes = RC_MAP_FLYDVB;
          info.addr = 0x0b;
          break;
+    case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
+        /* copied and modified from MSI TV@nywhere Plus */
+        dev->init_data.name = "SnaZio TvPVR PRO";
+        dev->init_data.get_key = get_key_snazio_tvpvr_pro;
+        dev->init_data.ir_codes = RC_MAP_SNAZIO_TVPVR_PRO;
+        info.addr = 0x30;
+        /* MSI TV@nywhere Plus controller doesn't seem to
+           respond to probes unless we read something from
+           an existing device. Weird...
+           REVISIT: might no longer be needed */
+        rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1);
+        dprintk("probe 0x%02x @ %s: %s\n",
+            msg_msi.addr, dev->i2c_adap.name,
+            (1 == rc) ? "yes" : "no");
+        break;
      default:
          dprintk("No I2C IR support for board %x\n", dev->board);
          return;
diff --git a/drivers/media/pci/saa7134/saa7134.h 
b/drivers/media/pci/saa7134/saa7134.h
index 2474e84..28b083f 100644
--- a/drivers/media/pci/saa7134/saa7134.h
+++ b/drivers/media/pci/saa7134/saa7134.h
@@ -338,6 +338,7 @@ struct saa7134_card_ir {
  #define SAA7134_BOARD_ASUSTeK_PS3_100      190
  #define SAA7134_BOARD_HAWELL_HW_9004V1      191
  #define SAA7134_BOARD_AVERMEDIA_A706        192
+#define SAA7134_BOARD_SNAZIO_TVPVR_PRO      193

  #define SAA7134_MAXBOARDS 32
  #define SAA7134_INPUT_MAX 8
diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index 0b8c549..72b2e45 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -81,6 +81,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
              rc-real-audio-220-32-keys.o \
              rc-reddo.o \
              rc-snapstream-firefly.o \
+            rc-snazio-tvpvr-pro.o \
              rc-streamzap.o \
              rc-tbs-nec.o \
              rc-technisat-usb2.o \
diff --git a/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c 
b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
new file mode 100644
index 0000000..44f0c81
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
@@ -0,0 +1,116 @@
+/* rc-snazio-tvpvr-pro.h - Keytable for snazio_tvpvr_pro Remote Controller
+ *
+ * keymap imported from ir-keymaps.c
+ *
+ * Copyright (c) 2010 by Mauro Carvalho Chehab
+ * Copyright (c) 2014 by POJAR GEORGE <geoubuntu@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+/*
+  Keycodes for remote on the SnaZio TvPVR PRO.
+  POJAR GEORGE <geoubuntu@gmail.com>
+*/
+
+static struct rc_map_table snazio_tvpvr_pro[] = {
+
+/*  ---- Remote Button Layout ----
+
+    POWER   SOURCE  SCAN    MUTE
+    TV/FM   1       2       3
+    |>      4       5       6
+    <|      7       8       9
+    ^^UP    0       +       RECALL
+    vvDN    RECORD  STOP    PLAY
+
+    MINIMIZE          ZOOM
+
+          CH+
+      VOL-                   VOL+
+          CH-
+
+    SNAPSHOT           MTS
+
+     <<      FUNC    >>     RESET
+*/
+
+    { 0x01, KEY_1 },        /* 1 */
+    { 0x0b, KEY_2 },        /* 2 */
+    { 0x1b, KEY_3 },        /* 3 */
+    { 0x05, KEY_4 },        /* 4 */
+    { 0x09, KEY_5 },        /* 5 */
+    { 0x15, KEY_6 },        /* 6 */
+    { 0x06, KEY_7 },        /* 7 */
+    { 0x0a, KEY_8 },        /* 8 */
+    { 0x12, KEY_9 },        /* 9 */
+    { 0x02, KEY_0 },        /* 0 */
+    { 0x10, KEY_KPPLUS },        /* + */
+    { 0x13, KEY_AGAIN },        /* Recall */
+
+    { 0x1e, KEY_POWER },        /* Power */
+    { 0x07, KEY_VIDEO },        /* Source */
+    { 0x1c, KEY_SEARCH },        /* Scan */
+    { 0x18, KEY_MUTE },        /* Mute */
+
+    { 0x03, KEY_RADIO },        /* TV/FM */
+    /* The next four keys are duplicates that appear to send the
+       same IR code as Ch+, Ch-, >>, and << .  The raw code assigned
+       to them is the actual code + 0x20 - they will never be
+       detected as such unless some way is discovered to distinguish
+       these buttons from those that have the same code. */
+    { 0x3f, KEY_RIGHT },        /* |> and Ch+ */
+    { 0x37, KEY_LEFT },        /* <| and Ch- */
+    { 0x2c, KEY_UP },        /* ^^Up and >> */
+    { 0x24, KEY_DOWN },        /* vvDn and << */
+
+    { 0x00, KEY_RECORD },        /* Record */
+    { 0x08, KEY_STOP },        /* Stop */
+    { 0x11, KEY_PLAY },        /* Play */
+
+    { 0x0f, KEY_CLOSE },        /* Minimize */
+    { 0x19, KEY_ZOOM },        /* Zoom */
+    { 0x1a, KEY_CAMERA },        /* Snapshot */
+    { 0x0d, KEY_LANGUAGE },        /* MTS */
+
+    { 0x14, KEY_VOLUMEDOWN },    /* Vol- */
+    { 0x16, KEY_VOLUMEUP },        /* Vol+ */
+    { 0x17, KEY_CHANNELDOWN },    /* Ch- */
+    { 0x1f, KEY_CHANNELUP },    /* Ch+ */
+
+    { 0x04, KEY_REWIND },        /* << */
+    { 0x0e, KEY_MENU },        /* Function */
+    { 0x0c, KEY_FASTFORWARD },    /* >> */
+    { 0x1d, KEY_RESTART },        /* Reset */
+};
+
+static struct rc_map_list snazio_tvpvr_pro_map = {
+    .map = {
+        .scan    = snazio_tvpvr_pro,
+        .size    = ARRAY_SIZE(snazio_tvpvr_pro),
+        .rc_type = RC_TYPE_UNKNOWN,    /* Legacy IR type */
+        .name    = RC_MAP_SNAZIO_TVPVR_PRO,
+    }
+};
+
+static int __init init_rc_map_snazio_tvpvr_pro(void)
+{
+    return rc_map_register(&snazio_tvpvr_pro_map);
+}
+
+static void __exit exit_rc_map_snazio_tvpvr_pro(void)
+{
+    rc_map_unregister(&snazio_tvpvr_pro_map);
+}
+
+module_init(init_rc_map_snazio_tvpvr_pro)
+module_exit(exit_rc_map_snazio_tvpvr_pro)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("POJAR GEORGE <geoubuntu@gmail.com>");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index e5aa240..b802af4 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -177,6 +177,7 @@ void rc_map_init(void);
  #define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
  #define RC_MAP_REDDO                     "rc-reddo"
  #define RC_MAP_SNAPSTREAM_FIREFLY        "rc-snapstream-firefly"
+#define RC_MAP_SNAZIO_TVPVR_PRO          "rc-snazio-tvpvr-pro"
  #define RC_MAP_STREAMZAP                 "rc-streamzap"
  #define RC_MAP_TBS_NEC                   "rc-tbs-nec"
  #define RC_MAP_TECHNISAT_USB2            "rc-technisat-usb2"
-- 
1.9.rc1

On 09.02.2014 18:29, Anca Emanuel wrote:
> the hardware working:


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] saa7134: Add support for SnaZio TvPVR PRO
  2014-02-09 16:06 [PATCH] saa7134: Add support for SnaZio " POJAR GEORGE
@ 2014-02-09 16:29 ` Anca Emanuel
  2014-02-09 23:44   ` GEORGE
  0 siblings, 1 reply; 10+ messages in thread
From: Anca Emanuel @ 2014-02-09 16:29 UTC (permalink / raw)
  To: POJAR GEORGE; +Cc: linux-media

I will like some proof that you have the hardware working: dmesg, and
printscreen.
like this: http://imgur.com/KNrfsmv

On Sun, Feb 9, 2014 at 6:06 PM, POJAR GEORGE <geoubuntu@gmail.com> wrote:
> From: POJAR GEORGE <geoubuntu@gmail.com>
>
> Signed-off-by: POJAR GEORGE <geoubuntu@gmail.com>
> ---
>  Documentation/video4linux/CARDLIST.saa7134     |   1 +
>  drivers/media/pci/saa7134/saa7134-cards.c      |  51 ++++++++++-
>  drivers/media/pci/saa7134/saa7134-input.c      |  62 +++++++++++++
>  drivers/media/pci/saa7134/saa7134.h            |   1 +
>  drivers/media/rc/keymaps/Makefile              |   1 +
>  drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c | 116 +++++++++++++++++++++++++
>  include/media/rc-map.h                         |   1 +
>  7 files changed, 232 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
>
> diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
> index 8df17d0..32e4353 100644
> --- a/Documentation/video4linux/CARDLIST.saa7134
> +++ b/Documentation/video4linux/CARDLIST.saa7134
> @@ -191,3 +191,4 @@
>  190 -> Asus My Cinema PS3-100                   [1043:48cd]
>  191 -> Hawell HW-9004V1
>  192 -> AverMedia AverTV Satellite Hybrid+FM A706 [1461:2055]
> +193 -> SnaZio TvPVR PRO                         [0x1779:0x13cf,0x1779:0x13d0,0x1779:0x13d1]
> diff --git a/drivers/media/pci/saa7134/saa7134-cards.c b/drivers/media/pci/saa7134/saa7134-cards.c
> index d45e7f6..3476785 100644
> --- a/drivers/media/pci/saa7134/saa7134-cards.c
> +++ b/drivers/media/pci/saa7134/saa7134-cards.c
> @@ -5827,7 +5827,37 @@ struct saa7134_board saa7134_boards[] = {
>                         .gpio = 0x0000800,
>                 },
>         },
> -
> +       [SAA7134_BOARD_SNAZIO_TVPVR_PRO] = {
> +               .name           = "SnaZio TvPVR PRO",
> +               .audio_clock    = 0x00187de7,
> +               .tuner_type     = TUNER_PHILIPS_TDA8290,
> +               .radio_type     = UNSET,
> +               .tuner_addr     = ADDR_UNSET,
> +               .radio_addr     = ADDR_UNSET,
> +               .gpiomask       = 1 << 21,
> +               .inputs         = {{
> +                       .name = name_tv,
> +                       .vmux = 1,
> +                       .amux = TV,
> +                       .gpio = 0x0000000,
> +                       .tv   = 1,
> +               }, {
> +                       .name = name_comp1,     /* Composite input */
> +                       .vmux = 3,
> +                       .amux = LINE2,
> +                       .gpio = 0x0000000,
> +               }, {
> +                       .name = name_svideo,    /* S-Video input */
> +                       .vmux = 8,
> +                       .amux = LINE2,
> +                       .gpio = 0x0000000,
> +               } },
> +               .radio = {
> +                       .name = name_radio,
> +                       .amux = TV,
> +                       .gpio = 0x0200000,
> +               },
> +       },
>  };
>
>  const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
> @@ -7080,6 +7110,24 @@ struct pci_device_id saa7134_pci_tbl[] = {
>                 .subdevice    = 0x2055, /* AverTV Satellite Hybrid+FM A706 */
>                 .driver_data  = SAA7134_BOARD_AVERMEDIA_A706,
>         }, {
> +               .vendor       = PCI_VENDOR_ID_PHILIPS,
> +               .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
> +               .subvendor    = 0x1779,
> +               .subdevice    = 0x13cf,
> +               .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
> +       }, {
> +               .vendor       = PCI_VENDOR_ID_PHILIPS,
> +               .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
> +               .subvendor    = 0x1779,
> +               .subdevice    = 0x13d0,
> +               .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
> +       }, {
> +               .vendor       = PCI_VENDOR_ID_PHILIPS,
> +               .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
> +               .subvendor    = 0x1779,
> +               .subdevice    = 0x13d1,
> +               .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
> +       }, {
>                 /* --- boards without eeprom + subsystem ID --- */
>                 .vendor       = PCI_VENDOR_ID_PHILIPS,
>                 .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
> @@ -7608,6 +7656,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
>         case SAA7134_BOARD_BEHOLD_H7:
>         case SAA7134_BOARD_BEHOLD_A7:
>         case SAA7134_BOARD_KWORLD_PC150U:
> +       case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
>                 dev->has_remote = SAA7134_REMOTE_I2C;
>                 break;
>         case SAA7134_BOARD_AVERMEDIA_A169_B:
> diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c
> index 6f43126..62ccc7d 100644
> --- a/drivers/media/pci/saa7134/saa7134-input.c
> +++ b/drivers/media/pci/saa7134/saa7134-input.c
> @@ -416,6 +416,53 @@ static int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
>         return get_key_pinnacle(ir, ir_key, ir_raw, 2, 0x80, 0x88);
>  }
>
> +/* copied and modified from get_key_msi_tvanywhere_plus() */
> +static int get_key_snazio_tvpvr_pro(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
> +{
> +       unsigned char b;
> +       unsigned int gpio;
> +
> +       /* <dev> is needed to access GPIO. Used by the saa_readl macro. */
> +       struct saa7134_dev *dev = ir->c->adapter->algo_data;
> +       if (dev == NULL) {
> +               i2cdprintk("get_key_snazio_tvpvr_pro: "
> +                          "ir->c->adapter->algo_data is NULL!\n");
> +               return -EIO;
> +       }
> +
> +       /* rising SAA7134_GPIO_GPRESCAN reads the status */
> +
> +       saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
> +       saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
> +
> +       gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
> +
> +       /* GPIO&0x100 is pulsed low when a button is pressed. Don't do
> +          I2C receive if gpio&0x100 is not low. */
> +
> +       if (gpio & 0x100)
> +               return 0;       /* No button press */
> +
> +       /* GPIO says there is a button press. Get it. */
> +
> +       if (1 != i2c_master_recv(ir->c, &b, 1)) {
> +               i2cdprintk("read error\n");
> +               return -EIO;
> +       }
> +
> +       /* No button press */
> +
> +       if (b == 0xff)
> +               return 0;
> +
> +       /* Button pressed */
> +
> +       dprintk("get_key_snazio_tvpvr_pro: Key = 0x%02X\n", b);
> +       *ir_key = b;
> +       *ir_raw = b;
> +       return 1;
> +}
> +
>  void saa7134_input_irq(struct saa7134_dev *dev)
>  {
>         struct saa7134_card_ir *ir;
> @@ -1006,6 +1053,21 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
>                 dev->init_data.ir_codes = RC_MAP_FLYDVB;
>                 info.addr = 0x0b;
>                 break;
> +       case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
> +               /* copied and modified from MSI TV@nywhere Plus */
> +               dev->init_data.name = "SnaZio TvPVR PRO";
> +               dev->init_data.get_key = get_key_snazio_tvpvr_pro;
> +               dev->init_data.ir_codes = RC_MAP_SNAZIO_TVPVR_PRO;
> +               info.addr = 0x30;
> +               /* MSI TV@nywhere Plus controller doesn't seem to
> +                  respond to probes unless we read something from
> +                  an existing device. Weird...
> +                  REVISIT: might no longer be needed */
> +               rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1);
> +               dprintk("probe 0x%02x @ %s: %s\n",
> +                       msg_msi.addr, dev->i2c_adap.name,
> +                       (1 == rc) ? "yes" : "no");
> +               break;
>         default:
>                 dprintk("No I2C IR support for board %x\n", dev->board);
>                 return;
> diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h
> index 2474e84..28b083f 100644
> --- a/drivers/media/pci/saa7134/saa7134.h
> +++ b/drivers/media/pci/saa7134/saa7134.h
> @@ -338,6 +338,7 @@ struct saa7134_card_ir {
>  #define SAA7134_BOARD_ASUSTeK_PS3_100      190
>  #define SAA7134_BOARD_HAWELL_HW_9004V1      191
>  #define SAA7134_BOARD_AVERMEDIA_A706           192
> +#define SAA7134_BOARD_SNAZIO_TVPVR_PRO      193
>
>  #define SAA7134_MAXBOARDS 32
>  #define SAA7134_INPUT_MAX 8
> diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
> index 0b8c549..72b2e45 100644
> --- a/drivers/media/rc/keymaps/Makefile
> +++ b/drivers/media/rc/keymaps/Makefile
> @@ -81,6 +81,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
>                         rc-real-audio-220-32-keys.o \
>                         rc-reddo.o \
>                         rc-snapstream-firefly.o \
> +                       rc-snazio-tvpvr-pro.o \
>                         rc-streamzap.o \
>                         rc-tbs-nec.o \
>                         rc-technisat-usb2.o \
> diff --git a/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
> new file mode 100644
> index 0000000..127350e
> --- /dev/null
> +++ b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
> @@ -0,0 +1,116 @@
> +/* rc-snazio-tvpvr-pro.h - Keytable for snazio_tvpvr_pro Remote Controller
> + *
> + * keymap imported from ir-keymaps.c
> + *
> + * Copyright (c) 2010 by Mauro Carvalho Chehab
> + * Copyright (c) 2010 by POJAR GEORGE <geoubuntu@gmail.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <media/rc-map.h>
> +#include <linux/module.h>
> +
> +/*
> +  Keycodes for remote on the SnaZio TvPVR PRO.
> +  POJAR GEORGE <geoubuntu@gmail.com>
> +*/
> +
> +static struct rc_map_table snazio_tvpvr_pro[] = {
> +
> +/*  ---- Remote Button Layout ----
> +
> +    POWER   SOURCE  SCAN    MUTE
> +    TV/FM   1       2       3
> +    |>      4       5       6
> +    <|      7       8       9
> +    ^^UP    0       +       RECALL
> +    vvDN    RECORD  STOP    PLAY
> +
> +       MINIMIZE          ZOOM
> +
> +                 CH+
> +      VOL-                   VOL+
> +                 CH-
> +
> +       SNAPSHOT           MTS
> +
> +     <<      FUNC    >>     RESET
> +*/
> +
> +       { 0x01, KEY_1 },                /* 1 */
> +       { 0x0b, KEY_2 },                /* 2 */
> +       { 0x1b, KEY_3 },                /* 3 */
> +       { 0x05, KEY_4 },                /* 4 */
> +       { 0x09, KEY_5 },                /* 5 */
> +       { 0x15, KEY_6 },                /* 6 */
> +       { 0x06, KEY_7 },                /* 7 */
> +       { 0x0a, KEY_8 },                /* 8 */
> +       { 0x12, KEY_9 },                /* 9 */
> +       { 0x02, KEY_0 },                /* 0 */
> +       { 0x10, KEY_KPPLUS },           /* + */
> +       { 0x13, KEY_AGAIN },            /* Recall */
> +
> +       { 0x1e, KEY_POWER },            /* Power */
> +       { 0x07, KEY_VIDEO },            /* Source */
> +       { 0x1c, KEY_SEARCH },           /* Scan */
> +       { 0x18, KEY_MUTE },             /* Mute */
> +
> +       { 0x03, KEY_RADIO },            /* TV/FM */
> +       /* The next four keys are duplicates that appear to send the
> +          same IR code as Ch+, Ch-, >>, and << .  The raw code assigned
> +          to them is the actual code + 0x20 - they will never be
> +          detected as such unless some way is discovered to distinguish
> +          these buttons from those that have the same code. */
> +       { 0x3f, KEY_RIGHT },            /* |> and Ch+ */
> +       { 0x37, KEY_LEFT },             /* <| and Ch- */
> +       { 0x2c, KEY_UP },               /* ^^Up and >> */
> +       { 0x24, KEY_DOWN },             /* vvDn and << */
> +
> +       { 0x00, KEY_RECORD },           /* Record */
> +       { 0x08, KEY_STOP },             /* Stop */
> +       { 0x11, KEY_PLAY },             /* Play */
> +
> +       { 0x0f, KEY_CLOSE },            /* Minimize */
> +       { 0x19, KEY_ZOOM },             /* Zoom */
> +       { 0x1a, KEY_CAMERA },           /* Snapshot */
> +       { 0x0d, KEY_LANGUAGE },         /* MTS */
> +
> +       { 0x14, KEY_VOLUMEDOWN },       /* Vol- */
> +       { 0x16, KEY_VOLUMEUP },         /* Vol+ */
> +       { 0x17, KEY_CHANNELDOWN },      /* Ch- */
> +       { 0x1f, KEY_CHANNELUP },        /* Ch+ */
> +
> +       { 0x04, KEY_REWIND },           /* << */
> +       { 0x0e, KEY_MENU },             /* Function */
> +       { 0x0c, KEY_FASTFORWARD },      /* >> */
> +       { 0x1d, KEY_RESTART },          /* Reset */
> +};
> +
> +static struct rc_map_list snazio_tvpvr_pro_map = {
> +       .map = {
> +               .scan    = snazio_tvpvr_pro,
> +               .size    = ARRAY_SIZE(snazio_tvpvr_pro),
> +               .rc_type = RC_TYPE_UNKNOWN,     /* Legacy IR type */
> +               .name    = RC_MAP_SNAZIO_TVPVR_PRO,
> +       }
> +};
> +
> +static int int __init init_rc_map_snazio_tvpvr_pro(void)
> +{
> +       return rc_map_register(&snazio_tvpvr_pro_map);
> +}
> +
> +static void __exit exit_rc_map_snazio_tvpvr_pro(void)
> +{
> +       rc_map_unregister(&snazio_tvpvr_pro_map);
> +}
> +
> +module_init(init_rc_map_snazio_tvpvr_pro)
> +module_exit(exit_rc_map_snazio_tvpvr_pro)
> +
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("POJAR GEORGE <geoubuntu@gmail.com>");
> diff --git a/include/media/rc-map.h b/include/media/rc-map.h
> index e5aa240..b802af4 100644
> --- a/include/media/rc-map.h
> +++ b/include/media/rc-map.h
> @@ -177,6 +177,7 @@ void rc_map_init(void);
>  #define RC_MAP_REAL_AUDIO_220_32_KEYS    "rc-real-audio-220-32-keys"
>  #define RC_MAP_REDDO                     "rc-reddo"
>  #define RC_MAP_SNAPSTREAM_FIREFLY        "rc-snapstream-firefly"
> +#define RC_MAP_SNAZIO_TVPVR_PRO          "rc-snazio-tvpvr-pro"
>  #define RC_MAP_STREAMZAP                 "rc-streamzap"
>  #define RC_MAP_TBS_NEC                   "rc-tbs-nec"
>  #define RC_MAP_TECHNISAT_USB2            "rc-technisat-usb2"
> --
> 1.9.rc1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] saa7134: Add support for SnaZio TvPVR PRO
@ 2014-02-09 16:11 POJAR GEORGE
  0 siblings, 0 replies; 10+ messages in thread
From: POJAR GEORGE @ 2014-02-09 16:11 UTC (permalink / raw)
  To: git; +Cc: POJAR GEORGE

From: POJAR GEORGE <geoubuntu@gmail.com>

Signed-off-by: POJAR GEORGE <geoubuntu@gmail.com>
---
 Documentation/video4linux/CARDLIST.saa7134     |   1 +
 drivers/media/pci/saa7134/saa7134-cards.c      |  51 ++++++++++-
 drivers/media/pci/saa7134/saa7134-input.c      |  62 +++++++++++++
 drivers/media/pci/saa7134/saa7134.h            |   1 +
 drivers/media/rc/keymaps/Makefile              |   1 +
 drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c | 116 +++++++++++++++++++++++++
 include/media/rc-map.h                         |   1 +
 7 files changed, 232 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c

diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
index 8df17d0..32e4353 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -191,3 +191,4 @@
 190 -> Asus My Cinema PS3-100                   [1043:48cd]
 191 -> Hawell HW-9004V1
 192 -> AverMedia AverTV Satellite Hybrid+FM A706 [1461:2055]
+193 -> SnaZio TvPVR PRO                         [0x1779:0x13cf,0x1779:0x13d0,0x1779:0x13d1]
diff --git a/drivers/media/pci/saa7134/saa7134-cards.c b/drivers/media/pci/saa7134/saa7134-cards.c
index d45e7f6..3476785 100644
--- a/drivers/media/pci/saa7134/saa7134-cards.c
+++ b/drivers/media/pci/saa7134/saa7134-cards.c
@@ -5827,7 +5827,37 @@ struct saa7134_board saa7134_boards[] = {
 			.gpio = 0x0000800,
 		},
 	},
-
+	[SAA7134_BOARD_SNAZIO_TVPVR_PRO] = {
+		.name           = "SnaZio TvPVR PRO",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_PHILIPS_TDA8290,
+		.radio_type     = UNSET,
+		.tuner_addr     = ADDR_UNSET,
+		.radio_addr     = ADDR_UNSET,
+		.gpiomask       = 1 << 21,
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+			.gpio = 0x0000000,
+			.tv   = 1,
+		}, {
+			.name = name_comp1,     /* Composite input */
+			.vmux = 3,
+			.amux = LINE2,
+			.gpio = 0x0000000,
+		}, {
+			.name = name_svideo,    /* S-Video input */
+			.vmux = 8,
+			.amux = LINE2,
+			.gpio = 0x0000000,
+		} },
+		.radio = {
+			.name = name_radio,
+			.amux = TV,
+			.gpio = 0x0200000,
+		},
+	},
 };
 
 const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -7080,6 +7110,24 @@ struct pci_device_id saa7134_pci_tbl[] = {
 		.subdevice    = 0x2055, /* AverTV Satellite Hybrid+FM A706 */
 		.driver_data  = SAA7134_BOARD_AVERMEDIA_A706,
 	}, {
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+		.subvendor    = 0x1779,
+		.subdevice    = 0x13cf,
+		.driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+	}, {
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+		.subvendor    = 0x1779,
+		.subdevice    = 0x13d0,
+		.driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+	}, {
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+		.subvendor    = 0x1779,
+		.subdevice    = 0x13d1,
+		.driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+	}, {
 		/* --- boards without eeprom + subsystem ID --- */
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -7608,6 +7656,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
 	case SAA7134_BOARD_BEHOLD_H7:
 	case SAA7134_BOARD_BEHOLD_A7:
 	case SAA7134_BOARD_KWORLD_PC150U:
+	case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
 		dev->has_remote = SAA7134_REMOTE_I2C;
 		break;
 	case SAA7134_BOARD_AVERMEDIA_A169_B:
diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c
index 6f43126..62ccc7d 100644
--- a/drivers/media/pci/saa7134/saa7134-input.c
+++ b/drivers/media/pci/saa7134/saa7134-input.c
@@ -416,6 +416,53 @@ static int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
 	return get_key_pinnacle(ir, ir_key, ir_raw, 2, 0x80, 0x88);
 }
 
+/* copied and modified from get_key_msi_tvanywhere_plus() */
+static int get_key_snazio_tvpvr_pro(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+	unsigned char b;
+	unsigned int gpio;
+
+	/* <dev> is needed to access GPIO. Used by the saa_readl macro. */
+	struct saa7134_dev *dev = ir->c->adapter->algo_data;
+	if (dev == NULL) {
+		i2cdprintk("get_key_snazio_tvpvr_pro: "
+			   "ir->c->adapter->algo_data is NULL!\n");
+		return -EIO;
+	}
+
+	/* rising SAA7134_GPIO_GPRESCAN reads the status */
+
+	saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
+	saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
+
+	gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
+
+	/* GPIO&0x100 is pulsed low when a button is pressed. Don't do
+	   I2C receive if gpio&0x100 is not low. */
+
+	if (gpio & 0x100)
+		return 0;       /* No button press */
+
+	/* GPIO says there is a button press. Get it. */
+
+	if (1 != i2c_master_recv(ir->c, &b, 1)) {
+		i2cdprintk("read error\n");
+		return -EIO;
+	}
+
+	/* No button press */
+
+	if (b == 0xff)
+		return 0;
+
+	/* Button pressed */
+
+	dprintk("get_key_snazio_tvpvr_pro: Key = 0x%02X\n", b);
+	*ir_key = b;
+	*ir_raw = b;
+	return 1;
+}
+
 void saa7134_input_irq(struct saa7134_dev *dev)
 {
 	struct saa7134_card_ir *ir;
@@ -1006,6 +1053,21 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
 		dev->init_data.ir_codes = RC_MAP_FLYDVB;
 		info.addr = 0x0b;
 		break;
+	case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
+		/* copied and modified from MSI TV@nywhere Plus */
+		dev->init_data.name = "SnaZio TvPVR PRO";
+		dev->init_data.get_key = get_key_snazio_tvpvr_pro;
+		dev->init_data.ir_codes = RC_MAP_SNAZIO_TVPVR_PRO;
+		info.addr = 0x30;
+		/* MSI TV@nywhere Plus controller doesn't seem to
+		   respond to probes unless we read something from
+		   an existing device. Weird...
+		   REVISIT: might no longer be needed */
+		rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1);
+		dprintk("probe 0x%02x @ %s: %s\n",
+			msg_msi.addr, dev->i2c_adap.name,
+			(1 == rc) ? "yes" : "no");
+		break;
 	default:
 		dprintk("No I2C IR support for board %x\n", dev->board);
 		return;
diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h
index 2474e84..28b083f 100644
--- a/drivers/media/pci/saa7134/saa7134.h
+++ b/drivers/media/pci/saa7134/saa7134.h
@@ -338,6 +338,7 @@ struct saa7134_card_ir {
 #define SAA7134_BOARD_ASUSTeK_PS3_100      190
 #define SAA7134_BOARD_HAWELL_HW_9004V1      191
 #define SAA7134_BOARD_AVERMEDIA_A706		192
+#define SAA7134_BOARD_SNAZIO_TVPVR_PRO      193
 
 #define SAA7134_MAXBOARDS 32
 #define SAA7134_INPUT_MAX 8
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index 0b8c549..72b2e45 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -81,6 +81,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
 			rc-real-audio-220-32-keys.o \
 			rc-reddo.o \
 			rc-snapstream-firefly.o \
+			rc-snazio-tvpvr-pro.o \
 			rc-streamzap.o \
 			rc-tbs-nec.o \
 			rc-technisat-usb2.o \
diff --git a/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
new file mode 100644
index 0000000..127350e
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
@@ -0,0 +1,116 @@
+/* rc-snazio-tvpvr-pro.h - Keytable for snazio_tvpvr_pro Remote Controller
+ *
+ * keymap imported from ir-keymaps.c
+ *
+ * Copyright (c) 2010 by Mauro Carvalho Chehab
+ * Copyright (c) 2010 by POJAR GEORGE <geoubuntu@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+/*
+  Keycodes for remote on the SnaZio TvPVR PRO.
+  POJAR GEORGE <geoubuntu@gmail.com>
+*/
+
+static struct rc_map_table snazio_tvpvr_pro[] = {
+
+/*  ---- Remote Button Layout ----
+
+    POWER   SOURCE  SCAN    MUTE
+    TV/FM   1       2       3
+    |>      4       5       6
+    <|      7       8       9
+    ^^UP    0       +       RECALL
+    vvDN    RECORD  STOP    PLAY
+
+	MINIMIZE          ZOOM
+
+		  CH+
+      VOL-                   VOL+
+		  CH-
+
+	SNAPSHOT           MTS
+
+     <<      FUNC    >>     RESET
+*/
+
+	{ 0x01, KEY_1 },		/* 1 */
+	{ 0x0b, KEY_2 },		/* 2 */
+	{ 0x1b, KEY_3 },		/* 3 */
+	{ 0x05, KEY_4 },		/* 4 */
+	{ 0x09, KEY_5 },		/* 5 */
+	{ 0x15, KEY_6 },		/* 6 */
+	{ 0x06, KEY_7 },		/* 7 */
+	{ 0x0a, KEY_8 },		/* 8 */
+	{ 0x12, KEY_9 },		/* 9 */
+	{ 0x02, KEY_0 },		/* 0 */
+	{ 0x10, KEY_KPPLUS },		/* + */
+	{ 0x13, KEY_AGAIN },		/* Recall */
+
+	{ 0x1e, KEY_POWER },		/* Power */
+	{ 0x07, KEY_VIDEO },		/* Source */
+	{ 0x1c, KEY_SEARCH },		/* Scan */
+	{ 0x18, KEY_MUTE },		/* Mute */
+
+	{ 0x03, KEY_RADIO },		/* TV/FM */
+	/* The next four keys are duplicates that appear to send the
+	   same IR code as Ch+, Ch-, >>, and << .  The raw code assigned
+	   to them is the actual code + 0x20 - they will never be
+	   detected as such unless some way is discovered to distinguish
+	   these buttons from those that have the same code. */
+	{ 0x3f, KEY_RIGHT },		/* |> and Ch+ */
+	{ 0x37, KEY_LEFT },		/* <| and Ch- */
+	{ 0x2c, KEY_UP },		/* ^^Up and >> */
+	{ 0x24, KEY_DOWN },		/* vvDn and << */
+
+	{ 0x00, KEY_RECORD },		/* Record */
+	{ 0x08, KEY_STOP },		/* Stop */
+	{ 0x11, KEY_PLAY },		/* Play */
+
+	{ 0x0f, KEY_CLOSE },		/* Minimize */
+	{ 0x19, KEY_ZOOM },		/* Zoom */
+	{ 0x1a, KEY_CAMERA },		/* Snapshot */
+	{ 0x0d, KEY_LANGUAGE },		/* MTS */
+
+	{ 0x14, KEY_VOLUMEDOWN },	/* Vol- */
+	{ 0x16, KEY_VOLUMEUP },		/* Vol+ */
+	{ 0x17, KEY_CHANNELDOWN },	/* Ch- */
+	{ 0x1f, KEY_CHANNELUP },	/* Ch+ */
+
+	{ 0x04, KEY_REWIND },		/* << */
+	{ 0x0e, KEY_MENU },		/* Function */
+	{ 0x0c, KEY_FASTFORWARD },	/* >> */
+	{ 0x1d, KEY_RESTART },		/* Reset */
+};
+
+static struct rc_map_list snazio_tvpvr_pro_map = {
+	.map = {
+		.scan    = snazio_tvpvr_pro,
+		.size    = ARRAY_SIZE(snazio_tvpvr_pro),
+		.rc_type = RC_TYPE_UNKNOWN,	/* Legacy IR type */
+		.name    = RC_MAP_SNAZIO_TVPVR_PRO,
+	}
+};
+
+static int int __init init_rc_map_snazio_tvpvr_pro(void)
+{
+	return rc_map_register(&snazio_tvpvr_pro_map);
+}
+
+static void __exit exit_rc_map_snazio_tvpvr_pro(void)
+{
+	rc_map_unregister(&snazio_tvpvr_pro_map);
+}
+
+module_init(init_rc_map_snazio_tvpvr_pro)
+module_exit(exit_rc_map_snazio_tvpvr_pro)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("POJAR GEORGE <geoubuntu@gmail.com>");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index e5aa240..b802af4 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -177,6 +177,7 @@ void rc_map_init(void);
 #define RC_MAP_REAL_AUDIO_220_32_KEYS    "rc-real-audio-220-32-keys"
 #define RC_MAP_REDDO                     "rc-reddo"
 #define RC_MAP_SNAPSTREAM_FIREFLY        "rc-snapstream-firefly"
+#define RC_MAP_SNAZIO_TVPVR_PRO          "rc-snazio-tvpvr-pro"
 #define RC_MAP_STREAMZAP                 "rc-streamzap"
 #define RC_MAP_TBS_NEC                   "rc-tbs-nec"
 #define RC_MAP_TECHNISAT_USB2            "rc-technisat-usb2"
-- 
1.9.rc1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] saa7134: Add support for SnaZio TvPVR PRO
@ 2014-02-09 16:06 POJAR GEORGE
  2014-02-09 16:29 ` Anca Emanuel
  0 siblings, 1 reply; 10+ messages in thread
From: POJAR GEORGE @ 2014-02-09 16:06 UTC (permalink / raw)
  To: linux-media; +Cc: POJAR GEORGE

From: POJAR GEORGE <geoubuntu@gmail.com>

Signed-off-by: POJAR GEORGE <geoubuntu@gmail.com>
---
 Documentation/video4linux/CARDLIST.saa7134     |   1 +
 drivers/media/pci/saa7134/saa7134-cards.c      |  51 ++++++++++-
 drivers/media/pci/saa7134/saa7134-input.c      |  62 +++++++++++++
 drivers/media/pci/saa7134/saa7134.h            |   1 +
 drivers/media/rc/keymaps/Makefile              |   1 +
 drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c | 116 +++++++++++++++++++++++++
 include/media/rc-map.h                         |   1 +
 7 files changed, 232 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c

diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
index 8df17d0..32e4353 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -191,3 +191,4 @@
 190 -> Asus My Cinema PS3-100                   [1043:48cd]
 191 -> Hawell HW-9004V1
 192 -> AverMedia AverTV Satellite Hybrid+FM A706 [1461:2055]
+193 -> SnaZio TvPVR PRO                         [0x1779:0x13cf,0x1779:0x13d0,0x1779:0x13d1]
diff --git a/drivers/media/pci/saa7134/saa7134-cards.c b/drivers/media/pci/saa7134/saa7134-cards.c
index d45e7f6..3476785 100644
--- a/drivers/media/pci/saa7134/saa7134-cards.c
+++ b/drivers/media/pci/saa7134/saa7134-cards.c
@@ -5827,7 +5827,37 @@ struct saa7134_board saa7134_boards[] = {
 			.gpio = 0x0000800,
 		},
 	},
-
+	[SAA7134_BOARD_SNAZIO_TVPVR_PRO] = {
+		.name           = "SnaZio TvPVR PRO",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_PHILIPS_TDA8290,
+		.radio_type     = UNSET,
+		.tuner_addr     = ADDR_UNSET,
+		.radio_addr     = ADDR_UNSET,
+		.gpiomask       = 1 << 21,
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+			.gpio = 0x0000000,
+			.tv   = 1,
+		}, {
+			.name = name_comp1,     /* Composite input */
+			.vmux = 3,
+			.amux = LINE2,
+			.gpio = 0x0000000,
+		}, {
+			.name = name_svideo,    /* S-Video input */
+			.vmux = 8,
+			.amux = LINE2,
+			.gpio = 0x0000000,
+		} },
+		.radio = {
+			.name = name_radio,
+			.amux = TV,
+			.gpio = 0x0200000,
+		},
+	},
 };
 
 const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -7080,6 +7110,24 @@ struct pci_device_id saa7134_pci_tbl[] = {
 		.subdevice    = 0x2055, /* AverTV Satellite Hybrid+FM A706 */
 		.driver_data  = SAA7134_BOARD_AVERMEDIA_A706,
 	}, {
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+		.subvendor    = 0x1779,
+		.subdevice    = 0x13cf,
+		.driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+	}, {
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+		.subvendor    = 0x1779,
+		.subdevice    = 0x13d0,
+		.driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+	}, {
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+		.subvendor    = 0x1779,
+		.subdevice    = 0x13d1,
+		.driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+	}, {
 		/* --- boards without eeprom + subsystem ID --- */
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -7608,6 +7656,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
 	case SAA7134_BOARD_BEHOLD_H7:
 	case SAA7134_BOARD_BEHOLD_A7:
 	case SAA7134_BOARD_KWORLD_PC150U:
+	case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
 		dev->has_remote = SAA7134_REMOTE_I2C;
 		break;
 	case SAA7134_BOARD_AVERMEDIA_A169_B:
diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c
index 6f43126..62ccc7d 100644
--- a/drivers/media/pci/saa7134/saa7134-input.c
+++ b/drivers/media/pci/saa7134/saa7134-input.c
@@ -416,6 +416,53 @@ static int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
 	return get_key_pinnacle(ir, ir_key, ir_raw, 2, 0x80, 0x88);
 }
 
+/* copied and modified from get_key_msi_tvanywhere_plus() */
+static int get_key_snazio_tvpvr_pro(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+	unsigned char b;
+	unsigned int gpio;
+
+	/* <dev> is needed to access GPIO. Used by the saa_readl macro. */
+	struct saa7134_dev *dev = ir->c->adapter->algo_data;
+	if (dev == NULL) {
+		i2cdprintk("get_key_snazio_tvpvr_pro: "
+			   "ir->c->adapter->algo_data is NULL!\n");
+		return -EIO;
+	}
+
+	/* rising SAA7134_GPIO_GPRESCAN reads the status */
+
+	saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
+	saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
+
+	gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
+
+	/* GPIO&0x100 is pulsed low when a button is pressed. Don't do
+	   I2C receive if gpio&0x100 is not low. */
+
+	if (gpio & 0x100)
+		return 0;       /* No button press */
+
+	/* GPIO says there is a button press. Get it. */
+
+	if (1 != i2c_master_recv(ir->c, &b, 1)) {
+		i2cdprintk("read error\n");
+		return -EIO;
+	}
+
+	/* No button press */
+
+	if (b == 0xff)
+		return 0;
+
+	/* Button pressed */
+
+	dprintk("get_key_snazio_tvpvr_pro: Key = 0x%02X\n", b);
+	*ir_key = b;
+	*ir_raw = b;
+	return 1;
+}
+
 void saa7134_input_irq(struct saa7134_dev *dev)
 {
 	struct saa7134_card_ir *ir;
@@ -1006,6 +1053,21 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
 		dev->init_data.ir_codes = RC_MAP_FLYDVB;
 		info.addr = 0x0b;
 		break;
+	case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
+		/* copied and modified from MSI TV@nywhere Plus */
+		dev->init_data.name = "SnaZio TvPVR PRO";
+		dev->init_data.get_key = get_key_snazio_tvpvr_pro;
+		dev->init_data.ir_codes = RC_MAP_SNAZIO_TVPVR_PRO;
+		info.addr = 0x30;
+		/* MSI TV@nywhere Plus controller doesn't seem to
+		   respond to probes unless we read something from
+		   an existing device. Weird...
+		   REVISIT: might no longer be needed */
+		rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1);
+		dprintk("probe 0x%02x @ %s: %s\n",
+			msg_msi.addr, dev->i2c_adap.name,
+			(1 == rc) ? "yes" : "no");
+		break;
 	default:
 		dprintk("No I2C IR support for board %x\n", dev->board);
 		return;
diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h
index 2474e84..28b083f 100644
--- a/drivers/media/pci/saa7134/saa7134.h
+++ b/drivers/media/pci/saa7134/saa7134.h
@@ -338,6 +338,7 @@ struct saa7134_card_ir {
 #define SAA7134_BOARD_ASUSTeK_PS3_100      190
 #define SAA7134_BOARD_HAWELL_HW_9004V1      191
 #define SAA7134_BOARD_AVERMEDIA_A706		192
+#define SAA7134_BOARD_SNAZIO_TVPVR_PRO      193
 
 #define SAA7134_MAXBOARDS 32
 #define SAA7134_INPUT_MAX 8
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index 0b8c549..72b2e45 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -81,6 +81,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
 			rc-real-audio-220-32-keys.o \
 			rc-reddo.o \
 			rc-snapstream-firefly.o \
+			rc-snazio-tvpvr-pro.o \
 			rc-streamzap.o \
 			rc-tbs-nec.o \
 			rc-technisat-usb2.o \
diff --git a/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
new file mode 100644
index 0000000..127350e
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
@@ -0,0 +1,116 @@
+/* rc-snazio-tvpvr-pro.h - Keytable for snazio_tvpvr_pro Remote Controller
+ *
+ * keymap imported from ir-keymaps.c
+ *
+ * Copyright (c) 2010 by Mauro Carvalho Chehab
+ * Copyright (c) 2010 by POJAR GEORGE <geoubuntu@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+/*
+  Keycodes for remote on the SnaZio TvPVR PRO.
+  POJAR GEORGE <geoubuntu@gmail.com>
+*/
+
+static struct rc_map_table snazio_tvpvr_pro[] = {
+
+/*  ---- Remote Button Layout ----
+
+    POWER   SOURCE  SCAN    MUTE
+    TV/FM   1       2       3
+    |>      4       5       6
+    <|      7       8       9
+    ^^UP    0       +       RECALL
+    vvDN    RECORD  STOP    PLAY
+
+	MINIMIZE          ZOOM
+
+		  CH+
+      VOL-                   VOL+
+		  CH-
+
+	SNAPSHOT           MTS
+
+     <<      FUNC    >>     RESET
+*/
+
+	{ 0x01, KEY_1 },		/* 1 */
+	{ 0x0b, KEY_2 },		/* 2 */
+	{ 0x1b, KEY_3 },		/* 3 */
+	{ 0x05, KEY_4 },		/* 4 */
+	{ 0x09, KEY_5 },		/* 5 */
+	{ 0x15, KEY_6 },		/* 6 */
+	{ 0x06, KEY_7 },		/* 7 */
+	{ 0x0a, KEY_8 },		/* 8 */
+	{ 0x12, KEY_9 },		/* 9 */
+	{ 0x02, KEY_0 },		/* 0 */
+	{ 0x10, KEY_KPPLUS },		/* + */
+	{ 0x13, KEY_AGAIN },		/* Recall */
+
+	{ 0x1e, KEY_POWER },		/* Power */
+	{ 0x07, KEY_VIDEO },		/* Source */
+	{ 0x1c, KEY_SEARCH },		/* Scan */
+	{ 0x18, KEY_MUTE },		/* Mute */
+
+	{ 0x03, KEY_RADIO },		/* TV/FM */
+	/* The next four keys are duplicates that appear to send the
+	   same IR code as Ch+, Ch-, >>, and << .  The raw code assigned
+	   to them is the actual code + 0x20 - they will never be
+	   detected as such unless some way is discovered to distinguish
+	   these buttons from those that have the same code. */
+	{ 0x3f, KEY_RIGHT },		/* |> and Ch+ */
+	{ 0x37, KEY_LEFT },		/* <| and Ch- */
+	{ 0x2c, KEY_UP },		/* ^^Up and >> */
+	{ 0x24, KEY_DOWN },		/* vvDn and << */
+
+	{ 0x00, KEY_RECORD },		/* Record */
+	{ 0x08, KEY_STOP },		/* Stop */
+	{ 0x11, KEY_PLAY },		/* Play */
+
+	{ 0x0f, KEY_CLOSE },		/* Minimize */
+	{ 0x19, KEY_ZOOM },		/* Zoom */
+	{ 0x1a, KEY_CAMERA },		/* Snapshot */
+	{ 0x0d, KEY_LANGUAGE },		/* MTS */
+
+	{ 0x14, KEY_VOLUMEDOWN },	/* Vol- */
+	{ 0x16, KEY_VOLUMEUP },		/* Vol+ */
+	{ 0x17, KEY_CHANNELDOWN },	/* Ch- */
+	{ 0x1f, KEY_CHANNELUP },	/* Ch+ */
+
+	{ 0x04, KEY_REWIND },		/* << */
+	{ 0x0e, KEY_MENU },		/* Function */
+	{ 0x0c, KEY_FASTFORWARD },	/* >> */
+	{ 0x1d, KEY_RESTART },		/* Reset */
+};
+
+static struct rc_map_list snazio_tvpvr_pro_map = {
+	.map = {
+		.scan    = snazio_tvpvr_pro,
+		.size    = ARRAY_SIZE(snazio_tvpvr_pro),
+		.rc_type = RC_TYPE_UNKNOWN,	/* Legacy IR type */
+		.name    = RC_MAP_SNAZIO_TVPVR_PRO,
+	}
+};
+
+static int int __init init_rc_map_snazio_tvpvr_pro(void)
+{
+	return rc_map_register(&snazio_tvpvr_pro_map);
+}
+
+static void __exit exit_rc_map_snazio_tvpvr_pro(void)
+{
+	rc_map_unregister(&snazio_tvpvr_pro_map);
+}
+
+module_init(init_rc_map_snazio_tvpvr_pro)
+module_exit(exit_rc_map_snazio_tvpvr_pro)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("POJAR GEORGE <geoubuntu@gmail.com>");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index e5aa240..b802af4 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -177,6 +177,7 @@ void rc_map_init(void);
 #define RC_MAP_REAL_AUDIO_220_32_KEYS    "rc-real-audio-220-32-keys"
 #define RC_MAP_REDDO                     "rc-reddo"
 #define RC_MAP_SNAPSTREAM_FIREFLY        "rc-snapstream-firefly"
+#define RC_MAP_SNAZIO_TVPVR_PRO          "rc-snazio-tvpvr-pro"
 #define RC_MAP_STREAMZAP                 "rc-streamzap"
 #define RC_MAP_TBS_NEC                   "rc-tbs-nec"
 #define RC_MAP_TECHNISAT_USB2            "rc-technisat-usb2"
-- 
1.9.rc1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] saa7134: Add support for Snazio TvPVR PRO
@ 2014-02-08 19:12 GEORGE
  0 siblings, 0 replies; 10+ messages in thread
From: GEORGE @ 2014-02-08 19:12 UTC (permalink / raw)
  To: linux-media

 From 6eb8ed397f724499b4439426bec98ab7e1cd588e Mon Sep 17 00:00:00 2001
From: POJAR GEORGE <geoubuntu@gmail.com>
Date: Sat, 8 Feb 2014 20:46:35 +0200
Subject: [PATCH] saa7134: Add support for Snazio TvPVR PRO

Signed-off-by: POJAR GEORGE <geoubuntu@gmail.com>
---
  Documentation/video4linux/CARDLIST.saa7134     |   1 +
  drivers/media/pci/saa7134/saa7134-cards.c      |  50 +++++++++++
  drivers/media/pci/saa7134/saa7134-input.c      |  64 ++++++++++++++
  drivers/media/pci/saa7134/saa7134.h            |   1 +
  drivers/media/rc/keymaps/Makefile              |   1 +
  drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c | 111 
+++++++++++++++++++++++++
  include/media/rc-map.h                         |   1 +
  7 files changed, 229 insertions(+)
  create mode 100644 drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c

diff --git a/Documentation/video4linux/CARDLIST.saa7134 
b/Documentation/video4linux/CARDLIST.saa7134
index 8df17d0..32e4353 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -191,3 +191,4 @@
  190 -> Asus My Cinema PS3-100                   [1043:48cd]
  191 -> Hawell HW-9004V1
  192 -> AverMedia AverTV Satellite Hybrid+FM A706 [1461:2055]
+193 -> SnaZio TvPVR PRO [0x1779:0x13cf,0x1779:0x13d0,0x1779:0x13d1]
diff --git a/drivers/media/pci/saa7134/saa7134-cards.c 
b/drivers/media/pci/saa7134/saa7134-cards.c
index d45e7f6..795f0a9 100644
--- a/drivers/media/pci/saa7134/saa7134-cards.c
+++ b/drivers/media/pci/saa7134/saa7134-cards.c
@@ -5827,6 +5827,37 @@ struct saa7134_board saa7134_boards[] = {
              .gpio = 0x0000800,
          },
      },
+    [SAA7134_BOARD_SNAZIO_TVPVR_PRO] = {
+        .name           = "SnaZio TvPVR PRO",
+        .audio_clock    = 0x00187de7,
+        .tuner_type     = TUNER_PHILIPS_TDA8290,
+        .radio_type     = UNSET,
+        .tuner_addr     = ADDR_UNSET,
+        .radio_addr     = ADDR_UNSET,
+        .gpiomask       = 1 << 21,
+        .inputs         = {{
+            .name = name_tv,
+            .vmux = 1,
+            .amux = TV,
+            .gpio = 0x0000000,
+            .tv   = 1,
+        }, {
+            .name = name_comp1,     /* Composite input */
+            .vmux = 3,
+            .amux = LINE2,
+            .gpio = 0x0000000,
+        }, {
+            .name = name_svideo,    /* S-Video input */
+            .vmux = 8,
+            .amux = LINE2,
+            .gpio = 0x0000000,
+        } },
+        .radio = {
+            .name = name_radio,
+            .amux = TV,
+            .gpio = 0x0200000,
+        },
+    },

  };

@@ -7080,6 +7111,24 @@ struct pci_device_id saa7134_pci_tbl[] = {
          .subdevice    = 0x2055, /* AverTV Satellite Hybrid+FM A706 */
          .driver_data  = SAA7134_BOARD_AVERMEDIA_A706,
      }, {
+        .vendor       = PCI_VENDOR_ID_PHILIPS,
+        .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+        .subvendor    = 0x1779,
+        .subdevice    = 0x13cf,
+        .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+    }, {
+        .vendor       = PCI_VENDOR_ID_PHILIPS,
+        .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+        .subvendor    = 0x1779,
+        .subdevice    = 0x13d0,
+        .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+    }, {
+        .vendor       = PCI_VENDOR_ID_PHILIPS,
+        .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+        .subvendor    = 0x1779,
+        .subdevice    = 0x13d1,
+        .driver_data  = SAA7134_BOARD_SNAZIO_TVPVR_PRO,
+    }, {
          /* --- boards without eeprom + subsystem ID --- */
          .vendor       = PCI_VENDOR_ID_PHILIPS,
          .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -7608,6 +7657,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
      case SAA7134_BOARD_BEHOLD_H7:
      case SAA7134_BOARD_BEHOLD_A7:
      case SAA7134_BOARD_KWORLD_PC150U:
+    case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
          dev->has_remote = SAA7134_REMOTE_I2C;
          break;
      case SAA7134_BOARD_AVERMEDIA_A169_B:
diff --git a/drivers/media/pci/saa7134/saa7134-input.c 
b/drivers/media/pci/saa7134/saa7134-input.c
index 6f43126..ade29f6 100644
--- a/drivers/media/pci/saa7134/saa7134-input.c
+++ b/drivers/media/pci/saa7134/saa7134-input.c
@@ -416,6 +416,54 @@ static int get_key_pinnacle_color(struct IR_i2c 
*ir, u32 *ir_key, u32 *ir_raw)
      return get_key_pinnacle(ir, ir_key, ir_raw, 2, 0x80, 0x88);
  }

+/* copied and modified from get_key_msi_tvanywhere_plus() */
+static int get_key_snazio_tvpvr_pro(struct IR_i2c *ir, u32 *ir_key,
+                       u32 *ir_raw)
+{
+    unsigned char b;
+    int gpio;
+
+    /* <dev> is needed to access GPIO. Used by the saa_readl macro. */
+    struct saa7134_dev *dev = ir->c->adapter->algo_data;
+    if (dev == NULL) {
+        i2cdprintk("get_key_snazio_tvpvr_pro: "
+               "ir->c->adapter->algo_data is NULL!\n");
+        return -EIO;
+    }
+
+    /* rising SAA7134_GPIO_GPRESCAN reads the status */
+
+    saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
+    saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
+
+    gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
+
+    /* GPIO&0x40 is pulsed low when a button is pressed. Don't do
+       I2C receive if gpio&0x40 is not low. */
+
+    if (gpio & 0x40)
+        return 0;       /* No button press */
+
+    /* GPIO says there is a button press. Get it. */
+
+    if (1 != i2c_master_recv(ir->c, &b, 1)) {
+        i2cdprintk("read error\n");
+        return -EIO;
+    }
+
+    /* No button press */
+
+    if (b == 0xff)
+        return 0;
+
+    /* Button pressed */
+
+    dprintk("get_key_snazio_tvpvr_pro: Key = 0x%02X\n", b);
+    *ir_key = b;
+    *ir_raw = b;
+    return 1;
+}
+
  void saa7134_input_irq(struct saa7134_dev *dev)
  {
      struct saa7134_card_ir *ir;
@@ -1006,6 +1054,22 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
          dev->init_data.ir_codes = RC_MAP_FLYDVB;
          info.addr = 0x0b;
          break;
+    case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
+        /* copied and modified from MSI TV@nywhere Plus */
+        dev->init_data.name = "SnaZio TvPVR PRO";
+        dev->init_data.get_key = get_key_snazio_tvpvr_pro;
+        dev->init_data.ir_codes = RC_MAP_SNAZIO_TVPVR_PRO;
+        dev->init_data.polling_interval = 50;
+        info.addr = 0x30;
+        /* MSI TV@nywhere Plus controller doesn't seem to
+           respond to probes unless we read something from
+           an existing device. Weird...
+           REVISIT: might no longer be needed */
+        rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1);
+        dprintk("probe 0x%02x @ %s: %s\n",
+            msg_msi.addr, dev->i2c_adap.name,
+            (1 == rc) ? "yes" : "no");
+        break;
      default:
          dprintk("No I2C IR support for board %x\n", dev->board);
          return;
diff --git a/drivers/media/pci/saa7134/saa7134.h 
b/drivers/media/pci/saa7134/saa7134.h
index 2474e84..28b083f 100644
--- a/drivers/media/pci/saa7134/saa7134.h
+++ b/drivers/media/pci/saa7134/saa7134.h
@@ -338,6 +338,7 @@ struct saa7134_card_ir {
  #define SAA7134_BOARD_ASUSTeK_PS3_100      190
  #define SAA7134_BOARD_HAWELL_HW_9004V1      191
  #define SAA7134_BOARD_AVERMEDIA_A706        192
+#define SAA7134_BOARD_SNAZIO_TVPVR_PRO      193

  #define SAA7134_MAXBOARDS 32
  #define SAA7134_INPUT_MAX 8
diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index 0b8c549..72b2e45 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -81,6 +81,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
              rc-real-audio-220-32-keys.o \
              rc-reddo.o \
              rc-snapstream-firefly.o \
+            rc-snazio-tvpvr-pro.o \
              rc-streamzap.o \
              rc-tbs-nec.o \
              rc-technisat-usb2.o \
diff --git a/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c 
b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
new file mode 100644
index 0000000..08b96d7
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-snazio-tvpvr-pro.c
@@ -0,0 +1,111 @@
+/* rc-snazio-tvpvr-pro.h - Keytable for snazio_tvpvr_pro Remote Controller
+ *
+ * keymap imported from ir-keymaps.c
+ *
+ * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+/*
+  Keycodes for remote on the SnaZio TvPVR PRO.
+  POJAR GEORGE <geoubuntu@gmail.com>
+*/
+
+static struct rc_map_table snazio_tvpvr_pro[] = {
+
+/*  ---- Remote Button Layout ----
+
+    POWER   SOURCE  SCAN    MUTE
+    TV/FM   1       2       3
+    |>      4       5       6
+    <|      7       8       9
+    ^^UP    0       +       RECALL
+    vvDN    RECORD  STOP    PLAY
+
+    MINIMIZE          ZOOM
+
+          CH+
+      VOL-                   VOL+
+          CH-
+
+    SNAPSHOT           MTS
+
+     <<      FUNC    >>     RESET
+*/
+
+    { 0x01, KEY_1 },        /* 1 */
+    { 0x0b, KEY_2 },        /* 2 */
+    { 0x1b, KEY_3 },        /* 3 */
+    { 0x05, KEY_4 },        /* 4 */
+    { 0x09, KEY_5 },        /* 5 */
+    { 0x15, KEY_6 },        /* 6 */
+    { 0x06, KEY_7 },        /* 7 */
+    { 0x0a, KEY_8 },        /* 8 */
+    { 0x12, KEY_9 },        /* 9 */
+    { 0x02, KEY_0 },        /* 0 */
+    { 0x10, KEY_KPPLUS },        /* + */
+    { 0x13, KEY_AGAIN },        /* Recall */
+
+    { 0x1e, KEY_POWER },        /* Power */
+    { 0x07, KEY_VIDEO },        /* Source */
+    { 0x1c, KEY_SEARCH },        /* Scan */
+    { 0x18, KEY_MUTE },        /* Mute */
+
+    { 0x03, KEY_RADIO },        /* TV/FM */
+
+    { 0x3f, KEY_RIGHT },        /* |> and Ch+ */
+    { 0x37, KEY_LEFT },        /* <| and Ch- */
+    { 0x2c, KEY_UP },        /* ^^Up and >> */
+    { 0x24, KEY_DOWN },        /* vvDn and << */
+
+    { 0x00, KEY_RECORD },        /* Record */
+    { 0x08, KEY_STOP },        /* Stop */
+    { 0x11, KEY_PLAY },        /* Play */
+
+    { 0x0f, KEY_CLOSE },        /* Minimize */
+    { 0x19, KEY_ZOOM },        /* Zoom */
+    { 0x1a, KEY_CAMERA },        /* Snapshot */
+    { 0x0d, KEY_LANGUAGE },        /* MTS */
+
+    { 0x14, KEY_VOLUMEDOWN },    /* Vol- */
+    { 0x16, KEY_VOLUMEUP },        /* Vol+ */
+    { 0x17, KEY_CHANNELDOWN },    /* Ch- */
+    { 0x1f, KEY_CHANNELUP },    /* Ch+ */
+
+    { 0x04, KEY_REWIND },        /* << */
+    { 0x0e, KEY_MENU },        /* Function */
+    { 0x0c, KEY_FASTFORWARD },    /* >> */
+    { 0x1d, KEY_RESTART },        /* Reset */
+};
+
+static struct rc_map_list snazio_tvpvr_pro_map = {
+    .map = {
+        .scan    = snazio_tvpvr_pro,
+        .size    = ARRAY_SIZE(snazio_tvpvr_pro),
+        .rc_type = RC_TYPE_UNKNOWN,
+        .name    = RC_MAP_SNAZIO_TVPVR_PRO,
+    }
+};
+
+static int __init init_rc_map_snazio_tvpvr_pro(void)
+{
+    return rc_map_register(&snazio_tvpvr_pro_map);
+}
+
+static void __exit exit_rc_map_snazio_tvpvr_pro(void)
+{
+    rc_map_unregister(&snazio_tvpvr_pro_map);
+}
+
+module_init(init_rc_map_snazio_tvpvr_pro)
+module_exit(exit_rc_map_snazio_tvpvr_pro)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("POJAR GEORGE <geoubuntu@gmail.com>");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index e5aa240..b802af4 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -177,6 +177,7 @@ void rc_map_init(void);
  #define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
  #define RC_MAP_REDDO                     "rc-reddo"
  #define RC_MAP_SNAPSTREAM_FIREFLY        "rc-snapstream-firefly"
+#define RC_MAP_SNAZIO_TVPVR_PRO          "rc-snazio-tvpvr-pro"
  #define RC_MAP_STREAMZAP                 "rc-streamzap"
  #define RC_MAP_TBS_NEC                   "rc-tbs-nec"
  #define RC_MAP_TECHNISAT_USB2            "rc-technisat-usb2"
-- 
1.9.rc1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-02-14 21:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-08  6:14 [PATCH] saa7134: Add support for Snazio TvPVR PRO GEORGE
2014-02-08 19:12 GEORGE
2014-02-09 16:06 [PATCH] saa7134: Add support for SnaZio " POJAR GEORGE
2014-02-09 16:29 ` Anca Emanuel
2014-02-09 23:44   ` GEORGE
2014-02-09 23:52     ` GEORGE
2014-02-10  5:28     ` Antti Palosaari
2014-03-11 14:49       ` Mauro Carvalho Chehab
2014-02-09 16:11 POJAR GEORGE
2016-02-14 21:23 [PATCH] saa7134: Add support for Snazio " GEORGE

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.