dss_features.c 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. /*
  2. * linux/drivers/video/omap2/dss/dss_features.c
  3. *
  4. * Copyright (C) 2010 Texas Instruments
  5. * Author: Archit Taneja <archit@ti.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published by
  9. * the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but WITHOUT
  12. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  14. * more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along with
  17. * this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include <linux/kernel.h>
  20. #include <linux/module.h>
  21. #include <linux/types.h>
  22. #include <linux/err.h>
  23. #include <linux/slab.h>
  24. #include <drm/drm_fourcc.h>
  25. #include "omapdss.h"
  26. #include "dss.h"
  27. #include "dss_features.h"
  28. struct omap_dss_features {
  29. const enum omap_dss_output_id *supported_outputs;
  30. };
  31. /* This struct is assigned to one of the below during initialization */
  32. static const struct omap_dss_features *omap_current_dss_features;
  33. static const enum omap_dss_output_id omap2_dss_supported_outputs[] = {
  34. /* OMAP_DSS_CHANNEL_LCD */
  35. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI,
  36. /* OMAP_DSS_CHANNEL_DIGIT */
  37. OMAP_DSS_OUTPUT_VENC,
  38. };
  39. static const enum omap_dss_output_id omap3430_dss_supported_outputs[] = {
  40. /* OMAP_DSS_CHANNEL_LCD */
  41. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  42. OMAP_DSS_OUTPUT_SDI | OMAP_DSS_OUTPUT_DSI1,
  43. /* OMAP_DSS_CHANNEL_DIGIT */
  44. OMAP_DSS_OUTPUT_VENC,
  45. };
  46. static const enum omap_dss_output_id omap3630_dss_supported_outputs[] = {
  47. /* OMAP_DSS_CHANNEL_LCD */
  48. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  49. OMAP_DSS_OUTPUT_DSI1,
  50. /* OMAP_DSS_CHANNEL_DIGIT */
  51. OMAP_DSS_OUTPUT_VENC,
  52. };
  53. static const enum omap_dss_output_id am43xx_dss_supported_outputs[] = {
  54. /* OMAP_DSS_CHANNEL_LCD */
  55. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI,
  56. };
  57. static const enum omap_dss_output_id omap4_dss_supported_outputs[] = {
  58. /* OMAP_DSS_CHANNEL_LCD */
  59. OMAP_DSS_OUTPUT_DBI | OMAP_DSS_OUTPUT_DSI1,
  60. /* OMAP_DSS_CHANNEL_DIGIT */
  61. OMAP_DSS_OUTPUT_VENC | OMAP_DSS_OUTPUT_HDMI,
  62. /* OMAP_DSS_CHANNEL_LCD2 */
  63. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  64. OMAP_DSS_OUTPUT_DSI2,
  65. };
  66. static const enum omap_dss_output_id omap5_dss_supported_outputs[] = {
  67. /* OMAP_DSS_CHANNEL_LCD */
  68. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  69. OMAP_DSS_OUTPUT_DSI1 | OMAP_DSS_OUTPUT_DSI2,
  70. /* OMAP_DSS_CHANNEL_DIGIT */
  71. OMAP_DSS_OUTPUT_HDMI,
  72. /* OMAP_DSS_CHANNEL_LCD2 */
  73. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  74. OMAP_DSS_OUTPUT_DSI1,
  75. /* OMAP_DSS_CHANNEL_LCD3 */
  76. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  77. OMAP_DSS_OUTPUT_DSI2,
  78. };
  79. /* OMAP2 DSS Features */
  80. static const struct omap_dss_features omap2_dss_features = {
  81. .supported_outputs = omap2_dss_supported_outputs,
  82. };
  83. /* OMAP3 DSS Features */
  84. static const struct omap_dss_features omap3430_dss_features = {
  85. .supported_outputs = omap3430_dss_supported_outputs,
  86. };
  87. /*
  88. * AM35xx DSS Features. This is basically OMAP3 DSS Features without the
  89. * vdds_dsi regulator.
  90. */
  91. static const struct omap_dss_features am35xx_dss_features = {
  92. .supported_outputs = omap3430_dss_supported_outputs,
  93. };
  94. static const struct omap_dss_features am43xx_dss_features = {
  95. .supported_outputs = am43xx_dss_supported_outputs,
  96. };
  97. static const struct omap_dss_features omap3630_dss_features = {
  98. .supported_outputs = omap3630_dss_supported_outputs,
  99. };
  100. /* OMAP4 DSS Features */
  101. /* For OMAP4430 ES 1.0 revision */
  102. static const struct omap_dss_features omap4430_es1_0_dss_features = {
  103. .supported_outputs = omap4_dss_supported_outputs,
  104. };
  105. /* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
  106. static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
  107. .supported_outputs = omap4_dss_supported_outputs,
  108. };
  109. /* For all the other OMAP4 versions */
  110. static const struct omap_dss_features omap4_dss_features = {
  111. .supported_outputs = omap4_dss_supported_outputs,
  112. };
  113. /* OMAP5 DSS Features */
  114. static const struct omap_dss_features omap5_dss_features = {
  115. .supported_outputs = omap5_dss_supported_outputs,
  116. };
  117. enum omap_dss_output_id dss_feat_get_supported_outputs(enum omap_channel channel)
  118. {
  119. return omap_current_dss_features->supported_outputs[channel];
  120. }
  121. void dss_features_init(enum omapdss_version version)
  122. {
  123. switch (version) {
  124. case OMAPDSS_VER_OMAP24xx:
  125. omap_current_dss_features = &omap2_dss_features;
  126. break;
  127. case OMAPDSS_VER_OMAP34xx_ES1:
  128. case OMAPDSS_VER_OMAP34xx_ES3:
  129. omap_current_dss_features = &omap3430_dss_features;
  130. break;
  131. case OMAPDSS_VER_OMAP3630:
  132. omap_current_dss_features = &omap3630_dss_features;
  133. break;
  134. case OMAPDSS_VER_OMAP4430_ES1:
  135. omap_current_dss_features = &omap4430_es1_0_dss_features;
  136. break;
  137. case OMAPDSS_VER_OMAP4430_ES2:
  138. omap_current_dss_features = &omap4430_es2_0_1_2_dss_features;
  139. break;
  140. case OMAPDSS_VER_OMAP4:
  141. omap_current_dss_features = &omap4_dss_features;
  142. break;
  143. case OMAPDSS_VER_OMAP5:
  144. case OMAPDSS_VER_DRA7xx:
  145. omap_current_dss_features = &omap5_dss_features;
  146. break;
  147. case OMAPDSS_VER_AM35xx:
  148. omap_current_dss_features = &am35xx_dss_features;
  149. break;
  150. case OMAPDSS_VER_AM43xx:
  151. omap_current_dss_features = &am43xx_dss_features;
  152. break;
  153. default:
  154. DSSWARN("Unsupported OMAP version");
  155. break;
  156. }
  157. }