diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-11-28 04:22:38 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-11-28 04:22:38 -0500 |
commit | d033a308d81ec83908760a15a841c2bd0d5e0ea3 (patch) | |
tree | 647abd67987fe4d7fee80105fc823edf3f53b4f6 /drivers/media | |
parent | c6c22955f80f2db9614b01fe5a3d1cfcd8b3d848 (diff) | |
parent | e23739b4ade80a3a7f87198f008f6c44a7cbc9fd (diff) |
Merge remote-tracking branch 'linus/master' into staging/for_v3.8
* linus/master: (1428 commits)
futex: avoid wake_futex() for a PI futex_q
watchdog: using u64 in get_sample_period()
writeback: put unused inodes to LRU after writeback completion
mm: vmscan: check for fatal signals iff the process was throttled
Revert "mm: remove __GFP_NO_KSWAPD"
proc: check vma->vm_file before dereferencing
UAPI: strip the _UAPI prefix from header guards during header installation
include/linux/bug.h: fix sparse warning related to BUILD_BUG_ON_INVALID
Linux 3.7-rc7
powerpc/eeh: Do not invalidate PE properly
ALSA: hda - Fix build without CONFIG_PM
of/address: sparc: Declare of_iomap as an extern function for sparc again
PM / QoS: fix wrong error-checking condition
bnx2x: remove redundant warning log
vxlan: fix command usage in its doc
8139cp: revert "set ring address before enabling receiver"
MPI: Fix compilation on MIPS with GCC 4.4 and newer
MIPS: Fix crash that occurs when function tracing is enabled
MIPS: Merge overlapping bootmem ranges
jbd: Fix lock ordering bug in journal_unmap_buffer()
...
Diffstat (limited to 'drivers/media')
21 files changed, 352 insertions, 176 deletions
diff --git a/drivers/media/dvb-frontends/stv0900_core.c b/drivers/media/dvb-frontends/stv0900_core.c index 262dfa503c2a..b551ca350e00 100644 --- a/drivers/media/dvb-frontends/stv0900_core.c +++ b/drivers/media/dvb-frontends/stv0900_core.c | |||
@@ -300,15 +300,15 @@ static enum fe_stv0900_error stv0900_set_mclk(struct stv0900_internal *intp, u32 | |||
300 | { | 300 | { |
301 | u32 m_div, clk_sel; | 301 | u32 m_div, clk_sel; |
302 | 302 | ||
303 | dprintk("%s: Mclk set to %d, Quartz = %d\n", __func__, mclk, | ||
304 | intp->quartz); | ||
305 | |||
306 | if (intp == NULL) | 303 | if (intp == NULL) |
307 | return STV0900_INVALID_HANDLE; | 304 | return STV0900_INVALID_HANDLE; |
308 | 305 | ||
309 | if (intp->errs) | 306 | if (intp->errs) |
310 | return STV0900_I2C_ERROR; | 307 | return STV0900_I2C_ERROR; |
311 | 308 | ||
309 | dprintk("%s: Mclk set to %d, Quartz = %d\n", __func__, mclk, | ||
310 | intp->quartz); | ||
311 | |||
312 | clk_sel = ((stv0900_get_bits(intp, F0900_SELX1RATIO) == 1) ? 4 : 6); | 312 | clk_sel = ((stv0900_get_bits(intp, F0900_SELX1RATIO) == 1) ? 4 : 6); |
313 | m_div = ((clk_sel * mclk) / intp->quartz) - 1; | 313 | m_div = ((clk_sel * mclk) / intp->quartz) - 1; |
314 | stv0900_write_bits(intp, F0900_M_DIV, m_div); | 314 | stv0900_write_bits(intp, F0900_M_DIV, m_div); |
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 89fc85403ca2..f47555b1000a 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c | |||
@@ -53,8 +53,7 @@ MODULE_LICENSE("GPL"); | |||
53 | /* ADV7604 system clock frequency */ | 53 | /* ADV7604 system clock frequency */ |
54 | #define ADV7604_fsc (28636360) | 54 | #define ADV7604_fsc (28636360) |
55 | 55 | ||
56 | #define DIGITAL_INPUT ((state->prim_mode == ADV7604_PRIM_MODE_HDMI_COMP) || \ | 56 | #define DIGITAL_INPUT (state->mode == ADV7604_MODE_HDMI) |
57 | (state->prim_mode == ADV7604_PRIM_MODE_HDMI_GR)) | ||
58 | 57 | ||
59 | /* | 58 | /* |
60 | ********************************************************************** | 59 | ********************************************************************** |
@@ -68,7 +67,7 @@ struct adv7604_state { | |||
68 | struct v4l2_subdev sd; | 67 | struct v4l2_subdev sd; |
69 | struct media_pad pad; | 68 | struct media_pad pad; |
70 | struct v4l2_ctrl_handler hdl; | 69 | struct v4l2_ctrl_handler hdl; |
71 | enum adv7604_prim_mode prim_mode; | 70 | enum adv7604_mode mode; |
72 | struct v4l2_dv_timings timings; | 71 | struct v4l2_dv_timings timings; |
73 | u8 edid[256]; | 72 | u8 edid[256]; |
74 | unsigned edid_blocks; | 73 | unsigned edid_blocks; |
@@ -77,6 +76,7 @@ struct adv7604_state { | |||
77 | struct workqueue_struct *work_queues; | 76 | struct workqueue_struct *work_queues; |
78 | struct delayed_work delayed_work_enable_hotplug; | 77 | struct delayed_work delayed_work_enable_hotplug; |
79 | bool connector_hdmi; | 78 | bool connector_hdmi; |
79 | bool restart_stdi_once; | ||
80 | 80 | ||
81 | /* i2c clients */ | 81 | /* i2c clients */ |
82 | struct i2c_client *i2c_avlink; | 82 | struct i2c_client *i2c_avlink; |
@@ -106,7 +106,6 @@ static const struct v4l2_dv_timings adv7604_timings[] = { | |||
106 | V4L2_DV_BT_CEA_720X576P50, | 106 | V4L2_DV_BT_CEA_720X576P50, |
107 | V4L2_DV_BT_CEA_1280X720P24, | 107 | V4L2_DV_BT_CEA_1280X720P24, |
108 | V4L2_DV_BT_CEA_1280X720P25, | 108 | V4L2_DV_BT_CEA_1280X720P25, |
109 | V4L2_DV_BT_CEA_1280X720P30, | ||
110 | V4L2_DV_BT_CEA_1280X720P50, | 109 | V4L2_DV_BT_CEA_1280X720P50, |
111 | V4L2_DV_BT_CEA_1280X720P60, | 110 | V4L2_DV_BT_CEA_1280X720P60, |
112 | V4L2_DV_BT_CEA_1920X1080P24, | 111 | V4L2_DV_BT_CEA_1920X1080P24, |
@@ -115,6 +114,7 @@ static const struct v4l2_dv_timings adv7604_timings[] = { | |||
115 | V4L2_DV_BT_CEA_1920X1080P50, | 114 | V4L2_DV_BT_CEA_1920X1080P50, |
116 | V4L2_DV_BT_CEA_1920X1080P60, | 115 | V4L2_DV_BT_CEA_1920X1080P60, |
117 | 116 | ||
117 | /* sorted by DMT ID */ | ||
118 | V4L2_DV_BT_DMT_640X350P85, | 118 | V4L2_DV_BT_DMT_640X350P85, |
119 | V4L2_DV_BT_DMT_640X400P85, | 119 | V4L2_DV_BT_DMT_640X400P85, |
120 | V4L2_DV_BT_DMT_720X400P85, | 120 | V4L2_DV_BT_DMT_720X400P85, |
@@ -164,6 +164,89 @@ static const struct v4l2_dv_timings adv7604_timings[] = { | |||
164 | { }, | 164 | { }, |
165 | }; | 165 | }; |
166 | 166 | ||
167 | struct adv7604_video_standards { | ||
168 | struct v4l2_dv_timings timings; | ||
169 | u8 vid_std; | ||
170 | u8 v_freq; | ||
171 | }; | ||
172 | |||
173 | /* sorted by number of lines */ | ||
174 | static const struct adv7604_video_standards adv7604_prim_mode_comp[] = { | ||
175 | /* { V4L2_DV_BT_CEA_720X480P59_94, 0x0a, 0x00 }, TODO flickering */ | ||
176 | { V4L2_DV_BT_CEA_720X576P50, 0x0b, 0x00 }, | ||
177 | { V4L2_DV_BT_CEA_1280X720P50, 0x19, 0x01 }, | ||
178 | { V4L2_DV_BT_CEA_1280X720P60, 0x19, 0x00 }, | ||
179 | { V4L2_DV_BT_CEA_1920X1080P24, 0x1e, 0x04 }, | ||
180 | { V4L2_DV_BT_CEA_1920X1080P25, 0x1e, 0x03 }, | ||
181 | { V4L2_DV_BT_CEA_1920X1080P30, 0x1e, 0x02 }, | ||
182 | { V4L2_DV_BT_CEA_1920X1080P50, 0x1e, 0x01 }, | ||
183 | { V4L2_DV_BT_CEA_1920X1080P60, 0x1e, 0x00 }, | ||
184 | /* TODO add 1920x1080P60_RB (CVT timing) */ | ||
185 | { }, | ||
186 | }; | ||
187 | |||
188 | /* sorted by number of lines */ | ||
189 | static const struct adv7604_video_standards adv7604_prim_mode_gr[] = { | ||
190 | { V4L2_DV_BT_DMT_640X480P60, 0x08, 0x00 }, | ||
191 | { V4L2_DV_BT_DMT_640X480P72, 0x09, 0x00 }, | ||
192 | { V4L2_DV_BT_DMT_640X480P75, 0x0a, 0x00 }, | ||
193 | { V4L2_DV_BT_DMT_640X480P85, 0x0b, 0x00 }, | ||
194 | { V4L2_DV_BT_DMT_800X600P56, 0x00, 0x00 }, | ||
195 | { V4L2_DV_BT_DMT_800X600P60, 0x01, 0x00 }, | ||
196 | { V4L2_DV_BT_DMT_800X600P72, 0x02, 0x00 }, | ||
197 | { V4L2_DV_BT_DMT_800X600P75, 0x03, 0x00 }, | ||
198 | { V4L2_DV_BT_DMT_800X600P85, 0x04, 0x00 }, | ||
199 | { V4L2_DV_BT_DMT_1024X768P60, 0x0c, 0x00 }, | ||
200 | { V4L2_DV_BT_DMT_1024X768P70, 0x0d, 0x00 }, | ||
201 | { V4L2_DV_BT_DMT_1024X768P75, 0x0e, 0x00 }, | ||
202 | { V4L2_DV_BT_DMT_1024X768P85, 0x0f, 0x00 }, | ||
203 | { V4L2_DV_BT_DMT_1280X1024P60, 0x05, 0x00 }, | ||
204 | { V4L2_DV_BT_DMT_1280X1024P75, 0x06, 0x00 }, | ||
205 | { V4L2_DV_BT_DMT_1360X768P60, 0x12, 0x00 }, | ||
206 | { V4L2_DV_BT_DMT_1366X768P60, 0x13, 0x00 }, | ||
207 | { V4L2_DV_BT_DMT_1400X1050P60, 0x14, 0x00 }, | ||
208 | { V4L2_DV_BT_DMT_1400X1050P75, 0x15, 0x00 }, | ||
209 | { V4L2_DV_BT_DMT_1600X1200P60, 0x16, 0x00 }, /* TODO not tested */ | ||
210 | /* TODO add 1600X1200P60_RB (not a DMT timing) */ | ||
211 | { V4L2_DV_BT_DMT_1680X1050P60, 0x18, 0x00 }, | ||
212 | { V4L2_DV_BT_DMT_1920X1200P60_RB, 0x19, 0x00 }, /* TODO not tested */ | ||
213 | { }, | ||
214 | }; | ||
215 | |||
216 | /* sorted by number of lines */ | ||
217 | static const struct adv7604_video_standards adv7604_prim_mode_hdmi_comp[] = { | ||
218 | { V4L2_DV_BT_CEA_720X480P59_94, 0x0a, 0x00 }, | ||
219 | { V4L2_DV_BT_CEA_720X576P50, 0x0b, 0x00 }, | ||
220 | { V4L2_DV_BT_CEA_1280X720P50, 0x13, 0x01 }, | ||
221 | { V4L2_DV_BT_CEA_1280X720P60, 0x13, 0x00 }, | ||
222 | { V4L2_DV_BT_CEA_1920X1080P24, 0x1e, 0x04 }, | ||
223 | { V4L2_DV_BT_CEA_1920X1080P25, 0x1e, 0x03 }, | ||
224 | { V4L2_DV_BT_CEA_1920X1080P30, 0x1e, 0x02 }, | ||
225 | { V4L2_DV_BT_CEA_1920X1080P50, 0x1e, 0x01 }, | ||
226 | { V4L2_DV_BT_CEA_1920X1080P60, 0x1e, 0x00 }, | ||
227 | { }, | ||
228 | }; | ||
229 | |||
230 | /* sorted by number of lines */ | ||
231 | static const struct adv7604_video_standards adv7604_prim_mode_hdmi_gr[] = { | ||
232 | { V4L2_DV_BT_DMT_640X480P60, 0x08, 0x00 }, | ||
233 | { V4L2_DV_BT_DMT_640X480P72, 0x09, 0x00 }, | ||
234 | { V4L2_DV_BT_DMT_640X480P75, 0x0a, 0x00 }, | ||
235 | { V4L2_DV_BT_DMT_640X480P85, 0x0b, 0x00 }, | ||
236 | { V4L2_DV_BT_DMT_800X600P56, 0x00, 0x00 }, | ||
237 | { V4L2_DV_BT_DMT_800X600P60, 0x01, 0x00 }, | ||
238 | { V4L2_DV_BT_DMT_800X600P72, 0x02, 0x00 }, | ||
239 | { V4L2_DV_BT_DMT_800X600P75, 0x03, 0x00 }, | ||
240 | { V4L2_DV_BT_DMT_800X600P85, 0x04, 0x00 }, | ||
241 | { V4L2_DV_BT_DMT_1024X768P60, 0x0c, 0x00 }, | ||
242 | { V4L2_DV_BT_DMT_1024X768P70, 0x0d, 0x00 }, | ||
243 | { V4L2_DV_BT_DMT_1024X768P75, 0x0e, 0x00 }, | ||
244 | { V4L2_DV_BT_DMT_1024X768P85, 0x0f, 0x00 }, | ||
245 | { V4L2_DV_BT_DMT_1280X1024P60, 0x05, 0x00 }, | ||
246 | { V4L2_DV_BT_DMT_1280X1024P75, 0x06, 0x00 }, | ||
247 | { }, | ||
248 | }; | ||
249 | |||
167 | /* ----------------------------------------------------------------------- */ | 250 | /* ----------------------------------------------------------------------- */ |
168 | 251 | ||
169 | static inline struct adv7604_state *to_state(struct v4l2_subdev *sd) | 252 | static inline struct adv7604_state *to_state(struct v4l2_subdev *sd) |
@@ -682,64 +765,144 @@ static int adv7604_s_detect_tx_5v_ctrl(struct v4l2_subdev *sd) | |||
682 | ((io_read(sd, 0x6f) & 0x10) >> 4)); | 765 | ((io_read(sd, 0x6f) & 0x10) >> 4)); |
683 | } | 766 | } |
684 | 767 | ||
685 | static void configure_free_run(struct v4l2_subdev *sd, const struct v4l2_bt_timings *timings) | 768 | static int find_and_set_predefined_video_timings(struct v4l2_subdev *sd, |
769 | u8 prim_mode, | ||
770 | const struct adv7604_video_standards *predef_vid_timings, | ||
771 | const struct v4l2_dv_timings *timings) | ||
772 | { | ||
773 | struct adv7604_state *state = to_state(sd); | ||
774 | int i; | ||
775 | |||
776 | for (i = 0; predef_vid_timings[i].timings.bt.width; i++) { | ||
777 | if (!v4l_match_dv_timings(timings, &predef_vid_timings[i].timings, | ||
778 | DIGITAL_INPUT ? 250000 : 1000000)) | ||
779 | continue; | ||
780 | io_write(sd, 0x00, predef_vid_timings[i].vid_std); /* video std */ | ||
781 | io_write(sd, 0x01, (predef_vid_timings[i].v_freq << 4) + | ||
782 | prim_mode); /* v_freq and prim mode */ | ||
783 | return 0; | ||
784 | } | ||
785 | |||
786 | return -1; | ||
787 | } | ||
788 | |||
789 | static int configure_predefined_video_timings(struct v4l2_subdev *sd, | ||
790 | struct v4l2_dv_timings *timings) | ||
686 | { | 791 | { |
792 | struct adv7604_state *state = to_state(sd); | ||
793 | int err; | ||
794 | |||
795 | v4l2_dbg(1, debug, sd, "%s", __func__); | ||
796 | |||
797 | /* reset to default values */ | ||
798 | io_write(sd, 0x16, 0x43); | ||
799 | io_write(sd, 0x17, 0x5a); | ||
800 | /* disable embedded syncs for auto graphics mode */ | ||
801 | cp_write_and_or(sd, 0x81, 0xef, 0x00); | ||
802 | cp_write(sd, 0x8f, 0x00); | ||
803 | cp_write(sd, 0x90, 0x00); | ||
804 | cp_write(sd, 0xa2, 0x00); | ||
805 | cp_write(sd, 0xa3, 0x00); | ||
806 | cp_write(sd, 0xa4, 0x00); | ||
807 | cp_write(sd, 0xa5, 0x00); | ||
808 | cp_write(sd, 0xa6, 0x00); | ||
809 | cp_write(sd, 0xa7, 0x00); | ||
810 | cp_write(sd, 0xab, 0x00); | ||
811 | cp_write(sd, 0xac, 0x00); | ||
812 | |||
813 | switch (state->mode) { | ||
814 | case ADV7604_MODE_COMP: | ||
815 | case ADV7604_MODE_GR: | ||
816 | err = find_and_set_predefined_video_timings(sd, | ||
817 | 0x01, adv7604_prim_mode_comp, timings); | ||
818 | if (err) | ||
819 | err = find_and_set_predefined_video_timings(sd, | ||
820 | 0x02, adv7604_prim_mode_gr, timings); | ||
821 | break; | ||
822 | case ADV7604_MODE_HDMI: | ||
823 | err = find_and_set_predefined_video_timings(sd, | ||
824 | 0x05, adv7604_prim_mode_hdmi_comp, timings); | ||
825 | if (err) | ||
826 | err = find_and_set_predefined_video_timings(sd, | ||
827 | 0x06, adv7604_prim_mode_hdmi_gr, timings); | ||
828 | break; | ||
829 | default: | ||
830 | v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n", | ||
831 | __func__, state->mode); | ||
832 | err = -1; | ||
833 | break; | ||
834 | } | ||
835 | |||
836 | |||
837 | return err; | ||
838 | } | ||
839 | |||
840 | static void configure_custom_video_timings(struct v4l2_subdev *sd, | ||
841 | const struct v4l2_bt_timings *bt) | ||
842 | { | ||
843 | struct adv7604_state *state = to_state(sd); | ||
687 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 844 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
688 | u32 width = htotal(timings); | 845 | u32 width = htotal(bt); |
689 | u32 height = vtotal(timings); | 846 | u32 height = vtotal(bt); |
690 | u16 ch1_fr_ll = (((u32)timings->pixelclock / 100) > 0) ? | 847 | u16 cp_start_sav = bt->hsync + bt->hbackporch - 4; |
691 | ((width * (ADV7604_fsc / 100)) / ((u32)timings->pixelclock / 100)) : 0; | 848 | u16 cp_start_eav = width - bt->hfrontporch; |
849 | u16 cp_start_vbi = height - bt->vfrontporch; | ||
850 | u16 cp_end_vbi = bt->vsync + bt->vbackporch; | ||
851 | u16 ch1_fr_ll = (((u32)bt->pixelclock / 100) > 0) ? | ||
852 | ((width * (ADV7604_fsc / 100)) / ((u32)bt->pixelclock / 100)) : 0; | ||
853 | const u8 pll[2] = { | ||
854 | 0xc0 | ((width >> 8) & 0x1f), | ||
855 | width & 0xff | ||
856 | }; | ||
692 | 857 | ||
693 | v4l2_dbg(2, debug, sd, "%s\n", __func__); | 858 | v4l2_dbg(2, debug, sd, "%s\n", __func__); |
694 | 859 | ||
695 | cp_write(sd, 0x8f, (ch1_fr_ll >> 8) & 0x7); /* CH1_FR_LL */ | 860 | switch (state->mode) { |
696 | cp_write(sd, 0x90, ch1_fr_ll & 0xff); /* CH1_FR_LL */ | 861 | case ADV7604_MODE_COMP: |
697 | cp_write(sd, 0xab, (height >> 4) & 0xff); /* CP_LCOUNT_MAX */ | 862 | case ADV7604_MODE_GR: |
698 | cp_write(sd, 0xac, (height & 0x0f) << 4); /* CP_LCOUNT_MAX */ | 863 | /* auto graphics */ |
699 | /* TODO support interlaced */ | 864 | io_write(sd, 0x00, 0x07); /* video std */ |
700 | cp_write(sd, 0x91, 0x10); /* INTERLACED */ | 865 | io_write(sd, 0x01, 0x02); /* prim mode */ |
701 | 866 | /* enable embedded syncs for auto graphics mode */ | |
702 | /* Should only be set in auto-graphics mode [REF_02 p. 91-92] */ | 867 | cp_write_and_or(sd, 0x81, 0xef, 0x10); |
703 | if ((io_read(sd, 0x00) == 0x07) && (io_read(sd, 0x01) == 0x02)) { | ||
704 | u16 cp_start_sav, cp_start_eav, cp_start_vbi, cp_end_vbi; | ||
705 | const u8 pll[2] = { | ||
706 | (0xc0 | ((width >> 8) & 0x1f)), | ||
707 | (width & 0xff) | ||
708 | }; | ||
709 | 868 | ||
869 | /* Should only be set in auto-graphics mode [REF_02, p. 91-92] */ | ||
710 | /* setup PLL_DIV_MAN_EN and PLL_DIV_RATIO */ | 870 | /* setup PLL_DIV_MAN_EN and PLL_DIV_RATIO */ |
711 | /* IO-map reg. 0x16 and 0x17 should be written in sequence */ | 871 | /* IO-map reg. 0x16 and 0x17 should be written in sequence */ |
712 | if (adv_smbus_write_i2c_block_data(client, 0x16, 2, pll)) { | 872 | if (adv_smbus_write_i2c_block_data(client, 0x16, 2, pll)) { |
713 | v4l2_err(sd, "writing to reg 0x16 and 0x17 failed\n"); | 873 | v4l2_err(sd, "writing to reg 0x16 and 0x17 failed\n"); |
714 | return; | 874 | break; |
715 | } | 875 | } |
716 | 876 | ||
717 | /* active video - horizontal timing */ | 877 | /* active video - horizontal timing */ |
718 | cp_start_sav = timings->hsync + timings->hbackporch - 4; | ||
719 | cp_start_eav = width - timings->hfrontporch; | ||
720 | cp_write(sd, 0xa2, (cp_start_sav >> 4) & 0xff); | 878 | cp_write(sd, 0xa2, (cp_start_sav >> 4) & 0xff); |
721 | cp_write(sd, 0xa3, ((cp_start_sav & 0x0f) << 4) | ((cp_start_eav >> 8) & 0x0f)); | 879 | cp_write(sd, 0xa3, ((cp_start_sav & 0x0f) << 4) | |
880 | ((cp_start_eav >> 8) & 0x0f)); | ||
722 | cp_write(sd, 0xa4, cp_start_eav & 0xff); | 881 | cp_write(sd, 0xa4, cp_start_eav & 0xff); |
723 | 882 | ||
724 | /* active video - vertical timing */ | 883 | /* active video - vertical timing */ |
725 | cp_start_vbi = height - timings->vfrontporch; | ||
726 | cp_end_vbi = timings->vsync + timings->vbackporch; | ||
727 | cp_write(sd, 0xa5, (cp_start_vbi >> 4) & 0xff); | 884 | cp_write(sd, 0xa5, (cp_start_vbi >> 4) & 0xff); |
728 | cp_write(sd, 0xa6, ((cp_start_vbi & 0xf) << 4) | ((cp_end_vbi >> 8) & 0xf)); | 885 | cp_write(sd, 0xa6, ((cp_start_vbi & 0xf) << 4) | |
886 | ((cp_end_vbi >> 8) & 0xf)); | ||
729 | cp_write(sd, 0xa7, cp_end_vbi & 0xff); | 887 | cp_write(sd, 0xa7, cp_end_vbi & 0xff); |
730 | } else { | 888 | break; |
731 | /* reset to default values */ | 889 | case ADV7604_MODE_HDMI: |
732 | io_write(sd, 0x16, 0x43); | 890 | /* set default prim_mode/vid_std for HDMI |
733 | io_write(sd, 0x17, 0x5a); | 891 | accoring to [REF_03, c. 4.2] */ |
734 | cp_write(sd, 0xa2, 0x00); | 892 | io_write(sd, 0x00, 0x02); /* video std */ |
735 | cp_write(sd, 0xa3, 0x00); | 893 | io_write(sd, 0x01, 0x06); /* prim mode */ |
736 | cp_write(sd, 0xa4, 0x00); | 894 | break; |
737 | cp_write(sd, 0xa5, 0x00); | 895 | default: |
738 | cp_write(sd, 0xa6, 0x00); | 896 | v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n", |
739 | cp_write(sd, 0xa7, 0x00); | 897 | __func__, state->mode); |
898 | break; | ||
740 | } | 899 | } |
741 | } | ||
742 | 900 | ||
901 | cp_write(sd, 0x8f, (ch1_fr_ll >> 8) & 0x7); | ||
902 | cp_write(sd, 0x90, ch1_fr_ll & 0xff); | ||
903 | cp_write(sd, 0xab, (height >> 4) & 0xff); | ||
904 | cp_write(sd, 0xac, (height & 0x0f) << 4); | ||
905 | } | ||
743 | 906 | ||
744 | static void set_rgb_quantization_range(struct v4l2_subdev *sd) | 907 | static void set_rgb_quantization_range(struct v4l2_subdev *sd) |
745 | { | 908 | { |
@@ -748,12 +911,7 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd) | |||
748 | switch (state->rgb_quantization_range) { | 911 | switch (state->rgb_quantization_range) { |
749 | case V4L2_DV_RGB_RANGE_AUTO: | 912 | case V4L2_DV_RGB_RANGE_AUTO: |
750 | /* automatic */ | 913 | /* automatic */ |
751 | if ((hdmi_read(sd, 0x05) & 0x80) || | 914 | if (DIGITAL_INPUT && !(hdmi_read(sd, 0x05) & 0x80)) { |
752 | (state->prim_mode == ADV7604_PRIM_MODE_COMP) || | ||
753 | (state->prim_mode == ADV7604_PRIM_MODE_RGB)) { | ||
754 | /* receiving HDMI or analog signal */ | ||
755 | io_write_and_or(sd, 0x02, 0x0f, 0xf0); | ||
756 | } else { | ||
757 | /* receiving DVI-D signal */ | 915 | /* receiving DVI-D signal */ |
758 | 916 | ||
759 | /* ADV7604 selects RGB limited range regardless of | 917 | /* ADV7604 selects RGB limited range regardless of |
@@ -766,6 +924,9 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd) | |||
766 | /* RGB full range (0-255) */ | 924 | /* RGB full range (0-255) */ |
767 | io_write_and_or(sd, 0x02, 0x0f, 0x10); | 925 | io_write_and_or(sd, 0x02, 0x0f, 0x10); |
768 | } | 926 | } |
927 | } else { | ||
928 | /* receiving HDMI or analog signal, set automode */ | ||
929 | io_write_and_or(sd, 0x02, 0x0f, 0xf0); | ||
769 | } | 930 | } |
770 | break; | 931 | break; |
771 | case V4L2_DV_RGB_RANGE_LIMITED: | 932 | case V4L2_DV_RGB_RANGE_LIMITED: |
@@ -977,8 +1138,10 @@ static int stdi2dv_timings(struct v4l2_subdev *sd, | |||
977 | state->aspect_ratio, timings)) | 1138 | state->aspect_ratio, timings)) |
978 | return 0; | 1139 | return 0; |
979 | 1140 | ||
980 | v4l2_dbg(2, debug, sd, "%s: No format candidate found for lcf=%d, bl = %d\n", | 1141 | v4l2_dbg(2, debug, sd, |
981 | __func__, stdi->lcf, stdi->bl); | 1142 | "%s: No format candidate found for lcvs = %d, lcf=%d, bl = %d, %chsync, %cvsync\n", |
1143 | __func__, stdi->lcvs, stdi->lcf, stdi->bl, | ||
1144 | stdi->hs_pol, stdi->vs_pol); | ||
982 | return -1; | 1145 | return -1; |
983 | } | 1146 | } |
984 | 1147 | ||
@@ -1133,7 +1296,7 @@ static int adv7604_query_dv_timings(struct v4l2_subdev *sd, | |||
1133 | adv7604_fill_optional_dv_timings_fields(sd, timings); | 1296 | adv7604_fill_optional_dv_timings_fields(sd, timings); |
1134 | } else { | 1297 | } else { |
1135 | /* find format | 1298 | /* find format |
1136 | * Since LCVS values are inaccurate (REF_03, page 275-276), | 1299 | * Since LCVS values are inaccurate [REF_03, p. 275-276], |
1137 | * stdi2dv_timings() is called with lcvs +-1 if the first attempt fails. | 1300 | * stdi2dv_timings() is called with lcvs +-1 if the first attempt fails. |
1138 | */ | 1301 | */ |
1139 | if (!stdi2dv_timings(sd, &stdi, timings)) | 1302 | if (!stdi2dv_timings(sd, &stdi, timings)) |
@@ -1145,9 +1308,31 @@ static int adv7604_query_dv_timings(struct v4l2_subdev *sd, | |||
1145 | stdi.lcvs -= 2; | 1308 | stdi.lcvs -= 2; |
1146 | v4l2_dbg(1, debug, sd, "%s: lcvs - 1 = %d\n", __func__, stdi.lcvs); | 1309 | v4l2_dbg(1, debug, sd, "%s: lcvs - 1 = %d\n", __func__, stdi.lcvs); |
1147 | if (stdi2dv_timings(sd, &stdi, timings)) { | 1310 | if (stdi2dv_timings(sd, &stdi, timings)) { |
1311 | /* | ||
1312 | * The STDI block may measure wrong values, especially | ||
1313 | * for lcvs and lcf. If the driver can not find any | ||
1314 | * valid timing, the STDI block is restarted to measure | ||
1315 | * the video timings again. The function will return an | ||
1316 | * error, but the restart of STDI will generate a new | ||
1317 | * STDI interrupt and the format detection process will | ||
1318 | * restart. | ||
1319 | */ | ||
1320 | if (state->restart_stdi_once) { | ||
1321 | v4l2_dbg(1, debug, sd, "%s: restart STDI\n", __func__); | ||
1322 | /* TODO restart STDI for Sync Channel 2 */ | ||
1323 | /* enter one-shot mode */ | ||
1324 | cp_write_and_or(sd, 0x86, 0xf9, 0x00); | ||
1325 | /* trigger STDI restart */ | ||
1326 | cp_write_and_or(sd, 0x86, 0xf9, 0x04); | ||
1327 | /* reset to continuous mode */ | ||
1328 | cp_write_and_or(sd, 0x86, 0xf9, 0x02); | ||
1329 | state->restart_stdi_once = false; | ||
1330 | return -ENOLINK; | ||
1331 | } | ||
1148 | v4l2_dbg(1, debug, sd, "%s: format not supported\n", __func__); | 1332 | v4l2_dbg(1, debug, sd, "%s: format not supported\n", __func__); |
1149 | return -ERANGE; | 1333 | return -ERANGE; |
1150 | } | 1334 | } |
1335 | state->restart_stdi_once = true; | ||
1151 | } | 1336 | } |
1152 | found: | 1337 | found: |
1153 | 1338 | ||
@@ -1176,6 +1361,7 @@ static int adv7604_s_dv_timings(struct v4l2_subdev *sd, | |||
1176 | { | 1361 | { |
1177 | struct adv7604_state *state = to_state(sd); | 1362 | struct adv7604_state *state = to_state(sd); |
1178 | struct v4l2_bt_timings *bt; | 1363 | struct v4l2_bt_timings *bt; |
1364 | int err; | ||
1179 | 1365 | ||
1180 | if (!timings) | 1366 | if (!timings) |
1181 | return -EINVAL; | 1367 | return -EINVAL; |
@@ -1188,12 +1374,20 @@ static int adv7604_s_dv_timings(struct v4l2_subdev *sd, | |||
1188 | __func__, (u32)bt->pixelclock); | 1374 | __func__, (u32)bt->pixelclock); |
1189 | return -ERANGE; | 1375 | return -ERANGE; |
1190 | } | 1376 | } |
1377 | |||
1191 | adv7604_fill_optional_dv_timings_fields(sd, timings); | 1378 | adv7604_fill_optional_dv_timings_fields(sd, timings); |
1192 | 1379 | ||
1193 | state->timings = *timings; | 1380 | state->timings = *timings; |
1194 | 1381 | ||
1195 | /* freerun */ | 1382 | cp_write(sd, 0x91, bt->interlaced ? 0x50 : 0x10); |
1196 | configure_free_run(sd, bt); | 1383 | |
1384 | /* Use prim_mode and vid_std when available */ | ||
1385 | err = configure_predefined_video_timings(sd, timings); | ||
1386 | if (err) { | ||
1387 | /* custom settings when the video format | ||
1388 | does not have prim_mode/vid_std */ | ||
1389 | configure_custom_video_timings(sd, bt); | ||
1390 | } | ||
1197 | 1391 | ||
1198 | set_rgb_quantization_range(sd); | 1392 | set_rgb_quantization_range(sd); |
1199 | 1393 | ||
@@ -1213,24 +1407,25 @@ static int adv7604_g_dv_timings(struct v4l2_subdev *sd, | |||
1213 | return 0; | 1407 | return 0; |
1214 | } | 1408 | } |
1215 | 1409 | ||
1216 | static void enable_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mode) | 1410 | static void enable_input(struct v4l2_subdev *sd) |
1217 | { | 1411 | { |
1218 | switch (prim_mode) { | 1412 | struct adv7604_state *state = to_state(sd); |
1219 | case ADV7604_PRIM_MODE_COMP: | 1413 | |
1220 | case ADV7604_PRIM_MODE_RGB: | 1414 | switch (state->mode) { |
1415 | case ADV7604_MODE_COMP: | ||
1416 | case ADV7604_MODE_GR: | ||
1221 | /* enable */ | 1417 | /* enable */ |
1222 | io_write(sd, 0x15, 0xb0); /* Disable Tristate of Pins (no audio) */ | 1418 | io_write(sd, 0x15, 0xb0); /* Disable Tristate of Pins (no audio) */ |
1223 | break; | 1419 | break; |
1224 | case ADV7604_PRIM_MODE_HDMI_COMP: | 1420 | case ADV7604_MODE_HDMI: |
1225 | case ADV7604_PRIM_MODE_HDMI_GR: | ||
1226 | /* enable */ | 1421 | /* enable */ |
1227 | hdmi_write(sd, 0x1a, 0x0a); /* Unmute audio */ | 1422 | hdmi_write(sd, 0x1a, 0x0a); /* Unmute audio */ |
1228 | hdmi_write(sd, 0x01, 0x00); /* Enable HDMI clock terminators */ | 1423 | hdmi_write(sd, 0x01, 0x00); /* Enable HDMI clock terminators */ |
1229 | io_write(sd, 0x15, 0xa0); /* Disable Tristate of Pins */ | 1424 | io_write(sd, 0x15, 0xa0); /* Disable Tristate of Pins */ |
1230 | break; | 1425 | break; |
1231 | default: | 1426 | default: |
1232 | v4l2_err(sd, "%s: reserved primary mode 0x%0x\n", | 1427 | v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n", |
1233 | __func__, prim_mode); | 1428 | __func__, state->mode); |
1234 | break; | 1429 | break; |
1235 | } | 1430 | } |
1236 | } | 1431 | } |
@@ -1243,17 +1438,13 @@ static void disable_input(struct v4l2_subdev *sd) | |||
1243 | hdmi_write(sd, 0x01, 0x78); /* Disable HDMI clock terminators */ | 1438 | hdmi_write(sd, 0x01, 0x78); /* Disable HDMI clock terminators */ |
1244 | } | 1439 | } |
1245 | 1440 | ||
1246 | static void select_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mode) | 1441 | static void select_input(struct v4l2_subdev *sd) |
1247 | { | 1442 | { |
1248 | switch (prim_mode) { | 1443 | struct adv7604_state *state = to_state(sd); |
1249 | case ADV7604_PRIM_MODE_COMP: | ||
1250 | case ADV7604_PRIM_MODE_RGB: | ||
1251 | /* set mode and select free run resolution */ | ||
1252 | io_write(sd, 0x00, 0x07); /* video std */ | ||
1253 | io_write(sd, 0x01, 0x02); /* prim mode */ | ||
1254 | /* enable embedded syncs for auto graphics mode */ | ||
1255 | cp_write_and_or(sd, 0x81, 0xef, 0x10); | ||
1256 | 1444 | ||
1445 | switch (state->mode) { | ||
1446 | case ADV7604_MODE_COMP: | ||
1447 | case ADV7604_MODE_GR: | ||
1257 | /* reset ADI recommended settings for HDMI: */ | 1448 | /* reset ADI recommended settings for HDMI: */ |
1258 | /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ | 1449 | /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ |
1259 | hdmi_write(sd, 0x0d, 0x04); /* HDMI filter optimization */ | 1450 | hdmi_write(sd, 0x0d, 0x04); /* HDMI filter optimization */ |
@@ -1281,16 +1472,7 @@ static void select_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mod | |||
1281 | cp_write(sd, 0x40, 0x5c); /* CP core pre-gain control. Graphics mode */ | 1472 | cp_write(sd, 0x40, 0x5c); /* CP core pre-gain control. Graphics mode */ |
1282 | break; | 1473 | break; |
1283 | 1474 | ||
1284 | case ADV7604_PRIM_MODE_HDMI_COMP: | 1475 | case ADV7604_MODE_HDMI: |
1285 | case ADV7604_PRIM_MODE_HDMI_GR: | ||
1286 | /* set mode and select free run resolution */ | ||
1287 | /* video std */ | ||
1288 | io_write(sd, 0x00, | ||
1289 | (prim_mode == ADV7604_PRIM_MODE_HDMI_GR) ? 0x02 : 0x1e); | ||
1290 | io_write(sd, 0x01, prim_mode); /* prim mode */ | ||
1291 | /* disable embedded syncs for auto graphics mode */ | ||
1292 | cp_write_and_or(sd, 0x81, 0xef, 0x00); | ||
1293 | |||
1294 | /* set ADI recommended settings for HDMI: */ | 1476 | /* set ADI recommended settings for HDMI: */ |
1295 | /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ | 1477 | /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ |
1296 | hdmi_write(sd, 0x0d, 0x84); /* HDMI filter optimization */ | 1478 | hdmi_write(sd, 0x0d, 0x84); /* HDMI filter optimization */ |
@@ -1319,7 +1501,8 @@ static void select_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mod | |||
1319 | 1501 | ||
1320 | break; | 1502 | break; |
1321 | default: | 1503 | default: |
1322 | v4l2_err(sd, "%s: reserved primary mode 0x%0x\n", __func__, prim_mode); | 1504 | v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n", |
1505 | __func__, state->mode); | ||
1323 | break; | 1506 | break; |
1324 | } | 1507 | } |
1325 | } | 1508 | } |
@@ -1331,26 +1514,13 @@ static int adv7604_s_routing(struct v4l2_subdev *sd, | |||
1331 | 1514 | ||
1332 | v4l2_dbg(2, debug, sd, "%s: input %d", __func__, input); | 1515 | v4l2_dbg(2, debug, sd, "%s: input %d", __func__, input); |
1333 | 1516 | ||
1334 | switch (input) { | 1517 | state->mode = input; |
1335 | case 0: | ||
1336 | /* TODO select HDMI_COMP or HDMI_GR */ | ||
1337 | state->prim_mode = ADV7604_PRIM_MODE_HDMI_COMP; | ||
1338 | break; | ||
1339 | case 1: | ||
1340 | state->prim_mode = ADV7604_PRIM_MODE_RGB; | ||
1341 | break; | ||
1342 | case 2: | ||
1343 | state->prim_mode = ADV7604_PRIM_MODE_COMP; | ||
1344 | break; | ||
1345 | default: | ||
1346 | return -EINVAL; | ||
1347 | } | ||
1348 | 1518 | ||
1349 | disable_input(sd); | 1519 | disable_input(sd); |
1350 | 1520 | ||
1351 | select_input(sd, state->prim_mode); | 1521 | select_input(sd); |
1352 | 1522 | ||
1353 | enable_input(sd, state->prim_mode); | 1523 | enable_input(sd); |
1354 | 1524 | ||
1355 | return 0; | 1525 | return 0; |
1356 | } | 1526 | } |
@@ -1559,8 +1729,9 @@ static int adv7604_log_status(struct v4l2_subdev *sd) | |||
1559 | v4l2_info(sd, "CP locked: %s\n", no_lock_cp(sd) ? "false" : "true"); | 1729 | v4l2_info(sd, "CP locked: %s\n", no_lock_cp(sd) ? "false" : "true"); |
1560 | v4l2_info(sd, "CP free run: %s\n", | 1730 | v4l2_info(sd, "CP free run: %s\n", |
1561 | (!!(cp_read(sd, 0xff) & 0x10) ? "on" : "off")); | 1731 | (!!(cp_read(sd, 0xff) & 0x10) ? "on" : "off")); |
1562 | v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x\n", | 1732 | v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x, v_freq = 0x%x\n", |
1563 | io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f); | 1733 | io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f, |
1734 | (io_read(sd, 0x01) & 0x70) >> 4); | ||
1564 | 1735 | ||
1565 | v4l2_info(sd, "-----Video Timings-----\n"); | 1736 | v4l2_info(sd, "-----Video Timings-----\n"); |
1566 | if (read_stdi(sd, &stdi)) | 1737 | if (read_stdi(sd, &stdi)) |
@@ -1722,9 +1893,9 @@ static int adv7604_core_init(struct v4l2_subdev *sd) | |||
1722 | cp_write(sd, 0xba, (pdata->hdmi_free_run_mode << 1) | 0x01); /* HDMI free run */ | 1893 | cp_write(sd, 0xba, (pdata->hdmi_free_run_mode << 1) | 0x01); /* HDMI free run */ |
1723 | cp_write(sd, 0xf3, 0xdc); /* Low threshold to enter/exit free run mode */ | 1894 | cp_write(sd, 0xf3, 0xdc); /* Low threshold to enter/exit free run mode */ |
1724 | cp_write(sd, 0xf9, 0x23); /* STDI ch. 1 - LCVS change threshold - | 1895 | cp_write(sd, 0xf9, 0x23); /* STDI ch. 1 - LCVS change threshold - |
1725 | ADI recommended setting [REF_01 c. 2.3.3] */ | 1896 | ADI recommended setting [REF_01, c. 2.3.3] */ |
1726 | cp_write(sd, 0x45, 0x23); /* STDI ch. 2 - LCVS change threshold - | 1897 | cp_write(sd, 0x45, 0x23); /* STDI ch. 2 - LCVS change threshold - |
1727 | ADI recommended setting [REF_01 c. 2.3.3] */ | 1898 | ADI recommended setting [REF_01, c. 2.3.3] */ |
1728 | cp_write(sd, 0xc9, 0x2d); /* use prim_mode and vid_std as free run resolution | 1899 | cp_write(sd, 0xc9, 0x2d); /* use prim_mode and vid_std as free run resolution |
1729 | for digital formats */ | 1900 | for digital formats */ |
1730 | 1901 | ||
@@ -1734,11 +1905,6 @@ static int adv7604_core_init(struct v4l2_subdev *sd) | |||
1734 | afe_write(sd, 0x02, pdata->ain_sel); /* Select analog input muxing mode */ | 1905 | afe_write(sd, 0x02, pdata->ain_sel); /* Select analog input muxing mode */ |
1735 | io_write_and_or(sd, 0x30, ~(1 << 4), pdata->output_bus_lsb_to_msb << 4); | 1906 | io_write_and_or(sd, 0x30, ~(1 << 4), pdata->output_bus_lsb_to_msb << 4); |
1736 | 1907 | ||
1737 | state->prim_mode = pdata->prim_mode; | ||
1738 | select_input(sd, pdata->prim_mode); | ||
1739 | |||
1740 | enable_input(sd, pdata->prim_mode); | ||
1741 | |||
1742 | /* interrupts */ | 1908 | /* interrupts */ |
1743 | io_write(sd, 0x40, 0xc2); /* Configure INT1 */ | 1909 | io_write(sd, 0x40, 0xc2); /* Configure INT1 */ |
1744 | io_write(sd, 0x41, 0xd7); /* STDI irq for any change, disable INT2 */ | 1910 | io_write(sd, 0x41, 0xd7); /* STDI irq for any change, disable INT2 */ |
@@ -1893,6 +2059,7 @@ static int adv7604_probe(struct i2c_client *client, | |||
1893 | v4l2_err(sd, "failed to create all i2c clients\n"); | 2059 | v4l2_err(sd, "failed to create all i2c clients\n"); |
1894 | goto err_i2c; | 2060 | goto err_i2c; |
1895 | } | 2061 | } |
2062 | state->restart_stdi_once = true; | ||
1896 | 2063 | ||
1897 | /* work queues */ | 2064 | /* work queues */ |
1898 | state->work_queues = create_singlethread_workqueue(client->name); | 2065 | state->work_queues = create_singlethread_workqueue(client->name); |
diff --git a/drivers/media/i2c/soc_camera/mt9v022.c b/drivers/media/i2c/soc_camera/mt9v022.c index 84d204f82cb2..d40a8858be01 100644 --- a/drivers/media/i2c/soc_camera/mt9v022.c +++ b/drivers/media/i2c/soc_camera/mt9v022.c | |||
@@ -296,9 +296,14 @@ static int mt9v022_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) | |||
296 | if (ret & 1) /* Autoexposure */ | 296 | if (ret & 1) /* Autoexposure */ |
297 | ret = reg_write(client, mt9v022->reg->max_total_shutter_width, | 297 | ret = reg_write(client, mt9v022->reg->max_total_shutter_width, |
298 | rect.height + mt9v022->y_skip_top + 43); | 298 | rect.height + mt9v022->y_skip_top + 43); |
299 | else | 299 | /* |
300 | ret = reg_write(client, MT9V022_TOTAL_SHUTTER_WIDTH, | 300 | * If autoexposure is off, there is no need to set |
301 | rect.height + mt9v022->y_skip_top + 43); | 301 | * MT9V022_TOTAL_SHUTTER_WIDTH here. Autoexposure can be off |
302 | * only if the user has set exposure manually, using the | ||
303 | * V4L2_CID_EXPOSURE_AUTO with the value V4L2_EXPOSURE_MANUAL. | ||
304 | * In this case the register MT9V022_TOTAL_SHUTTER_WIDTH | ||
305 | * already contains the correct value. | ||
306 | */ | ||
302 | } | 307 | } |
303 | /* Setup frame format: defaults apart from width and height */ | 308 | /* Setup frame format: defaults apart from width and height */ |
304 | if (!ret) | 309 | if (!ret) |
diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c index 60181ab96063..aa9df9d71a7b 100644 --- a/drivers/media/platform/omap3isp/ispccdc.c +++ b/drivers/media/platform/omap3isp/ispccdc.c | |||
@@ -1706,7 +1706,7 @@ static long ccdc_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) | |||
1706 | } | 1706 | } |
1707 | 1707 | ||
1708 | static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, | 1708 | static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, |
1709 | const struct v4l2_event_subscription *sub) | 1709 | struct v4l2_event_subscription *sub) |
1710 | { | 1710 | { |
1711 | if (sub->type != V4L2_EVENT_FRAME_SYNC) | 1711 | if (sub->type != V4L2_EVENT_FRAME_SYNC) |
1712 | return -EINVAL; | 1712 | return -EINVAL; |
@@ -1719,7 +1719,7 @@ static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, | |||
1719 | } | 1719 | } |
1720 | 1720 | ||
1721 | static int ccdc_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, | 1721 | static int ccdc_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, |
1722 | const struct v4l2_event_subscription *sub) | 1722 | struct v4l2_event_subscription *sub) |
1723 | { | 1723 | { |
1724 | return v4l2_event_unsubscribe(fh, sub); | 1724 | return v4l2_event_unsubscribe(fh, sub); |
1725 | } | 1725 | } |
diff --git a/drivers/media/platform/omap3isp/ispstat.c b/drivers/media/platform/omap3isp/ispstat.c index d7ac76b5c2ae..b8640be692f1 100644 --- a/drivers/media/platform/omap3isp/ispstat.c +++ b/drivers/media/platform/omap3isp/ispstat.c | |||
@@ -1025,7 +1025,7 @@ void omap3isp_stat_dma_isr(struct ispstat *stat) | |||
1025 | 1025 | ||
1026 | int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, | 1026 | int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, |
1027 | struct v4l2_fh *fh, | 1027 | struct v4l2_fh *fh, |
1028 | const struct v4l2_event_subscription *sub) | 1028 | struct v4l2_event_subscription *sub) |
1029 | { | 1029 | { |
1030 | struct ispstat *stat = v4l2_get_subdevdata(subdev); | 1030 | struct ispstat *stat = v4l2_get_subdevdata(subdev); |
1031 | 1031 | ||
@@ -1037,7 +1037,7 @@ int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, | |||
1037 | 1037 | ||
1038 | int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev, | 1038 | int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev, |
1039 | struct v4l2_fh *fh, | 1039 | struct v4l2_fh *fh, |
1040 | const struct v4l2_event_subscription *sub) | 1040 | struct v4l2_event_subscription *sub) |
1041 | { | 1041 | { |
1042 | return v4l2_event_unsubscribe(fh, sub); | 1042 | return v4l2_event_unsubscribe(fh, sub); |
1043 | } | 1043 | } |
diff --git a/drivers/media/platform/omap3isp/ispstat.h b/drivers/media/platform/omap3isp/ispstat.h index a6fe653eb237..9b7c8654dc8a 100644 --- a/drivers/media/platform/omap3isp/ispstat.h +++ b/drivers/media/platform/omap3isp/ispstat.h | |||
@@ -147,10 +147,10 @@ int omap3isp_stat_init(struct ispstat *stat, const char *name, | |||
147 | void omap3isp_stat_cleanup(struct ispstat *stat); | 147 | void omap3isp_stat_cleanup(struct ispstat *stat); |
148 | int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, | 148 | int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, |
149 | struct v4l2_fh *fh, | 149 | struct v4l2_fh *fh, |
150 | const struct v4l2_event_subscription *sub); | 150 | struct v4l2_event_subscription *sub); |
151 | int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev, | 151 | int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev, |
152 | struct v4l2_fh *fh, | 152 | struct v4l2_fh *fh, |
153 | const struct v4l2_event_subscription *sub); | 153 | struct v4l2_event_subscription *sub); |
154 | int omap3isp_stat_s_stream(struct v4l2_subdev *subdev, int enable); | 154 | int omap3isp_stat_s_stream(struct v4l2_subdev *subdev, int enable); |
155 | 155 | ||
156 | int omap3isp_stat_busy(struct ispstat *stat); | 156 | int omap3isp_stat_busy(struct ispstat *stat); |
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c index a0b737fecf13..75cd309035f9 100644 --- a/drivers/media/platform/omap3isp/ispvideo.c +++ b/drivers/media/platform/omap3isp/ispvideo.c | |||
@@ -792,7 +792,7 @@ isp_video_get_crop(struct file *file, void *fh, struct v4l2_crop *crop) | |||
792 | } | 792 | } |
793 | 793 | ||
794 | static int | 794 | static int |
795 | isp_video_set_crop(struct file *file, void *fh, struct v4l2_crop *crop) | 795 | isp_video_set_crop(struct file *file, void *fh, const struct v4l2_crop *crop) |
796 | { | 796 | { |
797 | struct isp_video *video = video_drvdata(file); | 797 | struct isp_video *video = video_drvdata(file); |
798 | struct v4l2_subdev *subdev; | 798 | struct v4l2_subdev *subdev; |
diff --git a/drivers/media/platform/s5p-fimc/Kconfig b/drivers/media/platform/s5p-fimc/Kconfig index 8f090a8f270e..c16b20d86ed2 100644 --- a/drivers/media/platform/s5p-fimc/Kconfig +++ b/drivers/media/platform/s5p-fimc/Kconfig | |||
@@ -24,6 +24,7 @@ config VIDEO_S5P_FIMC | |||
24 | config VIDEO_S5P_MIPI_CSIS | 24 | config VIDEO_S5P_MIPI_CSIS |
25 | tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver" | 25 | tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver" |
26 | depends on REGULATOR | 26 | depends on REGULATOR |
27 | select S5P_SETUP_MIPIPHY | ||
27 | help | 28 | help |
28 | This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2 | 29 | This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2 |
29 | receiver (MIPI-CSIS) devices. | 30 | receiver (MIPI-CSIS) devices. |
diff --git a/drivers/media/platform/s5p-fimc/fimc-capture.c b/drivers/media/platform/s5p-fimc/fimc-capture.c index e5fd159e3ee0..0d0aca500876 100644 --- a/drivers/media/platform/s5p-fimc/fimc-capture.c +++ b/drivers/media/platform/s5p-fimc/fimc-capture.c | |||
@@ -1745,7 +1745,9 @@ static int fimc_register_capture_device(struct fimc_dev *fimc, | |||
1745 | q->mem_ops = &vb2_dma_contig_memops; | 1745 | q->mem_ops = &vb2_dma_contig_memops; |
1746 | q->buf_struct_size = sizeof(struct fimc_vid_buffer); | 1746 | q->buf_struct_size = sizeof(struct fimc_vid_buffer); |
1747 | 1747 | ||
1748 | vb2_queue_init(q); | 1748 | ret = vb2_queue_init(q); |
1749 | if (ret) | ||
1750 | goto err_ent; | ||
1749 | 1751 | ||
1750 | vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK; | 1752 | vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK; |
1751 | ret = media_entity_init(&vfd->entity, 1, &vid_cap->vd_pad, 0); | 1753 | ret = media_entity_init(&vfd->entity, 1, &vid_cap->vd_pad, 0); |
diff --git a/drivers/media/platform/s5p-fimc/fimc-lite.c b/drivers/media/platform/s5p-fimc/fimc-lite.c index 70bcf39de879..9db246bed841 100644 --- a/drivers/media/platform/s5p-fimc/fimc-lite.c +++ b/drivers/media/platform/s5p-fimc/fimc-lite.c | |||
@@ -1253,7 +1253,9 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd) | |||
1253 | q->buf_struct_size = sizeof(struct flite_buffer); | 1253 | q->buf_struct_size = sizeof(struct flite_buffer); |
1254 | q->drv_priv = fimc; | 1254 | q->drv_priv = fimc; |
1255 | 1255 | ||
1256 | vb2_queue_init(q); | 1256 | ret = vb2_queue_init(q); |
1257 | if (ret < 0) | ||
1258 | return ret; | ||
1257 | 1259 | ||
1258 | fimc->vd_pad.flags = MEDIA_PAD_FL_SINK; | 1260 | fimc->vd_pad.flags = MEDIA_PAD_FL_SINK; |
1259 | ret = media_entity_init(&vfd->entity, 1, &fimc->vd_pad, 0); | 1261 | ret = media_entity_init(&vfd->entity, 1, &fimc->vd_pad, 0); |
diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c index 715b258a0cac..9bd5dd416220 100644 --- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c +++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c | |||
@@ -343,53 +343,50 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd) | |||
343 | static int fimc_register_callback(struct device *dev, void *p) | 343 | static int fimc_register_callback(struct device *dev, void *p) |
344 | { | 344 | { |
345 | struct fimc_dev *fimc = dev_get_drvdata(dev); | 345 | struct fimc_dev *fimc = dev_get_drvdata(dev); |
346 | struct v4l2_subdev *sd = &fimc->vid_cap.subdev; | 346 | struct v4l2_subdev *sd; |
347 | struct fimc_md *fmd = p; | 347 | struct fimc_md *fmd = p; |
348 | int ret = 0; | 348 | int ret; |
349 | |||
350 | if (!fimc || !fimc->pdev) | ||
351 | return 0; | ||
352 | 349 | ||
353 | if (fimc->pdev->id < 0 || fimc->pdev->id >= FIMC_MAX_DEVS) | 350 | if (fimc == NULL || fimc->id >= FIMC_MAX_DEVS) |
354 | return 0; | 351 | return 0; |
355 | 352 | ||
356 | fimc->pipeline_ops = &fimc_pipeline_ops; | 353 | sd = &fimc->vid_cap.subdev; |
357 | fmd->fimc[fimc->pdev->id] = fimc; | ||
358 | sd->grp_id = FIMC_GROUP_ID; | 354 | sd->grp_id = FIMC_GROUP_ID; |
359 | 355 | ||
360 | ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); | 356 | ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); |
361 | if (ret) { | 357 | if (ret) { |
362 | v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC.%d (%d)\n", | 358 | v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC.%d (%d)\n", |
363 | fimc->id, ret); | 359 | fimc->id, ret); |
360 | return ret; | ||
364 | } | 361 | } |
365 | 362 | ||
366 | return ret; | 363 | fimc->pipeline_ops = &fimc_pipeline_ops; |
364 | fmd->fimc[fimc->id] = fimc; | ||
365 | return 0; | ||
367 | } | 366 | } |
368 | 367 | ||
369 | static int fimc_lite_register_callback(struct device *dev, void *p) | 368 | static int fimc_lite_register_callback(struct device *dev, void *p) |
370 | { | 369 | { |
371 | struct fimc_lite *fimc = dev_get_drvdata(dev); | 370 | struct fimc_lite *fimc = dev_get_drvdata(dev); |
372 | struct v4l2_subdev *sd = &fimc->subdev; | ||
373 | struct fimc_md *fmd = p; | 371 | struct fimc_md *fmd = p; |
374 | int ret; | 372 | int ret; |
375 | 373 | ||
376 | if (fimc == NULL) | 374 | if (fimc == NULL || fimc->index >= FIMC_LITE_MAX_DEVS) |
377 | return 0; | 375 | return 0; |
378 | 376 | ||
379 | if (fimc->index >= FIMC_LITE_MAX_DEVS) | 377 | fimc->subdev.grp_id = FLITE_GROUP_ID; |
380 | return 0; | ||
381 | 378 | ||
382 | fimc->pipeline_ops = &fimc_pipeline_ops; | 379 | ret = v4l2_device_register_subdev(&fmd->v4l2_dev, &fimc->subdev); |
383 | fmd->fimc_lite[fimc->index] = fimc; | ||
384 | sd->grp_id = FLITE_GROUP_ID; | ||
385 | |||
386 | ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); | ||
387 | if (ret) { | 380 | if (ret) { |
388 | v4l2_err(&fmd->v4l2_dev, | 381 | v4l2_err(&fmd->v4l2_dev, |
389 | "Failed to register FIMC-LITE.%d (%d)\n", | 382 | "Failed to register FIMC-LITE.%d (%d)\n", |
390 | fimc->index, ret); | 383 | fimc->index, ret); |
384 | return ret; | ||
391 | } | 385 | } |
392 | return ret; | 386 | |
387 | fimc->pipeline_ops = &fimc_pipeline_ops; | ||
388 | fmd->fimc_lite[fimc->index] = fimc; | ||
389 | return 0; | ||
393 | } | 390 | } |
394 | 391 | ||
395 | static int csis_register_callback(struct device *dev, void *p) | 392 | static int csis_register_callback(struct device *dev, void *p) |
@@ -407,10 +404,12 @@ static int csis_register_callback(struct device *dev, void *p) | |||
407 | v4l2_info(sd, "csis%d sd: %s\n", pdev->id, sd->name); | 404 | v4l2_info(sd, "csis%d sd: %s\n", pdev->id, sd->name); |
408 | 405 | ||
409 | id = pdev->id < 0 ? 0 : pdev->id; | 406 | id = pdev->id < 0 ? 0 : pdev->id; |
410 | fmd->csis[id].sd = sd; | ||
411 | sd->grp_id = CSIS_GROUP_ID; | 407 | sd->grp_id = CSIS_GROUP_ID; |
408 | |||
412 | ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); | 409 | ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); |
413 | if (ret) | 410 | if (!ret) |
411 | fmd->csis[id].sd = sd; | ||
412 | else | ||
414 | v4l2_err(&fmd->v4l2_dev, | 413 | v4l2_err(&fmd->v4l2_dev, |
415 | "Failed to register CSIS subdevice: %d\n", ret); | 414 | "Failed to register CSIS subdevice: %d\n", ret); |
416 | return ret; | 415 | return ret; |
diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c index 85fd312f0a82..a1c87f0ceaab 100644 --- a/drivers/media/platform/sh_vou.c +++ b/drivers/media/platform/sh_vou.c | |||
@@ -935,9 +935,10 @@ static int sh_vou_g_crop(struct file *file, void *fh, struct v4l2_crop *a) | |||
935 | /* Assume a dull encoder, do all the work ourselves. */ | 935 | /* Assume a dull encoder, do all the work ourselves. */ |
936 | static int sh_vou_s_crop(struct file *file, void *fh, const struct v4l2_crop *a) | 936 | static int sh_vou_s_crop(struct file *file, void *fh, const struct v4l2_crop *a) |
937 | { | 937 | { |
938 | struct v4l2_crop a_writable = *a; | ||
938 | struct video_device *vdev = video_devdata(file); | 939 | struct video_device *vdev = video_devdata(file); |
939 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | 940 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); |
940 | struct v4l2_rect *rect = &a->c; | 941 | struct v4l2_rect *rect = &a_writable.c; |
941 | struct v4l2_crop sd_crop = {.type = V4L2_BUF_TYPE_VIDEO_OUTPUT}; | 942 | struct v4l2_crop sd_crop = {.type = V4L2_BUF_TYPE_VIDEO_OUTPUT}; |
942 | struct v4l2_pix_format *pix = &vou_dev->pix; | 943 | struct v4l2_pix_format *pix = &vou_dev->pix; |
943 | struct sh_vou_geometry geo; | 944 | struct sh_vou_geometry geo; |
diff --git a/drivers/media/platform/soc_camera/mx1_camera.c b/drivers/media/platform/soc_camera/mx1_camera.c index bbe70991d30b..032b8c9097f9 100644 --- a/drivers/media/platform/soc_camera/mx1_camera.c +++ b/drivers/media/platform/soc_camera/mx1_camera.c | |||
@@ -470,14 +470,6 @@ static void mx1_camera_remove_device(struct soc_camera_device *icd) | |||
470 | pcdev->icd = NULL; | 470 | pcdev->icd = NULL; |
471 | } | 471 | } |
472 | 472 | ||
473 | static int mx1_camera_set_crop(struct soc_camera_device *icd, | ||
474 | struct v4l2_crop *a) | ||
475 | { | ||
476 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | ||
477 | |||
478 | return v4l2_subdev_call(sd, video, s_crop, a); | ||
479 | } | ||
480 | |||
481 | static int mx1_camera_set_bus_param(struct soc_camera_device *icd) | 473 | static int mx1_camera_set_bus_param(struct soc_camera_device *icd) |
482 | { | 474 | { |
483 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 475 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
@@ -689,7 +681,6 @@ static struct soc_camera_host_ops mx1_soc_camera_host_ops = { | |||
689 | .add = mx1_camera_add_device, | 681 | .add = mx1_camera_add_device, |
690 | .remove = mx1_camera_remove_device, | 682 | .remove = mx1_camera_remove_device, |
691 | .set_bus_param = mx1_camera_set_bus_param, | 683 | .set_bus_param = mx1_camera_set_bus_param, |
692 | .set_crop = mx1_camera_set_crop, | ||
693 | .set_fmt = mx1_camera_set_fmt, | 684 | .set_fmt = mx1_camera_set_fmt, |
694 | .try_fmt = mx1_camera_try_fmt, | 685 | .try_fmt = mx1_camera_try_fmt, |
695 | .init_videobuf = mx1_camera_init_videobuf, | 686 | .init_videobuf = mx1_camera_init_videobuf, |
diff --git a/drivers/media/platform/soc_camera/mx2_camera.c b/drivers/media/platform/soc_camera/mx2_camera.c index 9fd9d1c5b218..9a55f4c4c7f4 100644 --- a/drivers/media/platform/soc_camera/mx2_camera.c +++ b/drivers/media/platform/soc_camera/mx2_camera.c | |||
@@ -864,8 +864,10 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count) | |||
864 | 864 | ||
865 | bytesperline = soc_mbus_bytes_per_line(icd->user_width, | 865 | bytesperline = soc_mbus_bytes_per_line(icd->user_width, |
866 | icd->current_fmt->host_fmt); | 866 | icd->current_fmt->host_fmt); |
867 | if (bytesperline < 0) | 867 | if (bytesperline < 0) { |
868 | spin_unlock_irqrestore(&pcdev->lock, flags); | ||
868 | return bytesperline; | 869 | return bytesperline; |
870 | } | ||
869 | 871 | ||
870 | /* | 872 | /* |
871 | * I didn't manage to properly enable/disable the prp | 873 | * I didn't manage to properly enable/disable the prp |
@@ -878,8 +880,10 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count) | |||
878 | pcdev->discard_buffer = dma_alloc_coherent(ici->v4l2_dev.dev, | 880 | pcdev->discard_buffer = dma_alloc_coherent(ici->v4l2_dev.dev, |
879 | pcdev->discard_size, &pcdev->discard_buffer_dma, | 881 | pcdev->discard_size, &pcdev->discard_buffer_dma, |
880 | GFP_KERNEL); | 882 | GFP_KERNEL); |
881 | if (!pcdev->discard_buffer) | 883 | if (!pcdev->discard_buffer) { |
884 | spin_unlock_irqrestore(&pcdev->lock, flags); | ||
882 | return -ENOMEM; | 885 | return -ENOMEM; |
886 | } | ||
883 | 887 | ||
884 | pcdev->buf_discard[0].discard = true; | 888 | pcdev->buf_discard[0].discard = true; |
885 | list_add_tail(&pcdev->buf_discard[0].queue, | 889 | list_add_tail(&pcdev->buf_discard[0].queue, |
@@ -1099,9 +1103,10 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd) | |||
1099 | } | 1103 | } |
1100 | 1104 | ||
1101 | static int mx2_camera_set_crop(struct soc_camera_device *icd, | 1105 | static int mx2_camera_set_crop(struct soc_camera_device *icd, |
1102 | struct v4l2_crop *a) | 1106 | const struct v4l2_crop *a) |
1103 | { | 1107 | { |
1104 | struct v4l2_rect *rect = &a->c; | 1108 | struct v4l2_crop a_writable = *a; |
1109 | struct v4l2_rect *rect = &a_writable.c; | ||
1105 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1110 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1106 | struct v4l2_mbus_framefmt mf; | 1111 | struct v4l2_mbus_framefmt mf; |
1107 | int ret; | 1112 | int ret; |
diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c index 3557ac97e430..261f6e9e1b17 100644 --- a/drivers/media/platform/soc_camera/mx3_camera.c +++ b/drivers/media/platform/soc_camera/mx3_camera.c | |||
@@ -799,9 +799,10 @@ static inline void stride_align(__u32 *width) | |||
799 | * default g_crop and cropcap from soc_camera.c | 799 | * default g_crop and cropcap from soc_camera.c |
800 | */ | 800 | */ |
801 | static int mx3_camera_set_crop(struct soc_camera_device *icd, | 801 | static int mx3_camera_set_crop(struct soc_camera_device *icd, |
802 | struct v4l2_crop *a) | 802 | const struct v4l2_crop *a) |
803 | { | 803 | { |
804 | struct v4l2_rect *rect = &a->c; | 804 | struct v4l2_crop a_writable = *a; |
805 | struct v4l2_rect *rect = &a_writable.c; | ||
805 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 806 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
806 | struct mx3_camera_dev *mx3_cam = ici->priv; | 807 | struct mx3_camera_dev *mx3_cam = ici->priv; |
807 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 808 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
diff --git a/drivers/media/platform/soc_camera/omap1_camera.c b/drivers/media/platform/soc_camera/omap1_camera.c index fa08c7695ccb..13636a585106 100644 --- a/drivers/media/platform/soc_camera/omap1_camera.c +++ b/drivers/media/platform/soc_camera/omap1_camera.c | |||
@@ -1215,9 +1215,9 @@ static int set_mbus_format(struct omap1_cam_dev *pcdev, struct device *dev, | |||
1215 | } | 1215 | } |
1216 | 1216 | ||
1217 | static int omap1_cam_set_crop(struct soc_camera_device *icd, | 1217 | static int omap1_cam_set_crop(struct soc_camera_device *icd, |
1218 | struct v4l2_crop *crop) | 1218 | const struct v4l2_crop *crop) |
1219 | { | 1219 | { |
1220 | struct v4l2_rect *rect = &crop->c; | 1220 | const struct v4l2_rect *rect = &crop->c; |
1221 | const struct soc_camera_format_xlate *xlate = icd->current_fmt; | 1221 | const struct soc_camera_format_xlate *xlate = icd->current_fmt; |
1222 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1222 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1223 | struct device *dev = icd->parent; | 1223 | struct device *dev = icd->parent; |
diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index 1e3776d08dac..3434ffe79c6e 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c | |||
@@ -1337,9 +1337,9 @@ static int pxa_camera_check_frame(u32 width, u32 height) | |||
1337 | } | 1337 | } |
1338 | 1338 | ||
1339 | static int pxa_camera_set_crop(struct soc_camera_device *icd, | 1339 | static int pxa_camera_set_crop(struct soc_camera_device *icd, |
1340 | struct v4l2_crop *a) | 1340 | const struct v4l2_crop *a) |
1341 | { | 1341 | { |
1342 | struct v4l2_rect *rect = &a->c; | 1342 | const struct v4l2_rect *rect = &a->c; |
1343 | struct device *dev = icd->parent; | 1343 | struct device *dev = icd->parent; |
1344 | struct soc_camera_host *ici = to_soc_camera_host(dev); | 1344 | struct soc_camera_host *ici = to_soc_camera_host(dev); |
1345 | struct pxa_camera_dev *pcdev = ici->priv; | 1345 | struct pxa_camera_dev *pcdev = ici->priv; |
diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c index 0a24253dcda2..2d8861c0e8f2 100644 --- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c +++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c | |||
@@ -1182,13 +1182,13 @@ static void sh_mobile_ceu_put_formats(struct soc_camera_device *icd) | |||
1182 | } | 1182 | } |
1183 | 1183 | ||
1184 | /* Check if any dimension of r1 is smaller than respective one of r2 */ | 1184 | /* Check if any dimension of r1 is smaller than respective one of r2 */ |
1185 | static bool is_smaller(struct v4l2_rect *r1, struct v4l2_rect *r2) | 1185 | static bool is_smaller(const struct v4l2_rect *r1, const struct v4l2_rect *r2) |
1186 | { | 1186 | { |
1187 | return r1->width < r2->width || r1->height < r2->height; | 1187 | return r1->width < r2->width || r1->height < r2->height; |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | /* Check if r1 fails to cover r2 */ | 1190 | /* Check if r1 fails to cover r2 */ |
1191 | static bool is_inside(struct v4l2_rect *r1, struct v4l2_rect *r2) | 1191 | static bool is_inside(const struct v4l2_rect *r1, const struct v4l2_rect *r2) |
1192 | { | 1192 | { |
1193 | return r1->left > r2->left || r1->top > r2->top || | 1193 | return r1->left > r2->left || r1->top > r2->top || |
1194 | r1->left + r1->width < r2->left + r2->width || | 1194 | r1->left + r1->width < r2->left + r2->width || |
@@ -1263,7 +1263,7 @@ static void update_subrect(struct sh_mobile_ceu_cam *cam) | |||
1263 | * 3. if (2) failed, try to request the maximum image | 1263 | * 3. if (2) failed, try to request the maximum image |
1264 | */ | 1264 | */ |
1265 | static int client_s_crop(struct soc_camera_device *icd, struct v4l2_crop *crop, | 1265 | static int client_s_crop(struct soc_camera_device *icd, struct v4l2_crop *crop, |
1266 | const struct v4l2_crop *cam_crop) | 1266 | struct v4l2_crop *cam_crop) |
1267 | { | 1267 | { |
1268 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1268 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1269 | struct v4l2_rect *rect = &crop->c, *cam_rect = &cam_crop->c; | 1269 | struct v4l2_rect *rect = &crop->c, *cam_rect = &cam_crop->c; |
@@ -1519,7 +1519,8 @@ static int client_scale(struct soc_camera_device *icd, | |||
1519 | static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, | 1519 | static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, |
1520 | const struct v4l2_crop *a) | 1520 | const struct v4l2_crop *a) |
1521 | { | 1521 | { |
1522 | struct v4l2_rect *rect = &a->c; | 1522 | struct v4l2_crop a_writable = *a; |
1523 | const struct v4l2_rect *rect = &a_writable.c; | ||
1523 | struct device *dev = icd->parent; | 1524 | struct device *dev = icd->parent; |
1524 | struct soc_camera_host *ici = to_soc_camera_host(dev); | 1525 | struct soc_camera_host *ici = to_soc_camera_host(dev); |
1525 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 1526 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
@@ -1545,7 +1546,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, | |||
1545 | * 1. - 2. Apply iterative camera S_CROP for new input window, read back | 1546 | * 1. - 2. Apply iterative camera S_CROP for new input window, read back |
1546 | * actual camera rectangle. | 1547 | * actual camera rectangle. |
1547 | */ | 1548 | */ |
1548 | ret = client_s_crop(icd, a, &cam_crop); | 1549 | ret = client_s_crop(icd, &a_writable, &cam_crop); |
1549 | if (ret < 0) | 1550 | if (ret < 0) |
1550 | return ret; | 1551 | return ret; |
1551 | 1552 | ||
@@ -1946,7 +1947,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, | |||
1946 | } | 1947 | } |
1947 | 1948 | ||
1948 | static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd, | 1949 | static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd, |
1949 | struct v4l2_crop *a) | 1950 | const struct v4l2_crop *a) |
1950 | { | 1951 | { |
1951 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1952 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1952 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 1953 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c index 7927f5771e17..671b4fa232b4 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | |||
@@ -283,14 +283,13 @@ static inline int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, | |||
283 | 283 | ||
284 | /* activate the pid on the device pid filter */ | 284 | /* activate the pid on the device pid filter */ |
285 | if (adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER && | 285 | if (adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER && |
286 | adap->pid_filtering && | 286 | adap->pid_filtering && adap->props->pid_filter) { |
287 | adap->props->pid_filter) | ||
288 | ret = adap->props->pid_filter(adap, dvbdmxfeed->index, | 287 | ret = adap->props->pid_filter(adap, dvbdmxfeed->index, |
289 | dvbdmxfeed->pid, (count == 1) ? 1 : 0); | 288 | dvbdmxfeed->pid, (count == 1) ? 1 : 0); |
290 | if (ret < 0) | 289 | if (ret < 0) |
291 | dev_err(&d->udev->dev, "%s: pid_filter() " \ | 290 | dev_err(&d->udev->dev, "%s: pid_filter() failed=%d\n", |
292 | "failed=%d\n", KBUILD_MODNAME, | 291 | KBUILD_MODNAME, ret); |
293 | ret); | 292 | } |
294 | 293 | ||
295 | /* start feeding if it is first pid */ | 294 | /* start feeding if it is first pid */ |
296 | if (adap->feed_count == 1 && count == 1) { | 295 | if (adap->feed_count == 1 && count == 1) { |
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c index 0431beed0ef4..5716662b4834 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c | |||
@@ -32,9 +32,7 @@ int dvb_usbv2_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf, | |||
32 | return -EINVAL; | 32 | return -EINVAL; |
33 | } | 33 | } |
34 | 34 | ||
35 | ret = mutex_lock_interruptible(&d->usb_mutex); | 35 | mutex_lock(&d->usb_mutex); |
36 | if (ret < 0) | ||
37 | return ret; | ||
38 | 36 | ||
39 | dev_dbg(&d->udev->dev, "%s: >>> %*ph\n", __func__, wlen, wbuf); | 37 | dev_dbg(&d->udev->dev, "%s: >>> %*ph\n", __func__, wlen, wbuf); |
40 | 38 | ||
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index ec9108e2a297..223f0e70fbf6 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c | |||
@@ -1346,6 +1346,10 @@ static const struct usb_device_id rtl28xxu_id_table[] = { | |||
1346 | &rtl2832u_props, "DigitalNow Quad DVB-T Receiver", NULL) }, | 1346 | &rtl2832u_props, "DigitalNow Quad DVB-T Receiver", NULL) }, |
1347 | { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d3, | 1347 | { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d3, |
1348 | &rtl2832u_props, "TerraTec Cinergy T Stick RC (Rev. 3)", NULL) }, | 1348 | &rtl2832u_props, "TerraTec Cinergy T Stick RC (Rev. 3)", NULL) }, |
1349 | { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1102, | ||
1350 | &rtl2832u_props, "Dexatek DK mini DVB-T Dongle", NULL) }, | ||
1351 | { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d7, | ||
1352 | &rtl2832u_props, "TerraTec Cinergy T Stick+", NULL) }, | ||
1349 | { } | 1353 | { } |
1350 | }; | 1354 | }; |
1351 | MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table); | 1355 | MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table); |