diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-02-15 12:33:51 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-19 15:07:21 -0400 |
commit | f0cd015e31d3818c96a9b436357b39929c2a361b (patch) | |
tree | d627e80c5016477c6ce5d363788f548a44ae4dac /drivers/media/i2c/tvp7002.c | |
parent | f08e9f0d5c138fcf8b0a1a952011cd044ae4e859 (diff) |
[media] tvp7002: replace 'preset' by 'timings' in various structs/variables
This is the first step towards removing the deprecated preset support of this
driver.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/tvp7002.c')
-rw-r--r-- | drivers/media/i2c/tvp7002.c | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c index 537f6b4d4918..7995eeb8f847 100644 --- a/drivers/media/i2c/tvp7002.c +++ b/drivers/media/i2c/tvp7002.c | |||
@@ -326,8 +326,8 @@ static const struct i2c_reg_value tvp7002_parms_720P50[] = { | |||
326 | { TVP7002_EOR, 0xff, TVP7002_RESERVED } | 326 | { TVP7002_EOR, 0xff, TVP7002_RESERVED } |
327 | }; | 327 | }; |
328 | 328 | ||
329 | /* Preset definition for handling device operation */ | 329 | /* Timings definition for handling device operation */ |
330 | struct tvp7002_preset_definition { | 330 | struct tvp7002_timings_definition { |
331 | u32 preset; | 331 | u32 preset; |
332 | struct v4l2_dv_timings timings; | 332 | struct v4l2_dv_timings timings; |
333 | const struct i2c_reg_value *p_settings; | 333 | const struct i2c_reg_value *p_settings; |
@@ -339,8 +339,8 @@ struct tvp7002_preset_definition { | |||
339 | u16 cpl_max; | 339 | u16 cpl_max; |
340 | }; | 340 | }; |
341 | 341 | ||
342 | /* Struct list for digital video presets */ | 342 | /* Struct list for digital video timings */ |
343 | static const struct tvp7002_preset_definition tvp7002_presets[] = { | 343 | static const struct tvp7002_timings_definition tvp7002_timings[] = { |
344 | { | 344 | { |
345 | V4L2_DV_720P60, | 345 | V4L2_DV_720P60, |
346 | V4L2_DV_BT_CEA_1280X720P60, | 346 | V4L2_DV_BT_CEA_1280X720P60, |
@@ -420,7 +420,7 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = { | |||
420 | } | 420 | } |
421 | }; | 421 | }; |
422 | 422 | ||
423 | #define NUM_PRESETS ARRAY_SIZE(tvp7002_presets) | 423 | #define NUM_TIMINGS ARRAY_SIZE(tvp7002_timings) |
424 | 424 | ||
425 | /* Device definition */ | 425 | /* Device definition */ |
426 | struct tvp7002 { | 426 | struct tvp7002 { |
@@ -431,7 +431,7 @@ struct tvp7002 { | |||
431 | int ver; | 431 | int ver; |
432 | int streaming; | 432 | int streaming; |
433 | 433 | ||
434 | const struct tvp7002_preset_definition *current_preset; | 434 | const struct tvp7002_timings_definition *current_timings; |
435 | }; | 435 | }; |
436 | 436 | ||
437 | /* | 437 | /* |
@@ -603,11 +603,11 @@ static int tvp7002_s_dv_preset(struct v4l2_subdev *sd, | |||
603 | u32 preset; | 603 | u32 preset; |
604 | int i; | 604 | int i; |
605 | 605 | ||
606 | for (i = 0; i < NUM_PRESETS; i++) { | 606 | for (i = 0; i < NUM_TIMINGS; i++) { |
607 | preset = tvp7002_presets[i].preset; | 607 | preset = tvp7002_timings[i].preset; |
608 | if (preset == dv_preset->preset) { | 608 | if (preset == dv_preset->preset) { |
609 | device->current_preset = &tvp7002_presets[i]; | 609 | device->current_timings = &tvp7002_timings[i]; |
610 | return tvp7002_write_inittab(sd, tvp7002_presets[i].p_settings); | 610 | return tvp7002_write_inittab(sd, tvp7002_timings[i].p_settings); |
611 | } | 611 | } |
612 | } | 612 | } |
613 | 613 | ||
@@ -623,12 +623,12 @@ static int tvp7002_s_dv_timings(struct v4l2_subdev *sd, | |||
623 | 623 | ||
624 | if (dv_timings->type != V4L2_DV_BT_656_1120) | 624 | if (dv_timings->type != V4L2_DV_BT_656_1120) |
625 | return -EINVAL; | 625 | return -EINVAL; |
626 | for (i = 0; i < NUM_PRESETS; i++) { | 626 | for (i = 0; i < NUM_TIMINGS; i++) { |
627 | const struct v4l2_bt_timings *t = &tvp7002_presets[i].timings.bt; | 627 | const struct v4l2_bt_timings *t = &tvp7002_timings[i].timings.bt; |
628 | 628 | ||
629 | if (!memcmp(bt, t, &bt->standards - &bt->width)) { | 629 | if (!memcmp(bt, t, &bt->standards - &bt->width)) { |
630 | device->current_preset = &tvp7002_presets[i]; | 630 | device->current_timings = &tvp7002_timings[i]; |
631 | return tvp7002_write_inittab(sd, tvp7002_presets[i].p_settings); | 631 | return tvp7002_write_inittab(sd, tvp7002_timings[i].p_settings); |
632 | } | 632 | } |
633 | } | 633 | } |
634 | return -EINVAL; | 634 | return -EINVAL; |
@@ -639,7 +639,7 @@ static int tvp7002_g_dv_timings(struct v4l2_subdev *sd, | |||
639 | { | 639 | { |
640 | struct tvp7002 *device = to_tvp7002(sd); | 640 | struct tvp7002 *device = to_tvp7002(sd); |
641 | 641 | ||
642 | *dv_timings = device->current_preset->timings; | 642 | *dv_timings = device->current_timings->timings; |
643 | return 0; | 643 | return 0; |
644 | } | 644 | } |
645 | 645 | ||
@@ -681,15 +681,15 @@ static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f | |||
681 | int error; | 681 | int error; |
682 | 682 | ||
683 | /* Calculate height and width based on current standard */ | 683 | /* Calculate height and width based on current standard */ |
684 | error = v4l_fill_dv_preset_info(device->current_preset->preset, &e_preset); | 684 | error = v4l_fill_dv_preset_info(device->current_timings->preset, &e_preset); |
685 | if (error) | 685 | if (error) |
686 | return error; | 686 | return error; |
687 | 687 | ||
688 | f->width = e_preset.width; | 688 | f->width = e_preset.width; |
689 | f->height = e_preset.height; | 689 | f->height = e_preset.height; |
690 | f->code = V4L2_MBUS_FMT_YUYV10_1X20; | 690 | f->code = V4L2_MBUS_FMT_YUYV10_1X20; |
691 | f->field = device->current_preset->scanmode; | 691 | f->field = device->current_timings->scanmode; |
692 | f->colorspace = device->current_preset->color_space; | 692 | f->colorspace = device->current_timings->color_space; |
693 | 693 | ||
694 | v4l2_dbg(1, debug, sd, "MBUS_FMT: Width - %d, Height - %d", | 694 | v4l2_dbg(1, debug, sd, "MBUS_FMT: Width - %d, Height - %d", |
695 | f->width, f->height); | 695 | f->width, f->height); |
@@ -697,16 +697,16 @@ static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f | |||
697 | } | 697 | } |
698 | 698 | ||
699 | /* | 699 | /* |
700 | * tvp7002_query_dv_preset() - query DV preset | 700 | * tvp7002_query_dv() - query DV timings |
701 | * @sd: pointer to standard V4L2 sub-device structure | 701 | * @sd: pointer to standard V4L2 sub-device structure |
702 | * @qpreset: standard V4L2 v4l2_dv_preset structure | 702 | * @index: index into the tvp7002_timings array |
703 | * | 703 | * |
704 | * Returns the current DV preset by TVP7002. If no active input is | 704 | * Returns the current DV timings detected by TVP7002. If no active input is |
705 | * detected, returns -EINVAL | 705 | * detected, returns -EINVAL |
706 | */ | 706 | */ |
707 | static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index) | 707 | static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index) |
708 | { | 708 | { |
709 | const struct tvp7002_preset_definition *presets = tvp7002_presets; | 709 | const struct tvp7002_timings_definition *timings = tvp7002_timings; |
710 | u8 progressive; | 710 | u8 progressive; |
711 | u32 lpfr; | 711 | u32 lpfr; |
712 | u32 cpln; | 712 | u32 cpln; |
@@ -717,7 +717,7 @@ static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index) | |||
717 | u8 cpl_msb; | 717 | u8 cpl_msb; |
718 | 718 | ||
719 | /* Return invalid index if no active input is detected */ | 719 | /* Return invalid index if no active input is detected */ |
720 | *index = NUM_PRESETS; | 720 | *index = NUM_TIMINGS; |
721 | 721 | ||
722 | /* Read standards from device registers */ | 722 | /* Read standards from device registers */ |
723 | tvp7002_read_err(sd, TVP7002_L_FRAME_STAT_LSBS, &lpf_lsb, &error); | 723 | tvp7002_read_err(sd, TVP7002_L_FRAME_STAT_LSBS, &lpf_lsb, &error); |
@@ -738,23 +738,23 @@ static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index) | |||
738 | progressive = (lpf_msb & TVP7002_INPR_MASK) >> TVP7002_IP_SHIFT; | 738 | progressive = (lpf_msb & TVP7002_INPR_MASK) >> TVP7002_IP_SHIFT; |
739 | 739 | ||
740 | /* Do checking of video modes */ | 740 | /* Do checking of video modes */ |
741 | for (*index = 0; *index < NUM_PRESETS; (*index)++, presets++) | 741 | for (*index = 0; *index < NUM_TIMINGS; (*index)++, timings++) |
742 | if (lpfr == presets->lines_per_frame && | 742 | if (lpfr == timings->lines_per_frame && |
743 | progressive == presets->progressive) { | 743 | progressive == timings->progressive) { |
744 | if (presets->cpl_min == 0xffff) | 744 | if (timings->cpl_min == 0xffff) |
745 | break; | 745 | break; |
746 | if (cpln >= presets->cpl_min && cpln <= presets->cpl_max) | 746 | if (cpln >= timings->cpl_min && cpln <= timings->cpl_max) |
747 | break; | 747 | break; |
748 | } | 748 | } |
749 | 749 | ||
750 | if (*index == NUM_PRESETS) { | 750 | if (*index == NUM_TIMINGS) { |
751 | v4l2_dbg(1, debug, sd, "detection failed: lpf = %x, cpl = %x\n", | 751 | v4l2_dbg(1, debug, sd, "detection failed: lpf = %x, cpl = %x\n", |
752 | lpfr, cpln); | 752 | lpfr, cpln); |
753 | return -ENOLINK; | 753 | return -ENOLINK; |
754 | } | 754 | } |
755 | 755 | ||
756 | /* Update lines per frame and clocks per line info */ | 756 | /* Update lines per frame and clocks per line info */ |
757 | v4l2_dbg(1, debug, sd, "detected preset: %d\n", *index); | 757 | v4l2_dbg(1, debug, sd, "detected timings: %d\n", *index); |
758 | return 0; | 758 | return 0; |
759 | } | 759 | } |
760 | 760 | ||
@@ -764,13 +764,13 @@ static int tvp7002_query_dv_preset(struct v4l2_subdev *sd, | |||
764 | int index; | 764 | int index; |
765 | int err = tvp7002_query_dv(sd, &index); | 765 | int err = tvp7002_query_dv(sd, &index); |
766 | 766 | ||
767 | if (err || index == NUM_PRESETS) { | 767 | if (err || index == NUM_TIMINGS) { |
768 | qpreset->preset = V4L2_DV_INVALID; | 768 | qpreset->preset = V4L2_DV_INVALID; |
769 | if (err == -ENOLINK) | 769 | if (err == -ENOLINK) |
770 | err = 0; | 770 | err = 0; |
771 | return err; | 771 | return err; |
772 | } | 772 | } |
773 | qpreset->preset = tvp7002_presets[index].preset; | 773 | qpreset->preset = tvp7002_timings[index].preset; |
774 | return 0; | 774 | return 0; |
775 | } | 775 | } |
776 | 776 | ||
@@ -782,7 +782,7 @@ static int tvp7002_query_dv_timings(struct v4l2_subdev *sd, | |||
782 | 782 | ||
783 | if (err) | 783 | if (err) |
784 | return err; | 784 | return err; |
785 | *timings = tvp7002_presets[index].timings; | 785 | *timings = tvp7002_timings[index].timings; |
786 | return 0; | 786 | return 0; |
787 | } | 787 | } |
788 | 788 | ||
@@ -896,7 +896,7 @@ static int tvp7002_s_stream(struct v4l2_subdev *sd, int enable) | |||
896 | */ | 896 | */ |
897 | static int tvp7002_log_status(struct v4l2_subdev *sd) | 897 | static int tvp7002_log_status(struct v4l2_subdev *sd) |
898 | { | 898 | { |
899 | const struct tvp7002_preset_definition *presets = tvp7002_presets; | 899 | const struct tvp7002_timings_definition *timings = tvp7002_timings; |
900 | struct tvp7002 *device = to_tvp7002(sd); | 900 | struct tvp7002 *device = to_tvp7002(sd); |
901 | struct v4l2_dv_enum_preset e_preset; | 901 | struct v4l2_dv_enum_preset e_preset; |
902 | struct v4l2_dv_preset detected; | 902 | struct v4l2_dv_preset detected; |
@@ -907,20 +907,20 @@ static int tvp7002_log_status(struct v4l2_subdev *sd) | |||
907 | tvp7002_query_dv_preset(sd, &detected); | 907 | tvp7002_query_dv_preset(sd, &detected); |
908 | 908 | ||
909 | /* Print standard related code values */ | 909 | /* Print standard related code values */ |
910 | for (i = 0; i < NUM_PRESETS; i++, presets++) | 910 | for (i = 0; i < NUM_TIMINGS; i++, timings++) |
911 | if (presets->preset == detected.preset) | 911 | if (timings->preset == detected.preset) |
912 | break; | 912 | break; |
913 | 913 | ||
914 | if (v4l_fill_dv_preset_info(device->current_preset->preset, &e_preset)) | 914 | if (v4l_fill_dv_preset_info(device->current_timings->preset, &e_preset)) |
915 | return -EINVAL; | 915 | return -EINVAL; |
916 | 916 | ||
917 | v4l2_info(sd, "Selected DV Preset: %s\n", e_preset.name); | 917 | v4l2_info(sd, "Selected DV Preset: %s\n", e_preset.name); |
918 | v4l2_info(sd, " Pixels per line: %u\n", e_preset.width); | 918 | v4l2_info(sd, " Pixels per line: %u\n", e_preset.width); |
919 | v4l2_info(sd, " Lines per frame: %u\n\n", e_preset.height); | 919 | v4l2_info(sd, " Lines per frame: %u\n\n", e_preset.height); |
920 | if (i == NUM_PRESETS) { | 920 | if (i == NUM_TIMINGS) { |
921 | v4l2_info(sd, "Detected DV Preset: None\n"); | 921 | v4l2_info(sd, "Detected DV Preset: None\n"); |
922 | } else { | 922 | } else { |
923 | if (v4l_fill_dv_preset_info(presets->preset, &e_preset)) | 923 | if (v4l_fill_dv_preset_info(timings->preset, &e_preset)) |
924 | return -EINVAL; | 924 | return -EINVAL; |
925 | v4l2_info(sd, "Detected DV Preset: %s\n", e_preset.name); | 925 | v4l2_info(sd, "Detected DV Preset: %s\n", e_preset.name); |
926 | v4l2_info(sd, " Pixels per line: %u\n", e_preset.width); | 926 | v4l2_info(sd, " Pixels per line: %u\n", e_preset.width); |
@@ -946,20 +946,20 @@ static int tvp7002_enum_dv_presets(struct v4l2_subdev *sd, | |||
946 | struct v4l2_dv_enum_preset *preset) | 946 | struct v4l2_dv_enum_preset *preset) |
947 | { | 947 | { |
948 | /* Check requested format index is within range */ | 948 | /* Check requested format index is within range */ |
949 | if (preset->index >= NUM_PRESETS) | 949 | if (preset->index >= NUM_TIMINGS) |
950 | return -EINVAL; | 950 | return -EINVAL; |
951 | 951 | ||
952 | return v4l_fill_dv_preset_info(tvp7002_presets[preset->index].preset, preset); | 952 | return v4l_fill_dv_preset_info(tvp7002_timings[preset->index].preset, preset); |
953 | } | 953 | } |
954 | 954 | ||
955 | static int tvp7002_enum_dv_timings(struct v4l2_subdev *sd, | 955 | static int tvp7002_enum_dv_timings(struct v4l2_subdev *sd, |
956 | struct v4l2_enum_dv_timings *timings) | 956 | struct v4l2_enum_dv_timings *timings) |
957 | { | 957 | { |
958 | /* Check requested format index is within range */ | 958 | /* Check requested format index is within range */ |
959 | if (timings->index >= NUM_PRESETS) | 959 | if (timings->index >= NUM_TIMINGS) |
960 | return -EINVAL; | 960 | return -EINVAL; |
961 | 961 | ||
962 | timings->timings = tvp7002_presets[timings->index].timings; | 962 | timings->timings = tvp7002_timings[timings->index].timings; |
963 | return 0; | 963 | return 0; |
964 | } | 964 | } |
965 | 965 | ||
@@ -1043,7 +1043,7 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id) | |||
1043 | 1043 | ||
1044 | sd = &device->sd; | 1044 | sd = &device->sd; |
1045 | device->pdata = c->dev.platform_data; | 1045 | device->pdata = c->dev.platform_data; |
1046 | device->current_preset = tvp7002_presets; | 1046 | device->current_timings = tvp7002_timings; |
1047 | 1047 | ||
1048 | /* Tell v4l2 the device is ready */ | 1048 | /* Tell v4l2 the device is ready */ |
1049 | v4l2_i2c_subdev_init(sd, c, &tvp7002_ops); | 1049 | v4l2_i2c_subdev_init(sd, c, &tvp7002_ops); |
@@ -1080,7 +1080,7 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id) | |||
1080 | return error; | 1080 | return error; |
1081 | 1081 | ||
1082 | /* Set registers according to default video mode */ | 1082 | /* Set registers according to default video mode */ |
1083 | preset.preset = device->current_preset->preset; | 1083 | preset.preset = device->current_timings->preset; |
1084 | error = tvp7002_s_dv_preset(sd, &preset); | 1084 | error = tvp7002_s_dv_preset(sd, &preset); |
1085 | 1085 | ||
1086 | v4l2_ctrl_handler_init(&device->hdl, 1); | 1086 | v4l2_ctrl_handler_init(&device->hdl, 1); |