aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tda7432.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/tda7432.c')
-rw-r--r--drivers/media/video/tda7432.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c
index 3bd7dfb8cc7c..c6efc9826ba5 100644
--- a/drivers/media/video/tda7432.c
+++ b/drivers/media/video/tda7432.c
@@ -50,6 +50,7 @@
50 50
51#include "bttv.h" 51#include "bttv.h"
52#include <media/audiochip.h> 52#include <media/audiochip.h>
53#include <media/v4l2-common.h>
53 54
54#ifndef VIDEO_AUDIO_BALANCE 55#ifndef VIDEO_AUDIO_BALANCE
55# define VIDEO_AUDIO_BALANCE 32 56# define VIDEO_AUDIO_BALANCE 32
@@ -90,9 +91,6 @@ struct tda7432 {
90static struct i2c_driver driver; 91static struct i2c_driver driver;
91static struct i2c_client client_template; 92static struct i2c_client client_template;
92 93
93#define dprintk if (debug) printk
94#define d2printk if (debug > 1) printk
95
96/* The TDA7432 is made by STS-Thompson 94/* The TDA7432 is made by STS-Thompson
97 * http://www.st.com 95 * http://www.st.com
98 * http://us.st.com/stonline/books/pdf/docs/4056.pdf 96 * http://us.st.com/stonline/books/pdf/docs/4056.pdf
@@ -229,12 +227,12 @@ static struct i2c_client client_template;
229static int tda7432_write(struct i2c_client *client, int subaddr, int val) 227static int tda7432_write(struct i2c_client *client, int subaddr, int val)
230{ 228{
231 unsigned char buffer[2]; 229 unsigned char buffer[2];
232 d2printk("tda7432: In tda7432_write\n"); 230 v4l_dbg(2,client,"In tda7432_write\n");
233 dprintk("tda7432: Writing %d 0x%x\n", subaddr, val); 231 v4l_dbg(1,client,"Writing %d 0x%x\n", subaddr, val);
234 buffer[0] = subaddr; 232 buffer[0] = subaddr;
235 buffer[1] = val; 233 buffer[1] = val;
236 if (2 != i2c_master_send(client,buffer,2)) { 234 if (2 != i2c_master_send(client,buffer,2)) {
237 printk(KERN_WARNING "tda7432: I/O error, trying (write %d 0x%x)\n", 235 v4l_err(client,"I/O error, trying (write %d 0x%x)\n",
238 subaddr, val); 236 subaddr, val);
239 return -1; 237 return -1;
240 } 238 }
@@ -247,9 +245,9 @@ static int tda7432_set(struct i2c_client *client)
247{ 245{
248 struct tda7432 *t = i2c_get_clientdata(client); 246 struct tda7432 *t = i2c_get_clientdata(client);
249 unsigned char buf[16]; 247 unsigned char buf[16];
250 d2printk("tda7432: In tda7432_set\n"); 248 v4l_dbg(2,client,"In tda7432_set\n");
251 249
252 dprintk(KERN_INFO 250 v4l_dbg(1,client,
253 "tda7432: 7432_set(0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x)\n", 251 "tda7432: 7432_set(0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x)\n",
254 t->input,t->volume,t->bass,t->treble,t->lf,t->lr,t->rf,t->rr,t->loud); 252 t->input,t->volume,t->bass,t->treble,t->lf,t->lr,t->rf,t->rr,t->loud);
255 buf[0] = TDA7432_IN; 253 buf[0] = TDA7432_IN;
@@ -263,7 +261,7 @@ static int tda7432_set(struct i2c_client *client)
263 buf[8] = t->rr; 261 buf[8] = t->rr;
264 buf[9] = t->loud; 262 buf[9] = t->loud;
265 if (10 != i2c_master_send(client,buf,10)) { 263 if (10 != i2c_master_send(client,buf,10)) {
266 printk(KERN_WARNING "tda7432: I/O error, trying tda7432_set\n"); 264 v4l_err(client,"I/O error, trying tda7432_set\n");
267 return -1; 265 return -1;
268 } 266 }
269 267
@@ -273,7 +271,7 @@ static int tda7432_set(struct i2c_client *client)
273static void do_tda7432_init(struct i2c_client *client) 271static void do_tda7432_init(struct i2c_client *client)
274{ 272{
275 struct tda7432 *t = i2c_get_clientdata(client); 273 struct tda7432 *t = i2c_get_clientdata(client);
276 d2printk("tda7432: In tda7432_init\n"); 274 v4l_dbg(2,client,"In tda7432_init\n");
277 275
278 t->input = TDA7432_STEREO_IN | /* Main (stereo) input */ 276 t->input = TDA7432_STEREO_IN | /* Main (stereo) input */
279 TDA7432_BASS_SYM | /* Symmetric bass cut */ 277 TDA7432_BASS_SYM | /* Symmetric bass cut */
@@ -301,7 +299,6 @@ static int tda7432_attach(struct i2c_adapter *adap, int addr, int kind)
301{ 299{
302 struct tda7432 *t; 300 struct tda7432 *t;
303 struct i2c_client *client; 301 struct i2c_client *client;
304 d2printk("tda7432: In tda7432_attach\n");
305 302
306 t = kmalloc(sizeof *t,GFP_KERNEL); 303 t = kmalloc(sizeof *t,GFP_KERNEL);
307 if (!t) 304 if (!t)
@@ -315,9 +312,9 @@ static int tda7432_attach(struct i2c_adapter *adap, int addr, int kind)
315 i2c_set_clientdata(client, t); 312 i2c_set_clientdata(client, t);
316 313
317 do_tda7432_init(client); 314 do_tda7432_init(client);
318 printk(KERN_INFO "tda7432: init\n");
319
320 i2c_attach_client(client); 315 i2c_attach_client(client);
316
317 v4l_info(client, "chip found @ 0x%x (%s)\n", addr << 1, adap->name);
321 return 0; 318 return 0;
322} 319}
323 320
@@ -343,7 +340,9 @@ static int tda7432_command(struct i2c_client *client,
343 unsigned int cmd, void *arg) 340 unsigned int cmd, void *arg)
344{ 341{
345 struct tda7432 *t = i2c_get_clientdata(client); 342 struct tda7432 *t = i2c_get_clientdata(client);
346 d2printk("tda7432: In tda7432_command\n"); 343 v4l_dbg(2,client,"In tda7432_command\n");
344 if (debug>1)
345 v4l_i2c_print_ioctl(client,cmd);
347 346
348 switch (cmd) { 347 switch (cmd) {
349 /* --- v4l ioctls --- */ 348 /* --- v4l ioctls --- */
@@ -354,7 +353,6 @@ static int tda7432_command(struct i2c_client *client,
354 case VIDIOCGAUDIO: 353 case VIDIOCGAUDIO:
355 { 354 {
356 struct video_audio *va = arg; 355 struct video_audio *va = arg;
357 dprintk("tda7432: VIDIOCGAUDIO\n");
358 356
359 va->flags |= VIDEO_AUDIO_VOLUME | 357 va->flags |= VIDEO_AUDIO_VOLUME |
360 VIDEO_AUDIO_BASS | 358 VIDEO_AUDIO_BASS |
@@ -409,7 +407,6 @@ static int tda7432_command(struct i2c_client *client,
409 case VIDIOCSAUDIO: 407 case VIDIOCSAUDIO:
410 { 408 {
411 struct video_audio *va = arg; 409 struct video_audio *va = arg;
412 dprintk("tda7432: VIDEOCSAUDIO\n");
413 410
414 if(va->flags & VIDEO_AUDIO_VOLUME){ 411 if(va->flags & VIDEO_AUDIO_VOLUME){
415 if(!maxvol){ /* max +20db */ 412 if(!maxvol){ /* max +20db */
@@ -485,11 +482,6 @@ static int tda7432_command(struct i2c_client *client,
485 482
486 } /* end of VIDEOCSAUDIO case */ 483 } /* end of VIDEOCSAUDIO case */
487 484
488 default: /* Not VIDEOCGAUDIO or VIDEOCSAUDIO */
489
490 /* nothing */
491 d2printk("tda7432: Default\n");
492
493 } /* end of (cmd) switch */ 485 } /* end of (cmd) switch */
494 486
495 return 0; 487 return 0;
@@ -514,7 +506,7 @@ static struct i2c_client client_template =
514static int __init tda7432_init(void) 506static int __init tda7432_init(void)
515{ 507{
516 if ( (loudness < 0) || (loudness > 15) ) { 508 if ( (loudness < 0) || (loudness > 15) ) {
517 printk(KERN_ERR "tda7432: loudness parameter must be between 0 and 15\n"); 509 printk(KERN_ERR "loudness parameter must be between 0 and 15\n");
518 return -EINVAL; 510 return -EINVAL;
519 } 511 }
520 512