summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/tda9875.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/tda9875.c')
-rw-r--r--linux/drivers/media/video/tda9875.c54
1 files changed, 21 insertions, 33 deletions
diff --git a/linux/drivers/media/video/tda9875.c b/linux/drivers/media/video/tda9875.c
index 95665fb44..f71784720 100644
--- a/linux/drivers/media/video/tda9875.c
+++ b/linux/drivers/media/video/tda9875.c
@@ -62,8 +62,6 @@ struct tda9875 {
static struct i2c_driver driver;
static struct i2c_client client_template;
-#define dprintk if (debug) printk
-
/* The TDA9875 is made by Philips Semiconductor
* http://www.semiconductors.philips.com
* TDA9875: I2C-bus controlled DSP audio processor, FM demodulator
@@ -116,12 +114,12 @@ static struct i2c_client client_template;
static int tda9875_write(struct i2c_client *client, int subaddr, unsigned char val)
{
unsigned char buffer[2];
- dprintk("In tda9875_write\n");
- dprintk("Writing %d 0x%x\n", subaddr, val);
+ v4l_dbg(2,client,"In tda9875_write\n");
+ v4l_dbg(1,client,"Writing %d 0x%x\n", subaddr, val);
buffer[0] = subaddr;
buffer[1] = val;
if (2 != i2c_master_send(client,buffer,2)) {
- printk(KERN_WARNING "tda9875: I/O error, trying (write %d 0x%x)\n",
+ v4l_err(client,"I/O error, trying (write %d 0x%x)\n",
subaddr, val);
return -1;
}
@@ -132,12 +130,12 @@ static int tda9875_write(struct i2c_client *client, int subaddr, unsigned char v
static int tda9875_read(struct i2c_client *client)
{
unsigned char buffer;
- dprintk("In tda9875_read\n");
+ v4l_dbg(2,client,"In tda9875_read\n");
if (1 != i2c_master_recv(client,&buffer,1)) {
- printk(KERN_WARNING "tda9875: I/O error, trying (read)\n");
+ v4l_err(client,"I/O error, trying (read)\n");
return -1;
}
- dprintk("Read 0x%02x\n", buffer);
+ v4l_dbg(1,client,"Read 0x%02x\n", buffer);
return buffer;
}
#endif
@@ -153,10 +151,10 @@ static int i2c_read_register(struct i2c_adapter *adap, int addr, int reg)
write[0] = reg;
if (2 != i2c_transfer(adap,msgs,2)) {
- printk(KERN_WARNING "tda9875: I/O error (read2)\n");
+ v4l_err(client,"I/O error (read2)\n");
return -1;
}
- dprintk("tda9875: chip_read2: reg%d=0x%x\n",reg,read[0]);
+ v4l_dbg(1,client,"chip_read2: reg%d=0x%x\n",reg,read[0]);
return read[0];
}
@@ -165,7 +163,7 @@ static void tda9875_set(struct i2c_client *client)
struct tda9875 *tda = i2c_get_clientdata(client);
unsigned char a;
- dprintk(KERN_DEBUG "tda9875_set(%04x,%04x,%04x,%04x)\n",
+ v4l_dbg(1,client,"tda9875_set(%04x,%04x,%04x,%04x)\n",
tda->lvol,tda->rvol,tda->bass,tda->treble);
@@ -182,7 +180,7 @@ static void tda9875_set(struct i2c_client *client)
static void do_tda9875_init(struct i2c_client *client)
{
struct tda9875 *t = i2c_get_clientdata(client);
- dprintk("In tda9875_init\n");
+ v4l_dbg(2,client,"In tda9875_init\n");
tda9875_write(client, TDA9875_CFG, 0xd0 ); /*reg de config 0 (reset)*/
tda9875_write(client, TDA9875_MSR, 0x03 ); /* Monitor 0b00000XXX*/
tda9875_write(client, TDA9875_C1MSB, 0x00 ); /*Car1(FM) MSB XMHz*/
@@ -237,11 +235,11 @@ static int tda9875_checkit(struct i2c_adapter *adap, int addr)
rev=i2c_read_register(adap,addr,255);
if(dic==0 || dic==2) { // tda9875 and tda9875A
- printk("tda9875: TDA9875%s Rev.%d detected at 0x%x\n",
+ v4l_info(client,"TDA9875%s Rev.%d detected at 0x%x\n",
dic==0?"":"A", rev,addr<<1);
return 1;
}
- printk("tda9875: no such chip at 0x%x (dic=0x%x rev=0x%x)\n",addr<<1,dic,rev);
+ v4l_err(client,"no such chip at 0x%x (dic=0x%x rev=0x%x)\n",addr<<1,dic,rev);
return(0);
}
@@ -254,7 +252,6 @@ static int tda9875_attach(struct i2c_adapter *adap, int addr,
{
struct tda9875 *t;
struct i2c_client *client;
- dprintk("In tda9875_attach\n");
t = kmalloc(sizeof *t,GFP_KERNEL);
if (!t)
@@ -276,9 +273,9 @@ static int tda9875_attach(struct i2c_adapter *adap, int addr,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
MOD_INC_USE_COUNT;
#endif
- printk(KERN_INFO "tda9875: init\n");
-
i2c_attach_client(client);
+
+ v4l_info(client, "chip found @ 0x%x (%s)\n", address << 1, adapter->name);
return 0;
}
@@ -313,8 +310,9 @@ static int tda9875_command(struct i2c_client *client,
{
struct tda9875 *t = i2c_get_clientdata(client);
- dprintk("In tda9875_command...\n");
-
+ v4l_dbg(2,client,"In tda9875_command...\n");
+ if (debug>1)
+ v4l_i2c_print_ioctl(client,cmd);
switch (cmd) {
/* --- v4l ioctls --- */
/* take care: bttv does userspace copying, we'll get a
@@ -324,8 +322,6 @@ static int tda9875_command(struct i2c_client *client,
struct video_audio *va = arg;
int left,right;
- dprintk("VIDIOCGAUDIO\n");
-
va->flags |= VIDEO_AUDIO_VOLUME |
VIDEO_AUDIO_BASS |
VIDEO_AUDIO_TREBLE;
@@ -350,7 +346,6 @@ static int tda9875_command(struct i2c_client *client,
struct video_audio *va = arg;
int left,right;
- dprintk("VIDEOCSAUDIO...\n");
left = (min(65536 - va->balance,32768) *
va->volume) / 32768;
right = (min(va->balance,(__u16)32768) *
@@ -379,10 +374,8 @@ static int tda9875_command(struct i2c_client *client,
if (t->treble < -12)
t->treble = -12 & 0xff;
-
-
-//printk("tda9875 bal:%04x vol:%04x bass:%04x treble:%04x\n",va->balance,va->volume,va->bass,va->treble);
-
+ v4l_dbg(2,"bal:%04x vol:%04x bass:%04x treble:%04x\n",
+ va->balance,va->volume,va->bass,va->treble);
tda9875_set(client);
@@ -390,11 +383,6 @@ static int tda9875_command(struct i2c_client *client,
} /* end of VIDEOCSAUDIO case */
- default: /* Not VIDEOCGAUDIO or VIDEOCSAUDIO */
-
- /* nothing */
- dprintk("Default\n");
-
} /* end of (cmd) switch */
return 0;
@@ -406,11 +394,11 @@ static struct i2c_driver driver = {
.owner = THIS_MODULE,
#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
- .name = "i2c tda9875 driver",
+ .name = "tda9875",
.flags = I2C_DF_NOTIFY,
#else
.driver = {
- .name = "i2c tda9875 driver",
+ .name = "tda9875",
},
#endif
.id = I2C_DRIVERID_TDA9875,