dss_features.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  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 enum dss_feat_id *features;
  38. const int num_features;
  39. const int num_mgrs;
  40. const int num_ovls;
  41. const enum omap_display_type *supported_displays;
  42. const enum omap_color_mode *supported_color_modes;
  43. const enum omap_overlay_caps *overlay_caps;
  44. const char * const *clksrc_names;
  45. const struct dss_param_range *dss_params;
  46. const u32 buffer_size_unit;
  47. const u32 burst_size_unit;
  48. };
  49. /* This struct is assigned to one of the below during initialization */
  50. static const struct omap_dss_features *omap_current_dss_features;
  51. static const struct dss_reg_field omap2_dss_reg_fields[] = {
  52. [FEAT_REG_FIRHINC] = { 11, 0 },
  53. [FEAT_REG_FIRVINC] = { 27, 16 },
  54. [FEAT_REG_FIFOLOWTHRESHOLD] = { 8, 0 },
  55. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 24, 16 },
  56. [FEAT_REG_FIFOSIZE] = { 8, 0 },
  57. [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
  58. [FEAT_REG_VERTICALACCU] = { 25, 16 },
  59. [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
  60. [FEAT_REG_DSIPLL_REGN] = { 0, 0 },
  61. [FEAT_REG_DSIPLL_REGM] = { 0, 0 },
  62. [FEAT_REG_DSIPLL_REGM_DISPC] = { 0, 0 },
  63. [FEAT_REG_DSIPLL_REGM_DSI] = { 0, 0 },
  64. };
  65. static const struct dss_reg_field omap3_dss_reg_fields[] = {
  66. [FEAT_REG_FIRHINC] = { 12, 0 },
  67. [FEAT_REG_FIRVINC] = { 28, 16 },
  68. [FEAT_REG_FIFOLOWTHRESHOLD] = { 11, 0 },
  69. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 27, 16 },
  70. [FEAT_REG_FIFOSIZE] = { 10, 0 },
  71. [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
  72. [FEAT_REG_VERTICALACCU] = { 25, 16 },
  73. [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
  74. [FEAT_REG_DSIPLL_REGN] = { 7, 1 },
  75. [FEAT_REG_DSIPLL_REGM] = { 18, 8 },
  76. [FEAT_REG_DSIPLL_REGM_DISPC] = { 22, 19 },
  77. [FEAT_REG_DSIPLL_REGM_DSI] = { 26, 23 },
  78. };
  79. static const struct dss_reg_field omap4_dss_reg_fields[] = {
  80. [FEAT_REG_FIRHINC] = { 12, 0 },
  81. [FEAT_REG_FIRVINC] = { 28, 16 },
  82. [FEAT_REG_FIFOLOWTHRESHOLD] = { 15, 0 },
  83. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 31, 16 },
  84. [FEAT_REG_FIFOSIZE] = { 15, 0 },
  85. [FEAT_REG_HORIZONTALACCU] = { 10, 0 },
  86. [FEAT_REG_VERTICALACCU] = { 26, 16 },
  87. [FEAT_REG_DISPC_CLK_SWITCH] = { 9, 8 },
  88. [FEAT_REG_DSIPLL_REGN] = { 8, 1 },
  89. [FEAT_REG_DSIPLL_REGM] = { 20, 9 },
  90. [FEAT_REG_DSIPLL_REGM_DISPC] = { 25, 21 },
  91. [FEAT_REG_DSIPLL_REGM_DSI] = { 30, 26 },
  92. };
  93. static const enum omap_display_type omap2_dss_supported_displays[] = {
  94. /* OMAP_DSS_CHANNEL_LCD */
  95. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI,
  96. /* OMAP_DSS_CHANNEL_DIGIT */
  97. OMAP_DISPLAY_TYPE_VENC,
  98. };
  99. static const enum omap_display_type omap3430_dss_supported_displays[] = {
  100. /* OMAP_DSS_CHANNEL_LCD */
  101. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
  102. OMAP_DISPLAY_TYPE_SDI | OMAP_DISPLAY_TYPE_DSI,
  103. /* OMAP_DSS_CHANNEL_DIGIT */
  104. OMAP_DISPLAY_TYPE_VENC,
  105. };
  106. static const enum omap_display_type omap3630_dss_supported_displays[] = {
  107. /* OMAP_DSS_CHANNEL_LCD */
  108. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
  109. OMAP_DISPLAY_TYPE_DSI,
  110. /* OMAP_DSS_CHANNEL_DIGIT */
  111. OMAP_DISPLAY_TYPE_VENC,
  112. };
  113. static const enum omap_display_type omap4_dss_supported_displays[] = {
  114. /* OMAP_DSS_CHANNEL_LCD */
  115. OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI,
  116. /* OMAP_DSS_CHANNEL_DIGIT */
  117. OMAP_DISPLAY_TYPE_VENC | OMAP_DISPLAY_TYPE_HDMI,
  118. /* OMAP_DSS_CHANNEL_LCD2 */
  119. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
  120. OMAP_DISPLAY_TYPE_DSI,
  121. };
  122. static const enum omap_color_mode omap2_dss_supported_color_modes[] = {
  123. /* OMAP_DSS_GFX */
  124. OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
  125. OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
  126. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
  127. OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P,
  128. /* OMAP_DSS_VIDEO1 */
  129. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  130. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
  131. OMAP_DSS_COLOR_UYVY,
  132. /* OMAP_DSS_VIDEO2 */
  133. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  134. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
  135. OMAP_DSS_COLOR_UYVY,
  136. };
  137. static const enum omap_color_mode omap3_dss_supported_color_modes[] = {
  138. /* OMAP_DSS_GFX */
  139. OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
  140. OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
  141. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
  142. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  143. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
  144. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
  145. /* OMAP_DSS_VIDEO1 */
  146. OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P |
  147. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
  148. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_UYVY,
  149. /* OMAP_DSS_VIDEO2 */
  150. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
  151. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  152. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
  153. OMAP_DSS_COLOR_UYVY | OMAP_DSS_COLOR_ARGB32 |
  154. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
  155. };
  156. static const enum omap_color_mode omap4_dss_supported_color_modes[] = {
  157. /* OMAP_DSS_GFX */
  158. OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
  159. OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
  160. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
  161. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  162. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
  163. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32 |
  164. OMAP_DSS_COLOR_ARGB16_1555 | OMAP_DSS_COLOR_RGBX16 |
  165. OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_XRGB16_1555,
  166. /* OMAP_DSS_VIDEO1 */
  167. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
  168. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
  169. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
  170. OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
  171. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
  172. OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
  173. OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
  174. OMAP_DSS_COLOR_RGBX32,
  175. /* OMAP_DSS_VIDEO2 */
  176. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
  177. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
  178. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
  179. OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
  180. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
  181. OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
  182. OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
  183. OMAP_DSS_COLOR_RGBX32,
  184. /* OMAP_DSS_VIDEO3 */
  185. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
  186. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
  187. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
  188. OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
  189. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
  190. OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
  191. OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
  192. OMAP_DSS_COLOR_RGBX32,
  193. };
  194. static const enum omap_overlay_caps omap2_dss_overlay_caps[] = {
  195. /* OMAP_DSS_GFX */
  196. 0,
  197. /* OMAP_DSS_VIDEO1 */
  198. OMAP_DSS_OVL_CAP_SCALE,
  199. /* OMAP_DSS_VIDEO2 */
  200. OMAP_DSS_OVL_CAP_SCALE,
  201. };
  202. static const enum omap_overlay_caps omap3430_dss_overlay_caps[] = {
  203. /* OMAP_DSS_GFX */
  204. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
  205. /* OMAP_DSS_VIDEO1 */
  206. OMAP_DSS_OVL_CAP_SCALE,
  207. /* OMAP_DSS_VIDEO2 */
  208. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
  209. };
  210. static const enum omap_overlay_caps omap3630_dss_overlay_caps[] = {
  211. /* OMAP_DSS_GFX */
  212. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
  213. /* OMAP_DSS_VIDEO1 */
  214. OMAP_DSS_OVL_CAP_SCALE,
  215. /* OMAP_DSS_VIDEO2 */
  216. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  217. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
  218. };
  219. static const enum omap_overlay_caps omap4_dss_overlay_caps[] = {
  220. /* OMAP_DSS_GFX */
  221. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA |
  222. OMAP_DSS_OVL_CAP_ZORDER,
  223. /* OMAP_DSS_VIDEO1 */
  224. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  225. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
  226. /* OMAP_DSS_VIDEO2 */
  227. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  228. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
  229. /* OMAP_DSS_VIDEO3 */
  230. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  231. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
  232. };
  233. static const char * const omap2_dss_clk_source_names[] = {
  234. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "N/A",
  235. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "N/A",
  236. [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK1",
  237. };
  238. static const char * const omap3_dss_clk_source_names[] = {
  239. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DSI1_PLL_FCLK",
  240. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DSI2_PLL_FCLK",
  241. [OMAP_DSS_CLK_SRC_FCK] = "DSS1_ALWON_FCLK",
  242. };
  243. static const char * const omap4_dss_clk_source_names[] = {
  244. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "PLL1_CLK1",
  245. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "PLL1_CLK2",
  246. [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK",
  247. [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "PLL2_CLK1",
  248. [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "PLL2_CLK2",
  249. };
  250. static const struct dss_param_range omap2_dss_param_range[] = {
  251. [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
  252. [FEAT_PARAM_DSS_PCD] = { 2, 255 },
  253. [FEAT_PARAM_DSIPLL_REGN] = { 0, 0 },
  254. [FEAT_PARAM_DSIPLL_REGM] = { 0, 0 },
  255. [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, 0 },
  256. [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, 0 },
  257. [FEAT_PARAM_DSIPLL_FINT] = { 0, 0 },
  258. [FEAT_PARAM_DSIPLL_LPDIV] = { 0, 0 },
  259. [FEAT_PARAM_DOWNSCALE] = { 1, 2 },
  260. /*
  261. * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
  262. * scaler cannot scale a image with width more than 768.
  263. */
  264. [FEAT_PARAM_LINEWIDTH] = { 1, 768 },
  265. };
  266. static const struct dss_param_range omap3_dss_param_range[] = {
  267. [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
  268. [FEAT_PARAM_DSS_PCD] = { 1, 255 },
  269. [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 7) - 1 },
  270. [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 11) - 1 },
  271. [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 4) - 1 },
  272. [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 4) - 1 },
  273. [FEAT_PARAM_DSIPLL_FINT] = { 750000, 2100000 },
  274. [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1},
  275. [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
  276. [FEAT_PARAM_LINEWIDTH] = { 1, 1024 },
  277. };
  278. static const struct dss_param_range omap4_dss_param_range[] = {
  279. [FEAT_PARAM_DSS_FCK] = { 0, 186000000 },
  280. [FEAT_PARAM_DSS_PCD] = { 1, 255 },
  281. [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
  282. [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
  283. [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 },
  284. [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 },
  285. [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 },
  286. [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
  287. [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
  288. [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
  289. };
  290. static const enum dss_feat_id omap2_dss_feat_list[] = {
  291. FEAT_LCDENABLEPOL,
  292. FEAT_LCDENABLESIGNAL,
  293. FEAT_PCKFREEENABLE,
  294. FEAT_FUNCGATED,
  295. FEAT_ROWREPEATENABLE,
  296. FEAT_RESIZECONF,
  297. };
  298. static const enum dss_feat_id omap3430_dss_feat_list[] = {
  299. FEAT_LCDENABLEPOL,
  300. FEAT_LCDENABLESIGNAL,
  301. FEAT_PCKFREEENABLE,
  302. FEAT_FUNCGATED,
  303. FEAT_LINEBUFFERSPLIT,
  304. FEAT_ROWREPEATENABLE,
  305. FEAT_RESIZECONF,
  306. FEAT_DSI_PLL_FREQSEL,
  307. FEAT_DSI_REVERSE_TXCLKESC,
  308. FEAT_VENC_REQUIRES_TV_DAC_CLK,
  309. FEAT_CPR,
  310. FEAT_PRELOAD,
  311. FEAT_FIR_COEF_V,
  312. FEAT_ALPHA_FIXED_ZORDER,
  313. FEAT_FIFO_MERGE,
  314. FEAT_OMAP3_DSI_FIFO_BUG,
  315. };
  316. static const enum dss_feat_id omap3630_dss_feat_list[] = {
  317. FEAT_LCDENABLEPOL,
  318. FEAT_LCDENABLESIGNAL,
  319. FEAT_PCKFREEENABLE,
  320. FEAT_FUNCGATED,
  321. FEAT_LINEBUFFERSPLIT,
  322. FEAT_ROWREPEATENABLE,
  323. FEAT_RESIZECONF,
  324. FEAT_DSI_PLL_PWR_BUG,
  325. FEAT_DSI_PLL_FREQSEL,
  326. FEAT_CPR,
  327. FEAT_PRELOAD,
  328. FEAT_FIR_COEF_V,
  329. FEAT_ALPHA_FIXED_ZORDER,
  330. FEAT_FIFO_MERGE,
  331. FEAT_OMAP3_DSI_FIFO_BUG,
  332. };
  333. static const enum dss_feat_id omap4430_es1_0_dss_feat_list[] = {
  334. FEAT_MGR_LCD2,
  335. FEAT_CORE_CLK_DIV,
  336. FEAT_LCD_CLK_SRC,
  337. FEAT_DSI_DCS_CMD_CONFIG_VC,
  338. FEAT_DSI_VC_OCP_WIDTH,
  339. FEAT_DSI_GNQ,
  340. FEAT_HANDLE_UV_SEPARATE,
  341. FEAT_ATTR2,
  342. FEAT_CPR,
  343. FEAT_PRELOAD,
  344. FEAT_FIR_COEF_V,
  345. FEAT_ALPHA_FREE_ZORDER,
  346. FEAT_FIFO_MERGE,
  347. };
  348. static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = {
  349. FEAT_MGR_LCD2,
  350. FEAT_CORE_CLK_DIV,
  351. FEAT_LCD_CLK_SRC,
  352. FEAT_DSI_DCS_CMD_CONFIG_VC,
  353. FEAT_DSI_VC_OCP_WIDTH,
  354. FEAT_DSI_GNQ,
  355. FEAT_HDMI_CTS_SWMODE,
  356. FEAT_HANDLE_UV_SEPARATE,
  357. FEAT_ATTR2,
  358. FEAT_CPR,
  359. FEAT_PRELOAD,
  360. FEAT_FIR_COEF_V,
  361. FEAT_ALPHA_FREE_ZORDER,
  362. FEAT_FIFO_MERGE,
  363. };
  364. static const enum dss_feat_id omap4_dss_feat_list[] = {
  365. FEAT_MGR_LCD2,
  366. FEAT_CORE_CLK_DIV,
  367. FEAT_LCD_CLK_SRC,
  368. FEAT_DSI_DCS_CMD_CONFIG_VC,
  369. FEAT_DSI_VC_OCP_WIDTH,
  370. FEAT_DSI_GNQ,
  371. FEAT_HDMI_CTS_SWMODE,
  372. FEAT_HDMI_AUDIO_USE_MCLK,
  373. FEAT_HANDLE_UV_SEPARATE,
  374. FEAT_ATTR2,
  375. FEAT_CPR,
  376. FEAT_PRELOAD,
  377. FEAT_FIR_COEF_V,
  378. FEAT_ALPHA_FREE_ZORDER,
  379. FEAT_FIFO_MERGE,
  380. };
  381. /* OMAP2 DSS Features */
  382. static const struct omap_dss_features omap2_dss_features = {
  383. .reg_fields = omap2_dss_reg_fields,
  384. .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields),
  385. .features = omap2_dss_feat_list,
  386. .num_features = ARRAY_SIZE(omap2_dss_feat_list),
  387. .num_mgrs = 2,
  388. .num_ovls = 3,
  389. .supported_displays = omap2_dss_supported_displays,
  390. .supported_color_modes = omap2_dss_supported_color_modes,
  391. .overlay_caps = omap2_dss_overlay_caps,
  392. .clksrc_names = omap2_dss_clk_source_names,
  393. .dss_params = omap2_dss_param_range,
  394. .buffer_size_unit = 1,
  395. .burst_size_unit = 8,
  396. };
  397. /* OMAP3 DSS Features */
  398. static const struct omap_dss_features omap3430_dss_features = {
  399. .reg_fields = omap3_dss_reg_fields,
  400. .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
  401. .features = omap3430_dss_feat_list,
  402. .num_features = ARRAY_SIZE(omap3430_dss_feat_list),
  403. .num_mgrs = 2,
  404. .num_ovls = 3,
  405. .supported_displays = omap3430_dss_supported_displays,
  406. .supported_color_modes = omap3_dss_supported_color_modes,
  407. .overlay_caps = omap3430_dss_overlay_caps,
  408. .clksrc_names = omap3_dss_clk_source_names,
  409. .dss_params = omap3_dss_param_range,
  410. .buffer_size_unit = 1,
  411. .burst_size_unit = 8,
  412. };
  413. static const struct omap_dss_features omap3630_dss_features = {
  414. .reg_fields = omap3_dss_reg_fields,
  415. .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
  416. .features = omap3630_dss_feat_list,
  417. .num_features = ARRAY_SIZE(omap3630_dss_feat_list),
  418. .num_mgrs = 2,
  419. .num_ovls = 3,
  420. .supported_displays = omap3630_dss_supported_displays,
  421. .supported_color_modes = omap3_dss_supported_color_modes,
  422. .overlay_caps = omap3630_dss_overlay_caps,
  423. .clksrc_names = omap3_dss_clk_source_names,
  424. .dss_params = omap3_dss_param_range,
  425. .buffer_size_unit = 1,
  426. .burst_size_unit = 8,
  427. };
  428. /* OMAP4 DSS Features */
  429. /* For OMAP4430 ES 1.0 revision */
  430. static const struct omap_dss_features omap4430_es1_0_dss_features = {
  431. .reg_fields = omap4_dss_reg_fields,
  432. .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
  433. .features = omap4430_es1_0_dss_feat_list,
  434. .num_features = ARRAY_SIZE(omap4430_es1_0_dss_feat_list),
  435. .num_mgrs = 3,
  436. .num_ovls = 4,
  437. .supported_displays = omap4_dss_supported_displays,
  438. .supported_color_modes = omap4_dss_supported_color_modes,
  439. .overlay_caps = omap4_dss_overlay_caps,
  440. .clksrc_names = omap4_dss_clk_source_names,
  441. .dss_params = omap4_dss_param_range,
  442. .buffer_size_unit = 16,
  443. .burst_size_unit = 16,
  444. };
  445. /* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
  446. static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
  447. .reg_fields = omap4_dss_reg_fields,
  448. .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
  449. .features = omap4430_es2_0_1_2_dss_feat_list,
  450. .num_features = ARRAY_SIZE(omap4430_es2_0_1_2_dss_feat_list),
  451. .num_mgrs = 3,
  452. .num_ovls = 4,
  453. .supported_displays = omap4_dss_supported_displays,
  454. .supported_color_modes = omap4_dss_supported_color_modes,
  455. .overlay_caps = omap4_dss_overlay_caps,
  456. .clksrc_names = omap4_dss_clk_source_names,
  457. .dss_params = omap4_dss_param_range,
  458. .buffer_size_unit = 16,
  459. .burst_size_unit = 16,
  460. };
  461. /* For all the other OMAP4 versions */
  462. static const struct omap_dss_features omap4_dss_features = {
  463. .reg_fields = omap4_dss_reg_fields,
  464. .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
  465. .features = omap4_dss_feat_list,
  466. .num_features = ARRAY_SIZE(omap4_dss_feat_list),
  467. .num_mgrs = 3,
  468. .num_ovls = 4,
  469. .supported_displays = omap4_dss_supported_displays,
  470. .supported_color_modes = omap4_dss_supported_color_modes,
  471. .overlay_caps = omap4_dss_overlay_caps,
  472. .clksrc_names = omap4_dss_clk_source_names,
  473. .dss_params = omap4_dss_param_range,
  474. .buffer_size_unit = 16,
  475. .burst_size_unit = 16,
  476. };
  477. #if defined(CONFIG_OMAP4_DSS_HDMI)
  478. /* HDMI OMAP4 Functions*/
  479. static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
  480. .video_configure = ti_hdmi_4xxx_basic_configure,
  481. .phy_enable = ti_hdmi_4xxx_phy_enable,
  482. .phy_disable = ti_hdmi_4xxx_phy_disable,
  483. .read_edid = ti_hdmi_4xxx_read_edid,
  484. .detect = ti_hdmi_4xxx_detect,
  485. .pll_enable = ti_hdmi_4xxx_pll_enable,
  486. .pll_disable = ti_hdmi_4xxx_pll_disable,
  487. .video_enable = ti_hdmi_4xxx_wp_video_start,
  488. .dump_wrapper = ti_hdmi_4xxx_wp_dump,
  489. .dump_core = ti_hdmi_4xxx_core_dump,
  490. .dump_pll = ti_hdmi_4xxx_pll_dump,
  491. .dump_phy = ti_hdmi_4xxx_phy_dump,
  492. #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
  493. defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
  494. .audio_enable = ti_hdmi_4xxx_wp_audio_enable,
  495. #endif
  496. };
  497. void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
  498. {
  499. if (cpu_is_omap44xx())
  500. ip_data->ops = &omap4_hdmi_functions;
  501. }
  502. #endif
  503. /* Functions returning values related to a DSS feature */
  504. int dss_feat_get_num_mgrs(void)
  505. {
  506. return omap_current_dss_features->num_mgrs;
  507. }
  508. int dss_feat_get_num_ovls(void)
  509. {
  510. return omap_current_dss_features->num_ovls;
  511. }
  512. unsigned long dss_feat_get_param_min(enum dss_range_param param)
  513. {
  514. return omap_current_dss_features->dss_params[param].min;
  515. }
  516. unsigned long dss_feat_get_param_max(enum dss_range_param param)
  517. {
  518. return omap_current_dss_features->dss_params[param].max;
  519. }
  520. enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel)
  521. {
  522. return omap_current_dss_features->supported_displays[channel];
  523. }
  524. enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane)
  525. {
  526. return omap_current_dss_features->supported_color_modes[plane];
  527. }
  528. enum omap_overlay_caps dss_feat_get_overlay_caps(enum omap_plane plane)
  529. {
  530. return omap_current_dss_features->overlay_caps[plane];
  531. }
  532. bool dss_feat_color_mode_supported(enum omap_plane plane,
  533. enum omap_color_mode color_mode)
  534. {
  535. return omap_current_dss_features->supported_color_modes[plane] &
  536. color_mode;
  537. }
  538. const char *dss_feat_get_clk_source_name(enum omap_dss_clk_source id)
  539. {
  540. return omap_current_dss_features->clksrc_names[id];
  541. }
  542. u32 dss_feat_get_buffer_size_unit(void)
  543. {
  544. return omap_current_dss_features->buffer_size_unit;
  545. }
  546. u32 dss_feat_get_burst_size_unit(void)
  547. {
  548. return omap_current_dss_features->burst_size_unit;
  549. }
  550. /* DSS has_feature check */
  551. bool dss_has_feature(enum dss_feat_id id)
  552. {
  553. int i;
  554. const enum dss_feat_id *features = omap_current_dss_features->features;
  555. const int num_features = omap_current_dss_features->num_features;
  556. for (i = 0; i < num_features; i++) {
  557. if (features[i] == id)
  558. return true;
  559. }
  560. return false;
  561. }
  562. void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
  563. {
  564. if (id >= omap_current_dss_features->num_reg_fields)
  565. BUG();
  566. *start = omap_current_dss_features->reg_fields[id].start;
  567. *end = omap_current_dss_features->reg_fields[id].end;
  568. }
  569. void dss_features_init(void)
  570. {
  571. if (cpu_is_omap24xx())
  572. omap_current_dss_features = &omap2_dss_features;
  573. else if (cpu_is_omap3630())
  574. omap_current_dss_features = &omap3630_dss_features;
  575. else if (cpu_is_omap34xx())
  576. omap_current_dss_features = &omap3430_dss_features;
  577. else if (omap_rev() == OMAP4430_REV_ES1_0)
  578. omap_current_dss_features = &omap4430_es1_0_dss_features;
  579. else if (omap_rev() == OMAP4430_REV_ES2_0 ||
  580. omap_rev() == OMAP4430_REV_ES2_1 ||
  581. omap_rev() == OMAP4430_REV_ES2_2)
  582. omap_current_dss_features = &omap4430_es2_0_1_2_dss_features;
  583. else if (cpu_is_omap44xx())
  584. omap_current_dss_features = &omap4_dss_features;
  585. else
  586. DSSWARN("Unsupported OMAP version");
  587. }