patch-2.4.22 linux-2.4.22/drivers/media/video/tda9875.c
Next file: linux-2.4.22/drivers/media/video/tda9887.c
Previous file: linux-2.4.22/drivers/media/video/tda7432.c
Back to the patch index
Back to the overall index
- Lines: 111
- Date:
2003-08-25 04:44:42.000000000 -0700
- Orig file:
linux-2.4.21/drivers/media/video/tda9875.c
- Orig date:
2003-06-13 07:51:34.000000000 -0700
diff -urN linux-2.4.21/drivers/media/video/tda9875.c linux-2.4.22/drivers/media/video/tda9875.c
@@ -33,6 +33,7 @@
#include "bttv.h"
#include "audiochip.h"
#include "id.h"
+#include "i2c-compat.h"
MODULE_PARM(debug,"i");
MODULE_LICENSE("GPL");
@@ -158,10 +159,11 @@
static void tda9875_set(struct i2c_client *client)
{
- struct tda9875 *tda = client->data;
+ struct tda9875 *tda = i2c_get_clientdata(client);
unsigned char a;
- dprintk(KERN_DEBUG "tda9875_set(%04x,%04x,%04x,%04x)\n",tda->lvol,tda->rvol,tda->bass,tda->treble);
+ dprintk(KERN_DEBUG "tda9875_set(%04x,%04x,%04x,%04x)\n",
+ tda->lvol,tda->rvol,tda->bass,tda->treble);
a = tda->lvol & 0xff;
@@ -176,7 +178,7 @@
static void do_tda9875_init(struct i2c_client *client)
{
- struct tda9875 *t = client->data;
+ struct tda9875 *t = i2c_get_clientdata(client);
dprintk("In tda9875_init\n");
tda9875_write(client, TDA9875_CFG, 0xd0 ); /*reg de config 0 (reset)*/
tda9875_write(client, TDA9875_MSR, 0x03 ); /* Monitor 0b00000XXX*/
@@ -256,7 +258,7 @@
memcpy(client,&client_template,sizeof(struct i2c_client));
client->adapter = adap;
client->addr = addr;
- client->data = t;
+ i2c_set_clientdata(client, t);
if(!tda9875_checkit(adap,addr)) {
kfree(t);
@@ -265,7 +267,6 @@
do_tda9875_init(client);
MOD_INC_USE_COUNT;
- strcpy(client->name,"TDA9875");
printk(KERN_INFO "tda9875: init\n");
i2c_attach_client(client);
@@ -281,7 +282,7 @@
static int tda9875_detach(struct i2c_client *client)
{
- struct tda9875 *t = client->data;
+ struct tda9875 *t = i2c_get_clientdata(client);
do_tda9875_init(client);
i2c_detach_client(client);
@@ -294,7 +295,7 @@
static int tda9875_command(struct i2c_client *client,
unsigned int cmd, void *arg)
{
- struct tda9875 *t = client->data;
+ struct tda9875 *t = i2c_get_clientdata(client);
dprintk("In tda9875_command...\n");
@@ -316,17 +317,15 @@
/* min is -84 max is 24 */
left = (t->lvol+84)*606;
right = (t->rvol+84)*606;
- va->volume=MAX(left,right);
- va->balance=(32768*MIN(left,right))/
+ va->volume=max(left,right);
+ va->balance=(32768*min(left,right))/
(va->volume ? va->volume : 1);
va->balance=(left<right)?
(65535-va->balance) : va->balance;
va->bass = (t->bass+12)*2427; /* min -12 max +15 */
va->treble = (t->treble+12)*2730;/* min -12 max +12 */
-
va->mode |= VIDEO_SOUND_MONO;
-
break; /* VIDIOCGAUDIO case */
}
@@ -336,9 +335,9 @@
int left,right;
dprintk("VIDEOCSAUDIO...\n");
- left = (MIN(65536 - va->balance,32768) *
+ left = (min(65536 - va->balance,32768) *
va->volume) / 32768;
- right = (MIN(va->balance,32768) *
+ right = (min(va->balance,(__u16)32768) *
va->volume) / 32768;
t->lvol = ((left/606)-84) & 0xff;
if (t->lvol > 24)
@@ -397,9 +396,9 @@
static struct i2c_client client_template =
{
- .name = "tda9875",
- .id = -1,
- .driver = &driver,
+ I2C_DEVNAME("tda9875"),
+ .id = -1,
+ .driver = &driver,
};
static int tda9875_init(void)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)