Skip to contentSkip to conversation

media/video i2c updates

PATCH New Gerd Knorr 1 participant 1 message Jan 8, 2003 Media (V4L/DVB)

lore
Share & tools
lore

Gerd Knorr

author
#0 lore raw

PATCH 1/1 media/video i2c updates

Hi,

This patch updates a bunch of i2c modules in drivers/media/video. Most of it are adaptions to the recent i2c changes in the kernel. While being at it I also did some other cleanups like deleting unused+dead code, using name-based initialization for some not-yet converted structs, ...

The patch also has a few small fixes here and there, but no major functional changes.

Please apply,

Gerd

drivers/media/video/audiochip.h +0 -38
@@ -30,44 +30,6 @@
  * make sense in v4l context only.  So I think that's acceptable...
  */
 
-#if 0
-
-/* TODO (if it is ever [to be] accessible in the V4L[2] spec):
- *   maybe fade? (back/front)
- * notes:
- * NEWCHANNEL and SWITCH_MUTE are here because the MSP3400 has a special
- * routine to go through when it tunes in to a new channel before turning
- * back on the sound.
- * Either SET_RADIO, NEWCHANNEL, and SWITCH_MUTE or SET_INPUT need to be
- * implemented (MSP3400 uses SET_RADIO to select inputs, and SWITCH_MUTE for
- * channel-change mute -- TEA6300 et al use SET_AUDIO to select input [TV, 
- * radio, external, or MUTE]).  If both methods are implemented, you get a
- * cookie for doing such a good job! :)
- */
-
-#define AUDC_SET_TVNORM       _IOW('m',1,int)  /* TV mode + PAL/SECAM/NTSC  */
-#define AUDC_NEWCHANNEL       _IO('m',3)       /* indicate new chan - off mute */
-
-#define AUDC_GET_VOLUME_LEFT  _IOR('m',4,__u16)
-#define AUDC_GET_VOLUME_RIGHT _IOR('m',5,__u16)
-#define AUDC_SET_VOLUME_LEFT  _IOW('m',6,__u16)
-#define AUDC_SET_VOLUME_RIGHT _IOW('m',7,__u16)
-
-#define AUDC_GET_STEREO       _IOR('m',8,__u16)
-#define AUDC_SET_STEREO       _IOW('m',9,__u16)
-
-#define AUDC_GET_DC           _IOR('m',10,__u16)/* ??? */
-
-#define AUDC_GET_BASS         _IOR('m',11,__u16)
-#define AUDC_SET_BASS         _IOW('m',12,__u16)
-#define AUDC_GET_TREBLE       _IOR('m',13,__u16)
-#define AUDC_SET_TREBLE       _IOW('m',14,__u16)
-
-#define AUDC_GET_UNIT         _IOR('m',15,int) /* ??? - unimplemented in MSP3400 */
-#define AUDC_SWITCH_MUTE      _IO('m',16)      /* turn on mute */
-#endif
-
-
 /* misc stuff to pass around config info to i2c chips */
 #define AUDC_CONFIG_PINNACLE  _IOW('m',32,int)
 
drivers/media/video/msp3400.c +39 -30

106 lines not on this page · raw message

drivers/media/video/tda7432.c +60 -50

233 lines not on this page · raw message

drivers/media/video/tda9875.c +13 -25
@@ -42,19 +42,10 @@
 /* Addresses to scan */
 static unsigned short normal_i2c[] =  {
     I2C_TDA9875 >> 1,
-    I2C_CLIENT_END};
-static unsigned short normal_i2c_range[] = {I2C_CLIENT_END};
-static unsigned short probe[2]        = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short probe_range[2]  = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore[2]       = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short force[2]        = { I2C_CLIENT_END, I2C_CLIENT_END };
-static struct i2c_client_address_data addr_data = {
-	normal_i2c, normal_i2c_range, 
-	probe, probe_range, 
-	ignore, ignore_range, 
-	force
+    I2C_CLIENT_END
 };
+static unsigned short normal_i2c_range[] = {I2C_CLIENT_END};
+I2C_CLIENT_INSMOD;
 
 /* This is a superset of the TDA9875 */
 struct tda9875 {
@@ -64,7 +55,6 @@
 	struct i2c_client c;
 };
 
-
 static struct i2c_driver driver;
 static struct i2c_client client_template;
 
@@ -397,22 +387,20 @@
 
 
 static struct i2c_driver driver = {
-        "i2c tda9875 driver",
-        I2C_DRIVERID_TDA9875, /* Get new one for TDA9875 */
-        I2C_DF_NOTIFY,
-	tda9875_probe,
-        tda9875_detach,
-        tda9875_command,
+	.owner          = THIS_MODULE,
+        .name           = "i2c tda9875 driver",
+        .id             = I2C_DRIVERID_TDA9875,
+        .flags          = I2C_DF_NOTIFY,
+	.attach_adapter = tda9875_probe,
+        .detach_client  = tda9875_detach,
+        .command        = tda9875_command,
 };
 
 static struct i2c_client client_template =
 {
-        "(unset)",		/* name */
-        -1,
-        0,
-        0,
-        NULL,
-        &driver
+        .name    = "tda9875",
+        .id      = -1,
+        .driver  = &driver,
 };
 
 static int tda9875_init(void)
drivers/media/video/tda9887.c +13 -22
@@ -26,17 +26,7 @@
 /* Addresses to scan */
 static unsigned short normal_i2c[] = {I2C_CLIENT_END};
 static unsigned short normal_i2c_range[] = {0x86>>1,0x86>>1,I2C_CLIENT_END};
-static unsigned short probe[2]        = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short probe_range[2]  = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore[2]       = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short force[2]        = { I2C_CLIENT_END, I2C_CLIENT_END };
-static struct i2c_client_address_data addr_data = {
-	normal_i2c, normal_i2c_range, 
-	probe, probe_range, 
-	ignore, ignore_range, 
-	force
-};
+I2C_CLIENT_INSMOD;
 
 /* insmod options */
 static int debug =  0;
@@ -145,8 +135,8 @@
 	u8   bOutPort2    = cOutputPort2Inactive;
 #endif
 	u8   bVideoTrap   = cVideoTrapBypassOFF;
-#if 0
-	u8   bTopAdjust   = mbAGC;
+#if 1
+	u8   bTopAdjust   = 0x0e /* -2dB */;
 #else
 	u8   bTopAdjust   = 0;
 #endif
@@ -456,18 +446,19 @@
 /* ----------------------------------------------------------------------- */
 
 static struct i2c_driver driver = {
-        name:           "i2c tda9887 driver",
-        id:             -1, /* FIXME */
-        flags:          I2C_DF_NOTIFY,
-        attach_adapter: tda9887_probe,
-        detach_client:  tda9887_detach,
-        command:        tda9887_command,
+	.owner          = THIS_MODULE,
+        .name           = "i2c tda9887 driver",
+        .id             = -1, /* FIXME */
+        .flags          = I2C_DF_NOTIFY,
+        .attach_adapter = tda9887_probe,
+        .detach_client  = tda9887_detach,
+        .command        = tda9887_command,
 };
 static struct i2c_client client_template =
 {
-        name:   "tda9887",
-	flags:  I2C_CLIENT_ALLOW_USE,
-        driver: &driver,
+        .name   = "tda9887",
+	.flags  = I2C_CLIENT_ALLOW_USE,
+        .driver = &driver,
 };
 
 static int tda9887_init_module(void)
drivers/media/video/tvaudio.c +29 -24

99 lines not on this page · raw message

drivers/media/video/tvmixer.c +14 -14
@@ -195,9 +195,8 @@
 
 	/* lock bttv in memory while the mixer is in use  */
 	file->private_data = mix;
-
-	if (!try_module_get(client->adapter->owner))
-		return -ENODEV;
+	if (client->adapter->owner)
+		try_module_get(client->adapter->owner);
         return 0;
 }
 
@@ -211,25 +210,26 @@
 		return -ENODEV;
 	}
 
-	module_put(client->adapter->owner);
+	if (client->adapter->owner)
+		module_put(client->adapter->owner);
 	return 0;
 }
 
-
 static struct i2c_driver driver = {
-	.name		= "tv card mixer driver",
-	.id		= I2C_DRIVERID_TVMIXER,
-	.flags		= I2C_DF_DUMMY,
-	.attach_adapter	= tvmixer_adapters,
-	.detach_client	= tvmixer_clients,
+	.owner           = THIS_MODULE,
+	.name            = "tv card mixer driver",
+        .id              = I2C_DRIVERID_TVMIXER,
+	.flags           = I2C_DF_DUMMY,
+        .attach_adapter  = tvmixer_adapters,
+        .detach_client   = tvmixer_clients,
 };
 
 static struct file_operations tvmixer_fops = {
 	.owner		= THIS_MODULE,
-	.llseek		= no_llseek,
-	.ioctl		= tvmixer_ioctl,
-	.open		= tvmixer_open,
-	.release	= tvmixer_release,
+	.llseek         = no_llseek,
+	.ioctl          = tvmixer_ioctl,
+	.open           = tvmixer_open,
+	.release        = tvmixer_release,
 };
 
 /* ----------------------------------------------------------------------- */
Signature · 2 lines
Weil die späten Diskussionen nicht mal mehr den Rotwein lohnen.
				-- Wacholder in "Melanie"