diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2012-10-01 10:39:46 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-10-05 13:27:18 -0400 |
commit | 368640827c0be2582d836cd74ae2cff03e6bfc02 (patch) | |
tree | 1012c886f4ce621b6d9284ffac81f3b79c3a95f7 /drivers/media | |
parent | 182b967e1119d22889e334c8f1c1b75df41f9165 (diff) |
[media] dm644x: replace the obsolete preset API by the timings API
This patch replaces the preset API by the timings API, and
appropriate changes in board file.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/davinci/vpbe.c | 110 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpbe_display.c | 60 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpbe_venc.c | 25 |
3 files changed, 89 insertions, 106 deletions
diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c index c4a82a1a8a97..d03f452bd243 100644 --- a/drivers/media/platform/davinci/vpbe.c +++ b/drivers/media/platform/davinci/vpbe.c | |||
@@ -174,26 +174,6 @@ static int vpbe_get_current_mode_info(struct vpbe_device *vpbe_dev, | |||
174 | return 0; | 174 | return 0; |
175 | } | 175 | } |
176 | 176 | ||
177 | static int vpbe_get_dv_preset_info(struct vpbe_device *vpbe_dev, | ||
178 | unsigned int dv_preset) | ||
179 | { | ||
180 | struct vpbe_config *cfg = vpbe_dev->cfg; | ||
181 | struct vpbe_enc_mode_info var; | ||
182 | int curr_output = vpbe_dev->current_out_index; | ||
183 | int i; | ||
184 | |||
185 | for (i = 0; i < vpbe_dev->cfg->outputs[curr_output].num_modes; i++) { | ||
186 | var = cfg->outputs[curr_output].modes[i]; | ||
187 | if ((var.timings_type & VPBE_ENC_DV_PRESET) && | ||
188 | (var.timings.dv_preset == dv_preset)) { | ||
189 | vpbe_dev->current_timings = var; | ||
190 | return 0; | ||
191 | } | ||
192 | } | ||
193 | |||
194 | return -EINVAL; | ||
195 | } | ||
196 | |||
197 | /* Get std by std id */ | 177 | /* Get std by std id */ |
198 | static int vpbe_get_std_info(struct vpbe_device *vpbe_dev, | 178 | static int vpbe_get_std_info(struct vpbe_device *vpbe_dev, |
199 | v4l2_std_id std_id) | 179 | v4l2_std_id std_id) |
@@ -206,7 +186,7 @@ static int vpbe_get_std_info(struct vpbe_device *vpbe_dev, | |||
206 | for (i = 0; i < vpbe_dev->cfg->outputs[curr_output].num_modes; i++) { | 186 | for (i = 0; i < vpbe_dev->cfg->outputs[curr_output].num_modes; i++) { |
207 | var = cfg->outputs[curr_output].modes[i]; | 187 | var = cfg->outputs[curr_output].modes[i]; |
208 | if ((var.timings_type & VPBE_ENC_STD) && | 188 | if ((var.timings_type & VPBE_ENC_STD) && |
209 | (var.timings.std_id & std_id)) { | 189 | (var.std_id & std_id)) { |
210 | vpbe_dev->current_timings = var; | 190 | vpbe_dev->current_timings = var; |
211 | return 0; | 191 | return 0; |
212 | } | 192 | } |
@@ -344,38 +324,42 @@ static unsigned int vpbe_get_output(struct vpbe_device *vpbe_dev) | |||
344 | } | 324 | } |
345 | 325 | ||
346 | /** | 326 | /** |
347 | * vpbe_s_dv_preset - Set the given preset timings in the encoder | 327 | * vpbe_s_dv_timings - Set the given preset timings in the encoder |
348 | * | 328 | * |
349 | * Sets the preset if supported by the current encoder. Return the status. | 329 | * Sets the timings if supported by the current encoder. Return the status. |
350 | * 0 - success & -EINVAL on error | 330 | * 0 - success & -EINVAL on error |
351 | */ | 331 | */ |
352 | static int vpbe_s_dv_preset(struct vpbe_device *vpbe_dev, | 332 | static int vpbe_s_dv_timings(struct vpbe_device *vpbe_dev, |
353 | struct v4l2_dv_preset *dv_preset) | 333 | struct v4l2_dv_timings *dv_timings) |
354 | { | 334 | { |
355 | struct vpbe_config *cfg = vpbe_dev->cfg; | 335 | struct vpbe_config *cfg = vpbe_dev->cfg; |
356 | int out_index = vpbe_dev->current_out_index; | 336 | int out_index = vpbe_dev->current_out_index; |
337 | struct vpbe_output *output = &cfg->outputs[out_index]; | ||
357 | int sd_index = vpbe_dev->current_sd_index; | 338 | int sd_index = vpbe_dev->current_sd_index; |
358 | int ret; | 339 | int ret, i; |
359 | 340 | ||
360 | 341 | ||
361 | if (!(cfg->outputs[out_index].output.capabilities & | 342 | if (!(cfg->outputs[out_index].output.capabilities & |
362 | V4L2_OUT_CAP_PRESETS)) | 343 | V4L2_OUT_CAP_CUSTOM_TIMINGS)) |
363 | return -EINVAL; | 344 | return -EINVAL; |
364 | 345 | ||
365 | ret = vpbe_get_dv_preset_info(vpbe_dev, dv_preset->preset); | 346 | for (i = 0; i < output->num_modes; i++) { |
366 | 347 | if (output->modes[i].timings_type == VPBE_ENC_CUSTOM_TIMINGS && | |
367 | if (ret) | 348 | !memcmp(&output->modes[i].dv_timings, |
368 | return ret; | 349 | dv_timings, sizeof(*dv_timings))) |
369 | 350 | break; | |
351 | } | ||
352 | if (i >= output->num_modes) | ||
353 | return -EINVAL; | ||
354 | vpbe_dev->current_timings = output->modes[i]; | ||
370 | mutex_lock(&vpbe_dev->lock); | 355 | mutex_lock(&vpbe_dev->lock); |
371 | 356 | ||
372 | |||
373 | ret = v4l2_subdev_call(vpbe_dev->encoders[sd_index], video, | 357 | ret = v4l2_subdev_call(vpbe_dev->encoders[sd_index], video, |
374 | s_dv_preset, dv_preset); | 358 | s_dv_timings, dv_timings); |
375 | if (!ret && (vpbe_dev->amp != NULL)) { | 359 | if (!ret && (vpbe_dev->amp != NULL)) { |
376 | /* Call amplifier subdevice */ | 360 | /* Call amplifier subdevice */ |
377 | ret = v4l2_subdev_call(vpbe_dev->amp, video, | 361 | ret = v4l2_subdev_call(vpbe_dev->amp, video, |
378 | s_dv_preset, dv_preset); | 362 | s_dv_timings, dv_timings); |
379 | } | 363 | } |
380 | /* set the lcd controller output for the given mode */ | 364 | /* set the lcd controller output for the given mode */ |
381 | if (!ret) { | 365 | if (!ret) { |
@@ -392,17 +376,17 @@ static int vpbe_s_dv_preset(struct vpbe_device *vpbe_dev, | |||
392 | } | 376 | } |
393 | 377 | ||
394 | /** | 378 | /** |
395 | * vpbe_g_dv_preset - Get the preset in the current encoder | 379 | * vpbe_g_dv_timings - Get the timings in the current encoder |
396 | * | 380 | * |
397 | * Get the preset in the current encoder. Return the status. 0 - success | 381 | * Get the timings in the current encoder. Return the status. 0 - success |
398 | * -EINVAL on error | 382 | * -EINVAL on error |
399 | */ | 383 | */ |
400 | static int vpbe_g_dv_preset(struct vpbe_device *vpbe_dev, | 384 | static int vpbe_g_dv_timings(struct vpbe_device *vpbe_dev, |
401 | struct v4l2_dv_preset *dv_preset) | 385 | struct v4l2_dv_timings *dv_timings) |
402 | { | 386 | { |
403 | if (vpbe_dev->current_timings.timings_type & | 387 | if (vpbe_dev->current_timings.timings_type & |
404 | VPBE_ENC_DV_PRESET) { | 388 | VPBE_ENC_CUSTOM_TIMINGS) { |
405 | dv_preset->preset = vpbe_dev->current_timings.timings.dv_preset; | 389 | *dv_timings = vpbe_dev->current_timings.dv_timings; |
406 | return 0; | 390 | return 0; |
407 | } | 391 | } |
408 | 392 | ||
@@ -410,13 +394,13 @@ static int vpbe_g_dv_preset(struct vpbe_device *vpbe_dev, | |||
410 | } | 394 | } |
411 | 395 | ||
412 | /** | 396 | /** |
413 | * vpbe_enum_dv_presets - Enumerate the dv presets in the current encoder | 397 | * vpbe_enum_dv_timings - Enumerate the dv timings in the current encoder |
414 | * | 398 | * |
415 | * Get the preset in the current encoder. Return the status. 0 - success | 399 | * Get the timings in the current encoder. Return the status. 0 - success |
416 | * -EINVAL on error | 400 | * -EINVAL on error |
417 | */ | 401 | */ |
418 | static int vpbe_enum_dv_presets(struct vpbe_device *vpbe_dev, | 402 | static int vpbe_enum_dv_timings(struct vpbe_device *vpbe_dev, |
419 | struct v4l2_dv_enum_preset *preset_info) | 403 | struct v4l2_enum_dv_timings *timings) |
420 | { | 404 | { |
421 | struct vpbe_config *cfg = vpbe_dev->cfg; | 405 | struct vpbe_config *cfg = vpbe_dev->cfg; |
422 | int out_index = vpbe_dev->current_out_index; | 406 | int out_index = vpbe_dev->current_out_index; |
@@ -424,12 +408,12 @@ static int vpbe_enum_dv_presets(struct vpbe_device *vpbe_dev, | |||
424 | int j = 0; | 408 | int j = 0; |
425 | int i; | 409 | int i; |
426 | 410 | ||
427 | if (!(output->output.capabilities & V4L2_OUT_CAP_PRESETS)) | 411 | if (!(output->output.capabilities & V4L2_OUT_CAP_CUSTOM_TIMINGS)) |
428 | return -EINVAL; | 412 | return -EINVAL; |
429 | 413 | ||
430 | for (i = 0; i < output->num_modes; i++) { | 414 | for (i = 0; i < output->num_modes; i++) { |
431 | if (output->modes[i].timings_type == VPBE_ENC_DV_PRESET) { | 415 | if (output->modes[i].timings_type == VPBE_ENC_CUSTOM_TIMINGS) { |
432 | if (j == preset_info->index) | 416 | if (j == timings->index) |
433 | break; | 417 | break; |
434 | j++; | 418 | j++; |
435 | } | 419 | } |
@@ -437,9 +421,8 @@ static int vpbe_enum_dv_presets(struct vpbe_device *vpbe_dev, | |||
437 | 421 | ||
438 | if (i == output->num_modes) | 422 | if (i == output->num_modes) |
439 | return -EINVAL; | 423 | return -EINVAL; |
440 | 424 | timings->timings = output->modes[i].dv_timings; | |
441 | return v4l_fill_dv_preset_info(output->modes[i].timings.dv_preset, | 425 | return 0; |
442 | preset_info); | ||
443 | } | 426 | } |
444 | 427 | ||
445 | /** | 428 | /** |
@@ -489,10 +472,10 @@ static int vpbe_s_std(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id) | |||
489 | */ | 472 | */ |
490 | static int vpbe_g_std(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id) | 473 | static int vpbe_g_std(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id) |
491 | { | 474 | { |
492 | struct vpbe_enc_mode_info cur_timings = vpbe_dev->current_timings; | 475 | struct vpbe_enc_mode_info *cur_timings = &vpbe_dev->current_timings; |
493 | 476 | ||
494 | if (cur_timings.timings_type & VPBE_ENC_STD) { | 477 | if (cur_timings->timings_type & VPBE_ENC_STD) { |
495 | *std_id = cur_timings.timings.std_id; | 478 | *std_id = cur_timings->std_id; |
496 | return 0; | 479 | return 0; |
497 | } | 480 | } |
498 | 481 | ||
@@ -511,7 +494,7 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev, | |||
511 | { | 494 | { |
512 | struct vpbe_enc_mode_info *preset_mode = NULL; | 495 | struct vpbe_enc_mode_info *preset_mode = NULL; |
513 | struct vpbe_config *cfg = vpbe_dev->cfg; | 496 | struct vpbe_config *cfg = vpbe_dev->cfg; |
514 | struct v4l2_dv_preset dv_preset; | 497 | struct v4l2_dv_timings dv_timings; |
515 | struct osd_state *osd_device; | 498 | struct osd_state *osd_device; |
516 | int out_index = vpbe_dev->current_out_index; | 499 | int out_index = vpbe_dev->current_out_index; |
517 | int ret = 0; | 500 | int ret = 0; |
@@ -530,11 +513,12 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev, | |||
530 | */ | 513 | */ |
531 | if (preset_mode->timings_type & VPBE_ENC_STD) | 514 | if (preset_mode->timings_type & VPBE_ENC_STD) |
532 | return vpbe_s_std(vpbe_dev, | 515 | return vpbe_s_std(vpbe_dev, |
533 | &preset_mode->timings.std_id); | 516 | &preset_mode->std_id); |
534 | if (preset_mode->timings_type & VPBE_ENC_DV_PRESET) { | 517 | if (preset_mode->timings_type & |
535 | dv_preset.preset = | 518 | VPBE_ENC_CUSTOM_TIMINGS) { |
536 | preset_mode->timings.dv_preset; | 519 | dv_timings = |
537 | return vpbe_s_dv_preset(vpbe_dev, &dv_preset); | 520 | preset_mode->dv_timings; |
521 | return vpbe_s_dv_timings(vpbe_dev, &dv_timings); | ||
538 | } | 522 | } |
539 | } | 523 | } |
540 | } | 524 | } |
@@ -810,9 +794,9 @@ static struct vpbe_device_ops vpbe_dev_ops = { | |||
810 | .enum_outputs = vpbe_enum_outputs, | 794 | .enum_outputs = vpbe_enum_outputs, |
811 | .set_output = vpbe_set_output, | 795 | .set_output = vpbe_set_output, |
812 | .get_output = vpbe_get_output, | 796 | .get_output = vpbe_get_output, |
813 | .s_dv_preset = vpbe_s_dv_preset, | 797 | .s_dv_timings = vpbe_s_dv_timings, |
814 | .g_dv_preset = vpbe_g_dv_preset, | 798 | .g_dv_timings = vpbe_g_dv_timings, |
815 | .enum_dv_presets = vpbe_enum_dv_presets, | 799 | .enum_dv_timings = vpbe_enum_dv_timings, |
816 | .s_std = vpbe_s_std, | 800 | .s_std = vpbe_s_std, |
817 | .g_std = vpbe_g_std, | 801 | .g_std = vpbe_g_std, |
818 | .initialize = vpbe_initialize, | 802 | .initialize = vpbe_initialize, |
diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 239f37bfa313..1b238fe07e80 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c | |||
@@ -393,7 +393,7 @@ vpbe_disp_calculate_scale_factor(struct vpbe_display *disp_dev, | |||
393 | int h_scale; | 393 | int h_scale; |
394 | int v_scale; | 394 | int v_scale; |
395 | 395 | ||
396 | v4l2_std_id standard_id = vpbe_dev->current_timings.timings.std_id; | 396 | v4l2_std_id standard_id = vpbe_dev->current_timings.std_id; |
397 | 397 | ||
398 | /* | 398 | /* |
399 | * Application initially set the image format. Current display | 399 | * Application initially set the image format. Current display |
@@ -943,7 +943,7 @@ static int vpbe_display_g_std(struct file *file, void *priv, | |||
943 | 943 | ||
944 | /* Get the standard from the current encoder */ | 944 | /* Get the standard from the current encoder */ |
945 | if (vpbe_dev->current_timings.timings_type & VPBE_ENC_STD) { | 945 | if (vpbe_dev->current_timings.timings_type & VPBE_ENC_STD) { |
946 | *std_id = vpbe_dev->current_timings.timings.std_id; | 946 | *std_id = vpbe_dev->current_timings.std_id; |
947 | return 0; | 947 | return 0; |
948 | } | 948 | } |
949 | 949 | ||
@@ -1029,29 +1029,29 @@ static int vpbe_display_g_output(struct file *file, void *priv, | |||
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | /** | 1031 | /** |
1032 | * vpbe_display_enum_dv_presets - Enumerate the dv presets | 1032 | * vpbe_display_enum_dv_timings - Enumerate the dv timings |
1033 | * | 1033 | * |
1034 | * enum the preset in the current encoder. Return the status. 0 - success | 1034 | * enum the timings in the current encoder. Return the status. 0 - success |
1035 | * -EINVAL on error | 1035 | * -EINVAL on error |
1036 | */ | 1036 | */ |
1037 | static int | 1037 | static int |
1038 | vpbe_display_enum_dv_presets(struct file *file, void *priv, | 1038 | vpbe_display_enum_dv_timings(struct file *file, void *priv, |
1039 | struct v4l2_dv_enum_preset *preset) | 1039 | struct v4l2_enum_dv_timings *timings) |
1040 | { | 1040 | { |
1041 | struct vpbe_fh *fh = priv; | 1041 | struct vpbe_fh *fh = priv; |
1042 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; | 1042 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; |
1043 | int ret; | 1043 | int ret; |
1044 | 1044 | ||
1045 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_ENUM_DV_PRESETS\n"); | 1045 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_ENUM_DV_TIMINGS\n"); |
1046 | 1046 | ||
1047 | /* Enumerate outputs */ | 1047 | /* Enumerate outputs */ |
1048 | if (NULL == vpbe_dev->ops.enum_dv_presets) | 1048 | if (NULL == vpbe_dev->ops.enum_dv_timings) |
1049 | return -EINVAL; | 1049 | return -EINVAL; |
1050 | 1050 | ||
1051 | ret = vpbe_dev->ops.enum_dv_presets(vpbe_dev, preset); | 1051 | ret = vpbe_dev->ops.enum_dv_timings(vpbe_dev, timings); |
1052 | if (ret) { | 1052 | if (ret) { |
1053 | v4l2_err(&vpbe_dev->v4l2_dev, | 1053 | v4l2_err(&vpbe_dev->v4l2_dev, |
1054 | "Failed to enumerate dv presets info\n"); | 1054 | "Failed to enumerate dv timings info\n"); |
1055 | return -EINVAL; | 1055 | return -EINVAL; |
1056 | } | 1056 | } |
1057 | 1057 | ||
@@ -1059,21 +1059,21 @@ vpbe_display_enum_dv_presets(struct file *file, void *priv, | |||
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | /** | 1061 | /** |
1062 | * vpbe_display_s_dv_preset - Set the dv presets | 1062 | * vpbe_display_s_dv_timings - Set the dv timings |
1063 | * | 1063 | * |
1064 | * Set the preset in the current encoder. Return the status. 0 - success | 1064 | * Set the timings in the current encoder. Return the status. 0 - success |
1065 | * -EINVAL on error | 1065 | * -EINVAL on error |
1066 | */ | 1066 | */ |
1067 | static int | 1067 | static int |
1068 | vpbe_display_s_dv_preset(struct file *file, void *priv, | 1068 | vpbe_display_s_dv_timings(struct file *file, void *priv, |
1069 | struct v4l2_dv_preset *preset) | 1069 | struct v4l2_dv_timings *timings) |
1070 | { | 1070 | { |
1071 | struct vpbe_fh *fh = priv; | 1071 | struct vpbe_fh *fh = priv; |
1072 | struct vpbe_layer *layer = fh->layer; | 1072 | struct vpbe_layer *layer = fh->layer; |
1073 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; | 1073 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; |
1074 | int ret; | 1074 | int ret; |
1075 | 1075 | ||
1076 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_DV_PRESETS\n"); | 1076 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_DV_TIMINGS\n"); |
1077 | 1077 | ||
1078 | 1078 | ||
1079 | /* If streaming is started, return error */ | 1079 | /* If streaming is started, return error */ |
@@ -1083,13 +1083,13 @@ vpbe_display_s_dv_preset(struct file *file, void *priv, | |||
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | /* Set the given standard in the encoder */ | 1085 | /* Set the given standard in the encoder */ |
1086 | if (!vpbe_dev->ops.s_dv_preset) | 1086 | if (!vpbe_dev->ops.s_dv_timings) |
1087 | return -EINVAL; | 1087 | return -EINVAL; |
1088 | 1088 | ||
1089 | ret = vpbe_dev->ops.s_dv_preset(vpbe_dev, preset); | 1089 | ret = vpbe_dev->ops.s_dv_timings(vpbe_dev, timings); |
1090 | if (ret) { | 1090 | if (ret) { |
1091 | v4l2_err(&vpbe_dev->v4l2_dev, | 1091 | v4l2_err(&vpbe_dev->v4l2_dev, |
1092 | "Failed to set the dv presets info\n"); | 1092 | "Failed to set the dv timings info\n"); |
1093 | return -EINVAL; | 1093 | return -EINVAL; |
1094 | } | 1094 | } |
1095 | /* set the current norm to zero to be consistent. If STD is used | 1095 | /* set the current norm to zero to be consistent. If STD is used |
@@ -1101,26 +1101,25 @@ vpbe_display_s_dv_preset(struct file *file, void *priv, | |||
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | /** | 1103 | /** |
1104 | * vpbe_display_g_dv_preset - Set the dv presets | 1104 | * vpbe_display_g_dv_timings - Set the dv timings |
1105 | * | 1105 | * |
1106 | * Get the preset in the current encoder. Return the status. 0 - success | 1106 | * Get the timings in the current encoder. Return the status. 0 - success |
1107 | * -EINVAL on error | 1107 | * -EINVAL on error |
1108 | */ | 1108 | */ |
1109 | static int | 1109 | static int |
1110 | vpbe_display_g_dv_preset(struct file *file, void *priv, | 1110 | vpbe_display_g_dv_timings(struct file *file, void *priv, |
1111 | struct v4l2_dv_preset *dv_preset) | 1111 | struct v4l2_dv_timings *dv_timings) |
1112 | { | 1112 | { |
1113 | struct vpbe_fh *fh = priv; | 1113 | struct vpbe_fh *fh = priv; |
1114 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; | 1114 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; |
1115 | 1115 | ||
1116 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_G_DV_PRESETS\n"); | 1116 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_G_DV_TIMINGS\n"); |
1117 | 1117 | ||
1118 | /* Get the given standard in the encoder */ | 1118 | /* Get the given standard in the encoder */ |
1119 | 1119 | ||
1120 | if (vpbe_dev->current_timings.timings_type & | 1120 | if (vpbe_dev->current_timings.timings_type & |
1121 | VPBE_ENC_DV_PRESET) { | 1121 | VPBE_ENC_CUSTOM_TIMINGS) { |
1122 | dv_preset->preset = | 1122 | *dv_timings = vpbe_dev->current_timings.dv_timings; |
1123 | vpbe_dev->current_timings.timings.dv_preset; | ||
1124 | } else { | 1123 | } else { |
1125 | return -EINVAL; | 1124 | return -EINVAL; |
1126 | } | 1125 | } |
@@ -1572,9 +1571,9 @@ static const struct v4l2_ioctl_ops vpbe_ioctl_ops = { | |||
1572 | .vidioc_enum_output = vpbe_display_enum_output, | 1571 | .vidioc_enum_output = vpbe_display_enum_output, |
1573 | .vidioc_s_output = vpbe_display_s_output, | 1572 | .vidioc_s_output = vpbe_display_s_output, |
1574 | .vidioc_g_output = vpbe_display_g_output, | 1573 | .vidioc_g_output = vpbe_display_g_output, |
1575 | .vidioc_s_dv_preset = vpbe_display_s_dv_preset, | 1574 | .vidioc_s_dv_timings = vpbe_display_s_dv_timings, |
1576 | .vidioc_g_dv_preset = vpbe_display_g_dv_preset, | 1575 | .vidioc_g_dv_timings = vpbe_display_g_dv_timings, |
1577 | .vidioc_enum_dv_presets = vpbe_display_enum_dv_presets, | 1576 | .vidioc_enum_dv_timings = vpbe_display_enum_dv_timings, |
1578 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1577 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1579 | .vidioc_g_register = vpbe_display_g_register, | 1578 | .vidioc_g_register = vpbe_display_g_register, |
1580 | .vidioc_s_register = vpbe_display_s_register, | 1579 | .vidioc_s_register = vpbe_display_s_register, |
@@ -1639,8 +1638,7 @@ static __devinit int init_vpbe_layer(int i, struct vpbe_display *disp_dev, | |||
1639 | VPBE_ENC_STD) { | 1638 | VPBE_ENC_STD) { |
1640 | vbd->tvnorms = (V4L2_STD_525_60 | V4L2_STD_625_50); | 1639 | vbd->tvnorms = (V4L2_STD_525_60 | V4L2_STD_625_50); |
1641 | vbd->current_norm = | 1640 | vbd->current_norm = |
1642 | disp_dev->vpbe_dev-> | 1641 | disp_dev->vpbe_dev->current_timings.std_id; |
1643 | current_timings.timings.std_id; | ||
1644 | } else | 1642 | } else |
1645 | vbd->current_norm = 0; | 1643 | vbd->current_norm = 0; |
1646 | 1644 | ||
diff --git a/drivers/media/platform/davinci/vpbe_venc.c b/drivers/media/platform/davinci/vpbe_venc.c index b21ecc8d134d..86d47c39033d 100644 --- a/drivers/media/platform/davinci/vpbe_venc.c +++ b/drivers/media/platform/davinci/vpbe_venc.c | |||
@@ -298,7 +298,7 @@ static int venc_set_480p59_94(struct v4l2_subdev *sd) | |||
298 | return -EINVAL; | 298 | return -EINVAL; |
299 | 299 | ||
300 | /* Setup clock at VPSS & VENC for SD */ | 300 | /* Setup clock at VPSS & VENC for SD */ |
301 | if (pdata->setup_clock(VPBE_ENC_DV_PRESET, V4L2_DV_480P59_94) < 0) | 301 | if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 27000000) < 0) |
302 | return -EINVAL; | 302 | return -EINVAL; |
303 | 303 | ||
304 | venc_enabledigitaloutput(sd, 0); | 304 | venc_enabledigitaloutput(sd, 0); |
@@ -345,7 +345,7 @@ static int venc_set_576p50(struct v4l2_subdev *sd) | |||
345 | (pdata->venc_type != VPBE_VERSION_2)) | 345 | (pdata->venc_type != VPBE_VERSION_2)) |
346 | return -EINVAL; | 346 | return -EINVAL; |
347 | /* Setup clock at VPSS & VENC for SD */ | 347 | /* Setup clock at VPSS & VENC for SD */ |
348 | if (pdata->setup_clock(VPBE_ENC_DV_PRESET, V4L2_DV_576P50) < 0) | 348 | if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 27000000) < 0) |
349 | return -EINVAL; | 349 | return -EINVAL; |
350 | 350 | ||
351 | venc_enabledigitaloutput(sd, 0); | 351 | venc_enabledigitaloutput(sd, 0); |
@@ -385,7 +385,7 @@ static int venc_set_720p60_internal(struct v4l2_subdev *sd) | |||
385 | struct venc_state *venc = to_state(sd); | 385 | struct venc_state *venc = to_state(sd); |
386 | struct venc_platform_data *pdata = venc->pdata; | 386 | struct venc_platform_data *pdata = venc->pdata; |
387 | 387 | ||
388 | if (pdata->setup_clock(VPBE_ENC_DV_PRESET, V4L2_DV_720P60) < 0) | 388 | if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 74250000) < 0) |
389 | return -EINVAL; | 389 | return -EINVAL; |
390 | 390 | ||
391 | venc_enabledigitaloutput(sd, 0); | 391 | venc_enabledigitaloutput(sd, 0); |
@@ -413,7 +413,7 @@ static int venc_set_1080i30_internal(struct v4l2_subdev *sd) | |||
413 | struct venc_state *venc = to_state(sd); | 413 | struct venc_state *venc = to_state(sd); |
414 | struct venc_platform_data *pdata = venc->pdata; | 414 | struct venc_platform_data *pdata = venc->pdata; |
415 | 415 | ||
416 | if (pdata->setup_clock(VPBE_ENC_DV_PRESET, V4L2_DV_1080P30) < 0) | 416 | if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 74250000) < 0) |
417 | return -EINVAL; | 417 | return -EINVAL; |
418 | 418 | ||
419 | venc_enabledigitaloutput(sd, 0); | 419 | venc_enabledigitaloutput(sd, 0); |
@@ -446,26 +446,27 @@ static int venc_s_std_output(struct v4l2_subdev *sd, v4l2_std_id norm) | |||
446 | return -EINVAL; | 446 | return -EINVAL; |
447 | } | 447 | } |
448 | 448 | ||
449 | static int venc_s_dv_preset(struct v4l2_subdev *sd, | 449 | static int venc_s_dv_timings(struct v4l2_subdev *sd, |
450 | struct v4l2_dv_preset *dv_preset) | 450 | struct v4l2_dv_timings *dv_timings) |
451 | { | 451 | { |
452 | struct venc_state *venc = to_state(sd); | 452 | struct venc_state *venc = to_state(sd); |
453 | u32 height = dv_timings->bt.height; | ||
453 | int ret; | 454 | int ret; |
454 | 455 | ||
455 | v4l2_dbg(debug, 1, sd, "venc_s_dv_preset\n"); | 456 | v4l2_dbg(debug, 1, sd, "venc_s_dv_timings\n"); |
456 | 457 | ||
457 | if (dv_preset->preset == V4L2_DV_576P50) | 458 | if (height == 576) |
458 | return venc_set_576p50(sd); | 459 | return venc_set_576p50(sd); |
459 | else if (dv_preset->preset == V4L2_DV_480P59_94) | 460 | else if (height == 480) |
460 | return venc_set_480p59_94(sd); | 461 | return venc_set_480p59_94(sd); |
461 | else if ((dv_preset->preset == V4L2_DV_720P60) && | 462 | else if ((height == 720) && |
462 | (venc->pdata->venc_type == VPBE_VERSION_2)) { | 463 | (venc->pdata->venc_type == VPBE_VERSION_2)) { |
463 | /* TBD setup internal 720p mode here */ | 464 | /* TBD setup internal 720p mode here */ |
464 | ret = venc_set_720p60_internal(sd); | 465 | ret = venc_set_720p60_internal(sd); |
465 | /* for DM365 VPBE, there is DAC inside */ | 466 | /* for DM365 VPBE, there is DAC inside */ |
466 | vdaccfg_write(sd, VDAC_CONFIG_HD_V2); | 467 | vdaccfg_write(sd, VDAC_CONFIG_HD_V2); |
467 | return ret; | 468 | return ret; |
468 | } else if ((dv_preset->preset == V4L2_DV_1080I30) && | 469 | } else if ((height == 1080) && |
469 | (venc->pdata->venc_type == VPBE_VERSION_2)) { | 470 | (venc->pdata->venc_type == VPBE_VERSION_2)) { |
470 | /* TBD setup internal 1080i mode here */ | 471 | /* TBD setup internal 1080i mode here */ |
471 | ret = venc_set_1080i30_internal(sd); | 472 | ret = venc_set_1080i30_internal(sd); |
@@ -518,7 +519,7 @@ static const struct v4l2_subdev_core_ops venc_core_ops = { | |||
518 | static const struct v4l2_subdev_video_ops venc_video_ops = { | 519 | static const struct v4l2_subdev_video_ops venc_video_ops = { |
519 | .s_routing = venc_s_routing, | 520 | .s_routing = venc_s_routing, |
520 | .s_std_output = venc_s_std_output, | 521 | .s_std_output = venc_s_std_output, |
521 | .s_dv_preset = venc_s_dv_preset, | 522 | .s_dv_timings = venc_s_dv_timings, |
522 | }; | 523 | }; |
523 | 524 | ||
524 | static const struct v4l2_subdev_ops venc_ops = { | 525 | static const struct v4l2_subdev_ops venc_ops = { |