Hi folks,
I think i did it. The card is now working fine under linux with 16
inputs. In fact, i can tell you it's REALLY working: we just caught a
thief in our university thanks to the cameras. One guard sneaked into a
professor room at 3am to steal memory and hd and gave a nice shot to our
camera! he's being fired today...
I needed to create a muxsel_hook as the crosspoint switch has to be
reseted and pulsed to change the input channel. Also uncommented some
code related to gpiomask2.
The patch is for linux-2.4.13 (linus). More information within.
Thanks everybody for the help, if you need anything fell free to ask...
Regards,
Miguel Freitas
diff -ur linux-2.4.13-linus/drivers/media/video/bttv-cards.c linux-2.4.13/drivers/media/video/bttv-cards.c
--- linux-2.4.13-linus/drivers/media/video/bttv-cards.c Wed Oct 17 19:19:20 2001
+++ linux-2.4.13/drivers/media/video/bttv-cards.c Mon Nov 5 16:22:41 2001
@@ -55,6 +55,7 @@
static void gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set);
static void winfast2000_audio(struct bttv *btv, struct video_audio *v, int set);
static void pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set);
+static void rv605_muxsel(struct bttv *btv, unsigned int input);
/* config variables */
static int triton1=0;
@@ -1106,6 +1107,21 @@
tuner_type: -1,
audio_hook: pvbt878p9b_audio,
has_radio: 1,
+},{
+ /* Miguel Freitas <miguel@xxxxxxxxxxxxxxxx> */
+ name: "RemoteVision MX (RV605)",
+ video_inputs: 16,
+ audio_inputs: 0,
+ tuner: 0,
+ svhs: 0,
+ gpiomask: 0x00,
+ gpiomask2: 0x07ff,
+ muxsel: { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03,
+ 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 },
+ no_msp34xx: 1,
+ no_tda9875: 1,
+ tuner_type: -1,
+ muxsel_hook: rv605_muxsel,
}
};
@@ -1922,6 +1938,47 @@
}
}
+/* RemoteVision MX (rv605) muxsel helper [Miguel Freitas]
+ *
+ * This is needed because rv605 don't use a normal multiplex, but a crosspoint
+ * switch instead (CD22M3494E). This IC can have multiple active connections
+ * between Xn (input) and Yn (output) pins. We need to clear any existing
+ * connection prior to establish a new one, pulsing the STROBE pin.
+ *
+ * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
+ * GPIO pins are wired as:
+ * GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroler)
+ * GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroler)
+ * GPIO[7] - DATA (xpoint) - P1[7] (microcontroler)
+ * GPIO[8] - - P3[5] (microcontroler)
+ * GPIO[9] - RESET (xpoint) - P3[6] (microcontroler)
+ * GPIO[10] - STROBE (xpoint) - P3[7] (microcontroler)
+ * GPINTR - - P3[4] (microcontroler)
+ *
+ * The microcontroler is a 80C32 like. It should be possible to change xpoint
+ * configuration either directly (as we are doing) or using the microcontroler
+ * which is also wired to I2C interface. I have no further info on the
+ * microcontroler features, one would need to disassembly the firmware.
+ * note: the vendor refused to give any information on this product, all
+ * that stuff was found using a multimeter! :)
+ */
+static void rv605_muxsel(struct bttv *btv, unsigned int input)
+{
+ /* reset all conections */
+ btaor(0x200,~0x200, BT848_GPIO_DATA);
+ mdelay(1);
+ btaor(0x000,~0x200, BT848_GPIO_DATA);
+ mdelay(1);
+
+ /* create a new conection */
+ btaor(0x080,~0x480, BT848_GPIO_DATA);
+ btaor(0x480,~0x480, BT848_GPIO_DATA);
+ mdelay(1);
+ btaor(0x080,~0x480, BT848_GPIO_DATA);
+ mdelay(1);
+}
+
+
/* ----------------------------------------------------------------------- */
/* motherboard chipset specific stuff */
diff -ur linux-2.4.13-linus/drivers/media/video/bttv-driver.c linux-2.4.13/drivers/media/video/bttv-driver.c
--- linux-2.4.13-linus/drivers/media/video/bttv-driver.c Wed Oct 17 19:19:20 2001
+++ linux-2.4.13/drivers/media/video/bttv-driver.c Mon Nov 5 16:29:05 2001
@@ -425,18 +425,16 @@
static void bt848_muxsel(struct bttv *btv, unsigned int input)
{
-
-#if 0 /* seems no card uses this ... */
+ /* needed by RemoteVideo MX */
btaor(bttv_tvcards[btv->type].gpiomask2,~bttv_tvcards[btv->type].gpiomask2,
BT848_GPIO_OUT_EN);
-#endif
/* This seems to get rid of some synchronization problems */
btand(~(3<<5), BT848_IFORM);
- mdelay(10);
-
+ mdelay(10);
+
input %= bttv_tvcards[btv->type].video_inputs;
- if (input==bttv_tvcards[btv->type].svhs)
+ if (input==bttv_tvcards[btv->type].svhs)
{
btor(BT848_CONTROL_COMP, BT848_E_CONTROL);
btor(BT848_CONTROL_COMP, BT848_O_CONTROL);
@@ -446,20 +444,25 @@
btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);
}
- btaor((bttv_tvcards[btv->type].muxsel[input&7]&3)<<5, ~(3<<5), BT848_IFORM);
- audio(btv, (input!=bttv_tvcards[btv->type].tuner) ?
+
+ btaor((bttv_tvcards[btv->type].muxsel[input]&3)<<5, ~(3<<5), BT848_IFORM);
+ audio(btv, (input!=bttv_tvcards[btv->type].tuner) ?
AUDIO_EXTERN : AUDIO_TUNER, 1);
-#if 0 /* seems no card uses this ... */
btaor(bttv_tvcards[btv->type].muxsel[input]>>4,
~bttv_tvcards[btv->type].gpiomask2, BT848_GPIO_DATA);
+
+ /* card specific hook */
+ if( bttv_tvcards[btv->type].muxsel_hook )
+ bttv_tvcards[btv->type].muxsel_hook ( btv, input );
+
if (bttv_gpio)
bttv_gpio_tracking(btv,"muxsel");
-#endif
+
}
-struct tvnorm
+struct tvnorm
{
u32 Fsc;
u16 swidth, sheight; /* scaled standard width, height */
diff -ur linux-2.4.13-linus/drivers/media/video/bttv.h linux-2.4.13/drivers/media/video/bttv.h
--- linux-2.4.13-linus/drivers/media/video/bttv.h Wed Oct 17 19:19:20 2001
+++ linux-2.4.13/drivers/media/video/bttv.h Mon Nov 5 15:48:30 2001
@@ -87,6 +87,7 @@
#define BTTV_PV_BT878P_PLUS 0x46
#define BTTV_FLYVIDEO98EZ 0x47
#define BTTV_PV_BT878P_9B 0x48
+#define BTTV_RV605 0x49
/* i2c address list */
@@ -123,7 +124,7 @@
int tuner;
int svhs;
u32 gpiomask;
- u32 muxsel[8];
+ u32 muxsel[16];
u32 audiomux[6]; /* Tuner, Radio, external, internal, mute, stereo */
u32 gpiomask2; /* GPIO MUX mask */
@@ -141,6 +142,7 @@
int tuner_type;
int has_radio;
void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set);
+ void (*muxsel_hook)(struct bttv *btv, unsigned int input);
};
extern struct tvcard bttv_tvcards[];