diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-02-15 12:59:48 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-23 10:00:35 -0400 |
commit | 9b30af98b42ea5ff33768faaaf246a6c8efb6163 (patch) | |
tree | adc9e8b4910b286600953663d0bc31d738fa5f9e /drivers/media/platform/s5p-tv | |
parent | 3887056bc4a07b607be2e403b29e8006b465227b (diff) |
[media] s5p-tv: remove the dv_preset API from hdmi
The dv_preset API is deprecated and is replaced by the much improved dv_timings
API. Remove the dv_preset support from this driver as this will allow us to
remove the dv_preset API altogether (s5p-tv being the last user of this code).
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Acked-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/platform/s5p-tv')
-rw-r--r-- | drivers/media/platform/s5p-tv/hdmi_drv.c | 95 |
1 files changed, 22 insertions, 73 deletions
diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c b/drivers/media/platform/s5p-tv/hdmi_drv.c index c78f54cd5df9..4e86626dad4b 100644 --- a/drivers/media/platform/s5p-tv/hdmi_drv.c +++ b/drivers/media/platform/s5p-tv/hdmi_drv.c | |||
@@ -44,9 +44,6 @@ MODULE_AUTHOR("Tomasz Stanislawski, <t.stanislaws@samsung.com>"); | |||
44 | MODULE_DESCRIPTION("Samsung HDMI"); | 44 | MODULE_DESCRIPTION("Samsung HDMI"); |
45 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
46 | 46 | ||
47 | /* default preset configured on probe */ | ||
48 | #define HDMI_DEFAULT_PRESET V4L2_DV_480P59_94 | ||
49 | |||
50 | struct hdmi_pulse { | 47 | struct hdmi_pulse { |
51 | u32 beg; | 48 | u32 beg; |
52 | u32 end; | 49 | u32 end; |
@@ -92,8 +89,6 @@ struct hdmi_device { | |||
92 | const struct hdmi_timings *cur_conf; | 89 | const struct hdmi_timings *cur_conf; |
93 | /** flag indicating that timings are dirty */ | 90 | /** flag indicating that timings are dirty */ |
94 | int cur_conf_dirty; | 91 | int cur_conf_dirty; |
95 | /** current preset */ | ||
96 | u32 cur_preset; | ||
97 | /** current timings */ | 92 | /** current timings */ |
98 | struct v4l2_dv_timings cur_timings; | 93 | struct v4l2_dv_timings cur_timings; |
99 | /** other resources */ | 94 | /** other resources */ |
@@ -255,7 +250,6 @@ static int hdmi_conf_apply(struct hdmi_device *hdmi_dev) | |||
255 | { | 250 | { |
256 | struct device *dev = hdmi_dev->dev; | 251 | struct device *dev = hdmi_dev->dev; |
257 | const struct hdmi_timings *conf = hdmi_dev->cur_conf; | 252 | const struct hdmi_timings *conf = hdmi_dev->cur_conf; |
258 | struct v4l2_dv_preset preset; | ||
259 | int ret; | 253 | int ret; |
260 | 254 | ||
261 | dev_dbg(dev, "%s\n", __func__); | 255 | dev_dbg(dev, "%s\n", __func__); |
@@ -270,11 +264,11 @@ static int hdmi_conf_apply(struct hdmi_device *hdmi_dev) | |||
270 | hdmi_write_mask(hdmi_dev, HDMI_PHY_RSTOUT, 0, HDMI_PHY_SW_RSTOUT); | 264 | hdmi_write_mask(hdmi_dev, HDMI_PHY_RSTOUT, 0, HDMI_PHY_SW_RSTOUT); |
271 | mdelay(10); | 265 | mdelay(10); |
272 | 266 | ||
273 | /* configure presets */ | 267 | /* configure timings */ |
274 | preset.preset = hdmi_dev->cur_preset; | 268 | ret = v4l2_subdev_call(hdmi_dev->phy_sd, video, s_dv_timings, |
275 | ret = v4l2_subdev_call(hdmi_dev->phy_sd, video, s_dv_preset, &preset); | 269 | &hdmi_dev->cur_timings); |
276 | if (ret) { | 270 | if (ret) { |
277 | dev_err(dev, "failed to set preset (%u)\n", preset.preset); | 271 | dev_err(dev, "failed to set timings\n"); |
278 | return ret; | 272 | return ret; |
279 | } | 273 | } |
280 | 274 | ||
@@ -478,35 +472,26 @@ static const struct hdmi_timings hdmi_timings_1080p50 = { | |||
478 | .vsyn[0] = { .beg = 0 + 4, .end = 5 + 4}, | 472 | .vsyn[0] = { .beg = 0 + 4, .end = 5 + 4}, |
479 | }; | 473 | }; |
480 | 474 | ||
475 | /* default hdmi_timings index of the timings configured on probe */ | ||
476 | #define HDMI_DEFAULT_TIMINGS_IDX (0) | ||
477 | |||
481 | static const struct { | 478 | static const struct { |
482 | u32 preset; | ||
483 | bool reduced_fps; | 479 | bool reduced_fps; |
484 | const struct v4l2_dv_timings dv_timings; | 480 | const struct v4l2_dv_timings dv_timings; |
485 | const struct hdmi_timings *hdmi_timings; | 481 | const struct hdmi_timings *hdmi_timings; |
486 | } hdmi_timings[] = { | 482 | } hdmi_timings[] = { |
487 | { V4L2_DV_480P59_94, false, V4L2_DV_BT_CEA_720X480P59_94, &hdmi_timings_480p }, | 483 | { false, V4L2_DV_BT_CEA_720X480P59_94, &hdmi_timings_480p }, |
488 | { V4L2_DV_576P50, false, V4L2_DV_BT_CEA_720X576P50, &hdmi_timings_576p50 }, | 484 | { false, V4L2_DV_BT_CEA_720X576P50, &hdmi_timings_576p50 }, |
489 | { V4L2_DV_720P50, false, V4L2_DV_BT_CEA_1280X720P50, &hdmi_timings_720p50 }, | 485 | { false, V4L2_DV_BT_CEA_1280X720P50, &hdmi_timings_720p50 }, |
490 | { V4L2_DV_720P59_94, true, V4L2_DV_BT_CEA_1280X720P60, &hdmi_timings_720p60 }, | 486 | { true, V4L2_DV_BT_CEA_1280X720P60, &hdmi_timings_720p60 }, |
491 | { V4L2_DV_720P60, false, V4L2_DV_BT_CEA_1280X720P60, &hdmi_timings_720p60 }, | 487 | { false, V4L2_DV_BT_CEA_1920X1080P24, &hdmi_timings_1080p24 }, |
492 | { V4L2_DV_1080P24, false, V4L2_DV_BT_CEA_1920X1080P24, &hdmi_timings_1080p24 }, | 488 | { false, V4L2_DV_BT_CEA_1920X1080P30, &hdmi_timings_1080p60 }, |
493 | { V4L2_DV_1080P30, false, V4L2_DV_BT_CEA_1920X1080P30, &hdmi_timings_1080p60 }, | 489 | { false, V4L2_DV_BT_CEA_1920X1080P50, &hdmi_timings_1080p50 }, |
494 | { V4L2_DV_1080P50, false, V4L2_DV_BT_CEA_1920X1080P50, &hdmi_timings_1080p50 }, | 490 | { false, V4L2_DV_BT_CEA_1920X1080I50, &hdmi_timings_1080i50 }, |
495 | { V4L2_DV_1080I50, false, V4L2_DV_BT_CEA_1920X1080I50, &hdmi_timings_1080i50 }, | 491 | { false, V4L2_DV_BT_CEA_1920X1080I60, &hdmi_timings_1080i60 }, |
496 | { V4L2_DV_1080I60, false, V4L2_DV_BT_CEA_1920X1080I60, &hdmi_timings_1080i60 }, | 492 | { false, V4L2_DV_BT_CEA_1920X1080P60, &hdmi_timings_1080p60 }, |
497 | { V4L2_DV_1080P60, false, V4L2_DV_BT_CEA_1920X1080P60, &hdmi_timings_1080p60 }, | ||
498 | }; | 493 | }; |
499 | 494 | ||
500 | static const struct hdmi_timings *hdmi_preset2timings(u32 preset) | ||
501 | { | ||
502 | int i; | ||
503 | |||
504 | for (i = 0; i < ARRAY_SIZE(hdmi_timings); ++i) | ||
505 | if (hdmi_timings[i].preset == preset) | ||
506 | return hdmi_timings[i].hdmi_timings; | ||
507 | return NULL; | ||
508 | } | ||
509 | |||
510 | static int hdmi_streamon(struct hdmi_device *hdev) | 495 | static int hdmi_streamon(struct hdmi_device *hdev) |
511 | { | 496 | { |
512 | struct device *dev = hdev->dev; | 497 | struct device *dev = hdev->dev; |
@@ -626,32 +611,6 @@ static int hdmi_s_power(struct v4l2_subdev *sd, int on) | |||
626 | return IS_ERR_VALUE(ret) ? ret : 0; | 611 | return IS_ERR_VALUE(ret) ? ret : 0; |
627 | } | 612 | } |
628 | 613 | ||
629 | static int hdmi_s_dv_preset(struct v4l2_subdev *sd, | ||
630 | struct v4l2_dv_preset *preset) | ||
631 | { | ||
632 | struct hdmi_device *hdev = sd_to_hdmi_dev(sd); | ||
633 | struct device *dev = hdev->dev; | ||
634 | const struct hdmi_timings *conf; | ||
635 | |||
636 | conf = hdmi_preset2timings(preset->preset); | ||
637 | if (conf == NULL) { | ||
638 | dev_err(dev, "preset (%u) not supported\n", preset->preset); | ||
639 | return -EINVAL; | ||
640 | } | ||
641 | hdev->cur_conf = conf; | ||
642 | hdev->cur_conf_dirty = 1; | ||
643 | hdev->cur_preset = preset->preset; | ||
644 | return 0; | ||
645 | } | ||
646 | |||
647 | static int hdmi_g_dv_preset(struct v4l2_subdev *sd, | ||
648 | struct v4l2_dv_preset *preset) | ||
649 | { | ||
650 | memset(preset, 0, sizeof(*preset)); | ||
651 | preset->preset = sd_to_hdmi_dev(sd)->cur_preset; | ||
652 | return 0; | ||
653 | } | ||
654 | |||
655 | static int hdmi_s_dv_timings(struct v4l2_subdev *sd, | 614 | static int hdmi_s_dv_timings(struct v4l2_subdev *sd, |
656 | struct v4l2_dv_timings *timings) | 615 | struct v4l2_dv_timings *timings) |
657 | { | 616 | { |
@@ -705,15 +664,6 @@ static int hdmi_g_mbus_fmt(struct v4l2_subdev *sd, | |||
705 | return 0; | 664 | return 0; |
706 | } | 665 | } |
707 | 666 | ||
708 | static int hdmi_enum_dv_presets(struct v4l2_subdev *sd, | ||
709 | struct v4l2_dv_enum_preset *preset) | ||
710 | { | ||
711 | if (preset->index >= ARRAY_SIZE(hdmi_timings)) | ||
712 | return -EINVAL; | ||
713 | return v4l_fill_dv_preset_info(hdmi_timings[preset->index].preset, | ||
714 | preset); | ||
715 | } | ||
716 | |||
717 | static int hdmi_enum_dv_timings(struct v4l2_subdev *sd, | 667 | static int hdmi_enum_dv_timings(struct v4l2_subdev *sd, |
718 | struct v4l2_enum_dv_timings *timings) | 668 | struct v4l2_enum_dv_timings *timings) |
719 | { | 669 | { |
@@ -748,9 +698,6 @@ static const struct v4l2_subdev_core_ops hdmi_sd_core_ops = { | |||
748 | }; | 698 | }; |
749 | 699 | ||
750 | static const struct v4l2_subdev_video_ops hdmi_sd_video_ops = { | 700 | static const struct v4l2_subdev_video_ops hdmi_sd_video_ops = { |
751 | .s_dv_preset = hdmi_s_dv_preset, | ||
752 | .g_dv_preset = hdmi_g_dv_preset, | ||
753 | .enum_dv_presets = hdmi_enum_dv_presets, | ||
754 | .s_dv_timings = hdmi_s_dv_timings, | 701 | .s_dv_timings = hdmi_s_dv_timings, |
755 | .g_dv_timings = hdmi_g_dv_timings, | 702 | .g_dv_timings = hdmi_g_dv_timings, |
756 | .enum_dv_timings = hdmi_enum_dv_timings, | 703 | .enum_dv_timings = hdmi_enum_dv_timings, |
@@ -1024,9 +971,11 @@ static int hdmi_probe(struct platform_device *pdev) | |||
1024 | sd->owner = THIS_MODULE; | 971 | sd->owner = THIS_MODULE; |
1025 | 972 | ||
1026 | strlcpy(sd->name, "s5p-hdmi", sizeof(sd->name)); | 973 | strlcpy(sd->name, "s5p-hdmi", sizeof(sd->name)); |
1027 | hdmi_dev->cur_preset = HDMI_DEFAULT_PRESET; | 974 | hdmi_dev->cur_timings = |
1028 | /* FIXME: missing fail preset is not supported */ | 975 | hdmi_timings[HDMI_DEFAULT_TIMINGS_IDX].dv_timings; |
1029 | hdmi_dev->cur_conf = hdmi_preset2timings(hdmi_dev->cur_preset); | 976 | /* FIXME: missing fail timings is not supported */ |
977 | hdmi_dev->cur_conf = | ||
978 | hdmi_timings[HDMI_DEFAULT_TIMINGS_IDX].hdmi_timings; | ||
1030 | hdmi_dev->cur_conf_dirty = 1; | 979 | hdmi_dev->cur_conf_dirty = 1; |
1031 | 980 | ||
1032 | /* storing subdev for call that have only access to struct device */ | 981 | /* storing subdev for call that have only access to struct device */ |