aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorArchit Taneja <archit@ti.com>2014-05-22 07:31:57 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-11-12 06:40:01 -0500
commit387ce9f2f2bd78436538deab9ece94512e362deb (patch)
tree47518c74b682b67b3e1c98db97569ff2917d4314 /drivers/video
parent80eb6751b7cde41cee766230fe07d982d13c1486 (diff)
OMAPDSS: DSS: init dss ports cleanly
The init/uninit port functions are used to set up the DPI and SDI outputs under the dss platform device. A 'reg' property is used to determine the port number of the output. This tells us whether the port is DPI or SDI for OMAP34xx DSS revision. For other DSS revisions, we only have DPI outputs under the dss platform device. For multiple DPI output instances(introduced in DRA7xx DSS), we will use the the port number to specify which DPI output instance is being inited. The current functions work fine if there is only one DPI output instance in DSS. For multiple DPI instances, it would get complicated to figure out whether port number was used to specify whether the output is SDI, or another DPI instance. We create a list of port types supported for each DSS rev, with the index of the port in the list specifying the port number of the output for that DSS revision. This allows us to have a more generic way to init/uninit ports within DSS, and also support multiple DPI ports. We make the uninit_port functions iterative since we will have multiple DPI ports to uninit in the future. Signed-off-by: Archit Taneja <archit@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/omap2/dss/dss.c82
-rw-r--r--drivers/video/fbdev/omap2/dss/dss.h24
-rw-r--r--drivers/video/fbdev/omap2/dss/sdi.c2
3 files changed, 92 insertions, 16 deletions
diff --git a/drivers/video/fbdev/omap2/dss/dss.c b/drivers/video/fbdev/omap2/dss/dss.c
index 391a6da55e8d..7e86b8a78315 100644
--- a/drivers/video/fbdev/omap2/dss/dss.c
+++ b/drivers/video/fbdev/omap2/dss/dss.c
@@ -70,6 +70,8 @@ struct dss_features {
70 u8 fck_div_max; 70 u8 fck_div_max;
71 u8 dss_fck_multiplier; 71 u8 dss_fck_multiplier;
72 const char *parent_clk_name; 72 const char *parent_clk_name;
73 enum omap_display_type *ports;
74 int num_ports;
73 int (*dpi_select_source)(enum omap_channel channel); 75 int (*dpi_select_source)(enum omap_channel channel);
74}; 76};
75 77
@@ -689,6 +691,16 @@ void dss_debug_dump_clocks(struct seq_file *s)
689} 691}
690#endif 692#endif
691 693
694
695static enum omap_display_type omap2plus_ports[] = {
696 OMAP_DISPLAY_TYPE_DPI,
697};
698
699static enum omap_display_type omap34xx_ports[] = {
700 OMAP_DISPLAY_TYPE_DPI,
701 OMAP_DISPLAY_TYPE_SDI,
702};
703
692static const struct dss_features omap24xx_dss_feats __initconst = { 704static const struct dss_features omap24xx_dss_feats __initconst = {
693 /* 705 /*
694 * fck div max is really 16, but the divider range has gaps. The range 706 * fck div max is really 16, but the divider range has gaps. The range
@@ -698,6 +710,8 @@ static const struct dss_features omap24xx_dss_feats __initconst = {
698 .dss_fck_multiplier = 2, 710 .dss_fck_multiplier = 2,
699 .parent_clk_name = "core_ck", 711 .parent_clk_name = "core_ck",
700 .dpi_select_source = &dss_dpi_select_source_omap2_omap3, 712 .dpi_select_source = &dss_dpi_select_source_omap2_omap3,
713 .ports = omap2plus_ports,
714 .num_ports = ARRAY_SIZE(omap2plus_ports),
701}; 715};
702 716
703static const struct dss_features omap34xx_dss_feats __initconst = { 717static const struct dss_features omap34xx_dss_feats __initconst = {
@@ -705,6 +719,8 @@ static const struct dss_features omap34xx_dss_feats __initconst = {
705 .dss_fck_multiplier = 2, 719 .dss_fck_multiplier = 2,
706 .parent_clk_name = "dpll4_ck", 720 .parent_clk_name = "dpll4_ck",
707 .dpi_select_source = &dss_dpi_select_source_omap2_omap3, 721 .dpi_select_source = &dss_dpi_select_source_omap2_omap3,
722 .ports = omap34xx_ports,
723 .num_ports = ARRAY_SIZE(omap34xx_ports),
708}; 724};
709 725
710static const struct dss_features omap3630_dss_feats __initconst = { 726static const struct dss_features omap3630_dss_feats __initconst = {
@@ -712,6 +728,8 @@ static const struct dss_features omap3630_dss_feats __initconst = {
712 .dss_fck_multiplier = 1, 728 .dss_fck_multiplier = 1,
713 .parent_clk_name = "dpll4_ck", 729 .parent_clk_name = "dpll4_ck",
714 .dpi_select_source = &dss_dpi_select_source_omap2_omap3, 730 .dpi_select_source = &dss_dpi_select_source_omap2_omap3,
731 .ports = omap2plus_ports,
732 .num_ports = ARRAY_SIZE(omap2plus_ports),
715}; 733};
716 734
717static const struct dss_features omap44xx_dss_feats __initconst = { 735static const struct dss_features omap44xx_dss_feats __initconst = {
@@ -719,6 +737,8 @@ static const struct dss_features omap44xx_dss_feats __initconst = {
719 .dss_fck_multiplier = 1, 737 .dss_fck_multiplier = 1,
720 .parent_clk_name = "dpll_per_x2_ck", 738 .parent_clk_name = "dpll_per_x2_ck",
721 .dpi_select_source = &dss_dpi_select_source_omap4, 739 .dpi_select_source = &dss_dpi_select_source_omap4,
740 .ports = omap2plus_ports,
741 .num_ports = ARRAY_SIZE(omap2plus_ports),
722}; 742};
723 743
724static const struct dss_features omap54xx_dss_feats __initconst = { 744static const struct dss_features omap54xx_dss_feats __initconst = {
@@ -726,6 +746,8 @@ static const struct dss_features omap54xx_dss_feats __initconst = {
726 .dss_fck_multiplier = 1, 746 .dss_fck_multiplier = 1,
727 .parent_clk_name = "dpll_per_x2_ck", 747 .parent_clk_name = "dpll_per_x2_ck",
728 .dpi_select_source = &dss_dpi_select_source_omap5, 748 .dpi_select_source = &dss_dpi_select_source_omap5,
749 .ports = omap2plus_ports,
750 .num_ports = ARRAY_SIZE(omap2plus_ports),
729}; 751};
730 752
731static const struct dss_features am43xx_dss_feats __initconst = { 753static const struct dss_features am43xx_dss_feats __initconst = {
@@ -733,6 +755,8 @@ static const struct dss_features am43xx_dss_feats __initconst = {
733 .dss_fck_multiplier = 0, 755 .dss_fck_multiplier = 0,
734 .parent_clk_name = NULL, 756 .parent_clk_name = NULL,
735 .dpi_select_source = &dss_dpi_select_source_omap2_omap3, 757 .dpi_select_source = &dss_dpi_select_source_omap2_omap3,
758 .ports = omap2plus_ports,
759 .num_ports = ARRAY_SIZE(omap2plus_ports),
736}; 760};
737 761
738static int __init dss_init_features(struct platform_device *pdev) 762static int __init dss_init_features(struct platform_device *pdev)
@@ -798,23 +822,32 @@ static int __init dss_init_ports(struct platform_device *pdev)
798 if (!port) 822 if (!port)
799 return 0; 823 return 0;
800 824
825 if (dss.feat->num_ports == 0)
826 return 0;
827
801 do { 828 do {
829 enum omap_display_type port_type;
802 u32 reg; 830 u32 reg;
803 831
804 r = of_property_read_u32(port, "reg", &reg); 832 r = of_property_read_u32(port, "reg", &reg);
805 if (r) 833 if (r)
806 reg = 0; 834 reg = 0;
807 835
808#ifdef CONFIG_OMAP2_DSS_DPI 836 if (reg >= dss.feat->num_ports)
809 if (reg == 0) 837 continue;
810 dpi_init_port(pdev, port);
811#endif
812 838
813#ifdef CONFIG_OMAP2_DSS_SDI 839 port_type = dss.feat->ports[reg];
814 if (reg == 1)
815 sdi_init_port(pdev, port);
816#endif
817 840
841 switch (port_type) {
842 case OMAP_DISPLAY_TYPE_DPI:
843 dpi_init_port(pdev, port);
844 break;
845 case OMAP_DISPLAY_TYPE_SDI:
846 sdi_init_port(pdev, port);
847 break;
848 default:
849 break;
850 }
818 } while ((port = omapdss_of_get_next_port(parent, port)) != NULL); 851 } while ((port = omapdss_of_get_next_port(parent, port)) != NULL);
819 852
820 return 0; 853 return 0;
@@ -832,13 +865,34 @@ static void __exit dss_uninit_ports(struct platform_device *pdev)
832 if (!port) 865 if (!port)
833 return; 866 return;
834 867
835#ifdef CONFIG_OMAP2_DSS_DPI 868 if (dss.feat->num_ports == 0)
836 dpi_uninit_port(port); 869 return;
837#endif
838 870
839#ifdef CONFIG_OMAP2_DSS_SDI 871 do {
840 sdi_uninit_port(); 872 enum omap_display_type port_type;
841#endif 873 u32 reg;
874 int r;
875
876 r = of_property_read_u32(port, "reg", &reg);
877 if (r)
878 reg = 0;
879
880 if (reg >= dss.feat->num_ports)
881 continue;
882
883 port_type = dss.feat->ports[reg];
884
885 switch (port_type) {
886 case OMAP_DISPLAY_TYPE_DPI:
887 dpi_uninit_port(port);
888 break;
889 case OMAP_DISPLAY_TYPE_SDI:
890 sdi_uninit_port(port);
891 break;
892 default:
893 break;
894 }
895 } while ((port = omapdss_of_get_next_port(parent, port)) != NULL);
842} 896}
843 897
844/* DSS HW IP initialisation */ 898/* DSS HW IP initialisation */
diff --git a/drivers/video/fbdev/omap2/dss/dss.h b/drivers/video/fbdev/omap2/dss/dss.h
index 5b9db95533bd..da4de14aaf17 100644
--- a/drivers/video/fbdev/omap2/dss/dss.h
+++ b/drivers/video/fbdev/omap2/dss/dss.h
@@ -244,8 +244,19 @@ bool dss_div_calc(unsigned long pck, unsigned long fck_min,
244int sdi_init_platform_driver(void) __init; 244int sdi_init_platform_driver(void) __init;
245void sdi_uninit_platform_driver(void) __exit; 245void sdi_uninit_platform_driver(void) __exit;
246 246
247#ifdef CONFIG_OMAP2_DSS_SDI
247int sdi_init_port(struct platform_device *pdev, struct device_node *port) __init; 248int sdi_init_port(struct platform_device *pdev, struct device_node *port) __init;
248void sdi_uninit_port(void) __exit; 249void sdi_uninit_port(struct device_node *port) __exit;
250#else
251static inline int __init sdi_init_port(struct platform_device *pdev,
252 struct device_node *port)
253{
254 return 0;
255}
256static inline void __exit sdi_uninit_port(struct device_node *port)
257{
258}
259#endif
249 260
250/* DSI */ 261/* DSI */
251 262
@@ -358,8 +369,19 @@ static inline bool dsi_pll_calc(struct platform_device *dsidev,
358int dpi_init_platform_driver(void) __init; 369int dpi_init_platform_driver(void) __init;
359void dpi_uninit_platform_driver(void) __exit; 370void dpi_uninit_platform_driver(void) __exit;
360 371
372#ifdef CONFIG_OMAP2_DSS_DPI
361int dpi_init_port(struct platform_device *pdev, struct device_node *port) __init; 373int dpi_init_port(struct platform_device *pdev, struct device_node *port) __init;
362void dpi_uninit_port(struct device_node *port) __exit; 374void dpi_uninit_port(struct device_node *port) __exit;
375#else
376static inline int __init dpi_init_port(struct platform_device *pdev,
377 struct device_node *port)
378{
379 return 0;
380}
381static inline void __exit dpi_uninit_port(struct device_node *port)
382{
383}
384#endif
363 385
364/* DISPC */ 386/* DISPC */
365int dispc_init_platform_driver(void) __init; 387int dispc_init_platform_driver(void) __init;
diff --git a/drivers/video/fbdev/omap2/dss/sdi.c b/drivers/video/fbdev/omap2/dss/sdi.c
index 4c9c46d4ea60..d9b10f27be20 100644
--- a/drivers/video/fbdev/omap2/dss/sdi.c
+++ b/drivers/video/fbdev/omap2/dss/sdi.c
@@ -425,7 +425,7 @@ err_datapairs:
425 return r; 425 return r;
426} 426}
427 427
428void __exit sdi_uninit_port(void) 428void __exit sdi_uninit_port(struct device_node *port)
429{ 429{
430 if (!sdi.port_initialized) 430 if (!sdi.port_initialized)
431 return; 431 return;