public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.14.3] bttv-cards: add IO-DATA GV-BCTV2/PCI
@ 2005-12-04  2:14 ITO N. Hisashi
  2005-12-04  3:14 ` [PATCH 2.6.14.3] hid-core: add HID quirks for Morphy USB-IO ITO N. Hisashi
  2005-12-04 11:44 ` [PATCH 2.6.14.3] bttv-cards: add IO-DATA GV-BCTV2/PCI Mauro Carvalho Chehab
  0 siblings, 2 replies; 3+ messages in thread
From: ITO N. Hisashi @ 2005-12-04  2:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: kraxel

Add support for IO-DATA GV-BCTV/PCI and IO-DATA GV-BCTV2/PCI.

Signed-off-by: Hisashi Ito <kuro@neko.ac>

diff -U 5 -rpN linux-2.6.14.3-vanilla/drivers/media/video/bttv-cards.c linux-2.6.14.3/drivers/media/video/bttv-cards.c
--- linux-2.6.14.3-vanilla/drivers/media/video/bttv-cards.c	2005-11-25 07:10:21.000000000 +0900
+++ linux-2.6.14.3/drivers/media/video/bttv-cards.c	2005-12-04 09:56:50.000000000 +0900
@@ -54,10 +54,11 @@ static void lt9415_audio(struct bttv *bt
 static void avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v,
 				    int set);
 static void avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v,
 				      int set);
 static void terratv_audio(struct bttv *btv, struct video_audio *v, int set);
+static void gvbctv2pci_audio(struct bttv *btv, struct video_audio *v, int set);
 static void gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set);
 static void gvbctv5pci_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 fv2000s_audio(struct bttv *btv, struct video_audio *v, int set);
@@ -81,10 +82,15 @@ static void kodicom4400r_muxsel(struct b
 static void kodicom4400r_init(struct bttv *btv);
 
 static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input);
 static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input);
 
+static void gvbctv2pci_write(struct bttv *btv, int data);
+static int gvbctv2pci_read(struct bttv *btv);
+static void gvbctv2pci_muxsel(struct bttv *btv, unsigned int input);
+static void gvbctv2pci_init(struct bttv *btv);
+
 static int terratec_active_radio_upgrade(struct bttv *btv);
 static int tea5757_read(struct bttv *btv);
 static int tea5757_write(struct bttv *btv, int value);
 static void identify_by_eeprom(struct bttv *btv,
 			       unsigned char eeprom_data[256]);
@@ -2416,10 +2422,27 @@ struct tvcard bttv_tvcards[] = {
 	.needs_tvaudio	= 1,
 	.pll		= PLL_28,
 	.tuner_type	= TUNER_YMEC_TVF66T5_B_DFF,
 	.tuner_addr	= 0xc1 >>1,
 	.has_radio	= 1,
+},{
+	/* Hisashi Ito <kuro@neko.ac>
+	   (Originally by Hiroshi Ohno <hiroshi@bigfield.com>) */
+	.name           = "IODATA GV-BCTV2/PCI",
+	.video_inputs   = 3,
+	.audio_inputs   = 1,
+	.tuner          = 0,
+	.svhs           = 2,
+	.muxsel         = {2, 3, 1},
+	.no_msp34xx     = 1,
+	.no_tda9875     = 1,
+	.no_tda7432     = 1,
+	.pll            = PLL_28,
+	.tuner_type     = TUNER_ALPS_TSBH1_NTSC,
+	.tuner_addr     = ADDR_UNSET,
+	.muxsel_hook	= gvbctv2pci_muxsel,
+	.audio_hook	= gvbctv2pci_audio,
 }};
 
 static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
 
 /* ----------------------------------------------------------------------- */
@@ -2749,10 +2772,52 @@ static void sigmaSLC_muxsel(struct bttv 
 	unsigned int inmux = input % 4;
 	gpio_inout( 3<<9, 3<<9 );
 	gpio_bits( 3<<9, inmux<<9 );
 }
 
+static void
+gvbctv2pci_write(struct bttv *btv, int data)
+{
+	btwrite(0, BT848_GPIO_OUT_EN);
+	btwrite(data, BT848_GPIO_DATA);
+	btwrite(0xff00, BT848_GPIO_OUT_EN);
+	data &= ~0x400;
+	btwrite(data, BT848_GPIO_DATA);
+	data |= 0x400;
+	btwrite(data, BT848_GPIO_DATA);
+	btwrite(0xff00, BT848_GPIO_DATA);
+	btwrite(0, BT848_GPIO_OUT_EN);
+}
+
+static int
+gvbctv2pci_read(struct bttv *btv)
+{
+	int data;
+
+	btwrite(0, BT848_GPIO_OUT_EN);
+	btwrite(0x0d00, BT848_GPIO_DATA);
+	btwrite(0x0f00, BT848_GPIO_OUT_EN);
+	btwrite(0x0500, BT848_GPIO_DATA);
+	data = btread(BT848_GPIO_DATA);
+	btwrite(0x0d00, BT848_GPIO_DATA);
+	btwrite(0x0f00, BT848_GPIO_DATA);
+	btwrite(0, BT848_GPIO_OUT_EN);
+	return data;
+}
+
+static void
+gvbctv2pci_muxsel(struct bttv *btv, unsigned int input)
+{
+	static const int masks[] = {0x1f00, 0x0f00, 0x0f00};
+	gvbctv2pci_write(btv, masks[input]);
+}
+
+static void
+gvbctv2pci_init(struct bttv *btv)
+{
+	gvbctv2pci_write(btv, 0x4d00); /* mute */
+}
 /* ----------------------------------------------------------------------- */
 
 static void bttv_reset_audio(struct bttv *btv)
 {
 	/*
@@ -2911,10 +2976,13 @@ void __devinit bttv_init_card2(struct bt
 		tibetCS16_init(btv);
 		break;
 	case BTTV_KODICOM_4400R:
 		kodicom4400r_init(btv);
 		break;
+	case BTTV_GVBCTV2PCI:
+		gvbctv2pci_init(btv);
+		break;
 	}
 
 	/* pll configuration */
         if (!(btv->id==848 && btv->revision==0x11)) {
 		/* defaults from card list */
@@ -3740,10 +3808,49 @@ void winview_audio(struct bttv *btv, str
 /* ----------------------------------------------------------------------- */
 /* mono/stereo control for various cards (which don't use i2c chips but    */
 /* connect something to the GPIO pins                                      */
 
 static void
+gvbctv2pci_audio(struct bttv *btv, struct video_audio *v, int set)
+{
+	if (set) {
+		int con = 0x0d00;
+
+		if (v->mode & VIDEO_SOUND_LANG2) {
+			con = 0x3d00; /* LANG2 */
+			if (v->mode & VIDEO_SOUND_LANG1)
+				con = 0x1d00; /* LANG1+LANG2 */
+		}
+		/* Set BCTV2 mute here since we can't do via direct gpio. */
+		if (v->flags & VIDEO_AUDIO_MUTE)
+			con = 0x4d00;
+		gvbctv2pci_write(btv, con);
+	} else {
+		switch (gvbctv2pci_read(btv) & 0x7000) {
+		case 0x3000:
+			v->mode = VIDEO_SOUND_STEREO;
+			break;
+		case 0x4000:
+			v->mode = VIDEO_SOUND_LANG1|VIDEO_SOUND_LANG2;
+			break;
+		case 0x5000:
+			v->mode = VIDEO_SOUND_LANG2;
+			break;
+		case 0x6000:
+			v->mode = VIDEO_SOUND_LANG1;
+			break;
+		case 0x7000:
+			v->mode = VIDEO_SOUND_MONO;
+			break;
+		default:
+			v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
+				  VIDEO_SOUND_LANG1  | VIDEO_SOUND_LANG2;
+		}
+	}
+}
+
+static void
 gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
 {
 	unsigned int con = 0;
 
 	if (set) {
diff -U 5 -rpN linux-2.6.14.3-vanilla/drivers/media/video/bttv.h linux-2.6.14.3/drivers/media/video/bttv.h
--- linux-2.6.14.3-vanilla/drivers/media/video/bttv.h	2005-11-25 07:10:21.000000000 +0900
+++ linux-2.6.14.3/drivers/media/video/bttv.h	2005-12-04 09:08:20.000000000 +0900
@@ -135,10 +135,11 @@
 #define BTTV_TIBET_CS16  0x83
 #define BTTV_KODICOM_4400R  0x84
 #define BTTV_ADLINK_RTV24   0x86
 #define BTTV_DVICO_FUSIONHDTV_5_LITE 0x87
 #define BTTV_ACORP_Y878F   0x88
+#define BTTV_GVBCTV2PCI     0x89
 
 /* i2c address list */
 #define I2C_TSA5522        0xc2
 #define I2C_TDA7432        0x8a
 #define I2C_BT832_ALT1	   0x88

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

* [PATCH 2.6.14.3] hid-core: add HID quirks for Morphy USB-IO
  2005-12-04  2:14 [PATCH 2.6.14.3] bttv-cards: add IO-DATA GV-BCTV2/PCI ITO N. Hisashi
@ 2005-12-04  3:14 ` ITO N. Hisashi
  2005-12-04 11:44 ` [PATCH 2.6.14.3] bttv-cards: add IO-DATA GV-BCTV2/PCI Mauro Carvalho Chehab
  1 sibling, 0 replies; 3+ messages in thread
From: ITO N. Hisashi @ 2005-12-04  3:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: mike-

Morphy USB-IO (and its clones made by Km2Net or Techno Kit) reports 
the type to be an HID, but this is wrong because it is a general
purpose I/O device.

Signed-off-by: Hisashi Ito <kuro@neko.ac>

diff -U 5 -rpN linux-2.6.14.3-vanilla/drivers/usb/input/hid-core.c linux-2.6.14.3/drivers/usb/input/hid-core.c
--- linux-2.6.14.3-vanilla/drivers/usb/input/hid-core.c	2005-11-25 07:10:21.000000000 +0900
+++ linux-2.6.14.3/drivers/usb/input/hid-core.c	2005-12-04 11:43:38.000000000 +0900
@@ -1445,10 +1445,19 @@ void hid_init_reports(struct hid_device 
 #define USB_DEVICE_ID_POWERCONTROL	0x2030
 
 #define USB_VENDOR_ID_APPLE		0x05ac
 #define USB_DEVICE_ID_APPLE_POWERMOUSE	0x0304
 
+#define USB_VENDOR_ID_KM2NET		0x1352
+#define USB_DEVICE_ID_KM2NET_USBIO	0x0100
+
+#define USB_VENDOR_ID_MORPHY		0x0BFE
+#define USB_DEVICE_ID_MORPHY_USBIO	0x1000
+
+#define USB_VENDOR_ID_TECHNOKIT		0x12ED
+#define USB_DEVICE_ID_TECHNOKIT_USBIO	0x1003
+
 /*
  * Alphabetically sorted blacklist by quirk type.
  */
 
 static struct hid_blacklist {
@@ -1480,10 +1489,11 @@ static struct hid_blacklist {
 	{ USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_0_4_IF_KIT, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_KM2NET, USB_DEVICE_ID_KM2NET_USBIO, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_CASSY, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_POCKETCASSY, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_MOBILECASSY, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_JWM, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_DMMP, HID_QUIRK_IGNORE },
@@ -1495,16 +1505,21 @@ static struct hid_blacklist {
 	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_POWERCONTROL, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_MORPHY, USB_DEVICE_ID_MORPHY_USBIO, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_MORPHY, USB_DEVICE_ID_MORPHY_USBIO + 1, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_MORPHY, USB_DEVICE_ID_MORPHY_USBIO + 2, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_MORPHY, USB_DEVICE_ID_MORPHY_USBIO + 3, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 100, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 200, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 300, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 400, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 500, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_TECHNOKIT, USB_DEVICE_ID_TECHNOKIT_USBIO, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PENPARTNER, HID_QUIRK_IGNORE },

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

* Re: [PATCH 2.6.14.3] bttv-cards: add IO-DATA GV-BCTV2/PCI
  2005-12-04  2:14 [PATCH 2.6.14.3] bttv-cards: add IO-DATA GV-BCTV2/PCI ITO N. Hisashi
  2005-12-04  3:14 ` [PATCH 2.6.14.3] hid-core: add HID quirks for Morphy USB-IO ITO N. Hisashi
@ 2005-12-04 11:44 ` Mauro Carvalho Chehab
  1 sibling, 0 replies; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2005-12-04 11:44 UTC (permalink / raw)
  To: his; +Cc: linux-kernel, kraxel, Linux and Kernel Video

Hisashi,

	First of all, kraxel is not the current maintainer. Please c/c to me
instead. Also, please copy v4l mailing list. You don't need to c/c LKML
for this kind of patch.

Em Dom, 2005-12-04 às 11:14 +0900, ITO N. Hisashi escreveu:
> Add support for IO-DATA GV-BCTV/PCI and IO-DATA GV-BCTV2/PCI.
> 
> Signed-off-by: Hisashi Ito <kuro@neko.ac>
> 
> diff -U 5 -rpN linux-2.6.14.3-vanilla/drivers/media/video/bttv-cards.c linux-2.6.14.3/drivers/media/video/bttv-cards.c
	No. Newer patches should be generated against V4L tree. It is available
at http://linuxtv.org
>  
> +static void
> +gvbctv2pci_write(struct bttv *btv, int data)
> +{
> +	btwrite(0, BT848_GPIO_OUT_EN);
> +	btwrite(data, BT848_GPIO_DATA);
> +	btwrite(0xff00, BT848_GPIO_OUT_EN);
> +	data &= ~0x400;
> +	btwrite(data, BT848_GPIO_DATA);
> +	data |= 0x400;
> +	btwrite(data, BT848_GPIO_DATA);
> +	btwrite(0xff00, BT848_GPIO_DATA);
> +	btwrite(0, BT848_GPIO_OUT_EN);
> +}
> +
> +static int
> +gvbctv2pci_read(struct bttv *btv)
> +{
> +	int data;
> +
> +	btwrite(0, BT848_GPIO_OUT_EN);
> +	btwrite(0x0d00, BT848_GPIO_DATA);
> +	btwrite(0x0f00, BT848_GPIO_OUT_EN);
> +	btwrite(0x0500, BT848_GPIO_DATA);
> +	data = btread(BT848_GPIO_DATA);
> +	btwrite(0x0d00, BT848_GPIO_DATA);
> +	btwrite(0x0f00, BT848_GPIO_DATA);
> +	btwrite(0, BT848_GPIO_OUT_EN);
> +	return data;
> +}
> +
> +static void
> +gvbctv2pci_muxsel(struct bttv *btv, unsigned int input)
> +{
> +	static const int masks[] = {0x1f00, 0x0f00, 0x0f00};
> +	gvbctv2pci_write(btv, masks[input]);
> +}
> +
> +static void
> +gvbctv2pci_init(struct bttv *btv)
> +{
> +	gvbctv2pci_write(btv, 0x4d00); /* mute */
> +}

> +gvbctv2pci_audio(struct bttv *btv, struct video_audio *v, int set)
> +{
> +	if (set) {
> +		int con = 0x0d00;
> +
> +		if (v->mode & VIDEO_SOUND_LANG2) {
> +			con = 0x3d00; /* LANG2 */
> +			if (v->mode & VIDEO_SOUND_LANG1)
> +				con = 0x1d00; /* LANG1+LANG2 */
> +		}
> +		/* Set BCTV2 mute here since we can't do via direct gpio. */
> +		if (v->flags & VIDEO_AUDIO_MUTE)
> +			con = 0x4d00;
> +		gvbctv2pci_write(btv, con);
> +	} else {
> +		switch (gvbctv2pci_read(btv) & 0x7000) {
> +		case 0x3000:
> +			v->mode = VIDEO_SOUND_STEREO;
> +			break;
> +		case 0x4000:
> +			v->mode = VIDEO_SOUND_LANG1|VIDEO_SOUND_LANG2;
> +			break;
> +		case 0x5000:
> +			v->mode = VIDEO_SOUND_LANG2;
> +			break;
> +		case 0x6000:
> +			v->mode = VIDEO_SOUND_LANG1;
> +			break;
> +		case 0x7000:
> +			v->mode = VIDEO_SOUND_MONO;
> +			break;
> +		default:
> +			v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
> +				  VIDEO_SOUND_LANG1  | VIDEO_SOUND_LANG2;
> +		}
> +	}
> +}
> +
> +static void

	Am I wrong, or do you have a different audio chip? If so, the best
practice is to create a separate file for handling it (like we have for
msp34xx, wm8775 and others). 

> +#define BTTV_GVBCTV2PCI     0x89

	No. Today's last board is 0x8f. This is because you've used 2.6.14 instead of the v4l tree.

Cheers, 
Mauro.


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

end of thread, other threads:[~2005-12-04 11:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-04  2:14 [PATCH 2.6.14.3] bttv-cards: add IO-DATA GV-BCTV2/PCI ITO N. Hisashi
2005-12-04  3:14 ` [PATCH 2.6.14.3] hid-core: add HID quirks for Morphy USB-IO ITO N. Hisashi
2005-12-04 11:44 ` [PATCH 2.6.14.3] bttv-cards: add IO-DATA GV-BCTV2/PCI Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox