aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/cx18/cx18-av-core.c60
-rw-r--r--drivers/media/video/cx18/cx18-av-core.h5
-rw-r--r--drivers/media/video/cx18/cx18-driver.c4
-rw-r--r--drivers/media/video/cx231xx/cx231xx-cards.c2
-rw-r--r--drivers/media/video/cx23885/cx23885-cards.c2
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c8
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c2
-rw-r--r--include/media/v4l2-subdev.h17
9 files changed, 50 insertions, 52 deletions
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c
index f4dd9d78eb3d..0c58e55fdbee 100644
--- a/drivers/media/video/cx18/cx18-av-core.c
+++ b/drivers/media/video/cx18/cx18-av-core.c
@@ -203,43 +203,42 @@ static int cx18_av_reset(struct v4l2_subdev *sd, u32 val)
203 203
204static int cx18_av_init(struct v4l2_subdev *sd, u32 val) 204static int cx18_av_init(struct v4l2_subdev *sd, u32 val)
205{ 205{
206 struct cx18_av_state *state = to_cx18_av_state(sd);
207 struct cx18 *cx = v4l2_get_subdevdata(sd); 206 struct cx18 *cx = v4l2_get_subdevdata(sd);
208 207
209 switch (val) { 208 /*
210 case CX18_AV_INIT_PLLS: 209 * The crystal freq used in calculations in this driver will be
211 /* 210 * 28.636360 MHz.
212 * The crystal freq used in calculations in this driver will be 211 * Aim to run the PLLs' VCOs near 400 MHz to minimze errors.
213 * 28.636360 MHz. 212 */
214 * Aim to run the PLLs' VCOs near 400 MHz to minimze errors.
215 */
216 213
217 /* 214 /*
218 * VDCLK Integer = 0x0f, Post Divider = 0x04 215 * VDCLK Integer = 0x0f, Post Divider = 0x04
219 * AIMCLK Integer = 0x0e, Post Divider = 0x16 216 * AIMCLK Integer = 0x0e, Post Divider = 0x16
220 */ 217 */
221 cx18_av_write4(cx, CXADEC_PLL_CTRL1, 0x160e040f); 218 cx18_av_write4(cx, CXADEC_PLL_CTRL1, 0x160e040f);
222 219
223 /* VDCLK Fraction = 0x2be2fe */ 220 /* VDCLK Fraction = 0x2be2fe */
224 /* xtal * 0xf.15f17f0/4 = 108 MHz: 432 MHz before post divide */ 221 /* xtal * 0xf.15f17f0/4 = 108 MHz: 432 MHz before post divide */
225 cx18_av_write4(cx, CXADEC_VID_PLL_FRAC, 0x002be2fe); 222 cx18_av_write4(cx, CXADEC_VID_PLL_FRAC, 0x002be2fe);
226 223
227 /* AIMCLK Fraction = 0x05227ad */ 224 /* AIMCLK Fraction = 0x05227ad */
228 /* xtal * 0xe.2913d68/0x16 = 48000 * 384: 406 MHz pre post-div*/ 225 /* xtal * 0xe.2913d68/0x16 = 48000 * 384: 406 MHz pre post-div*/
229 cx18_av_write4(cx, CXADEC_AUX_PLL_FRAC, 0x005227ad); 226 cx18_av_write4(cx, CXADEC_AUX_PLL_FRAC, 0x005227ad);
230 227
231 /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x16 */ 228 /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x16 */
232 cx18_av_write(cx, CXADEC_I2S_MCLK, 0x56); 229 cx18_av_write(cx, CXADEC_I2S_MCLK, 0x56);
233 break; 230 return 0;
231}
234 232
235 case CX18_AV_INIT_NORMAL: 233static int cx18_av_load_fw(struct v4l2_subdev *sd)
236 default: 234{
237 if (!state->is_initialized) { 235 struct cx18_av_state *state = to_cx18_av_state(sd);
238 /* initialize on first use */ 236 struct cx18 *cx = v4l2_get_subdevdata(sd);
239 state->is_initialized = 1; 237
240 cx18_av_initialize(cx); 238 if (!state->is_initialized) {
241 } 239 /* initialize on first use */
242 break; 240 state->is_initialized = 1;
241 cx18_av_initialize(cx);
243 } 242 }
244 return 0; 243 return 0;
245} 244}
@@ -1185,6 +1184,7 @@ static const struct v4l2_subdev_core_ops cx18_av_general_ops = {
1185 .g_chip_ident = cx18_av_g_chip_ident, 1184 .g_chip_ident = cx18_av_g_chip_ident,
1186 .log_status = cx18_av_log_status, 1185 .log_status = cx18_av_log_status,
1187 .init = cx18_av_init, 1186 .init = cx18_av_init,
1187 .load_fw = cx18_av_load_fw,
1188 .reset = cx18_av_reset, 1188 .reset = cx18_av_reset,
1189 .queryctrl = cx18_av_queryctrl, 1189 .queryctrl = cx18_av_queryctrl,
1190 .g_ctrl = cx18_av_g_ctrl, 1190 .g_ctrl = cx18_av_g_ctrl,
diff --git a/drivers/media/video/cx18/cx18-av-core.h b/drivers/media/video/cx18/cx18-av-core.h
index c458120e8c90..9b84a0c58e0e 100644
--- a/drivers/media/video/cx18/cx18-av-core.h
+++ b/drivers/media/video/cx18/cx18-av-core.h
@@ -328,11 +328,6 @@ static inline struct cx18_av_state *to_cx18_av_state(struct v4l2_subdev *sd)
328 return container_of(sd, struct cx18_av_state, sd); 328 return container_of(sd, struct cx18_av_state, sd);
329} 329}
330 330
331enum cx18_av_subdev_init_arg {
332 CX18_AV_INIT_NORMAL = 0,
333 CX18_AV_INIT_PLLS = 1,
334};
335
336/* ----------------------------------------------------------------------- */ 331/* ----------------------------------------------------------------------- */
337/* cx18_av-core.c */ 332/* cx18_av-core.c */
338int cx18_av_write(struct cx18 *cx, u16 addr, u8 value); 333int cx18_av_write(struct cx18 *cx, u16 addr, u8 value);
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index 210c68aaae00..49b1c3d7b1a8 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -810,7 +810,7 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev,
810 CX18_ERR("Could not register A/V decoder subdevice\n"); 810 CX18_ERR("Could not register A/V decoder subdevice\n");
811 goto free_map; 811 goto free_map;
812 } 812 }
813 cx18_call_hw(cx, CX18_HW_418_AV, core, init, (u32) CX18_AV_INIT_PLLS); 813 cx18_call_hw(cx, CX18_HW_418_AV, core, init, 0);
814 814
815 /* Initialize GPIO Reset Controller to do chip resets during i2c init */ 815 /* Initialize GPIO Reset Controller to do chip resets during i2c init */
816 if (cx->card->hw_all & CX18_HW_GPIO_RESET_CTRL) { 816 if (cx->card->hw_all & CX18_HW_GPIO_RESET_CTRL) {
@@ -1028,7 +1028,7 @@ int cx18_init_on_first_open(struct cx18 *cx)
1028 cx18_vapi(cx, CX18_APU_STOP, 1, CX18_APU_ENCODING_METHOD_MPEG); 1028 cx18_vapi(cx, CX18_APU_STOP, 1, CX18_APU_ENCODING_METHOD_MPEG);
1029 1029
1030 /* Init the A/V decoder, if it hasn't been already */ 1030 /* Init the A/V decoder, if it hasn't been already */
1031 v4l2_subdev_call(cx->sd_av, core, init, (u32) CX18_AV_INIT_NORMAL); 1031 v4l2_subdev_call(cx->sd_av, core, load_fw);
1032 1032
1033 vf.tuner = 0; 1033 vf.tuner = 0;
1034 vf.type = V4L2_TUNER_ANALOG_TV; 1034 vf.type = V4L2_TUNER_ANALOG_TV;
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c
index 79833c25e705..b63719fddee4 100644
--- a/drivers/media/video/cx231xx/cx231xx-cards.c
+++ b/drivers/media/video/cx231xx/cx231xx-cards.c
@@ -316,7 +316,7 @@ void cx231xx_card_setup(struct cx231xx *dev)
316 "cx25840", "cx25840", 0x88 >> 1); 316 "cx25840", "cx25840", 0x88 >> 1);
317 if (dev->sd_cx25840 == NULL) 317 if (dev->sd_cx25840 == NULL)
318 cx231xx_info("cx25840 subdev registration failure\n"); 318 cx231xx_info("cx25840 subdev registration failure\n");
319 cx25840_call(dev, core, init, 0); 319 cx25840_call(dev, core, load_fw);
320 320
321 } 321 }
322 322
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c
index 5e4b7e790d94..fe8525517c4e 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -741,7 +741,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
741 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: 741 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
742 dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->i2c_bus[2].i2c_adap, 742 dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->i2c_bus[2].i2c_adap,
743 "cx25840", "cx25840", 0x88 >> 1); 743 "cx25840", "cx25840", 0x88 >> 1);
744 v4l2_subdev_call(dev->sd_cx25840, core, init, 0); 744 v4l2_subdev_call(dev->sd_cx25840, core, load_fw);
745 break; 745 break;
746 } 746 }
747 747
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index f8ed3c09b17c..51266812d338 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -1182,7 +1182,7 @@ static void log_audio_status(struct i2c_client *client)
1182 1182
1183/* ----------------------------------------------------------------------- */ 1183/* ----------------------------------------------------------------------- */
1184 1184
1185/* This init operation must be called to load the driver's firmware. 1185/* This load_fw operation must be called to load the driver's firmware.
1186 Without this the audio standard detection will fail and you will 1186 Without this the audio standard detection will fail and you will
1187 only get mono. 1187 only get mono.
1188 1188
@@ -1192,13 +1192,13 @@ static void log_audio_status(struct i2c_client *client)
1192 postponing it is that loading this firmware takes a long time (seconds) 1192 postponing it is that loading this firmware takes a long time (seconds)
1193 due to the slow i2c bus speed. So it will speed up the boot process if 1193 due to the slow i2c bus speed. So it will speed up the boot process if
1194 you can avoid loading the fw as long as the video device isn't used. */ 1194 you can avoid loading the fw as long as the video device isn't used. */
1195static int cx25840_init(struct v4l2_subdev *sd, u32 val) 1195static int cx25840_load_fw(struct v4l2_subdev *sd)
1196{ 1196{
1197 struct cx25840_state *state = to_state(sd); 1197 struct cx25840_state *state = to_state(sd);
1198 struct i2c_client *client = v4l2_get_subdevdata(sd); 1198 struct i2c_client *client = v4l2_get_subdevdata(sd);
1199 1199
1200 if (!state->is_initialized) { 1200 if (!state->is_initialized) {
1201 /* initialize on first use */ 1201 /* initialize and load firmware */
1202 state->is_initialized = 1; 1202 state->is_initialized = 1;
1203 if (state->is_cx25836) 1203 if (state->is_cx25836)
1204 cx25836_initialize(client); 1204 cx25836_initialize(client);
@@ -1473,7 +1473,7 @@ static const struct v4l2_subdev_core_ops cx25840_core_ops = {
1473 .s_ctrl = cx25840_s_ctrl, 1473 .s_ctrl = cx25840_s_ctrl,
1474 .queryctrl = cx25840_queryctrl, 1474 .queryctrl = cx25840_queryctrl,
1475 .reset = cx25840_reset, 1475 .reset = cx25840_reset,
1476 .init = cx25840_init, 1476 .load_fw = cx25840_load_fw,
1477#ifdef CONFIG_VIDEO_ADV_DEBUG 1477#ifdef CONFIG_VIDEO_ADV_DEBUG
1478 .g_register = cx25840_g_register, 1478 .g_register = cx25840_g_register,
1479 .s_register = cx25840_s_register, 1479 .s_register = cx25840_s_register,
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index eca8bf92a225..07d5ffea6e6f 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -1234,7 +1234,7 @@ int ivtv_init_on_first_open(struct ivtv *itv)
1234 if (itv->card->hw_all & IVTV_HW_CX25840) { 1234 if (itv->card->hw_all & IVTV_HW_CX25840) {
1235 struct v4l2_control ctrl; 1235 struct v4l2_control ctrl;
1236 1236
1237 v4l2_subdev_call(itv->sd_video, core, init, 0); 1237 v4l2_subdev_call(itv->sd_video, core, load_fw);
1238 /* CX25840_CID_ENABLE_PVR150_WORKAROUND */ 1238 /* CX25840_CID_ENABLE_PVR150_WORKAROUND */
1239 ctrl.id = V4L2_CID_PRIVATE_BASE; 1239 ctrl.id = V4L2_CID_PRIVATE_BASE;
1240 ctrl.value = itv->pvr150_workaround; 1240 ctrl.value = itv->pvr150_workaround;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index eff92113daf9..59a0259266fb 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -2185,7 +2185,7 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
2185 pvr2_hdw_load_modules(hdw); 2185 pvr2_hdw_load_modules(hdw);
2186 if (!pvr2_hdw_dev_ok(hdw)) return; 2186 if (!pvr2_hdw_dev_ok(hdw)) return;
2187 2187
2188 v4l2_device_call_all(&hdw->v4l2_dev, 0, core, init, 0); 2188 v4l2_device_call_all(&hdw->v4l2_dev, 0, core, load_fw);
2189 2189
2190 for (idx = 0; idx < CTRLDEF_COUNT; idx++) { 2190 for (idx = 0; idx < CTRLDEF_COUNT; idx++) {
2191 cptr = hdw->controls + idx; 2191 cptr = hdw->controls + idx;
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index c84ff88c913f..38b89cf7c995 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -89,7 +89,9 @@ struct v4l2_crystal_freq {
89 values. Do not use for new drivers and should be removed in existing 89 values. Do not use for new drivers and should be removed in existing
90 drivers. 90 drivers.
91 91
92 reset: generic reset command. The argument selects which subsystems to 92 load_fw: load firmware.
93
94 reset: generic reset command. The argument selects which subsystems to
93 reset. Passing 0 will always reset the whole chip. Do not use for new 95 reset. Passing 0 will always reset the whole chip. Do not use for new
94 drivers without discussing this first on the linux-media mailinglist. 96 drivers without discussing this first on the linux-media mailinglist.
95 There should be no reason normally to reset a device. 97 There should be no reason normally to reset a device.
@@ -101,6 +103,7 @@ struct v4l2_subdev_core_ops {
101 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 103 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
102 int (*log_status)(struct v4l2_subdev *sd); 104 int (*log_status)(struct v4l2_subdev *sd);
103 int (*init)(struct v4l2_subdev *sd, u32 val); 105 int (*init)(struct v4l2_subdev *sd, u32 val);
106 int (*load_fw)(struct v4l2_subdev *sd);
104 int (*reset)(struct v4l2_subdev *sd, u32 val); 107 int (*reset)(struct v4l2_subdev *sd, u32 val);
105 int (*s_gpio)(struct v4l2_subdev *sd, u32 val); 108 int (*s_gpio)(struct v4l2_subdev *sd, u32 val);
106 int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc); 109 int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
@@ -175,31 +178,31 @@ struct v4l2_subdev_audio_ops {
175 v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the 178 v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
176 type field is set to 0 on return. 179 type field is set to 0 on return.
177 180
178 s_vbi_data: used to generate VBI signals on a video signal. 181 s_vbi_data: used to generate VBI signals on a video signal.
179 v4l2_sliced_vbi_data is filled with the data packets that should be 182 v4l2_sliced_vbi_data is filled with the data packets that should be
180 output. Note that if you set the line field to 0, then that VBI signal 183 output. Note that if you set the line field to 0, then that VBI signal
181 is disabled. If no valid VBI data was found, then the type field is 184 is disabled. If no valid VBI data was found, then the type field is
182 set to 0 on return. 185 set to 0 on return.
183 186
184 g_vbi_data: used to obtain the sliced VBI packet from a readback register. 187 g_vbi_data: used to obtain the sliced VBI packet from a readback register.
185 Not all video decoders support this. If no data is available because 188 Not all video decoders support this. If no data is available because
186 the readback register contains invalid or erroneous data -EIO is 189 the readback register contains invalid or erroneous data -EIO is
187 returned. Note that you must fill in the 'id' member and the 'field' 190 returned. Note that you must fill in the 'id' member and the 'field'
188 member (to determine whether CC data from the first or second field 191 member (to determine whether CC data from the first or second field
189 should be obtained). 192 should be obtained).
190 193
191 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by 194 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
192 video input devices. 195 video input devices.
193 196
194 s_crystal_freq: sets the frequency of the crystal used to generate the 197 s_crystal_freq: sets the frequency of the crystal used to generate the
195 clocks. An extra flags field allows device specific configuration 198 clocks. An extra flags field allows device specific configuration
196 regarding clock frequency dividers, etc. If not used, then set flags 199 regarding clock frequency dividers, etc. If not used, then set flags
197 to 0. If the frequency is not supported, then -EINVAL is returned. 200 to 0. If the frequency is not supported, then -EINVAL is returned.
198 201
199 g_input_status: get input status. Same as the status field in the v4l2_input 202 g_input_status: get input status. Same as the status field in the v4l2_input
200 struct. 203 struct.
201 204
202 s_routing: see s_routing in audio_ops, except this version is for video 205 s_routing: see s_routing in audio_ops, except this version is for video
203 devices. 206 devices.
204 */ 207 */
205struct v4l2_subdev_video_ops { 208struct v4l2_subdev_video_ops {