diff options
Diffstat (limited to 'drivers/video/omap2/displays/panel-generic-dpi.c')
-rw-r--r-- | drivers/video/omap2/displays/panel-generic-dpi.c | 76 |
1 files changed, 68 insertions, 8 deletions
diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c b/drivers/video/omap2/displays/panel-generic-dpi.c index bc5af2500eb9..88295c526815 100644 --- a/drivers/video/omap2/displays/panel-generic-dpi.c +++ b/drivers/video/omap2/displays/panel-generic-dpi.c | |||
@@ -545,6 +545,8 @@ struct panel_drv_data { | |||
545 | struct omap_dss_device *dssdev; | 545 | struct omap_dss_device *dssdev; |
546 | 546 | ||
547 | struct panel_config *panel_config; | 547 | struct panel_config *panel_config; |
548 | |||
549 | struct mutex lock; | ||
548 | }; | 550 | }; |
549 | 551 | ||
550 | static inline struct panel_generic_dpi_data | 552 | static inline struct panel_generic_dpi_data |
@@ -563,6 +565,9 @@ static int generic_dpi_panel_power_on(struct omap_dss_device *dssdev) | |||
563 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) | 565 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) |
564 | return 0; | 566 | return 0; |
565 | 567 | ||
568 | omapdss_dpi_set_timings(dssdev, &dssdev->panel.timings); | ||
569 | omapdss_dpi_set_data_lines(dssdev, dssdev->phy.dpi.data_lines); | ||
570 | |||
566 | r = omapdss_dpi_display_enable(dssdev); | 571 | r = omapdss_dpi_display_enable(dssdev); |
567 | if (r) | 572 | if (r) |
568 | goto err0; | 573 | goto err0; |
@@ -634,6 +639,8 @@ static int generic_dpi_panel_probe(struct omap_dss_device *dssdev) | |||
634 | drv_data->dssdev = dssdev; | 639 | drv_data->dssdev = dssdev; |
635 | drv_data->panel_config = panel_config; | 640 | drv_data->panel_config = panel_config; |
636 | 641 | ||
642 | mutex_init(&drv_data->lock); | ||
643 | |||
637 | dev_set_drvdata(&dssdev->dev, drv_data); | 644 | dev_set_drvdata(&dssdev->dev, drv_data); |
638 | 645 | ||
639 | return 0; | 646 | return 0; |
@@ -652,56 +659,108 @@ static void __exit generic_dpi_panel_remove(struct omap_dss_device *dssdev) | |||
652 | 659 | ||
653 | static int generic_dpi_panel_enable(struct omap_dss_device *dssdev) | 660 | static int generic_dpi_panel_enable(struct omap_dss_device *dssdev) |
654 | { | 661 | { |
655 | int r = 0; | 662 | struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev); |
663 | int r; | ||
664 | |||
665 | mutex_lock(&drv_data->lock); | ||
656 | 666 | ||
657 | r = generic_dpi_panel_power_on(dssdev); | 667 | r = generic_dpi_panel_power_on(dssdev); |
658 | if (r) | 668 | if (r) |
659 | return r; | 669 | goto err; |
660 | 670 | ||
661 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | 671 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; |
672 | err: | ||
673 | mutex_unlock(&drv_data->lock); | ||
662 | 674 | ||
663 | return 0; | 675 | return r; |
664 | } | 676 | } |
665 | 677 | ||
666 | static void generic_dpi_panel_disable(struct omap_dss_device *dssdev) | 678 | static void generic_dpi_panel_disable(struct omap_dss_device *dssdev) |
667 | { | 679 | { |
680 | struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev); | ||
681 | |||
682 | mutex_lock(&drv_data->lock); | ||
683 | |||
668 | generic_dpi_panel_power_off(dssdev); | 684 | generic_dpi_panel_power_off(dssdev); |
669 | 685 | ||
670 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | 686 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; |
687 | |||
688 | mutex_unlock(&drv_data->lock); | ||
671 | } | 689 | } |
672 | 690 | ||
673 | static int generic_dpi_panel_suspend(struct omap_dss_device *dssdev) | 691 | static int generic_dpi_panel_suspend(struct omap_dss_device *dssdev) |
674 | { | 692 | { |
693 | struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev); | ||
694 | |||
695 | mutex_lock(&drv_data->lock); | ||
696 | |||
675 | generic_dpi_panel_power_off(dssdev); | 697 | generic_dpi_panel_power_off(dssdev); |
676 | 698 | ||
677 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | 699 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; |
678 | 700 | ||
701 | mutex_unlock(&drv_data->lock); | ||
702 | |||
679 | return 0; | 703 | return 0; |
680 | } | 704 | } |
681 | 705 | ||
682 | static int generic_dpi_panel_resume(struct omap_dss_device *dssdev) | 706 | static int generic_dpi_panel_resume(struct omap_dss_device *dssdev) |
683 | { | 707 | { |
684 | int r = 0; | 708 | struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev); |
709 | int r; | ||
710 | |||
711 | mutex_lock(&drv_data->lock); | ||
685 | 712 | ||
686 | r = generic_dpi_panel_power_on(dssdev); | 713 | r = generic_dpi_panel_power_on(dssdev); |
687 | if (r) | 714 | if (r) |
688 | return r; | 715 | goto err; |
689 | 716 | ||
690 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | 717 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; |
691 | 718 | ||
692 | return 0; | 719 | err: |
720 | mutex_unlock(&drv_data->lock); | ||
721 | |||
722 | return r; | ||
693 | } | 723 | } |
694 | 724 | ||
695 | static void generic_dpi_panel_set_timings(struct omap_dss_device *dssdev, | 725 | static void generic_dpi_panel_set_timings(struct omap_dss_device *dssdev, |
696 | struct omap_video_timings *timings) | 726 | struct omap_video_timings *timings) |
697 | { | 727 | { |
698 | dpi_set_timings(dssdev, timings); | 728 | struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev); |
729 | |||
730 | mutex_lock(&drv_data->lock); | ||
731 | |||
732 | omapdss_dpi_set_timings(dssdev, timings); | ||
733 | |||
734 | dssdev->panel.timings = *timings; | ||
735 | |||
736 | mutex_unlock(&drv_data->lock); | ||
737 | } | ||
738 | |||
739 | static void generic_dpi_panel_get_timings(struct omap_dss_device *dssdev, | ||
740 | struct omap_video_timings *timings) | ||
741 | { | ||
742 | struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev); | ||
743 | |||
744 | mutex_lock(&drv_data->lock); | ||
745 | |||
746 | *timings = dssdev->panel.timings; | ||
747 | |||
748 | mutex_unlock(&drv_data->lock); | ||
699 | } | 749 | } |
700 | 750 | ||
701 | static int generic_dpi_panel_check_timings(struct omap_dss_device *dssdev, | 751 | static int generic_dpi_panel_check_timings(struct omap_dss_device *dssdev, |
702 | struct omap_video_timings *timings) | 752 | struct omap_video_timings *timings) |
703 | { | 753 | { |
704 | return dpi_check_timings(dssdev, timings); | 754 | struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev); |
755 | int r; | ||
756 | |||
757 | mutex_lock(&drv_data->lock); | ||
758 | |||
759 | r = dpi_check_timings(dssdev, timings); | ||
760 | |||
761 | mutex_unlock(&drv_data->lock); | ||
762 | |||
763 | return r; | ||
705 | } | 764 | } |
706 | 765 | ||
707 | static struct omap_dss_driver dpi_driver = { | 766 | static struct omap_dss_driver dpi_driver = { |
@@ -714,6 +773,7 @@ static struct omap_dss_driver dpi_driver = { | |||
714 | .resume = generic_dpi_panel_resume, | 773 | .resume = generic_dpi_panel_resume, |
715 | 774 | ||
716 | .set_timings = generic_dpi_panel_set_timings, | 775 | .set_timings = generic_dpi_panel_set_timings, |
776 | .get_timings = generic_dpi_panel_get_timings, | ||
717 | .check_timings = generic_dpi_panel_check_timings, | 777 | .check_timings = generic_dpi_panel_check_timings, |
718 | 778 | ||
719 | .driver = { | 779 | .driver = { |