summaryrefslogtreecommitdiffstats
path: root/include/video/omapdss.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/video/omapdss.h')
-rw-r--r--include/video/omapdss.h293
1 files changed, 251 insertions, 42 deletions
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index aeb4e9a0c5d1..b39463553845 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -23,6 +23,8 @@
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25 25
26#include <video/videomode.h>
27
26#define DISPC_IRQ_FRAMEDONE (1 << 0) 28#define DISPC_IRQ_FRAMEDONE (1 << 0)
27#define DISPC_IRQ_VSYNC (1 << 1) 29#define DISPC_IRQ_VSYNC (1 << 1)
28#define DISPC_IRQ_EVSYNC_EVEN (1 << 2) 30#define DISPC_IRQ_EVSYNC_EVEN (1 << 2)
@@ -68,6 +70,7 @@ enum omap_display_type {
68 OMAP_DISPLAY_TYPE_DSI = 1 << 3, 70 OMAP_DISPLAY_TYPE_DSI = 1 << 3,
69 OMAP_DISPLAY_TYPE_VENC = 1 << 4, 71 OMAP_DISPLAY_TYPE_VENC = 1 << 4,
70 OMAP_DISPLAY_TYPE_HDMI = 1 << 5, 72 OMAP_DISPLAY_TYPE_HDMI = 1 << 5,
73 OMAP_DISPLAY_TYPE_DVI = 1 << 6,
71}; 74};
72 75
73enum omap_plane { 76enum omap_plane {
@@ -169,6 +172,11 @@ enum omap_dss_audio_state {
169 OMAP_DSS_AUDIO_PLAYING, 172 OMAP_DSS_AUDIO_PLAYING,
170}; 173};
171 174
175struct omap_dss_audio {
176 struct snd_aes_iec958 *iec;
177 struct snd_cea_861_aud_if *cea;
178};
179
172enum omap_dss_rotation_type { 180enum omap_dss_rotation_type {
173 OMAP_DSS_ROT_DMA = 1 << 0, 181 OMAP_DSS_ROT_DMA = 1 << 0,
174 OMAP_DSS_ROT_VRFB = 1 << 1, 182 OMAP_DSS_ROT_VRFB = 1 << 1,
@@ -365,6 +373,7 @@ struct omap_dss_board_info {
365 int num_devices; 373 int num_devices;
366 struct omap_dss_device **devices; 374 struct omap_dss_device **devices;
367 struct omap_dss_device *default_device; 375 struct omap_dss_device *default_device;
376 const char *default_display_name;
368 int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask); 377 int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask);
369 void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask); 378 void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask);
370 int (*set_min_bus_tput)(struct device *dev, unsigned long r); 379 int (*set_min_bus_tput)(struct device *dev, unsigned long r);
@@ -512,7 +521,7 @@ struct omap_overlay_manager {
512 enum omap_dss_output_id supported_outputs; 521 enum omap_dss_output_id supported_outputs;
513 522
514 /* dynamic fields */ 523 /* dynamic fields */
515 struct omap_dss_output *output; 524 struct omap_dss_device *output;
516 525
517 /* 526 /*
518 * The following functions do not block: 527 * The following functions do not block:
@@ -526,7 +535,7 @@ struct omap_overlay_manager {
526 */ 535 */
527 536
528 int (*set_output)(struct omap_overlay_manager *mgr, 537 int (*set_output)(struct omap_overlay_manager *mgr,
529 struct omap_dss_output *output); 538 struct omap_dss_device *output);
530 int (*unset_output)(struct omap_overlay_manager *mgr); 539 int (*unset_output)(struct omap_overlay_manager *mgr);
531 540
532 int (*set_manager_info)(struct omap_overlay_manager *mgr, 541 int (*set_manager_info)(struct omap_overlay_manager *mgr,
@@ -569,33 +578,192 @@ struct omap_dss_writeback_info {
569 u8 pre_mult_alpha; 578 u8 pre_mult_alpha;
570}; 579};
571 580
572struct omap_dss_output { 581struct omapdss_dpi_ops {
573 struct list_head list; 582 int (*connect)(struct omap_dss_device *dssdev,
583 struct omap_dss_device *dst);
584 void (*disconnect)(struct omap_dss_device *dssdev,
585 struct omap_dss_device *dst);
574 586
575 const char *name; 587 int (*enable)(struct omap_dss_device *dssdev);
588 void (*disable)(struct omap_dss_device *dssdev);
576 589
577 /* display type supported by the output */ 590 int (*check_timings)(struct omap_dss_device *dssdev,
578 enum omap_display_type type; 591 struct omap_video_timings *timings);
592 void (*set_timings)(struct omap_dss_device *dssdev,
593 struct omap_video_timings *timings);
594 void (*get_timings)(struct omap_dss_device *dssdev,
595 struct omap_video_timings *timings);
579 596
580 /* DISPC channel for this output */ 597 void (*set_data_lines)(struct omap_dss_device *dssdev, int data_lines);
581 enum omap_channel dispc_channel; 598};
582 599
583 /* output instance */ 600struct omapdss_sdi_ops {
584 enum omap_dss_output_id id; 601 int (*connect)(struct omap_dss_device *dssdev,
602 struct omap_dss_device *dst);
603 void (*disconnect)(struct omap_dss_device *dssdev,
604 struct omap_dss_device *dst);
585 605
586 /* output's platform device pointer */ 606 int (*enable)(struct omap_dss_device *dssdev);
587 struct platform_device *pdev; 607 void (*disable)(struct omap_dss_device *dssdev);
588 608
589 /* dynamic fields */ 609 int (*check_timings)(struct omap_dss_device *dssdev,
590 struct omap_overlay_manager *manager; 610 struct omap_video_timings *timings);
611 void (*set_timings)(struct omap_dss_device *dssdev,
612 struct omap_video_timings *timings);
613 void (*get_timings)(struct omap_dss_device *dssdev,
614 struct omap_video_timings *timings);
591 615
592 struct omap_dss_device *device; 616 void (*set_datapairs)(struct omap_dss_device *dssdev, int datapairs);
617};
618
619struct omapdss_dvi_ops {
620 int (*connect)(struct omap_dss_device *dssdev,
621 struct omap_dss_device *dst);
622 void (*disconnect)(struct omap_dss_device *dssdev,
623 struct omap_dss_device *dst);
624
625 int (*enable)(struct omap_dss_device *dssdev);
626 void (*disable)(struct omap_dss_device *dssdev);
627
628 int (*check_timings)(struct omap_dss_device *dssdev,
629 struct omap_video_timings *timings);
630 void (*set_timings)(struct omap_dss_device *dssdev,
631 struct omap_video_timings *timings);
632 void (*get_timings)(struct omap_dss_device *dssdev,
633 struct omap_video_timings *timings);
634};
635
636struct omapdss_atv_ops {
637 int (*connect)(struct omap_dss_device *dssdev,
638 struct omap_dss_device *dst);
639 void (*disconnect)(struct omap_dss_device *dssdev,
640 struct omap_dss_device *dst);
641
642 int (*enable)(struct omap_dss_device *dssdev);
643 void (*disable)(struct omap_dss_device *dssdev);
644
645 int (*check_timings)(struct omap_dss_device *dssdev,
646 struct omap_video_timings *timings);
647 void (*set_timings)(struct omap_dss_device *dssdev,
648 struct omap_video_timings *timings);
649 void (*get_timings)(struct omap_dss_device *dssdev,
650 struct omap_video_timings *timings);
651
652 void (*set_type)(struct omap_dss_device *dssdev,
653 enum omap_dss_venc_type type);
654 void (*invert_vid_out_polarity)(struct omap_dss_device *dssdev,
655 bool invert_polarity);
656
657 int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
658 u32 (*get_wss)(struct omap_dss_device *dssdev);
659};
660
661struct omapdss_hdmi_ops {
662 int (*connect)(struct omap_dss_device *dssdev,
663 struct omap_dss_device *dst);
664 void (*disconnect)(struct omap_dss_device *dssdev,
665 struct omap_dss_device *dst);
666
667 int (*enable)(struct omap_dss_device *dssdev);
668 void (*disable)(struct omap_dss_device *dssdev);
669
670 int (*check_timings)(struct omap_dss_device *dssdev,
671 struct omap_video_timings *timings);
672 void (*set_timings)(struct omap_dss_device *dssdev,
673 struct omap_video_timings *timings);
674 void (*get_timings)(struct omap_dss_device *dssdev,
675 struct omap_video_timings *timings);
676
677 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
678 bool (*detect)(struct omap_dss_device *dssdev);
679
680 /*
681 * Note: These functions might sleep. Do not call while
682 * holding a spinlock/readlock.
683 */
684 int (*audio_enable)(struct omap_dss_device *dssdev);
685 void (*audio_disable)(struct omap_dss_device *dssdev);
686 bool (*audio_supported)(struct omap_dss_device *dssdev);
687 int (*audio_config)(struct omap_dss_device *dssdev,
688 struct omap_dss_audio *audio);
689 /* Note: These functions may not sleep */
690 int (*audio_start)(struct omap_dss_device *dssdev);
691 void (*audio_stop)(struct omap_dss_device *dssdev);
692};
693
694struct omapdss_dsi_ops {
695 int (*connect)(struct omap_dss_device *dssdev,
696 struct omap_dss_device *dst);
697 void (*disconnect)(struct omap_dss_device *dssdev,
698 struct omap_dss_device *dst);
699
700 int (*enable)(struct omap_dss_device *dssdev);
701 void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
702 bool enter_ulps);
703
704 /* bus configuration */
705 int (*set_config)(struct omap_dss_device *dssdev,
706 const struct omap_dss_dsi_config *cfg);
707 int (*configure_pins)(struct omap_dss_device *dssdev,
708 const struct omap_dsi_pin_config *pin_cfg);
709
710 void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
711 bool enable);
712 int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
713
714 int (*update)(struct omap_dss_device *dssdev, int channel,
715 void (*callback)(int, void *), void *data);
716
717 void (*bus_lock)(struct omap_dss_device *dssdev);
718 void (*bus_unlock)(struct omap_dss_device *dssdev);
719
720 int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
721 void (*disable_video_output)(struct omap_dss_device *dssdev,
722 int channel);
723
724 int (*request_vc)(struct omap_dss_device *dssdev, int *channel);
725 int (*set_vc_id)(struct omap_dss_device *dssdev, int channel,
726 int vc_id);
727 void (*release_vc)(struct omap_dss_device *dssdev, int channel);
728
729 /* data transfer */
730 int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
731 u8 *data, int len);
732 int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
733 u8 *data, int len);
734 int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
735 u8 *data, int len);
736
737 int (*gen_write)(struct omap_dss_device *dssdev, int channel,
738 u8 *data, int len);
739 int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
740 u8 *data, int len);
741 int (*gen_read)(struct omap_dss_device *dssdev, int channel,
742 u8 *reqdata, int reqlen,
743 u8 *data, int len);
744
745 int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
746
747 int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
748 int channel, u16 plen);
593}; 749};
594 750
595struct omap_dss_device { 751struct omap_dss_device {
596 struct device dev; 752 /* old device, to be removed */
753 struct device old_dev;
754
755 /* new device, pointer to panel device */
756 struct device *dev;
757
758 struct module *owner;
759
760 struct list_head panel_list;
761
762 /* alias in the form of "display%d" */
763 char alias[16];
597 764
598 enum omap_display_type type; 765 enum omap_display_type type;
766 enum omap_display_type output_type;
599 767
600 /* obsolete, to be removed */ 768 /* obsolete, to be removed */
601 enum omap_channel channel; 769 enum omap_channel channel;
@@ -616,9 +784,6 @@ struct omap_dss_device {
616 784
617 struct { 785 struct {
618 int module; 786 int module;
619
620 bool ext_te;
621 u8 ext_te_gpio;
622 } dsi; 787 } dsi;
623 788
624 struct { 789 struct {
@@ -639,10 +804,6 @@ struct omap_dss_device {
639 struct rfbi_timings rfbi_timings; 804 struct rfbi_timings rfbi_timings;
640 } ctrl; 805 } ctrl;
641 806
642 int reset_gpio;
643
644 int max_backlight_level;
645
646 const char *name; 807 const char *name;
647 808
648 /* used to match device to driver */ 809 /* used to match device to driver */
@@ -652,22 +813,40 @@ struct omap_dss_device {
652 813
653 struct omap_dss_driver *driver; 814 struct omap_dss_driver *driver;
654 815
816 union {
817 const struct omapdss_dpi_ops *dpi;
818 const struct omapdss_sdi_ops *sdi;
819 const struct omapdss_dvi_ops *dvi;
820 const struct omapdss_hdmi_ops *hdmi;
821 const struct omapdss_atv_ops *atv;
822 const struct omapdss_dsi_ops *dsi;
823 } ops;
824
655 /* helper variable for driver suspend/resume */ 825 /* helper variable for driver suspend/resume */
656 bool activate_after_resume; 826 bool activate_after_resume;
657 827
658 enum omap_display_caps caps; 828 enum omap_display_caps caps;
659 829
660 struct omap_dss_output *output; 830 struct omap_dss_device *output;
661 831
662 enum omap_dss_display_state state; 832 enum omap_dss_display_state state;
663 833
664 enum omap_dss_audio_state audio_state; 834 enum omap_dss_audio_state audio_state;
665 835
666 /* platform specific */ 836 /* OMAP DSS output specific fields */
667 int (*platform_enable)(struct omap_dss_device *dssdev); 837
668 void (*platform_disable)(struct omap_dss_device *dssdev); 838 struct list_head list;
669 int (*set_backlight)(struct omap_dss_device *dssdev, int level); 839
670 int (*get_backlight)(struct omap_dss_device *dssdev); 840 /* DISPC channel for this output */
841 enum omap_channel dispc_channel;
842
843 /* output instance */
844 enum omap_dss_output_id id;
845
846 /* dynamic fields */
847 struct omap_overlay_manager *manager;
848
849 struct omap_dss_device *device;
671}; 850};
672 851
673struct omap_dss_hdmi_data 852struct omap_dss_hdmi_data
@@ -677,17 +856,15 @@ struct omap_dss_hdmi_data
677 int hpd_gpio; 856 int hpd_gpio;
678}; 857};
679 858
680struct omap_dss_audio {
681 struct snd_aes_iec958 *iec;
682 struct snd_cea_861_aud_if *cea;
683};
684
685struct omap_dss_driver { 859struct omap_dss_driver {
686 struct device_driver driver; 860 struct device_driver driver;
687 861
688 int (*probe)(struct omap_dss_device *); 862 int (*probe)(struct omap_dss_device *);
689 void (*remove)(struct omap_dss_device *); 863 void (*remove)(struct omap_dss_device *);
690 864
865 int (*connect)(struct omap_dss_device *dssdev);
866 void (*disconnect)(struct omap_dss_device *dssdev);
867
691 int (*enable)(struct omap_dss_device *display); 868 int (*enable)(struct omap_dss_device *display);
692 void (*disable)(struct omap_dss_device *display); 869 void (*disable)(struct omap_dss_device *display);
693 int (*run_test)(struct omap_dss_device *display, int test); 870 int (*run_test)(struct omap_dss_device *display, int test);
@@ -753,7 +930,10 @@ bool omapdss_is_initialized(void);
753int omap_dss_register_driver(struct omap_dss_driver *); 930int omap_dss_register_driver(struct omap_dss_driver *);
754void omap_dss_unregister_driver(struct omap_dss_driver *); 931void omap_dss_unregister_driver(struct omap_dss_driver *);
755 932
756void omap_dss_get_device(struct omap_dss_device *dssdev); 933int omapdss_register_display(struct omap_dss_device *dssdev);
934void omapdss_unregister_display(struct omap_dss_device *dssdev);
935
936struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
757void omap_dss_put_device(struct omap_dss_device *dssdev); 937void omap_dss_put_device(struct omap_dss_device *dssdev);
758#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL) 938#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
759struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from); 939struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
@@ -761,8 +941,10 @@ struct omap_dss_device *omap_dss_find_device(void *data,
761 int (*match)(struct omap_dss_device *dssdev, void *data)); 941 int (*match)(struct omap_dss_device *dssdev, void *data));
762const char *omapdss_get_default_display_name(void); 942const char *omapdss_get_default_display_name(void);
763 943
764int omap_dss_start_device(struct omap_dss_device *dssdev); 944void videomode_to_omap_video_timings(const struct videomode *vm,
765void omap_dss_stop_device(struct omap_dss_device *dssdev); 945 struct omap_video_timings *ovt);
946void omap_video_timings_to_videomode(const struct omap_video_timings *ovt,
947 struct videomode *vm);
766 948
767int dss_feat_get_num_mgrs(void); 949int dss_feat_get_num_mgrs(void);
768int dss_feat_get_num_ovls(void); 950int dss_feat_get_num_ovls(void);
@@ -778,10 +960,17 @@ struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
778int omap_dss_get_num_overlays(void); 960int omap_dss_get_num_overlays(void);
779struct omap_overlay *omap_dss_get_overlay(int num); 961struct omap_overlay *omap_dss_get_overlay(int num);
780 962
781struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id); 963int omapdss_register_output(struct omap_dss_device *output);
782int omapdss_output_set_device(struct omap_dss_output *out, 964void omapdss_unregister_output(struct omap_dss_device *output);
965struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id);
966struct omap_dss_device *omap_dss_find_output(const char *name);
967struct omap_dss_device *omap_dss_find_output_by_node(struct device_node *node);
968int omapdss_output_set_device(struct omap_dss_device *out,
783 struct omap_dss_device *dssdev); 969 struct omap_dss_device *dssdev);
784int omapdss_output_unset_device(struct omap_dss_output *out); 970int omapdss_output_unset_device(struct omap_dss_device *out);
971
972struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev);
973struct omap_overlay_manager *omapdss_find_mgr_from_display(struct omap_dss_device *dssdev);
785 974
786void omapdss_default_get_resolution(struct omap_dss_device *dssdev, 975void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
787 u16 *xres, u16 *yres); 976 u16 *xres, u16 *yres);
@@ -832,7 +1021,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
832 bool mem_to_mem); 1021 bool mem_to_mem);
833 1022
834#define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver) 1023#define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver)
835#define to_dss_device(x) container_of((x), struct omap_dss_device, dev) 1024#define to_dss_device(x) container_of((x), struct omap_dss_device, old_dev)
836 1025
837void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel, 1026void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
838 bool enable); 1027 bool enable);
@@ -883,6 +1072,11 @@ int omapdss_compat_init(void);
883void omapdss_compat_uninit(void); 1072void omapdss_compat_uninit(void);
884 1073
885struct dss_mgr_ops { 1074struct dss_mgr_ops {
1075 int (*connect)(struct omap_overlay_manager *mgr,
1076 struct omap_dss_device *dst);
1077 void (*disconnect)(struct omap_overlay_manager *mgr,
1078 struct omap_dss_device *dst);
1079
886 void (*start_update)(struct omap_overlay_manager *mgr); 1080 void (*start_update)(struct omap_overlay_manager *mgr);
887 int (*enable)(struct omap_overlay_manager *mgr); 1081 int (*enable)(struct omap_overlay_manager *mgr);
888 void (*disable)(struct omap_overlay_manager *mgr); 1082 void (*disable)(struct omap_overlay_manager *mgr);
@@ -899,6 +1093,10 @@ struct dss_mgr_ops {
899int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops); 1093int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops);
900void dss_uninstall_mgr_ops(void); 1094void dss_uninstall_mgr_ops(void);
901 1095
1096int dss_mgr_connect(struct omap_overlay_manager *mgr,
1097 struct omap_dss_device *dst);
1098void dss_mgr_disconnect(struct omap_overlay_manager *mgr,
1099 struct omap_dss_device *dst);
902void dss_mgr_set_timings(struct omap_overlay_manager *mgr, 1100void dss_mgr_set_timings(struct omap_overlay_manager *mgr,
903 const struct omap_video_timings *timings); 1101 const struct omap_video_timings *timings);
904void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr, 1102void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr,
@@ -910,4 +1108,15 @@ int dss_mgr_register_framedone_handler(struct omap_overlay_manager *mgr,
910 void (*handler)(void *), void *data); 1108 void (*handler)(void *), void *data);
911void dss_mgr_unregister_framedone_handler(struct omap_overlay_manager *mgr, 1109void dss_mgr_unregister_framedone_handler(struct omap_overlay_manager *mgr,
912 void (*handler)(void *), void *data); 1110 void (*handler)(void *), void *data);
1111
1112static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
1113{
1114 return dssdev->output;
1115}
1116
1117static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
1118{
1119 return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
1120}
1121
913#endif 1122#endif