diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2012-10-16 09:02:05 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-11-21 15:11:43 -0500 |
commit | ccbd5bc448ec782af7d1f3f68bd450c9c38015a0 (patch) | |
tree | 0bcbcaa44868cc6170b63387593cf635d397ff23 | |
parent | 6b0d5d344a78d43957a9f49c549b6f3aa2dc2082 (diff) |
[media] adv7604: use presets where possible
Use predefined video timings (prim_mode/vid_std) when available as recommended
by Analog Devices (http://ez.analog.com/message/48267#48267).
Also remove 720p30 support since the ADV7604 can't handle that.
(http://ez.analog.com/message/61488#61488)
Signed-off-by: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/i2c/adv7604.c | 275 |
1 files changed, 219 insertions, 56 deletions
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 74a18c0fc10d..88b7984a4188 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c | |||
@@ -105,7 +105,6 @@ static const struct v4l2_dv_timings adv7604_timings[] = { | |||
105 | V4L2_DV_BT_CEA_720X576P50, | 105 | V4L2_DV_BT_CEA_720X576P50, |
106 | V4L2_DV_BT_CEA_1280X720P24, | 106 | V4L2_DV_BT_CEA_1280X720P24, |
107 | V4L2_DV_BT_CEA_1280X720P25, | 107 | V4L2_DV_BT_CEA_1280X720P25, |
108 | V4L2_DV_BT_CEA_1280X720P30, | ||
109 | V4L2_DV_BT_CEA_1280X720P50, | 108 | V4L2_DV_BT_CEA_1280X720P50, |
110 | V4L2_DV_BT_CEA_1280X720P60, | 109 | V4L2_DV_BT_CEA_1280X720P60, |
111 | V4L2_DV_BT_CEA_1920X1080P24, | 110 | V4L2_DV_BT_CEA_1920X1080P24, |
@@ -114,6 +113,7 @@ static const struct v4l2_dv_timings adv7604_timings[] = { | |||
114 | V4L2_DV_BT_CEA_1920X1080P50, | 113 | V4L2_DV_BT_CEA_1920X1080P50, |
115 | V4L2_DV_BT_CEA_1920X1080P60, | 114 | V4L2_DV_BT_CEA_1920X1080P60, |
116 | 115 | ||
116 | /* sorted by DMT ID */ | ||
117 | V4L2_DV_BT_DMT_640X350P85, | 117 | V4L2_DV_BT_DMT_640X350P85, |
118 | V4L2_DV_BT_DMT_640X400P85, | 118 | V4L2_DV_BT_DMT_640X400P85, |
119 | V4L2_DV_BT_DMT_720X400P85, | 119 | V4L2_DV_BT_DMT_720X400P85, |
@@ -163,6 +163,89 @@ static const struct v4l2_dv_timings adv7604_timings[] = { | |||
163 | { }, | 163 | { }, |
164 | }; | 164 | }; |
165 | 165 | ||
166 | struct adv7604_video_standards { | ||
167 | struct v4l2_dv_timings timings; | ||
168 | u8 vid_std; | ||
169 | u8 v_freq; | ||
170 | }; | ||
171 | |||
172 | /* sorted by number of lines */ | ||
173 | static const struct adv7604_video_standards adv7604_prim_mode_comp[] = { | ||
174 | /* { V4L2_DV_BT_CEA_720X480P59_94, 0x0a, 0x00 }, TODO flickering */ | ||
175 | { V4L2_DV_BT_CEA_720X576P50, 0x0b, 0x00 }, | ||
176 | { V4L2_DV_BT_CEA_1280X720P50, 0x19, 0x01 }, | ||
177 | { V4L2_DV_BT_CEA_1280X720P60, 0x19, 0x00 }, | ||
178 | { V4L2_DV_BT_CEA_1920X1080P24, 0x1e, 0x04 }, | ||
179 | { V4L2_DV_BT_CEA_1920X1080P25, 0x1e, 0x03 }, | ||
180 | { V4L2_DV_BT_CEA_1920X1080P30, 0x1e, 0x02 }, | ||
181 | { V4L2_DV_BT_CEA_1920X1080P50, 0x1e, 0x01 }, | ||
182 | { V4L2_DV_BT_CEA_1920X1080P60, 0x1e, 0x00 }, | ||
183 | /* TODO add 1920x1080P60_RB (CVT timing) */ | ||
184 | { }, | ||
185 | }; | ||
186 | |||
187 | /* sorted by number of lines */ | ||
188 | static const struct adv7604_video_standards adv7604_prim_mode_gr[] = { | ||
189 | { V4L2_DV_BT_DMT_640X480P60, 0x08, 0x00 }, | ||
190 | { V4L2_DV_BT_DMT_640X480P72, 0x09, 0x00 }, | ||
191 | { V4L2_DV_BT_DMT_640X480P75, 0x0a, 0x00 }, | ||
192 | { V4L2_DV_BT_DMT_640X480P85, 0x0b, 0x00 }, | ||
193 | { V4L2_DV_BT_DMT_800X600P56, 0x00, 0x00 }, | ||
194 | { V4L2_DV_BT_DMT_800X600P60, 0x01, 0x00 }, | ||
195 | { V4L2_DV_BT_DMT_800X600P72, 0x02, 0x00 }, | ||
196 | { V4L2_DV_BT_DMT_800X600P75, 0x03, 0x00 }, | ||
197 | { V4L2_DV_BT_DMT_800X600P85, 0x04, 0x00 }, | ||
198 | { V4L2_DV_BT_DMT_1024X768P60, 0x0c, 0x00 }, | ||
199 | { V4L2_DV_BT_DMT_1024X768P70, 0x0d, 0x00 }, | ||
200 | { V4L2_DV_BT_DMT_1024X768P75, 0x0e, 0x00 }, | ||
201 | { V4L2_DV_BT_DMT_1024X768P85, 0x0f, 0x00 }, | ||
202 | { V4L2_DV_BT_DMT_1280X1024P60, 0x05, 0x00 }, | ||
203 | { V4L2_DV_BT_DMT_1280X1024P75, 0x06, 0x00 }, | ||
204 | { V4L2_DV_BT_DMT_1360X768P60, 0x12, 0x00 }, | ||
205 | { V4L2_DV_BT_DMT_1366X768P60, 0x13, 0x00 }, | ||
206 | { V4L2_DV_BT_DMT_1400X1050P60, 0x14, 0x00 }, | ||
207 | { V4L2_DV_BT_DMT_1400X1050P75, 0x15, 0x00 }, | ||
208 | { V4L2_DV_BT_DMT_1600X1200P60, 0x16, 0x00 }, /* TODO not tested */ | ||
209 | /* TODO add 1600X1200P60_RB (not a DMT timing) */ | ||
210 | { V4L2_DV_BT_DMT_1680X1050P60, 0x18, 0x00 }, | ||
211 | { V4L2_DV_BT_DMT_1920X1200P60_RB, 0x19, 0x00 }, /* TODO not tested */ | ||
212 | { }, | ||
213 | }; | ||
214 | |||
215 | /* sorted by number of lines */ | ||
216 | static const struct adv7604_video_standards adv7604_prim_mode_hdmi_comp[] = { | ||
217 | { V4L2_DV_BT_CEA_720X480P59_94, 0x0a, 0x00 }, | ||
218 | { V4L2_DV_BT_CEA_720X576P50, 0x0b, 0x00 }, | ||
219 | { V4L2_DV_BT_CEA_1280X720P50, 0x13, 0x01 }, | ||
220 | { V4L2_DV_BT_CEA_1280X720P60, 0x13, 0x00 }, | ||
221 | { V4L2_DV_BT_CEA_1920X1080P24, 0x1e, 0x04 }, | ||
222 | { V4L2_DV_BT_CEA_1920X1080P25, 0x1e, 0x03 }, | ||
223 | { V4L2_DV_BT_CEA_1920X1080P30, 0x1e, 0x02 }, | ||
224 | { V4L2_DV_BT_CEA_1920X1080P50, 0x1e, 0x01 }, | ||
225 | { V4L2_DV_BT_CEA_1920X1080P60, 0x1e, 0x00 }, | ||
226 | { }, | ||
227 | }; | ||
228 | |||
229 | /* sorted by number of lines */ | ||
230 | static const struct adv7604_video_standards adv7604_prim_mode_hdmi_gr[] = { | ||
231 | { V4L2_DV_BT_DMT_640X480P60, 0x08, 0x00 }, | ||
232 | { V4L2_DV_BT_DMT_640X480P72, 0x09, 0x00 }, | ||
233 | { V4L2_DV_BT_DMT_640X480P75, 0x0a, 0x00 }, | ||
234 | { V4L2_DV_BT_DMT_640X480P85, 0x0b, 0x00 }, | ||
235 | { V4L2_DV_BT_DMT_800X600P56, 0x00, 0x00 }, | ||
236 | { V4L2_DV_BT_DMT_800X600P60, 0x01, 0x00 }, | ||
237 | { V4L2_DV_BT_DMT_800X600P72, 0x02, 0x00 }, | ||
238 | { V4L2_DV_BT_DMT_800X600P75, 0x03, 0x00 }, | ||
239 | { V4L2_DV_BT_DMT_800X600P85, 0x04, 0x00 }, | ||
240 | { V4L2_DV_BT_DMT_1024X768P60, 0x0c, 0x00 }, | ||
241 | { V4L2_DV_BT_DMT_1024X768P70, 0x0d, 0x00 }, | ||
242 | { V4L2_DV_BT_DMT_1024X768P75, 0x0e, 0x00 }, | ||
243 | { V4L2_DV_BT_DMT_1024X768P85, 0x0f, 0x00 }, | ||
244 | { V4L2_DV_BT_DMT_1280X1024P60, 0x05, 0x00 }, | ||
245 | { V4L2_DV_BT_DMT_1280X1024P75, 0x06, 0x00 }, | ||
246 | { }, | ||
247 | }; | ||
248 | |||
166 | /* ----------------------------------------------------------------------- */ | 249 | /* ----------------------------------------------------------------------- */ |
167 | 250 | ||
168 | static inline struct adv7604_state *to_state(struct v4l2_subdev *sd) | 251 | static inline struct adv7604_state *to_state(struct v4l2_subdev *sd) |
@@ -671,64 +754,144 @@ static int adv7604_s_detect_tx_5v_ctrl(struct v4l2_subdev *sd) | |||
671 | ((io_read(sd, 0x6f) & 0x10) >> 4)); | 754 | ((io_read(sd, 0x6f) & 0x10) >> 4)); |
672 | } | 755 | } |
673 | 756 | ||
674 | static void configure_free_run(struct v4l2_subdev *sd, const struct v4l2_bt_timings *timings) | 757 | static int find_and_set_predefined_video_timings(struct v4l2_subdev *sd, |
758 | u8 prim_mode, | ||
759 | const struct adv7604_video_standards *predef_vid_timings, | ||
760 | const struct v4l2_dv_timings *timings) | ||
761 | { | ||
762 | struct adv7604_state *state = to_state(sd); | ||
763 | int i; | ||
764 | |||
765 | for (i = 0; predef_vid_timings[i].timings.bt.width; i++) { | ||
766 | if (!v4l_match_dv_timings(timings, &predef_vid_timings[i].timings, | ||
767 | DIGITAL_INPUT ? 250000 : 1000000)) | ||
768 | continue; | ||
769 | io_write(sd, 0x00, predef_vid_timings[i].vid_std); /* video std */ | ||
770 | io_write(sd, 0x01, (predef_vid_timings[i].v_freq << 4) + | ||
771 | prim_mode); /* v_freq and prim mode */ | ||
772 | return 0; | ||
773 | } | ||
774 | |||
775 | return -1; | ||
776 | } | ||
777 | |||
778 | static int configure_predefined_video_timings(struct v4l2_subdev *sd, | ||
779 | struct v4l2_dv_timings *timings) | ||
675 | { | 780 | { |
781 | struct adv7604_state *state = to_state(sd); | ||
782 | int err; | ||
783 | |||
784 | v4l2_dbg(1, debug, sd, "%s", __func__); | ||
785 | |||
786 | /* reset to default values */ | ||
787 | io_write(sd, 0x16, 0x43); | ||
788 | io_write(sd, 0x17, 0x5a); | ||
789 | /* disable embedded syncs for auto graphics mode */ | ||
790 | cp_write_and_or(sd, 0x81, 0xef, 0x00); | ||
791 | cp_write(sd, 0x8f, 0x00); | ||
792 | cp_write(sd, 0x90, 0x00); | ||
793 | cp_write(sd, 0xa2, 0x00); | ||
794 | cp_write(sd, 0xa3, 0x00); | ||
795 | cp_write(sd, 0xa4, 0x00); | ||
796 | cp_write(sd, 0xa5, 0x00); | ||
797 | cp_write(sd, 0xa6, 0x00); | ||
798 | cp_write(sd, 0xa7, 0x00); | ||
799 | cp_write(sd, 0xab, 0x00); | ||
800 | cp_write(sd, 0xac, 0x00); | ||
801 | |||
802 | switch (state->mode) { | ||
803 | case ADV7604_MODE_COMP: | ||
804 | case ADV7604_MODE_GR: | ||
805 | err = find_and_set_predefined_video_timings(sd, | ||
806 | 0x01, adv7604_prim_mode_comp, timings); | ||
807 | if (err) | ||
808 | err = find_and_set_predefined_video_timings(sd, | ||
809 | 0x02, adv7604_prim_mode_gr, timings); | ||
810 | break; | ||
811 | case ADV7604_MODE_HDMI: | ||
812 | err = find_and_set_predefined_video_timings(sd, | ||
813 | 0x05, adv7604_prim_mode_hdmi_comp, timings); | ||
814 | if (err) | ||
815 | err = find_and_set_predefined_video_timings(sd, | ||
816 | 0x06, adv7604_prim_mode_hdmi_gr, timings); | ||
817 | break; | ||
818 | default: | ||
819 | v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n", | ||
820 | __func__, state->mode); | ||
821 | err = -1; | ||
822 | break; | ||
823 | } | ||
824 | |||
825 | |||
826 | return err; | ||
827 | } | ||
828 | |||
829 | static void configure_custom_video_timings(struct v4l2_subdev *sd, | ||
830 | const struct v4l2_bt_timings *bt) | ||
831 | { | ||
832 | struct adv7604_state *state = to_state(sd); | ||
676 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 833 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
677 | u32 width = htotal(timings); | 834 | u32 width = htotal(bt); |
678 | u32 height = vtotal(timings); | 835 | u32 height = vtotal(bt); |
679 | u16 ch1_fr_ll = (((u32)timings->pixelclock / 100) > 0) ? | 836 | u16 cp_start_sav = bt->hsync + bt->hbackporch - 4; |
680 | ((width * (ADV7604_fsc / 100)) / ((u32)timings->pixelclock / 100)) : 0; | 837 | u16 cp_start_eav = width - bt->hfrontporch; |
838 | u16 cp_start_vbi = height - bt->vfrontporch; | ||
839 | u16 cp_end_vbi = bt->vsync + bt->vbackporch; | ||
840 | u16 ch1_fr_ll = (((u32)bt->pixelclock / 100) > 0) ? | ||
841 | ((width * (ADV7604_fsc / 100)) / ((u32)bt->pixelclock / 100)) : 0; | ||
842 | const u8 pll[2] = { | ||
843 | 0xc0 | ((width >> 8) & 0x1f), | ||
844 | width & 0xff | ||
845 | }; | ||
681 | 846 | ||
682 | v4l2_dbg(2, debug, sd, "%s\n", __func__); | 847 | v4l2_dbg(2, debug, sd, "%s\n", __func__); |
683 | 848 | ||
684 | cp_write(sd, 0x8f, (ch1_fr_ll >> 8) & 0x7); /* CH1_FR_LL */ | 849 | switch (state->mode) { |
685 | cp_write(sd, 0x90, ch1_fr_ll & 0xff); /* CH1_FR_LL */ | 850 | case ADV7604_MODE_COMP: |
686 | cp_write(sd, 0xab, (height >> 4) & 0xff); /* CP_LCOUNT_MAX */ | 851 | case ADV7604_MODE_GR: |
687 | cp_write(sd, 0xac, (height & 0x0f) << 4); /* CP_LCOUNT_MAX */ | 852 | /* auto graphics */ |
688 | /* TODO support interlaced */ | 853 | io_write(sd, 0x00, 0x07); /* video std */ |
689 | cp_write(sd, 0x91, 0x10); /* INTERLACED */ | 854 | io_write(sd, 0x01, 0x02); /* prim mode */ |
690 | 855 | /* enable embedded syncs for auto graphics mode */ | |
691 | /* Should only be set in auto-graphics mode [REF_02 p. 91-92] */ | 856 | cp_write_and_or(sd, 0x81, 0xef, 0x10); |
692 | if ((io_read(sd, 0x00) == 0x07) && (io_read(sd, 0x01) == 0x02)) { | ||
693 | u16 cp_start_sav, cp_start_eav, cp_start_vbi, cp_end_vbi; | ||
694 | const u8 pll[2] = { | ||
695 | (0xc0 | ((width >> 8) & 0x1f)), | ||
696 | (width & 0xff) | ||
697 | }; | ||
698 | 857 | ||
858 | /* Should only be set in auto-graphics mode [REF_02, p. 91-92] */ | ||
699 | /* setup PLL_DIV_MAN_EN and PLL_DIV_RATIO */ | 859 | /* setup PLL_DIV_MAN_EN and PLL_DIV_RATIO */ |
700 | /* IO-map reg. 0x16 and 0x17 should be written in sequence */ | 860 | /* IO-map reg. 0x16 and 0x17 should be written in sequence */ |
701 | if (adv_smbus_write_i2c_block_data(client, 0x16, 2, pll)) { | 861 | if (adv_smbus_write_i2c_block_data(client, 0x16, 2, pll)) { |
702 | v4l2_err(sd, "writing to reg 0x16 and 0x17 failed\n"); | 862 | v4l2_err(sd, "writing to reg 0x16 and 0x17 failed\n"); |
703 | return; | 863 | break; |
704 | } | 864 | } |
705 | 865 | ||
706 | /* active video - horizontal timing */ | 866 | /* active video - horizontal timing */ |
707 | cp_start_sav = timings->hsync + timings->hbackporch - 4; | ||
708 | cp_start_eav = width - timings->hfrontporch; | ||
709 | cp_write(sd, 0xa2, (cp_start_sav >> 4) & 0xff); | 867 | cp_write(sd, 0xa2, (cp_start_sav >> 4) & 0xff); |
710 | cp_write(sd, 0xa3, ((cp_start_sav & 0x0f) << 4) | ((cp_start_eav >> 8) & 0x0f)); | 868 | cp_write(sd, 0xa3, ((cp_start_sav & 0x0f) << 4) | |
869 | ((cp_start_eav >> 8) & 0x0f)); | ||
711 | cp_write(sd, 0xa4, cp_start_eav & 0xff); | 870 | cp_write(sd, 0xa4, cp_start_eav & 0xff); |
712 | 871 | ||
713 | /* active video - vertical timing */ | 872 | /* active video - vertical timing */ |
714 | cp_start_vbi = height - timings->vfrontporch; | ||
715 | cp_end_vbi = timings->vsync + timings->vbackporch; | ||
716 | cp_write(sd, 0xa5, (cp_start_vbi >> 4) & 0xff); | 873 | cp_write(sd, 0xa5, (cp_start_vbi >> 4) & 0xff); |
717 | cp_write(sd, 0xa6, ((cp_start_vbi & 0xf) << 4) | ((cp_end_vbi >> 8) & 0xf)); | 874 | cp_write(sd, 0xa6, ((cp_start_vbi & 0xf) << 4) | |
875 | ((cp_end_vbi >> 8) & 0xf)); | ||
718 | cp_write(sd, 0xa7, cp_end_vbi & 0xff); | 876 | cp_write(sd, 0xa7, cp_end_vbi & 0xff); |
719 | } else { | 877 | break; |
720 | /* reset to default values */ | 878 | case ADV7604_MODE_HDMI: |
721 | io_write(sd, 0x16, 0x43); | 879 | /* set default prim_mode/vid_std for HDMI |
722 | io_write(sd, 0x17, 0x5a); | 880 | accoring to [REF_03, c. 4.2] */ |
723 | cp_write(sd, 0xa2, 0x00); | 881 | io_write(sd, 0x00, 0x02); /* video std */ |
724 | cp_write(sd, 0xa3, 0x00); | 882 | io_write(sd, 0x01, 0x06); /* prim mode */ |
725 | cp_write(sd, 0xa4, 0x00); | 883 | break; |
726 | cp_write(sd, 0xa5, 0x00); | 884 | default: |
727 | cp_write(sd, 0xa6, 0x00); | 885 | v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n", |
728 | cp_write(sd, 0xa7, 0x00); | 886 | __func__, state->mode); |
887 | break; | ||
729 | } | 888 | } |
730 | } | ||
731 | 889 | ||
890 | cp_write(sd, 0x8f, (ch1_fr_ll >> 8) & 0x7); | ||
891 | cp_write(sd, 0x90, ch1_fr_ll & 0xff); | ||
892 | cp_write(sd, 0xab, (height >> 4) & 0xff); | ||
893 | cp_write(sd, 0xac, (height & 0x0f) << 4); | ||
894 | } | ||
732 | 895 | ||
733 | static void set_rgb_quantization_range(struct v4l2_subdev *sd) | 896 | static void set_rgb_quantization_range(struct v4l2_subdev *sd) |
734 | { | 897 | { |
@@ -964,8 +1127,10 @@ static int stdi2dv_timings(struct v4l2_subdev *sd, | |||
964 | state->aspect_ratio, timings)) | 1127 | state->aspect_ratio, timings)) |
965 | return 0; | 1128 | return 0; |
966 | 1129 | ||
967 | v4l2_dbg(2, debug, sd, "%s: No format candidate found for lcf=%d, bl = %d\n", | 1130 | v4l2_dbg(2, debug, sd, |
968 | __func__, stdi->lcf, stdi->bl); | 1131 | "%s: No format candidate found for lcvs = %d, lcf=%d, bl = %d, %chsync, %cvsync\n", |
1132 | __func__, stdi->lcvs, stdi->lcf, stdi->bl, | ||
1133 | stdi->hs_pol, stdi->vs_pol); | ||
969 | return -1; | 1134 | return -1; |
970 | } | 1135 | } |
971 | 1136 | ||
@@ -1163,6 +1328,7 @@ static int adv7604_s_dv_timings(struct v4l2_subdev *sd, | |||
1163 | { | 1328 | { |
1164 | struct adv7604_state *state = to_state(sd); | 1329 | struct adv7604_state *state = to_state(sd); |
1165 | struct v4l2_bt_timings *bt; | 1330 | struct v4l2_bt_timings *bt; |
1331 | int err; | ||
1166 | 1332 | ||
1167 | if (!timings) | 1333 | if (!timings) |
1168 | return -EINVAL; | 1334 | return -EINVAL; |
@@ -1175,12 +1341,20 @@ static int adv7604_s_dv_timings(struct v4l2_subdev *sd, | |||
1175 | __func__, (u32)bt->pixelclock); | 1341 | __func__, (u32)bt->pixelclock); |
1176 | return -ERANGE; | 1342 | return -ERANGE; |
1177 | } | 1343 | } |
1344 | |||
1178 | adv7604_fill_optional_dv_timings_fields(sd, timings); | 1345 | adv7604_fill_optional_dv_timings_fields(sd, timings); |
1179 | 1346 | ||
1180 | state->timings = *timings; | 1347 | state->timings = *timings; |
1181 | 1348 | ||
1182 | /* freerun */ | 1349 | cp_write(sd, 0x91, bt->interlaced ? 0x50 : 0x10); |
1183 | configure_free_run(sd, bt); | 1350 | |
1351 | /* Use prim_mode and vid_std when available */ | ||
1352 | err = configure_predefined_video_timings(sd, timings); | ||
1353 | if (err) { | ||
1354 | /* custom settings when the video format | ||
1355 | does not have prim_mode/vid_std */ | ||
1356 | configure_custom_video_timings(sd, bt); | ||
1357 | } | ||
1184 | 1358 | ||
1185 | set_rgb_quantization_range(sd); | 1359 | set_rgb_quantization_range(sd); |
1186 | 1360 | ||
@@ -1238,12 +1412,6 @@ static void select_input(struct v4l2_subdev *sd) | |||
1238 | switch (state->mode) { | 1412 | switch (state->mode) { |
1239 | case ADV7604_MODE_COMP: | 1413 | case ADV7604_MODE_COMP: |
1240 | case ADV7604_MODE_GR: | 1414 | case ADV7604_MODE_GR: |
1241 | /* set mode and select free run resolution */ | ||
1242 | io_write(sd, 0x00, 0x07); /* video std */ | ||
1243 | io_write(sd, 0x01, 0x02); /* prim mode */ | ||
1244 | /* enable embedded syncs for auto graphics mode */ | ||
1245 | cp_write_and_or(sd, 0x81, 0xef, 0x10); | ||
1246 | |||
1247 | /* reset ADI recommended settings for HDMI: */ | 1415 | /* reset ADI recommended settings for HDMI: */ |
1248 | /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ | 1416 | /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ |
1249 | hdmi_write(sd, 0x0d, 0x04); /* HDMI filter optimization */ | 1417 | hdmi_write(sd, 0x0d, 0x04); /* HDMI filter optimization */ |
@@ -1272,12 +1440,6 @@ static void select_input(struct v4l2_subdev *sd) | |||
1272 | break; | 1440 | break; |
1273 | 1441 | ||
1274 | case ADV7604_MODE_HDMI: | 1442 | case ADV7604_MODE_HDMI: |
1275 | /* set mode and select free run resolution */ | ||
1276 | io_write(sd, 0x00, 0x02); /* video std */ | ||
1277 | io_write(sd, 0x01, 0x06); /* prim mode */ | ||
1278 | /* disable embedded syncs for auto graphics mode */ | ||
1279 | cp_write_and_or(sd, 0x81, 0xef, 0x00); | ||
1280 | |||
1281 | /* set ADI recommended settings for HDMI: */ | 1443 | /* set ADI recommended settings for HDMI: */ |
1282 | /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ | 1444 | /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ |
1283 | hdmi_write(sd, 0x0d, 0x84); /* HDMI filter optimization */ | 1445 | hdmi_write(sd, 0x0d, 0x84); /* HDMI filter optimization */ |
@@ -1534,8 +1696,9 @@ static int adv7604_log_status(struct v4l2_subdev *sd) | |||
1534 | v4l2_info(sd, "CP locked: %s\n", no_lock_cp(sd) ? "false" : "true"); | 1696 | v4l2_info(sd, "CP locked: %s\n", no_lock_cp(sd) ? "false" : "true"); |
1535 | v4l2_info(sd, "CP free run: %s\n", | 1697 | v4l2_info(sd, "CP free run: %s\n", |
1536 | (!!(cp_read(sd, 0xff) & 0x10) ? "on" : "off")); | 1698 | (!!(cp_read(sd, 0xff) & 0x10) ? "on" : "off")); |
1537 | v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x\n", | 1699 | v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x, v_freq = 0x%x\n", |
1538 | io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f); | 1700 | io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f, |
1701 | (io_read(sd, 0x01) & 0x70) >> 4); | ||
1539 | 1702 | ||
1540 | v4l2_info(sd, "-----Video Timings-----\n"); | 1703 | v4l2_info(sd, "-----Video Timings-----\n"); |
1541 | if (read_stdi(sd, &stdi)) | 1704 | if (read_stdi(sd, &stdi)) |