diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-01-09 12:32:40 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2006-01-09 12:32:40 -0500 |
commit | fac9e89999a12f378112fe93764b30196bc03f46 (patch) | |
tree | 6daf5fee44efe3d878358d17fa9934139d0c7ade /drivers/media/video/saa7127.c | |
parent | 0e7072ef6623c3dc58faf3f7310aba77b0a5845e (diff) |
V4L/DVB (3278): convert diagnostics over to the new v4l2-common.h macros.
- Convert diagnostics over to the new v4l2-common.h macros.
- deprecated tuner_debug option, the new option is debug.
- renamed cx25840_debug to debug.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'drivers/media/video/saa7127.c')
-rw-r--r-- | drivers/media/video/saa7127.c | 78 |
1 files changed, 27 insertions, 51 deletions
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index aee0f2d73da3..2009c1bc4720 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c | |||
@@ -66,30 +66,6 @@ module_param(test_image, int, 0644); | |||
66 | MODULE_PARM_DESC(debug, "debug level (0-2)"); | 66 | MODULE_PARM_DESC(debug, "debug level (0-2)"); |
67 | MODULE_PARM_DESC(test_image, "test_image (0-1)"); | 67 | MODULE_PARM_DESC(test_image, "test_image (0-1)"); |
68 | 68 | ||
69 | #define saa7127_dbg(fmt, arg...) \ | ||
70 | do { \ | ||
71 | if (debug >= 1) \ | ||
72 | printk(KERN_INFO "%s debug %d-%04x: " fmt, \ | ||
73 | client->driver->driver.name, \ | ||
74 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ | ||
75 | } while (0) | ||
76 | |||
77 | /* High volume debug. Use with care. */ | ||
78 | #define saa7127_dbg_highvol(fmt, arg...) \ | ||
79 | do { \ | ||
80 | if (debug == 2) \ | ||
81 | printk(KERN_INFO "%s debug %d-%04x: " fmt, \ | ||
82 | client->driver->driver.name, \ | ||
83 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ | ||
84 | } while (0) | ||
85 | |||
86 | #define saa7127_err(fmt, arg...) do { \ | ||
87 | printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \ | ||
88 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | ||
89 | #define saa7127_info(fmt, arg...) do { \ | ||
90 | printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \ | ||
91 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | ||
92 | |||
93 | static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END }; | 69 | static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END }; |
94 | 70 | ||
95 | 71 | ||
@@ -336,7 +312,7 @@ static int saa7127_write(struct i2c_client *client, u8 reg, u8 val) | |||
336 | if (i2c_smbus_write_byte_data(client, reg, val) == 0) | 312 | if (i2c_smbus_write_byte_data(client, reg, val) == 0) |
337 | return 0; | 313 | return 0; |
338 | } | 314 | } |
339 | saa7127_err("I2C Write Problem\n"); | 315 | v4l_err(client, "I2C Write Problem\n"); |
340 | return -1; | 316 | return -1; |
341 | } | 317 | } |
342 | 318 | ||
@@ -362,7 +338,7 @@ static int saa7127_set_vps(struct i2c_client *client, struct v4l2_sliced_vbi_dat | |||
362 | if (enable && (data->field != 0 || data->line != 16)) | 338 | if (enable && (data->field != 0 || data->line != 16)) |
363 | return -EINVAL; | 339 | return -EINVAL; |
364 | if (state->vps_enable != enable) { | 340 | if (state->vps_enable != enable) { |
365 | saa7127_dbg("Turn VPS Signal %s\n", enable ? "on" : "off"); | 341 | v4l_dbg(1, client, "Turn VPS Signal %s\n", enable ? "on" : "off"); |
366 | saa7127_write(client, 0x54, enable << 7); | 342 | saa7127_write(client, 0x54, enable << 7); |
367 | state->vps_enable = enable; | 343 | state->vps_enable = enable; |
368 | } | 344 | } |
@@ -374,7 +350,7 @@ static int saa7127_set_vps(struct i2c_client *client, struct v4l2_sliced_vbi_dat | |||
374 | state->vps_data[2] = data->data[11]; | 350 | state->vps_data[2] = data->data[11]; |
375 | state->vps_data[3] = data->data[12]; | 351 | state->vps_data[3] = data->data[12]; |
376 | state->vps_data[4] = data->data[13]; | 352 | state->vps_data[4] = data->data[13]; |
377 | saa7127_dbg("Set VPS data %02x %02x %02x %02x %02x\n", | 353 | v4l_dbg(1, client, "Set VPS data %02x %02x %02x %02x %02x\n", |
378 | state->vps_data[0], state->vps_data[1], | 354 | state->vps_data[0], state->vps_data[1], |
379 | state->vps_data[2], state->vps_data[3], | 355 | state->vps_data[2], state->vps_data[3], |
380 | state->vps_data[4]); | 356 | state->vps_data[4]); |
@@ -397,7 +373,7 @@ static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data | |||
397 | if (enable && (data->field != 0 || data->line != 21)) | 373 | if (enable && (data->field != 0 || data->line != 21)) |
398 | return -EINVAL; | 374 | return -EINVAL; |
399 | if (state->cc_enable != enable) { | 375 | if (state->cc_enable != enable) { |
400 | saa7127_dbg("Turn CC %s\n", enable ? "on" : "off"); | 376 | v4l_dbg(1, client, "Turn CC %s\n", enable ? "on" : "off"); |
401 | saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, | 377 | saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, |
402 | (state->xds_enable << 7) | (enable << 6) | 0x11); | 378 | (state->xds_enable << 7) | (enable << 6) | 0x11); |
403 | state->cc_enable = enable; | 379 | state->cc_enable = enable; |
@@ -405,7 +381,7 @@ static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data | |||
405 | if (!enable) | 381 | if (!enable) |
406 | return 0; | 382 | return 0; |
407 | 383 | ||
408 | saa7127_dbg_highvol("CC data: %04x\n", cc); | 384 | v4l_dbg(2, client, "CC data: %04x\n", cc); |
409 | saa7127_write(client, SAA7127_REG_LINE_21_ODD_0, cc & 0xff); | 385 | saa7127_write(client, SAA7127_REG_LINE_21_ODD_0, cc & 0xff); |
410 | saa7127_write(client, SAA7127_REG_LINE_21_ODD_1, cc >> 8); | 386 | saa7127_write(client, SAA7127_REG_LINE_21_ODD_1, cc >> 8); |
411 | state->cc_data = cc; | 387 | state->cc_data = cc; |
@@ -423,7 +399,7 @@ static int saa7127_set_xds(struct i2c_client *client, struct v4l2_sliced_vbi_dat | |||
423 | if (enable && (data->field != 1 || data->line != 21)) | 399 | if (enable && (data->field != 1 || data->line != 21)) |
424 | return -EINVAL; | 400 | return -EINVAL; |
425 | if (state->xds_enable != enable) { | 401 | if (state->xds_enable != enable) { |
426 | saa7127_dbg("Turn XDS %s\n", enable ? "on" : "off"); | 402 | v4l_dbg(1, client, "Turn XDS %s\n", enable ? "on" : "off"); |
427 | saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, | 403 | saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, |
428 | (enable << 7) | (state->cc_enable << 6) | 0x11); | 404 | (enable << 7) | (state->cc_enable << 6) | 0x11); |
429 | state->xds_enable = enable; | 405 | state->xds_enable = enable; |
@@ -431,7 +407,7 @@ static int saa7127_set_xds(struct i2c_client *client, struct v4l2_sliced_vbi_dat | |||
431 | if (!enable) | 407 | if (!enable) |
432 | return 0; | 408 | return 0; |
433 | 409 | ||
434 | saa7127_dbg_highvol("XDS data: %04x\n", xds); | 410 | v4l_dbg(2, client, "XDS data: %04x\n", xds); |
435 | saa7127_write(client, SAA7127_REG_LINE_21_EVEN_0, xds & 0xff); | 411 | saa7127_write(client, SAA7127_REG_LINE_21_EVEN_0, xds & 0xff); |
436 | saa7127_write(client, SAA7127_REG_LINE_21_EVEN_1, xds >> 8); | 412 | saa7127_write(client, SAA7127_REG_LINE_21_EVEN_1, xds >> 8); |
437 | state->xds_data = xds; | 413 | state->xds_data = xds; |
@@ -448,7 +424,7 @@ static int saa7127_set_wss(struct i2c_client *client, struct v4l2_sliced_vbi_dat | |||
448 | if (enable && (data->field != 0 || data->line != 23)) | 424 | if (enable && (data->field != 0 || data->line != 23)) |
449 | return -EINVAL; | 425 | return -EINVAL; |
450 | if (state->wss_enable != enable) { | 426 | if (state->wss_enable != enable) { |
451 | saa7127_dbg("Turn WSS %s\n", enable ? "on" : "off"); | 427 | v4l_dbg(1, client, "Turn WSS %s\n", enable ? "on" : "off"); |
452 | saa7127_write(client, 0x27, enable << 7); | 428 | saa7127_write(client, 0x27, enable << 7); |
453 | state->wss_enable = enable; | 429 | state->wss_enable = enable; |
454 | } | 430 | } |
@@ -457,7 +433,7 @@ static int saa7127_set_wss(struct i2c_client *client, struct v4l2_sliced_vbi_dat | |||
457 | 433 | ||
458 | saa7127_write(client, 0x26, data->data[0]); | 434 | saa7127_write(client, 0x26, data->data[0]); |
459 | saa7127_write(client, 0x27, 0x80 | (data->data[1] & 0x3f)); | 435 | saa7127_write(client, 0x27, 0x80 | (data->data[1] & 0x3f)); |
460 | saa7127_dbg("WSS mode: %s\n", wss_strs[data->data[0] & 0xf]); | 436 | v4l_dbg(1, client, "WSS mode: %s\n", wss_strs[data->data[0] & 0xf]); |
461 | state->wss_mode = (data->data[1] & 0x3f) << 8 | data->data[0]; | 437 | state->wss_mode = (data->data[1] & 0x3f) << 8 | data->data[0]; |
462 | return 0; | 438 | return 0; |
463 | } | 439 | } |
@@ -469,11 +445,11 @@ static int saa7127_set_video_enable(struct i2c_client *client, int enable) | |||
469 | struct saa7127_state *state = i2c_get_clientdata(client); | 445 | struct saa7127_state *state = i2c_get_clientdata(client); |
470 | 446 | ||
471 | if (enable) { | 447 | if (enable) { |
472 | saa7127_dbg("Enable Video Output\n"); | 448 | v4l_dbg(1, client, "Enable Video Output\n"); |
473 | saa7127_write(client, 0x2d, state->reg_2d); | 449 | saa7127_write(client, 0x2d, state->reg_2d); |
474 | saa7127_write(client, 0x61, state->reg_61); | 450 | saa7127_write(client, 0x61, state->reg_61); |
475 | } else { | 451 | } else { |
476 | saa7127_dbg("Disable Video Output\n"); | 452 | v4l_dbg(1, client, "Disable Video Output\n"); |
477 | saa7127_write(client, 0x2d, (state->reg_2d & 0xf0)); | 453 | saa7127_write(client, 0x2d, (state->reg_2d & 0xf0)); |
478 | saa7127_write(client, 0x61, (state->reg_61 | 0xc0)); | 454 | saa7127_write(client, 0x61, (state->reg_61 | 0xc0)); |
479 | } | 455 | } |
@@ -489,11 +465,11 @@ static int saa7127_set_std(struct i2c_client *client, v4l2_std_id std) | |||
489 | const struct i2c_reg_value *inittab; | 465 | const struct i2c_reg_value *inittab; |
490 | 466 | ||
491 | if (std & V4L2_STD_525_60) { | 467 | if (std & V4L2_STD_525_60) { |
492 | saa7127_dbg("Selecting 60 Hz video Standard\n"); | 468 | v4l_dbg(1, client, "Selecting 60 Hz video Standard\n"); |
493 | inittab = saa7127_init_config_60hz; | 469 | inittab = saa7127_init_config_60hz; |
494 | state->reg_61 = SAA7127_60HZ_DAC_CONTROL; | 470 | state->reg_61 = SAA7127_60HZ_DAC_CONTROL; |
495 | } else { | 471 | } else { |
496 | saa7127_dbg("Selecting 50 Hz video Standard\n"); | 472 | v4l_dbg(1, client, "Selecting 50 Hz video Standard\n"); |
497 | inittab = saa7127_init_config_50hz; | 473 | inittab = saa7127_init_config_50hz; |
498 | state->reg_61 = SAA7127_50HZ_DAC_CONTROL; | 474 | state->reg_61 = SAA7127_50HZ_DAC_CONTROL; |
499 | } | 475 | } |
@@ -544,7 +520,7 @@ static int saa7127_set_output_type(struct i2c_client *client, int output) | |||
544 | default: | 520 | default: |
545 | return -EINVAL; | 521 | return -EINVAL; |
546 | } | 522 | } |
547 | saa7127_dbg("Selecting %s output type\n", output_strs[output]); | 523 | v4l_dbg(1, client, "Selecting %s output type\n", output_strs[output]); |
548 | 524 | ||
549 | /* Configure Encoder */ | 525 | /* Configure Encoder */ |
550 | saa7127_write(client, 0x2d, state->reg_2d); | 526 | saa7127_write(client, 0x2d, state->reg_2d); |
@@ -561,12 +537,12 @@ static int saa7127_set_input_type(struct i2c_client *client, int input) | |||
561 | 537 | ||
562 | switch (input) { | 538 | switch (input) { |
563 | case SAA7127_INPUT_TYPE_NORMAL: /* avia */ | 539 | case SAA7127_INPUT_TYPE_NORMAL: /* avia */ |
564 | saa7127_dbg("Selecting Normal Encoder Input\n"); | 540 | v4l_dbg(1, client, "Selecting Normal Encoder Input\n"); |
565 | state->reg_3a_cb = 0; | 541 | state->reg_3a_cb = 0; |
566 | break; | 542 | break; |
567 | 543 | ||
568 | case SAA7127_INPUT_TYPE_TEST_IMAGE: /* color bar */ | 544 | case SAA7127_INPUT_TYPE_TEST_IMAGE: /* color bar */ |
569 | saa7127_dbg("Selecting Color Bar generator\n"); | 545 | v4l_dbg(1, client, "Selecting Color Bar generator\n"); |
570 | state->reg_3a_cb = 0x80; | 546 | state->reg_3a_cb = 0x80; |
571 | break; | 547 | break; |
572 | 548 | ||
@@ -633,14 +609,14 @@ static int saa7127_command(struct i2c_client *client, | |||
633 | break; | 609 | break; |
634 | 610 | ||
635 | case VIDIOC_LOG_STATUS: | 611 | case VIDIOC_LOG_STATUS: |
636 | saa7127_info("Standard: %s\n", (state->std & V4L2_STD_525_60) ? "60 Hz" : "50 Hz"); | 612 | v4l_info(client, "Standard: %s\n", (state->std & V4L2_STD_525_60) ? "60 Hz" : "50 Hz"); |
637 | saa7127_info("Input: %s\n", state->input_type ? "color bars" : "normal"); | 613 | v4l_info(client, "Input: %s\n", state->input_type ? "color bars" : "normal"); |
638 | saa7127_info("Output: %s\n", state->video_enable ? | 614 | v4l_info(client, "Output: %s\n", state->video_enable ? |
639 | output_strs[state->output_type] : "disabled"); | 615 | output_strs[state->output_type] : "disabled"); |
640 | saa7127_info("WSS: %s\n", state->wss_enable ? | 616 | v4l_info(client, "WSS: %s\n", state->wss_enable ? |
641 | wss_strs[state->wss_mode] : "disabled"); | 617 | wss_strs[state->wss_mode] : "disabled"); |
642 | saa7127_info("VPS: %s\n", state->vps_enable ? "enabled" : "disabled"); | 618 | v4l_info(client, "VPS: %s\n", state->vps_enable ? "enabled" : "disabled"); |
643 | saa7127_info("CC: %s\n", state->cc_enable ? "enabled" : "disabled"); | 619 | v4l_info(client, "CC: %s\n", state->cc_enable ? "enabled" : "disabled"); |
644 | break; | 620 | break; |
645 | 621 | ||
646 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 622 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
@@ -723,7 +699,7 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) | |||
723 | client->driver = &i2c_driver_saa7127; | 699 | client->driver = &i2c_driver_saa7127; |
724 | snprintf(client->name, sizeof(client->name) - 1, "saa7127"); | 700 | snprintf(client->name, sizeof(client->name) - 1, "saa7127"); |
725 | 701 | ||
726 | saa7127_dbg("detecting saa7127 client on address 0x%x\n", address << 1); | 702 | v4l_dbg(1, client, "detecting saa7127 client on address 0x%x\n", address << 1); |
727 | 703 | ||
728 | /* First test register 0: Bits 5-7 are a version ID (should be 0), | 704 | /* First test register 0: Bits 5-7 are a version ID (should be 0), |
729 | and bit 2 should also be 0. | 705 | and bit 2 should also be 0. |
@@ -732,7 +708,7 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) | |||
732 | 0x1d after a reset and not expected to ever change. */ | 708 | 0x1d after a reset and not expected to ever change. */ |
733 | if ((saa7127_read(client, 0) & 0xe4) != 0 || | 709 | if ((saa7127_read(client, 0) & 0xe4) != 0 || |
734 | (saa7127_read(client, 0x29) & 0x3f) != 0x1d) { | 710 | (saa7127_read(client, 0x29) & 0x3f) != 0x1d) { |
735 | saa7127_dbg("saa7127 not found\n"); | 711 | v4l_dbg(1, client, "saa7127 not found\n"); |
736 | kfree(client); | 712 | kfree(client); |
737 | return 0; | 713 | return 0; |
738 | } | 714 | } |
@@ -748,7 +724,7 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) | |||
748 | 724 | ||
749 | /* Configure Encoder */ | 725 | /* Configure Encoder */ |
750 | 726 | ||
751 | saa7127_dbg("Configuring encoder\n"); | 727 | v4l_dbg(1, client, "Configuring encoder\n"); |
752 | saa7127_write_inittab(client, saa7127_init_config_common); | 728 | saa7127_write_inittab(client, saa7127_init_config_common); |
753 | saa7127_set_std(client, V4L2_STD_NTSC); | 729 | saa7127_set_std(client, V4L2_STD_NTSC); |
754 | saa7127_set_output_type(client, SAA7127_OUTPUT_TYPE_BOTH); | 730 | saa7127_set_output_type(client, SAA7127_OUTPUT_TYPE_BOTH); |
@@ -769,12 +745,12 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) | |||
769 | read_result = saa7127_read(client, SAA7129_REG_FADE_KEY_COL2); | 745 | read_result = saa7127_read(client, SAA7129_REG_FADE_KEY_COL2); |
770 | saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, 0xaa); | 746 | saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, 0xaa); |
771 | if (saa7127_read(client, SAA7129_REG_FADE_KEY_COL2) == 0xaa) { | 747 | if (saa7127_read(client, SAA7129_REG_FADE_KEY_COL2) == 0xaa) { |
772 | saa7127_info("saa7129 found @ 0x%x (%s)\n", address << 1, adapter->name); | 748 | v4l_info(client, "saa7129 found @ 0x%x (%s)\n", address << 1, adapter->name); |
773 | saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, read_result); | 749 | saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, read_result); |
774 | saa7127_write_inittab(client, saa7129_init_config_extra); | 750 | saa7127_write_inittab(client, saa7129_init_config_extra); |
775 | state->ident = V4L2_IDENT_SAA7129; | 751 | state->ident = V4L2_IDENT_SAA7129; |
776 | } else { | 752 | } else { |
777 | saa7127_info("saa7127 found @ 0x%x (%s)\n", address << 1, adapter->name); | 753 | v4l_info(client, "saa7127 found @ 0x%x (%s)\n", address << 1, adapter->name); |
778 | state->ident = V4L2_IDENT_SAA7127; | 754 | state->ident = V4L2_IDENT_SAA7127; |
779 | } | 755 | } |
780 | 756 | ||