dss_features.c 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962
  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 <video/omapdss.h>
  25. #include "dss.h"
  26. #include "dss_features.h"
  27. /* Defines a generic omap register field */
  28. struct dss_reg_field {
  29. u8 start, end;
  30. };
  31. struct dss_param_range {
  32. int min, max;
  33. };
  34. struct omap_dss_features {
  35. const struct dss_reg_field *reg_fields;
  36. const int num_reg_fields;
  37. const enum dss_feat_id *features;
  38. const int num_features;
  39. const int num_mgrs;
  40. const int num_ovls;
  41. const int num_wbs;
  42. const enum omap_display_type *supported_displays;
  43. const enum omap_dss_output_id *supported_outputs;
  44. const enum omap_color_mode *supported_color_modes;
  45. const enum omap_overlay_caps *overlay_caps;
  46. const char * const *clksrc_names;
  47. const struct dss_param_range *dss_params;
  48. const enum omap_dss_rotation_type supported_rotation_types;
  49. const u32 buffer_size_unit;
  50. const u32 burst_size_unit;
  51. };
  52. /* This struct is assigned to one of the below during initialization */
  53. static const struct omap_dss_features *omap_current_dss_features;
  54. static const struct dss_reg_field omap2_dss_reg_fields[] = {
  55. [FEAT_REG_FIRHINC] = { 11, 0 },
  56. [FEAT_REG_FIRVINC] = { 27, 16 },
  57. [FEAT_REG_FIFOLOWTHRESHOLD] = { 8, 0 },
  58. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 24, 16 },
  59. [FEAT_REG_FIFOSIZE] = { 8, 0 },
  60. [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
  61. [FEAT_REG_VERTICALACCU] = { 25, 16 },
  62. [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
  63. };
  64. static const struct dss_reg_field omap3_dss_reg_fields[] = {
  65. [FEAT_REG_FIRHINC] = { 12, 0 },
  66. [FEAT_REG_FIRVINC] = { 28, 16 },
  67. [FEAT_REG_FIFOLOWTHRESHOLD] = { 11, 0 },
  68. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 27, 16 },
  69. [FEAT_REG_FIFOSIZE] = { 10, 0 },
  70. [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
  71. [FEAT_REG_VERTICALACCU] = { 25, 16 },
  72. [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
  73. };
  74. static const struct dss_reg_field am43xx_dss_reg_fields[] = {
  75. [FEAT_REG_FIRHINC] = { 12, 0 },
  76. [FEAT_REG_FIRVINC] = { 28, 16 },
  77. [FEAT_REG_FIFOLOWTHRESHOLD] = { 11, 0 },
  78. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 27, 16 },
  79. [FEAT_REG_FIFOSIZE] = { 10, 0 },
  80. [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
  81. [FEAT_REG_VERTICALACCU] = { 25, 16 },
  82. [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
  83. };
  84. static const struct dss_reg_field omap4_dss_reg_fields[] = {
  85. [FEAT_REG_FIRHINC] = { 12, 0 },
  86. [FEAT_REG_FIRVINC] = { 28, 16 },
  87. [FEAT_REG_FIFOLOWTHRESHOLD] = { 15, 0 },
  88. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 31, 16 },
  89. [FEAT_REG_FIFOSIZE] = { 15, 0 },
  90. [FEAT_REG_HORIZONTALACCU] = { 10, 0 },
  91. [FEAT_REG_VERTICALACCU] = { 26, 16 },
  92. [FEAT_REG_DISPC_CLK_SWITCH] = { 9, 8 },
  93. };
  94. static const struct dss_reg_field omap5_dss_reg_fields[] = {
  95. [FEAT_REG_FIRHINC] = { 12, 0 },
  96. [FEAT_REG_FIRVINC] = { 28, 16 },
  97. [FEAT_REG_FIFOLOWTHRESHOLD] = { 15, 0 },
  98. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 31, 16 },
  99. [FEAT_REG_FIFOSIZE] = { 15, 0 },
  100. [FEAT_REG_HORIZONTALACCU] = { 10, 0 },
  101. [FEAT_REG_VERTICALACCU] = { 26, 16 },
  102. [FEAT_REG_DISPC_CLK_SWITCH] = { 9, 7 },
  103. };
  104. static const enum omap_display_type omap2_dss_supported_displays[] = {
  105. /* OMAP_DSS_CHANNEL_LCD */
  106. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI,
  107. /* OMAP_DSS_CHANNEL_DIGIT */
  108. OMAP_DISPLAY_TYPE_VENC,
  109. };
  110. static const enum omap_display_type omap3430_dss_supported_displays[] = {
  111. /* OMAP_DSS_CHANNEL_LCD */
  112. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
  113. OMAP_DISPLAY_TYPE_SDI | OMAP_DISPLAY_TYPE_DSI,
  114. /* OMAP_DSS_CHANNEL_DIGIT */
  115. OMAP_DISPLAY_TYPE_VENC,
  116. };
  117. static const enum omap_display_type omap3630_dss_supported_displays[] = {
  118. /* OMAP_DSS_CHANNEL_LCD */
  119. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
  120. OMAP_DISPLAY_TYPE_DSI,
  121. /* OMAP_DSS_CHANNEL_DIGIT */
  122. OMAP_DISPLAY_TYPE_VENC,
  123. };
  124. static const enum omap_display_type am43xx_dss_supported_displays[] = {
  125. /* OMAP_DSS_CHANNEL_LCD */
  126. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI,
  127. };
  128. static const enum omap_display_type omap4_dss_supported_displays[] = {
  129. /* OMAP_DSS_CHANNEL_LCD */
  130. OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI,
  131. /* OMAP_DSS_CHANNEL_DIGIT */
  132. OMAP_DISPLAY_TYPE_VENC | OMAP_DISPLAY_TYPE_HDMI,
  133. /* OMAP_DSS_CHANNEL_LCD2 */
  134. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
  135. OMAP_DISPLAY_TYPE_DSI,
  136. };
  137. static const enum omap_display_type omap5_dss_supported_displays[] = {
  138. /* OMAP_DSS_CHANNEL_LCD */
  139. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
  140. OMAP_DISPLAY_TYPE_DSI,
  141. /* OMAP_DSS_CHANNEL_DIGIT */
  142. OMAP_DISPLAY_TYPE_HDMI | OMAP_DISPLAY_TYPE_DPI,
  143. /* OMAP_DSS_CHANNEL_LCD2 */
  144. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
  145. OMAP_DISPLAY_TYPE_DSI,
  146. };
  147. static const enum omap_dss_output_id omap2_dss_supported_outputs[] = {
  148. /* OMAP_DSS_CHANNEL_LCD */
  149. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI,
  150. /* OMAP_DSS_CHANNEL_DIGIT */
  151. OMAP_DSS_OUTPUT_VENC,
  152. };
  153. static const enum omap_dss_output_id omap3430_dss_supported_outputs[] = {
  154. /* OMAP_DSS_CHANNEL_LCD */
  155. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  156. OMAP_DSS_OUTPUT_SDI | OMAP_DSS_OUTPUT_DSI1,
  157. /* OMAP_DSS_CHANNEL_DIGIT */
  158. OMAP_DSS_OUTPUT_VENC,
  159. };
  160. static const enum omap_dss_output_id omap3630_dss_supported_outputs[] = {
  161. /* OMAP_DSS_CHANNEL_LCD */
  162. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  163. OMAP_DSS_OUTPUT_DSI1,
  164. /* OMAP_DSS_CHANNEL_DIGIT */
  165. OMAP_DSS_OUTPUT_VENC,
  166. };
  167. static const enum omap_dss_output_id am43xx_dss_supported_outputs[] = {
  168. /* OMAP_DSS_CHANNEL_LCD */
  169. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI,
  170. };
  171. static const enum omap_dss_output_id omap4_dss_supported_outputs[] = {
  172. /* OMAP_DSS_CHANNEL_LCD */
  173. OMAP_DSS_OUTPUT_DBI | OMAP_DSS_OUTPUT_DSI1,
  174. /* OMAP_DSS_CHANNEL_DIGIT */
  175. OMAP_DSS_OUTPUT_VENC | OMAP_DSS_OUTPUT_HDMI,
  176. /* OMAP_DSS_CHANNEL_LCD2 */
  177. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  178. OMAP_DSS_OUTPUT_DSI2,
  179. };
  180. static const enum omap_dss_output_id omap5_dss_supported_outputs[] = {
  181. /* OMAP_DSS_CHANNEL_LCD */
  182. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  183. OMAP_DSS_OUTPUT_DSI1 | OMAP_DSS_OUTPUT_DSI2,
  184. /* OMAP_DSS_CHANNEL_DIGIT */
  185. OMAP_DSS_OUTPUT_HDMI,
  186. /* OMAP_DSS_CHANNEL_LCD2 */
  187. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  188. OMAP_DSS_OUTPUT_DSI1,
  189. /* OMAP_DSS_CHANNEL_LCD3 */
  190. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  191. OMAP_DSS_OUTPUT_DSI2,
  192. };
  193. static const enum omap_color_mode omap2_dss_supported_color_modes[] = {
  194. /* OMAP_DSS_GFX */
  195. OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
  196. OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
  197. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
  198. OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P,
  199. /* OMAP_DSS_VIDEO1 */
  200. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  201. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
  202. OMAP_DSS_COLOR_UYVY,
  203. /* OMAP_DSS_VIDEO2 */
  204. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  205. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
  206. OMAP_DSS_COLOR_UYVY,
  207. };
  208. static const enum omap_color_mode omap3_dss_supported_color_modes[] = {
  209. /* OMAP_DSS_GFX */
  210. OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
  211. OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
  212. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
  213. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  214. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
  215. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
  216. /* OMAP_DSS_VIDEO1 */
  217. OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P |
  218. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
  219. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_UYVY,
  220. /* OMAP_DSS_VIDEO2 */
  221. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
  222. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  223. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
  224. OMAP_DSS_COLOR_UYVY | OMAP_DSS_COLOR_ARGB32 |
  225. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
  226. };
  227. static const enum omap_color_mode omap4_dss_supported_color_modes[] = {
  228. /* OMAP_DSS_GFX */
  229. OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
  230. OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
  231. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
  232. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  233. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
  234. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32 |
  235. OMAP_DSS_COLOR_ARGB16_1555 | OMAP_DSS_COLOR_RGBX16 |
  236. OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_XRGB16_1555,
  237. /* OMAP_DSS_VIDEO1 */
  238. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
  239. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
  240. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
  241. OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
  242. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
  243. OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
  244. OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
  245. OMAP_DSS_COLOR_RGBX32,
  246. /* OMAP_DSS_VIDEO2 */
  247. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
  248. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
  249. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
  250. OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
  251. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
  252. OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
  253. OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
  254. OMAP_DSS_COLOR_RGBX32,
  255. /* OMAP_DSS_VIDEO3 */
  256. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
  257. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
  258. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
  259. OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
  260. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
  261. OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
  262. OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
  263. OMAP_DSS_COLOR_RGBX32,
  264. /* OMAP_DSS_WB */
  265. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
  266. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
  267. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
  268. OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
  269. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
  270. OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
  271. OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
  272. OMAP_DSS_COLOR_RGBX32,
  273. };
  274. static const enum omap_overlay_caps omap2_dss_overlay_caps[] = {
  275. /* OMAP_DSS_GFX */
  276. OMAP_DSS_OVL_CAP_POS | OMAP_DSS_OVL_CAP_REPLICATION,
  277. /* OMAP_DSS_VIDEO1 */
  278. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_POS |
  279. OMAP_DSS_OVL_CAP_REPLICATION,
  280. /* OMAP_DSS_VIDEO2 */
  281. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_POS |
  282. OMAP_DSS_OVL_CAP_REPLICATION,
  283. };
  284. static const enum omap_overlay_caps omap3430_dss_overlay_caps[] = {
  285. /* OMAP_DSS_GFX */
  286. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_POS |
  287. OMAP_DSS_OVL_CAP_REPLICATION,
  288. /* OMAP_DSS_VIDEO1 */
  289. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_POS |
  290. OMAP_DSS_OVL_CAP_REPLICATION,
  291. /* OMAP_DSS_VIDEO2 */
  292. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  293. OMAP_DSS_OVL_CAP_POS | OMAP_DSS_OVL_CAP_REPLICATION,
  294. };
  295. static const enum omap_overlay_caps omap3630_dss_overlay_caps[] = {
  296. /* OMAP_DSS_GFX */
  297. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA |
  298. OMAP_DSS_OVL_CAP_POS | OMAP_DSS_OVL_CAP_REPLICATION,
  299. /* OMAP_DSS_VIDEO1 */
  300. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_POS |
  301. OMAP_DSS_OVL_CAP_REPLICATION,
  302. /* OMAP_DSS_VIDEO2 */
  303. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  304. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_POS |
  305. OMAP_DSS_OVL_CAP_REPLICATION,
  306. };
  307. static const enum omap_overlay_caps omap4_dss_overlay_caps[] = {
  308. /* OMAP_DSS_GFX */
  309. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA |
  310. OMAP_DSS_OVL_CAP_ZORDER | OMAP_DSS_OVL_CAP_POS |
  311. OMAP_DSS_OVL_CAP_REPLICATION,
  312. /* OMAP_DSS_VIDEO1 */
  313. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  314. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER |
  315. OMAP_DSS_OVL_CAP_POS | OMAP_DSS_OVL_CAP_REPLICATION,
  316. /* OMAP_DSS_VIDEO2 */
  317. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  318. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER |
  319. OMAP_DSS_OVL_CAP_POS | OMAP_DSS_OVL_CAP_REPLICATION,
  320. /* OMAP_DSS_VIDEO3 */
  321. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  322. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER |
  323. OMAP_DSS_OVL_CAP_POS | OMAP_DSS_OVL_CAP_REPLICATION,
  324. };
  325. static const char * const omap2_dss_clk_source_names[] = {
  326. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "N/A",
  327. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "N/A",
  328. [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK1",
  329. };
  330. static const char * const omap3_dss_clk_source_names[] = {
  331. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DSI1_PLL_FCLK",
  332. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DSI2_PLL_FCLK",
  333. [OMAP_DSS_CLK_SRC_FCK] = "DSS1_ALWON_FCLK",
  334. };
  335. static const char * const omap4_dss_clk_source_names[] = {
  336. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "PLL1_CLK1",
  337. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "PLL1_CLK2",
  338. [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK",
  339. [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "PLL2_CLK1",
  340. [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "PLL2_CLK2",
  341. };
  342. static const char * const omap5_dss_clk_source_names[] = {
  343. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DPLL_DSI1_A_CLK1",
  344. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DPLL_DSI1_A_CLK2",
  345. [OMAP_DSS_CLK_SRC_FCK] = "DSS_CLK",
  346. [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "DPLL_DSI1_C_CLK1",
  347. [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "DPLL_DSI1_C_CLK2",
  348. };
  349. static const struct dss_param_range omap2_dss_param_range[] = {
  350. [FEAT_PARAM_DSS_FCK] = { 0, 133000000 },
  351. [FEAT_PARAM_DSS_PCD] = { 2, 255 },
  352. [FEAT_PARAM_DOWNSCALE] = { 1, 2 },
  353. /*
  354. * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
  355. * scaler cannot scale a image with width more than 768.
  356. */
  357. [FEAT_PARAM_LINEWIDTH] = { 1, 768 },
  358. };
  359. static const struct dss_param_range omap3_dss_param_range[] = {
  360. [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
  361. [FEAT_PARAM_DSS_PCD] = { 1, 255 },
  362. [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1},
  363. [FEAT_PARAM_DSI_FCK] = { 0, 173000000 },
  364. [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
  365. [FEAT_PARAM_LINEWIDTH] = { 1, 1024 },
  366. };
  367. static const struct dss_param_range am43xx_dss_param_range[] = {
  368. [FEAT_PARAM_DSS_FCK] = { 0, 200000000 },
  369. [FEAT_PARAM_DSS_PCD] = { 1, 255 },
  370. [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
  371. [FEAT_PARAM_LINEWIDTH] = { 1, 1024 },
  372. };
  373. static const struct dss_param_range omap4_dss_param_range[] = {
  374. [FEAT_PARAM_DSS_FCK] = { 0, 186000000 },
  375. [FEAT_PARAM_DSS_PCD] = { 1, 255 },
  376. [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
  377. [FEAT_PARAM_DSI_FCK] = { 0, 170000000 },
  378. [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
  379. [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
  380. };
  381. static const struct dss_param_range omap5_dss_param_range[] = {
  382. [FEAT_PARAM_DSS_FCK] = { 0, 209250000 },
  383. [FEAT_PARAM_DSS_PCD] = { 1, 255 },
  384. [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
  385. [FEAT_PARAM_DSI_FCK] = { 0, 209250000 },
  386. [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
  387. [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
  388. };
  389. static const enum dss_feat_id omap2_dss_feat_list[] = {
  390. FEAT_LCDENABLEPOL,
  391. FEAT_LCDENABLESIGNAL,
  392. FEAT_PCKFREEENABLE,
  393. FEAT_FUNCGATED,
  394. FEAT_ROWREPEATENABLE,
  395. FEAT_RESIZECONF,
  396. };
  397. static const enum dss_feat_id omap3430_dss_feat_list[] = {
  398. FEAT_LCDENABLEPOL,
  399. FEAT_LCDENABLESIGNAL,
  400. FEAT_PCKFREEENABLE,
  401. FEAT_FUNCGATED,
  402. FEAT_LINEBUFFERSPLIT,
  403. FEAT_ROWREPEATENABLE,
  404. FEAT_RESIZECONF,
  405. FEAT_DSI_REVERSE_TXCLKESC,
  406. FEAT_VENC_REQUIRES_TV_DAC_CLK,
  407. FEAT_CPR,
  408. FEAT_PRELOAD,
  409. FEAT_FIR_COEF_V,
  410. FEAT_ALPHA_FIXED_ZORDER,
  411. FEAT_FIFO_MERGE,
  412. FEAT_OMAP3_DSI_FIFO_BUG,
  413. FEAT_DPI_USES_VDDS_DSI,
  414. };
  415. static const enum dss_feat_id am35xx_dss_feat_list[] = {
  416. FEAT_LCDENABLEPOL,
  417. FEAT_LCDENABLESIGNAL,
  418. FEAT_PCKFREEENABLE,
  419. FEAT_FUNCGATED,
  420. FEAT_LINEBUFFERSPLIT,
  421. FEAT_ROWREPEATENABLE,
  422. FEAT_RESIZECONF,
  423. FEAT_DSI_REVERSE_TXCLKESC,
  424. FEAT_VENC_REQUIRES_TV_DAC_CLK,
  425. FEAT_CPR,
  426. FEAT_PRELOAD,
  427. FEAT_FIR_COEF_V,
  428. FEAT_ALPHA_FIXED_ZORDER,
  429. FEAT_FIFO_MERGE,
  430. FEAT_OMAP3_DSI_FIFO_BUG,
  431. };
  432. static const enum dss_feat_id am43xx_dss_feat_list[] = {
  433. FEAT_LCDENABLEPOL,
  434. FEAT_LCDENABLESIGNAL,
  435. FEAT_PCKFREEENABLE,
  436. FEAT_FUNCGATED,
  437. FEAT_LINEBUFFERSPLIT,
  438. FEAT_ROWREPEATENABLE,
  439. FEAT_RESIZECONF,
  440. FEAT_CPR,
  441. FEAT_PRELOAD,
  442. FEAT_FIR_COEF_V,
  443. FEAT_ALPHA_FIXED_ZORDER,
  444. FEAT_FIFO_MERGE,
  445. };
  446. static const enum dss_feat_id omap3630_dss_feat_list[] = {
  447. FEAT_LCDENABLEPOL,
  448. FEAT_LCDENABLESIGNAL,
  449. FEAT_PCKFREEENABLE,
  450. FEAT_FUNCGATED,
  451. FEAT_LINEBUFFERSPLIT,
  452. FEAT_ROWREPEATENABLE,
  453. FEAT_RESIZECONF,
  454. FEAT_DSI_PLL_PWR_BUG,
  455. FEAT_CPR,
  456. FEAT_PRELOAD,
  457. FEAT_FIR_COEF_V,
  458. FEAT_ALPHA_FIXED_ZORDER,
  459. FEAT_FIFO_MERGE,
  460. FEAT_OMAP3_DSI_FIFO_BUG,
  461. FEAT_DPI_USES_VDDS_DSI,
  462. };
  463. static const enum dss_feat_id omap4430_es1_0_dss_feat_list[] = {
  464. FEAT_MGR_LCD2,
  465. FEAT_CORE_CLK_DIV,
  466. FEAT_LCD_CLK_SRC,
  467. FEAT_DSI_DCS_CMD_CONFIG_VC,
  468. FEAT_DSI_VC_OCP_WIDTH,
  469. FEAT_DSI_GNQ,
  470. FEAT_HANDLE_UV_SEPARATE,
  471. FEAT_ATTR2,
  472. FEAT_CPR,
  473. FEAT_PRELOAD,
  474. FEAT_FIR_COEF_V,
  475. FEAT_ALPHA_FREE_ZORDER,
  476. FEAT_FIFO_MERGE,
  477. FEAT_BURST_2D,
  478. };
  479. static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = {
  480. FEAT_MGR_LCD2,
  481. FEAT_CORE_CLK_DIV,
  482. FEAT_LCD_CLK_SRC,
  483. FEAT_DSI_DCS_CMD_CONFIG_VC,
  484. FEAT_DSI_VC_OCP_WIDTH,
  485. FEAT_DSI_GNQ,
  486. FEAT_HDMI_CTS_SWMODE,
  487. FEAT_HANDLE_UV_SEPARATE,
  488. FEAT_ATTR2,
  489. FEAT_CPR,
  490. FEAT_PRELOAD,
  491. FEAT_FIR_COEF_V,
  492. FEAT_ALPHA_FREE_ZORDER,
  493. FEAT_FIFO_MERGE,
  494. FEAT_BURST_2D,
  495. };
  496. static const enum dss_feat_id omap4_dss_feat_list[] = {
  497. FEAT_MGR_LCD2,
  498. FEAT_CORE_CLK_DIV,
  499. FEAT_LCD_CLK_SRC,
  500. FEAT_DSI_DCS_CMD_CONFIG_VC,
  501. FEAT_DSI_VC_OCP_WIDTH,
  502. FEAT_DSI_GNQ,
  503. FEAT_HDMI_CTS_SWMODE,
  504. FEAT_HDMI_AUDIO_USE_MCLK,
  505. FEAT_HANDLE_UV_SEPARATE,
  506. FEAT_ATTR2,
  507. FEAT_CPR,
  508. FEAT_PRELOAD,
  509. FEAT_FIR_COEF_V,
  510. FEAT_ALPHA_FREE_ZORDER,
  511. FEAT_FIFO_MERGE,
  512. FEAT_BURST_2D,
  513. };
  514. static const enum dss_feat_id omap5_dss_feat_list[] = {
  515. FEAT_MGR_LCD2,
  516. FEAT_MGR_LCD3,
  517. FEAT_CORE_CLK_DIV,
  518. FEAT_LCD_CLK_SRC,
  519. FEAT_DSI_DCS_CMD_CONFIG_VC,
  520. FEAT_DSI_VC_OCP_WIDTH,
  521. FEAT_DSI_GNQ,
  522. FEAT_HDMI_CTS_SWMODE,
  523. FEAT_HDMI_AUDIO_USE_MCLK,
  524. FEAT_HANDLE_UV_SEPARATE,
  525. FEAT_ATTR2,
  526. FEAT_CPR,
  527. FEAT_PRELOAD,
  528. FEAT_FIR_COEF_V,
  529. FEAT_ALPHA_FREE_ZORDER,
  530. FEAT_FIFO_MERGE,
  531. FEAT_BURST_2D,
  532. FEAT_DSI_PHY_DCC,
  533. FEAT_MFLAG,
  534. };
  535. /* OMAP2 DSS Features */
  536. static const struct omap_dss_features omap2_dss_features = {
  537. .reg_fields = omap2_dss_reg_fields,
  538. .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields),
  539. .features = omap2_dss_feat_list,
  540. .num_features = ARRAY_SIZE(omap2_dss_feat_list),
  541. .num_mgrs = 2,
  542. .num_ovls = 3,
  543. .supported_displays = omap2_dss_supported_displays,
  544. .supported_outputs = omap2_dss_supported_outputs,
  545. .supported_color_modes = omap2_dss_supported_color_modes,
  546. .overlay_caps = omap2_dss_overlay_caps,
  547. .clksrc_names = omap2_dss_clk_source_names,
  548. .dss_params = omap2_dss_param_range,
  549. .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
  550. .buffer_size_unit = 1,
  551. .burst_size_unit = 8,
  552. };
  553. /* OMAP3 DSS Features */
  554. static const struct omap_dss_features omap3430_dss_features = {
  555. .reg_fields = omap3_dss_reg_fields,
  556. .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
  557. .features = omap3430_dss_feat_list,
  558. .num_features = ARRAY_SIZE(omap3430_dss_feat_list),
  559. .num_mgrs = 2,
  560. .num_ovls = 3,
  561. .supported_displays = omap3430_dss_supported_displays,
  562. .supported_outputs = omap3430_dss_supported_outputs,
  563. .supported_color_modes = omap3_dss_supported_color_modes,
  564. .overlay_caps = omap3430_dss_overlay_caps,
  565. .clksrc_names = omap3_dss_clk_source_names,
  566. .dss_params = omap3_dss_param_range,
  567. .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
  568. .buffer_size_unit = 1,
  569. .burst_size_unit = 8,
  570. };
  571. /*
  572. * AM35xx DSS Features. This is basically OMAP3 DSS Features without the
  573. * vdds_dsi regulator.
  574. */
  575. static const struct omap_dss_features am35xx_dss_features = {
  576. .reg_fields = omap3_dss_reg_fields,
  577. .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
  578. .features = am35xx_dss_feat_list,
  579. .num_features = ARRAY_SIZE(am35xx_dss_feat_list),
  580. .num_mgrs = 2,
  581. .num_ovls = 3,
  582. .supported_displays = omap3430_dss_supported_displays,
  583. .supported_outputs = omap3430_dss_supported_outputs,
  584. .supported_color_modes = omap3_dss_supported_color_modes,
  585. .overlay_caps = omap3430_dss_overlay_caps,
  586. .clksrc_names = omap3_dss_clk_source_names,
  587. .dss_params = omap3_dss_param_range,
  588. .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
  589. .buffer_size_unit = 1,
  590. .burst_size_unit = 8,
  591. };
  592. static const struct omap_dss_features am43xx_dss_features = {
  593. .reg_fields = am43xx_dss_reg_fields,
  594. .num_reg_fields = ARRAY_SIZE(am43xx_dss_reg_fields),
  595. .features = am43xx_dss_feat_list,
  596. .num_features = ARRAY_SIZE(am43xx_dss_feat_list),
  597. .num_mgrs = 1,
  598. .num_ovls = 3,
  599. .supported_displays = am43xx_dss_supported_displays,
  600. .supported_outputs = am43xx_dss_supported_outputs,
  601. .supported_color_modes = omap3_dss_supported_color_modes,
  602. .overlay_caps = omap3430_dss_overlay_caps,
  603. .clksrc_names = omap2_dss_clk_source_names,
  604. .dss_params = am43xx_dss_param_range,
  605. .supported_rotation_types = OMAP_DSS_ROT_DMA,
  606. .buffer_size_unit = 1,
  607. .burst_size_unit = 8,
  608. };
  609. static const struct omap_dss_features omap3630_dss_features = {
  610. .reg_fields = omap3_dss_reg_fields,
  611. .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
  612. .features = omap3630_dss_feat_list,
  613. .num_features = ARRAY_SIZE(omap3630_dss_feat_list),
  614. .num_mgrs = 2,
  615. .num_ovls = 3,
  616. .supported_displays = omap3630_dss_supported_displays,
  617. .supported_outputs = omap3630_dss_supported_outputs,
  618. .supported_color_modes = omap3_dss_supported_color_modes,
  619. .overlay_caps = omap3630_dss_overlay_caps,
  620. .clksrc_names = omap3_dss_clk_source_names,
  621. .dss_params = omap3_dss_param_range,
  622. .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_VRFB,
  623. .buffer_size_unit = 1,
  624. .burst_size_unit = 8,
  625. };
  626. /* OMAP4 DSS Features */
  627. /* For OMAP4430 ES 1.0 revision */
  628. static const struct omap_dss_features omap4430_es1_0_dss_features = {
  629. .reg_fields = omap4_dss_reg_fields,
  630. .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
  631. .features = omap4430_es1_0_dss_feat_list,
  632. .num_features = ARRAY_SIZE(omap4430_es1_0_dss_feat_list),
  633. .num_mgrs = 3,
  634. .num_ovls = 4,
  635. .num_wbs = 1,
  636. .supported_displays = omap4_dss_supported_displays,
  637. .supported_outputs = omap4_dss_supported_outputs,
  638. .supported_color_modes = omap4_dss_supported_color_modes,
  639. .overlay_caps = omap4_dss_overlay_caps,
  640. .clksrc_names = omap4_dss_clk_source_names,
  641. .dss_params = omap4_dss_param_range,
  642. .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
  643. .buffer_size_unit = 16,
  644. .burst_size_unit = 16,
  645. };
  646. /* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
  647. static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
  648. .reg_fields = omap4_dss_reg_fields,
  649. .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
  650. .features = omap4430_es2_0_1_2_dss_feat_list,
  651. .num_features = ARRAY_SIZE(omap4430_es2_0_1_2_dss_feat_list),
  652. .num_mgrs = 3,
  653. .num_ovls = 4,
  654. .num_wbs = 1,
  655. .supported_displays = omap4_dss_supported_displays,
  656. .supported_outputs = omap4_dss_supported_outputs,
  657. .supported_color_modes = omap4_dss_supported_color_modes,
  658. .overlay_caps = omap4_dss_overlay_caps,
  659. .clksrc_names = omap4_dss_clk_source_names,
  660. .dss_params = omap4_dss_param_range,
  661. .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
  662. .buffer_size_unit = 16,
  663. .burst_size_unit = 16,
  664. };
  665. /* For all the other OMAP4 versions */
  666. static const struct omap_dss_features omap4_dss_features = {
  667. .reg_fields = omap4_dss_reg_fields,
  668. .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
  669. .features = omap4_dss_feat_list,
  670. .num_features = ARRAY_SIZE(omap4_dss_feat_list),
  671. .num_mgrs = 3,
  672. .num_ovls = 4,
  673. .num_wbs = 1,
  674. .supported_displays = omap4_dss_supported_displays,
  675. .supported_outputs = omap4_dss_supported_outputs,
  676. .supported_color_modes = omap4_dss_supported_color_modes,
  677. .overlay_caps = omap4_dss_overlay_caps,
  678. .clksrc_names = omap4_dss_clk_source_names,
  679. .dss_params = omap4_dss_param_range,
  680. .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
  681. .buffer_size_unit = 16,
  682. .burst_size_unit = 16,
  683. };
  684. /* OMAP5 DSS Features */
  685. static const struct omap_dss_features omap5_dss_features = {
  686. .reg_fields = omap5_dss_reg_fields,
  687. .num_reg_fields = ARRAY_SIZE(omap5_dss_reg_fields),
  688. .features = omap5_dss_feat_list,
  689. .num_features = ARRAY_SIZE(omap5_dss_feat_list),
  690. .num_mgrs = 4,
  691. .num_ovls = 4,
  692. .supported_displays = omap5_dss_supported_displays,
  693. .supported_outputs = omap5_dss_supported_outputs,
  694. .supported_color_modes = omap4_dss_supported_color_modes,
  695. .overlay_caps = omap4_dss_overlay_caps,
  696. .clksrc_names = omap5_dss_clk_source_names,
  697. .dss_params = omap5_dss_param_range,
  698. .supported_rotation_types = OMAP_DSS_ROT_DMA | OMAP_DSS_ROT_TILER,
  699. .buffer_size_unit = 16,
  700. .burst_size_unit = 16,
  701. };
  702. /* Functions returning values related to a DSS feature */
  703. int dss_feat_get_num_mgrs(void)
  704. {
  705. return omap_current_dss_features->num_mgrs;
  706. }
  707. EXPORT_SYMBOL(dss_feat_get_num_mgrs);
  708. int dss_feat_get_num_ovls(void)
  709. {
  710. return omap_current_dss_features->num_ovls;
  711. }
  712. EXPORT_SYMBOL(dss_feat_get_num_ovls);
  713. int dss_feat_get_num_wbs(void)
  714. {
  715. return omap_current_dss_features->num_wbs;
  716. }
  717. unsigned long dss_feat_get_param_min(enum dss_range_param param)
  718. {
  719. return omap_current_dss_features->dss_params[param].min;
  720. }
  721. unsigned long dss_feat_get_param_max(enum dss_range_param param)
  722. {
  723. return omap_current_dss_features->dss_params[param].max;
  724. }
  725. enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel)
  726. {
  727. return omap_current_dss_features->supported_displays[channel];
  728. }
  729. EXPORT_SYMBOL(dss_feat_get_supported_displays);
  730. enum omap_dss_output_id dss_feat_get_supported_outputs(enum omap_channel channel)
  731. {
  732. return omap_current_dss_features->supported_outputs[channel];
  733. }
  734. EXPORT_SYMBOL(dss_feat_get_supported_outputs);
  735. enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane)
  736. {
  737. return omap_current_dss_features->supported_color_modes[plane];
  738. }
  739. EXPORT_SYMBOL(dss_feat_get_supported_color_modes);
  740. enum omap_overlay_caps dss_feat_get_overlay_caps(enum omap_plane plane)
  741. {
  742. return omap_current_dss_features->overlay_caps[plane];
  743. }
  744. bool dss_feat_color_mode_supported(enum omap_plane plane,
  745. enum omap_color_mode color_mode)
  746. {
  747. return omap_current_dss_features->supported_color_modes[plane] &
  748. color_mode;
  749. }
  750. const char *dss_feat_get_clk_source_name(enum omap_dss_clk_source id)
  751. {
  752. return omap_current_dss_features->clksrc_names[id];
  753. }
  754. u32 dss_feat_get_buffer_size_unit(void)
  755. {
  756. return omap_current_dss_features->buffer_size_unit;
  757. }
  758. u32 dss_feat_get_burst_size_unit(void)
  759. {
  760. return omap_current_dss_features->burst_size_unit;
  761. }
  762. /* DSS has_feature check */
  763. bool dss_has_feature(enum dss_feat_id id)
  764. {
  765. int i;
  766. const enum dss_feat_id *features = omap_current_dss_features->features;
  767. const int num_features = omap_current_dss_features->num_features;
  768. for (i = 0; i < num_features; i++) {
  769. if (features[i] == id)
  770. return true;
  771. }
  772. return false;
  773. }
  774. void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
  775. {
  776. if (id >= omap_current_dss_features->num_reg_fields)
  777. BUG();
  778. *start = omap_current_dss_features->reg_fields[id].start;
  779. *end = omap_current_dss_features->reg_fields[id].end;
  780. }
  781. bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type)
  782. {
  783. return omap_current_dss_features->supported_rotation_types & rot_type;
  784. }
  785. void dss_features_init(enum omapdss_version version)
  786. {
  787. switch (version) {
  788. case OMAPDSS_VER_OMAP24xx:
  789. omap_current_dss_features = &omap2_dss_features;
  790. break;
  791. case OMAPDSS_VER_OMAP34xx_ES1:
  792. case OMAPDSS_VER_OMAP34xx_ES3:
  793. omap_current_dss_features = &omap3430_dss_features;
  794. break;
  795. case OMAPDSS_VER_OMAP3630:
  796. omap_current_dss_features = &omap3630_dss_features;
  797. break;
  798. case OMAPDSS_VER_OMAP4430_ES1:
  799. omap_current_dss_features = &omap4430_es1_0_dss_features;
  800. break;
  801. case OMAPDSS_VER_OMAP4430_ES2:
  802. omap_current_dss_features = &omap4430_es2_0_1_2_dss_features;
  803. break;
  804. case OMAPDSS_VER_OMAP4:
  805. omap_current_dss_features = &omap4_dss_features;
  806. break;
  807. case OMAPDSS_VER_OMAP5:
  808. case OMAPDSS_VER_DRA7xx:
  809. omap_current_dss_features = &omap5_dss_features;
  810. break;
  811. case OMAPDSS_VER_AM35xx:
  812. omap_current_dss_features = &am35xx_dss_features;
  813. break;
  814. case OMAPDSS_VER_AM43xx:
  815. omap_current_dss_features = &am43xx_dss_features;
  816. break;
  817. default:
  818. DSSWARN("Unsupported OMAP version");
  819. break;
  820. }
  821. }