aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7127.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-12-12 08:23:52 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:04:06 -0500
commit9fad368b6dff95b8b009a6b8eed42a549a05b263 (patch)
tree1ae85598418897c55b55416693226ca419bb9db0 /drivers/media/video/saa7127.c
parentd52c7385ec8d4d2081b0db47e309723ce3eae816 (diff)
V4L/DVB (6867): saa7127: CodingStyle cleanups
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/saa7127.c')
-rw-r--r--drivers/media/video/saa7127.c61
1 files changed, 32 insertions, 29 deletions
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c
index b146eedfc7a6..06c88db656b4 100644
--- a/drivers/media/video/saa7127.c
+++ b/drivers/media/video/saa7127.c
@@ -58,8 +58,8 @@
58#include <media/v4l2-i2c-drv.h> 58#include <media/v4l2-i2c-drv.h>
59#include <media/saa7127.h> 59#include <media/saa7127.h>
60 60
61static int debug = 0; 61static int debug;
62static int test_image = 0; 62static int test_image;
63 63
64MODULE_DESCRIPTION("Philips SAA7127/9 video encoder driver"); 64MODULE_DESCRIPTION("Philips SAA7127/9 video encoder driver");
65MODULE_AUTHOR("Kevin Thayer, Chris Kennedy, Hans Verkuil"); 65MODULE_AUTHOR("Kevin Thayer, Chris Kennedy, Hans Verkuil");
@@ -357,9 +357,10 @@ static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data
357 if (enable && (data->field != 0 || data->line != 21)) 357 if (enable && (data->field != 0 || data->line != 21))
358 return -EINVAL; 358 return -EINVAL;
359 if (state->cc_enable != enable) { 359 if (state->cc_enable != enable) {
360 v4l_dbg(1, debug, client, "Turn CC %s\n", enable ? "on" : "off"); 360 v4l_dbg(1, debug, client,
361 "Turn CC %s\n", enable ? "on" : "off");
361 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, 362 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION,
362 (state->xds_enable << 7) | (enable << 6) | 0x11); 363 (state->xds_enable << 7) | (enable << 6) | 0x11);
363 state->cc_enable = enable; 364 state->cc_enable = enable;
364 } 365 }
365 if (!enable) 366 if (!enable)
@@ -417,7 +418,8 @@ static int saa7127_set_wss(struct i2c_client *client, struct v4l2_sliced_vbi_dat
417 418
418 saa7127_write(client, 0x26, data->data[0]); 419 saa7127_write(client, 0x26, data->data[0]);
419 saa7127_write(client, 0x27, 0x80 | (data->data[1] & 0x3f)); 420 saa7127_write(client, 0x27, 0x80 | (data->data[1] & 0x3f));
420 v4l_dbg(1, debug, client, "WSS mode: %s\n", wss_strs[data->data[0] & 0xf]); 421 v4l_dbg(1, debug, client,
422 "WSS mode: %s\n", wss_strs[data->data[0] & 0xf]);
421 state->wss_mode = (data->data[1] & 0x3f) << 8 | data->data[0]; 423 state->wss_mode = (data->data[1] & 0x3f) << 8 | data->data[0];
422 return 0; 424 return 0;
423} 425}
@@ -504,7 +506,8 @@ static int saa7127_set_output_type(struct i2c_client *client, int output)
504 default: 506 default:
505 return -EINVAL; 507 return -EINVAL;
506 } 508 }
507 v4l_dbg(1, debug, client, "Selecting %s output type\n", output_strs[output]); 509 v4l_dbg(1, debug, client,
510 "Selecting %s output type\n", output_strs[output]);
508 511
509 /* Configure Encoder */ 512 /* Configure Encoder */
510 saa7127_write(client, 0x2d, state->reg_2d); 513 saa7127_write(client, 0x2d, state->reg_2d);
@@ -566,12 +569,10 @@ static int saa7127_command(struct i2c_client *client,
566 { 569 {
567 int rc = 0; 570 int rc = 0;
568 571
569 if (state->input_type != route->input) { 572 if (state->input_type != route->input)
570 rc = saa7127_set_input_type(client, route->input); 573 rc = saa7127_set_input_type(client, route->input);
571 } 574 if (rc == 0 && state->output_type != route->output)
572 if (rc == 0 && state->output_type != route->output) {
573 rc = saa7127_set_output_type(client, route->output); 575 rc = saa7127_set_output_type(client, route->output);
574 }
575 return rc; 576 return rc;
576 } 577 }
577 578
@@ -617,7 +618,8 @@ static int saa7127_command(struct i2c_client *client,
617 { 618 {
618 struct v4l2_register *reg = arg; 619 struct v4l2_register *reg = arg;
619 620
620 if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) 621 if (!v4l2_chip_match_i2c_client(client,
622 reg->match_type, reg->match_chip))
621 return -EINVAL; 623 return -EINVAL;
622 if (!capable(CAP_SYS_ADMIN)) 624 if (!capable(CAP_SYS_ADMIN))
623 return -EPERM; 625 return -EPERM;
@@ -634,16 +636,16 @@ static int saa7127_command(struct i2c_client *client,
634 struct v4l2_sliced_vbi_data *data = arg; 636 struct v4l2_sliced_vbi_data *data = arg;
635 637
636 switch (data->id) { 638 switch (data->id) {
637 case V4L2_SLICED_WSS_625: 639 case V4L2_SLICED_WSS_625:
638 return saa7127_set_wss(client, data); 640 return saa7127_set_wss(client, data);
639 case V4L2_SLICED_VPS: 641 case V4L2_SLICED_VPS:
640 return saa7127_set_vps(client, data); 642 return saa7127_set_vps(client, data);
641 case V4L2_SLICED_CAPTION_525: 643 case V4L2_SLICED_CAPTION_525:
642 if (data->field == 0) 644 if (data->field == 0)
643 return saa7127_set_cc(client, data); 645 return saa7127_set_cc(client, data);
644 return saa7127_set_xds(client, data); 646 return saa7127_set_xds(client, data);
645 default: 647 default:
646 return -EINVAL; 648 return -EINVAL;
647 } 649 }
648 break; 650 break;
649 } 651 }
@@ -671,7 +673,8 @@ static int saa7127_probe(struct i2c_client *client)
671 673
672 snprintf(client->name, sizeof(client->name) - 1, "saa7127"); 674 snprintf(client->name, sizeof(client->name) - 1, "saa7127");
673 675
674 v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n", client->addr << 1); 676 v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n",
677 client->addr << 1);
675 678
676 /* First test register 0: Bits 5-7 are a version ID (should be 0), 679 /* First test register 0: Bits 5-7 are a version ID (should be 0),
677 and bit 2 should also be 0. 680 and bit 2 should also be 0.
@@ -685,9 +688,8 @@ static int saa7127_probe(struct i2c_client *client)
685 } 688 }
686 state = kzalloc(sizeof(struct saa7127_state), GFP_KERNEL); 689 state = kzalloc(sizeof(struct saa7127_state), GFP_KERNEL);
687 690
688 if (state == NULL) { 691 if (state == NULL)
689 return -ENOMEM; 692 return -ENOMEM;
690 }
691 693
692 i2c_set_clientdata(client, state); 694 i2c_set_clientdata(client, state);
693 695
@@ -701,25 +703,26 @@ static int saa7127_probe(struct i2c_client *client)
701 saa7127_set_wss(client, &vbi); 703 saa7127_set_wss(client, &vbi);
702 saa7127_set_cc(client, &vbi); 704 saa7127_set_cc(client, &vbi);
703 saa7127_set_xds(client, &vbi); 705 saa7127_set_xds(client, &vbi);
704 if (test_image == 1) { 706 if (test_image == 1)
705 /* The Encoder has an internal Colorbar generator */ 707 /* The Encoder has an internal Colorbar generator */
706 /* This can be used for debugging */ 708 /* This can be used for debugging */
707 saa7127_set_input_type(client, SAA7127_INPUT_TYPE_TEST_IMAGE); 709 saa7127_set_input_type(client, SAA7127_INPUT_TYPE_TEST_IMAGE);
708 } else { 710 else
709 saa7127_set_input_type(client, SAA7127_INPUT_TYPE_NORMAL); 711 saa7127_set_input_type(client, SAA7127_INPUT_TYPE_NORMAL);
710 }
711 saa7127_set_video_enable(client, 1); 712 saa7127_set_video_enable(client, 1);
712 713
713 /* Detect if it's an saa7129 */ 714 /* Detect if it's an saa7129 */
714 read_result = saa7127_read(client, SAA7129_REG_FADE_KEY_COL2); 715 read_result = saa7127_read(client, SAA7129_REG_FADE_KEY_COL2);
715 saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, 0xaa); 716 saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, 0xaa);
716 if (saa7127_read(client, SAA7129_REG_FADE_KEY_COL2) == 0xaa) { 717 if (saa7127_read(client, SAA7129_REG_FADE_KEY_COL2) == 0xaa) {
717 v4l_info(client, "saa7129 found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); 718 v4l_info(client, "saa7129 found @ 0x%x (%s)\n",
719 client->addr << 1, client->adapter->name);
718 saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, read_result); 720 saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, read_result);
719 saa7127_write_inittab(client, saa7129_init_config_extra); 721 saa7127_write_inittab(client, saa7129_init_config_extra);
720 state->ident = V4L2_IDENT_SAA7129; 722 state->ident = V4L2_IDENT_SAA7129;
721 } else { 723 } else {
722 v4l_info(client, "saa7127 found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); 724 v4l_info(client, "saa7127 found @ 0x%x (%s)\n",
725 client->addr << 1, client->adapter->name);
723 state->ident = V4L2_IDENT_SAA7127; 726 state->ident = V4L2_IDENT_SAA7127;
724 } 727 }
725 return 0; 728 return 0;