aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/omapdrm
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2017-08-04 18:43:56 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2017-08-15 08:18:25 -0400
commitb8dab2bddb5be59e143b41cc4f170ba01a04e117 (patch)
treeb032e36db75c3385f38c63c25d8ae75ccfeeb30e /drivers/gpu/drm/omapdrm
parent7a143a4b116db223d661500f819cfef9b4bbdefa (diff)
drm: omapdrm: dpi: Replace OMAP SoC model checks with DSS model
The DPI code only needs to differentiate between major OMAP revisions, which can be obtained from the DSS compatible string. Replace the OMAP SoC model checks to prepare for removal of the OMAP SoC version platform data. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm')
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dpi.c59
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dss.c10
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dss.h13
3 files changed, 45 insertions, 37 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c
index 2828b1c1f625..857d462b3786 100644
--- a/drivers/gpu/drm/omapdrm/dss/dpi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
@@ -39,6 +39,7 @@
39 39
40struct dpi_data { 40struct dpi_data {
41 struct platform_device *pdev; 41 struct platform_device *pdev;
42 enum dss_model dss_model;
42 43
43 struct regulator *vdds_dsi_reg; 44 struct regulator *vdds_dsi_reg;
44 enum dss_clk_source clk_src; 45 enum dss_clk_source clk_src;
@@ -99,25 +100,21 @@ static enum dss_clk_source dpi_get_clk_src_dra7xx(enum omap_channel channel)
99 return DSS_CLK_SRC_FCK; 100 return DSS_CLK_SRC_FCK;
100} 101}
101 102
102static enum dss_clk_source dpi_get_clk_src(enum omap_channel channel) 103static enum dss_clk_source dpi_get_clk_src(struct dpi_data *dpi)
103{ 104{
105 enum omap_channel channel = dpi->output.dispc_channel;
106
104 /* 107 /*
105 * XXX we can't currently use DSI PLL for DPI with OMAP3, as the DSI PLL 108 * XXX we can't currently use DSI PLL for DPI with OMAP3, as the DSI PLL
106 * would also be used for DISPC fclk. Meaning, when the DPI output is 109 * would also be used for DISPC fclk. Meaning, when the DPI output is
107 * disabled, DISPC clock will be disabled, and TV out will stop. 110 * disabled, DISPC clock will be disabled, and TV out will stop.
108 */ 111 */
109 switch (omapdss_get_version()) { 112 switch (dpi->dss_model) {
110 case OMAPDSS_VER_OMAP24xx: 113 case DSS_MODEL_OMAP2:
111 case OMAPDSS_VER_OMAP34xx_ES1: 114 case DSS_MODEL_OMAP3:
112 case OMAPDSS_VER_OMAP34xx_ES3:
113 case OMAPDSS_VER_OMAP3630:
114 case OMAPDSS_VER_AM35xx:
115 case OMAPDSS_VER_AM43xx:
116 return DSS_CLK_SRC_FCK; 115 return DSS_CLK_SRC_FCK;
117 116
118 case OMAPDSS_VER_OMAP4430_ES1: 117 case DSS_MODEL_OMAP4:
119 case OMAPDSS_VER_OMAP4430_ES2:
120 case OMAPDSS_VER_OMAP4:
121 switch (channel) { 118 switch (channel) {
122 case OMAP_DSS_CHANNEL_LCD: 119 case OMAP_DSS_CHANNEL_LCD:
123 return DSS_CLK_SRC_PLL1_1; 120 return DSS_CLK_SRC_PLL1_1;
@@ -127,7 +124,7 @@ static enum dss_clk_source dpi_get_clk_src(enum omap_channel channel)
127 return DSS_CLK_SRC_FCK; 124 return DSS_CLK_SRC_FCK;
128 } 125 }
129 126
130 case OMAPDSS_VER_OMAP5: 127 case DSS_MODEL_OMAP5:
131 switch (channel) { 128 switch (channel) {
132 case OMAP_DSS_CHANNEL_LCD: 129 case OMAP_DSS_CHANNEL_LCD:
133 return DSS_CLK_SRC_PLL1_1; 130 return DSS_CLK_SRC_PLL1_1;
@@ -138,7 +135,7 @@ static enum dss_clk_source dpi_get_clk_src(enum omap_channel channel)
138 return DSS_CLK_SRC_FCK; 135 return DSS_CLK_SRC_FCK;
139 } 136 }
140 137
141 case OMAPDSS_VER_DRA7xx: 138 case DSS_MODEL_DRA7:
142 return dpi_get_clk_src_dra7xx(channel); 139 return dpi_get_clk_src_dra7xx(channel);
143 140
144 default: 141 default:
@@ -597,7 +594,7 @@ static void dpi_init_pll(struct dpi_data *dpi)
597 if (dpi->pll) 594 if (dpi->pll)
598 return; 595 return;
599 596
600 dpi->clk_src = dpi_get_clk_src(dpi->output.dispc_channel); 597 dpi->clk_src = dpi_get_clk_src(dpi);
601 598
602 pll = dss_pll_find_by_src(dpi->clk_src); 599 pll = dss_pll_find_by_src(dpi->clk_src);
603 if (!pll) 600 if (!pll)
@@ -617,18 +614,14 @@ static void dpi_init_pll(struct dpi_data *dpi)
617 * the channel in some more dynamic manner, or get the channel as a user 614 * the channel in some more dynamic manner, or get the channel as a user
618 * parameter. 615 * parameter.
619 */ 616 */
620static enum omap_channel dpi_get_channel(int port_num) 617static enum omap_channel dpi_get_channel(struct dpi_data *dpi, int port_num)
621{ 618{
622 switch (omapdss_get_version()) { 619 switch (dpi->dss_model) {
623 case OMAPDSS_VER_OMAP24xx: 620 case DSS_MODEL_OMAP2:
624 case OMAPDSS_VER_OMAP34xx_ES1: 621 case DSS_MODEL_OMAP3:
625 case OMAPDSS_VER_OMAP34xx_ES3:
626 case OMAPDSS_VER_OMAP3630:
627 case OMAPDSS_VER_AM35xx:
628 case OMAPDSS_VER_AM43xx:
629 return OMAP_DSS_CHANNEL_LCD; 622 return OMAP_DSS_CHANNEL_LCD;
630 623
631 case OMAPDSS_VER_DRA7xx: 624 case DSS_MODEL_DRA7:
632 switch (port_num) { 625 switch (port_num) {
633 case 2: 626 case 2:
634 return OMAP_DSS_CHANNEL_LCD3; 627 return OMAP_DSS_CHANNEL_LCD3;
@@ -639,12 +632,10 @@ static enum omap_channel dpi_get_channel(int port_num)
639 return OMAP_DSS_CHANNEL_LCD; 632 return OMAP_DSS_CHANNEL_LCD;
640 } 633 }
641 634
642 case OMAPDSS_VER_OMAP4430_ES1: 635 case DSS_MODEL_OMAP4:
643 case OMAPDSS_VER_OMAP4430_ES2:
644 case OMAPDSS_VER_OMAP4:
645 return OMAP_DSS_CHANNEL_LCD2; 636 return OMAP_DSS_CHANNEL_LCD2;
646 637
647 case OMAPDSS_VER_OMAP5: 638 case DSS_MODEL_OMAP5:
648 return OMAP_DSS_CHANNEL_LCD3; 639 return OMAP_DSS_CHANNEL_LCD3;
649 640
650 default: 641 default:
@@ -709,10 +700,8 @@ static const struct omapdss_dpi_ops dpi_ops = {
709 .get_timings = dpi_get_timings, 700 .get_timings = dpi_get_timings,
710}; 701};
711 702
712static void dpi_init_output_port(struct platform_device *pdev, 703static void dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
713 struct device_node *port)
714{ 704{
715 struct dpi_data *dpi = port->data;
716 struct omap_dss_device *out = &dpi->output; 705 struct omap_dss_device *out = &dpi->output;
717 int r; 706 int r;
718 u32 port_num; 707 u32 port_num;
@@ -734,10 +723,10 @@ static void dpi_init_output_port(struct platform_device *pdev,
734 break; 723 break;
735 } 724 }
736 725
737 out->dev = &pdev->dev; 726 out->dev = &dpi->pdev->dev;
738 out->id = OMAP_DSS_OUTPUT_DPI; 727 out->id = OMAP_DSS_OUTPUT_DPI;
739 out->output_type = OMAP_DISPLAY_TYPE_DPI; 728 out->output_type = OMAP_DISPLAY_TYPE_DPI;
740 out->dispc_channel = dpi_get_channel(port_num); 729 out->dispc_channel = dpi_get_channel(dpi, port_num);
741 out->port_num = port_num; 730 out->port_num = port_num;
742 out->ops.dpi = &dpi_ops; 731 out->ops.dpi = &dpi_ops;
743 out->owner = THIS_MODULE; 732 out->owner = THIS_MODULE;
@@ -753,7 +742,8 @@ static void dpi_uninit_output_port(struct device_node *port)
753 omapdss_unregister_output(out); 742 omapdss_unregister_output(out);
754} 743}
755 744
756int dpi_init_port(struct platform_device *pdev, struct device_node *port) 745int dpi_init_port(struct platform_device *pdev, struct device_node *port,
746 enum dss_model dss_model)
757{ 747{
758 struct dpi_data *dpi; 748 struct dpi_data *dpi;
759 struct device_node *ep; 749 struct device_node *ep;
@@ -779,11 +769,12 @@ int dpi_init_port(struct platform_device *pdev, struct device_node *port)
779 of_node_put(ep); 769 of_node_put(ep);
780 770
781 dpi->pdev = pdev; 771 dpi->pdev = pdev;
772 dpi->dss_model = dss_model;
782 port->data = dpi; 773 port->data = dpi;
783 774
784 mutex_init(&dpi->lock); 775 mutex_init(&dpi->lock);
785 776
786 dpi_init_output_port(pdev, port); 777 dpi_init_output_port(dpi, port);
787 778
788 dpi->port_initialized = true; 779 dpi->port_initialized = true;
789 780
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index b8a2f92efcba..7be69b1d535a 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -76,6 +76,7 @@ struct dss_ops {
76}; 76};
77 77
78struct dss_features { 78struct dss_features {
79 enum dss_model model;
79 u8 fck_div_max; 80 u8 fck_div_max;
80 u8 dss_fck_multiplier; 81 u8 dss_fck_multiplier;
81 const char *parent_clk_name; 82 const char *parent_clk_name;
@@ -932,6 +933,7 @@ static const enum omap_display_type dra7xx_ports[] = {
932}; 933};
933 934
934static const struct dss_features omap24xx_dss_feats = { 935static const struct dss_features omap24xx_dss_feats = {
936 .model = DSS_MODEL_OMAP2,
935 /* 937 /*
936 * fck div max is really 16, but the divider range has gaps. The range 938 * fck div max is really 16, but the divider range has gaps. The range
937 * from 1 to 6 has no gaps, so let's use that as a max. 939 * from 1 to 6 has no gaps, so let's use that as a max.
@@ -945,6 +947,7 @@ static const struct dss_features omap24xx_dss_feats = {
945}; 947};
946 948
947static const struct dss_features omap34xx_dss_feats = { 949static const struct dss_features omap34xx_dss_feats = {
950 .model = DSS_MODEL_OMAP3,
948 .fck_div_max = 16, 951 .fck_div_max = 16,
949 .dss_fck_multiplier = 2, 952 .dss_fck_multiplier = 2,
950 .parent_clk_name = "dpll4_ck", 953 .parent_clk_name = "dpll4_ck",
@@ -954,6 +957,7 @@ static const struct dss_features omap34xx_dss_feats = {
954}; 957};
955 958
956static const struct dss_features omap3630_dss_feats = { 959static const struct dss_features omap3630_dss_feats = {
960 .model = DSS_MODEL_OMAP3,
957 .fck_div_max = 32, 961 .fck_div_max = 32,
958 .dss_fck_multiplier = 1, 962 .dss_fck_multiplier = 1,
959 .parent_clk_name = "dpll4_ck", 963 .parent_clk_name = "dpll4_ck",
@@ -963,6 +967,7 @@ static const struct dss_features omap3630_dss_feats = {
963}; 967};
964 968
965static const struct dss_features omap44xx_dss_feats = { 969static const struct dss_features omap44xx_dss_feats = {
970 .model = DSS_MODEL_OMAP4,
966 .fck_div_max = 32, 971 .fck_div_max = 32,
967 .dss_fck_multiplier = 1, 972 .dss_fck_multiplier = 1,
968 .parent_clk_name = "dpll_per_x2_ck", 973 .parent_clk_name = "dpll_per_x2_ck",
@@ -972,6 +977,7 @@ static const struct dss_features omap44xx_dss_feats = {
972}; 977};
973 978
974static const struct dss_features omap54xx_dss_feats = { 979static const struct dss_features omap54xx_dss_feats = {
980 .model = DSS_MODEL_OMAP5,
975 .fck_div_max = 64, 981 .fck_div_max = 64,
976 .dss_fck_multiplier = 1, 982 .dss_fck_multiplier = 1,
977 .parent_clk_name = "dpll_per_x2_ck", 983 .parent_clk_name = "dpll_per_x2_ck",
@@ -981,6 +987,7 @@ static const struct dss_features omap54xx_dss_feats = {
981}; 987};
982 988
983static const struct dss_features am43xx_dss_feats = { 989static const struct dss_features am43xx_dss_feats = {
990 .model = DSS_MODEL_OMAP3,
984 .fck_div_max = 0, 991 .fck_div_max = 0,
985 .dss_fck_multiplier = 0, 992 .dss_fck_multiplier = 0,
986 .parent_clk_name = NULL, 993 .parent_clk_name = NULL,
@@ -990,6 +997,7 @@ static const struct dss_features am43xx_dss_feats = {
990}; 997};
991 998
992static const struct dss_features dra7xx_dss_feats = { 999static const struct dss_features dra7xx_dss_feats = {
1000 .model = DSS_MODEL_DRA7,
993 .fck_div_max = 64, 1001 .fck_div_max = 64,
994 .dss_fck_multiplier = 1, 1002 .dss_fck_multiplier = 1,
995 .parent_clk_name = "dpll_per_x2_ck", 1003 .parent_clk_name = "dpll_per_x2_ck",
@@ -1065,7 +1073,7 @@ static int dss_init_ports(struct platform_device *pdev)
1065 1073
1066 switch (dss.feat->ports[i]) { 1074 switch (dss.feat->ports[i]) {
1067 case OMAP_DISPLAY_TYPE_DPI: 1075 case OMAP_DISPLAY_TYPE_DPI:
1068 dpi_init_port(pdev, port); 1076 dpi_init_port(pdev, port, dss.feat->model);
1069 break; 1077 break;
1070 case OMAP_DISPLAY_TYPE_SDI: 1078 case OMAP_DISPLAY_TYPE_SDI:
1071 sdi_init_port(pdev, port); 1079 sdi_init_port(pdev, port);
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
index 136977cb1aeb..0d595a2ee200 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.h
+++ b/drivers/gpu/drm/omapdrm/dss/dss.h
@@ -72,6 +72,14 @@
72#define FLD_MOD(orig, val, start, end) \ 72#define FLD_MOD(orig, val, start, end) \
73 (((orig) & ~FLD_MASK(start, end)) | FLD_VAL(val, start, end)) 73 (((orig) & ~FLD_MASK(start, end)) | FLD_VAL(val, start, end))
74 74
75enum dss_model {
76 DSS_MODEL_OMAP2,
77 DSS_MODEL_OMAP3,
78 DSS_MODEL_OMAP4,
79 DSS_MODEL_OMAP5,
80 DSS_MODEL_DRA7,
81};
82
75enum dss_io_pad_mode { 83enum dss_io_pad_mode {
76 DSS_IO_PAD_MODE_RESET, 84 DSS_IO_PAD_MODE_RESET,
77 DSS_IO_PAD_MODE_RFBI, 85 DSS_IO_PAD_MODE_RFBI,
@@ -315,11 +323,12 @@ void dsi_irq_handler(void);
315 323
316/* DPI */ 324/* DPI */
317#ifdef CONFIG_OMAP2_DSS_DPI 325#ifdef CONFIG_OMAP2_DSS_DPI
318int dpi_init_port(struct platform_device *pdev, struct device_node *port); 326int dpi_init_port(struct platform_device *pdev, struct device_node *port,
327 enum dss_model dss_model);
319void dpi_uninit_port(struct device_node *port); 328void dpi_uninit_port(struct device_node *port);
320#else 329#else
321static inline int dpi_init_port(struct platform_device *pdev, 330static inline int dpi_init_port(struct platform_device *pdev,
322 struct device_node *port) 331 struct device_node *port, enum dss_model dss_model)
323{ 332{
324 return 0; 333 return 0;
325} 334}