dss_features.c 29 KB

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