Skip to contentSkip to conversation

tuner-core.c improvments and Ymec Tvision TVF8533MF support]

PATCH In review Mauro Carvalho Chehab 1 participant 2 messages Jun 1, 2005 – Jun 2, 2005 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tuner-core.c improvments and Ymec Tvision TVF8533MF support]

Sorry, I forgot to attach the file :-)

-------- Original Message --------

tuner-core.c, tuner.h:

- tuner-core changed to support multiple I2C devices used on
some adapters;
- Kconfig now has an option (CONFIG_TUNER_MULTI_I2C) to enable
this new behavor;
- By default, even enabling CONFIG_TUNER_MULTI_I2C, tuner-core
emulates the old behavor, using first I2C device for both FM and TV;
- There is a new i2c command (TUNER_SET_ADDR) to allow tuner
clients to select I2C address for FM or TV tuner;
- Tuner I2C dettach now generates a warning on syslog if failed.

tuner-simple.c:
- TVision TVF-8531MF and TVF-5533 MF tuner included. It uses, by
default, I2C on 0xC2 address for TV and on 0xC0 for Radio. Both TV and FM Radio mode are working.

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#1 lore raw

I'm resubmiting the patch because I forgot diff for include/media/tuner.h. The patch is now complete. It is for linux-2.6.12-rc5-mm2.

Quoted 12 lines

tuner-core.c, tuner.h, Kconfig:

- tuner-core changed to support multiple I2C devices used on
some adapters;
- Kconfig now has an option (CONFIG_TUNER_MULTI_I2C) to enable
this new behavor;
- By default, even enabling CONFIG_TUNER_MULTI_I2C, tuner-core
emulates the old behavor, using first I2C device for both FM and TV;
- There is a new i2c command (TUNER_SET_ADDR) to allow tuner
clients to select I2C address for FM or TV tuner;
- Tuner I2C dettach now generates a warning on syslog if failed.

Quoted 8 lines

tuner-simple.c:
- TVision TVF-8531MF and TVF-5533 MF tuner included. It uses, by
default, I2C on 0xC2 address for TV and on 0xC0 for Radio. Both TV and FM Radio mode are working.

drivers/media/video/Kconfig +13 -0
diff -ur linux-2.6.12-rc5-mm.org/drivers/media/video/Kconfig linux-2.6.12-rc5-mm/drivers/media/video/Kconfig
@@ -7,6 +7,19 @@
 
 comment "Video Adapters"
 
+config CONFIG_TUNER_MULTI_I2C
+	bool "Enable support for multiple I2C devices on Video Adapters (EXPERIMENTAL)"
+	depends on VIDEO_DEV && EXPERIMENTAL
+	---help---
+	  Some video adapters have more than one tuner inside. This patch 
+	  enables support for using more than one tuner. This is required
+	  for some cards to allow tunning  both video and radio.
+	  It also improves I2C autodetection for these cards.
+
+	  Only few tuners currently is supporting this. More to come.
+
+	  It is safe to say 'Y' here even if your card has only one I2C tuner.
+
 config VIDEO_BT848
 	tristate "BT848 Video For Linux"
 	depends on VIDEO_DEV && PCI && I2C
drivers/media/video/tuner-core.c +77 -4

195 lines not on this page · raw message

drivers/media/video/tuner-simple.c +28 -2
diff -ur linux-2.6.12-rc5-mm.org/drivers/media/video/tuner-simple.c linux-2.6.12-rc5-mm/drivers/media/video/tuner-simple.c
@@ -1,5 +1,5 @@
 /*
- * $Id: tuner-simple.c,v 1.10 2005/03/08 08:38:00 kraxel Exp $
+ * $Id: tuner-simple.c,v 1.14 2005/05/30 02:02:47 mchehab Exp $
  *
  * i2c tv tuner chip device driver
  * controls all those simple 4-control-bytes style tuners.
@@ -212,6 +212,11 @@
         { "Philips FQ1236A MK4", Philips, NTSC,
           16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 },
 
+	/* Should work for TVF8531MF, TVF8831MF, TVF8731MF */
+	{ "Ymec TVision TVF-8531MF", Philips, NTSC,
+	  16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732},
+	{ "Ymec TVision TVF-5533MF", Philips, NTSC,
+	  16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732},
 };
 unsigned const int tuner_count = ARRAY_SIZE(tuners);
 
@@ -424,6 +429,13 @@
 	buffer[2] = tun->config;
 
 	switch (t->type) {
+	case TUNER_YMEC_TVF_5533MF:
+		
+		/*These values are empirically determinated */
+		div = (freq*122)/16 - 20;
+		buffer[2] = 0x88; /* could be also 0x80 */
+		buffer[3] = 0x19; /* could be also 0x10, 0x18, 0x99 */
+		break;
 	case TUNER_PHILIPS_FM1216ME_MK3:
 	case TUNER_PHILIPS_FM1236_MK3:
 		buffer[3] = 0x19;
@@ -457,7 +469,21 @@
 	tuner_info("type set to %d (%s)\n",
 		   t->type, tuners[t->type].name);
 	strlcpy(c->name, tuners[t->type].name, sizeof(c->name));
-
+	
+	switch (t->type) {
+	case TUNER_YMEC_TVF_5533MF:
+		{
+			struct tuner_addr tun_addr = { V4L2_TUNER_ANALOG_TV, 0xc2>>1 };
+			
+			if (c->driver->command) {
+				c->driver->command(c, TUNER_SET_ADDR, &tun_addr);
+			} else {
+				tuner_warn("Couldn't set TV tuner I2C address to 0x%02x\n",tun_addr.addr<<1);
+			}
+			break;
+		}
+	}
+	
 	t->tv_freq    = default_set_tv_freq;
 	t->radio_freq = default_set_radio_freq;
 	t->has_signal = tuner_signal;
include/media/tuner.h +10 -0
diff -ur linux-2.6.12-rc5-mm.org/include/media/tuner.h linux-2.6.12-rc5-mm/include/media/tuner.h
@@ -98,6 +98,9 @@
 #define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */
 #define TUNER_PHILIPS_FQ1236A_MK4 57   /* Hauppauge PVR-500MCE NTSC */
 
+#define TUNER_YMEC_TVF_8531MF 58
+#define TUNER_YMEC_TVF_5533MF 59	/* Pixelview Pro Ultra NTSC */
+
 #define NOTUNER 0
 #define PAL     1	/* PAL_BG */
 #define PAL_I   2
@@ -121,8 +124,10 @@
 
 #define TUNER_SET_TYPE               _IOW('t',1,int)    /* set tuner type */
 #define TUNER_SET_TVFREQ             _IOW('t',2,int)    /* set tv freq */
+#define TUNER_SET_ADDR               _IOW('T',3,int)	/* Chooses tuner I2C address */
 
 #define  TDA9887_SET_CONFIG          _IOW('t',5,int)
+
 /* tv card specific */
 # define TDA9887_PRESENT             (1<<0)
 # define TDA9887_PORT1_INACTIVE      (1<<1)
@@ -143,6 +148,11 @@
 #define I2C_ADDR_TDA8290        0x4b
 #define I2C_ADDR_TDA8275        0x61
 
+struct tuner_addr {
+	enum v4l2_tuner_type type;
+	unsigned short addr;
+};
+
 struct tuner {
 	/* device */
 	struct i2c_client i2c;