dss_features.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  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/types.h>
  21. #include <linux/err.h>
  22. #include <linux/slab.h>
  23. #include <video/omapdss.h>
  24. #include <plat/cpu.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 u32 has_feature;
  38. const int num_mgrs;
  39. const int num_ovls;
  40. const enum omap_display_type *supported_displays;
  41. const enum omap_color_mode *supported_color_modes;
  42. const enum omap_overlay_caps *overlay_caps;
  43. const char * const *clksrc_names;
  44. const struct dss_param_range *dss_params;
  45. const u32 buffer_size_unit;
  46. const u32 burst_size_unit;
  47. };
  48. /* This struct is assigned to one of the below during initialization */
  49. static const struct omap_dss_features *omap_current_dss_features;
  50. static const struct dss_reg_field omap2_dss_reg_fields[] = {
  51. [FEAT_REG_FIRHINC] = { 11, 0 },
  52. [FEAT_REG_FIRVINC] = { 27, 16 },
  53. [FEAT_REG_FIFOLOWTHRESHOLD] = { 8, 0 },
  54. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 24, 16 },
  55. [FEAT_REG_FIFOSIZE] = { 8, 0 },
  56. [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
  57. [FEAT_REG_VERTICALACCU] = { 25, 16 },
  58. [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
  59. [FEAT_REG_DSIPLL_REGN] = { 0, 0 },
  60. [FEAT_REG_DSIPLL_REGM] = { 0, 0 },
  61. [FEAT_REG_DSIPLL_REGM_DISPC] = { 0, 0 },
  62. [FEAT_REG_DSIPLL_REGM_DSI] = { 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. [FEAT_REG_DSIPLL_REGN] = { 7, 1 },
  74. [FEAT_REG_DSIPLL_REGM] = { 18, 8 },
  75. [FEAT_REG_DSIPLL_REGM_DISPC] = { 22, 19 },
  76. [FEAT_REG_DSIPLL_REGM_DSI] = { 26, 23 },
  77. };
  78. static const struct dss_reg_field omap4_dss_reg_fields[] = {
  79. [FEAT_REG_FIRHINC] = { 12, 0 },
  80. [FEAT_REG_FIRVINC] = { 28, 16 },
  81. [FEAT_REG_FIFOLOWTHRESHOLD] = { 15, 0 },
  82. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 31, 16 },
  83. [FEAT_REG_FIFOSIZE] = { 15, 0 },
  84. [FEAT_REG_HORIZONTALACCU] = { 10, 0 },
  85. [FEAT_REG_VERTICALACCU] = { 26, 16 },
  86. [FEAT_REG_DISPC_CLK_SWITCH] = { 9, 8 },
  87. [FEAT_REG_DSIPLL_REGN] = { 8, 1 },
  88. [FEAT_REG_DSIPLL_REGM] = { 20, 9 },
  89. [FEAT_REG_DSIPLL_REGM_DISPC] = { 25, 21 },
  90. [FEAT_REG_DSIPLL_REGM_DSI] = { 30, 26 },
  91. };
  92. static const enum omap_display_type omap2_dss_supported_displays[] = {
  93. /* OMAP_DSS_CHANNEL_LCD */
  94. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI,
  95. /* OMAP_DSS_CHANNEL_DIGIT */
  96. OMAP_DISPLAY_TYPE_VENC,
  97. };
  98. static const enum omap_display_type omap3430_dss_supported_displays[] = {
  99. /* OMAP_DSS_CHANNEL_LCD */
  100. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
  101. OMAP_DISPLAY_TYPE_SDI | OMAP_DISPLAY_TYPE_DSI,
  102. /* OMAP_DSS_CHANNEL_DIGIT */
  103. OMAP_DISPLAY_TYPE_VENC,
  104. };
  105. static const enum omap_display_type omap3630_dss_supported_displays[] = {
  106. /* OMAP_DSS_CHANNEL_LCD */
  107. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
  108. OMAP_DISPLAY_TYPE_DSI,
  109. /* OMAP_DSS_CHANNEL_DIGIT */
  110. OMAP_DISPLAY_TYPE_VENC,
  111. };
  112. static const enum omap_display_type omap4_dss_supported_displays[] = {
  113. /* OMAP_DSS_CHANNEL_LCD */
  114. OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI,
  115. /* OMAP_DSS_CHANNEL_DIGIT */
  116. OMAP_DISPLAY_TYPE_VENC | OMAP_DISPLAY_TYPE_HDMI,
  117. /* OMAP_DSS_CHANNEL_LCD2 */
  118. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
  119. OMAP_DISPLAY_TYPE_DSI,
  120. };
  121. static const enum omap_color_mode omap2_dss_supported_color_modes[] = {
  122. /* OMAP_DSS_GFX */
  123. OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
  124. OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
  125. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
  126. OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P,
  127. /* OMAP_DSS_VIDEO1 */
  128. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  129. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
  130. OMAP_DSS_COLOR_UYVY,
  131. /* OMAP_DSS_VIDEO2 */
  132. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  133. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
  134. OMAP_DSS_COLOR_UYVY,
  135. };
  136. static const enum omap_color_mode omap3_dss_supported_color_modes[] = {
  137. /* OMAP_DSS_GFX */
  138. OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
  139. OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
  140. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
  141. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  142. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
  143. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
  144. /* OMAP_DSS_VIDEO1 */
  145. OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P |
  146. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
  147. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_UYVY,
  148. /* OMAP_DSS_VIDEO2 */
  149. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
  150. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  151. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
  152. OMAP_DSS_COLOR_UYVY | OMAP_DSS_COLOR_ARGB32 |
  153. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
  154. };
  155. static const enum omap_color_mode omap4_dss_supported_color_modes[] = {
  156. /* OMAP_DSS_GFX */
  157. OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
  158. OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
  159. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
  160. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  161. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
  162. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32 |
  163. OMAP_DSS_COLOR_ARGB16_1555,
  164. /* OMAP_DSS_VIDEO1 */
  165. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
  166. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
  167. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
  168. OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
  169. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
  170. OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
  171. OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
  172. OMAP_DSS_COLOR_RGBX32,
  173. /* OMAP_DSS_VIDEO2 */
  174. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
  175. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
  176. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
  177. OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
  178. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
  179. OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
  180. OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
  181. OMAP_DSS_COLOR_RGBX32,
  182. };
  183. static const enum omap_overlay_caps omap2_dss_overlay_caps[] = {
  184. /* OMAP_DSS_GFX */
  185. 0,
  186. /* OMAP_DSS_VIDEO1 */
  187. OMAP_DSS_OVL_CAP_SCALE,
  188. /* OMAP_DSS_VIDEO2 */
  189. OMAP_DSS_OVL_CAP_SCALE,
  190. };
  191. static const enum omap_overlay_caps omap3430_dss_overlay_caps[] = {
  192. /* OMAP_DSS_GFX */
  193. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
  194. /* OMAP_DSS_VIDEO1 */
  195. OMAP_DSS_OVL_CAP_SCALE,
  196. /* OMAP_DSS_VIDEO2 */
  197. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
  198. };
  199. static const enum omap_overlay_caps omap3630_dss_overlay_caps[] = {
  200. /* OMAP_DSS_GFX */
  201. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
  202. /* OMAP_DSS_VIDEO1 */
  203. OMAP_DSS_OVL_CAP_SCALE,
  204. /* OMAP_DSS_VIDEO2 */
  205. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  206. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
  207. };
  208. static const enum omap_overlay_caps omap4_dss_overlay_caps[] = {
  209. /* OMAP_DSS_GFX */
  210. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
  211. /* OMAP_DSS_VIDEO1 */
  212. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  213. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
  214. /* OMAP_DSS_VIDEO2 */
  215. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  216. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
  217. };
  218. static const char * const omap2_dss_clk_source_names[] = {
  219. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "N/A",
  220. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "N/A",
  221. [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK1",
  222. };
  223. static const char * const omap3_dss_clk_source_names[] = {
  224. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DSI1_PLL_FCLK",
  225. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DSI2_PLL_FCLK",
  226. [OMAP_DSS_CLK_SRC_FCK] = "DSS1_ALWON_FCLK",
  227. };
  228. static const char * const omap4_dss_clk_source_names[] = {
  229. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "PLL1_CLK1",
  230. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "PLL1_CLK2",
  231. [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK",
  232. [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "PLL2_CLK1",
  233. [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "PLL2_CLK2",
  234. };
  235. static const struct dss_param_range omap2_dss_param_range[] = {
  236. [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
  237. [FEAT_PARAM_DSS_PCD] = { 2, 255 },
  238. [FEAT_PARAM_DSIPLL_REGN] = { 0, 0 },
  239. [FEAT_PARAM_DSIPLL_REGM] = { 0, 0 },
  240. [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, 0 },
  241. [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, 0 },
  242. [FEAT_PARAM_DSIPLL_FINT] = { 0, 0 },
  243. [FEAT_PARAM_DSIPLL_LPDIV] = { 0, 0 },
  244. [FEAT_PARAM_DOWNSCALE] = { 1, 2 },
  245. };
  246. static const struct dss_param_range omap3_dss_param_range[] = {
  247. [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
  248. [FEAT_PARAM_DSS_PCD] = { 1, 255 },
  249. [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 7) - 1 },
  250. [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 11) - 1 },
  251. [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 4) - 1 },
  252. [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 4) - 1 },
  253. [FEAT_PARAM_DSIPLL_FINT] = { 750000, 2100000 },
  254. [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1},
  255. [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
  256. };
  257. static const struct dss_param_range omap4_dss_param_range[] = {
  258. [FEAT_PARAM_DSS_FCK] = { 0, 186000000 },
  259. [FEAT_PARAM_DSS_PCD] = { 1, 255 },
  260. [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
  261. [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
  262. [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 },
  263. [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 },
  264. [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 },
  265. [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
  266. [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
  267. };
  268. /* OMAP2 DSS Features */
  269. static const struct omap_dss_features omap2_dss_features = {
  270. .reg_fields = omap2_dss_reg_fields,
  271. .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields),
  272. .has_feature =
  273. FEAT_LCDENABLEPOL | FEAT_LCDENABLESIGNAL |
  274. FEAT_PCKFREEENABLE | FEAT_FUNCGATED |
  275. FEAT_ROWREPEATENABLE | FEAT_RESIZECONF,
  276. .num_mgrs = 2,
  277. .num_ovls = 3,
  278. .supported_displays = omap2_dss_supported_displays,
  279. .supported_color_modes = omap2_dss_supported_color_modes,
  280. .overlay_caps = omap2_dss_overlay_caps,
  281. .clksrc_names = omap2_dss_clk_source_names,
  282. .dss_params = omap2_dss_param_range,
  283. .buffer_size_unit = 1,
  284. .burst_size_unit = 8,
  285. };
  286. /* OMAP3 DSS Features */
  287. static const struct omap_dss_features omap3430_dss_features = {
  288. .reg_fields = omap3_dss_reg_fields,
  289. .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
  290. .has_feature =
  291. FEAT_GLOBAL_ALPHA | FEAT_LCDENABLEPOL |
  292. FEAT_LCDENABLESIGNAL | FEAT_PCKFREEENABLE |
  293. FEAT_FUNCGATED | FEAT_ROWREPEATENABLE |
  294. FEAT_LINEBUFFERSPLIT | FEAT_RESIZECONF |
  295. FEAT_DSI_PLL_FREQSEL | FEAT_DSI_REVERSE_TXCLKESC |
  296. FEAT_VENC_REQUIRES_TV_DAC_CLK | FEAT_CPR | FEAT_PRELOAD |
  297. FEAT_FIR_COEF_V,
  298. .num_mgrs = 2,
  299. .num_ovls = 3,
  300. .supported_displays = omap3430_dss_supported_displays,
  301. .supported_color_modes = omap3_dss_supported_color_modes,
  302. .overlay_caps = omap3430_dss_overlay_caps,
  303. .clksrc_names = omap3_dss_clk_source_names,
  304. .dss_params = omap3_dss_param_range,
  305. .buffer_size_unit = 1,
  306. .burst_size_unit = 8,
  307. };
  308. static const struct omap_dss_features omap3630_dss_features = {
  309. .reg_fields = omap3_dss_reg_fields,
  310. .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
  311. .has_feature =
  312. FEAT_GLOBAL_ALPHA | FEAT_LCDENABLEPOL |
  313. FEAT_LCDENABLESIGNAL | FEAT_PCKFREEENABLE |
  314. FEAT_FUNCGATED |
  315. FEAT_ROWREPEATENABLE | FEAT_LINEBUFFERSPLIT |
  316. FEAT_RESIZECONF | FEAT_DSI_PLL_PWR_BUG |
  317. FEAT_DSI_PLL_FREQSEL | FEAT_CPR | FEAT_PRELOAD |
  318. FEAT_FIR_COEF_V,
  319. .num_mgrs = 2,
  320. .num_ovls = 3,
  321. .supported_displays = omap3630_dss_supported_displays,
  322. .supported_color_modes = omap3_dss_supported_color_modes,
  323. .overlay_caps = omap3630_dss_overlay_caps,
  324. .clksrc_names = omap3_dss_clk_source_names,
  325. .dss_params = omap3_dss_param_range,
  326. .buffer_size_unit = 1,
  327. .burst_size_unit = 8,
  328. };
  329. /* OMAP4 DSS Features */
  330. /* For OMAP4430 ES 1.0 revision */
  331. static const struct omap_dss_features omap4430_es1_0_dss_features = {
  332. .reg_fields = omap4_dss_reg_fields,
  333. .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
  334. .has_feature =
  335. FEAT_GLOBAL_ALPHA |
  336. FEAT_MGR_LCD2 |
  337. FEAT_CORE_CLK_DIV | FEAT_LCD_CLK_SRC |
  338. FEAT_DSI_DCS_CMD_CONFIG_VC | FEAT_DSI_VC_OCP_WIDTH |
  339. FEAT_DSI_GNQ | FEAT_HANDLE_UV_SEPARATE | FEAT_ATTR2 |
  340. FEAT_CPR | FEAT_PRELOAD | FEAT_FIR_COEF_V,
  341. .num_mgrs = 3,
  342. .num_ovls = 3,
  343. .supported_displays = omap4_dss_supported_displays,
  344. .supported_color_modes = omap4_dss_supported_color_modes,
  345. .overlay_caps = omap4_dss_overlay_caps,
  346. .clksrc_names = omap4_dss_clk_source_names,
  347. .dss_params = omap4_dss_param_range,
  348. .buffer_size_unit = 16,
  349. .burst_size_unit = 16,
  350. };
  351. /* For all the other OMAP4 versions */
  352. static const struct omap_dss_features omap4_dss_features = {
  353. .reg_fields = omap4_dss_reg_fields,
  354. .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
  355. .has_feature =
  356. FEAT_GLOBAL_ALPHA |
  357. FEAT_MGR_LCD2 |
  358. FEAT_CORE_CLK_DIV | FEAT_LCD_CLK_SRC |
  359. FEAT_DSI_DCS_CMD_CONFIG_VC | FEAT_DSI_VC_OCP_WIDTH |
  360. FEAT_DSI_GNQ | FEAT_HDMI_CTS_SWMODE |
  361. FEAT_HANDLE_UV_SEPARATE | FEAT_ATTR2 | FEAT_CPR |
  362. FEAT_PRELOAD | FEAT_FIR_COEF_V,
  363. .num_mgrs = 3,
  364. .num_ovls = 3,
  365. .supported_displays = omap4_dss_supported_displays,
  366. .supported_color_modes = omap4_dss_supported_color_modes,
  367. .overlay_caps = omap4_dss_overlay_caps,
  368. .clksrc_names = omap4_dss_clk_source_names,
  369. .dss_params = omap4_dss_param_range,
  370. .buffer_size_unit = 16,
  371. .burst_size_unit = 16,
  372. };
  373. #if defined(CONFIG_OMAP4_DSS_HDMI)
  374. /* HDMI OMAP4 Functions*/
  375. static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
  376. .video_configure = ti_hdmi_4xxx_basic_configure,
  377. .phy_enable = ti_hdmi_4xxx_phy_enable,
  378. .phy_disable = ti_hdmi_4xxx_phy_disable,
  379. .read_edid = ti_hdmi_4xxx_read_edid,
  380. .detect = ti_hdmi_4xxx_detect,
  381. .pll_enable = ti_hdmi_4xxx_pll_enable,
  382. .pll_disable = ti_hdmi_4xxx_pll_disable,
  383. .video_enable = ti_hdmi_4xxx_wp_video_start,
  384. .dump_wrapper = ti_hdmi_4xxx_wp_dump,
  385. .dump_core = ti_hdmi_4xxx_core_dump,
  386. .dump_pll = ti_hdmi_4xxx_pll_dump,
  387. .dump_phy = ti_hdmi_4xxx_phy_dump,
  388. };
  389. void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
  390. {
  391. if (cpu_is_omap44xx())
  392. ip_data->ops = &omap4_hdmi_functions;
  393. }
  394. #endif
  395. /* Functions returning values related to a DSS feature */
  396. int dss_feat_get_num_mgrs(void)
  397. {
  398. return omap_current_dss_features->num_mgrs;
  399. }
  400. int dss_feat_get_num_ovls(void)
  401. {
  402. return omap_current_dss_features->num_ovls;
  403. }
  404. unsigned long dss_feat_get_param_min(enum dss_range_param param)
  405. {
  406. return omap_current_dss_features->dss_params[param].min;
  407. }
  408. unsigned long dss_feat_get_param_max(enum dss_range_param param)
  409. {
  410. return omap_current_dss_features->dss_params[param].max;
  411. }
  412. enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel)
  413. {
  414. return omap_current_dss_features->supported_displays[channel];
  415. }
  416. enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane)
  417. {
  418. return omap_current_dss_features->supported_color_modes[plane];
  419. }
  420. enum omap_overlay_caps dss_feat_get_overlay_caps(enum omap_plane plane)
  421. {
  422. return omap_current_dss_features->overlay_caps[plane];
  423. }
  424. bool dss_feat_color_mode_supported(enum omap_plane plane,
  425. enum omap_color_mode color_mode)
  426. {
  427. return omap_current_dss_features->supported_color_modes[plane] &
  428. color_mode;
  429. }
  430. const char *dss_feat_get_clk_source_name(enum omap_dss_clk_source id)
  431. {
  432. return omap_current_dss_features->clksrc_names[id];
  433. }
  434. u32 dss_feat_get_buffer_size_unit(void)
  435. {
  436. return omap_current_dss_features->buffer_size_unit;
  437. }
  438. u32 dss_feat_get_burst_size_unit(void)
  439. {
  440. return omap_current_dss_features->burst_size_unit;
  441. }
  442. /* DSS has_feature check */
  443. bool dss_has_feature(enum dss_feat_id id)
  444. {
  445. return omap_current_dss_features->has_feature & id;
  446. }
  447. void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
  448. {
  449. if (id >= omap_current_dss_features->num_reg_fields)
  450. BUG();
  451. *start = omap_current_dss_features->reg_fields[id].start;
  452. *end = omap_current_dss_features->reg_fields[id].end;
  453. }
  454. void dss_features_init(void)
  455. {
  456. if (cpu_is_omap24xx())
  457. omap_current_dss_features = &omap2_dss_features;
  458. else if (cpu_is_omap3630())
  459. omap_current_dss_features = &omap3630_dss_features;
  460. else if (cpu_is_omap34xx())
  461. omap_current_dss_features = &omap3430_dss_features;
  462. else if (omap_rev() == OMAP4430_REV_ES1_0)
  463. omap_current_dss_features = &omap4430_es1_0_dss_features;
  464. else if (cpu_is_omap44xx())
  465. omap_current_dss_features = &omap4_dss_features;
  466. else
  467. DSSWARN("Unsupported OMAP version");
  468. }