diff options
author | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-01-12 08:12:07 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-02-24 07:31:28 -0500 |
commit | 37ac60e414052f1d9301368437db8f0cb9e323fe (patch) | |
tree | d6b30b58deae82a6d5f2ac2f4d9cf18ed3bc57da /drivers/video/omap2/dss/venc.c | |
parent | 18946f62c6cc8cf051bafca8b7fa72309e8a1067 (diff) |
OMAP: DSS2: move enable/disable/suspend/resume
Move enable/disable/suspend/resume from omap_dss_device to
omap_dss_driver.
This is part of a larger patch-set, which moves the control from omapdss
driver to the display driver.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Diffstat (limited to 'drivers/video/omap2/dss/venc.c')
-rw-r--r-- | drivers/video/omap2/dss/venc.c | 251 |
1 files changed, 100 insertions, 151 deletions
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 0d0dc94417fc..a0ab52c841ee 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c | |||
@@ -400,6 +400,56 @@ static const struct venc_config *venc_timings_to_config( | |||
400 | BUG(); | 400 | BUG(); |
401 | } | 401 | } |
402 | 402 | ||
403 | static void venc_power_on(struct omap_dss_device *dssdev) | ||
404 | { | ||
405 | u32 l; | ||
406 | |||
407 | venc_enable_clocks(1); | ||
408 | |||
409 | venc_reset(); | ||
410 | venc_write_config(venc_timings_to_config(&dssdev->panel.timings)); | ||
411 | |||
412 | dss_set_venc_output(dssdev->phy.venc.type); | ||
413 | dss_set_dac_pwrdn_bgz(1); | ||
414 | |||
415 | l = 0; | ||
416 | |||
417 | if (dssdev->phy.venc.type == OMAP_DSS_VENC_TYPE_COMPOSITE) | ||
418 | l |= 1 << 1; | ||
419 | else /* S-Video */ | ||
420 | l |= (1 << 0) | (1 << 2); | ||
421 | |||
422 | if (dssdev->phy.venc.invert_polarity == false) | ||
423 | l |= 1 << 3; | ||
424 | |||
425 | venc_write_reg(VENC_OUTPUT_CONTROL, l); | ||
426 | |||
427 | dispc_set_digit_size(dssdev->panel.timings.x_res, | ||
428 | dssdev->panel.timings.y_res/2); | ||
429 | |||
430 | regulator_enable(venc.vdda_dac_reg); | ||
431 | |||
432 | if (dssdev->platform_enable) | ||
433 | dssdev->platform_enable(dssdev); | ||
434 | |||
435 | dssdev->manager->enable(dssdev->manager); | ||
436 | } | ||
437 | |||
438 | static void venc_power_off(struct omap_dss_device *dssdev) | ||
439 | { | ||
440 | venc_write_reg(VENC_OUTPUT_CONTROL, 0); | ||
441 | dss_set_dac_pwrdn_bgz(0); | ||
442 | |||
443 | dssdev->manager->disable(dssdev->manager); | ||
444 | |||
445 | if (dssdev->platform_disable) | ||
446 | dssdev->platform_disable(dssdev); | ||
447 | |||
448 | regulator_disable(venc.vdda_dac_reg); | ||
449 | |||
450 | venc_enable_clocks(0); | ||
451 | } | ||
452 | |||
403 | 453 | ||
404 | 454 | ||
405 | 455 | ||
@@ -420,23 +470,66 @@ static int venc_panel_enable(struct omap_dss_device *dssdev) | |||
420 | { | 470 | { |
421 | int r = 0; | 471 | int r = 0; |
422 | 472 | ||
473 | DSSDBG("venc_enable_display\n"); | ||
474 | |||
475 | mutex_lock(&venc.venc_lock); | ||
476 | |||
477 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { | ||
478 | r = -EINVAL; | ||
479 | goto err1; | ||
480 | } | ||
481 | |||
482 | if (dssdev->platform_enable) { | ||
483 | r = dssdev->platform_enable(dssdev); | ||
484 | if (r) | ||
485 | goto err2; | ||
486 | } | ||
487 | |||
488 | venc_power_on(dssdev); | ||
489 | |||
490 | venc.wss_data = 0; | ||
491 | |||
492 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
493 | |||
423 | /* wait couple of vsyncs until enabling the LCD */ | 494 | /* wait couple of vsyncs until enabling the LCD */ |
424 | msleep(50); | 495 | msleep(50); |
425 | 496 | ||
426 | if (dssdev->platform_enable) | 497 | mutex_unlock(&venc.venc_lock); |
427 | r = dssdev->platform_enable(dssdev); | ||
428 | 498 | ||
429 | return r; | 499 | return r; |
500 | err2: | ||
501 | venc_power_off(dssdev); | ||
502 | err1: | ||
503 | mutex_unlock(&venc.venc_lock); | ||
504 | return r; | ||
430 | } | 505 | } |
431 | 506 | ||
432 | static void venc_panel_disable(struct omap_dss_device *dssdev) | 507 | static void venc_panel_disable(struct omap_dss_device *dssdev) |
433 | { | 508 | { |
434 | if (dssdev->platform_disable) | 509 | DSSDBG("venc_disable_display\n"); |
435 | dssdev->platform_disable(dssdev); | ||
436 | 510 | ||
437 | /* wait at least 5 vsyncs after disabling the LCD */ | 511 | mutex_lock(&venc.venc_lock); |
512 | |||
513 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) | ||
514 | goto end; | ||
438 | 515 | ||
516 | if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) { | ||
517 | /* suspended is the same as disabled with venc */ | ||
518 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
519 | goto end; | ||
520 | } | ||
521 | |||
522 | venc_power_off(dssdev); | ||
523 | |||
524 | /* wait at least 5 vsyncs after disabling the LCD */ | ||
439 | msleep(100); | 525 | msleep(100); |
526 | |||
527 | if (dssdev->platform_disable) | ||
528 | dssdev->platform_disable(dssdev); | ||
529 | |||
530 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
531 | end: | ||
532 | mutex_unlock(&venc.venc_lock); | ||
440 | } | 533 | } |
441 | 534 | ||
442 | static int venc_panel_suspend(struct omap_dss_device *dssdev) | 535 | static int venc_panel_suspend(struct omap_dss_device *dssdev) |
@@ -526,146 +619,6 @@ void venc_exit(void) | |||
526 | iounmap(venc.base); | 619 | iounmap(venc.base); |
527 | } | 620 | } |
528 | 621 | ||
529 | static void venc_power_on(struct omap_dss_device *dssdev) | ||
530 | { | ||
531 | u32 l; | ||
532 | |||
533 | venc_enable_clocks(1); | ||
534 | |||
535 | venc_reset(); | ||
536 | venc_write_config(venc_timings_to_config(&dssdev->panel.timings)); | ||
537 | |||
538 | dss_set_venc_output(dssdev->phy.venc.type); | ||
539 | dss_set_dac_pwrdn_bgz(1); | ||
540 | |||
541 | l = 0; | ||
542 | |||
543 | if (dssdev->phy.venc.type == OMAP_DSS_VENC_TYPE_COMPOSITE) | ||
544 | l |= 1 << 1; | ||
545 | else /* S-Video */ | ||
546 | l |= (1 << 0) | (1 << 2); | ||
547 | |||
548 | if (dssdev->phy.venc.invert_polarity == false) | ||
549 | l |= 1 << 3; | ||
550 | |||
551 | venc_write_reg(VENC_OUTPUT_CONTROL, l); | ||
552 | |||
553 | dispc_set_digit_size(dssdev->panel.timings.x_res, | ||
554 | dssdev->panel.timings.y_res/2); | ||
555 | |||
556 | regulator_enable(venc.vdda_dac_reg); | ||
557 | |||
558 | if (dssdev->platform_enable) | ||
559 | dssdev->platform_enable(dssdev); | ||
560 | |||
561 | dssdev->manager->enable(dssdev->manager); | ||
562 | } | ||
563 | |||
564 | static void venc_power_off(struct omap_dss_device *dssdev) | ||
565 | { | ||
566 | venc_write_reg(VENC_OUTPUT_CONTROL, 0); | ||
567 | dss_set_dac_pwrdn_bgz(0); | ||
568 | |||
569 | dssdev->manager->disable(dssdev->manager); | ||
570 | |||
571 | if (dssdev->platform_disable) | ||
572 | dssdev->platform_disable(dssdev); | ||
573 | |||
574 | regulator_disable(venc.vdda_dac_reg); | ||
575 | |||
576 | venc_enable_clocks(0); | ||
577 | } | ||
578 | |||
579 | static int venc_enable_display(struct omap_dss_device *dssdev) | ||
580 | { | ||
581 | int r = 0; | ||
582 | |||
583 | DSSDBG("venc_enable_display\n"); | ||
584 | |||
585 | mutex_lock(&venc.venc_lock); | ||
586 | |||
587 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { | ||
588 | r = -EINVAL; | ||
589 | goto err; | ||
590 | } | ||
591 | |||
592 | venc_power_on(dssdev); | ||
593 | |||
594 | venc.wss_data = 0; | ||
595 | |||
596 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
597 | err: | ||
598 | mutex_unlock(&venc.venc_lock); | ||
599 | |||
600 | return r; | ||
601 | } | ||
602 | |||
603 | static void venc_disable_display(struct omap_dss_device *dssdev) | ||
604 | { | ||
605 | DSSDBG("venc_disable_display\n"); | ||
606 | |||
607 | mutex_lock(&venc.venc_lock); | ||
608 | |||
609 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) | ||
610 | goto end; | ||
611 | |||
612 | if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) { | ||
613 | /* suspended is the same as disabled with venc */ | ||
614 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
615 | goto end; | ||
616 | } | ||
617 | |||
618 | venc_power_off(dssdev); | ||
619 | |||
620 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
621 | end: | ||
622 | mutex_unlock(&venc.venc_lock); | ||
623 | } | ||
624 | |||
625 | static int venc_display_suspend(struct omap_dss_device *dssdev) | ||
626 | { | ||
627 | int r = 0; | ||
628 | |||
629 | DSSDBG("venc_display_suspend\n"); | ||
630 | |||
631 | mutex_lock(&venc.venc_lock); | ||
632 | |||
633 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { | ||
634 | r = -EINVAL; | ||
635 | goto err; | ||
636 | } | ||
637 | |||
638 | venc_power_off(dssdev); | ||
639 | |||
640 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
641 | err: | ||
642 | mutex_unlock(&venc.venc_lock); | ||
643 | |||
644 | return r; | ||
645 | } | ||
646 | |||
647 | static int venc_display_resume(struct omap_dss_device *dssdev) | ||
648 | { | ||
649 | int r = 0; | ||
650 | |||
651 | DSSDBG("venc_display_resume\n"); | ||
652 | |||
653 | mutex_lock(&venc.venc_lock); | ||
654 | |||
655 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) { | ||
656 | r = -EINVAL; | ||
657 | goto err; | ||
658 | } | ||
659 | |||
660 | venc_power_on(dssdev); | ||
661 | |||
662 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
663 | err: | ||
664 | mutex_unlock(&venc.venc_lock); | ||
665 | |||
666 | return r; | ||
667 | } | ||
668 | |||
669 | static void venc_get_timings(struct omap_dss_device *dssdev, | 622 | static void venc_get_timings(struct omap_dss_device *dssdev, |
670 | struct omap_video_timings *timings) | 623 | struct omap_video_timings *timings) |
671 | { | 624 | { |
@@ -684,8 +637,8 @@ static void venc_set_timings(struct omap_dss_device *dssdev, | |||
684 | dssdev->panel.timings = *timings; | 637 | dssdev->panel.timings = *timings; |
685 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { | 638 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { |
686 | /* turn the venc off and on to get new timings to use */ | 639 | /* turn the venc off and on to get new timings to use */ |
687 | venc_disable_display(dssdev); | 640 | venc_panel_disable(dssdev); |
688 | venc_enable_display(dssdev); | 641 | venc_panel_enable(dssdev); |
689 | } | 642 | } |
690 | } | 643 | } |
691 | 644 | ||
@@ -738,10 +691,6 @@ int venc_init_display(struct omap_dss_device *dssdev) | |||
738 | { | 691 | { |
739 | DSSDBG("init_display\n"); | 692 | DSSDBG("init_display\n"); |
740 | 693 | ||
741 | dssdev->enable = venc_enable_display; | ||
742 | dssdev->disable = venc_disable_display; | ||
743 | dssdev->suspend = venc_display_suspend; | ||
744 | dssdev->resume = venc_display_resume; | ||
745 | dssdev->get_timings = venc_get_timings; | 694 | dssdev->get_timings = venc_get_timings; |
746 | dssdev->set_timings = venc_set_timings; | 695 | dssdev->set_timings = venc_set_timings; |
747 | dssdev->check_timings = venc_check_timings; | 696 | dssdev->check_timings = venc_check_timings; |