diff options
Diffstat (limited to 'drivers/media/video/tda7432.c')
-rw-r--r-- | drivers/media/video/tda7432.c | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c index 549c9929f107..99261f15e66e 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 { | |||
90 | static struct i2c_driver driver; | 91 | static struct i2c_driver driver; |
91 | static struct i2c_client client_template; | 92 | static 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; | |||
229 | static int tda7432_write(struct i2c_client *client, int subaddr, int val) | 227 | static 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) | |||
273 | static void do_tda7432_init(struct i2c_client *client) | 271 | static 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,21 +312,16 @@ 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 | ||
324 | static int tda7432_probe(struct i2c_adapter *adap) | 321 | static int tda7432_probe(struct i2c_adapter *adap) |
325 | { | 322 | { |
326 | #ifdef I2C_CLASS_TV_ANALOG | ||
327 | if (adap->class & I2C_CLASS_TV_ANALOG) | 323 | if (adap->class & I2C_CLASS_TV_ANALOG) |
328 | return i2c_probe(adap, &addr_data, tda7432_attach); | 324 | return i2c_probe(adap, &addr_data, tda7432_attach); |
329 | #else | ||
330 | if (adap->id == I2C_HW_B_BT848) | ||
331 | return i2c_probe(adap, &addr_data, tda7432_attach); | ||
332 | #endif | ||
333 | return 0; | 325 | return 0; |
334 | } | 326 | } |
335 | 327 | ||
@@ -348,7 +340,9 @@ static int tda7432_command(struct i2c_client *client, | |||
348 | unsigned int cmd, void *arg) | 340 | unsigned int cmd, void *arg) |
349 | { | 341 | { |
350 | struct tda7432 *t = i2c_get_clientdata(client); | 342 | struct tda7432 *t = i2c_get_clientdata(client); |
351 | 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); | ||
352 | 346 | ||
353 | switch (cmd) { | 347 | switch (cmd) { |
354 | /* --- v4l ioctls --- */ | 348 | /* --- v4l ioctls --- */ |
@@ -359,7 +353,6 @@ static int tda7432_command(struct i2c_client *client, | |||
359 | case VIDIOCGAUDIO: | 353 | case VIDIOCGAUDIO: |
360 | { | 354 | { |
361 | struct video_audio *va = arg; | 355 | struct video_audio *va = arg; |
362 | dprintk("tda7432: VIDIOCGAUDIO\n"); | ||
363 | 356 | ||
364 | va->flags |= VIDEO_AUDIO_VOLUME | | 357 | va->flags |= VIDEO_AUDIO_VOLUME | |
365 | VIDEO_AUDIO_BASS | | 358 | VIDEO_AUDIO_BASS | |
@@ -414,7 +407,6 @@ static int tda7432_command(struct i2c_client *client, | |||
414 | case VIDIOCSAUDIO: | 407 | case VIDIOCSAUDIO: |
415 | { | 408 | { |
416 | struct video_audio *va = arg; | 409 | struct video_audio *va = arg; |
417 | dprintk("tda7432: VIDEOCSAUDIO\n"); | ||
418 | 410 | ||
419 | if(va->flags & VIDEO_AUDIO_VOLUME){ | 411 | if(va->flags & VIDEO_AUDIO_VOLUME){ |
420 | if(!maxvol){ /* max +20db */ | 412 | if(!maxvol){ /* max +20db */ |
@@ -490,11 +482,6 @@ static int tda7432_command(struct i2c_client *client, | |||
490 | 482 | ||
491 | } /* end of VIDEOCSAUDIO case */ | 483 | } /* end of VIDEOCSAUDIO case */ |
492 | 484 | ||
493 | default: /* Not VIDEOCGAUDIO or VIDEOCSAUDIO */ | ||
494 | |||
495 | /* nothing */ | ||
496 | d2printk("tda7432: Default\n"); | ||
497 | |||
498 | } /* end of (cmd) switch */ | 485 | } /* end of (cmd) switch */ |
499 | 486 | ||
500 | return 0; | 487 | return 0; |
@@ -502,7 +489,7 @@ static int tda7432_command(struct i2c_client *client, | |||
502 | 489 | ||
503 | static struct i2c_driver driver = { | 490 | static struct i2c_driver driver = { |
504 | .driver = { | 491 | .driver = { |
505 | .name = "i2c tda7432 driver", | 492 | .name = "tda7432", |
506 | }, | 493 | }, |
507 | .id = I2C_DRIVERID_TDA7432, | 494 | .id = I2C_DRIVERID_TDA7432, |
508 | .attach_adapter = tda7432_probe, | 495 | .attach_adapter = tda7432_probe, |
@@ -519,7 +506,7 @@ static struct i2c_client client_template = | |||
519 | static int __init tda7432_init(void) | 506 | static int __init tda7432_init(void) |
520 | { | 507 | { |
521 | if ( (loudness < 0) || (loudness > 15) ) { | 508 | if ( (loudness < 0) || (loudness > 15) ) { |
522 | 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"); |
523 | return -EINVAL; | 510 | return -EINVAL; |
524 | } | 511 | } |
525 | 512 | ||