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.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/linux/drivers/media/video/tda9875.c b/linux/drivers/media/video/tda9875.c
index f71784720..499f0e0c2 100644
--- a/linux/drivers/media/video/tda9875.c
+++ b/linux/drivers/media/video/tda9875.c
@@ -25,6 +25,7 @@
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/slab.h>
+#include "compat.h"
#include <linux/videodev.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
@@ -38,6 +39,7 @@
#else
#include <media/audiochip.h>
#endif
+#include <media/v4l2-common.h>
static int debug; /* insmod parameter */
module_param(debug, int, S_IRUGO | S_IWUSR);
@@ -62,6 +64,8 @@ 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
@@ -114,12 +118,12 @@ static struct i2c_client client_template;
static int tda9875_write(struct i2c_client *client, int subaddr, unsigned char val)
{
unsigned char buffer[2];
- v4l_dbg(2,client,"In tda9875_write\n");
- v4l_dbg(1,client,"Writing %d 0x%x\n", subaddr, val);
+ dprintk("In tda9875_write\n");
+ dprintk("Writing %d 0x%x\n", subaddr, val);
buffer[0] = subaddr;
buffer[1] = val;
if (2 != i2c_master_send(client,buffer,2)) {
- v4l_err(client,"I/O error, trying (write %d 0x%x)\n",
+ printk(KERN_WARNING "tda9875: I/O error, trying (write %d 0x%x)\n",
subaddr, val);
return -1;
}
@@ -151,10 +155,10 @@ static int i2c_read_register(struct i2c_adapter *adap, int addr, int reg)
write[0] = reg;
if (2 != i2c_transfer(adap,msgs,2)) {
- v4l_err(client,"I/O error (read2)\n");
+ printk(KERN_WARNING "tda9875: I/O error (read2)\n");
return -1;
}
- v4l_dbg(1,client,"chip_read2: reg%d=0x%x\n",reg,read[0]);
+ dprintk("tda9875: chip_read2: reg%d=0x%x\n",reg,read[0]);
return read[0];
}
@@ -163,7 +167,7 @@ static void tda9875_set(struct i2c_client *client)
struct tda9875 *tda = i2c_get_clientdata(client);
unsigned char a;
- v4l_dbg(1,client,"tda9875_set(%04x,%04x,%04x,%04x)\n",
+ dprintk(KERN_DEBUG "tda9875_set(%04x,%04x,%04x,%04x)\n",
tda->lvol,tda->rvol,tda->bass,tda->treble);
@@ -180,7 +184,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);
- v4l_dbg(2,client,"In tda9875_init\n");
+ dprintk("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*/
@@ -235,11 +239,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
- v4l_info(client,"TDA9875%s Rev.%d detected at 0x%x\n",
+ printk("tda9875: TDA9875%s Rev.%d detected at 0x%x\n",
dic==0?"":"A", rev,addr<<1);
return 1;
}
- v4l_err(client,"no such chip at 0x%x (dic=0x%x rev=0x%x)\n",addr<<1,dic,rev);
+ printk("tda9875: no such chip at 0x%x (dic=0x%x rev=0x%x)\n",addr<<1,dic,rev);
return(0);
}
@@ -252,6 +256,7 @@ 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)
@@ -275,7 +280,7 @@ static int tda9875_attach(struct i2c_adapter *adap, int addr,
#endif
i2c_attach_client(client);
- v4l_info(client, "chip found @ 0x%x (%s)\n", address << 1, adapter->name);
+ printk(KERN_INFO "tda9875: init\n");
return 0;
}
@@ -310,9 +315,8 @@ static int tda9875_command(struct i2c_client *client,
{
struct tda9875 *t = i2c_get_clientdata(client);
- v4l_dbg(2,client,"In tda9875_command...\n");
- if (debug>1)
- v4l_i2c_print_ioctl(client,cmd);
+ dprintk("In tda9875_command...\n");
+
switch (cmd) {
/* --- v4l ioctls --- */
/* take care: bttv does userspace copying, we'll get a
@@ -322,6 +326,8 @@ 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;
@@ -346,6 +352,7 @@ 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) *
@@ -374,8 +381,10 @@ static int tda9875_command(struct i2c_client *client,
if (t->treble < -12)
t->treble = -12 & 0xff;
- v4l_dbg(2,"bal:%04x vol:%04x bass:%04x treble:%04x\n",
- va->balance,va->volume,va->bass,va->treble);
+
+
+//printk("tda9875 bal:%04x vol:%04x bass:%04x treble:%04x\n",va->balance,va->volume,va->bass,va->treble);
+
tda9875_set(client);
@@ -383,6 +392,11 @@ 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;