diff options
-rw-r--r-- | arch/arm/mach-davinci/board-dm644x-evm.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-davinci/dm644x.c | 17 | ||||
-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 | ||||
-rw-r--r-- | include/media/davinci/vpbe.h | 14 | ||||
-rw-r--r-- | include/media/davinci/vpbe_types.h | 8 | ||||
-rw-r--r-- | include/media/davinci/vpbe_venc.h | 2 |
8 files changed, 111 insertions, 140 deletions
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index d34ed55912b2..3baf56d0a84f 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/phy.h> | 23 | #include <linux/phy.h> |
24 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
25 | #include <linux/videodev2.h> | 25 | #include <linux/videodev2.h> |
26 | #include <linux/v4l2-dv-timings.h> | ||
26 | #include <linux/export.h> | 27 | #include <linux/export.h> |
27 | 28 | ||
28 | #include <media/tvp514x.h> | 29 | #include <media/tvp514x.h> |
@@ -620,7 +621,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = { | |||
620 | { | 621 | { |
621 | .name = "ntsc", | 622 | .name = "ntsc", |
622 | .timings_type = VPBE_ENC_STD, | 623 | .timings_type = VPBE_ENC_STD, |
623 | .timings = {V4L2_STD_525_60}, | 624 | .std_id = V4L2_STD_525_60, |
624 | .interlaced = 1, | 625 | .interlaced = 1, |
625 | .xres = 720, | 626 | .xres = 720, |
626 | .yres = 480, | 627 | .yres = 480, |
@@ -632,7 +633,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = { | |||
632 | { | 633 | { |
633 | .name = "pal", | 634 | .name = "pal", |
634 | .timings_type = VPBE_ENC_STD, | 635 | .timings_type = VPBE_ENC_STD, |
635 | .timings = {V4L2_STD_625_50}, | 636 | .std_id = V4L2_STD_625_50, |
636 | .interlaced = 1, | 637 | .interlaced = 1, |
637 | .xres = 720, | 638 | .xres = 720, |
638 | .yres = 576, | 639 | .yres = 576, |
@@ -647,8 +648,8 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = { | |||
647 | static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = { | 648 | static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = { |
648 | { | 649 | { |
649 | .name = "480p59_94", | 650 | .name = "480p59_94", |
650 | .timings_type = VPBE_ENC_DV_PRESET, | 651 | .timings_type = VPBE_ENC_CUSTOM_TIMINGS, |
651 | .timings = {V4L2_DV_480P59_94}, | 652 | .dv_timings = V4L2_DV_BT_CEA_720X480P59_94, |
652 | .interlaced = 0, | 653 | .interlaced = 0, |
653 | .xres = 720, | 654 | .xres = 720, |
654 | .yres = 480, | 655 | .yres = 480, |
@@ -659,8 +660,8 @@ static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = { | |||
659 | }, | 660 | }, |
660 | { | 661 | { |
661 | .name = "576p50", | 662 | .name = "576p50", |
662 | .timings_type = VPBE_ENC_DV_PRESET, | 663 | .timings_type = VPBE_ENC_CUSTOM_TIMINGS, |
663 | .timings = {V4L2_DV_576P50}, | 664 | .dv_timings = V4L2_DV_BT_CEA_720X576P50, |
664 | .interlaced = 0, | 665 | .interlaced = 0, |
665 | .xres = 720, | 666 | .xres = 720, |
666 | .yres = 576, | 667 | .yres = 576, |
@@ -698,7 +699,7 @@ static struct vpbe_output dm644xevm_vpbe_outputs[] = { | |||
698 | .index = 1, | 699 | .index = 1, |
699 | .name = "Component", | 700 | .name = "Component", |
700 | .type = V4L2_OUTPUT_TYPE_ANALOG, | 701 | .type = V4L2_OUTPUT_TYPE_ANALOG, |
701 | .capabilities = V4L2_OUT_CAP_PRESETS, | 702 | .capabilities = V4L2_OUT_CAP_CUSTOM_TIMINGS, |
702 | }, | 703 | }, |
703 | .subdev_name = VPBE_VENC_SUBDEV_NAME, | 704 | .subdev_name = VPBE_VENC_SUBDEV_NAME, |
704 | .default_mode = "480p59_94", | 705 | .default_mode = "480p59_94", |
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c index c8b866657fcb..79d2880c9d2d 100644 --- a/arch/arm/mach-davinci/dm644x.c +++ b/arch/arm/mach-davinci/dm644x.c | |||
@@ -701,7 +701,7 @@ static struct resource dm644x_venc_resources[] = { | |||
701 | #define DM644X_VPSS_DACCLKEN BIT(4) | 701 | #define DM644X_VPSS_DACCLKEN BIT(4) |
702 | 702 | ||
703 | static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type, | 703 | static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type, |
704 | unsigned int mode) | 704 | unsigned int pclock) |
705 | { | 705 | { |
706 | int ret = 0; | 706 | int ret = 0; |
707 | u32 v = DM644X_VPSS_VENCLKEN; | 707 | u32 v = DM644X_VPSS_VENCLKEN; |
@@ -711,27 +711,18 @@ static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type, | |||
711 | v |= DM644X_VPSS_DACCLKEN; | 711 | v |= DM644X_VPSS_DACCLKEN; |
712 | writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL)); | 712 | writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL)); |
713 | break; | 713 | break; |
714 | case VPBE_ENC_DV_PRESET: | 714 | case VPBE_ENC_CUSTOM_TIMINGS: |
715 | switch (mode) { | 715 | if (pclock <= 27000000) { |
716 | case V4L2_DV_480P59_94: | ||
717 | case V4L2_DV_576P50: | ||
718 | v |= DM644X_VPSS_MUXSEL_PLL2_MODE | | 716 | v |= DM644X_VPSS_MUXSEL_PLL2_MODE | |
719 | DM644X_VPSS_DACCLKEN; | 717 | DM644X_VPSS_DACCLKEN; |
720 | writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL)); | 718 | writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL)); |
721 | break; | 719 | } else { |
722 | case V4L2_DV_720P60: | ||
723 | case V4L2_DV_1080I60: | ||
724 | case V4L2_DV_1080P30: | ||
725 | /* | 720 | /* |
726 | * For HD, use external clock source since | 721 | * For HD, use external clock source since |
727 | * HD requires higher clock rate | 722 | * HD requires higher clock rate |
728 | */ | 723 | */ |
729 | v |= DM644X_VPSS_MUXSEL_VPBECLK_MODE; | 724 | v |= DM644X_VPSS_MUXSEL_VPBECLK_MODE; |
730 | writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL)); | 725 | writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL)); |
731 | break; | ||
732 | default: | ||
733 | ret = -EINVAL; | ||
734 | break; | ||
735 | } | 726 | } |
736 | break; | 727 | break; |
737 | default: | 728 | default: |
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 = { |
diff --git a/include/media/davinci/vpbe.h b/include/media/davinci/vpbe.h index 8bc1b3c0e679..a7ca4884c46c 100644 --- a/include/media/davinci/vpbe.h +++ b/include/media/davinci/vpbe.h | |||
@@ -35,7 +35,7 @@ struct osd_config_info { | |||
35 | struct vpbe_output { | 35 | struct vpbe_output { |
36 | struct v4l2_output output; | 36 | struct v4l2_output output; |
37 | /* | 37 | /* |
38 | * If output capabilities include dv_preset, list supported presets | 38 | * If output capabilities include dv_timings, list supported timings |
39 | * below | 39 | * below |
40 | */ | 40 | */ |
41 | char *subdev_name; | 41 | char *subdev_name; |
@@ -120,16 +120,16 @@ struct vpbe_device_ops { | |||
120 | unsigned int (*get_output)(struct vpbe_device *vpbe_dev); | 120 | unsigned int (*get_output)(struct vpbe_device *vpbe_dev); |
121 | 121 | ||
122 | /* Set DV preset at current output */ | 122 | /* Set DV preset at current output */ |
123 | int (*s_dv_preset)(struct vpbe_device *vpbe_dev, | 123 | int (*s_dv_timings)(struct vpbe_device *vpbe_dev, |
124 | struct v4l2_dv_preset *dv_preset); | 124 | struct v4l2_dv_timings *dv_timings); |
125 | 125 | ||
126 | /* Get DV presets supported at the output */ | 126 | /* Get DV presets supported at the output */ |
127 | int (*g_dv_preset)(struct vpbe_device *vpbe_dev, | 127 | int (*g_dv_timings)(struct vpbe_device *vpbe_dev, |
128 | struct v4l2_dv_preset *dv_preset); | 128 | struct v4l2_dv_timings *dv_timings); |
129 | 129 | ||
130 | /* Enumerate the DV Presets supported at the output */ | 130 | /* Enumerate the DV Presets supported at the output */ |
131 | int (*enum_dv_presets)(struct vpbe_device *vpbe_dev, | 131 | int (*enum_dv_timings)(struct vpbe_device *vpbe_dev, |
132 | struct v4l2_dv_enum_preset *preset_info); | 132 | struct v4l2_enum_dv_timings *timings_info); |
133 | 133 | ||
134 | /* Set std at the output */ | 134 | /* Set std at the output */ |
135 | int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id); | 135 | int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id); |
diff --git a/include/media/davinci/vpbe_types.h b/include/media/davinci/vpbe_types.h index 727f55170e41..9b85396514be 100644 --- a/include/media/davinci/vpbe_types.h +++ b/include/media/davinci/vpbe_types.h | |||
@@ -32,11 +32,6 @@ enum vpbe_enc_timings_type { | |||
32 | VPBE_ENC_TIMINGS_INVALID = 0x8, | 32 | VPBE_ENC_TIMINGS_INVALID = 0x8, |
33 | }; | 33 | }; |
34 | 34 | ||
35 | union vpbe_timings { | ||
36 | v4l2_std_id std_id; | ||
37 | unsigned int dv_preset; | ||
38 | }; | ||
39 | |||
40 | /* | 35 | /* |
41 | * struct vpbe_enc_mode_info | 36 | * struct vpbe_enc_mode_info |
42 | * @name: ptr to name string of the standard, "NTSC", "PAL" etc | 37 | * @name: ptr to name string of the standard, "NTSC", "PAL" etc |
@@ -73,7 +68,8 @@ union vpbe_timings { | |||
73 | struct vpbe_enc_mode_info { | 68 | struct vpbe_enc_mode_info { |
74 | unsigned char *name; | 69 | unsigned char *name; |
75 | enum vpbe_enc_timings_type timings_type; | 70 | enum vpbe_enc_timings_type timings_type; |
76 | union vpbe_timings timings; | 71 | v4l2_std_id std_id; |
72 | struct v4l2_dv_timings dv_timings; | ||
77 | unsigned int interlaced; | 73 | unsigned int interlaced; |
78 | unsigned int xres; | 74 | unsigned int xres; |
79 | unsigned int yres; | 75 | unsigned int yres; |
diff --git a/include/media/davinci/vpbe_venc.h b/include/media/davinci/vpbe_venc.h index 6b57334f4029..cc78c2eb16da 100644 --- a/include/media/davinci/vpbe_venc.h +++ b/include/media/davinci/vpbe_venc.h | |||
@@ -32,7 +32,7 @@ struct venc_platform_data { | |||
32 | int (*setup_pinmux)(enum v4l2_mbus_pixelcode if_type, | 32 | int (*setup_pinmux)(enum v4l2_mbus_pixelcode if_type, |
33 | int field); | 33 | int field); |
34 | int (*setup_clock)(enum vpbe_enc_timings_type type, | 34 | int (*setup_clock)(enum vpbe_enc_timings_type type, |
35 | unsigned int mode); | 35 | unsigned int pixclock); |
36 | int (*setup_if_config)(enum v4l2_mbus_pixelcode pixcode); | 36 | int (*setup_if_config)(enum v4l2_mbus_pixelcode pixcode); |
37 | /* Number of LCD outputs supported */ | 37 | /* Number of LCD outputs supported */ |
38 | int num_lcd_outputs; | 38 | int num_lcd_outputs; |