diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 12:58:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 12:58:16 -0400 |
commit | 240c3c3424366c8109babd2a0fe80855de511b35 (patch) | |
tree | 72eb8652c8e513715efee1e254644b4b670333fd /drivers/media/i2c/tvp7002.c | |
parent | 19b344efa35dbc253e2d10403dafe6aafda73c56 (diff) | |
parent | df90e2258950fd631cdbf322c1ee1f22068391aa (diff) |
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media update from Mauro Carvalho Chehab:
- OF documentation and patches at core and drivers, to be used by for
embedded media systems
- some I2C drivers used on go7007 were rewritten/promoted from staging:
sony-btf-mpx, tw2804, tw9903, tw9906, wis-ov7640, wis-uda1342
- add fimc-is driver (Exynos)
- add a new radio driver: radio-si476x
- add a two new tuners: r820t and tuner_it913x
- split camera code on em28xx driver and add more models
- the cypress firmware load is used outside dvb usb drivers. So, move
it to a common directory to make easier to re-use it
- siano media driver updated to work with sms2270 devices
- several work done in order to promote go7007 and solo6x1x out of
staging (still, there are some pending issues)
- several API compliance fixes at v4l2 drivers that don't behave as
expected
- as usual, lots of driver fixes, improvements, cleanups and new device
addition at the existing drivers.
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (831 commits)
[media] cx88: make core less verbose
[media] em28xx: fix oops at em28xx_dvb_bus_ctrl()
[media] s5c73m3: fix indentation of the help section in Kconfig
[media] cx25821-alsa: get rid of a __must_check warning
[media] cx25821-video: declare cx25821_vidioc_s_std as static
[media] cx25821-video: remove maxw from cx25821_vidioc_try_fmt_vid_cap
[media] r820t: Remove a warning for an unused value
[media] dib0090: Fix a warning at dib0090_set_EFUSE
[media] dib8000: fix a warning
[media] dib8000: Fix sub-channel range
[media] dib8000: store dtv_property_cache in a temp var
[media] dib8000: warning fix: declare internal functions as static
[media] r820t: quiet gcc warning on n_ring
[media] r820t: memory leak in release()
[media] r820t: precendence bug in r820t_xtal_check()
[media] videodev2.h: Remove the unused old V4L1 buffer types
[media] anysee: Grammar s/report the/report to/
[media] anysee: Initialize ret = 0 in anysee_frontend_attach()
[media] media: videobuf2: fix the length check for mmap
[media] em28xx: save isoc endpoint number for DVB only if endpoint has alt settings with xMaxPacketSize != 0
...
Diffstat (limited to 'drivers/media/i2c/tvp7002.c')
-rw-r--r-- | drivers/media/i2c/tvp7002.c | 184 |
1 files changed, 47 insertions, 137 deletions
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c index 537f6b4d4918..027809cca5f5 100644 --- a/drivers/media/i2c/tvp7002.c +++ b/drivers/media/i2c/tvp7002.c | |||
@@ -326,9 +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; | ||
332 | struct v4l2_dv_timings timings; | 331 | struct v4l2_dv_timings timings; |
333 | const struct i2c_reg_value *p_settings; | 332 | const struct i2c_reg_value *p_settings; |
334 | enum v4l2_colorspace color_space; | 333 | enum v4l2_colorspace color_space; |
@@ -339,10 +338,9 @@ struct tvp7002_preset_definition { | |||
339 | u16 cpl_max; | 338 | u16 cpl_max; |
340 | }; | 339 | }; |
341 | 340 | ||
342 | /* Struct list for digital video presets */ | 341 | /* Struct list for digital video timings */ |
343 | static const struct tvp7002_preset_definition tvp7002_presets[] = { | 342 | static const struct tvp7002_timings_definition tvp7002_timings[] = { |
344 | { | 343 | { |
345 | V4L2_DV_720P60, | ||
346 | V4L2_DV_BT_CEA_1280X720P60, | 344 | V4L2_DV_BT_CEA_1280X720P60, |
347 | tvp7002_parms_720P60, | 345 | tvp7002_parms_720P60, |
348 | V4L2_COLORSPACE_REC709, | 346 | V4L2_COLORSPACE_REC709, |
@@ -353,7 +351,6 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = { | |||
353 | 153 | 351 | 153 |
354 | }, | 352 | }, |
355 | { | 353 | { |
356 | V4L2_DV_1080I60, | ||
357 | V4L2_DV_BT_CEA_1920X1080I60, | 354 | V4L2_DV_BT_CEA_1920X1080I60, |
358 | tvp7002_parms_1080I60, | 355 | tvp7002_parms_1080I60, |
359 | V4L2_COLORSPACE_REC709, | 356 | V4L2_COLORSPACE_REC709, |
@@ -364,7 +361,6 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = { | |||
364 | 205 | 361 | 205 |
365 | }, | 362 | }, |
366 | { | 363 | { |
367 | V4L2_DV_1080I50, | ||
368 | V4L2_DV_BT_CEA_1920X1080I50, | 364 | V4L2_DV_BT_CEA_1920X1080I50, |
369 | tvp7002_parms_1080I50, | 365 | tvp7002_parms_1080I50, |
370 | V4L2_COLORSPACE_REC709, | 366 | V4L2_COLORSPACE_REC709, |
@@ -375,7 +371,6 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = { | |||
375 | 245 | 371 | 245 |
376 | }, | 372 | }, |
377 | { | 373 | { |
378 | V4L2_DV_720P50, | ||
379 | V4L2_DV_BT_CEA_1280X720P50, | 374 | V4L2_DV_BT_CEA_1280X720P50, |
380 | tvp7002_parms_720P50, | 375 | tvp7002_parms_720P50, |
381 | V4L2_COLORSPACE_REC709, | 376 | V4L2_COLORSPACE_REC709, |
@@ -386,7 +381,6 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = { | |||
386 | 183 | 381 | 183 |
387 | }, | 382 | }, |
388 | { | 383 | { |
389 | V4L2_DV_1080P60, | ||
390 | V4L2_DV_BT_CEA_1920X1080P60, | 384 | V4L2_DV_BT_CEA_1920X1080P60, |
391 | tvp7002_parms_1080P60, | 385 | tvp7002_parms_1080P60, |
392 | V4L2_COLORSPACE_REC709, | 386 | V4L2_COLORSPACE_REC709, |
@@ -397,7 +391,6 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = { | |||
397 | 102 | 391 | 102 |
398 | }, | 392 | }, |
399 | { | 393 | { |
400 | V4L2_DV_480P59_94, | ||
401 | V4L2_DV_BT_CEA_720X480P59_94, | 394 | V4L2_DV_BT_CEA_720X480P59_94, |
402 | tvp7002_parms_480P, | 395 | tvp7002_parms_480P, |
403 | V4L2_COLORSPACE_SMPTE170M, | 396 | V4L2_COLORSPACE_SMPTE170M, |
@@ -408,7 +401,6 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = { | |||
408 | 0xffff | 401 | 0xffff |
409 | }, | 402 | }, |
410 | { | 403 | { |
411 | V4L2_DV_576P50, | ||
412 | V4L2_DV_BT_CEA_720X576P50, | 404 | V4L2_DV_BT_CEA_720X576P50, |
413 | tvp7002_parms_576P, | 405 | tvp7002_parms_576P, |
414 | V4L2_COLORSPACE_SMPTE170M, | 406 | V4L2_COLORSPACE_SMPTE170M, |
@@ -420,7 +412,7 @@ static const struct tvp7002_preset_definition tvp7002_presets[] = { | |||
420 | } | 412 | } |
421 | }; | 413 | }; |
422 | 414 | ||
423 | #define NUM_PRESETS ARRAY_SIZE(tvp7002_presets) | 415 | #define NUM_TIMINGS ARRAY_SIZE(tvp7002_timings) |
424 | 416 | ||
425 | /* Device definition */ | 417 | /* Device definition */ |
426 | struct tvp7002 { | 418 | struct tvp7002 { |
@@ -431,7 +423,7 @@ struct tvp7002 { | |||
431 | int ver; | 423 | int ver; |
432 | int streaming; | 424 | int streaming; |
433 | 425 | ||
434 | const struct tvp7002_preset_definition *current_preset; | 426 | const struct tvp7002_timings_definition *current_timings; |
435 | }; | 427 | }; |
436 | 428 | ||
437 | /* | 429 | /* |
@@ -588,32 +580,6 @@ static int tvp7002_write_inittab(struct v4l2_subdev *sd, | |||
588 | return error; | 580 | return error; |
589 | } | 581 | } |
590 | 582 | ||
591 | /* | ||
592 | * tvp7002_s_dv_preset() - Set digital video preset | ||
593 | * @sd: ptr to v4l2_subdev struct | ||
594 | * @dv_preset: ptr to v4l2_dv_preset struct | ||
595 | * | ||
596 | * Set the digital video preset for a TVP7002 decoder device. | ||
597 | * Returns zero when successful or -EINVAL if register access fails. | ||
598 | */ | ||
599 | static int tvp7002_s_dv_preset(struct v4l2_subdev *sd, | ||
600 | struct v4l2_dv_preset *dv_preset) | ||
601 | { | ||
602 | struct tvp7002 *device = to_tvp7002(sd); | ||
603 | u32 preset; | ||
604 | int i; | ||
605 | |||
606 | for (i = 0; i < NUM_PRESETS; i++) { | ||
607 | preset = tvp7002_presets[i].preset; | ||
608 | if (preset == dv_preset->preset) { | ||
609 | device->current_preset = &tvp7002_presets[i]; | ||
610 | return tvp7002_write_inittab(sd, tvp7002_presets[i].p_settings); | ||
611 | } | ||
612 | } | ||
613 | |||
614 | return -EINVAL; | ||
615 | } | ||
616 | |||
617 | static int tvp7002_s_dv_timings(struct v4l2_subdev *sd, | 583 | static int tvp7002_s_dv_timings(struct v4l2_subdev *sd, |
618 | struct v4l2_dv_timings *dv_timings) | 584 | struct v4l2_dv_timings *dv_timings) |
619 | { | 585 | { |
@@ -623,12 +589,12 @@ static int tvp7002_s_dv_timings(struct v4l2_subdev *sd, | |||
623 | 589 | ||
624 | if (dv_timings->type != V4L2_DV_BT_656_1120) | 590 | if (dv_timings->type != V4L2_DV_BT_656_1120) |
625 | return -EINVAL; | 591 | return -EINVAL; |
626 | for (i = 0; i < NUM_PRESETS; i++) { | 592 | for (i = 0; i < NUM_TIMINGS; i++) { |
627 | const struct v4l2_bt_timings *t = &tvp7002_presets[i].timings.bt; | 593 | const struct v4l2_bt_timings *t = &tvp7002_timings[i].timings.bt; |
628 | 594 | ||
629 | if (!memcmp(bt, t, &bt->standards - &bt->width)) { | 595 | if (!memcmp(bt, t, &bt->standards - &bt->width)) { |
630 | device->current_preset = &tvp7002_presets[i]; | 596 | device->current_timings = &tvp7002_timings[i]; |
631 | return tvp7002_write_inittab(sd, tvp7002_presets[i].p_settings); | 597 | return tvp7002_write_inittab(sd, tvp7002_timings[i].p_settings); |
632 | } | 598 | } |
633 | } | 599 | } |
634 | return -EINVAL; | 600 | return -EINVAL; |
@@ -639,7 +605,7 @@ static int tvp7002_g_dv_timings(struct v4l2_subdev *sd, | |||
639 | { | 605 | { |
640 | struct tvp7002 *device = to_tvp7002(sd); | 606 | struct tvp7002 *device = to_tvp7002(sd); |
641 | 607 | ||
642 | *dv_timings = device->current_preset->timings; | 608 | *dv_timings = device->current_timings->timings; |
643 | return 0; | 609 | return 0; |
644 | } | 610 | } |
645 | 611 | ||
@@ -677,19 +643,13 @@ static int tvp7002_s_ctrl(struct v4l2_ctrl *ctrl) | |||
677 | static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f) | 643 | static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f) |
678 | { | 644 | { |
679 | struct tvp7002 *device = to_tvp7002(sd); | 645 | struct tvp7002 *device = to_tvp7002(sd); |
680 | struct v4l2_dv_enum_preset e_preset; | 646 | const struct v4l2_bt_timings *bt = &device->current_timings->timings.bt; |
681 | int error; | ||
682 | 647 | ||
683 | /* Calculate height and width based on current standard */ | 648 | f->width = bt->width; |
684 | error = v4l_fill_dv_preset_info(device->current_preset->preset, &e_preset); | 649 | f->height = bt->height; |
685 | if (error) | ||
686 | return error; | ||
687 | |||
688 | f->width = e_preset.width; | ||
689 | f->height = e_preset.height; | ||
690 | f->code = V4L2_MBUS_FMT_YUYV10_1X20; | 650 | f->code = V4L2_MBUS_FMT_YUYV10_1X20; |
691 | f->field = device->current_preset->scanmode; | 651 | f->field = device->current_timings->scanmode; |
692 | f->colorspace = device->current_preset->color_space; | 652 | f->colorspace = device->current_timings->color_space; |
693 | 653 | ||
694 | v4l2_dbg(1, debug, sd, "MBUS_FMT: Width - %d, Height - %d", | 654 | v4l2_dbg(1, debug, sd, "MBUS_FMT: Width - %d, Height - %d", |
695 | f->width, f->height); | 655 | f->width, f->height); |
@@ -697,16 +657,16 @@ static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f | |||
697 | } | 657 | } |
698 | 658 | ||
699 | /* | 659 | /* |
700 | * tvp7002_query_dv_preset() - query DV preset | 660 | * tvp7002_query_dv() - query DV timings |
701 | * @sd: pointer to standard V4L2 sub-device structure | 661 | * @sd: pointer to standard V4L2 sub-device structure |
702 | * @qpreset: standard V4L2 v4l2_dv_preset structure | 662 | * @index: index into the tvp7002_timings array |
703 | * | 663 | * |
704 | * Returns the current DV preset by TVP7002. If no active input is | 664 | * Returns the current DV timings detected by TVP7002. If no active input is |
705 | * detected, returns -EINVAL | 665 | * detected, returns -EINVAL |
706 | */ | 666 | */ |
707 | static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index) | 667 | static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index) |
708 | { | 668 | { |
709 | const struct tvp7002_preset_definition *presets = tvp7002_presets; | 669 | const struct tvp7002_timings_definition *timings = tvp7002_timings; |
710 | u8 progressive; | 670 | u8 progressive; |
711 | u32 lpfr; | 671 | u32 lpfr; |
712 | u32 cpln; | 672 | u32 cpln; |
@@ -717,7 +677,7 @@ static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index) | |||
717 | u8 cpl_msb; | 677 | u8 cpl_msb; |
718 | 678 | ||
719 | /* Return invalid index if no active input is detected */ | 679 | /* Return invalid index if no active input is detected */ |
720 | *index = NUM_PRESETS; | 680 | *index = NUM_TIMINGS; |
721 | 681 | ||
722 | /* Read standards from device registers */ | 682 | /* Read standards from device registers */ |
723 | tvp7002_read_err(sd, TVP7002_L_FRAME_STAT_LSBS, &lpf_lsb, &error); | 683 | tvp7002_read_err(sd, TVP7002_L_FRAME_STAT_LSBS, &lpf_lsb, &error); |
@@ -738,39 +698,23 @@ static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index) | |||
738 | progressive = (lpf_msb & TVP7002_INPR_MASK) >> TVP7002_IP_SHIFT; | 698 | progressive = (lpf_msb & TVP7002_INPR_MASK) >> TVP7002_IP_SHIFT; |
739 | 699 | ||
740 | /* Do checking of video modes */ | 700 | /* Do checking of video modes */ |
741 | for (*index = 0; *index < NUM_PRESETS; (*index)++, presets++) | 701 | for (*index = 0; *index < NUM_TIMINGS; (*index)++, timings++) |
742 | if (lpfr == presets->lines_per_frame && | 702 | if (lpfr == timings->lines_per_frame && |
743 | progressive == presets->progressive) { | 703 | progressive == timings->progressive) { |
744 | if (presets->cpl_min == 0xffff) | 704 | if (timings->cpl_min == 0xffff) |
745 | break; | 705 | break; |
746 | if (cpln >= presets->cpl_min && cpln <= presets->cpl_max) | 706 | if (cpln >= timings->cpl_min && cpln <= timings->cpl_max) |
747 | break; | 707 | break; |
748 | } | 708 | } |
749 | 709 | ||
750 | if (*index == NUM_PRESETS) { | 710 | if (*index == NUM_TIMINGS) { |
751 | v4l2_dbg(1, debug, sd, "detection failed: lpf = %x, cpl = %x\n", | 711 | v4l2_dbg(1, debug, sd, "detection failed: lpf = %x, cpl = %x\n", |
752 | lpfr, cpln); | 712 | lpfr, cpln); |
753 | return -ENOLINK; | 713 | return -ENOLINK; |
754 | } | 714 | } |
755 | 715 | ||
756 | /* Update lines per frame and clocks per line info */ | 716 | /* Update lines per frame and clocks per line info */ |
757 | v4l2_dbg(1, debug, sd, "detected preset: %d\n", *index); | 717 | v4l2_dbg(1, debug, sd, "detected timings: %d\n", *index); |
758 | return 0; | ||
759 | } | ||
760 | |||
761 | static int tvp7002_query_dv_preset(struct v4l2_subdev *sd, | ||
762 | struct v4l2_dv_preset *qpreset) | ||
763 | { | ||
764 | int index; | ||
765 | int err = tvp7002_query_dv(sd, &index); | ||
766 | |||
767 | if (err || index == NUM_PRESETS) { | ||
768 | qpreset->preset = V4L2_DV_INVALID; | ||
769 | if (err == -ENOLINK) | ||
770 | err = 0; | ||
771 | return err; | ||
772 | } | ||
773 | qpreset->preset = tvp7002_presets[index].preset; | ||
774 | return 0; | 718 | return 0; |
775 | } | 719 | } |
776 | 720 | ||
@@ -782,7 +726,7 @@ static int tvp7002_query_dv_timings(struct v4l2_subdev *sd, | |||
782 | 726 | ||
783 | if (err) | 727 | if (err) |
784 | return err; | 728 | return err; |
785 | *timings = tvp7002_presets[index].timings; | 729 | *timings = tvp7002_timings[index].timings; |
786 | return 0; | 730 | return 0; |
787 | } | 731 | } |
788 | 732 | ||
@@ -824,7 +768,7 @@ static int tvp7002_g_register(struct v4l2_subdev *sd, | |||
824 | * -EPERM if call not allowed. | 768 | * -EPERM if call not allowed. |
825 | */ | 769 | */ |
826 | static int tvp7002_s_register(struct v4l2_subdev *sd, | 770 | static int tvp7002_s_register(struct v4l2_subdev *sd, |
827 | struct v4l2_dbg_register *reg) | 771 | const struct v4l2_dbg_register *reg) |
828 | { | 772 | { |
829 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 773 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
830 | 774 | ||
@@ -896,35 +840,21 @@ static int tvp7002_s_stream(struct v4l2_subdev *sd, int enable) | |||
896 | */ | 840 | */ |
897 | static int tvp7002_log_status(struct v4l2_subdev *sd) | 841 | static int tvp7002_log_status(struct v4l2_subdev *sd) |
898 | { | 842 | { |
899 | const struct tvp7002_preset_definition *presets = tvp7002_presets; | ||
900 | struct tvp7002 *device = to_tvp7002(sd); | 843 | struct tvp7002 *device = to_tvp7002(sd); |
901 | struct v4l2_dv_enum_preset e_preset; | 844 | const struct v4l2_bt_timings *bt; |
902 | struct v4l2_dv_preset detected; | 845 | int detected; |
903 | int i; | ||
904 | |||
905 | detected.preset = V4L2_DV_INVALID; | ||
906 | /* Find my current standard*/ | ||
907 | tvp7002_query_dv_preset(sd, &detected); | ||
908 | 846 | ||
909 | /* Print standard related code values */ | 847 | /* Find my current timings */ |
910 | for (i = 0; i < NUM_PRESETS; i++, presets++) | 848 | tvp7002_query_dv(sd, &detected); |
911 | if (presets->preset == detected.preset) | ||
912 | break; | ||
913 | 849 | ||
914 | if (v4l_fill_dv_preset_info(device->current_preset->preset, &e_preset)) | 850 | bt = &device->current_timings->timings.bt; |
915 | return -EINVAL; | 851 | v4l2_info(sd, "Selected DV Timings: %ux%u\n", bt->width, bt->height); |
916 | 852 | if (detected == NUM_TIMINGS) { | |
917 | v4l2_info(sd, "Selected DV Preset: %s\n", e_preset.name); | 853 | v4l2_info(sd, "Detected DV Timings: None\n"); |
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); | ||
920 | if (i == NUM_PRESETS) { | ||
921 | v4l2_info(sd, "Detected DV Preset: None\n"); | ||
922 | } else { | 854 | } else { |
923 | if (v4l_fill_dv_preset_info(presets->preset, &e_preset)) | 855 | bt = &tvp7002_timings[detected].timings.bt; |
924 | return -EINVAL; | 856 | v4l2_info(sd, "Detected DV Timings: %ux%u\n", |
925 | v4l2_info(sd, "Detected DV Preset: %s\n", e_preset.name); | 857 | bt->width, bt->height); |
926 | v4l2_info(sd, " Pixels per line: %u\n", e_preset.width); | ||
927 | v4l2_info(sd, " Lines per frame: %u\n\n", e_preset.height); | ||
928 | } | 858 | } |
929 | v4l2_info(sd, "Streaming enabled: %s\n", | 859 | v4l2_info(sd, "Streaming enabled: %s\n", |
930 | device->streaming ? "yes" : "no"); | 860 | device->streaming ? "yes" : "no"); |
@@ -935,31 +865,14 @@ static int tvp7002_log_status(struct v4l2_subdev *sd) | |||
935 | return 0; | 865 | return 0; |
936 | } | 866 | } |
937 | 867 | ||
938 | /* | ||
939 | * tvp7002_enum_dv_presets() - Enum supported digital video formats | ||
940 | * @sd: pointer to standard V4L2 sub-device structure | ||
941 | * @preset: pointer to format struct | ||
942 | * | ||
943 | * Enumerate supported digital video formats. | ||
944 | */ | ||
945 | static int tvp7002_enum_dv_presets(struct v4l2_subdev *sd, | ||
946 | struct v4l2_dv_enum_preset *preset) | ||
947 | { | ||
948 | /* Check requested format index is within range */ | ||
949 | if (preset->index >= NUM_PRESETS) | ||
950 | return -EINVAL; | ||
951 | |||
952 | return v4l_fill_dv_preset_info(tvp7002_presets[preset->index].preset, preset); | ||
953 | } | ||
954 | |||
955 | static int tvp7002_enum_dv_timings(struct v4l2_subdev *sd, | 868 | static int tvp7002_enum_dv_timings(struct v4l2_subdev *sd, |
956 | struct v4l2_enum_dv_timings *timings) | 869 | struct v4l2_enum_dv_timings *timings) |
957 | { | 870 | { |
958 | /* Check requested format index is within range */ | 871 | /* Check requested format index is within range */ |
959 | if (timings->index >= NUM_PRESETS) | 872 | if (timings->index >= NUM_TIMINGS) |
960 | return -EINVAL; | 873 | return -EINVAL; |
961 | 874 | ||
962 | timings->timings = tvp7002_presets[timings->index].timings; | 875 | timings->timings = tvp7002_timings[timings->index].timings; |
963 | return 0; | 876 | return 0; |
964 | } | 877 | } |
965 | 878 | ||
@@ -986,9 +899,6 @@ static const struct v4l2_subdev_core_ops tvp7002_core_ops = { | |||
986 | 899 | ||
987 | /* Specific video subsystem operation handlers */ | 900 | /* Specific video subsystem operation handlers */ |
988 | static const struct v4l2_subdev_video_ops tvp7002_video_ops = { | 901 | static const struct v4l2_subdev_video_ops tvp7002_video_ops = { |
989 | .enum_dv_presets = tvp7002_enum_dv_presets, | ||
990 | .s_dv_preset = tvp7002_s_dv_preset, | ||
991 | .query_dv_preset = tvp7002_query_dv_preset, | ||
992 | .g_dv_timings = tvp7002_g_dv_timings, | 902 | .g_dv_timings = tvp7002_g_dv_timings, |
993 | .s_dv_timings = tvp7002_s_dv_timings, | 903 | .s_dv_timings = tvp7002_s_dv_timings, |
994 | .enum_dv_timings = tvp7002_enum_dv_timings, | 904 | .enum_dv_timings = tvp7002_enum_dv_timings, |
@@ -1019,7 +929,7 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id) | |||
1019 | { | 929 | { |
1020 | struct v4l2_subdev *sd; | 930 | struct v4l2_subdev *sd; |
1021 | struct tvp7002 *device; | 931 | struct tvp7002 *device; |
1022 | struct v4l2_dv_preset preset; | 932 | struct v4l2_dv_timings timings; |
1023 | int polarity_a; | 933 | int polarity_a; |
1024 | int polarity_b; | 934 | int polarity_b; |
1025 | u8 revision; | 935 | u8 revision; |
@@ -1043,7 +953,7 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id) | |||
1043 | 953 | ||
1044 | sd = &device->sd; | 954 | sd = &device->sd; |
1045 | device->pdata = c->dev.platform_data; | 955 | device->pdata = c->dev.platform_data; |
1046 | device->current_preset = tvp7002_presets; | 956 | device->current_timings = tvp7002_timings; |
1047 | 957 | ||
1048 | /* Tell v4l2 the device is ready */ | 958 | /* Tell v4l2 the device is ready */ |
1049 | v4l2_i2c_subdev_init(sd, c, &tvp7002_ops); | 959 | v4l2_i2c_subdev_init(sd, c, &tvp7002_ops); |
@@ -1080,8 +990,8 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id) | |||
1080 | return error; | 990 | return error; |
1081 | 991 | ||
1082 | /* Set registers according to default video mode */ | 992 | /* Set registers according to default video mode */ |
1083 | preset.preset = device->current_preset->preset; | 993 | timings = device->current_timings->timings; |
1084 | error = tvp7002_s_dv_preset(sd, &preset); | 994 | error = tvp7002_s_dv_timings(sd, &timings); |
1085 | 995 | ||
1086 | v4l2_ctrl_handler_init(&device->hdl, 1); | 996 | v4l2_ctrl_handler_init(&device->hdl, 1); |
1087 | v4l2_ctrl_new_std(&device->hdl, &tvp7002_ctrl_ops, | 997 | v4l2_ctrl_new_std(&device->hdl, &tvp7002_ctrl_ops, |